@sema-agent/core 7.59.0 → 7.61.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/CHANGELOG.md +1169 -0
- package/README.md +2 -2
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +4 -3
- package/dist/agents/agent-transcript-tool.js +4 -2
- package/dist/agents/cascade.d.ts +61 -10
- package/dist/agents/cascade.js +60 -20
- package/dist/agents/child-model-seat.js +6 -3
- package/dist/agents/composition-allowance.d.ts +53 -0
- package/dist/agents/composition-allowance.js +49 -0
- package/dist/agents/composition-placement.d.ts +29 -0
- package/dist/agents/composition-placement.js +24 -0
- package/dist/agents/cumulative-stats.d.ts +4 -0
- package/dist/agents/cumulative-stats.js +3 -1
- package/dist/agents/inherited-tool-pool.d.ts +28 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/peer-notice-route.d.ts +1 -1
- package/dist/agents/peer-notice-route.js +4 -3
- package/dist/agents/peer-notices.d.ts +4 -4
- package/dist/agents/peer-notices.js +8 -4
- package/dist/agents/peer-session-drain.d.ts +8 -1
- package/dist/agents/peer-session-drain.js +36 -7
- package/dist/agents/repair-loop.js +16 -6
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +16 -3
- package/dist/agents/roster-store.d.ts +2 -2
- package/dist/agents/roster-store.js +8 -3
- package/dist/agents/send-message-tool.d.ts +14 -27
- package/dist/agents/send-message-tool.js +47 -54
- package/dist/agents/subagent-completion-gate.d.ts +35 -0
- package/dist/agents/subagent-completion-gate.js +62 -0
- package/dist/agents/subagent-steps.d.ts +7 -6
- package/dist/agents/subagent.d.ts +52 -28
- package/dist/agents/subagent.js +276 -246
- package/dist/agents/suspend-guard.d.ts +9 -0
- package/dist/agents/suspend-guard.js +4 -0
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +37 -27
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/anthropic.js +1 -0
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/errors.d.ts +7 -1
- package/dist/brain/errors.js +6 -0
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +1 -0
- package/dist/brain/openai.js +1 -0
- package/dist/brain/provider-dialect.d.ts +10 -0
- package/dist/brain/provider-dialect.js +13 -2
- package/dist/brain/route-adjudicator.js +3 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +4 -0
- package/dist/brain/timeout.d.ts +3 -1
- package/dist/brain/timeout.js +18 -5
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/agent-state.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +61 -23
- package/dist/core/allow-entry.js +134 -39
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/ask-origin.d.ts +79 -0
- package/dist/core/ask-origin.js +76 -0
- package/dist/core/ask-question.d.ts +19 -13
- package/dist/core/ask-question.js +8 -2
- package/dist/core/auto-compaction.d.ts +2 -0
- package/dist/core/auto-compaction.js +2 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +66 -17
- package/dist/core/background-agent-store.d.ts +17 -6
- package/dist/core/background-agent-store.js +15 -13
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-requirements.d.ts +24 -3
- package/dist/core/checkpoint-requirements.js +9 -1
- package/dist/core/checkpoint-store.d.ts +86 -32
- package/dist/core/checkpoint-store.js +10 -5
- package/dist/core/child-clamp-seats.d.ts +3 -2
- package/dist/core/child-clamp-seats.js +4 -3
- package/dist/core/closest-name.d.ts +13 -0
- package/dist/core/closest-name.js +35 -0
- package/dist/core/compliance.d.ts +1 -1
- package/dist/core/context-settings.js +3 -5
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +5 -6
- package/dist/core/decision-receipt.d.ts +14 -1
- package/dist/core/decision-receipt.js +6 -3
- package/dist/core/delegation-frames.d.ts +13 -9
- package/dist/core/effective-path-target.js +2 -3
- package/dist/core/engine-attestation.d.ts +11 -1
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-notice.d.ts +106 -32
- package/dist/core/file-history-retention.d.ts +8 -0
- package/dist/core/file-history-retention.js +14 -11
- package/dist/core/file-history-store.d.ts +31 -1
- package/dist/core/file-history-store.js +31 -2
- package/dist/core/frame-settlement.d.ts +15 -0
- package/dist/core/frame-settlement.js +10 -1
- package/dist/core/fs-write-gate-policy.d.ts +3 -3
- package/dist/core/fs-write-gate-policy.js +8 -7
- package/dist/core/gate-fold.js +9 -6
- package/dist/core/gate-lanes.js +46 -12
- package/dist/core/gate-outcome.d.ts +40 -1
- package/dist/core/gate-outcome.js +10 -0
- package/dist/core/git-worktree-env.d.ts +7 -3
- package/dist/core/git-worktree-env.js +16 -13
- package/dist/core/governance-codes.d.ts +19 -3
- package/dist/core/governance-codes.js +27 -3
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +51 -60
- package/dist/core/hooks.js +131 -78
- package/dist/core/host-floor.js +3 -5
- package/dist/core/image-admission.d.ts +145 -52
- package/dist/core/image-admission.js +202 -47
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/input-author.d.ts +36 -0
- package/dist/core/input-author.js +39 -0
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/leg-identity.d.ts +62 -0
- package/dist/core/leg-identity.js +18 -0
- package/dist/core/locked-config.d.ts +55 -3
- package/dist/core/locked-config.js +84 -51
- package/dist/core/lsp.d.ts +5 -3
- package/dist/core/lsp.js +3 -2
- package/dist/core/mailbox-store.d.ts +85 -10
- package/dist/core/mailbox-store.js +31 -10
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-connection-pool.d.ts +6 -20
- package/dist/core/mcp-connection-pool.js +10 -28
- package/dist/core/mcp-failure.d.ts +83 -16
- package/dist/core/mcp-failure.js +67 -30
- package/dist/core/mcp-host-seat.d.ts +131 -0
- package/dist/core/mcp-host-seat.js +305 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +9 -4
- package/dist/core/mcp-server-link.d.ts +18 -6
- package/dist/core/mcp-server-link.js +19 -4
- package/dist/core/mcp-server-spec.d.ts +39 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp-session-end.d.ts +1 -2
- package/dist/core/mcp-session-end.js +1 -1
- package/dist/core/mcp.d.ts +23 -55
- package/dist/core/mcp.js +172 -156
- package/dist/core/media-byte-cap.d.ts +21 -46
- package/dist/core/media-byte-cap.js +55 -55
- package/dist/core/member-group.d.ts +7 -0
- package/dist/core/member-group.js +35 -0
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/consolidation.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.js +7 -1
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/dual-root.d.ts +31 -0
- package/dist/core/memory-engine/dual-root.js +59 -11
- package/dist/core/memory-engine/engine.js +27 -24
- package/dist/core/memory-engine/file-backend.d.ts +13 -0
- package/dist/core/memory-engine/file-backend.js +35 -15
- package/dist/core/memory-engine/index.d.ts +2 -1
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +3 -0
- package/dist/core/memory-engine/layout.js +13 -3
- package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
- package/dist/core/memory-engine/memory-deployment.js +182 -0
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +68 -13
- package/dist/core/memory-engine/sync-client.js +147 -18
- package/dist/core/memory-engine/sync-report.d.ts +106 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +13 -3
- package/dist/core/mode-policy.d.ts +15 -7
- package/dist/core/mode-policy.js +18 -6
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +100 -0
- package/dist/core/mods/agent-stations.js +154 -0
- package/dist/core/mods/dollar.d.ts +62 -0
- package/dist/core/mods/extension-call.d.ts +15 -1
- package/dist/core/mods/extension-call.js +7 -2
- package/dist/core/mods/kernel/dispatch.d.ts +9 -4
- package/dist/core/mods/kernel/dispatch.js +8 -8
- package/dist/core/mods/kernel/events.d.ts +13 -4
- package/dist/core/mods/kernel/events.js +14 -10
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/kernel/registration.d.ts +3 -0
- package/dist/core/mods/kernel/registration.js +5 -0
- package/dist/core/mods/kernel/site-rules.d.ts +6 -3
- package/dist/core/mods/kernel/site-rules.js +10 -2
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/session-append.d.ts +115 -0
- package/dist/core/mods/session-append.js +311 -0
- package/dist/core/mods/session-compact.d.ts +48 -0
- package/dist/core/mods/session-compact.js +194 -0
- package/dist/core/mods/session-receive.d.ts +93 -0
- package/dist/core/mods/session-receive.js +141 -0
- package/dist/core/mods/session-send.d.ts +72 -0
- package/dist/core/mods/session-send.js +88 -0
- package/dist/core/mods/stations.d.ts +89 -75
- package/dist/core/mods/stations.js +57 -53
- package/dist/core/mods/tool-call.d.ts +12 -4
- package/dist/core/mods/tool-call.js +32 -16
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/output-style.js +3 -4
- package/dist/core/own-property-receipt.d.ts +62 -0
- package/dist/core/own-property-receipt.js +43 -0
- package/dist/core/park-selfcheck.js +12 -10
- package/dist/core/path-identity.d.ts +11 -0
- package/dist/core/path-identity.js +4 -0
- package/dist/core/path-rule-binding.d.ts +3 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/peer-seat.d.ts +66 -11
- package/dist/core/peer-seat.js +199 -42
- package/dist/core/permission-rule-consent.d.ts +21 -26
- package/dist/core/permission-rule-consent.js +22 -3
- package/dist/core/permission-rule-model.d.ts +38 -13
- package/dist/core/permission-rule-model.js +54 -16
- package/dist/core/permission-rule-org.d.ts +1 -1
- package/dist/core/permission-rule-provider.js +4 -1
- package/dist/core/permission-rules.d.ts +4 -0
- package/dist/core/permission-rules.js +11 -16
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +218 -122
- package/dist/core/remote-env.js +133 -14
- package/dist/core/retention-policy.d.ts +24 -23
- package/dist/core/retention-policy.js +36 -2
- package/dist/core/retention.d.ts +4 -1
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +8 -3
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +12 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +37 -3
- package/dist/core/roles.js +126 -78
- package/dist/core/row-admission.d.ts +10 -0
- package/dist/core/row-admission.js +5 -0
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/advisor-instructions.d.ts +2 -1
- package/dist/core/runner/advisor-instructions.js +2 -1
- package/dist/core/runner/announce-once-ledger.d.ts +4 -4
- package/dist/core/runner/assemble-result.d.ts +13 -8
- package/dist/core/runner/assemble-result.js +12 -8
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +21 -10
- package/dist/core/runner/caller-roster.d.ts +12 -9
- package/dist/core/runner/caller-roster.js +5 -2
- package/dist/core/runner/checkpoint-scope.d.ts +16 -1
- package/dist/core/runner/checkpoint-scope.js +21 -0
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/compact-session.js +14 -2
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/compaction-restate.d.ts +2 -2
- package/dist/core/runner/compaction-restate.js +4 -3
- package/dist/core/runner/construction-doors.d.ts +2 -2
- package/dist/core/runner/construction-doors.js +7 -2
- package/dist/core/runner/contracts.d.ts +158 -65
- package/dist/core/runner/cross-boundary-lane.d.ts +4 -6
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/decide-continuation.d.ts +4 -2
- package/dist/core/runner/decide-continuation.js +7 -4
- package/dist/core/runner/denial-limit-arms.d.ts +15 -21
- package/dist/core/runner/denial-limit-arms.js +17 -10
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/expire-settle.d.ts +44 -0
- package/dist/core/runner/expire-settle.js +55 -0
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +75 -7
- package/dist/core/runner/gate-exit.js +20 -1
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +4 -4
- package/dist/core/runner/halt-attribution.d.ts +2 -1
- package/dist/core/runner/halt-attribution.js +2 -1
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/local-claims.d.ts +17 -0
- package/dist/core/runner/local-claims.js +18 -0
- package/dist/core/runner/media-removed-seat.d.ts +46 -0
- package/dist/core/runner/media-removed-seat.js +88 -0
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- package/dist/core/runner/park-commit.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
- package/dist/core/runner/permission-rule-lanes.js +29 -10
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.d.ts +26 -0
- package/dist/core/runner/placement-fence.js +38 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
- package/dist/core/runner/prepare-ask-lane.js +4 -4
- package/dist/core/runner/prepare-boundary-parks.d.ts +6 -3
- package/dist/core/runner/prepare-boundary-parks.js +4 -4
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +30 -26
- package/dist/core/runner/prepare-context-lane.d.ts +6 -2
- package/dist/core/runner/prepare-context-lane.js +13 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +13 -11
- package/dist/core/runner/prepare-delegation-surface.js +7 -8
- package/dist/core/runner/prepare-execution-env.d.ts +5 -2
- package/dist/core/runner/prepare-execution-env.js +7 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +23 -17
- package/dist/core/runner/prepare-gate-stations.js +10 -7
- package/dist/core/runner/prepare-hands-readface.d.ts +8 -6
- package/dist/core/runner/prepare-hands-readface.js +19 -11
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
- package/dist/core/runner/prepare-inherited-gate.js +12 -5
- package/dist/core/runner/prepare-lsp.d.ts +3 -0
- package/dist/core/runner/prepare-lsp.js +2 -2
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +8 -7
- package/dist/core/runner/prepare-park-ask.js +6 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +15 -25
- package/dist/core/runner/prepare-policy-chain.js +131 -128
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-project-context.js +8 -5
- package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -0
- package/dist/core/runner/prepare-prompt-inputs.js +4 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +9 -2
- package/dist/core/runner/prepare-question-face.d.ts +6 -4
- package/dist/core/runner/prepare-question-face.js +2 -2
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +11 -9
- package/dist/core/runner/prepare-suspend-saga.js +21 -13
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +84 -42
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
- package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +7 -3
- package/dist/core/runner/prepare-wiring-manifest.js +34 -19
- package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
- package/dist/core/runner/prepare-workspace-restore.js +12 -8
- package/dist/core/runner/read-root-grant.d.ts +1 -1
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/resume-admission.d.ts +5 -3
- package/dist/core/runner/resume-admission.js +17 -3
- package/dist/core/runner/resume-apply.js +3 -1
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/resume-claim.d.ts +8 -3
- package/dist/core/runner/resume-claim.js +28 -12
- package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
- package/dist/core/runner/resume-internals-and-config.js +10 -1
- package/dist/core/runner/resume-preflight.d.ts +3 -2
- package/dist/core/runner/resume-preflight.js +13 -26
- package/dist/core/runner/retired-runner-deps.js +6 -1
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +1 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +3 -2
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +5 -3
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.js +15 -6
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-leg.js +65 -56
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +36 -12
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +14 -8
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +12 -4
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +26 -17
- package/dist/core/runner/run-turn-boundary.js +37 -19
- package/dist/core/runner/runtask.d.ts +25 -7
- package/dist/core/runner/runtask.js +46 -22
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/session-rule-policy.js +6 -1
- package/dist/core/runner/shell-env-withheld.d.ts +1 -1
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
- package/dist/core/runner/stream-halt-verbs.js +4 -3
- package/dist/core/runner/stream-reap.d.ts +7 -6
- package/dist/core/runner/stream-reap.js +13 -16
- package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
- package/dist/core/runner/stream-settle-backstop.js +5 -3
- package/dist/core/runner/stream-steer-verb.d.ts +5 -2
- package/dist/core/runner/stream-steer-verb.js +8 -7
- package/dist/core/runner/sub-agent-deny-lists.js +10 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/terminal-account.d.ts +11 -1
- package/dist/core/runner/terminal-account.js +20 -0
- package/dist/core/runner/terminal-projection.d.ts +8 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-disclosure.d.ts +3 -0
- package/dist/core/runner/tool-disclosure.js +5 -4
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-end-body.js +1 -1
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-output-projection.d.ts +3 -3
- package/dist/core/runner/tool-output-projection.js +7 -6
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/tool-table-view.d.ts +56 -0
- package/dist/core/runner/tool-table-view.js +51 -0
- package/dist/core/runner/turn-attachments.d.ts +6 -7
- package/dist/core/runner/turn-attachments.js +4 -17
- package/dist/core/runner/void-verifier-pause.d.ts +33 -0
- package/dist/core/runner/void-verifier-pause.js +41 -0
- package/dist/core/runner-deps.d.ts +55 -43
- package/dist/core/secret-env.d.ts +14 -13
- package/dist/core/secret-env.js +8 -9
- package/dist/core/session-log-transfer.js +9 -10
- package/dist/core/session-policy-store.d.ts +10 -3
- package/dist/core/session-policy-store.js +21 -3
- package/dist/core/session-reconcile.d.ts +3 -2
- package/dist/core/session-reconcile.js +7 -4
- package/dist/core/session-store.d.ts +5 -2
- package/dist/core/session-store.js +53 -16
- package/dist/core/session.d.ts +2 -1
- package/dist/core/shell-confinement.d.ts +37 -0
- package/dist/core/shell-confinement.js +56 -0
- package/dist/core/skill-grant.d.ts +9 -0
- package/dist/core/skill-grant.js +18 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
- package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
- package/dist/core/store-contracts/file-history-store-contract.js +25 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
- package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +67 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/task-event.d.ts +35 -10
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +172 -12
- package/dist/core/task-notification.js +209 -12
- package/dist/core/task-registry-agent.d.ts +23 -55
- package/dist/core/task-registry-agent.js +41 -56
- package/dist/core/task-registry-monitor.d.ts +8 -1
- package/dist/core/task-registry-monitor.js +43 -61
- package/dist/core/task-registry-shared.d.ts +52 -114
- package/dist/core/task-registry-shared.js +24 -48
- package/dist/core/task-registry-workflow.js +5 -22
- package/dist/core/task-registry.d.ts +64 -90
- package/dist/core/task-registry.js +73 -119
- package/dist/core/task-result.d.ts +27 -19
- package/dist/core/task-spec-members.d.ts +39 -0
- package/dist/core/task-spec-members.js +92 -0
- package/dist/core/task-spec.d.ts +13 -16
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/task-tool-shape.d.ts +7 -57
- package/dist/core/task-tool-shape.js +7 -66
- package/dist/core/terminal-cause.d.ts +30 -0
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tool-catalog-entries.js +3 -6
- package/dist/core/tool-check-reading.js +16 -10
- package/dist/core/tool-conformance.js +1 -2
- package/dist/core/tool-errors.d.ts +6 -3
- package/dist/core/tool-errors.js +2 -0
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +6 -4
- package/dist/core/tool-face.d.ts +2 -3
- package/dist/core/tool-name-aliases.d.ts +23 -28
- package/dist/core/tool-name-aliases.js +63 -7
- package/dist/core/tool-name-readings.d.ts +14 -3
- package/dist/core/tool-name-readings.js +2 -0
- package/dist/core/tool-policy.d.ts +113 -22
- package/dist/core/tool-policy.js +85 -15
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +111 -5
- package/dist/core/tool-result-store.js +52 -12
- package/dist/core/tool-spec.d.ts +39 -10
- package/dist/core/trace.d.ts +18 -2
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +40 -27
- package/dist/core/workflow-journal-store.d.ts +1 -1
- package/dist/core/workflow-run-store.d.ts +2 -0
- package/dist/core/workflow-run-store.js +6 -5
- package/dist/core/workflow-settled-run.d.ts +5 -0
- package/dist/core/workflow-settled-run.js +7 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +37 -7
- package/dist/engine/execution-env/node-execution-env.js +224 -21
- package/dist/engine/harness/agent-harness.d.ts +66 -19
- package/dist/engine/harness/agent-harness.js +98 -27
- package/dist/engine/harness/messages.d.ts +4 -3
- package/dist/engine/harness/messages.js +2 -2
- package/dist/engine/harness/types.d.ts +151 -34
- package/dist/engine/llm/media-removed.d.ts +14 -0
- package/dist/engine/llm/media-removed.js +9 -0
- package/dist/engine/llm/rejected-images.d.ts +35 -25
- package/dist/engine/llm/rejected-images.js +59 -10
- package/dist/engine/llm/types.d.ts +24 -3
- package/dist/engine/llm/types.js +7 -3
- package/dist/engine/loop/agent-loop.d.ts +18 -13
- package/dist/engine/loop/agent-loop.js +173 -32
- package/dist/engine/loop/types.d.ts +21 -5
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/engine/session/import-validate.js +7 -0
- package/dist/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +41 -23
- package/dist/index.js +29 -16
- package/dist/internal/harness-types.d.ts +3 -1
- package/dist/internal/llm.d.ts +2 -1
- package/dist/internal/llm.js +1 -0
- package/dist/orchestration/goal.d.ts +6 -2
- package/dist/orchestration/goal.js +6 -3
- package/dist/orchestration/run-workflow-tool.d.ts +20 -20
- package/dist/orchestration/run-workflow-tool.js +63 -56
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +8 -0
- package/dist/orchestration/workflow.js +33 -9
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +19 -14
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +24 -16
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +4 -1
- package/dist/stores/file/index.d.ts +9 -6
- package/dist/stores/file/index.js +33 -9
- package/dist/stores/file/ledger-tuning.d.ts +23 -0
- package/dist/stores/file/ledger-tuning.js +21 -0
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +43 -21
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +4 -1
- package/dist/stores/file/permission-rule-adopt.js +24 -21
- package/dist/stores/file/permission-rule-store.js +6 -3
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +4 -1
- package/dist/stores/file/session-store.d.ts +17 -4
- package/dist/stores/file/session-store.js +22 -19
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +31 -2
- package/dist/stores/file/tool-result-store.js +129 -7
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +4 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -13
- package/dist/stores/file/workflow-journal-store.js +4 -18
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/stores/file/workflow-run-store.js +15 -10
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/dead-cwd.d.ts +5 -5
- package/dist/tools/fs/dead-cwd.js +4 -11
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +13 -0
- package/dist/tools/fs/fs-bash-background-text.js +7 -0
- package/dist/tools/fs/fs-bash.d.ts +11 -22
- package/dist/tools/fs/fs-bash.js +58 -154
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +34 -27
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +39 -16
- package/dist/tools/fs/fs-shared.js +25 -6
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +15 -9
- package/dist/tools/fs/index.js +12 -18
- package/dist/tools/fs/pdf.d.ts +4 -4
- package/dist/tools/fs/pdf.js +6 -6
- package/dist/tools/fs/read-deny-home.js +8 -1
- package/dist/tools/fs/read-deny.d.ts +26 -2
- package/dist/tools/fs/read-deny.js +9 -2
- package/dist/tools/fs/read-floor.d.ts +57 -6
- package/dist/tools/fs/read-floor.js +241 -2
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +6 -5
- package/dist/tools/fs/search.js +10 -10
- package/dist/tools/fs/shell-read-establish.js +3 -1
- package/dist/tools/fs/shell-read-identity.d.ts +3 -1
- package/dist/tools/fs/shell-read-identity.js +4 -2
- package/dist/tools/fs/shell-read-judge.d.ts +7 -1
- package/dist/tools/fs/shell-read-judge.js +1 -1
- package/dist/tools/monitor.d.ts +12 -10
- package/dist/tools/monitor.js +22 -13
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/dist/tools/worktree.d.ts +5 -1
- package/dist/tools/worktree.js +20 -17
- package/package.json +8 -3
- package/test/export-surface.snapshot.json +166 -30
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
- package/wire-changes/primitives@7.61.0.json +30 -0
- package/dist/core/runner/image-removed-seat.d.ts +0 -12
- package/dist/core/runner/image-removed-seat.js +0 -19
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { SessionError, StreamingImportValidator, importRowCells, ownerCell, sessionLogMarkOf, uuidv7 } from "../internal/harness.js";
|
|
2
|
-
import { receiptRefusal,
|
|
2
|
+
import { optionKeys, receiptRefusal, receiveMembers } from "./own-property-receipt.js";
|
|
3
3
|
import { thrownText } from "./thrown-value.js";
|
|
4
4
|
const EXPORT_WORDS = { subject: "SessionLogExportOptions", unit: "member", moment: "at SessionLogTransfer.exportStream" };
|
|
5
5
|
const BEGIN_WORDS = { subject: "SessionLogTransfer.beginReplace options", unit: "member", moment: "at SessionLogTransfer.beginReplace" };
|
|
6
6
|
const COMMIT_WORDS = { subject: "SessionLogCommit", unit: "member", moment: "at SessionLogReplace.commit" };
|
|
7
|
+
const EXPORT_KEYS = optionKeys()({ afterSeq: 0, batchSize: 0 });
|
|
8
|
+
const BEGIN_KEYS = optionKeys()({ preserveActorAssertions: 0 });
|
|
9
|
+
const COMMIT_KEYS = optionKeys()({ owner: 0, decide: 0 });
|
|
7
10
|
async function logOrNull(seat, sessionId) {
|
|
8
11
|
return (await seat.readRow(sessionId))?.entries ?? null;
|
|
9
12
|
}
|
|
@@ -15,14 +18,10 @@ function committedHead(sessionId, answer) {
|
|
|
15
18
|
}
|
|
16
19
|
throw new SessionError("storage", `the repo's importEntries wrote session ${sessionId}'s log but answered no head (got ${answer === null ? "null" : typeof answer}) — a repo behind SessionStore.logTransfer answers the head its write committed; read the row again`);
|
|
17
20
|
}
|
|
18
|
-
function readRecord(raw, words,
|
|
21
|
+
function readRecord(raw, words, keys) {
|
|
19
22
|
if (typeof raw !== "object" || raw === null)
|
|
20
23
|
throw receiptRefusal(`${words.subject} must be an object, got ${raw === null ? "null" : typeof raw}`);
|
|
21
|
-
|
|
22
|
-
for (const name of Object.keys(got))
|
|
23
|
-
if (!names.includes(name))
|
|
24
|
-
throw receiptRefusal(`${words.subject} carries "${name}" — not a member this face reads`);
|
|
25
|
-
return got;
|
|
24
|
+
return receiveMembers(raw, words, keys, (_, [stray]) => receiptRefusal(`${words.subject} carries "${String(stray)}" — not a member this face reads`));
|
|
26
25
|
}
|
|
27
26
|
function isIntegerFrom(value, floor) {
|
|
28
27
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= floor;
|
|
@@ -30,7 +29,7 @@ function isIntegerFrom(value, floor) {
|
|
|
30
29
|
function readExportOptions(raw) {
|
|
31
30
|
if (raw === undefined)
|
|
32
31
|
return { afterSeq: -1 };
|
|
33
|
-
const got = readRecord(raw, EXPORT_WORDS,
|
|
32
|
+
const got = readRecord(raw, EXPORT_WORDS, EXPORT_KEYS);
|
|
34
33
|
const afterSeq = got["afterSeq"];
|
|
35
34
|
if (afterSeq !== undefined && !isIntegerFrom(afterSeq, -1))
|
|
36
35
|
throw receiptRefusal("SessionLogExportOptions.afterSeq must be an integer ≥ -1 when present");
|
|
@@ -41,7 +40,7 @@ function readExportOptions(raw) {
|
|
|
41
40
|
function readBeginOptions(raw) {
|
|
42
41
|
if (raw === undefined)
|
|
43
42
|
return {};
|
|
44
|
-
const preserveActorAssertions = readRecord(raw, BEGIN_WORDS,
|
|
43
|
+
const preserveActorAssertions = readRecord(raw, BEGIN_WORDS, BEGIN_KEYS)["preserveActorAssertions"];
|
|
45
44
|
if (preserveActorAssertions === undefined)
|
|
46
45
|
return {};
|
|
47
46
|
if (typeof preserveActorAssertions !== "boolean")
|
|
@@ -49,7 +48,7 @@ function readBeginOptions(raw) {
|
|
|
49
48
|
return { preserveActorAssertions };
|
|
50
49
|
}
|
|
51
50
|
function readCommit(raw) {
|
|
52
|
-
const { owner, decide } = readRecord(raw, COMMIT_WORDS,
|
|
51
|
+
const { owner, decide } = readRecord(raw, COMMIT_WORDS, COMMIT_KEYS);
|
|
53
52
|
if (owner === undefined)
|
|
54
53
|
throw receiptRefusal("SessionLogCommit.owner must be a principal name or null (anonymous), got undefined");
|
|
55
54
|
try {
|
|
@@ -81,7 +81,14 @@ export type SessionRuleEntryField = {
|
|
|
81
81
|
* persisted grammar read every bare name as no rule. A session's entries mean what they meant (the entry reader already read a bare
|
|
82
82
|
* name as the whole tool), so no earlier entry reads differently; the stamp moves for the persisted store's buckets and the sync
|
|
83
83
|
* wire's states, so an engine of grammar 5 given a bucket written in grammar 6 refuses it whole rather than drop a whole-tool deny
|
|
84
|
-
* as damage. No persisted row of an earlier stamp can hold a bare name (every entrance refused one), so none is read anew
|
|
84
|
+
* as damage. No persisted row of an earlier stamp can hold a bare name (every entrance refused one), so none is read anew;
|
|
85
|
+
* - 7, an exact MCP tool name with `__` in its body (`mcp__a__b`, no `*`) in `toolDeny` reads every MCP server spelling it can
|
|
86
|
+
* stand for (`peerReadingsOf`: tool `b` of server `a` AND every tool of server `a__b`), where grammar 6 read the one exact tool.
|
|
87
|
+
* A session row an earlier grammar wrote reads such an entry as the one exact tool, announced (the revision table); an engine of
|
|
88
|
+
* grammar 6 given a row written in grammar 7 refuses it rather than read the deny as the narrower exact tool. The persisted store
|
|
89
|
+
* and the rule-sync wire stamp 7 as well, so a grammar-6 engine refuses their buckets and states too — but this revision does not
|
|
90
|
+
* pay the persisted store the reading of its earlier stamps owed below: a stored whole-tool deny / ask of such a name in a
|
|
91
|
+
* bucket of stamp 6 reads in this grammar, the wider way (#3085).
|
|
85
92
|
* A row an earlier grammar wrote keeps the meaning that grammar gave its entries, and an entry that grammar could not read takes
|
|
86
93
|
* this one's ({@link earlierGrammarReads}, over the revisions above as one table); an entry this grammar reads as no rule reads as
|
|
87
94
|
* `earlier_grammar` ({@link compileSessionRuleBucket}).
|
|
@@ -94,7 +101,7 @@ export type SessionRuleEntryField = {
|
|
|
94
101
|
* what an existing persisted rule text means owes that store a reading of its earlier stamps, as {@link earlierGrammarReads}
|
|
95
102
|
* is for entries. Every stamp is judged by {@link readRuleGrammarStamp}.
|
|
96
103
|
*/
|
|
97
|
-
export declare const SESSION_RULES_GRAMMAR =
|
|
104
|
+
export declare const SESSION_RULES_GRAMMAR = 7;
|
|
98
105
|
/** {@link SessionPermissionRules} plus the monotonic `rev` the store stamps (the OCC key). */
|
|
99
106
|
export interface StoredSessionRules extends SessionPermissionRules {
|
|
100
107
|
rev: number;
|
|
@@ -402,7 +409,7 @@ export declare class InMemorySessionPolicyStore implements SessionPolicyStore {
|
|
|
402
409
|
private readonly map;
|
|
403
410
|
/** {@link SessionPolicyStoreOptions.mountedToolNames}, read once at construction. */
|
|
404
411
|
private readonly mountedToolNames;
|
|
405
|
-
constructor(
|
|
412
|
+
constructor(options?: SessionPolicyStoreOptions);
|
|
406
413
|
/**
|
|
407
414
|
* The per-key mark {@link SessionPolicyStore.deleteBySession} may not erase: the largest `rev` this key has
|
|
408
415
|
* ever been stamped with, kept outside the row so removing the row cannot roll the counter back. Written by
|
|
@@ -7,12 +7,14 @@ import { valueTypeLabel } from "./tool-name-list.js";
|
|
|
7
7
|
import { NAME_RULE_FACES, noticeRuleText } from "./permission-rule-model.js";
|
|
8
8
|
import { parsePermissionRule, ruleSpellingOf } from "./permission-rule-syntax.js";
|
|
9
9
|
import { splitNamespacedName } from "./tool-name-aliases.js";
|
|
10
|
+
import { namesASetOfTools } from "./namespaced-rule-name.js";
|
|
11
|
+
import { optionKeys, receiveOptions } from "./own-property-receipt.js";
|
|
10
12
|
const SESSION_RULE_BUCKETS = { toolAllow: "allow", toolDeny: "deny", allowDirs: "dirs" };
|
|
11
13
|
const BUCKETS = Object.keys(SESSION_RULE_BUCKETS);
|
|
12
14
|
const ENTRY_FIELDS = BUCKETS.filter((f) => SESSION_RULE_BUCKETS[f] !== "dirs");
|
|
13
15
|
const STORE_STAMPS = new Set(["rev", "gen", "grammar"]);
|
|
14
16
|
const OPERATOR_PART = "operatorRules";
|
|
15
|
-
export const SESSION_RULES_GRAMMAR =
|
|
17
|
+
export const SESSION_RULES_GRAMMAR = 7;
|
|
16
18
|
export class SessionPolicyError extends Error {
|
|
17
19
|
code;
|
|
18
20
|
detail;
|
|
@@ -24,6 +26,7 @@ export class SessionPolicyError extends Error {
|
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
const NO_DECLARED_TOOLS = new Set();
|
|
29
|
+
const SESSION_POLICY_STORE_OPTION_KEYS = optionKeys()({ mountedToolNames: 0 });
|
|
27
30
|
export function readMountedToolNames(value) {
|
|
28
31
|
if (value === undefined)
|
|
29
32
|
return NO_DECLARED_TOOLS;
|
|
@@ -216,6 +219,20 @@ const GRAMMAR_REVISIONS = [
|
|
|
216
219
|
return { ...answer, was: `the exact tool name ${JSON.stringify(pattern)}, so it refused only a tool of that name`, keep: { kind: "row", compiled: { kind: "tool", name: pattern } } };
|
|
217
220
|
},
|
|
218
221
|
},
|
|
222
|
+
{
|
|
223
|
+
grammar: 7,
|
|
224
|
+
answer: ({ direction, reading }) => {
|
|
225
|
+
if (direction !== "deny" || reading.kind !== "row" || reading.compiled.kind !== "covering" || namesASetOfTools(reading.compiled.pattern, "deny"))
|
|
226
|
+
return undefined;
|
|
227
|
+
const { pattern } = reading.compiled;
|
|
228
|
+
return {
|
|
229
|
+
was: `the exact tool name ${JSON.stringify(pattern)}, so it refused only a tool of that name`,
|
|
230
|
+
now: "every MCP server spelling the name can stand for — that tool, and every tool of a server whose own name carries the `__`",
|
|
231
|
+
keep: { kind: "row", compiled: { kind: "tool", name: pattern } },
|
|
232
|
+
reader: "grammar_revised",
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
},
|
|
219
236
|
];
|
|
220
237
|
function earlierGrammarReads(row, direction, entry, reading, list) {
|
|
221
238
|
if (row >= SESSION_RULES_GRAMMAR)
|
|
@@ -510,8 +527,9 @@ export function continuesLineage(a, b) {
|
|
|
510
527
|
export class InMemorySessionPolicyStore {
|
|
511
528
|
map = new Map();
|
|
512
529
|
mountedToolNames;
|
|
513
|
-
constructor(
|
|
514
|
-
|
|
530
|
+
constructor(options) {
|
|
531
|
+
const opts = receiveOptions(options, "InMemorySessionPolicyStore", SESSION_POLICY_STORE_OPTION_KEYS);
|
|
532
|
+
this.mountedToolNames = readMountedToolNames(opts.mountedToolNames);
|
|
515
533
|
}
|
|
516
534
|
highWater = new Map();
|
|
517
535
|
key(sessionId, principal) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentMessage } from "../internal/harness-types.js";
|
|
1
|
+
import type { AgentMessage, RowAdmission } from "../internal/harness-types.js";
|
|
2
2
|
import type { ToolResultMessage } from "../internal/llm.js";
|
|
3
3
|
import type { Session } from "./session.js";
|
|
4
4
|
import type { ToolEffect } from "./types.js";
|
|
@@ -122,6 +122,7 @@ export declare const INTERRUPTED_BY_USER_FOR_TOOL_USE_MARKER = "[Request interru
|
|
|
122
122
|
*/
|
|
123
123
|
export declare function appendInterruptionMarker(session: Session, opts: {
|
|
124
124
|
toolUseInFlight: boolean;
|
|
125
|
+
admitRows?: RowAdmission;
|
|
125
126
|
}): Promise<string>;
|
|
126
127
|
/** One synthetic interrupted result: what a call with no recorded result is closed with. */
|
|
127
128
|
export interface InterruptedResult {
|
|
@@ -172,4 +173,4 @@ export declare function interruptedResultMessage(result: InterruptedResult, time
|
|
|
172
173
|
* never started: it is closed with a "never executed — safe to re-issue" result instead of the
|
|
173
174
|
* conservative unknown-outcome wording. When omitted, every orphan keeps the conservative texts.
|
|
174
175
|
*/
|
|
175
|
-
export declare function reconcileInterruptedSession(session: Session, toolEffects?: Map<string, ToolEffect>, suspendedBatch?: ReadonlySet<string>, startedToolCallIds?: ReadonlySet<string
|
|
176
|
+
export declare function reconcileInterruptedSession(session: Session, toolEffects?: Map<string, ToolEffect>, suspendedBatch?: ReadonlySet<string>, startedToolCallIds?: ReadonlySet<string>, admitRows?: RowAdmission): Promise<ReconcileReport>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { appendAdmittedRow } from "./row-admission.js";
|
|
1
2
|
import { readMember } from "./thrown-value.js";
|
|
2
3
|
export const closeNeverExecuted = (errorKind) => errorKind === "interrupted_never_started";
|
|
3
4
|
const INTERRUPTED_UNKNOWN = "[INTERRUPTED] The previous run ended before this tool call's result was recorded. Its outcome " +
|
|
@@ -86,7 +87,7 @@ export function findOrphanToolCalls(messages, suspendedBatch) {
|
|
|
86
87
|
export const INTERRUPTED_BY_USER_MARKER = "[Request interrupted by user]";
|
|
87
88
|
export const INTERRUPTED_BY_USER_FOR_TOOL_USE_MARKER = "[Request interrupted by user for tool use]";
|
|
88
89
|
export async function appendInterruptionMarker(session, opts) {
|
|
89
|
-
return await session
|
|
90
|
+
return await appendAdmittedRow(opts.admitRows, session, {
|
|
90
91
|
role: "user",
|
|
91
92
|
content: [
|
|
92
93
|
{
|
|
@@ -145,14 +146,16 @@ function closableByAppend(messages, suspendedBatch) {
|
|
|
145
146
|
.sort((a, b) => a[1].order - b[1].order)
|
|
146
147
|
.map(([toolCallId, site]) => ({ toolCallId, toolName: site.toolName, args: site.args }));
|
|
147
148
|
}
|
|
148
|
-
export async function reconcileInterruptedSession(session, toolEffects, suspendedBatch, startedToolCallIds) {
|
|
149
|
+
export async function reconcileInterruptedSession(session, toolEffects, suspendedBatch, startedToolCallIds, admitRows) {
|
|
149
150
|
const { messages } = await session.buildContext();
|
|
150
151
|
const orphans = closableByAppend(messages, suspendedBatch);
|
|
151
152
|
const recovered = [];
|
|
152
153
|
const results = interruptedResults(orphans, toolEffects, startedToolCallIds);
|
|
153
154
|
for (const [i, result] of results.entries()) {
|
|
154
|
-
const
|
|
155
|
-
|
|
155
|
+
const row = interruptedResultMessage(result, Date.now());
|
|
156
|
+
const entryId = await appendAdmittedRow(admitRows, session, row);
|
|
157
|
+
const text = row.content.flatMap((b) => (b.type === "text" ? [b.text] : [])).join("\n");
|
|
158
|
+
recovered.push({ toolCallId: result.toolCallId, toolName: result.toolName, entryId, text, errorKind: result.errorKind, args: orphans[i].args });
|
|
156
159
|
}
|
|
157
160
|
return { recovered };
|
|
158
161
|
}
|
|
@@ -9,7 +9,8 @@ export type EvictPolicy = "delete" | "forget";
|
|
|
9
9
|
export interface TtlSessionStoreOptions {
|
|
10
10
|
/** Idle TTL before a cached session is evicted. Default 7 days. */
|
|
11
11
|
defaultTtlDays?: number;
|
|
12
|
-
/** Optional background sweep interval
|
|
12
|
+
/** Optional background sweep interval: a whole number of milliseconds from 1 to 2147483647 (the longest a timer takes; any other
|
|
13
|
+
* value is refused, `config.invalid_argument`). Omit it for no background sweep (sweeps opportunistically on acquire). */
|
|
13
14
|
sweepIntervalMs?: number;
|
|
14
15
|
/**
|
|
15
16
|
* Backing session repo. Default `InMemorySessionRepo` (process-only, lost on restart). Supply a
|
|
@@ -95,6 +96,8 @@ export declare function admitSessionPlacement(sessionId: string, persisted: Sess
|
|
|
95
96
|
}, capability: {
|
|
96
97
|
subagentPlacement: boolean;
|
|
97
98
|
}): void;
|
|
99
|
+
/** The hooks {@link TtlSessionStore} runs — a member of `hooks` outside it is refused by name. */
|
|
100
|
+
export declare const STORE_HOOK_KEYS: import("./own-property-receipt.js").OptionKeys<SessionStoreHooks>;
|
|
98
101
|
/**
|
|
99
102
|
* TTL-cached {@link SessionStore} over a pluggable {@link SessionRepo}.
|
|
100
103
|
*
|
|
@@ -171,7 +174,7 @@ export declare class TtlSessionStore implements SessionStore {
|
|
|
171
174
|
private defaultTtlMs;
|
|
172
175
|
private evictPolicy;
|
|
173
176
|
private sweepTimer?;
|
|
174
|
-
constructor(
|
|
177
|
+
constructor(options?: TtlSessionStoreOptions);
|
|
175
178
|
/** Get an existing session by id (resuming from the repo if needed), or create one. */
|
|
176
179
|
acquire(sessionId?: string, opts?: {
|
|
177
180
|
requireExisting?: boolean;
|
|
@@ -3,7 +3,10 @@ import { isSessionConflict, readSessionListQuery } from "./session.js";
|
|
|
3
3
|
import { readRetentionDeclaration } from "./retention.js";
|
|
4
4
|
import { readMember } from "./thrown-value.js";
|
|
5
5
|
import { principalNameFault, principalNameOf } from "./principal-name.js";
|
|
6
|
-
import { receiptRefusal,
|
|
6
|
+
import { DECLARATION_RECEIPT_MODE, optionKeys, receiptRefusal, receiveMembers, receiveOptions } from "./own-property-receipt.js";
|
|
7
|
+
import { describeFault, receive } from "./mods/kernel/receive.js";
|
|
8
|
+
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
9
|
+
import { readIntegerOption, TIMER_DELAY_MS } from "./integer-option.js";
|
|
7
10
|
import { repoLogTransfer } from "./session-log-transfer.js";
|
|
8
11
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
9
12
|
import { SESSION_DEFAULT_TTL_DAYS } from "../config/defaults.js";
|
|
@@ -22,6 +25,8 @@ export function admitSessionPlacement(sessionId, persisted, request, capability)
|
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|
|
28
|
+
const TTL_SESSION_STORE_OPTION_KEYS = optionKeys()({ defaultTtlDays: 0, sweepIntervalMs: 0, repo: 0, evict: 0, durability: 0, placements: 0, retention: 0, hooks: 0 });
|
|
29
|
+
export const STORE_HOOK_KEYS = optionKeys()({ beforeSessionDelete: 0 });
|
|
25
30
|
export class TtlSessionStore {
|
|
26
31
|
retention;
|
|
27
32
|
durability;
|
|
@@ -43,16 +48,18 @@ export class TtlSessionStore {
|
|
|
43
48
|
defaultTtlMs;
|
|
44
49
|
evictPolicy;
|
|
45
50
|
sweepTimer;
|
|
46
|
-
constructor(
|
|
51
|
+
constructor(options) {
|
|
52
|
+
const opts = receiveOptions(options, "TtlSessionStore", TTL_SESSION_STORE_OPTION_KEYS);
|
|
47
53
|
this.retention = readRetentionDeclaration("TtlSessionStoreOptions.retention", opts.retention);
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
const givenRepo = opts.repo;
|
|
55
|
+
this.repo = givenRepo ?? new InMemorySessionRepo();
|
|
56
|
+
const durability = opts.durability !== undefined ? durabilityWord("TtlSessionStoreOptions.durability", opts.durability) : givenRepo === undefined ? "process-local" : undefined;
|
|
50
57
|
if (durability !== undefined)
|
|
51
58
|
this.durability = durability;
|
|
52
|
-
this.defaultTtlMs = (opts.defaultTtlDays
|
|
53
|
-
this.evictPolicy = opts.evict
|
|
59
|
+
this.defaultTtlMs = ttlDays(opts.defaultTtlDays) * DAY_MS;
|
|
60
|
+
this.evictPolicy = opts.evict !== undefined ? evictWord(opts.evict) : givenRepo ? "forget" : "delete";
|
|
54
61
|
if (opts.placements !== undefined)
|
|
55
|
-
this.placements = opts.placements;
|
|
62
|
+
this.placements = placementsDeclaration(opts.placements);
|
|
56
63
|
const repoListPlaced = this.repo.listPlaced;
|
|
57
64
|
if (typeof repoListPlaced === "function") {
|
|
58
65
|
this.listPlaced = (kind, o) => repoListPlaced.call(this.repo, kind, o);
|
|
@@ -78,11 +85,13 @@ export class TtlSessionStore {
|
|
|
78
85
|
});
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
|
-
const
|
|
88
|
+
const hooks = opts.hooks;
|
|
89
|
+
const beforeRowDelete = readStoreHooks(hooks);
|
|
82
90
|
if (beforeRowDelete !== undefined)
|
|
83
|
-
this.beforeRowDelete = (sessionId) => Reflect.apply(beforeRowDelete,
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
this.beforeRowDelete = (sessionId) => Reflect.apply(beforeRowDelete, hooks, [sessionId]);
|
|
92
|
+
const sweepIntervalMs = readIntegerOption("TtlSessionStoreOptions.sweepIntervalMs", opts.sweepIntervalMs, TIMER_DELAY_MS, "milliseconds", "no background sweep");
|
|
93
|
+
if (sweepIntervalMs !== undefined) {
|
|
94
|
+
this.sweepTimer = setInterval(() => this.sweep(), sweepIntervalMs);
|
|
86
95
|
this.sweepTimer.unref?.();
|
|
87
96
|
}
|
|
88
97
|
}
|
|
@@ -491,16 +500,44 @@ function newestFirst(a, b) {
|
|
|
491
500
|
return b.lastActiveAt - a.lastActiveAt;
|
|
492
501
|
return a.sessionId < b.sessionId ? 1 : a.sessionId > b.sessionId ? -1 : 0;
|
|
493
502
|
}
|
|
503
|
+
function durabilityWord(name, value) {
|
|
504
|
+
if (value === "durable" || value === "process-local")
|
|
505
|
+
return value;
|
|
506
|
+
throw receiptRefusal(`${name} must be "durable" or "process-local" when given (got ${describeRejectedValue(value)})`);
|
|
507
|
+
}
|
|
508
|
+
function ttlDays(value) {
|
|
509
|
+
if (value === undefined)
|
|
510
|
+
return SESSION_DEFAULT_TTL_DAYS;
|
|
511
|
+
if (typeof value === "number" && Number.isFinite(value) && value >= 0)
|
|
512
|
+
return value;
|
|
513
|
+
throw receiptRefusal(`TtlSessionStoreOptions.defaultTtlDays must be a finite non-negative number of days when given (got ${describeRejectedValue(value)})`);
|
|
514
|
+
}
|
|
515
|
+
function evictWord(value) {
|
|
516
|
+
if (value === "delete" || value === "forget")
|
|
517
|
+
return value;
|
|
518
|
+
throw receiptRefusal(`TtlSessionStoreOptions.evict must be "delete" or "forget" when given (got ${describeRejectedValue(value)})`);
|
|
519
|
+
}
|
|
520
|
+
function placementsDeclaration(value) {
|
|
521
|
+
const got = receive(value, DECLARATION_RECEIPT_MODE);
|
|
522
|
+
if (!got.ok)
|
|
523
|
+
throw receiptRefusal(`TtlSessionStoreOptions.placements could not be read as plain data — ${describeFault(got.fault)}`);
|
|
524
|
+
const held = got.value;
|
|
525
|
+
if (typeof held !== "object" || held === null || Array.isArray(held))
|
|
526
|
+
throw receiptRefusal(`TtlSessionStoreOptions.placements must be a record when given (got ${describeRejectedValue(held)})`);
|
|
527
|
+
const subagent = held.subagent;
|
|
528
|
+
if (subagent !== undefined) {
|
|
529
|
+
if (typeof subagent !== "object" || subagent === null || Array.isArray(subagent))
|
|
530
|
+
throw receiptRefusal(`TtlSessionStoreOptions.placements.subagent must be a record when given (got ${describeRejectedValue(subagent)})`);
|
|
531
|
+
durabilityWord("TtlSessionStoreOptions.placements.subagent.durability", subagent.durability);
|
|
532
|
+
}
|
|
533
|
+
return held;
|
|
534
|
+
}
|
|
494
535
|
function readStoreHooks(hooks) {
|
|
495
536
|
if (hooks === undefined)
|
|
496
537
|
return undefined;
|
|
497
538
|
if (typeof hooks !== "object" || hooks === null)
|
|
498
539
|
throw receiptRefusal(`TtlSessionStoreOptions.hooks must be an object when given, got ${hooks === null ? "null" : typeof hooks}`);
|
|
499
|
-
const got =
|
|
500
|
-
for (const name of Object.keys(got)) {
|
|
501
|
-
if (name !== "beforeSessionDelete")
|
|
502
|
-
throw receiptRefusal(`TtlSessionStoreOptions.hooks.${name} is not a hook this store runs (it runs beforeSessionDelete)`);
|
|
503
|
-
}
|
|
540
|
+
const got = receiveMembers(hooks, { subject: "TtlSessionStoreOptions.hooks", unit: "hook", moment: "at construction" }, STORE_HOOK_KEYS);
|
|
504
541
|
const hook = got["beforeSessionDelete"];
|
|
505
542
|
if (hook !== undefined && typeof hook !== "function")
|
|
506
543
|
throw receiptRefusal(`TtlSessionStoreOptions.hooks.beforeSessionDelete must be a function when given, got ${hook === null ? "null" : typeof hook}`);
|
package/dist/core/session.d.ts
CHANGED
|
@@ -83,7 +83,8 @@ export interface SessionStoreSummary {
|
|
|
83
83
|
/**
|
|
84
84
|
* An ENGINE-minted run identity for this session ({@link import("./types.js").TaskResult.runId}),
|
|
85
85
|
* recorded by the most recent {@link SessionStore.noteTaskRun} write to LAND.
|
|
86
|
-
* {@link lastTaskId} above is
|
|
86
|
+
* {@link lastTaskId} above is the leg's task id (a background row's id, else the declared one, else the
|
|
87
|
+
* session id), so on the ordinary deployment that supplies no
|
|
87
88
|
* host task id it answers the SESSION's own id: a "last run" handle that names the session it hangs off
|
|
88
89
|
* cannot say WHICH run it means. This one names a specific run — read the ORDERING clause below for
|
|
89
90
|
* exactly how strong "most recent" is here, which is weaker than the sibling field's wording implies.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seatbelt confinement a shell start runs under on the engine's macOS host: the launcher, the deny-default base every
|
|
3
|
+
* confined start runs under, the one assembly of a profile from the reads it refuses and the locations it holds in place,
|
|
4
|
+
* and the one wrapping of a start in its floor's profile. Below the engine and the tools both: an environment spawns
|
|
5
|
+
* through {@link confineShellStart} and probes with {@link SEATBELT_PROBE_PROFILE}; the floor's adapter translates its
|
|
6
|
+
* table into the expressions {@link seatbeltProfile} assembles (`ReadFloor.confinement`).
|
|
7
|
+
*/
|
|
8
|
+
import type { ReadFloor } from "../internal/harness-types.js";
|
|
9
|
+
/** The seatbelt launcher, by its absolute path (a PATH lookup could run another program in its place). */
|
|
10
|
+
export declare const SANDBOX_EXEC = "/usr/bin/sandbox-exec";
|
|
11
|
+
/** A profile: the base; reads open but for each of `reads` (an expression in the dialect's regex syntax), directory metadata
|
|
12
|
+
* still readable; writes open, and no unlink or create at any of `holds` (a rename cannot carry a refused file out from
|
|
13
|
+
* under its row). No expression on a side ⇒ no block for it. */
|
|
14
|
+
export declare function seatbeltProfile(reads: readonly string[], holds: readonly string[]): string;
|
|
15
|
+
/** The profile of no row: what an environment applies once to learn whether confinement works on this host at all. */
|
|
16
|
+
export declare const SEATBELT_PROBE_PROFILE: string;
|
|
17
|
+
/** A shell start as an environment spawns it: the shell and its arguments, the command last. */
|
|
18
|
+
export interface ShellStart {
|
|
19
|
+
readonly command: string;
|
|
20
|
+
readonly args: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The start confined to `floor` — the one wrapping every environment that spawns on the engine's host takes: no floor ⇒
|
|
24
|
+
* the start as it is (`profile` undefined); a floor ⇒ `sandbox-exec -p <the floor's seatbelt profile>` running the start,
|
|
25
|
+
* with that profile; a floor whose profile cannot be made ⇒ the row and why, and the start must not run. Pure: whether the
|
|
26
|
+
* host can apply a profile at all is the environment's probe, and an apply that fails at the start is the environment's to
|
|
27
|
+
* refuse.
|
|
28
|
+
*/
|
|
29
|
+
export declare function confineShellStart(start: ShellStart, floor: ReadFloor | undefined): {
|
|
30
|
+
readonly ok: true;
|
|
31
|
+
readonly start: ShellStart;
|
|
32
|
+
readonly profile: string | undefined;
|
|
33
|
+
} | {
|
|
34
|
+
readonly ok: false;
|
|
35
|
+
readonly row: string;
|
|
36
|
+
readonly reason: string;
|
|
37
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const SANDBOX_EXEC = "/usr/bin/sandbox-exec";
|
|
2
|
+
const SEATBELT_BASE = [
|
|
3
|
+
"(version 1)", "(deny default)", "(allow process-exec)", "(allow process-fork)", "(allow process-info* (target same-sandbox))",
|
|
4
|
+
"(allow signal (target same-sandbox))", "(allow mach-priv-task-port (target same-sandbox))", "(allow user-preference-read)", "(allow mach-lookup",
|
|
5
|
+
"(global-name \"com.apple.audio.systemsoundserver\")", "(global-name \"com.apple.distributed_notifications@Uv3\")",
|
|
6
|
+
"(global-name \"com.apple.FontObjectsServer\")", "(global-name \"com.apple.fonts\")", "(global-name \"com.apple.logd\")",
|
|
7
|
+
"(global-name \"com.apple.lsd.mapdb\")", "(global-name \"com.apple.PowerManagement.control\")", "(global-name \"com.apple.system.logger\")",
|
|
8
|
+
"(global-name \"com.apple.system.notification_center\")", "(global-name \"com.apple.system.opendirectoryd.libinfo\")",
|
|
9
|
+
"(global-name \"com.apple.system.opendirectoryd.membership\")", "(global-name \"com.apple.bsd.dirhelper\")",
|
|
10
|
+
"(global-name \"com.apple.securityd.xpc\")", "(global-name \"com.apple.coreservices.launchservicesd\")", ")", "(allow ipc-posix-shm)",
|
|
11
|
+
"(allow ipc-posix-sem)", "(allow iokit-open", "(iokit-registry-entry-class \"IOSurfaceRootUserClient\")",
|
|
12
|
+
"(iokit-registry-entry-class \"RootDomainUserClient\")", "(iokit-user-client-class \"IOSurfaceSendRight\")", ")", "(allow iokit-get-properties)",
|
|
13
|
+
"(allow system-socket (require-all (socket-domain AF_SYSTEM) (socket-protocol 2)))", "(allow sysctl-read", "(sysctl-name \"hw.activecpu\")",
|
|
14
|
+
"(sysctl-name \"hw.busfrequency_compat\")", "(sysctl-name \"hw.byteorder\")", "(sysctl-name \"hw.cacheconfig\")",
|
|
15
|
+
"(sysctl-name \"hw.cachelinesize_compat\")", "(sysctl-name \"hw.cpufamily\")", "(sysctl-name \"hw.cpufrequency\")",
|
|
16
|
+
"(sysctl-name \"hw.cpufrequency_compat\")", "(sysctl-name \"hw.cputype\")", "(sysctl-name \"hw.l1dcachesize_compat\")",
|
|
17
|
+
"(sysctl-name \"hw.l1icachesize_compat\")", "(sysctl-name \"hw.l2cachesize_compat\")", "(sysctl-name \"hw.l3cachesize_compat\")",
|
|
18
|
+
"(sysctl-name \"hw.logicalcpu\")", "(sysctl-name \"hw.logicalcpu_max\")", "(sysctl-name \"hw.machine\")", "(sysctl-name \"hw.memsize\")",
|
|
19
|
+
"(sysctl-name \"hw.ncpu\")", "(sysctl-name \"hw.nperflevels\")", "(sysctl-name \"hw.packages\")", "(sysctl-name \"hw.pagesize_compat\")",
|
|
20
|
+
"(sysctl-name \"hw.pagesize\")", "(sysctl-name \"hw.physicalcpu\")", "(sysctl-name \"hw.physicalcpu_max\")",
|
|
21
|
+
"(sysctl-name \"hw.tbfrequency_compat\")", "(sysctl-name \"hw.vectorunit\")", "(sysctl-name \"kern.argmax\")", "(sysctl-name \"kern.bootargs\")",
|
|
22
|
+
"(sysctl-name \"kern.hostname\")", "(sysctl-name \"kern.maxfiles\")", "(sysctl-name \"kern.maxfilesperproc\")", "(sysctl-name \"kern.maxproc\")",
|
|
23
|
+
"(sysctl-name \"kern.ngroups\")", "(sysctl-name \"kern.osproductversion\")", "(sysctl-name \"kern.osrelease\")", "(sysctl-name \"kern.ostype\")",
|
|
24
|
+
"(sysctl-name \"kern.osvariant_status\")", "(sysctl-name \"kern.osversion\")", "(sysctl-name \"kern.secure_kernel\")",
|
|
25
|
+
"(sysctl-name \"kern.tcsm_available\")", "(sysctl-name \"kern.tcsm_enable\")", "(sysctl-name \"kern.usrstack64\")", "(sysctl-name \"kern.version\")",
|
|
26
|
+
"(sysctl-name \"kern.willshutdown\")", "(sysctl-name \"machdep.cpu.brand_string\")", "(sysctl-name \"machdep.ptrauth_enabled\")",
|
|
27
|
+
"(sysctl-name \"security.mac.lockdown_mode_state\")", "(sysctl-name \"sysctl.proc_cputype\")", "(sysctl-name \"vm.loadavg\")",
|
|
28
|
+
"(sysctl-name-prefix \"hw.optional.arm\")", "(sysctl-name-prefix \"hw.optional.arm.\")", "(sysctl-name-prefix \"hw.optional.armv8_\")",
|
|
29
|
+
"(sysctl-name-prefix \"hw.perflevel\")", "(sysctl-name-prefix \"kern.proc.all\")", "(sysctl-name-prefix \"kern.proc.pgrp.\")",
|
|
30
|
+
"(sysctl-name-prefix \"kern.proc.pid.\")", "(sysctl-name-prefix \"machdep.cpu.\")", "(sysctl-name-prefix \"net.routetable.\")", ")",
|
|
31
|
+
"(allow sysctl-write", "(sysctl-name \"kern.tcsm_enable\")", ")", "(allow distributed-notification-post)",
|
|
32
|
+
"(allow mach-lookup (global-name \"com.apple.SecurityServer\"))", "(allow file-ioctl (literal \"/dev/null\"))",
|
|
33
|
+
"(allow file-ioctl (literal \"/dev/zero\"))", "(allow file-ioctl (literal \"/dev/random\"))", "(allow file-ioctl (literal \"/dev/urandom\"))",
|
|
34
|
+
"(allow file-ioctl (literal \"/dev/dtracehelper\"))", "(allow file-ioctl (literal \"/dev/tty\"))",
|
|
35
|
+
"(allow file-ioctl file-read-data file-write-data", "(require-all", "(literal \"/dev/null\")", "(vnode-type CHARACTER-DEVICE)", ")", ")",
|
|
36
|
+
"(allow network*)",
|
|
37
|
+
];
|
|
38
|
+
export function seatbeltProfile(reads, holds) {
|
|
39
|
+
const filters = (xs) => xs.map((x) => `(regex ${JSON.stringify(x)})`);
|
|
40
|
+
const lines = [...SEATBELT_BASE, "(allow file-read*)"];
|
|
41
|
+
if (reads.length > 0)
|
|
42
|
+
lines.push("(deny file-read*", ...filters(reads), ")", "(allow file-read-metadata (vnode-type DIRECTORY))");
|
|
43
|
+
lines.push("(allow file-write*)");
|
|
44
|
+
if (holds.length > 0)
|
|
45
|
+
lines.push("(deny file-write-unlink file-write-create", ...filters(holds), ")");
|
|
46
|
+
return lines.join("\n");
|
|
47
|
+
}
|
|
48
|
+
export const SEATBELT_PROBE_PROFILE = seatbeltProfile([], []);
|
|
49
|
+
export function confineShellStart(start, floor) {
|
|
50
|
+
if (floor === undefined)
|
|
51
|
+
return { ok: true, start, profile: undefined };
|
|
52
|
+
const c = floor.confinement("seatbelt");
|
|
53
|
+
if (!c.ok)
|
|
54
|
+
return c;
|
|
55
|
+
return { ok: true, start: { command: SANDBOX_EXEC, args: ["-p", c.profile, start.command, ...start.args] }, profile: c.profile };
|
|
56
|
+
}
|
|
@@ -46,6 +46,15 @@ export interface SkillGrantSource {
|
|
|
46
46
|
* the person's invoked names are read through it ({@link seedSkillGrants}).
|
|
47
47
|
*/
|
|
48
48
|
export declare function skillNamedBy<T extends Pick<SkillGrantSource, "name">>(args: unknown, skills: readonly T[]): T | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The listed name a missed `Skill` call most likely meant, for the refusal to say — never to act on ({@link skillNamedBy} stays
|
|
51
|
+
* the ONE resolution: nothing activates, binds or digests under a name the table does not spell exactly). The nearest listed
|
|
52
|
+
* name within two edits ({@link closestName}); failing that, the asked name with the foreign namespace prefix taken off when
|
|
53
|
+
* that bare name is listed. Undefined: nothing near, no `skill` member that is a string, or an empty one.
|
|
54
|
+
*/
|
|
55
|
+
export declare function skillNameSuggestion<T extends Pick<SkillGrantSource, "name">>(args: unknown, skills: readonly T[]): string | undefined;
|
|
56
|
+
/** The sentence the refusal of a missed `Skill` call adds for {@link skillNameSuggestion} (leading space included), or `""` when there is nothing to suggest. */
|
|
57
|
+
export declare function skillNameHint<T extends Pick<SkillGrantSource, "name">>(args: unknown, skills: readonly T[]): string;
|
|
49
58
|
/** The digest of what a Skill card disclosed — `Execute skill: <name>` and the lists approving it releases ({@link skillGrantBinding}). The read point a parked Skill approval binds to (stored beside the row's input binding, compared before the resumed activation). */
|
|
50
59
|
export declare function skillGrantDigest(skill: Pick<SkillGrantSource, "name" | "allowedTools" | "disallowedTools"> | undefined): string;
|
|
51
60
|
/**
|
package/dist/core/skill-grant.js
CHANGED
|
@@ -5,6 +5,7 @@ import { inlineUntrusted } from "./untrusted-text.js";
|
|
|
5
5
|
import { boundInputHashOf } from "./canonical-json.js";
|
|
6
6
|
import { NOT_BINDABLE } from "./skill-grant-binding.js";
|
|
7
7
|
import { readToolNameList } from "./tool-name-list.js";
|
|
8
|
+
import { closestName } from "./closest-name.js";
|
|
8
9
|
import { allowingRows, strippedInAuto, compileAllowList, readRuleEntry, inertEntryPhrase, judgeAllowEntries, nonListValueLabel, renderListEntry, spelledListEntry } from "./allow-entry.js";
|
|
9
10
|
export const SKILL_GRANT_ORIGINS = Object.freeze(["model", "user", "inherited"]);
|
|
10
11
|
const FROZEN_SKILL_GRANT_ORIGINS = new Set(["model", "inherited"]);
|
|
@@ -12,6 +13,23 @@ export function skillNamedBy(args, skills) {
|
|
|
12
13
|
const named = args?.skill;
|
|
13
14
|
return typeof named === "string" ? skills.find((s) => s.name === named) : undefined;
|
|
14
15
|
}
|
|
16
|
+
const FOREIGN_SKILL_NAMESPACE = "anthropic-skills:";
|
|
17
|
+
export function skillNameSuggestion(args, skills) {
|
|
18
|
+
const named = args?.skill;
|
|
19
|
+
if (typeof named !== "string" || named.trim() === "")
|
|
20
|
+
return undefined;
|
|
21
|
+
const nearest = closestName(named, skills.map((s) => s.name));
|
|
22
|
+
if (nearest !== undefined)
|
|
23
|
+
return nearest;
|
|
24
|
+
if (!named.startsWith(FOREIGN_SKILL_NAMESPACE))
|
|
25
|
+
return undefined;
|
|
26
|
+
const bare = named.slice(FOREIGN_SKILL_NAMESPACE.length);
|
|
27
|
+
return skills.some((s) => s.name === bare) ? bare : undefined;
|
|
28
|
+
}
|
|
29
|
+
export function skillNameHint(args, skills) {
|
|
30
|
+
const suggestion = skillNameSuggestion(args, skills);
|
|
31
|
+
return suggestion === undefined ? "" : ` Did you mean ${suggestion}? Invoke it by that full name.`;
|
|
32
|
+
}
|
|
15
33
|
function readsAsNothingLabel(inert) {
|
|
16
34
|
return `<reads as nothing (${inert.reason}): ${spelledListEntry(inert.entry)}>`;
|
|
17
35
|
}
|
|
@@ -63,7 +63,7 @@ export declare const EXPECTED_LISTBYSCOPE_SUMMARIES: ({
|
|
|
63
63
|
severity: number;
|
|
64
64
|
deadline: number;
|
|
65
65
|
createdAt: number;
|
|
66
|
-
|
|
66
|
+
sourceSessionId: string;
|
|
67
67
|
principal: string;
|
|
68
68
|
toolCallId: string;
|
|
69
69
|
toolName: string;
|
|
@@ -82,7 +82,7 @@ export declare const EXPECTED_LISTBYSCOPE_SUMMARIES: ({
|
|
|
82
82
|
createdAt: number;
|
|
83
83
|
severity?: undefined;
|
|
84
84
|
deadline?: undefined;
|
|
85
|
-
|
|
85
|
+
sourceSessionId?: undefined;
|
|
86
86
|
principal?: undefined;
|
|
87
87
|
toolCallId?: undefined;
|
|
88
88
|
toolName?: undefined;
|
|
@@ -430,6 +430,19 @@ export async function checkpointStoreContract(make, runAssertion, options = {})
|
|
|
430
430
|
const bareBack = (await store.get(bare.token));
|
|
431
431
|
assert.equal("requires" in bareBack || "requirementsDigest" in bareBack, false, "a row without a list or digest must stay without (never [] / null / \"\")");
|
|
432
432
|
});
|
|
433
|
+
run("held rows: a row's `heldRows` (the conversation rows owed after its leaf) survive the round-trip verbatim — every row, in its order, each member of each (text blocks, a string content, `provenance`, `rewrittenBy`); a row without them stays without", async () => {
|
|
434
|
+
const store = make();
|
|
435
|
+
const heldRows = [
|
|
436
|
+
{ role: "user", content: "first note", timestamp: 1, provenance: "engine-note" },
|
|
437
|
+
{ role: "user", content: [{ type: "text", text: "second note, rewritten" }], timestamp: 2, provenance: "engine-note", rewrittenBy: ["scrubber", "tagger"] },
|
|
438
|
+
];
|
|
439
|
+
const held = createCheckpointFixture({ token: mintCheckpointToken(), sessionId: "held-rows", heldRows });
|
|
440
|
+
const bare = createCheckpointFixture({ token: mintCheckpointToken(), sessionId: "held-none" });
|
|
441
|
+
for (const cp of [held, bare])
|
|
442
|
+
await store.put(cp.token, cp);
|
|
443
|
+
assert.deepEqual((await store.get(held.token)).heldRows, heldRows, "the held rows must survive the round-trip as the same rows, in the same order, every member kept");
|
|
444
|
+
assert.equal("heldRows" in (await store.get(bare.token)), false, "a row without held rows must stay without (never [] / null)");
|
|
445
|
+
});
|
|
433
446
|
run("run origin: a row's `state.runOrigin` survives the round-trip verbatim and rides the listing; absent stays absent; a word outside the set is kept on the row and reads as absent in the listing", async () => {
|
|
434
447
|
const store = make();
|
|
435
448
|
const member = createCheckpointFixture({ token: mintCheckpointToken(), sessionId: "ro-member" });
|
|
@@ -633,7 +646,7 @@ export async function checkpointListByScopeSummaries(store) {
|
|
|
633
646
|
sessionId: "needs-approval",
|
|
634
647
|
deadline: 1_999_999_999_999,
|
|
635
648
|
createdAt: 1_700_000_000_000,
|
|
636
|
-
|
|
649
|
+
sourceSessionId: "needs-approval",
|
|
637
650
|
principal: "alice@corp",
|
|
638
651
|
gate: {
|
|
639
652
|
kind: "human",
|
|
@@ -681,7 +694,7 @@ export const EXPECTED_LISTBYSCOPE_SUMMARIES = [
|
|
|
681
694
|
severity: 5,
|
|
682
695
|
deadline: 1_999_999_999_999,
|
|
683
696
|
createdAt: 1_700_000_000_000,
|
|
684
|
-
|
|
697
|
+
sourceSessionId: "needs-approval",
|
|
685
698
|
principal: "alice@corp",
|
|
686
699
|
toolCallId: "call-pr",
|
|
687
700
|
toolName: "open_pr",
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FileHistoryStore } from "../file-history-store.js";
|
|
2
2
|
import { type ContractAssertionRunner } from "./contract-harness.js";
|
|
3
|
-
export declare function fileHistoryStoreContract(make: () => FileHistoryStore, runAssertion?: ContractAssertionRunner
|
|
3
|
+
export declare function fileHistoryStoreContract(make: () => FileHistoryStore, runAssertion?: ContractAssertionRunner, onOptionalMember?: (report: {
|
|
4
|
+
member: "blobExchange";
|
|
5
|
+
status: "verified" | "absent";
|
|
6
|
+
}) => void): Promise<void>;
|
|
@@ -3,6 +3,7 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
import { chmod, mkdtemp, mkdir, rm, stat, symlink, writeFile, readFile } from "node:fs/promises";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
|
+
import { fileHistoryBlobExchangeOf } from "../file-history-store.js";
|
|
6
7
|
import { isGovernanceRetryClass } from "../governance-codes.js";
|
|
7
8
|
import { NodeExecutionEnv } from "../../internal/harness.js";
|
|
8
9
|
import { beginContract } from "./contract-harness.js";
|
|
@@ -51,8 +52,31 @@ async function withTree(fn) {
|
|
|
51
52
|
await rm(dir, { recursive: true, force: true });
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
export async function fileHistoryStoreContract(make, runAssertion) {
|
|
55
|
+
export async function fileHistoryStoreContract(make, runAssertion, onOptionalMember) {
|
|
55
56
|
const { run, settle } = beginContract(runAssertion);
|
|
57
|
+
run("blobExchange (optional member group): read as one group; put checks the address and stores nothing it refuses; has answers from the index; get round-trips; absence is REPORTED", async () => {
|
|
58
|
+
const exchange = fileHistoryBlobExchangeOf(make());
|
|
59
|
+
if (exchange === undefined) {
|
|
60
|
+
onOptionalMember?.({ member: "blobExchange", status: "absent" });
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const bytes = new TextEncoder().encode("bytes another machine sent ahead of its import");
|
|
64
|
+
const other = new TextEncoder().encode("different bytes");
|
|
65
|
+
const hash = createHash("sha256").update(bytes).digest("hex");
|
|
66
|
+
const otherHash = createHash("sha256").update(other).digest("hex");
|
|
67
|
+
assert.deepEqual([...(await exchange.has([hash]))], [], "nothing is held before the put");
|
|
68
|
+
assert.equal(await exchange.get(hash), undefined, "get answers undefined for bytes the store does not hold");
|
|
69
|
+
const wrong = await exchange.put(otherHash, bytes);
|
|
70
|
+
assert.equal(wrong.ok, false, "bytes that do not hash to the address are refused");
|
|
71
|
+
assert.equal(!wrong.ok && wrong.error.code, "adopt_failed", "the refusal is the adoption family's word");
|
|
72
|
+
assert.equal(!wrong.ok && wrong.error.permanence, "terminal", "no retry makes the bytes hash differently");
|
|
73
|
+
assert.deepEqual([...(await exchange.has([otherHash, hash]))], [], "a refused put stores nothing under either address");
|
|
74
|
+
assert.deepEqual(await exchange.put(hash, bytes), { ok: true });
|
|
75
|
+
assert.deepEqual(await exchange.put(hash, bytes), { ok: true }, "a repeat put is idempotent");
|
|
76
|
+
assert.deepEqual([...(await exchange.has([hash, otherHash]))], [hash], "has names the held ones only");
|
|
77
|
+
assert.deepEqual([...((await exchange.get(hash)) ?? [])], [...bytes], "get round-trips the bytes");
|
|
78
|
+
onOptionalMember?.({ member: "blobExchange", status: "verified" });
|
|
79
|
+
});
|
|
56
80
|
run("absent everything: canRestore=false, restore=failed/not_found with an empty ledger, reap=0 — and none of it throws", async () => {
|
|
57
81
|
await withTree(async (dir, env) => {
|
|
58
82
|
const store = make();
|