@intentic/sandbox-contract 1.431.0 → 1.433.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.
- package/README.md +25 -3
- package/dist/briefs/agent-ask.d.ts +10 -0
- package/dist/briefs/agent-ask.d.ts.map +1 -0
- package/dist/briefs/agent-ask.js +2 -0
- package/dist/briefs/agent-ask.js.map +1 -0
- package/dist/{chores/extension-update.d.ts → briefs/extension-update-brief.d.ts} +1 -1
- package/dist/briefs/extension-update-brief.d.ts.map +1 -0
- package/dist/{chores/extension-update.js → briefs/extension-update-brief.js} +2 -2
- package/dist/briefs/extension-update-brief.js.map +1 -0
- package/dist/chores/digest.d.ts.map +1 -1
- package/dist/chores/digest.js.map +1 -1
- package/dist/chores/index.d.ts +2 -2
- package/dist/chores/index.d.ts.map +1 -1
- package/dist/chores/index.js +1 -1
- package/dist/chores/index.js.map +1 -1
- package/dist/chores/prompt.d.ts +1 -9
- package/dist/chores/prompt.d.ts.map +1 -1
- package/dist/chores/prompt.js +1 -1
- package/dist/chores/prompt.js.map +1 -1
- package/dist/chores/stack.d.ts.map +1 -1
- package/dist/chores/stack.js.map +1 -1
- package/dist/chores/verdict.d.ts.map +1 -1
- package/dist/chores/verdict.js.map +1 -1
- package/dist/chores/workspace-scope.d.ts +1 -3
- package/dist/chores/workspace-scope.d.ts.map +1 -1
- package/dist/chores/workspace-scope.js +1 -3
- package/dist/chores/workspace-scope.js.map +1 -1
- package/dist/contracts/agent.contract.d.ts +1049 -12
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.d.ts +358 -4
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/approvals.contract.d.ts +35 -0
- package/dist/contracts/approvals.contract.d.ts.map +1 -1
- package/dist/contracts/approvals.contract.js +13 -3
- package/dist/contracts/approvals.contract.js.map +1 -1
- package/dist/contracts/automations.contract.d.ts +60 -8
- package/dist/contracts/automations.contract.d.ts.map +1 -1
- package/dist/contracts/capabilities.contract.d.ts +40 -0
- package/dist/contracts/capabilities.contract.d.ts.map +1 -1
- package/dist/contracts/capabilities.contract.js +21 -0
- package/dist/contracts/capabilities.contract.js.map +1 -1
- package/dist/contracts/ci.contract.d.ts +222 -95
- package/dist/contracts/ci.contract.d.ts.map +1 -1
- package/dist/contracts/ci.contract.js +87 -26
- package/dist/contracts/ci.contract.js.map +1 -1
- package/dist/contracts/device-stacks.contract.d.ts +129 -0
- package/dist/contracts/device-stacks.contract.d.ts.map +1 -0
- package/dist/contracts/device-stacks.contract.js +66 -0
- package/dist/contracts/device-stacks.contract.js.map +1 -0
- package/dist/contracts/device.contract.d.ts +47 -0
- package/dist/contracts/device.contract.d.ts.map +1 -1
- package/dist/contracts/extensions.contract.d.ts +607 -0
- package/dist/contracts/extensions.contract.d.ts.map +1 -1
- package/dist/contracts/extensions.contract.js +10 -1
- package/dist/contracts/extensions.contract.js.map +1 -1
- package/dist/contracts/needs.contract.d.ts +887 -18
- package/dist/contracts/needs.contract.d.ts.map +1 -1
- package/dist/contracts/offload.contract.d.ts +21 -0
- package/dist/contracts/offload.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +653 -40
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/seal.contract.d.ts +20 -0
- package/dist/contracts/seal.contract.d.ts.map +1 -1
- package/dist/contracts/secrets.contract.d.ts +15 -0
- package/dist/contracts/secrets.contract.d.ts.map +1 -1
- package/dist/contracts/secrets.contract.js +21 -1
- package/dist/contracts/secrets.contract.js.map +1 -1
- package/dist/contracts/sessions.contract.d.ts +133 -2
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.d.ts +73 -42
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.js +18 -0
- package/dist/contracts/settings.contract.js.map +1 -1
- package/dist/contracts/stack-grants.contract.d.ts +440 -0
- package/dist/contracts/stack-grants.contract.d.ts.map +1 -0
- package/dist/contracts/stack-grants.contract.js +46 -0
- package/dist/contracts/stack-grants.contract.js.map +1 -0
- package/dist/contracts/system.contract.d.ts +191 -69
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.js +12 -42
- package/dist/contracts/system.contract.js.map +1 -1
- package/dist/contracts/workspace.contract.d.ts +0 -55
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +0 -19
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events/agent-events.d.ts +509 -8
- package/dist/events/agent-events.d.ts.map +1 -1
- package/dist/events/agent-transcript.d.ts +133 -2
- package/dist/events/agent-transcript.d.ts.map +1 -1
- package/dist/events/agent-words.d.ts.map +1 -1
- package/dist/events/agent-words.js +2 -1
- package/dist/events/agent-words.js.map +1 -1
- package/dist/events/child-news.d.ts +32 -0
- package/dist/events/child-news.d.ts.map +1 -0
- package/dist/events/child-news.js +171 -0
- package/dist/events/child-news.js.map +1 -0
- package/dist/events/prompt-origins.d.ts +42 -0
- package/dist/events/prompt-origins.d.ts.map +1 -1
- package/dist/events/prompt-origins.js +28 -0
- package/dist/events/prompt-origins.js.map +1 -1
- package/dist/events/requests.d.ts +14 -0
- package/dist/events/requests.d.ts.map +1 -1
- package/dist/events/requests.js +12 -0
- package/dist/events/requests.js.map +1 -1
- package/dist/events/system-events.d.ts +16 -0
- package/dist/events/system-events.d.ts.map +1 -1
- package/dist/events/transcript.d.ts +669 -10
- package/dist/events/transcript.d.ts.map +1 -1
- package/dist/events/transcript.js +2 -1
- package/dist/events/transcript.js.map +1 -1
- package/dist/ids/conversation-ids.d.ts.map +1 -1
- package/dist/ids/conversation-ids.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/models/model-roles.d.ts +91 -37
- package/dist/models/model-roles.d.ts.map +1 -1
- package/dist/models/model-roles.js +106 -35
- package/dist/models/model-roles.js.map +1 -1
- package/dist/models/model-setups.d.ts +10 -8
- package/dist/models/model-setups.d.ts.map +1 -1
- package/dist/models/model-setups.js +15 -15
- package/dist/models/model-setups.js.map +1 -1
- package/dist/policy/approvals-execution.d.ts +5 -2
- package/dist/policy/approvals-execution.d.ts.map +1 -1
- package/dist/policy/approvals-execution.js +3 -4
- package/dist/policy/approvals-execution.js.map +1 -1
- package/dist/policy/batch-runs.d.ts +1 -1
- package/dist/policy/batch-runs.d.ts.map +1 -1
- package/dist/policy/batch-runs.js +2 -1
- package/dist/policy/batch-runs.js.map +1 -1
- package/dist/policy/message-limits.d.ts.map +1 -1
- package/dist/policy/message-limits.js.map +1 -1
- package/dist/policy/org-locks.d.ts +1 -1
- package/dist/policy/org-locks.d.ts.map +1 -1
- package/dist/policy/org-locks.js +1 -0
- package/dist/policy/org-locks.js.map +1 -1
- package/dist/policy/shell/workspace-root-exclude.d.ts +4 -0
- package/dist/policy/shell/workspace-root-exclude.d.ts.map +1 -0
- package/dist/policy/shell/workspace-root-exclude.js +4 -0
- package/dist/policy/shell/workspace-root-exclude.js.map +1 -0
- package/dist/protocol/doors/listener-protocol.d.ts +7 -0
- package/dist/protocol/doors/listener-protocol.d.ts.map +1 -1
- package/dist/protocol/doors/listener-protocol.js +1 -0
- package/dist/protocol/doors/listener-protocol.js.map +1 -1
- package/dist/protocol/doors/webext-links.d.ts.map +1 -1
- package/dist/protocol/doors/webext-links.js.map +1 -1
- package/dist/protocol/raw/extension-protocol.d.ts +634 -0
- package/dist/protocol/raw/extension-protocol.d.ts.map +1 -1
- package/dist/protocol/raw/extension-protocol.js +292 -0
- package/dist/protocol/raw/extension-protocol.js.map +1 -1
- package/dist/protocol/raw/raw-json-routes.d.ts +3034 -0
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +39 -0
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +260 -1
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +57 -1
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/protocol/s2s/address.d.ts +53 -0
- package/dist/protocol/s2s/address.d.ts.map +1 -0
- package/dist/protocol/s2s/address.js +111 -0
- package/dist/protocol/s2s/address.js.map +1 -0
- package/dist/protocol/s2s/attestation.d.ts +41 -0
- package/dist/protocol/s2s/attestation.d.ts.map +1 -0
- package/dist/protocol/s2s/attestation.js +96 -0
- package/dist/protocol/s2s/attestation.js.map +1 -0
- package/dist/protocol/s2s/canonical.d.ts +10 -0
- package/dist/protocol/s2s/canonical.d.ts.map +1 -0
- package/dist/protocol/s2s/canonical.js +94 -0
- package/dist/protocol/s2s/canonical.js.map +1 -0
- package/dist/protocol/s2s/envelope.d.ts +40 -0
- package/dist/protocol/s2s/envelope.d.ts.map +1 -0
- package/dist/protocol/s2s/envelope.js +116 -0
- package/dist/protocol/s2s/envelope.js.map +1 -0
- package/dist/protocol/s2s/extension-sign.d.ts +21 -0
- package/dist/protocol/s2s/extension-sign.d.ts.map +1 -0
- package/dist/protocol/s2s/extension-sign.js +41 -0
- package/dist/protocol/s2s/extension-sign.js.map +1 -0
- package/dist/protocol/s2s/identity-doc.d.ts +50 -0
- package/dist/protocol/s2s/identity-doc.d.ts.map +1 -0
- package/dist/protocol/s2s/identity-doc.js +89 -0
- package/dist/protocol/s2s/identity-doc.js.map +1 -0
- package/dist/protocol/s2s/index.d.ts +12 -0
- package/dist/protocol/s2s/index.d.ts.map +1 -0
- package/dist/protocol/s2s/index.js +12 -0
- package/dist/protocol/s2s/index.js.map +1 -0
- package/dist/protocol/s2s/kem.d.ts +15 -0
- package/dist/protocol/s2s/kem.d.ts.map +1 -0
- package/dist/protocol/s2s/kem.js +34 -0
- package/dist/protocol/s2s/kem.js.map +1 -0
- package/dist/protocol/s2s/keys.d.ts +34 -0
- package/dist/protocol/s2s/keys.d.ts.map +1 -0
- package/dist/protocol/s2s/keys.js +81 -0
- package/dist/protocol/s2s/keys.js.map +1 -0
- package/dist/protocol/s2s/passkey-cosign.d.ts +44 -0
- package/dist/protocol/s2s/passkey-cosign.d.ts.map +1 -0
- package/dist/protocol/s2s/passkey-cosign.js +139 -0
- package/dist/protocol/s2s/passkey-cosign.js.map +1 -0
- package/dist/protocol/s2s/session.d.ts +61 -0
- package/dist/protocol/s2s/session.d.ts.map +1 -0
- package/dist/protocol/s2s/session.js +98 -0
- package/dist/protocol/s2s/session.js.map +1 -0
- package/dist/protocol/s2s/sign.d.ts +12 -0
- package/dist/protocol/s2s/sign.d.ts.map +1 -0
- package/dist/protocol/s2s/sign.js +33 -0
- package/dist/protocol/s2s/sign.js.map +1 -0
- package/dist/schemas/activity.d.ts.map +1 -1
- package/dist/schemas/activity.js.map +1 -1
- package/dist/schemas/agent.d.ts +4 -0
- package/dist/schemas/agent.d.ts.map +1 -1
- package/dist/schemas/agent.js +4 -2
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/agents-list.d.ts +8 -0
- package/dist/schemas/agents-list.d.ts.map +1 -1
- package/dist/schemas/agents.d.ts +16 -0
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/approvals.d.ts +100 -0
- package/dist/schemas/approvals.d.ts.map +1 -1
- package/dist/schemas/approvals.js +21 -0
- package/dist/schemas/approvals.js.map +1 -1
- package/dist/schemas/automations.d.ts +89 -27
- package/dist/schemas/automations.d.ts.map +1 -1
- package/dist/schemas/automations.js +15 -33
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +1 -0
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/ci-deployments.d.ts +30 -0
- package/dist/schemas/ci-deployments.d.ts.map +1 -0
- package/dist/schemas/ci-deployments.js +18 -0
- package/dist/schemas/ci-deployments.js.map +1 -0
- package/dist/schemas/ci.d.ts +348 -21
- package/dist/schemas/ci.d.ts.map +1 -1
- package/dist/schemas/ci.js +110 -19
- package/dist/schemas/ci.js.map +1 -1
- package/dist/schemas/command-admission.d.ts +6 -0
- package/dist/schemas/command-admission.d.ts.map +1 -1
- package/dist/schemas/command-admission.js +2 -1
- package/dist/schemas/command-admission.js.map +1 -1
- package/dist/schemas/command-run.d.ts +29 -0
- package/dist/schemas/command-run.d.ts.map +1 -0
- package/dist/schemas/command-run.js +20 -0
- package/dist/schemas/command-run.js.map +1 -0
- package/dist/schemas/contact-need.d.ts +50 -0
- package/dist/schemas/contact-need.d.ts.map +1 -0
- package/dist/schemas/contact-need.js +19 -0
- package/dist/schemas/contact-need.js.map +1 -0
- package/dist/schemas/contacts-settings.d.ts +5 -0
- package/dist/schemas/contacts-settings.d.ts.map +1 -0
- package/dist/schemas/contacts-settings.js +11 -0
- package/dist/schemas/contacts-settings.js.map +1 -0
- package/dist/schemas/data-protection.d.ts +15 -2
- package/dist/schemas/data-protection.d.ts.map +1 -1
- package/dist/schemas/data-protection.js +15 -23
- package/dist/schemas/data-protection.js.map +1 -1
- package/dist/schemas/device-stacks.d.ts +131 -0
- package/dist/schemas/device-stacks.d.ts.map +1 -1
- package/dist/schemas/device-stacks.js +81 -0
- package/dist/schemas/device-stacks.js.map +1 -1
- package/dist/schemas/devices.d.ts +73 -0
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js +6 -2
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/extension-updates.d.ts +1192 -0
- package/dist/schemas/extension-updates.d.ts.map +1 -1
- package/dist/schemas/extension-updates.js +18 -4
- package/dist/schemas/extension-updates.js.map +1 -1
- package/dist/schemas/host-power.d.ts +22 -0
- package/dist/schemas/host-power.d.ts.map +1 -1
- package/dist/schemas/host-power.js +55 -0
- package/dist/schemas/host-power.js.map +1 -1
- package/dist/schemas/hosts.d.ts +226 -0
- package/dist/schemas/hosts.d.ts.map +1 -1
- package/dist/schemas/hosts.js +24 -0
- package/dist/schemas/hosts.js.map +1 -1
- package/dist/schemas/issues.d.ts +37 -249
- package/dist/schemas/issues.d.ts.map +1 -1
- package/dist/schemas/issues.js +10 -43
- package/dist/schemas/issues.js.map +1 -1
- package/dist/schemas/links.d.ts +8 -0
- package/dist/schemas/links.d.ts.map +1 -1
- package/dist/schemas/links.js +4 -0
- package/dist/schemas/links.js.map +1 -1
- package/dist/schemas/maintenance.d.ts.map +1 -1
- package/dist/schemas/maintenance.js.map +1 -1
- package/dist/schemas/metrics.d.ts +25 -0
- package/dist/schemas/metrics.d.ts.map +1 -1
- package/dist/schemas/metrics.js +18 -0
- package/dist/schemas/metrics.js.map +1 -1
- package/dist/schemas/need-kinds.d.ts +20 -0
- package/dist/schemas/need-kinds.d.ts.map +1 -0
- package/dist/schemas/need-kinds.js +7 -0
- package/dist/schemas/need-kinds.js.map +1 -0
- package/dist/schemas/needs.d.ts +666 -30
- package/dist/schemas/needs.d.ts.map +1 -1
- package/dist/schemas/needs.js +29 -6
- package/dist/schemas/needs.js.map +1 -1
- package/dist/schemas/offload.d.ts +52 -0
- package/dist/schemas/offload.d.ts.map +1 -1
- package/dist/schemas/offload.js +12 -0
- package/dist/schemas/offload.js.map +1 -1
- package/dist/schemas/outward-action.d.ts +39 -0
- package/dist/schemas/outward-action.d.ts.map +1 -0
- package/dist/schemas/outward-action.js +40 -0
- package/dist/schemas/outward-action.js.map +1 -0
- package/dist/schemas/providers/plan-limits.d.ts +1 -0
- package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
- package/dist/schemas/providers/plan-limits.js +1 -0
- package/dist/schemas/providers/plan-limits.js.map +1 -1
- package/dist/schemas/redirect-need.d.ts +15 -0
- package/dist/schemas/redirect-need.d.ts.map +1 -0
- package/dist/schemas/redirect-need.js +14 -0
- package/dist/schemas/redirect-need.js.map +1 -0
- package/dist/schemas/s2s-identity.d.ts +521 -0
- package/dist/schemas/s2s-identity.d.ts.map +1 -0
- package/dist/schemas/s2s-identity.js +208 -0
- package/dist/schemas/s2s-identity.js.map +1 -0
- package/dist/schemas/s2s-views.d.ts +2127 -0
- package/dist/schemas/s2s-views.d.ts.map +1 -0
- package/dist/schemas/s2s-views.js +217 -0
- package/dist/schemas/s2s-views.js.map +1 -0
- package/dist/schemas/s2s-wire.d.ts +1616 -0
- package/dist/schemas/s2s-wire.d.ts.map +1 -0
- package/dist/schemas/s2s-wire.js +276 -0
- package/dist/schemas/s2s-wire.js.map +1 -0
- package/dist/schemas/s2s.d.ts +5 -0
- package/dist/schemas/s2s.d.ts.map +1 -0
- package/dist/schemas/s2s.js +5 -0
- package/dist/schemas/s2s.js.map +1 -0
- package/dist/schemas/secrets.d.ts +17 -0
- package/dist/schemas/secrets.d.ts.map +1 -1
- package/dist/schemas/secrets.js +12 -5
- package/dist/schemas/secrets.js.map +1 -1
- package/dist/schemas/settings-history.d.ts +1 -1
- package/dist/schemas/settings-history.d.ts.map +1 -1
- package/dist/schemas/settings-history.js +5 -4
- package/dist/schemas/settings-history.js.map +1 -1
- package/dist/schemas/settings-savings.d.ts +58 -0
- package/dist/schemas/settings-savings.d.ts.map +1 -1
- package/dist/schemas/settings-savings.js +22 -0
- package/dist/schemas/settings-savings.js.map +1 -1
- package/dist/schemas/settings.d.ts +18 -42
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +7 -6
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/stack-grants.d.ts +60 -0
- package/dist/schemas/stack-grants.d.ts.map +1 -0
- package/dist/schemas/stack-grants.js +33 -0
- package/dist/schemas/stack-grants.js.map +1 -0
- package/dist/schemas/terminal.d.ts +2 -0
- package/dist/schemas/terminal.d.ts.map +1 -1
- package/dist/schemas/terminal.js +4 -0
- package/dist/schemas/terminal.js.map +1 -1
- package/dist/schemas/vpn.d.ts +4 -0
- package/dist/schemas/vpn.d.ts.map +1 -1
- package/dist/schemas/vpn.js +9 -0
- package/dist/schemas/vpn.js.map +1 -1
- package/dist/schemas/watch-sources.d.ts +72 -0
- package/dist/schemas/watch-sources.d.ts.map +1 -0
- package/dist/schemas/watch-sources.js +88 -0
- package/dist/schemas/watch-sources.js.map +1 -0
- package/dist/schemas/workspace/workspace-search.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-search.js +1 -1
- package/dist/schemas/workspace/workspace-search.js.map +1 -1
- package/dist/schemas/wsl-memory.d.ts +76 -0
- package/dist/schemas/wsl-memory.d.ts.map +1 -0
- package/dist/schemas/wsl-memory.js +36 -0
- package/dist/schemas/wsl-memory.js.map +1 -0
- package/dist/state/auth-state.d.ts.map +1 -1
- package/dist/state/auth-state.js +8 -0
- package/dist/state/auth-state.js.map +1 -1
- package/dist/state/definition.d.ts +22 -8
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/state/workspace-state.d.ts +8 -3
- package/dist/state/workspace-state.d.ts.map +1 -1
- package/dist/state/workspace-state.js +8 -3
- package/dist/state/workspace-state.js.map +1 -1
- package/package.json +20 -5
- package/src/briefs/agent-ask.ts +23 -0
- package/src/{chores/extension-update.ts → briefs/extension-update-brief.ts} +3 -2
- package/src/chores/digest.ts +1 -0
- package/src/chores/index.ts +13 -2
- package/src/chores/prompt.ts +3 -18
- package/src/chores/stack.ts +1 -0
- package/src/chores/verdict.ts +1 -0
- package/src/chores/workspace-scope.ts +3 -8
- package/src/contracts/approvals.contract.ts +24 -3
- package/src/contracts/capabilities.contract.ts +24 -0
- package/src/contracts/ci.contract.ts +119 -37
- package/src/contracts/device-stacks.contract.ts +97 -0
- package/src/contracts/extensions.contract.ts +11 -0
- package/src/contracts/secrets.contract.ts +27 -0
- package/src/contracts/settings.contract.ts +24 -0
- package/src/contracts/stack-grants.contract.ts +51 -0
- package/src/contracts/system.contract.ts +16 -59
- package/src/contracts/workspace.contract.ts +0 -22
- package/src/events/agent-words.ts +3 -1
- package/src/events/child-news.test.ts +91 -0
- package/src/events/child-news.ts +269 -0
- package/src/events/prompt-origins.ts +35 -0
- package/src/events/requests.ts +18 -0
- package/src/events/transcript.ts +10 -1
- package/src/ids/conversation-ids.test.ts +22 -3
- package/src/ids/conversation-ids.ts +5 -7
- package/src/index.ts +3 -6
- package/src/models/model-roles.test.ts +61 -4
- package/src/models/model-roles.ts +153 -49
- package/src/models/model-setups.ts +49 -26
- package/src/policy/approvals-execution.ts +11 -6
- package/src/policy/batch-runs.ts +2 -2
- package/src/policy/message-limits.ts +8 -4
- package/src/policy/org-locks.ts +1 -0
- package/src/policy/shell/workspace-root-exclude.ts +11 -0
- package/src/protocol/doors/listener-protocol.ts +14 -0
- package/src/protocol/doors/webext-links.ts +3 -1
- package/src/protocol/ingress-contract.fixture.json +6 -1
- package/src/protocol/raw/extension-protocol.ts +513 -2
- package/src/protocol/raw/raw-json-routes.ts +85 -0
- package/src/protocol/raw/raw-routes.ts +111 -7
- package/src/protocol/s2s/address.test.ts +157 -0
- package/src/protocol/s2s/address.ts +193 -0
- package/src/protocol/s2s/attestation.test.ts +262 -0
- package/src/protocol/s2s/attestation.ts +173 -0
- package/src/protocol/s2s/canonical.test.ts +70 -0
- package/src/protocol/s2s/canonical.ts +119 -0
- package/src/protocol/s2s/envelope.test.ts +162 -0
- package/src/protocol/s2s/envelope.ts +194 -0
- package/src/protocol/s2s/extension-sign.test.ts +117 -0
- package/src/protocol/s2s/extension-sign.ts +76 -0
- package/src/protocol/s2s/identity-doc.test.ts +187 -0
- package/src/protocol/s2s/identity-doc.ts +169 -0
- package/src/protocol/s2s/index.ts +15 -0
- package/src/protocol/s2s/kem.ts +62 -0
- package/src/protocol/s2s/keys.test.ts +76 -0
- package/src/protocol/s2s/keys.ts +155 -0
- package/src/protocol/s2s/passkey-cosign.test.ts +98 -0
- package/src/protocol/s2s/passkey-cosign.testing.ts +86 -0
- package/src/protocol/s2s/passkey-cosign.ts +192 -0
- package/src/protocol/s2s/s2s.testing.ts +22 -0
- package/src/protocol/s2s/session.test.ts +133 -0
- package/src/protocol/s2s/session.ts +179 -0
- package/src/protocol/s2s/sign.test.ts +66 -0
- package/src/protocol/s2s/sign.ts +53 -0
- package/src/schemas/activity.ts +2 -1
- package/src/schemas/agent.test.ts +3 -0
- package/src/schemas/agent.ts +10 -4
- package/src/schemas/approvals.ts +41 -0
- package/src/schemas/automations.ts +26 -41
- package/src/schemas/ci-deployments.ts +26 -0
- package/src/schemas/ci.ts +185 -45
- package/src/schemas/command-admission.ts +4 -1
- package/src/schemas/command-run.ts +44 -0
- package/src/schemas/contact-need.ts +26 -0
- package/src/schemas/contacts-settings.ts +16 -0
- package/src/schemas/data-protection.ts +28 -34
- package/src/schemas/device-stacks.ts +162 -3
- package/src/schemas/devices.ts +13 -2
- package/src/schemas/extension-updates.ts +27 -7
- package/src/schemas/host-power.test.ts +53 -0
- package/src/schemas/host-power.ts +96 -2
- package/src/schemas/hosts.test.ts +32 -0
- package/src/schemas/hosts.ts +62 -0
- package/src/schemas/issues.ts +30 -86
- package/src/schemas/links.ts +4 -0
- package/src/schemas/maintenance.ts +4 -3
- package/src/schemas/metrics.ts +35 -0
- package/src/schemas/need-kinds.ts +13 -0
- package/src/schemas/needs.ts +44 -16
- package/src/schemas/offload.ts +31 -0
- package/src/schemas/outward-action.ts +47 -0
- package/src/schemas/providers/plan-limits.ts +1 -0
- package/src/schemas/redirect-need.ts +19 -0
- package/src/schemas/s2s-identity.ts +329 -0
- package/src/schemas/s2s-views.ts +326 -0
- package/src/schemas/s2s-wire.ts +401 -0
- package/src/schemas/s2s.test.ts +175 -0
- package/src/schemas/s2s.ts +9 -0
- package/src/schemas/secrets.ts +23 -5
- package/src/schemas/settings-history.ts +10 -5
- package/src/schemas/settings-savings.ts +29 -0
- package/src/schemas/settings.test.ts +23 -23
- package/src/schemas/settings.ts +12 -12
- package/src/schemas/stack-grants.ts +59 -0
- package/src/schemas/terminal.ts +6 -0
- package/src/schemas/version-seam.test.ts +13 -1
- package/src/schemas/vpn.ts +13 -0
- package/src/schemas/watch-sources.ts +127 -0
- package/src/schemas/workspace/workspace-search.ts +5 -2
- package/src/schemas/wsl-memory.ts +59 -0
- package/src/state/auth-state.ts +17 -0
- package/src/state/workspace-state.ts +18 -18
- package/src/text/embed.ts +2 -2
- package/dist/chores/extension-update.d.ts.map +0 -1
- package/dist/chores/extension-update.js.map +0 -1
- package/dist/contracts/chores.contract.d.ts +0 -213
- package/dist/contracts/chores.contract.d.ts.map +0 -1
- package/dist/contracts/chores.contract.js +0 -32
- package/dist/contracts/chores.contract.js.map +0 -1
- package/dist/contracts/issues.contract.d.ts +0 -106
- package/dist/contracts/issues.contract.d.ts.map +0 -1
- package/dist/contracts/issues.contract.js +0 -50
- package/dist/contracts/issues.contract.js.map +0 -1
- package/src/chores/chores.test.ts +0 -24
- package/src/chores/digest.test.ts +0 -27
- package/src/chores/probes.integration.test.ts +0 -494
- package/src/chores/stack.test.ts +0 -140
- package/src/chores/verdict.test.ts +0 -761
- package/src/contracts/chores.contract.ts +0 -39
- package/src/contracts/issues.contract.ts +0 -53
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DROP_BYTES_MAX, DROP_FILES_MAX, DropFileSchema } from "./account-routes.js";
|
|
3
|
+
import { ConversationBundleSchema, DiagnosticsAnswerSchema, DiagnosticsQuerySchema } from "./diagnostics.js";
|
|
4
|
+
import { AccountReportSchema } from "./issues.js";
|
|
5
|
+
import {
|
|
6
|
+
LINK_MAX_HOPS,
|
|
7
|
+
LINK_OPERATE_WAIT_S_MAX,
|
|
8
|
+
LinkAnswerSchema,
|
|
9
|
+
LinkExecSchema,
|
|
10
|
+
LinkExecStatusSchema,
|
|
11
|
+
LinkMessageSchema,
|
|
12
|
+
LinkReadAnswerSchema,
|
|
13
|
+
LinkReadSchema,
|
|
14
|
+
LinkTaskSchema,
|
|
15
|
+
LinkTaskStatusSchema,
|
|
16
|
+
LinkWriteAnswerSchema,
|
|
17
|
+
LinkWriteSchema,
|
|
18
|
+
} from "./links.js";
|
|
19
|
+
import {
|
|
20
|
+
HybridSigSchema,
|
|
21
|
+
S2sAddressSchema,
|
|
22
|
+
S2sAttestationSchema,
|
|
23
|
+
S2sBase64UrlSchema,
|
|
24
|
+
S2sClaimsSchema,
|
|
25
|
+
S2sContactScopeSchema,
|
|
26
|
+
S2sFingerprintSchema,
|
|
27
|
+
S2sGrantsSchema,
|
|
28
|
+
S2S_NOTE_MAX,
|
|
29
|
+
S2sPersonSchema,
|
|
30
|
+
S2sRefSchema,
|
|
31
|
+
SandboxIdentitySchema,
|
|
32
|
+
} from "./s2s-identity.js";
|
|
33
|
+
|
|
34
|
+
// SANDBOX-TO-SANDBOX (docs/architecture/messages.md), the wire half: the envelope a message travels in, every kind of
|
|
35
|
+
// payload it can carry, what the inbox door answers, and the call sessions records and operating go through.
|
|
36
|
+
// Re-exported from schemas/s2s.ts.
|
|
37
|
+
|
|
38
|
+
// The sealed body's cap, in bytes; past it the door answers 413 `too_large` before reading further.
|
|
39
|
+
export const S2S_BODY_MAX_BYTES = 16 * 1024 * 1024;
|
|
40
|
+
// The same cap as base64url characters, the body field's own length.
|
|
41
|
+
export const S2S_BODY_MAX_CHARS = Math.ceil(S2S_BODY_MAX_BYTES / 3) * 4;
|
|
42
|
+
// The whole POST /s2s/inbox request: the body and room for the header, the key agreement and the signature.
|
|
43
|
+
export const S2S_ENVELOPE_MAX_BYTES = S2S_BODY_MAX_CHARS + 64 * 1024;
|
|
44
|
+
// A message's own limits: the drops' file count and bytes, and words.
|
|
45
|
+
export const S2S_MESSAGE_FILES_MAX = DROP_FILES_MAX;
|
|
46
|
+
export const S2S_MESSAGE_BYTES_MAX = DROP_BYTES_MAX;
|
|
47
|
+
export const S2S_MESSAGE_TEXT_MAX = 60_000;
|
|
48
|
+
export const S2S_SUBJECT_MAX = 200;
|
|
49
|
+
// How long an envelope id is remembered, so a retry of one already taken answers 200 and changes nothing.
|
|
50
|
+
export const S2S_SEEN_IDS_MS = 30 * 24 * 60 * 60 * 1000;
|
|
51
|
+
// How far an envelope's `sentAt` may be from the receiver's clock when it arrives: at most a day behind, at most five
|
|
52
|
+
// minutes ahead. The outbox seals afresh at every attempt, so an honest envelope is seconds old; one past either bound is
|
|
53
|
+
// refused `replay`, and a day sits well inside the time its id is remembered, so no id is forgotten while it could still be
|
|
54
|
+
// taken (2026-11-27).
|
|
55
|
+
export const S2S_ENVELOPE_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
56
|
+
export const S2S_ENVELOPE_MAX_AHEAD_MS = 5 * 60 * 1000;
|
|
57
|
+
// What a stranger (no contact) may send: contact requests only, this many an hour per address and in all.
|
|
58
|
+
export const S2S_STRANGER_REQUESTS_PER_ADDRESS_HOUR = 3;
|
|
59
|
+
export const S2S_STRANGER_REQUESTS_PER_HOUR = 30;
|
|
60
|
+
// The per-contact minute limit by kind, as the passes had.
|
|
61
|
+
export const S2S_PER_MINUTE = { message: 60, report: 30, task: 10 } as const;
|
|
62
|
+
// The outbox: retried for a week, `min(30 s · 2^n, 30 min)` unless the far side says Retry-After.
|
|
63
|
+
export const S2S_OUTBOX_KEEP_MS = 7 * 24 * 60 * 60 * 1000;
|
|
64
|
+
export const S2S_OUTBOX_BACKOFF_BASE_MS = 30_000;
|
|
65
|
+
export const S2S_OUTBOX_BACKOFF_MAX_MS = 30 * 60 * 1000;
|
|
66
|
+
// The query parameter an attempt to a contact holding this sandbox's wake grant carries its secret in.
|
|
67
|
+
export const S2S_WAKE_QUERY = "wake";
|
|
68
|
+
// Calls: the header naming the session, how long a session lives, and how far a call's clock may be from the callee's.
|
|
69
|
+
export const S2S_SESSION_HEADER = "x-intentic-s2s-session";
|
|
70
|
+
export const S2S_SESSION_TTL_MS = 60 * 60 * 1000;
|
|
71
|
+
export const S2S_CALL_SKEW_MS = 2 * 60 * 1000;
|
|
72
|
+
|
|
73
|
+
// An envelope's id: a UUIDv7, so ids sort by when they were made.
|
|
74
|
+
export const S2sEnvelopeIdSchema = z
|
|
75
|
+
.string()
|
|
76
|
+
.regex(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u)
|
|
77
|
+
.describe("A UUIDv7.");
|
|
78
|
+
|
|
79
|
+
export const S2S_PAYLOAD_KINDS = [
|
|
80
|
+
"contact.request",
|
|
81
|
+
"contact.accept",
|
|
82
|
+
"contact.update",
|
|
83
|
+
"contact.remove",
|
|
84
|
+
"identity.rotated",
|
|
85
|
+
"message",
|
|
86
|
+
"report",
|
|
87
|
+
"task.request",
|
|
88
|
+
"task.update",
|
|
89
|
+
"task.message",
|
|
90
|
+
"task.answer",
|
|
91
|
+
"task.stop",
|
|
92
|
+
"receipt",
|
|
93
|
+
"attestation.request",
|
|
94
|
+
"attestation.issued",
|
|
95
|
+
] as const;
|
|
96
|
+
export const S2sPayloadKindSchema = z.enum(S2S_PAYLOAD_KINDS);
|
|
97
|
+
export type S2sPayloadKind = z.infer<typeof S2sPayloadKindSchema>;
|
|
98
|
+
export const isS2sPayloadKind = (kind: string): kind is S2sPayloadKind => S2S_PAYLOAD_KINDS.some((known) => known === kind);
|
|
99
|
+
|
|
100
|
+
// The header, in the clear and signed. `kind` is any word here so a kind this build does not know is refused by name
|
|
101
|
+
// (422 `unknown_kind`), never misread. Loose, as the identity document is, so a later field still verifies; the type
|
|
102
|
+
// names the fields this build knows.
|
|
103
|
+
const headerFields = {
|
|
104
|
+
v: z.literal(1),
|
|
105
|
+
id: S2sEnvelopeIdSchema,
|
|
106
|
+
from: S2sAddressSchema.describe("The sender's address, as the receiver knows it."),
|
|
107
|
+
fromFp: S2sFingerprintSchema.describe("The key set the sender signed with."),
|
|
108
|
+
to: S2sAddressSchema.describe("The receiver's address."),
|
|
109
|
+
toFp: S2sFingerprintSchema.describe("The receiver's key set the body is sealed to: its current one or a kept previous one."),
|
|
110
|
+
kind: z.string().min(1).max(64).describe("The payload's kind (S2S_PAYLOAD_KINDS)."),
|
|
111
|
+
thread: S2sRefSchema.optional().describe("The thread it belongs to, as the sender names it."),
|
|
112
|
+
replyTo: S2sEnvelopeIdSchema.optional().describe("The envelope it answers."),
|
|
113
|
+
as: S2sPersonSchema.optional().describe("The person of a person-scoped contact it travels for."),
|
|
114
|
+
hops: z.number().int().min(0).max(10).describe("How many sandboxes the work it carries already crossed (LINK_MAX_HOPS)."),
|
|
115
|
+
sentAt: z.number().int().nonnegative().describe("When it was sealed, in epoch milliseconds."),
|
|
116
|
+
};
|
|
117
|
+
export const S2sEnvelopeHeaderSchema = z.looseObject(headerFields);
|
|
118
|
+
export type S2sEnvelopeHeader = z.infer<z.ZodObject<typeof headerFields>>;
|
|
119
|
+
|
|
120
|
+
// The hybrid key agreement to the receiver's key set: an ephemeral X25519 key, an ML-KEM-768 ciphertext, the AEAD nonce.
|
|
121
|
+
export const S2sEncSchema = z.object({
|
|
122
|
+
x25519: S2sBase64UrlSchema.describe("The sender's ephemeral X25519 public key, 32 bytes."),
|
|
123
|
+
mlkem768: S2sBase64UrlSchema.describe("The ML-KEM-768 ciphertext to the receiver's key, 1088 bytes."),
|
|
124
|
+
nonce: S2sBase64UrlSchema.describe("The AES-256-GCM nonce, 12 bytes."),
|
|
125
|
+
});
|
|
126
|
+
export type S2sEnc = z.infer<typeof S2sEncSchema>;
|
|
127
|
+
|
|
128
|
+
const envelopeFields = {
|
|
129
|
+
...headerFields,
|
|
130
|
+
enc: S2sEncSchema,
|
|
131
|
+
body: S2sBase64UrlSchema.max(S2S_BODY_MAX_CHARS).describe("The payload as JSON, sealed with AES-256-GCM; the tag at its end."),
|
|
132
|
+
sig: HybridSigSchema.describe("The sender's signature over the canonical header, `enc` and `body`."),
|
|
133
|
+
};
|
|
134
|
+
export const S2sEnvelopeSchema = z.looseObject(envelopeFields).describe("One signed, encrypted message between two sandboxes (POST /s2s/inbox).");
|
|
135
|
+
export type S2sEnvelope = z.infer<z.ZodObject<typeof envelopeFields>>;
|
|
136
|
+
|
|
137
|
+
/* PAYLOADS: the body, once opened, by kind. */
|
|
138
|
+
|
|
139
|
+
// A message's file, whole: its own name (never a path) and its bytes in base64, as a drop carried them.
|
|
140
|
+
export const S2sAttachmentSchema = DropFileSchema;
|
|
141
|
+
export type S2sAttachment = z.infer<typeof S2sAttachmentSchema>;
|
|
142
|
+
|
|
143
|
+
const wakeSecret = z.string().min(32).max(200).describe("This sandbox's wake secret, handed to a contact it grants `wake`.");
|
|
144
|
+
const taskRef = S2sRefSchema.describe("The task, by the asking side's own request id for it (LinkTask `requestId`).");
|
|
145
|
+
|
|
146
|
+
export const S2sContactRequestSchema = z.object({
|
|
147
|
+
kind: z.literal("contact.request"),
|
|
148
|
+
document: SandboxIdentitySchema.describe("The asking sandbox's identity; the receiver confirms it by fetching it from the claimed address."),
|
|
149
|
+
note: z.string().max(S2S_NOTE_MAX).optional().describe("Why it asks, in its own words."),
|
|
150
|
+
grants: S2sGrantsSchema.describe("What the asking sandbox gives the receiver, informational there."),
|
|
151
|
+
scope: S2sContactScopeSchema,
|
|
152
|
+
wake: wakeSecret.optional(),
|
|
153
|
+
});
|
|
154
|
+
export const S2sContactAcceptSchema = z.object({
|
|
155
|
+
kind: z.literal("contact.accept"),
|
|
156
|
+
document: SandboxIdentitySchema,
|
|
157
|
+
grants: S2sGrantsSchema.describe("What the accepting sandbox gives the asking one."),
|
|
158
|
+
wake: wakeSecret.optional(),
|
|
159
|
+
});
|
|
160
|
+
export const S2sContactUpdateSchema = z.object({
|
|
161
|
+
kind: z.literal("contact.update"),
|
|
162
|
+
grants: S2sGrantsSchema.optional().describe("The grants as they are now, when they changed."),
|
|
163
|
+
wake: wakeSecret.nullable().optional().describe("A new wake secret, or null when the grant was taken away."),
|
|
164
|
+
});
|
|
165
|
+
export const S2sContactRemoveSchema = z.object({
|
|
166
|
+
kind: z.literal("contact.remove"),
|
|
167
|
+
reason: z.string().max(S2S_NOTE_MAX).optional(),
|
|
168
|
+
});
|
|
169
|
+
export const S2sIdentityRotatedSchema = z.object({
|
|
170
|
+
kind: z.literal("identity.rotated"),
|
|
171
|
+
document: SandboxIdentitySchema.describe("The new document; its `prev` is signed by the key the contact pinned, or by the recovery key."),
|
|
172
|
+
});
|
|
173
|
+
export const S2sMessagePayloadSchema = z.object({
|
|
174
|
+
kind: z.literal("message"),
|
|
175
|
+
subject: z.string().max(S2S_SUBJECT_MAX).optional(),
|
|
176
|
+
text: z.string().max(S2S_MESSAGE_TEXT_MAX),
|
|
177
|
+
attachments: z.array(S2sAttachmentSchema).max(S2S_MESSAGE_FILES_MAX).default([]),
|
|
178
|
+
});
|
|
179
|
+
// A problem report, the account report's own fields (schemas/issues.ts), handed to the issues extension as before, and the
|
|
180
|
+
// project it is about, which a pass used to carry.
|
|
181
|
+
export const S2sReportPayloadSchema = AccountReportSchema.extend({
|
|
182
|
+
kind: z.literal("report"),
|
|
183
|
+
project: z.string().min(1).max(200).describe("The project it is about, as the receiving sandbox claims it (github.com/owner/repo)."),
|
|
184
|
+
});
|
|
185
|
+
// A task, the link task's own fields (schemas/links.ts).
|
|
186
|
+
export const S2sTaskRequestSchema = LinkTaskSchema.extend({ kind: z.literal("task.request") });
|
|
187
|
+
export const S2sTaskUpdateSchema = z.object({ kind: z.literal("task.update"), task: taskRef, status: LinkTaskStatusSchema });
|
|
188
|
+
export const S2sTaskMessageSchema = z.object({ kind: z.literal("task.message"), task: taskRef, message: LinkMessageSchema });
|
|
189
|
+
export const S2sTaskAnswerSchema = z.object({ kind: z.literal("task.answer"), task: taskRef, answer: LinkAnswerSchema });
|
|
190
|
+
export const S2sTaskStopSchema = z.object({ kind: z.literal("task.stop"), task: taskRef });
|
|
191
|
+
export const S2sReceiptSchema = z.object({
|
|
192
|
+
kind: z.literal("receipt"),
|
|
193
|
+
of: S2sEnvelopeIdSchema.describe("The envelope it is about."),
|
|
194
|
+
read: z.boolean().describe("A person (or the turn acting for one) read it."),
|
|
195
|
+
at: z.number().int().nonnegative(),
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Attestations (docs/architecture/messages.md, "Attestations"), under the contact's `message` grant and between
|
|
199
|
+
// sandbox-scoped contacts only, since each is the sandbox speaking as itself. Neither is acted on when it arrives: it waits
|
|
200
|
+
// in the contact's thread for a person there, who issues a vouch for a request or adds an issued one to the identity.
|
|
201
|
+
// A request: the sandbox asks the contact to vouch for it, with the claims it hopes for. The issuer signs what it decides.
|
|
202
|
+
export const S2sAttestationRequestSchema = z.object({
|
|
203
|
+
kind: z.literal("attestation.request"),
|
|
204
|
+
claims: S2sClaimsSchema.describe("The claims it asks to be vouched for, in its own words."),
|
|
205
|
+
note: z.string().max(S2S_NOTE_MAX).optional().describe("Why it asks, or how the contact could check."),
|
|
206
|
+
});
|
|
207
|
+
// An issued one: the contact's signed vouch for this sandbox, sent by its issuer; the envelope's `replyTo` names the
|
|
208
|
+
// request it answers, when it answers one.
|
|
209
|
+
export const S2sAttestationIssuedSchema = z.object({
|
|
210
|
+
kind: z.literal("attestation.issued"),
|
|
211
|
+
attestation: S2sAttestationSchema.describe("The attestation, signed by the sender about the receiver."),
|
|
212
|
+
note: z.string().max(S2S_NOTE_MAX).optional(),
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The line a thread files an attestation's message under: the note it came with, else its claims by name ("kind:
|
|
217
|
+
* organisation, country: PL"). The daemon writes it; the editor, which draws the claims themselves, leaves out a line
|
|
218
|
+
* that is only them.
|
|
219
|
+
*/
|
|
220
|
+
export const attestationText = (claims: Readonly<Record<string, string | number | boolean>>, note?: string): string => {
|
|
221
|
+
if (note !== undefined && note.trim() !== "") {
|
|
222
|
+
return note;
|
|
223
|
+
}
|
|
224
|
+
const named = Object.entries(claims).map(([name, value]) => `${name}: ${String(value)}`);
|
|
225
|
+
return named.length === 0 ? "No claims named." : named.join(", ");
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export const S2sPayloadSchema = z.discriminatedUnion("kind", [
|
|
229
|
+
S2sContactRequestSchema,
|
|
230
|
+
S2sContactAcceptSchema,
|
|
231
|
+
S2sContactUpdateSchema,
|
|
232
|
+
S2sContactRemoveSchema,
|
|
233
|
+
S2sIdentityRotatedSchema,
|
|
234
|
+
S2sMessagePayloadSchema,
|
|
235
|
+
S2sReportPayloadSchema,
|
|
236
|
+
S2sTaskRequestSchema,
|
|
237
|
+
S2sTaskUpdateSchema,
|
|
238
|
+
S2sTaskMessageSchema,
|
|
239
|
+
S2sTaskAnswerSchema,
|
|
240
|
+
S2sTaskStopSchema,
|
|
241
|
+
S2sReceiptSchema,
|
|
242
|
+
S2sAttestationRequestSchema,
|
|
243
|
+
S2sAttestationIssuedSchema,
|
|
244
|
+
]);
|
|
245
|
+
export type S2sPayload = z.infer<typeof S2sPayloadSchema>;
|
|
246
|
+
export type S2sPayloadOf<K extends S2sPayloadKind> = Extract<S2sPayload, { readonly kind: K }>;
|
|
247
|
+
|
|
248
|
+
/* THE INBOX DOOR's answers. */
|
|
249
|
+
|
|
250
|
+
export const S2sInboxAcceptedSchema = z.object({
|
|
251
|
+
ok: z.literal(true),
|
|
252
|
+
id: S2sEnvelopeIdSchema,
|
|
253
|
+
duplicate: z.boolean().optional().describe("It had already arrived; nothing changed."),
|
|
254
|
+
});
|
|
255
|
+
export type S2sInboxAccepted = z.infer<typeof S2sInboxAcceptedSchema>;
|
|
256
|
+
|
|
257
|
+
// Why a door refused, with the status it answers. A blocked sender is never told: it is answered as if accepted.
|
|
258
|
+
export const S2S_REFUSAL_CODES = [
|
|
259
|
+
"malformed",
|
|
260
|
+
"signature",
|
|
261
|
+
"not_contact",
|
|
262
|
+
"grant",
|
|
263
|
+
"floor",
|
|
264
|
+
"key_changed",
|
|
265
|
+
"unconfirmed",
|
|
266
|
+
"recipient",
|
|
267
|
+
"hops",
|
|
268
|
+
"too_large",
|
|
269
|
+
"unknown_kind",
|
|
270
|
+
"rate",
|
|
271
|
+
"unready",
|
|
272
|
+
"task",
|
|
273
|
+
"session",
|
|
274
|
+
"replay",
|
|
275
|
+
] as const;
|
|
276
|
+
export const S2sRefusalCodeSchema = z
|
|
277
|
+
.enum(S2S_REFUSAL_CODES)
|
|
278
|
+
.describe(
|
|
279
|
+
"malformed: not an envelope. signature: it does not verify against the pinned key. not_contact: a stranger may only ask to be one. grant: the contact lacks the grant for this kind. floor: a person-scoped contact's person is not on the roster above the kind's floor. key_changed: held until a person trusts the new key. unconfirmed: a request's document is not what its address serves. recipient: not this sandbox's address or key. hops: crossed too many sandboxes. too_large: past the size cap. unknown_kind: a kind this build does not know. rate: past the per-contact minute limit (retried). unready: nothing here takes this kind yet (retried). task: the task cannot be taken or acted on as asked (no such task, one not allowed yet or declined, the task grant's hourly turns spent), in words, never retried. session: a call names no session this sandbox holds (it expired, this sandbox restarted, or a key changed since it opened): open a new one. replay: a call or session request outside the clock window, or one seen before; an envelope sealed more than a day before it arrived or more than five minutes ahead of the receiver's clock.",
|
|
280
|
+
);
|
|
281
|
+
export type S2sRefusalCode = z.infer<typeof S2sRefusalCodeSchema>;
|
|
282
|
+
// 403, 409 and 422 end a send at once; 429 and 503 are tried again. Never 401, which a sender reads as a daemon too old
|
|
283
|
+
// for the door.
|
|
284
|
+
export const S2S_REFUSAL_STATUS = {
|
|
285
|
+
malformed: 400,
|
|
286
|
+
signature: 403,
|
|
287
|
+
not_contact: 403,
|
|
288
|
+
grant: 403,
|
|
289
|
+
floor: 403,
|
|
290
|
+
key_changed: 403,
|
|
291
|
+
unconfirmed: 403,
|
|
292
|
+
recipient: 409,
|
|
293
|
+
hops: 409,
|
|
294
|
+
too_large: 413,
|
|
295
|
+
unknown_kind: 422,
|
|
296
|
+
rate: 429,
|
|
297
|
+
unready: 503,
|
|
298
|
+
task: 409,
|
|
299
|
+
session: 409,
|
|
300
|
+
replay: 409,
|
|
301
|
+
} as const satisfies Record<S2sRefusalCode, number>;
|
|
302
|
+
export const S2sRefusalSchema = z.object({
|
|
303
|
+
error: z.string().describe("Why, in words a person can act on."),
|
|
304
|
+
code: S2sRefusalCodeSchema,
|
|
305
|
+
});
|
|
306
|
+
export type S2sRefusal = z.infer<typeof S2sRefusalSchema>;
|
|
307
|
+
|
|
308
|
+
/* CALLS: records and operating, request and response under a session key; nothing stored or retried. */
|
|
309
|
+
|
|
310
|
+
// POST /s2s/session: a fresh key agreement to the callee's key, signed by the caller. Loose for the same reason as the
|
|
311
|
+
// envelope header: the signature covers every field.
|
|
312
|
+
const sessionOpenFields = {
|
|
313
|
+
v: z.literal(1),
|
|
314
|
+
from: S2sAddressSchema,
|
|
315
|
+
fromFp: S2sFingerprintSchema,
|
|
316
|
+
to: S2sAddressSchema,
|
|
317
|
+
toFp: S2sFingerprintSchema,
|
|
318
|
+
as: S2sPersonSchema.optional().describe("The person of a person-scoped contact the calls are for."),
|
|
319
|
+
at: z.number().int().nonnegative().describe("When it was made, in epoch milliseconds; within S2S_CALL_SKEW_MS of the callee's clock."),
|
|
320
|
+
nonce: S2sBase64UrlSchema.describe("16 random bytes."),
|
|
321
|
+
enc: S2sEncSchema.omit({ nonce: true }),
|
|
322
|
+
sig: HybridSigSchema.describe("The caller's signature over the canonical request without `sig`."),
|
|
323
|
+
};
|
|
324
|
+
export const S2sSessionOpenSchema = z.looseObject(sessionOpenFields);
|
|
325
|
+
export type S2sSessionOpen = z.infer<z.ZodObject<typeof sessionOpenFields>>;
|
|
326
|
+
|
|
327
|
+
export const S2sSessionAnswerSchema = z.object({
|
|
328
|
+
session: S2sRefSchema.describe("The session's id, sent back in x-intentic-s2s-session on every call."),
|
|
329
|
+
expiresAt: z.number().int().describe("When the callee forgets it, in epoch milliseconds."),
|
|
330
|
+
confirm: S2sBase64UrlSchema.describe("HMAC-SHA256 under the session key over the session id: the callee derived the same key."),
|
|
331
|
+
});
|
|
332
|
+
export type S2sSessionAnswer = z.infer<typeof S2sSessionAnswerSchema>;
|
|
333
|
+
|
|
334
|
+
// What a sealed answer opens to: the method's status and what it answered, its output (S2S_CALLS) at 200 and a refusal in
|
|
335
|
+
// words (`error`, or the fleet reads' own `message`) otherwise. Sealed whole, so the edge reads no more of an answer than
|
|
336
|
+
// that one came back.
|
|
337
|
+
export const S2sCallAnswerSchema = z.object({
|
|
338
|
+
status: z.number().int().min(200).max(599).describe("The method's own status: 200, or why it refused (404 nothing by that name, 409, 429, 503)."),
|
|
339
|
+
body: z.unknown().describe("The method's output at 200; a refusal in words otherwise."),
|
|
340
|
+
});
|
|
341
|
+
export type S2sCallAnswer = z.infer<typeof S2sCallAnswerSchema>;
|
|
342
|
+
|
|
343
|
+
// A call's body or its answer, sealed under the session key with a fresh nonce.
|
|
344
|
+
export const S2sCallSealedSchema = z.object({
|
|
345
|
+
at: z.number().int().nonnegative().describe("When it was sealed, in epoch milliseconds."),
|
|
346
|
+
nonce: S2sBase64UrlSchema.describe("12 random bytes, never seen before in the session."),
|
|
347
|
+
body: S2sBase64UrlSchema.max(S2S_BODY_MAX_CHARS).describe("The method's input or answer as JSON, AES-256-GCM sealed."),
|
|
348
|
+
});
|
|
349
|
+
export type S2sCallSealed = z.infer<typeof S2sCallSealedSchema>;
|
|
350
|
+
|
|
351
|
+
export const S2S_CALL_METHODS = [
|
|
352
|
+
"records.fleet",
|
|
353
|
+
"records.show",
|
|
354
|
+
"records.bundle",
|
|
355
|
+
"records.diagnostics",
|
|
356
|
+
"operate.exec",
|
|
357
|
+
"operate.status",
|
|
358
|
+
"operate.stop",
|
|
359
|
+
"operate.read",
|
|
360
|
+
"operate.write",
|
|
361
|
+
"task.watch",
|
|
362
|
+
] as const;
|
|
363
|
+
export const S2sCallMethodSchema = z.enum(S2S_CALL_METHODS);
|
|
364
|
+
export type S2sCallMethod = z.infer<typeof S2sCallMethodSchema>;
|
|
365
|
+
|
|
366
|
+
const handle = z.string().min(1).max(200).describe("A conversation, by handle or id, as `agents show` takes it.");
|
|
367
|
+
// The rest of a fleet read's query, as `agents ls|find|show` spell it over HTTP (limit, all, repo, owner, transcript, last,
|
|
368
|
+
// grep, message, raw, stored, diff…).
|
|
369
|
+
const fleetQuery = z.record(z.string().max(40), z.string().max(2000)).optional().describe("The read's other query parameters, as `agents ls|show` send them.");
|
|
370
|
+
// The fleet reads answer what the `agents` command's own routes answer, which share no schema yet.
|
|
371
|
+
const FleetAnswerSchema = z.record(z.string(), z.unknown()).describe("What `agents ls|find|show` answers here.");
|
|
372
|
+
|
|
373
|
+
const commandId = z.string().min(1).max(100).describe("The command, by the id operate.exec answered.");
|
|
374
|
+
export const S2sOperateStatusInputSchema = z.object({
|
|
375
|
+
id: commandId,
|
|
376
|
+
waitS: z.number().int().min(0).max(LINK_OPERATE_WAIT_S_MAX).optional().describe("Hold the call this long for it to end."),
|
|
377
|
+
});
|
|
378
|
+
export const S2sTaskWatchInputSchema = z.object({
|
|
379
|
+
task: taskRef,
|
|
380
|
+
after: z.number().int().nonnegative().optional().describe("Answer once the status's version moves past this one."),
|
|
381
|
+
waitS: z.number().int().min(0).max(25).optional(),
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
// Each method's input and answer, opened from the sealed call and answer.
|
|
385
|
+
export const S2S_CALLS = {
|
|
386
|
+
"records.fleet": { grant: "records", input: z.object({ q: z.string().max(200).optional(), query: fleetQuery }), output: FleetAnswerSchema },
|
|
387
|
+
"records.show": { grant: "records", input: z.object({ handle, query: fleetQuery }), output: FleetAnswerSchema },
|
|
388
|
+
"records.bundle": { grant: "records", input: z.object({ handle }), output: ConversationBundleSchema },
|
|
389
|
+
"records.diagnostics": { grant: "records", input: DiagnosticsQuerySchema, output: DiagnosticsAnswerSchema },
|
|
390
|
+
"operate.exec": { grant: "operate", input: LinkExecSchema, output: LinkExecStatusSchema },
|
|
391
|
+
"operate.status": { grant: "operate", input: S2sOperateStatusInputSchema, output: LinkExecStatusSchema },
|
|
392
|
+
"operate.stop": { grant: "operate", input: z.object({ id: commandId }), output: LinkExecStatusSchema },
|
|
393
|
+
"operate.read": { grant: "operate", input: LinkReadSchema, output: LinkReadAnswerSchema },
|
|
394
|
+
"operate.write": { grant: "operate", input: LinkWriteSchema, output: LinkWriteAnswerSchema },
|
|
395
|
+
"task.watch": { grant: "task", input: S2sTaskWatchInputSchema, output: LinkTaskStatusSchema },
|
|
396
|
+
} as const satisfies Record<S2sCallMethod, { readonly grant: "records" | "operate" | "task"; readonly input: z.ZodType; readonly output: z.ZodType }>;
|
|
397
|
+
export type S2sCallInput<M extends S2sCallMethod> = z.input<(typeof S2S_CALLS)[M]["input"]>;
|
|
398
|
+
export type S2sCallOutput<M extends S2sCallMethod> = z.output<(typeof S2S_CALLS)[M]["output"]>;
|
|
399
|
+
|
|
400
|
+
// LINK_MAX_HOPS, under the name the inbox's hop check reads.
|
|
401
|
+
export const S2S_MAX_HOPS = LINK_MAX_HOPS;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { RAW_JSON_ROUTES } from "../protocol/raw/raw-json-routes.js";
|
|
2
|
+
import { RAW_ROUTES } from "../protocol/raw/raw-routes.js";
|
|
3
|
+
import { LINK_TURNS_PER_HOUR_DEFAULT } from "./links.js";
|
|
4
|
+
import { NeedAskSchema, NeedSubjectSchema } from "./needs.js";
|
|
5
|
+
import {
|
|
6
|
+
S2S_CALL_METHODS,
|
|
7
|
+
S2S_CALLS,
|
|
8
|
+
S2S_CLAIM_VALUE_MAX,
|
|
9
|
+
S2S_CLAIMS_MAX,
|
|
10
|
+
S2S_PAYLOAD_KINDS,
|
|
11
|
+
S2S_REFUSAL_CODES,
|
|
12
|
+
S2S_REFUSAL_STATUS,
|
|
13
|
+
S2sAddressSchema,
|
|
14
|
+
S2sClaimsSchema,
|
|
15
|
+
S2sContactScopeSchema,
|
|
16
|
+
S2sGrantsSchema,
|
|
17
|
+
S2sPayloadSchema,
|
|
18
|
+
S2sTaskGrantSchema,
|
|
19
|
+
} from "./s2s.js";
|
|
20
|
+
|
|
21
|
+
const s2sRoutes = Object.entries(RAW_ROUTES).filter(([key]) => key.includes(` /s2s/`) || key.endsWith(`/upgrade`) || key.endsWith(`/contact-bootstrap`));
|
|
22
|
+
|
|
23
|
+
describe("grants", () => {
|
|
24
|
+
it("default to messages only", () => {
|
|
25
|
+
expect(S2sGrantsSchema.parse({})).toEqual({ message: true, report: false, records: false, operate: false, wake: false });
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("carry a task grant as the link terms do, under their names and defaults", () => {
|
|
29
|
+
expect(S2sTaskGrantSchema.parse({})).toEqual({ approve: false, turnsPerHour: LINK_TURNS_PER_HOUR_DEFAULT });
|
|
30
|
+
expect(S2sTaskGrantSchema.parse({ actsAs: `reviewer`, approve: true })).toEqual({ actsAs: `reviewer`, approve: true, turnsPerHour: LINK_TURNS_PER_HOUR_DEFAULT });
|
|
31
|
+
expect(S2sTaskGrantSchema.safeParse({ turnsPerHour: 121 }).success).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe("addresses and scopes", () => {
|
|
36
|
+
it("take a host, a domain, localhost with a port, and nothing uppercase or with a path", () => {
|
|
37
|
+
for (const ok of [`0123456789ab.sandbox.example`, `ops.acme.example`, `localhost:8443`, `a.b:65535`]) {
|
|
38
|
+
expect(S2sAddressSchema.safeParse(ok).success).toBe(true);
|
|
39
|
+
}
|
|
40
|
+
for (const bad of [`Ops.Example`, `ops.example/x`, `ops`, `https://ops.example`, `ops.example.`]) {
|
|
41
|
+
expect(S2sAddressSchema.safeParse(bad).success).toBe(false);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("names the person of a person-scoped contact and nobody for a sandbox-scoped one", () => {
|
|
46
|
+
expect(S2sContactScopeSchema.parse({ kind: `person`, person: `ada@acme.example` })).toEqual({ kind: `person`, person: `ada@acme.example` });
|
|
47
|
+
expect(S2sContactScopeSchema.safeParse({ kind: `person` }).success).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe("payloads", () => {
|
|
52
|
+
it("have one schema per kind the header may name, and refuse any other", () => {
|
|
53
|
+
expect(S2S_PAYLOAD_KINDS.length).toBe(15);
|
|
54
|
+
expect(S2sPayloadSchema.safeParse({ kind: `poll.vote` }).success).toBe(false);
|
|
55
|
+
expect(S2sPayloadSchema.parse({ kind: `message`, text: `hi` })).toEqual({ kind: `message`, text: `hi`, attachments: [] });
|
|
56
|
+
expect(S2sPayloadSchema.parse({ kind: `task.stop`, task: `r-1` })).toEqual({ kind: `task.stop`, task: `r-1` });
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("carry a report and a task in the account report's and the link task's own fields", () => {
|
|
60
|
+
const report = { kind: `report`, project: `github.com/acme/app`, report: { kind: `detection`, title: `x`, fingerprint: `f`, message: `m` }, times: 2 };
|
|
61
|
+
expect(S2sPayloadSchema.safeParse(report).success).toBe(true);
|
|
62
|
+
// The project a pass used to carry rides the report itself.
|
|
63
|
+
const { project: _project, ...unnamed } = report;
|
|
64
|
+
expect(S2sPayloadSchema.safeParse(unnamed).success).toBe(false);
|
|
65
|
+
expect(S2sPayloadSchema.parse({ kind: `task.request`, requestId: `r-1`, task: `do it` })).toEqual({ kind: `task.request`, requestId: `r-1`, task: `do it`, hops: 0 });
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe("attestation payloads", () => {
|
|
70
|
+
it("carry a request's claims and note, and an issued attestation whole, of a type this build reads or not", () => {
|
|
71
|
+
const request = { kind: `attestation.request`, claims: { kind: `organisation`, over18: true, staff: 12 }, note: `we met in Gdańsk` } as const;
|
|
72
|
+
expect(S2sPayloadSchema.parse(request)).toEqual(request);
|
|
73
|
+
expect(S2sPayloadSchema.safeParse({ kind: `attestation.request`, claims: { Kind: `person` } }).success).toBe(false);
|
|
74
|
+
const later = { kind: `attestation.issued`, attestation: { type: `zk-uniqueness`, v: 2, proof: `…` } } as const;
|
|
75
|
+
expect(S2sPayloadSchema.parse(later)).toEqual(later);
|
|
76
|
+
expect(S2sPayloadSchema.safeParse({ kind: `attestation.issued`, attestation: { v: 1 } }).success).toBe(false);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("bound the claims by count, by a word's length and by their bytes whole", () => {
|
|
80
|
+
const claims = (count: number, value: string) => Object.fromEntries(Array.from({ length: count }, (_, at) => [`c${at}`, value]));
|
|
81
|
+
expect(S2sClaimsSchema.safeParse(claims(S2S_CLAIMS_MAX, `x`)).success).toBe(true);
|
|
82
|
+
expect(S2sClaimsSchema.safeParse(claims(S2S_CLAIMS_MAX + 1, `x`)).success).toBe(false);
|
|
83
|
+
expect(S2sClaimsSchema.safeParse({ name: `x`.repeat(S2S_CLAIM_VALUE_MAX) }).success).toBe(true);
|
|
84
|
+
expect(S2sClaimsSchema.safeParse({ name: `x`.repeat(S2S_CLAIM_VALUE_MAX + 1) }).success).toBe(false);
|
|
85
|
+
// Six words of 120 characters come to 769 bytes of JSON, one past the bytes and well inside the count.
|
|
86
|
+
expect(S2sClaimsSchema.safeParse(claims(6, `x`.repeat(S2S_CLAIM_VALUE_MAX))).success).toBe(false);
|
|
87
|
+
expect(S2sClaimsSchema.safeParse({ ...claims(5, `x`.repeat(S2S_CLAIM_VALUE_MAX)), c5: `x`.repeat(S2S_CLAIM_VALUE_MAX - 1) }).success).toBe(true);
|
|
88
|
+
expect(S2sClaimsSchema.safeParse({ "verified by": `x` }).success).toBe(false);
|
|
89
|
+
expect(S2sClaimsSchema.safeParse({ nested: { a: 1 } }).success).toBe(false);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe("refusals", () => {
|
|
94
|
+
it("answer a status for every code and never 401, which a sender reads as a daemon too old for the door", () => {
|
|
95
|
+
expect(Object.keys(S2S_REFUSAL_STATUS).toSorted()).toEqual([...S2S_REFUSAL_CODES].toSorted());
|
|
96
|
+
expect(Object.values(S2S_REFUSAL_STATUS).toSorted((a, b) => a - b)).toEqual([400, 403, 403, 403, 403, 403, 403, 409, 409, 409, 409, 409, 413, 422, 429, 503]);
|
|
97
|
+
expect(S2S_REFUSAL_STATUS.rate).toBe(429);
|
|
98
|
+
// A task refused in words (no such task, not allowed yet, the grant's hourly turns spent) is never retried.
|
|
99
|
+
expect(S2S_REFUSAL_STATUS.task).toBe(409);
|
|
100
|
+
expect(S2S_REFUSAL_STATUS.unready).toBe(503);
|
|
101
|
+
expect(S2S_REFUSAL_STATUS.unknown_kind).toBe(422);
|
|
102
|
+
// A call's session gone, or a call replayed or held back: refused in words, never 401.
|
|
103
|
+
expect(S2S_REFUSAL_STATUS.session).toBe(409);
|
|
104
|
+
expect(S2S_REFUSAL_STATUS.replay).toBe(409);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe("calls", () => {
|
|
109
|
+
it("give every method a grant, an input and an answer", () => {
|
|
110
|
+
expect(Object.keys(S2S_CALLS).toSorted()).toEqual([...S2S_CALL_METHODS].toSorted());
|
|
111
|
+
expect(S2S_CALLS[`operate.exec`].grant).toBe(`operate`);
|
|
112
|
+
expect(S2S_CALLS[`records.bundle`].grant).toBe(`records`);
|
|
113
|
+
expect(S2S_CALLS[`task.watch`].grant).toBe(`task`);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe("the contact need", () => {
|
|
118
|
+
it("is a need subject and an ask like every other kind", () => {
|
|
119
|
+
const subject = { kind: `contact` as const, address: `ops.acme.example`, action: `add` as const, grants: { report: true } };
|
|
120
|
+
expect(NeedSubjectSchema.parse(subject)).toEqual({ ...subject, grants: { message: true, report: true, records: false, operate: false, wake: false } });
|
|
121
|
+
expect(NeedAskSchema.parse({ kind: `contact`, action: `accept`, contactId: `c-1` })).toEqual({
|
|
122
|
+
kind: `contact`,
|
|
123
|
+
action: `accept`,
|
|
124
|
+
contactId: `c-1`,
|
|
125
|
+
grants: { message: true, report: false, records: false, operate: false, wake: false },
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe("the s2s routes", () => {
|
|
131
|
+
it("are doors that check their own credential for another daemon, and no control token reaches any", () => {
|
|
132
|
+
const doors = s2sRoutes.filter(([, meta]) => `auth` in meta && meta.auth === `door`).map(([key]) => key);
|
|
133
|
+
expect(doors.toSorted()).toEqual(
|
|
134
|
+
[
|
|
135
|
+
`GET /s2s/identity`,
|
|
136
|
+
`POST /s2s/inbox`,
|
|
137
|
+
`POST /s2s/session`,
|
|
138
|
+
`POST /s2s/call/{method}`,
|
|
139
|
+
`POST /link/upgrade`,
|
|
140
|
+
`POST /account/pairings/upgrade`,
|
|
141
|
+
`POST /account/contact-bootstrap`,
|
|
142
|
+
].toSorted(),
|
|
143
|
+
);
|
|
144
|
+
expect(s2sRoutes.filter(([, meta]) => !(`control` in meta) || meta.control !== `never`).map(([key]) => key)).toEqual([]);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("keep the recovery key the owner's alone", () => {
|
|
148
|
+
expect(RAW_ROUTES[`POST /s2s/me/recovery`]).toEqual({ floor: `owner`, panel: false, control: `never` });
|
|
149
|
+
expect(RAW_ROUTES[`POST /s2s/me/recover`]).toEqual({ floor: `owner`, panel: false, control: `never` });
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it("keep attestations the owner's or a maintainer's, and out of every agent's and panel's reach", () => {
|
|
153
|
+
const attestations = s2sRoutes.filter(([key]) => key.includes(`attestations`));
|
|
154
|
+
expect(attestations.map(([key]) => key)).toEqual([
|
|
155
|
+
`GET /s2s/me/attestations`,
|
|
156
|
+
`POST /s2s/me/attestations`,
|
|
157
|
+
`DELETE /s2s/me/attestations/{id}`,
|
|
158
|
+
`POST /s2s/me/attestations/ask`,
|
|
159
|
+
`POST /s2s/attestations/issue`,
|
|
160
|
+
]);
|
|
161
|
+
expect(RAW_ROUTES[`GET /s2s/me/attestations`]).toEqual({ floor: `maintainer`, control: `never` });
|
|
162
|
+
for (const [, meta] of attestations.slice(1)) {
|
|
163
|
+
expect(meta).toEqual({ panel: false, control: `never` });
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("register paired before a contact's id, which would otherwise take it", () => {
|
|
168
|
+
const keys = Object.keys(RAW_ROUTES);
|
|
169
|
+
expect(keys.indexOf(`POST /s2s/contacts/paired`)).toBeLessThan(keys.indexOf(`POST /s2s/contacts/{id}`));
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it("answer JSON on every one but a message's file, which answers its bytes", () => {
|
|
173
|
+
expect(s2sRoutes.map(([key]) => key).filter((key) => !(key in RAW_JSON_ROUTES))).toEqual([`GET /s2s/messages/{id}/files/{name}`]);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// SANDBOX-TO-SANDBOX (docs/architecture/messages.md): every wire and editor shape of contacts, messages and calls,
|
|
2
|
+
// imported from here. s2s-identity.ts: the identity document, keys, addresses and grants. s2s-wire.ts: the envelope, its
|
|
3
|
+
// payload kinds, the doors' refusals, sessions and calls. s2s-views.ts: what the Messages tab and the `messages` command
|
|
4
|
+
// read and send, and the pairing and upgrade exchanges. contact-need.ts: the card an agent raises to add or accept a
|
|
5
|
+
// contact. The primitives that make and check them are protocol/s2s/ (`@intentic/sandbox-contract/s2s`).
|
|
6
|
+
export * from "./s2s-identity.js";
|
|
7
|
+
export * from "./s2s-wire.js";
|
|
8
|
+
export * from "./s2s-views.js";
|
|
9
|
+
export * from "./contact-need.js";
|
package/src/schemas/secrets.ts
CHANGED
|
@@ -22,6 +22,16 @@ export const SecretKeysSchema = z.object({
|
|
|
22
22
|
export const SecretKeyParamSchema = z.object({ key: secretKey.describe("Which secret, by name.") });
|
|
23
23
|
export const SecretRevealSchema = z.object({ value: z.string().describe("The value itself. The only place in this API one is ever returned.") });
|
|
24
24
|
|
|
25
|
+
// (2026-11-25) A value the agent already holds the way to, moved into the store without passing through the chat or its
|
|
26
|
+
// own context: `secrets import NAME --stdin`, a value piped from where it lives now (another orchestrator's variables,
|
|
27
|
+
// a file on a server). A new name only, never one anything here holds: the agent token can add a credential and never
|
|
28
|
+
// replace one, so a value the owner stored cannot be swapped under the references that read it.
|
|
29
|
+
export const SECRET_IMPORT_MAX = 64_000;
|
|
30
|
+
export const SecretImportSchema = z.object({
|
|
31
|
+
key: secretKey.describe("The name to store it under: one nothing here holds yet."),
|
|
32
|
+
value: z.string().min(1).max(SECRET_IMPORT_MAX).describe("The value, as read from the command's input. Stored, never echoed or logged."),
|
|
33
|
+
});
|
|
34
|
+
|
|
25
35
|
// A secret nobody has to find or paste: a session key, a webhook signing secret, a database password the task sets up
|
|
26
36
|
// itself. The sandbox makes it and keeps it; the caller gets its reference and length, never the value.
|
|
27
37
|
// The shortest stored value the sandbox masks wherever it appears; a shorter one masks only in a secret-like context. The
|
|
@@ -72,9 +82,9 @@ export const CredentialGateKindSchema = z
|
|
|
72
82
|
export type CredentialGateKind = z.infer<typeof CredentialGateKindSchema>;
|
|
73
83
|
|
|
74
84
|
export const CredentialLaneSchema = z
|
|
75
|
-
.enum(["shell", "code", "browser", "session", "otp", "gateway", "ssh", "device", "desktop"])
|
|
85
|
+
.enum(["shell", "code", "browser", "session", "otp", "gateway", "ssh", "device", "desktop", "mcp"])
|
|
76
86
|
.describe(
|
|
77
|
-
"What the credential was about to be used for: a shell command, a script, typing into a page, mounting a connected account, one one-time code, a request the credential gateway attaches it to, a signature the sandbox's ssh agent makes with a held key, typing into a window or phone app on one of the owner's computers,
|
|
87
|
+
"What the credential was about to be used for: a shell command, a script, typing into a page, mounting a connected account, one one-time code, a request the credential gateway attaches it to, a signature the sandbox's ssh agent makes with a held key, typing into a window or phone app on one of the owner's computers, typing into a window on the sandbox's own desktop, or an argument of a tool call to an MCP server the owner connected.",
|
|
78
88
|
);
|
|
79
89
|
export type CredentialLane = z.infer<typeof CredentialLaneSchema>;
|
|
80
90
|
|
|
@@ -319,14 +329,14 @@ export const SecretInventoryEntrySchema = z.object({
|
|
|
319
329
|
.object({
|
|
320
330
|
at: z.number().describe("When, in milliseconds."),
|
|
321
331
|
lane: z
|
|
322
|
-
.enum(["shell", "code", "browser", "gateway", "ssh", "device", "desktop"])
|
|
332
|
+
.enum(["shell", "code", "browser", "gateway", "ssh", "device", "desktop", "mcp", "deploy"])
|
|
323
333
|
.describe(
|
|
324
|
-
"How it was used: a command, a script, typed into a page, attached by the credential gateway to a request the agent sent, a key the sandbox's ssh agent signed with for the agent, typed into a window or app on one of the owner's computers,
|
|
334
|
+
"How it was used: a command, a script, typed into a page, attached by the credential gateway to a request the agent sent, a key the sandbox's ssh agent signed with for the agent, typed into a window or app on one of the owner's computers, typed into a window on the sandbox's desktop, sent in a tool call to an MCP server the owner connected, or rendered by the sandbox into a managed stack's .env or registry login as it deployed it.",
|
|
325
335
|
),
|
|
326
336
|
detail: z
|
|
327
337
|
.string()
|
|
328
338
|
.optional()
|
|
329
|
-
.describe("Where it went: the start of the command or script, or the
|
|
339
|
+
.describe("Where it went: the start of the command or script, the site, the MCP tool and its server's host, or the stack and the computer it was deployed to. Names and destinations only, never values."),
|
|
330
340
|
approvedBy: z.string().optional().describe("Who released it for that use, when it is gated. Absent when nothing had to be approved."),
|
|
331
341
|
})
|
|
332
342
|
.optional()
|
|
@@ -376,3 +386,11 @@ export const SecretInventorySchema = z.object({
|
|
|
376
386
|
.array(SecretInventoryEntrySchema)
|
|
377
387
|
.describe("One entry per secret this sandbox knows about, from every place they live. No values, ever."),
|
|
378
388
|
});
|
|
389
|
+
|
|
390
|
+
// (2026-11-25) A keyed mark of each named value: an HMAC under a key this sandbox keeps in its auth root, never a plain
|
|
391
|
+
// hash, so a mark says nothing about the value to anyone without that key. A managed deploy answers the marks of the
|
|
392
|
+
// values it filled (device-stacks.ts); comparing them later with these tells the Deployments extension that a stack's
|
|
393
|
+
// secret changed in the store, without it ever holding one. A name nothing holds answers no mark.
|
|
394
|
+
export const SecretMarksRequestSchema = z.object({ names: z.array(secretKey).min(1).max(200) });
|
|
395
|
+
export const SecretMarksResponseSchema = z.object({ marks: z.record(z.string(), z.string()) });
|
|
396
|
+
export type SecretMarksResponse = z.infer<typeof SecretMarksResponseSchema>;
|