Files
LangBot/sdk/docs/certified-plugins.md
0d84c334ba feat(sdk): move the plugin SDK into the monorepo with independent releases (LANG-420) (#2993)
* chore(sdk): import langbot-plugin-sdk v0.7.24 snapshot into sdk/ (LANG-420)

Snapshot of langbot-app/langbot-plugin-sdk at 76443bb8 (tag v0.7.24),
without history. The repository's .github/ workflows are not imported;
they are replaced by sdk-*.yml workflows in the next commit. The root
.gitignore keeps the template .vscode/launch.json.example tracked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(sdk): move the plugin SDK into the monorepo with independent releases (LANG-420)

- CI: sdk-tests.yml / sdk-box-docker.yml run the SDK suite from sdk/ in
  its own environment (Python 3.10-3.12); run-tests.yml gains a
  "Core with in-tree SDK" job that overlays sdk/ on Core's venv.
- Releases: sdk-publish.yml publishes langbot-plugin from sdk/vX.Y.Z tag
  pushes and never creates a GitHub Release. Core release workflows now
  only accept v* tags, and scripts/check_sdk_release_pin.py blocks a Core
  PyPI/Docker release whose langbot-plugin pin differs from the released,
  unchanged sdk/.
- Packaging: Core still installs the PyPI pin. Core wheel/sdist, git
  export, Docker context, release ZIP and fnOS package exclude sdk/.
- Generator/tests: generate_plugin_workspace_api.py writes sdk/ directly;
  the SDK's generator drift tests now run instead of skipping.
- Docs: AGENTS/ARCHITECTURE, sdk/ guides (+ RELEASING.md, SOURCE.json),
  agent skills and lbs probes, public docs (zh/en/ja) and dev-docs
  point at sdk/ instead of the sibling langbot-plugin-sdk checkout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-11-11 23:12:53 +08:00

4.3 KiB

Certified Plugin Archives

langbot_plugin.certification provides an opt-in archive certification format only for Cloud cross-tenant sharing of the same Worker and the same plugin/component singleton. It does not change lbp build output: unsigned .lbpkg archives retain an empty ZIP comment and verify as absent; Cloud installs them on dedicated Workers. There is no dedicated certificate or intermediate trust tier.

Manifest runtime profile

A plugin manifest may opt into the certified shared-runtime profile only with:

execution:
  python:
    path: main.py
    attr: Plugin
  sharedRuntime: shared-runtime-v1
  componentModel: stateless-v1

If execution.sharedRuntime is absent, the manifest remains a dedicated-runtime manifest. shared-runtime-v1 requires componentModel: stateless-v1; this declares the stateless singleton component contract. Legacy per-installation object behavior remains compatible on dedicated workers but is not certifiable.

Envelope format

The envelope is compact, sorted UTF-8 JSON in the ZIP comment. New stateless certificates use certified-plugin-envelope-v2 with exactly these fields. Legacy v1 envelopes remain readable and verifiable, but have no signed component_model and cannot authorize shared singleton placement.

{
  "schema": "certified-plugin-envelope-v2",
  "key_id": "issuer-key-id",
  "plugin_id": {"author": "publisher", "name": "plugin"},
  "version": "1.2.3",
  "digest": "lowercase-sha256-hex",
  "shared_runtime": "shared-runtime-v1",
  "component_model": "stateless-v1",
  "signature": "base64-signature"
}

New v2 envelopes require shared_runtime: shared-runtime-v1 and component_model: stateless-v1. Dedicated manifests must remain unsigned; historical v2 envelopes with null claims do not verify as certification. Older v1 schemas may carry null claims, but cannot grant Cloud sharing or be treated as unsigned. The digest is SHA-256 of the original ZIP bytes with only its ZIP comment removed, so adding or replacing the envelope does not change the signed digest. ZIP comments are limited to 16 KiB; archive manifests are read without extraction and limited to 1 MiB.

Signing and verification

The module is algorithm-neutral and does not add a cryptography dependency. Supply the signing callback and a trusted-key resolver from the deployment that owns issuer keys. Cloud issuers use Ed25519. OSS ships without a built-in issuer public key, supports one Workspace, and does not support configuring a certification key or shared-certified execution. Do not use the test-only HMAC pattern as a trust boundary.

from langbot_plugin.certification import create_envelope, verify_archive, write_envelope

# signer(payload: bytes) -> bytes signs with the issuer's private key.
envelope = create_envelope(archive_bytes, "issuer-key-id", signer)
certified_archive = write_envelope(archive_bytes, envelope)

# key_resolver(key_id) -> verifier | None, where verifier(payload, signature) -> bool.
result = verify_archive(certified_archive, key_resolver)
if result.status != "valid":
    raise ValueError(result.status)

Verification binds the envelope's plugin_id.author, plugin_id.name, version, normalized digest, shared_runtime, and component_model to manifest.yaml. Legacy v1 signatures can still verify cryptographically but never grant singleton sharing because they lack the signed stateless-v1 claim. Malformed or untrusted signatures are not unsigned archives and Cloud must reject them. Verification alone is not placement: compare the exact downloaded artifact, public version record and deployed Core trust ring. A reviewed source candidate, issued badge, or shared code/dependency tree does not prove a live shared Worker.

Verification statuses

  • absent: no ZIP comment; legacy archive.
  • valid: envelope, signature, digest, and manifest bindings all match.
  • malformed: invalid ZIP comment or malformed envelope.
  • unknown_key: the configured resolver does not trust key_id.
  • signature_invalid: the trusted key rejected the envelope signature.
  • digest_mismatch: archive bytes outside the ZIP comment changed.
  • manifest_mismatch: the signed identity or runtime profile differs from manifest.yaml.
  • unsupported_schema: a well-formed envelope uses an unsupported schema.