sealbridge 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.ja.md +6 -4
  2. package/README.md +9 -4
  3. package/dist/cli/dist/accept.d.ts +2 -1
  4. package/dist/cli/dist/accept.js +18 -7
  5. package/dist/cli/dist/accept.js.map +1 -1
  6. package/dist/cli/dist/index.js +46 -13
  7. package/dist/cli/dist/index.js.map +1 -1
  8. package/dist/cli/dist/invite-links.d.ts +14 -0
  9. package/dist/cli/dist/invite-links.js +263 -0
  10. package/dist/cli/dist/invite-links.js.map +1 -0
  11. package/dist/cli/dist/invite-output.d.ts +1 -1
  12. package/dist/cli/dist/invite-output.js +3 -2
  13. package/dist/cli/dist/invite-output.js.map +1 -1
  14. package/dist/cli/dist/network.js +16 -23
  15. package/dist/cli/dist/network.js.map +1 -1
  16. package/dist/cli/dist/receipt.d.ts +12 -2
  17. package/dist/cli/dist/receipt.js +6 -5
  18. package/dist/cli/dist/receipt.js.map +1 -1
  19. package/dist/cli/dist/sdk.d.ts +6 -4
  20. package/dist/cli/dist/sdk.js +3 -2
  21. package/dist/cli/dist/sdk.js.map +1 -1
  22. package/dist/cli/dist/task-review.d.ts +1 -8
  23. package/dist/cli/dist/task-review.js +4 -17
  24. package/dist/cli/dist/task-review.js.map +1 -1
  25. package/dist/cli/dist/tasks.js +1 -1
  26. package/dist/cli/dist/tasks.js.map +1 -1
  27. package/dist/examples/two-owner-demo/dist/run-demo.js +3 -1
  28. package/dist/examples/two-owner-demo/dist/run-demo.js.map +1 -1
  29. package/dist/package.json +1 -1
  30. package/dist/packages/core/dist/content-inspection-rules.d.ts +22 -0
  31. package/dist/packages/core/dist/content-inspection-rules.js +34 -0
  32. package/dist/packages/core/dist/content-inspection-rules.js.map +1 -0
  33. package/dist/packages/core/dist/content-inspection.d.ts +43 -0
  34. package/dist/packages/core/dist/content-inspection.js +192 -0
  35. package/dist/packages/core/dist/content-inspection.js.map +1 -0
  36. package/dist/packages/core/dist/context-grant.d.ts +13 -0
  37. package/dist/packages/core/dist/context-grant.js +65 -0
  38. package/dist/packages/core/dist/context-grant.js.map +1 -0
  39. package/dist/packages/core/dist/delegation.d.ts +17 -0
  40. package/dist/packages/core/dist/delegation.js +126 -0
  41. package/dist/packages/core/dist/delegation.js.map +1 -0
  42. package/dist/packages/core/dist/edge.d.ts +2 -0
  43. package/dist/packages/core/dist/edge.js +2 -0
  44. package/dist/packages/core/dist/edge.js.map +1 -1
  45. package/dist/packages/core/dist/index.d.ts +6 -0
  46. package/dist/packages/core/dist/index.js +6 -0
  47. package/dist/packages/core/dist/index.js.map +1 -1
  48. package/dist/packages/core/dist/invite-link.d.ts +72 -0
  49. package/dist/packages/core/dist/invite-link.js +225 -0
  50. package/dist/packages/core/dist/invite-link.js.map +1 -0
  51. package/dist/packages/core/dist/invite-sas.d.ts +7 -0
  52. package/dist/packages/core/dist/invite-sas.js +15 -0
  53. package/dist/packages/core/dist/invite-sas.js.map +1 -0
  54. package/dist/packages/core/dist/relay-auth.d.ts +1 -1
  55. package/dist/packages/core/dist/relay-auth.js +1 -1
  56. package/dist/packages/core/dist/relay-auth.js.map +1 -1
  57. package/dist/packages/core/dist/schema.d.ts +1 -1
  58. package/dist/packages/core/dist/schema.js +4 -0
  59. package/dist/packages/core/dist/schema.js.map +1 -1
  60. package/dist/packages/core/dist/types.d.ts +52 -0
  61. package/dist/packages/ledger/dist/index.d.ts +70 -2
  62. package/dist/packages/ledger/dist/index.js +404 -26
  63. package/dist/packages/ledger/dist/index.js.map +1 -1
  64. package/dist/packages/relay/dist/fetch.js +4 -0
  65. package/dist/packages/relay/dist/fetch.js.map +1 -1
  66. package/dist/packages/relay/dist/invites.d.ts +42 -0
  67. package/dist/packages/relay/dist/invites.js +347 -0
  68. package/dist/packages/relay/dist/invites.js.map +1 -0
  69. package/dist/packages/relay/dist/worker.d.ts +3 -0
  70. package/dist/packages/relay/dist/worker.js +21 -0
  71. package/dist/packages/relay/dist/worker.js.map +1 -1
  72. package/dist/packages/runtime/dist/a2a.js +1 -1
  73. package/dist/packages/runtime/dist/adapter.d.ts +1 -0
  74. package/dist/packages/runtime/dist/application-config.js +69 -6
  75. package/dist/packages/runtime/dist/application-config.js.map +1 -1
  76. package/dist/packages/runtime/dist/approval-providers.d.ts +4 -0
  77. package/dist/packages/runtime/dist/approval-providers.js +3 -0
  78. package/dist/packages/runtime/dist/approval-providers.js.map +1 -1
  79. package/dist/packages/runtime/dist/connection-persistence.d.ts +1 -1
  80. package/dist/packages/runtime/dist/context-grant-audit.d.ts +8 -0
  81. package/dist/packages/runtime/dist/context-grant-audit.js +41 -0
  82. package/dist/packages/runtime/dist/context-grant-audit.js.map +1 -0
  83. package/dist/packages/runtime/dist/delegation.d.ts +37 -0
  84. package/dist/packages/runtime/dist/delegation.js +125 -0
  85. package/dist/packages/runtime/dist/delegation.js.map +1 -0
  86. package/dist/packages/runtime/dist/gateway.d.ts +1 -0
  87. package/dist/packages/runtime/dist/gateway.js.map +1 -1
  88. package/dist/packages/runtime/dist/held-request-store.d.ts +2 -0
  89. package/dist/packages/runtime/dist/held-request-store.js +3 -2
  90. package/dist/packages/runtime/dist/held-request-store.js.map +1 -1
  91. package/dist/packages/runtime/dist/held-task-content.d.ts +14 -0
  92. package/dist/packages/runtime/dist/held-task-content.js +33 -0
  93. package/dist/packages/runtime/dist/held-task-content.js.map +1 -0
  94. package/dist/packages/runtime/dist/index.d.ts +4 -0
  95. package/dist/packages/runtime/dist/index.js +4 -0
  96. package/dist/packages/runtime/dist/index.js.map +1 -1
  97. package/dist/packages/runtime/dist/mcp-server.js +22 -8
  98. package/dist/packages/runtime/dist/mcp-server.js.map +1 -1
  99. package/dist/packages/runtime/dist/mcp-tool-catalog.js +44 -5
  100. package/dist/packages/runtime/dist/mcp-tool-catalog.js.map +1 -1
  101. package/dist/packages/runtime/dist/rule-content-review-child.d.ts +1 -0
  102. package/dist/packages/runtime/dist/rule-content-review-child.js +25 -0
  103. package/dist/packages/runtime/dist/rule-content-review-child.js.map +1 -0
  104. package/dist/packages/runtime/dist/rule-content-review.d.ts +9 -0
  105. package/dist/packages/runtime/dist/rule-content-review.js +217 -0
  106. package/dist/packages/runtime/dist/rule-content-review.js.map +1 -0
  107. package/dist/packages/runtime/dist/session-audit.d.ts +6 -1
  108. package/dist/packages/runtime/dist/session-audit.js +35 -4
  109. package/dist/packages/runtime/dist/session-audit.js.map +1 -1
  110. package/dist/packages/runtime/dist/session.d.ts +21 -1
  111. package/dist/packages/runtime/dist/session.js +429 -63
  112. package/dist/packages/runtime/dist/session.js.map +1 -1
  113. package/dist/packages/runtime/dist/task-journal.d.ts +10 -1
  114. package/dist/packages/runtime/dist/task-journal.js +26 -1
  115. package/dist/packages/runtime/dist/task-journal.js.map +1 -1
  116. package/dist/packages/runtime/dist/verifier.d.ts +5 -2
  117. package/dist/packages/runtime/dist/verifier.js +14 -4
  118. package/dist/packages/runtime/dist/verifier.js.map +1 -1
  119. package/dist/spec/audit-entry.schema.json +25 -1
  120. package/dist/spec/audit-evidence.schema.json +179 -0
  121. package/dist/spec/audit-file-record.schema.json +177 -0
  122. package/dist/spec/audit-interruption.schema.json +110 -0
  123. package/dist/spec/context-grant-audit-payload.schema.json +24 -0
  124. package/dist/spec/context-grant.schema.json +146 -0
  125. package/dist/spec/delegation-attachment.schema.json +167 -0
  126. package/dist/spec/delegation-link.schema.json +141 -0
  127. package/dist/spec/examples/context-pooling/approval_redelegation/sample-delegation-attachment.json +413 -0
  128. package/dist/spec/examples/context-pooling/hand_over/sample-context-grant.json +18 -0
  129. package/dist/spec/examples/context-pooling/hand_over/sample-task-manifest.0.2.0.json +94 -0
  130. package/dist/spec/examples/context-pooling/sample-context-grant-audit-payload.json +4 -0
  131. package/dist/spec/examples/context-pooling/view_only/sample-context-grant.json +18 -0
  132. package/dist/spec/examples/context-pooling/view_only/sample-task-manifest.0.2.0.json +94 -0
  133. package/dist/spec/examples/sample-audit-evidence.json +138 -0
  134. package/dist/spec/examples/sample-audit-file-record.json +31 -0
  135. package/dist/spec/examples/sample-audit-interruption.json +29 -0
  136. package/dist/spec/task-manifest.0.2.0.schema.json +87 -1
  137. package/docs/context-grants.md +221 -0
  138. package/docs/sdk.ja.md +108 -2
  139. package/docs/sdk.md +120 -2
  140. package/package.json +3 -2
package/docs/sdk.md CHANGED
@@ -39,10 +39,12 @@ All values are direct re-exports of existing implementations, without wrappers.
39
39
  | Connection metadata | `WorkerTrustStore` (including `listConnections`), `workerIntakePath` |
40
40
  | Connection exchange | `ConnectionService`, `ConnectionRouter`, `StoredConnectionExchange`, `syncConnections` |
41
41
  | Owner confirmation command | `connectionsCommand`, `connectionHumanReview` |
42
- | Held review | `ConnectionAdmissionReview`, `HeldRequestReview`, `unavailableHeldContentReviewProvider` |
42
+ | Held review | `ConnectionAdmissionReview`, `HeldRequestReview`, `unavailableHeldContentReviewProvider`, `createRuleBasedContentReviewProvider` |
43
+ | Verified task content | `taskContent` |
43
44
  | Discovery and invitations | `createSignedAgentCard`, `verifySignedAgentCard`, `createInviteToken`, `inviteTokenFromUri`, `isInviteTarget`, `parseAndVerifyInviteToken`, `discoverAgentCards`, `findDiscoveredAgentCard` |
44
45
  | Key creation | `generateKeyPair` |
45
46
  | MCP hosting | `AcpMcpServer`, `mcpServerCommand`, `parseMcpServerArgs`, `mcpServerOptionsFromArgs` |
47
+ | Content rules | `inspectRuleContent`, `CONTENT_INSPECTION_RULES`, `CONTENT_INSPECTION_RULESET_VERSION`, `CONTENT_INSPECTION_RULESET_DIGEST`, `CONTENT_INSPECTION_LIMITS` |
46
48
 
47
49
  Named type exports:
48
50
 
@@ -60,7 +62,7 @@ Named type exports:
60
62
  `ConnectionRouterOptions`, `ConnectedEvent`, `ConnectionsCommandOptions`.
61
63
  - Review: `HeldRequestReviewOptions`, `HeldContentReviewProvider`,
62
64
  `HeldInspectionContext`, `InspectionCompletion`, `ConnectionAdmissionReviewOptions`,
63
- `InboundConnectionSummary`.
65
+ `InboundConnectionSummary`, `HeldTaskContent`.
64
66
  - MCP: `AcpMcpServerOptions`, `ApprovalProvider`, `ParsedMcpServerArgs`.
65
67
  - Core/transport: `KeyPair`, `Json`, `Signed`, `SignedEnvelope`, `Invite`,
66
68
  `AgentSkill`, `DiscoveryAgentCard`, `CreateAgentCardOptions`, `SignedAgentCard`,
@@ -134,6 +136,34 @@ inbound connections. Bind decisions to explicit owner actions. Its
134
136
  names are informational data. Built-in inspection covers connection metadata only.
135
137
  See [owner admission review](connections/admission.md#owner-admission-review).
136
138
 
139
+ ## Verified held task content
140
+
141
+ `taskContent(envelope, owner, contentDigest, envelopeDigest?)` returns a
142
+ `HeldTaskContent` containing only `{manifest, input, capabilityChains}`;
143
+ capabilities default to `[]`. It verifies the outer signature and recipient before
144
+ decrypting, requires encrypted content and an own `input` field, validates the
145
+ manifest and signed proposal, and checks PROPOSE/sequence-zero, task, requester,
146
+ worker-owner and content-digest bindings. Supply the held record's `envelopeDigest`
147
+ to also bind the exact envelope. Invitation, connection and transport fields are
148
+ excluded. The three-argument form remains supported, including the existing CLI
149
+ deep import of `taskContent`.
150
+
151
+ The result is sensitive plaintext in memory. Keep it out of logs and persistent
152
+ storage; render it as literal data. Owner-facing display callers must separately
153
+ require completed review through `HeldRequestReview` (including its owner/content/
154
+ envelope-bound receipt); extraction itself does not check inspection or authorize
155
+ opening, connection consent or execution. Inspection providers may use the helper
156
+ while inspecting content. It does not validate capability-chain authority, trust,
157
+ or current grant/deadline usability. Expired terminal task content can still be
158
+ verified; live admission retains its separate checks. This is structural and
159
+ cryptographic verification, not a content heuristic or assessment.
160
+
161
+ Verification failures use `INVALID_PROPOSAL`; encrypted-input failures retain
162
+ `UNENCRYPTED_ENVELOPE_REJECTED` or `ENVELOPE_DECRYPTION_FAILED`. Schema and native
163
+ parser details are excluded. The helper creates no inspection receipt, writes no
164
+ files and makes no network requests. Protocol, schemas, required fields and stored
165
+ record formats are unchanged. See [held-content review](connections/held-content.md).
166
+
137
167
  ## MCP lifecycle
138
168
 
139
169
  In a dedicated stdio MCP process, `mcpServerCommand(args, identityOptions)` runs the
@@ -143,3 +173,91 @@ existing CLI lifecycle. For host-owned streams, construct `AcpMcpServer`, call
143
173
  inject an `approvalProvider`; the unflagged policy-auto default is unchanged.
144
174
  Approval before sending and final verification remain separate. Connection review
145
175
  is a separate `connectionReview` option. See [MCP integration](../README.md#mcp-live-progress-revocation-and-quorum).
176
+
177
+ ## Audit evidence
178
+
179
+ `parseJsonl` / `verifyAudit` retain their bilateral-only contracts. Use `parseAuditJsonl` / `verifyAuditEvidence` for the `AuditEvidence` union (`AuditBundle | InterruptedAuditBundle`). Worker-only format-1 terminals return `UNILATERALLY_CLOSED` with `valid:false`, even with matching external pins; ordinary result APIs still require bilateral bundles. `createAuditInterruption`, the interruption-aware stores, and public evidence types are exported from `sealbridge/sdk`. See [storage, pins, durability, and requester comparison rules](audit-interruption.md).
180
+
181
+ ## Opt-in offline content rules
182
+
183
+ `inspectRuleContent({manifest,input,capabilityChains?}, limits?, signal?)` is the
184
+ in-memory core scanner. `RuleInspectionInput`, `RuleInspectionOptions`,
185
+ `RuleInspectionRule`, `RuleInspectionKind`, `RuleInspectionFinding`,
186
+ `RuleInspectionDiagnosticCode`, `RuleInspectionReport`, and
187
+ `RuleBasedContentReviewOptions` are supported SDK type exports. Core owns the
188
+ rules and traversal; runtime owns the child process. The edge entry is unchanged.
189
+
190
+ For held tasks, inject the provider explicitly:
191
+
192
+ ```ts
193
+ import { HeldRequestReview, WorkerNode, createRuleBasedContentReviewProvider } from 'sealbridge/sdk';
194
+
195
+ const inspectionTimeoutMs = 5000;
196
+ const heldReview = new HeldRequestReview(owner, {
197
+ ...identityOptions,
198
+ inspectionTimeoutMs,
199
+ provider: createRuleBasedContentReviewProvider({
200
+ timeoutMs: inspectionTimeoutMs,
201
+ onReport(recordId, report) {
202
+ // Supply literal owner-facing review material in memory.
203
+ renderInspection(recordId, report);
204
+ },
205
+ }),
206
+ });
207
+ const worker = new WorkerNode({ ...workerOptions, owner, heldReview });
208
+ ```
209
+
210
+ Here `owner`, `identityOptions`, `workerOptions`, and `renderInspection` belong to
211
+ the embedding host. Keep provider timeout at or below the review timeout; both
212
+ default to 5 seconds and accept 1–45,000 ms. Cancellation or either deadline ends
213
+ inspection and terminates the child. Callback failure, rejection, interruption or
214
+ exceeding that deadline cannot produce completion. The callback receives a copy;
215
+ its mutation cannot change the receipt. It is a host callback, not an isolation
216
+ boundary for arbitrary code.
217
+
218
+ The provider verifies the outer envelope, encrypted recipient, signed proposal,
219
+ manifest, task/sender/worker and held digests before projecting manifest, input and
220
+ capabilities into the fixed compiled scanner over IPC. Owner keys and transport
221
+ credentials are excluded. It uses an environment allowlist, a 64 KiB result cap,
222
+ and termination on abort, timeout or failure. It writes no plaintext files or
223
+ logs and makes no network requests, DNS lookups, execution or archive extraction.
224
+ This fixed trusted scanner does not provide kernel network isolation or accept
225
+ plugins, downloaded rules, caller regexes or source code.
226
+
227
+ The immutable descriptors, detector version and default limits determine
228
+ `CONTENT_INSPECTION_RULESET_DIGEST`. Defaults are 256 KiB serialized content,
229
+ depth 32, 100,000 nodes/keys, 64 KiB of UTF-8 per string, 100 findings and 64 KiB total
230
+ decoded base64 bytes. `limits` may lower these local bounds. Exceeding a work or
231
+ result bound is `error`; findings are never silently truncated into success.
232
+ All manifest fields, input, capabilities and string keys are scanned in JSON
233
+ Pointer order. Location offsets count original UTF-16 units; pointer segments use
234
+ `~0`/`~1` escaping, with potentially sensitive keys replaced by `[redacted]`.
235
+ Reports contain fixed note/diagnostic codes and no evidence snippets or URL values.
236
+ Ordinary keys can occur as location segments; treat reports as review material.
237
+
238
+ The rules check invisible/control characters, English/Japanese instruction phrases,
239
+ URL forms, combined secret requests, recognizable credential forms, code markers
240
+ and long base64. Decoding is bounded and performed once; executable/archive
241
+ prefixes produce `block`. These are heuristics: matching text may be ordinary
242
+ quoted material, unrecognized forms may pass, and credentials are not verified
243
+ online. A `pass` is the absence of findings from these rules. A completed
244
+ `pass`, `warn` or `block` maps to the existing receipt's `complete`, with `block`
245
+ as the strongest owner warning. None authorizes execution, opens a task or
246
+ bypasses the existing live human contract decision. Failures outrank partial
247
+ findings, remain `error`, and preserve the completed-inspection display gate.
248
+
249
+ `contentDigest` is `digest({manifest,input})`; supplied capabilities and effective
250
+ limits are bound through the report and exact envelope. A standalone core error
251
+ before a bounded JSON snapshot exists uses `digest(null)` as an incomplete digest;
252
+ never use an error report as content verification. The runtime binds error reports
253
+ to the authenticated held digest. The receipt's existing `reportDigest` hashes
254
+ `{recordId,ownerDid,kind,contentDigest,envelopeDigest,report}`. Only this digest is
255
+ persisted; full reports remain in `onReport` memory. Existing cached receipts
256
+ contain no findings: `HeldRequestReview.inspect` can return a cached completion
257
+ without calling the provider. After restart, explicitly call the provider with the
258
+ stored envelope and bound inspection context when a report is needed. Do not
259
+ infer an empty report from a receipt or create a report cache on disk.
260
+
261
+ Other held kinds return `unavailable`. Default review, CLI display, trusted
262
+ admission, MCP and automatic approval behavior are unchanged. No protocol,
263
+ schema, required manifest field, wire or stored-record format changes are made.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sealbridge",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -65,7 +65,8 @@
65
65
  "README.md",
66
66
  "README.ja.md",
67
67
  "docs/sdk.md",
68
- "docs/sdk.ja.md"
68
+ "docs/sdk.ja.md",
69
+ "docs/context-grants.md"
69
70
  ],
70
71
  "publishConfig": {
71
72
  "access": "public"