@sema-agent/core 7.70.0 → 7.71.1
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 +740 -0
- package/dist/agents/agent-transcript-tool.js +43 -19
- package/dist/agents/inherited-tool-pool.d.ts +5 -1
- package/dist/agents/inherited-tool-pool.js +6 -0
- package/dist/agents/retain-ledger.js +2 -0
- package/dist/agents/send-message-tool.d.ts +12 -1
- package/dist/agents/send-message-tool.js +47 -9
- package/dist/agents/subagent.js +31 -10
- package/dist/agents/tool-filter.js +1 -2
- package/dist/agents/verify.js +13 -2
- package/dist/agents/yield-adoption.js +11 -1
- package/dist/brain/claude-model-id.d.ts +11 -0
- package/dist/brain/claude-model-id.js +3 -1
- package/dist/config/catalog.js +10 -1
- package/dist/config/defaults.d.ts +3 -0
- package/dist/config/defaults.js +1 -0
- package/dist/core/allow-entry.js +1 -2
- package/dist/core/ask-origin.d.ts +55 -21
- package/dist/core/ask-origin.js +19 -11
- package/dist/core/ask-question.d.ts +4 -7
- package/dist/core/ask-question.js +2 -4
- package/dist/core/ask-unresolvable-notice.d.ts +17 -3
- package/dist/core/ask-unresolvable-notice.js +18 -4
- package/dist/core/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +2 -0
- package/dist/core/auto-compaction.d.ts +14 -4
- package/dist/core/auto-compaction.js +3 -2
- package/dist/core/auto-strip.js +2 -0
- package/dist/core/caller-text.d.ts +2 -33
- package/dist/core/caller-text.js +2 -23
- package/dist/core/caller-tool-name.js +1 -2
- package/dist/core/canonical-json.d.ts +9 -0
- package/dist/core/canonical-json.js +6 -0
- package/dist/core/checkpoint-features.d.ts +43 -80
- package/dist/core/checkpoint-features.js +10 -20
- package/dist/core/checkpoint-generation.d.ts +89 -19
- package/dist/core/checkpoint-generation.js +89 -14
- package/dist/core/checkpoint-queries.d.ts +95 -15
- package/dist/core/checkpoint-queries.js +108 -7
- package/dist/core/checkpoint-rekey.d.ts +2 -1
- package/dist/core/checkpoint-rekey.js +2 -2
- package/dist/core/checkpoint-requirements.d.ts +21 -7
- package/dist/core/checkpoint-requirements.js +2 -5
- package/dist/core/checkpoint-row-verdict.d.ts +3 -4
- package/dist/core/checkpoint-row-verdict.js +20 -41
- package/dist/core/checkpoint-store.d.ts +69 -41
- package/dist/core/checkpoint-store.js +28 -14
- package/dist/core/command-sandbox.d.ts +5 -3
- package/dist/core/command-sandbox.js +17 -9
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/declaration-words.d.ts +2 -1
- package/dist/core/declaration-words.js +13 -2
- package/dist/core/effective-path-target.d.ts +23 -0
- package/dist/core/effective-path-target.js +15 -1
- package/dist/core/engine-attestation.d.ts +5 -1
- package/dist/core/engine-attestation.js +1 -0
- package/dist/core/engine-capabilities.d.ts +14 -9
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +62 -32
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +1 -1
- package/dist/core/entries-not-applied.js +1 -0
- package/dist/core/file-history-store.d.ts +95 -11
- package/dist/core/file-history-store.js +117 -19
- package/dist/core/gate-fold.js +13 -7
- package/dist/core/gate-lanes.js +9 -9
- package/dist/core/governance-codes.d.ts +56 -7
- package/dist/core/governance-codes.js +105 -7
- package/dist/core/grant-holder.d.ts +53 -0
- package/dist/core/grant-holder.js +80 -0
- package/dist/core/hooks.d.ts +7 -3
- package/dist/core/hooks.js +2 -2
- package/dist/core/locked-config.d.ts +7 -1
- package/dist/core/locked-config.js +9 -2
- package/dist/core/mcp-call-meta.d.ts +52 -7
- package/dist/core/mcp-call-meta.js +21 -2
- package/dist/core/mcp-host-read.d.ts +1 -1
- package/dist/core/mcp-server-spec.d.ts +18 -0
- package/dist/core/mcp-server-spec.js +1 -0
- package/dist/core/mcp.js +2 -2
- package/dist/core/member-outcome.d.ts +22 -1
- package/dist/core/member-outcome.js +18 -6
- package/dist/core/memory-engine/delegation-settlement.js +5 -5
- package/dist/core/memory-engine/engine.js +19 -19
- package/dist/core/memory-engine/file-backend.d.ts +7 -2
- package/dist/core/memory-engine/file-backend.js +14 -12
- package/dist/core/memory-engine/frontmatter.js +1 -1
- package/dist/core/memory-engine/index.d.ts +1 -0
- package/dist/core/memory-engine/index.js +1 -0
- package/dist/core/memory-engine/layout.d.ts +34 -9
- package/dist/core/memory-engine/layout.js +36 -19
- package/dist/core/memory-engine/memory-deployment.js +8 -8
- package/dist/core/memory-engine/mount-failed-notice.d.ts +8 -5
- package/dist/core/memory-engine/mount-failed-notice.js +5 -2
- package/dist/core/mode-policy.d.ts +5 -0
- package/dist/core/mode-policy.js +6 -0
- package/dist/core/mods/host.d.ts +2 -1
- package/dist/core/mods/host.js +7 -6
- package/dist/core/mods/kernel/index.d.ts +1 -1
- package/dist/core/mods/kernel/index.js +1 -1
- package/dist/core/mods/kernel/registration.d.ts +5 -2
- package/dist/core/mods/kernel/registration.js +19 -3
- package/dist/core/mods/package.d.ts +12 -1
- package/dist/core/mods/package.js +36 -9
- package/dist/core/mods/stations.d.ts +7 -1
- package/dist/core/mods/stations.js +17 -3
- package/dist/core/mods/teammate-stations.d.ts +4 -1
- package/dist/core/mods/teammate-stations.js +1 -1
- package/dist/core/native-signal.d.ts +13 -0
- package/dist/core/native-signal.js +18 -0
- package/dist/core/park-resumability.d.ts +16 -14
- package/dist/core/park-resumability.js +9 -4
- package/dist/core/path-rule-binding.js +1 -1
- package/dist/core/permission-rule-model.d.ts +11 -5
- package/dist/core/permission-rule-model.js +5 -3
- package/dist/core/permission-rule-org.js +1 -1
- package/dist/core/permission-rule-provider.d.ts +5 -1
- package/dist/core/permission-rule-provider.js +6 -1
- package/dist/core/permission-rule-session.d.ts +35 -5
- package/dist/core/permission-rule-session.js +32 -1
- package/dist/core/permission-rule-store.d.ts +5 -1
- package/dist/core/permission-rule-store.js +28 -5
- package/dist/core/permission-rules.d.ts +2 -2
- package/dist/core/permission-rules.js +2 -3
- package/dist/core/principal-name.d.ts +12 -0
- package/dist/core/principal-name.js +6 -2
- package/dist/core/read-root-grant-screen.d.ts +7 -6
- package/dist/core/read-root-grant-screen.js +7 -8
- package/dist/core/remote-env.d.ts +42 -8
- package/dist/core/resume-config-judge.js +1 -1
- package/dist/core/resume-startup-cause.d.ts +19 -4
- package/dist/core/resume-startup-cause.js +25 -6
- package/dist/core/rewind-conversation.d.ts +4 -0
- package/dist/core/rewrite-rejudge.d.ts +9 -1
- package/dist/core/rewrite-rejudge.js +11 -1
- package/dist/core/rule-offer-read.js +3 -2
- package/dist/core/runner/assemble-result.d.ts +21 -11
- package/dist/core/runner/assemble-result.js +24 -4
- package/dist/core/runner/boundary-reminders.d.ts +104 -0
- package/dist/core/runner/boundary-reminders.js +108 -0
- package/dist/core/runner/branch-writeback.d.ts +21 -7
- package/dist/core/runner/branch-writeback.js +44 -6
- package/dist/core/runner/command-sandbox-frame.js +2 -1
- package/dist/core/runner/compact-session.js +11 -4
- package/dist/core/runner/constraint-layers.d.ts +24 -5
- package/dist/core/runner/constraint-layers.js +21 -2
- package/dist/core/runner/continuation-gate.js +3 -1
- package/dist/core/runner/contracts.d.ts +83 -13
- package/dist/core/runner/cross-boundary-lane.js +2 -1
- package/dist/core/runner/delegation-owner.d.ts +246 -45
- package/dist/core/runner/delegation-owner.js +237 -63
- package/dist/core/runner/expire-settle.d.ts +17 -0
- package/dist/core/runner/expire-settle.js +8 -2
- package/dist/core/runner/file-history-request.d.ts +4 -3
- package/dist/core/runner/file-history-request.js +4 -1
- package/dist/core/runner/file-history-restore.d.ts +11 -3
- package/dist/core/runner/file-history-restore.js +11 -3
- package/dist/core/runner/gate-exit.d.ts +22 -1
- package/dist/core/runner/gate-exit.js +12 -14
- package/dist/core/runner/nested-memory-content.js +1 -1
- package/dist/core/runner/nested-memory-lane.d.ts +10 -2
- package/dist/core/runner/nested-memory-lane.js +29 -8
- package/dist/core/runner/own-model-money-door.d.ts +13 -0
- package/dist/core/runner/own-model-money-door.js +17 -0
- package/dist/core/runner/park-commit.d.ts +4 -2
- package/dist/core/runner/park-commit.js +2 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +4 -0
- package/dist/core/runner/permission-rule-lanes.js +7 -0
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.d.ts +8 -2
- package/dist/core/runner/placement-fence.js +8 -3
- package/dist/core/runner/policy-throw.d.ts +3 -2
- package/dist/core/runner/policy-throw.js +2 -2
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +23 -14
- package/dist/core/runner/prepare-acquire-reconcile.js +33 -15
- package/dist/core/runner/prepare-artifact.d.ts +14 -1
- package/dist/core/runner/prepare-artifact.js +7 -2
- package/dist/core/runner/prepare-ask-lane.d.ts +8 -0
- package/dist/core/runner/prepare-ask-lane.js +14 -5
- package/dist/core/runner/prepare-boundary-parks.js +5 -4
- package/dist/core/runner/prepare-config-doors.d.ts +9 -4
- package/dist/core/runner/prepare-config-doors.js +25 -8
- package/dist/core/runner/prepare-defer-classify.d.ts +8 -4
- package/dist/core/runner/prepare-defer-classify.js +6 -6
- package/dist/core/runner/prepare-execution-env.d.ts +4 -1
- package/dist/core/runner/prepare-execution-env.js +8 -3
- package/dist/core/runner/prepare-file-history.d.ts +26 -0
- package/dist/core/runner/prepare-file-history.js +15 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -3
- package/dist/core/runner/prepare-inherited-gate.js +9 -2
- package/dist/core/runner/prepare-leg-adoption.d.ts +2 -2
- package/dist/core/runner/prepare-park-ask.js +8 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +5 -0
- package/dist/core/runner/prepare-policy-chain.js +18 -7
- package/dist/core/runner/prepare-prompt-assembly.d.ts +3 -0
- package/dist/core/runner/prepare-prompt-assembly.js +4 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -1
- package/dist/core/runner/prepare-suspend-saga.js +19 -5
- package/dist/core/runner/prepare-task.d.ts +2 -5
- package/dist/core/runner/prepare-task.js +71 -26
- package/dist/core/runner/prepare-turn-wiring.js +7 -5
- package/dist/core/runner/prepare-workspace-restore.js +59 -28
- package/dist/core/runner/read-root-grant.d.ts +1 -0
- package/dist/core/runner/read-root-grant.js +1 -2
- package/dist/core/runner/resume-admission.d.ts +3 -0
- package/dist/core/runner/resume-admission.js +6 -4
- package/dist/core/runner/resume-apply.js +7 -5
- package/dist/core/runner/resume-claim.d.ts +2 -2
- package/dist/core/runner/resume-claim.js +4 -4
- package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
- package/dist/core/runner/resume-policy-outcome.js +6 -4
- package/dist/core/runner/resume-preflight.d.ts +3 -0
- package/dist/core/runner/resume-preflight.js +10 -3
- package/dist/core/runner/rewind-conversation.js +11 -4
- package/dist/core/runner/rewind-files.js +29 -14
- package/dist/core/runner/rewind-outcome.d.ts +27 -0
- package/dist/core/runner/rewind-outcome.js +14 -0
- package/dist/core/runner/run-attachment-seats.js +2 -1
- package/dist/core/runner/run-clock-and-content.js +2 -0
- package/dist/core/runner/run-identity-wiring.js +2 -0
- package/dist/core/runner/run-leg.js +11 -1
- package/dist/core/runner/run-notification-lane.d.ts +3 -0
- package/dist/core/runner/run-notification-lane.js +2 -2
- package/dist/core/runner/run-settle-and-teardown.d.ts +4 -2
- package/dist/core/runner/run-settle-and-teardown.js +52 -40
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +5 -4
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +3 -3
- package/dist/core/runner/run-turn-boundary.js +7 -0
- package/dist/core/runner/runtask.d.ts +7 -4
- package/dist/core/runner/runtask.js +18 -9
- package/dist/core/runner/session-call-grant-station.d.ts +64 -0
- package/dist/core/runner/session-call-grant-station.js +119 -0
- package/dist/core/runner/session-file-state-replay.js +2 -2
- package/dist/core/runner/session-prompt-seats.d.ts +95 -0
- package/dist/core/runner/session-prompt-seats.js +62 -0
- package/dist/core/runner/session-rule-policy.js +1 -1
- package/dist/core/runner/session-write-ledger.d.ts +8 -0
- package/dist/core/runner/session-write-ledger.js +16 -0
- package/dist/core/runner/side-call-account.js +5 -1
- package/dist/core/runner/stop-tail-notice.d.ts +7 -0
- package/dist/core/runner/stop-tail-notice.js +23 -8
- package/dist/core/runner/stream-reap.js +4 -2
- package/dist/core/runner/stream-settle-backstop.d.ts +1 -1
- package/dist/core/runner/stream-settle-backstop.js +17 -18
- package/dist/core/runner/terminal-account.js +17 -8
- package/dist/core/runner/terminal-projection.d.ts +3 -2
- package/dist/core/runner/terminal-projection.js +1 -1
- package/dist/core/runner/tool-turn-repair-seat.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.js +12 -7
- package/dist/core/runner/turn-attachments.d.ts +22 -1
- package/dist/core/runner/turn-attachments.js +20 -3
- package/dist/core/runner-deps.d.ts +6 -2
- package/dist/core/secret-env.d.ts +26 -6
- package/dist/core/secret-env.js +6 -6
- package/dist/core/session-call-grant-screen.d.ts +58 -0
- package/dist/core/session-call-grant-screen.js +18 -0
- package/dist/core/session-call-grant.d.ts +93 -0
- package/dist/core/session-call-grant.js +524 -0
- package/dist/core/session-checkout.d.ts +3 -0
- package/dist/core/session-checkout.js +8 -3
- package/dist/core/session-policy-store.d.ts +14 -0
- package/dist/core/session-policy-store.js +16 -2
- package/dist/core/session-store.d.ts +18 -1
- package/dist/core/session-store.js +20 -4
- package/dist/core/session.d.ts +36 -4
- package/dist/core/shared-artifact-reads.d.ts +93 -0
- package/dist/core/shared-artifact-reads.js +94 -0
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/skills-directory.d.ts +9 -45
- package/dist/core/skills-directory.js +9 -722
- package/dist/core/spend-account.js +3 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +22 -4
- package/dist/core/store-contracts/checkpoint-store-contract.js +363 -29
- package/dist/core/store-contracts/file-history-store-contract.d.ts +11 -3
- package/dist/core/store-contracts/file-history-store-contract.js +62 -2
- package/dist/core/store-contracts/grant-fixture.d.ts +52 -0
- package/dist/core/store-contracts/grant-fixture.js +84 -0
- package/dist/core/store-contracts/session-repo-contract.js +18 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +15 -1
- package/dist/core/store-contracts/session-store-contract.js +211 -2
- package/dist/core/store-contracts/workflow-journal-store-contract.js +47 -8
- package/dist/core/suspend-lane-reasons.d.ts +13 -0
- package/dist/core/suspend-lane-reasons.js +5 -0
- package/dist/core/synthetic-read-verdict.d.ts +5 -3
- package/dist/core/synthetic-read-verdict.js +1 -1
- package/dist/core/task-limits.d.ts +15 -0
- package/dist/core/task-notification.d.ts +33 -7
- package/dist/core/task-notification.js +34 -9
- package/dist/core/task-registry-agent.d.ts +1 -1
- package/dist/core/task-registry-agent.js +18 -7
- package/dist/core/task-registry-shared.d.ts +29 -4
- package/dist/core/task-registry-shared.js +7 -0
- package/dist/core/task-registry.d.ts +21 -1
- package/dist/core/task-registry.js +36 -9
- package/dist/core/task-result.d.ts +55 -1
- package/dist/core/task-spec.d.ts +17 -3
- package/dist/core/terminal-cause.d.ts +68 -5
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.js +2 -1
- package/dist/core/tool-errors.js +1 -0
- package/dist/core/tool-list-grammar.d.ts +0 -47
- package/dist/core/tool-list-grammar.js +1 -75
- package/dist/core/tool-model-gate.d.ts +7 -11
- package/dist/core/tool-model-gate.js +5 -8
- package/dist/core/tool-name-aliases.js +2 -3
- package/dist/core/tool-name-readings.d.ts +4 -0
- package/dist/core/tool-name-readings.js +1 -0
- package/dist/core/tool-policy.d.ts +46 -4
- package/dist/core/tool-policy.js +47 -18
- package/dist/core/tool-result-store.d.ts +0 -24
- package/dist/core/tool-result-store.js +1 -36
- package/dist/core/tool-spec.d.ts +8 -4
- package/dist/core/untrusted-egress.js +2 -2
- package/dist/core/untrusted-text.d.ts +8 -0
- package/dist/core/untrusted-text.js +14 -0
- package/dist/core/user-attachment.d.ts +16 -1
- package/dist/core/user-attachment.js +42 -18
- package/dist/core/wiring-manifest.d.ts +4 -9
- package/dist/core/wiring-manifest.js +1 -1
- package/dist/core/workflow-journal-store.d.ts +55 -8
- package/dist/core/workflow-journal-store.js +34 -10
- package/dist/core/workflow-run-store-contract.js +56 -1
- package/dist/core/workflow-run-store.d.ts +43 -19
- package/dist/core/workflow-run-store.js +17 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
- package/dist/engine/execution-env/node-execution-env.js +4 -0
- package/dist/engine/harness/agent-harness.d.ts +10 -5
- package/dist/engine/harness/agent-harness.js +12 -4
- package/dist/engine/harness/types.d.ts +18 -0
- package/dist/engine/llm/tool-turns.d.ts +1 -1
- package/dist/engine/llm/types.d.ts +5 -4
- package/dist/engine/session/memory-repo.d.ts +15 -3
- package/dist/engine/session/memory-repo.js +21 -3
- package/dist/engine/session/memory-storage.d.ts +5 -0
- package/dist/engine/session/memory-storage.js +8 -3
- package/dist/engine/session/repo-utils.d.ts +9 -0
- package/dist/engine/session/repo-utils.js +14 -0
- package/dist/engine/session/storage-base.d.ts +20 -7
- package/dist/engine/session/storage-base.js +13 -1
- package/dist/index.d.ts +39 -21
- package/dist/index.js +32 -17
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +13 -1
- package/dist/orchestration/run-workflow-tool.js +101 -32
- package/dist/orchestration/workflow-park-adoption.d.ts +309 -92
- package/dist/orchestration/workflow-park-adoption.js +588 -323
- package/dist/orchestration/workflow-tree-id.d.ts +66 -0
- package/dist/orchestration/workflow-tree-id.js +66 -0
- package/dist/orchestration/workflow-types.d.ts +90 -11
- package/dist/orchestration/workflow-types.js +10 -1
- package/dist/orchestration/workflow.d.ts +30 -4
- package/dist/orchestration/workflow.js +424 -114
- package/dist/prompt-assembly/catalog/constitution.js +5 -1
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +3 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +61 -22
- package/dist/prompt-assembly/catalog/environment.js +2 -2
- package/dist/prompt-assembly/catalog/events.d.ts +16 -0
- package/dist/prompt-assembly/catalog/events.js +2 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +72 -44
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +2 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +2 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +5 -1
- package/dist/prompt-assembly/catalog/schema.js +2 -0
- package/dist/prompt-assembly/catalog/sections.js +3 -14
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/select.js +1 -0
- package/dist/prompt-assembly/tool-catalog.d.ts +10 -7
- package/dist/prompt-assembly/tool-catalog.js +21 -7
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/default.d.ts +4 -1
- package/dist/prompts/default.js +6 -0
- package/dist/stores/file/checkpoint-store.d.ts +11 -10
- package/dist/stores/file/checkpoint-store.js +36 -10
- package/dist/stores/file/file-history-store.d.ts +6 -0
- package/dist/stores/file/file-history-store.js +21 -4
- package/dist/stores/file/fs-atomic.d.ts +1 -1
- package/dist/stores/file/index.d.ts +14 -4
- package/dist/stores/file/index.js +21 -5
- package/dist/stores/file/process-anchor.d.ts +9 -1
- package/dist/stores/file/session-policy-store.js +2 -17
- package/dist/stores/file/session-store.d.ts +27 -0
- package/dist/stores/file/session-store.js +81 -9
- package/dist/stores/file/workflow-journal-store.d.ts +14 -4
- package/dist/stores/file/workflow-journal-store.js +32 -24
- package/dist/stores/file/workflow-run-store.d.ts +15 -4
- package/dist/stores/file/workflow-run-store.js +76 -0
- package/dist/tools/artifact/artifact-tool.d.ts +10 -3
- package/dist/tools/artifact/artifact-tool.js +16 -1
- package/dist/tools/fs/bash-program-position.d.ts +10 -4
- package/dist/tools/fs/bash-program-position.js +11 -8
- package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -1
- package/dist/tools/fs/bash-readonly-classifier.js +9 -2
- package/dist/tools/fs/find-actions.d.ts +30 -16
- package/dist/tools/fs/find-actions.js +272 -19
- package/dist/tools/fs/fs-bash.js +8 -5
- package/dist/tools/fs/fs-shared.d.ts +0 -29
- package/dist/tools/fs/fs-shared.js +0 -5
- package/dist/tools/fs/fs-write.js +2 -1
- package/dist/tools/fs/read-deny.d.ts +6 -1
- package/dist/tools/fs/read-deny.js +6 -1
- package/dist/tools/fs/read-floor.d.ts +6 -0
- package/dist/tools/fs/read-floor.js +5 -1
- package/dist/tools/fs/removal-actions.d.ts +43 -0
- package/dist/tools/fs/removal-actions.js +25 -0
- package/dist/tools/fs/removal-targets.d.ts +2 -21
- package/dist/tools/fs/removal-targets.js +2 -3
- package/dist/tools/fs/safety.d.ts +37 -1
- package/dist/tools/fs/safety.js +52 -0
- package/dist/tools/fs/shell-climb.d.ts +46 -0
- package/dist/tools/fs/shell-climb.js +79 -0
- package/dist/tools/fs/shell-read-check.js +47 -19
- package/dist/tools/fs/shell-read-establish.js +36 -22
- package/dist/tools/fs/shell-read-judge.d.ts +10 -2
- package/dist/tools/fs/shell-read-judge.js +4 -4
- package/dist/tools/fs/shell-read-plan.d.ts +3 -0
- package/dist/tools/fs/shell-read-plan.js +1 -1
- package/dist/tools/fs/shell-read-workdir.js +3 -2
- package/dist/tools/fs/shell-read-write-targets.d.ts +4 -3
- package/dist/tools/fs/shell-read-write-targets.js +3 -0
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +173 -15
- package/wire-changes/core-stores-sql@7.71.0.json +40 -0
- package/wire-changes/core-stores-sql@7.71.1.json +40 -0
- package/wire-changes/core@7.71.0.json +5827 -0
- package/wire-changes/core@7.71.1.json +118 -0
- package/wire-changes/mods-kernel@7.71.0.json +52 -0
- package/wire-changes/mods-kernel@7.71.1.json +40 -0
- package/wire-changes/primitives@7.71.0.json +473 -0
- package/wire-changes/primitives@7.71.1.json +40 -0
- package/wire-changes/wiki-gate@7.71.0.json +40 -0
- package/wire-changes/wiki-gate@7.71.1.json +40 -0
- package/dist/core/frontmatter-fence.d.ts +0 -10
- package/dist/core/frontmatter-fence.js +0 -6
- package/dist/core/permission-rule-syntax.d.ts +0 -46
- package/dist/core/permission-rule-syntax.js +0 -52
package/dist/core/task-spec.d.ts
CHANGED
|
@@ -336,7 +336,7 @@ export interface TaskSpec {
|
|
|
336
336
|
*
|
|
337
337
|
* What the engine does with it: the run's ending waits for the loop-type background tasks it launched (agents,
|
|
338
338
|
* continued agents, workflows) — their terminal frames are owed to the run's lane and arrive as later turns,
|
|
339
|
-
* bounded by the walltime and
|
|
339
|
+
* bounded by the walltime and the wait's own ceiling ({@link TaskLimits.oneShotWaitCeilingMs}, default 600 s) — and does not wait for process-type ones (a background command,
|
|
340
340
|
* a Monitor watch), whose receipts carry one sentence saying so. Default `false`/absent = interactive (unchanged).
|
|
341
341
|
* A deployment MAY thread it into other one-shot-sensitive decisions of its own.
|
|
342
342
|
*
|
|
@@ -598,8 +598,11 @@ export interface TaskSpec {
|
|
|
598
598
|
/**
|
|
599
599
|
* The directory this session's OLDER file versions were recorded under (an engine before 7.68.2 recorded no place): without
|
|
600
600
|
* it they are refused `place_unrecorded`; with it they are judged as recorded there, by the one place comparison (another
|
|
601
|
-
* directory ⇒ not written: left as it is outside this root, `recorded_elsewhere` inside it). An absolute path, in the run's environment
|
|
602
|
-
* `
|
|
601
|
+
* directory ⇒ not written: left as it is outside this root, `recorded_elsewhere` inside it). An absolute path, in the run's environment
|
|
602
|
+
* — or the word `"rewind_root"`: they were recorded under this rewind's own root (the root the engine joins the session's keys on: a
|
|
603
|
+
* session that works in a tree of its own, that tree), which the host states without knowing or spelling the path; the engine reads it
|
|
604
|
+
* as that root where the restore runs. Only on a run that restores files, else `rewind.invalid_spec`. A host states it when it knows
|
|
605
|
+
* where every earlier turn ran. `Runner.rewindFiles` takes it too (capability word `file_history.unplaced_recorded_under`).
|
|
603
606
|
*/
|
|
604
607
|
unplacedHistoryRecordedUnder?: string;
|
|
605
608
|
/**
|
|
@@ -1768,6 +1771,17 @@ export interface TaskSpec {
|
|
|
1768
1771
|
* default — a near-miss spelling must not silently publish a different readout than the one asked for.
|
|
1769
1772
|
*/
|
|
1770
1773
|
totalTokensReminderMode?: "off" | "infinite" | "fixed" | "countdown" | "padded-countdown";
|
|
1774
|
+
/** The silent-turn reminder: when the model has gone several requests without a word to the person (five since the last
|
|
1775
|
+
* reminder, at most three in one stretch; or, on a model whose traits hold `timed_silent_turn_reminder`, a minute of
|
|
1776
|
+
* silence), the next turn boundary reminds it to keep them updated. Only for a model whose prompt traits hold
|
|
1777
|
+
* `silent_turn_reminder`, only on a top-level leg (never a delegated child). DEFAULT ON — boolean: `false` is the opt-out,
|
|
1778
|
+
* a non-boolean is refused at the task's door (`config.invalid_argument`). */
|
|
1779
|
+
silentTurnReminder?: boolean;
|
|
1780
|
+
/** The elapsed-time reminder: the boundary bundle (a continuation boundary no person's input opens) tells the model how long
|
|
1781
|
+
* it has been since the person last spoke (`Elapsed time so far: 3m 07s`; the session's clock, read by its child legs too,
|
|
1782
|
+
* restarted only by the person's own input on a top-level leg). Only for a model whose prompt traits hold
|
|
1783
|
+
* `elapsed_time_reminder`. DEFAULT ON — same boolean contract as {@link silentTurnReminder}. */
|
|
1784
|
+
elapsedTimeReminder?: boolean;
|
|
1771
1785
|
/** Post-compact background-task restatement — DEFAULT ON since 5.12.0 (boolean, not `true`:
|
|
1772
1786
|
* explicit `false` is the opt-out; same contract as the listing family below). CC hard-codes
|
|
1773
1787
|
* this behavior, and the opt-in default left every non-shell host (server-driven runs) with a
|
|
@@ -23,6 +23,34 @@ import type { ModelOutputInvalidCause, OutputLimit } from "../internal/llm.js";
|
|
|
23
23
|
* A consumer holding a table over it is tsc-red on a new word until it places the word.
|
|
24
24
|
*/
|
|
25
25
|
export type UnstartedRowOutcome = "reopened" | "declined" | "unknown";
|
|
26
|
+
/**
|
|
27
|
+
* Whether a leg's rewind moved the working tree, read off what its restore asked of the env (the witness of the restore's own
|
|
28
|
+
* view, the one reading): `"none"` — no write, delete, change of mode or directory was asked of the tree (the leg never reached its
|
|
29
|
+
* restore, or the restore was refused or failed before any file moved: its plan refused or failed, the history had no address);
|
|
30
|
+
* `"some"` — at least one of them answered done; `"unknown"` — some were asked and none answered done (a write that failed may have
|
|
31
|
+
* written part of a file). A CLOSED SET registered in `docs/CLOSED-SETS.md`; the member {@link TaskRewindSettlement.moved}.
|
|
32
|
+
*/
|
|
33
|
+
export type RewindMoved = "none" | "some" | "unknown";
|
|
34
|
+
/**
|
|
35
|
+
* Where a leg's request left its session's conversation leaf (`TaskSpec.resumeAt` branches it at the session acquire): `"untouched"`
|
|
36
|
+
* — the request moved no leaf (it asked no `resumeAt`, was refused before branching, or branched at the leaf it found);
|
|
37
|
+
* `"put_back"` — it branched and the refused leg put the leaf back where the request found it; `"left_moved"` — the leaf stays off
|
|
38
|
+
* where the request found it (the leg ran past its prepare on the branch, another writer moved the leaf past the request's own
|
|
39
|
+
* entries, or the cleanup's bound expired before its write started). A CLOSED SET registered in `docs/CLOSED-SETS.md`.
|
|
40
|
+
*/
|
|
41
|
+
export type RewindBranch = "untouched" | "put_back" | "left_moved";
|
|
42
|
+
/**
|
|
43
|
+
* What a leg that asked for a rewind did to the working tree and to its conversation ({@link RewindMoved}, {@link RewindBranch}) —
|
|
44
|
+
* the two facts a host tells a person "what the disk and the conversation look like now" from, minted where each happens: `moved` by
|
|
45
|
+
* the restore (the witness of what it asked of the env), `branch` by the acquire that branched and the cleanup that puts it back.
|
|
46
|
+
* `branch` absent = not known: the put-back's read or its write threw, or its bound expired while the write was in flight (the
|
|
47
|
+
* session store's write carries no cancellation). Carried on a `failed` or `blocked` terminal ({@link TerminalCause}) and on `Runner.rewindFiles`'
|
|
48
|
+
* `rewind.restore_failed` detail (`branch: "untouched"` there: the verb moves no leaf).
|
|
49
|
+
*/
|
|
50
|
+
export interface TaskRewindSettlement {
|
|
51
|
+
moved: RewindMoved;
|
|
52
|
+
branch?: RewindBranch;
|
|
53
|
+
}
|
|
26
54
|
/**
|
|
27
55
|
* WHY a run ended — ONE tagged cause, and the ONLY terminal record a {@link TaskResult} carries. The run
|
|
28
56
|
* loop's terminal arbitration used to decide a `status` word plus seven optional plane fields one by one
|
|
@@ -97,6 +125,8 @@ export type TerminalCause = {
|
|
|
97
125
|
* `"spend.account_closed"` — the run's next model request was not sent because the run its work belongs to (the run
|
|
98
126
|
* that started it, by a task-bound link) had already ended and closed its spend account; no ceiling held, so raising a
|
|
99
127
|
* limit does not help — the work has to be started again under a live run (`errorClassOf` reads `aborted`).
|
|
128
|
+
* `"holder.superseded"` — the store refused one of the leg's session writes for the run's grant (`RunInternals.holder`): another
|
|
129
|
+
* leg holds the run, or the run has ended. The leg stopped on that tick; do not retry it (`errorClassOf` reads `aborted`).
|
|
100
130
|
* `"unexpected.suspended"` / `"unexpected.needs_review"` — a nested orchestrator stopped at a durable pause and
|
|
101
131
|
* carries it on {@link nestedPause} (`mapNestedSuspend` states which orchestrators, and how the pause continues).
|
|
102
132
|
*/
|
|
@@ -135,9 +165,19 @@ export type TerminalCause = {
|
|
|
135
165
|
* between, can succeed — the failure's cause read by the one table the reopened sentence reads too (`resumeAgainMayCure`).
|
|
136
166
|
* `true` = an infrastructure failure a retry can pass (or a cause not known); `false` = a retry fails the same way (the
|
|
137
167
|
* transcript is missing or damaged, or the tool, the configuration or the decision must change first), so an automatic retry of
|
|
138
|
-
* the same decision expires the row instead. PRESENCE: exactly when `unstartedRow` is `"reopened"
|
|
168
|
+
* the same decision expires the row instead. PRESENCE: exactly when `unstartedRow` is `"reopened"` and the row is this run's to
|
|
169
|
+
* resume — the table has an answer for the failure's cause; absent otherwise, and absent on a row reopened for the run's current
|
|
170
|
+
* holder (cause `superseded`, code `holder.superseded`: this run neither retries nor expires it).
|
|
139
171
|
*/
|
|
140
172
|
resumeAgainMayCure?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* On a leg whose request asked for a rewind (`TaskSpec.resumeAt`, `rewindFilesTo` or `restoreFiles`), whatever `code` ended it —
|
|
175
|
+
* a refusal of the rewind itself, a refusal after the restore landed, a failure of the run on the restored tree: whether the
|
|
176
|
+
* working tree moved and where the conversation's leaf was left ({@link TaskRewindSettlement}). Beside `code`, never folded into
|
|
177
|
+
* a code's own `detail`. PRESENCE: exactly on such a leg's failed terminal; absent on every other leg — and from an engine before
|
|
178
|
+
* 7.71.0, where it reads as not known.
|
|
179
|
+
*/
|
|
180
|
+
rewind?: TaskRewindSettlement;
|
|
141
181
|
} | {
|
|
142
182
|
kind: "blocked";
|
|
143
183
|
/**
|
|
@@ -157,6 +197,13 @@ export type TerminalCause = {
|
|
|
157
197
|
* engine from before this key — branch on `detail?.kind`, never on the prose in `reason`.
|
|
158
198
|
*/
|
|
159
199
|
detail?: TerminalBlockedDetail;
|
|
200
|
+
/**
|
|
201
|
+
* On a leg whose request asked for a rewind, the same record a `failed` terminal states ({@link TaskRewindSettlement}): the
|
|
202
|
+
* restore ran in prepare and the leg then ended blocked (a prompt hook refused the objective, the agent reported it could not go
|
|
203
|
+
* on) — whether the working tree moved and where the conversation's leaf was left. PRESENCE: exactly on such a leg's blocked
|
|
204
|
+
* terminal; absent on every other leg, and from an engine before 7.71.0.
|
|
205
|
+
*/
|
|
206
|
+
rewind?: TaskRewindSettlement;
|
|
160
207
|
} | {
|
|
161
208
|
kind: "paused";
|
|
162
209
|
/**
|
|
@@ -325,9 +372,9 @@ export type TerminalFailureDetail = {
|
|
|
325
372
|
* other string leaf passes the secret-tier redaction (credential shapes masked; a path is kept — it rides this
|
|
326
373
|
* structured seat, never `message`); a member whose key is not JSON-safe (visible ASCII 1–128, nothing the
|
|
327
374
|
* redaction would mask) is left out. Read off the same link of the error's `cause` chain whose `code` became
|
|
328
|
-
* `terminal.code`. PRESENCE: only when that link carried a plain-object `detail` with at least one such member, or
|
|
329
|
-
* configuration refusal whose input the engine knows (below) — a code thrown with
|
|
330
|
-
* named the result) leaves the whole account absent.
|
|
375
|
+
* `terminal.code`. PRESENCE: only when that link carried a plain-object `detail` with at least one such member, or one a bound
|
|
376
|
+
* cut ({@link omitted}), or is a configuration refusal whose input the engine knows (below) — a code thrown with none of those
|
|
377
|
+
* (or a higher-ranked terminal that named the result) leaves the whole account absent.
|
|
331
378
|
*
|
|
332
379
|
* One member is the engine's own, never the thrower's: `input` — on a `config.*` / `resume_at.*` refusal of a leg's prepare,
|
|
333
380
|
* which input must change for the refusal to go away (`ConfigRefusalInput`: `taskConfig` the request, `deps` the deployment,
|
|
@@ -335,10 +382,26 @@ export type TerminalFailureDetail = {
|
|
|
335
382
|
* name in the thrown `detail` is left out; read it with `configRefusalInputOf`.
|
|
336
383
|
*/
|
|
337
384
|
detail: CodedFailureDetail;
|
|
385
|
+
/**
|
|
386
|
+
* The names of the thrown `detail`'s own members a bound above left out of `detail`, or cut into (an array dropped whole, a
|
|
387
|
+
* record that lost a member, a string too long, a member the snapshot's totals had no room for), in the detail's member order
|
|
388
|
+
* — so a member absent from `detail` reads as "too large to carry" when it is named here and as "not stated" when it is not.
|
|
389
|
+
* Never counted against the bounds; at most 64 names — a detail with more own members than the entry bound admits is left out
|
|
390
|
+
* whole and named by its first 64, the rest counted in {@link omittedMore}. A member left out for its kind (a function, bytes)
|
|
391
|
+
* or for its key is not named. PRESENCE: exactly when a bound cut something; `detail` is then present even if no member fit (`{}`).
|
|
392
|
+
* It sits on this arm of `terminal.detail` (`terminal.detail.omitted`), beside the account's own `detail` — not on the terminal.
|
|
393
|
+
*/
|
|
394
|
+
omitted?: readonly string[];
|
|
395
|
+
/**
|
|
396
|
+
* How many more of the thrown `detail`'s own members a bound cut than {@link omitted} names (it names 64 at most): a member past
|
|
397
|
+
* those is "too large to carry" too, unnamed. Counts only members whose key could have been named (a key left out for its shape,
|
|
398
|
+
* or for carrying a credential, is in neither). PRESENCE: only when more than 64 such were cut.
|
|
399
|
+
*/
|
|
400
|
+
omittedMore?: number;
|
|
338
401
|
} | {
|
|
339
402
|
kind: "model_output_invalid";
|
|
340
403
|
/** Which drop cause failed the turn (`MODEL_OUTPUT_INVALID_CAUSES`: `truncated` — arguments cut before they
|
|
341
|
-
* parsed; `unnamed` — a call with no tool name). The same words `
|
|
404
|
+
* parsed; `unnamed` — a call with no tool name). The same words the person's line for an incomplete tool turn carries in `detail.cause`. */
|
|
342
405
|
cause: ModelOutputInvalidCause;
|
|
343
406
|
/** With `truncated`: the output-cap facts the stream reported (the cap stop, the counted output, the request's
|
|
344
407
|
* cap) — what the brain's sentence words as its cap clause. */
|
|
@@ -26,7 +26,7 @@ export const TOOL_CATALOG_ENTRIES = [
|
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
id: "edit", name: "Edit", source: "builtin", definedIn: "src/tools/fs/fs-write.ts", mountedBy: ["hands"],
|
|
29
|
-
cards: ["edit"],
|
|
29
|
+
cards: ["edit", "create"],
|
|
30
30
|
face: {
|
|
31
31
|
family: "file-write", boundaryLegs: ["env"], effect: "write", contract: c("core.edit@1"),
|
|
32
32
|
pathTarget: { param: "file_path", aliases: ["path"], access: "edit", skillScopeEligible: true, base: "cwd", absent: "none" },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { extensionNamed, extensionQuestionText, extensionSpeaker, refusalOf } from "./tool-policy.js";
|
|
2
|
+
import { answerAsShown, shownDigestOf } from "./rewrite-rejudge.js";
|
|
2
3
|
import { hookAskReasonOf, joinAskReasons } from "./ask-origin.js";
|
|
3
4
|
import { allowRuleShadowOf, withAllowRuleShadow } from "./allow-entry.js";
|
|
4
5
|
import { failedHandlerClause } from "./mods/stations.js";
|
|
@@ -58,7 +59,7 @@ export async function readToolChecks(chains, standing, call, project) {
|
|
|
58
59
|
if (reading.kind === "denied")
|
|
59
60
|
return reading;
|
|
60
61
|
if (reading.kind === "asked" && chain.settle !== undefined && heard.kind === "answered") {
|
|
61
|
-
const settled = await chain.settle(questionOf(heard, call.toolName), call.request, call.signal);
|
|
62
|
+
const settled = answerAsShown(shownDigestOf(call.request), await chain.settle(questionOf(heard, call.toolName), call.request, call.signal), call.request);
|
|
62
63
|
if (settled.action === "deny")
|
|
63
64
|
return { kind: "denied", deny: refusalOf(settled, call.judged) };
|
|
64
65
|
if (settled.action === "allow") {
|
package/dist/core/tool-errors.js
CHANGED
|
@@ -91,6 +91,7 @@ const EXACT_CODE_CLASS = new Map([
|
|
|
91
91
|
["model.malformed_tool_use_exhausted", "output"],
|
|
92
92
|
["model.truncated_output_exhausted", "output"],
|
|
93
93
|
["spend.account_closed", "aborted"],
|
|
94
|
+
["holder.superseded", "aborted"],
|
|
94
95
|
]);
|
|
95
96
|
const DOTTED_PREFIX_CLASS = [
|
|
96
97
|
["limits.", "limit"],
|
|
@@ -1,51 +1,4 @@
|
|
|
1
1
|
import { type ToolNameListSide } from "./tool-name-list.js";
|
|
2
|
-
/** YAML's white space — the space and the tab — THE one definition: every test that reads a blank reads it here (a
|
|
3
|
-
* no-break space, a line break, any other space character is text). */
|
|
4
|
-
export declare const isBlank: (ch: string) => boolean;
|
|
5
|
-
/** Why a list cannot be read — clauses a reader puts in its sentence; none quotes the list's own text. */
|
|
6
|
-
export declare const PARENS_NOT_ONE_ZONE = "an entry's parentheses are not one group that closes it (a `(` that does not close, a `)` with no `(`, or text after the closing `)` \u2014 `\\(` / `\\)` are a rule's own text)";
|
|
7
|
-
export declare const SEQUENCE_NOT_A_NAME = "an entry is not a plain or quoted name (nested, mapping, anchor, tag, flow and block-scalar entries, and number, boolean and null entries, are not read)";
|
|
8
|
-
/** An entry the rule syntax cannot read, by its place in the list (counted from 1; the entry itself is not quoted). */
|
|
9
|
-
export declare const notARule: (position: number) => string;
|
|
10
|
-
/**
|
|
11
|
-
* The cut, run over ONE scalar's text at a time (a reader of YAML's structure reads that first): entries end at every comma
|
|
12
|
-
* and every SPACE character outside parentheses. A `(` opens a zone a matching `)` closes, nested zones counted
|
|
13
|
-
* (`Bash(echo $(date) now)` is one entry); a parenthesis after an odd run of backslashes is the rule's escaped text
|
|
14
|
-
* (`\(` / `\)`, the rule syntax's own escape) and counts for nothing. An entry's parentheses are ONE zone that closes the
|
|
15
|
-
* entry: a `)` with no zone open, a zone the scalar leaves open, and anything but a separator after the `)` that closes the
|
|
16
|
-
* zone (`Bash(a)(b)`, two rules joined by a tab or a no-break space) are the one problem of parentheses, kept for the list
|
|
17
|
-
* ({@link problem}) and for the entry it is in ({@link brokenParens}). Each entry loses the blanks at its ends and an empty
|
|
18
|
-
* one is dropped (`Read,Grep,` is two). A tab is no separator. What else an entry must be is the rule syntax's to say, asked
|
|
19
|
-
* once the whole list is read.
|
|
20
|
-
*/
|
|
21
|
-
export declare class EntryCutter {
|
|
22
|
-
readonly entries: string[];
|
|
23
|
-
/** Per entry, at its index in {@link entries}: its parentheses are not one zone that closes it. */
|
|
24
|
-
readonly brokenParens: boolean[];
|
|
25
|
-
problem: string | undefined;
|
|
26
|
-
/** Parentheses open in the current scalar: inside one nothing cuts. */
|
|
27
|
-
private depth;
|
|
28
|
-
/** The current entry's zone opened and closed again: only a separator may follow. */
|
|
29
|
-
private closed;
|
|
30
|
-
private current;
|
|
31
|
-
/** The current entry's parentheses are not one zone. */
|
|
32
|
-
private currentBroken;
|
|
33
|
-
/** Blanks read after the entry's last other character, written only when another one follows: an entry's leading and
|
|
34
|
-
* trailing blanks, and the blanks a line break drops, never are (and no line break makes the cut look back). */
|
|
35
|
-
private blanks;
|
|
36
|
-
/** The character pushed last was a backslash that escapes the next one. */
|
|
37
|
-
private escaping;
|
|
38
|
-
push(ch: string): void;
|
|
39
|
-
/** `breaks` line breaks inside a scalar, as YAML folds them: the blanks before them go, one reads as a space (which
|
|
40
|
-
* separates entries outside parentheses), and more than one keeps all but one as line breaks of the text. */
|
|
41
|
-
fold(breaks: number): void;
|
|
42
|
-
/** The scalar is over: its last entry is cut, and a zone it left open is a problem. */
|
|
43
|
-
endScalar(): void;
|
|
44
|
-
fail(why: string): void;
|
|
45
|
-
/** The current entry's parentheses are not one zone that closes it — a problem of the list and of that entry. */
|
|
46
|
-
private breakParens;
|
|
47
|
-
private cut;
|
|
48
|
-
}
|
|
49
2
|
/** One entry of a tool-list field, read by the rule syntax. */
|
|
50
3
|
export interface ToolListFieldEntry {
|
|
51
4
|
/** The entry's place in the field, counted from 1 over every entry the field holds — read or refused — in written order. */
|
|
@@ -1,79 +1,5 @@
|
|
|
1
|
-
import { ruleSpellingOf } from "
|
|
1
|
+
import { EntryCutter, PARENS_NOT_ONE_ZONE, SEQUENCE_NOT_A_NAME, notARule, ruleSpellingOf } from "@sema-agent/primitives";
|
|
2
2
|
import { readToolNameList } from "./tool-name-list.js";
|
|
3
|
-
export const isBlank = (ch) => ch === " " || ch === "\t";
|
|
4
|
-
export const PARENS_NOT_ONE_ZONE = "an entry's parentheses are not one group that closes it (a `(` that does not close, a `)` with no `(`, or text after the closing `)` — `\\(` / `\\)` are a rule's own text)";
|
|
5
|
-
export const SEQUENCE_NOT_A_NAME = "an entry is not a plain or quoted name (nested, mapping, anchor, tag, flow and block-scalar entries, and number, boolean and null entries, are not read)";
|
|
6
|
-
export const notARule = (position) => `entry ${position} is no rule spelling (a tool name of ASCII letters, digits and \`_ - . : *\`, starting with a letter, a digit, \`_\` or \`*\`, then at most one parenthesized rule)`;
|
|
7
|
-
export class EntryCutter {
|
|
8
|
-
entries = [];
|
|
9
|
-
brokenParens = [];
|
|
10
|
-
problem;
|
|
11
|
-
depth = 0;
|
|
12
|
-
closed = false;
|
|
13
|
-
current = "";
|
|
14
|
-
currentBroken = false;
|
|
15
|
-
blanks = "";
|
|
16
|
-
escaping = false;
|
|
17
|
-
push(ch) {
|
|
18
|
-
const escaped = this.escaping;
|
|
19
|
-
this.escaping = ch === "\\" && !escaped;
|
|
20
|
-
if (this.depth === 0 && (ch === "," || ch === " ")) {
|
|
21
|
-
this.cut();
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (isBlank(ch)) {
|
|
25
|
-
if (this.current !== "")
|
|
26
|
-
this.blanks += ch;
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (this.closed)
|
|
30
|
-
this.breakParens();
|
|
31
|
-
if (ch === "(" && !escaped)
|
|
32
|
-
this.depth++;
|
|
33
|
-
else if (ch === ")" && !escaped) {
|
|
34
|
-
if (this.depth === 0)
|
|
35
|
-
this.breakParens();
|
|
36
|
-
else
|
|
37
|
-
this.closed = --this.depth === 0;
|
|
38
|
-
}
|
|
39
|
-
this.current += this.blanks + ch;
|
|
40
|
-
this.blanks = "";
|
|
41
|
-
}
|
|
42
|
-
fold(breaks) {
|
|
43
|
-
this.blanks = "";
|
|
44
|
-
if (breaks === 1)
|
|
45
|
-
this.push(" ");
|
|
46
|
-
else
|
|
47
|
-
for (let n = 1; n < breaks; n++)
|
|
48
|
-
this.push("\n");
|
|
49
|
-
}
|
|
50
|
-
endScalar() {
|
|
51
|
-
if (this.depth > 0)
|
|
52
|
-
this.breakParens();
|
|
53
|
-
this.depth = 0;
|
|
54
|
-
this.escaping = false;
|
|
55
|
-
this.cut();
|
|
56
|
-
}
|
|
57
|
-
fail(why) {
|
|
58
|
-
this.problem ??= why;
|
|
59
|
-
}
|
|
60
|
-
breakParens() {
|
|
61
|
-
this.currentBroken = true;
|
|
62
|
-
this.fail(PARENS_NOT_ONE_ZONE);
|
|
63
|
-
}
|
|
64
|
-
cut() {
|
|
65
|
-
const entry = this.current;
|
|
66
|
-
const broken = this.currentBroken;
|
|
67
|
-
this.current = "";
|
|
68
|
-
this.blanks = "";
|
|
69
|
-
this.closed = false;
|
|
70
|
-
this.currentBroken = false;
|
|
71
|
-
if (entry !== "") {
|
|
72
|
-
this.entries.push(entry);
|
|
73
|
-
this.brokenParens.push(broken);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
3
|
const LIST_UNREADABLE = "its value is a list whose entries cannot be read (an accessor or a proxy trap threw), not a list of names";
|
|
78
4
|
const notAList = (type) => `its value is ${type}, not a list of names`;
|
|
79
5
|
const DENY_ALL = "`*` in a denied list denies every tool (a reader that collapses the list to `*` would deny nothing)";
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* edges (family absent, id shape unmatched, version below floor) all point the same way, and it is
|
|
19
19
|
* the only polarity compatible with BYOM — the reverse would trim every non-claude deployment's
|
|
20
20
|
* default face. The engine does NOT guarantee a canonical id either: a deployment-authored
|
|
21
|
-
* `Model.id` (a raw Model object, or a catalog key shadowing the tier expansion) that
|
|
22
|
-
*
|
|
21
|
+
* `Model.id` (a raw Model object, or a catalog key shadowing the tier expansion) that the one reading of a Claude
|
|
22
|
+
* model id (`parseClaudeModelId`) does not parse — an unknown suffix, a gateway alias — stays open — the
|
|
23
23
|
* explicit-id discipline's deployment-side duty. To gate a non-claude strong model, write the
|
|
24
24
|
* exact id into a {@link ToolModelGateRule.modelIds} row (the only non-claude channel; no prefix
|
|
25
25
|
* or wildcard syntax exists).
|
|
@@ -32,18 +32,14 @@
|
|
|
32
32
|
* env would have to grow with every class.
|
|
33
33
|
*/
|
|
34
34
|
import type { ToolSpec } from "./types.js";
|
|
35
|
-
/** The shared tail extractor (BYOM ids may carry provider prefixes — "openrouter/anthropic/claude-fable-5"):
|
|
36
|
-
* boundary-aware LAST path segment, case-folded. Single source for every model-family/model-id
|
|
37
|
-
* comparison site (the tool-registration gate's; prompt text never reads a model id — it selects on the model's
|
|
38
|
-
* declared traits). */
|
|
39
|
-
export declare function modelIdTail(id: string): string;
|
|
40
35
|
/** One gate class's matching rule (both axes optional; a rule with BOTH axes empty gates nothing —
|
|
41
36
|
* the per-class OFF shape a deployment reaches by explicitly clearing the axes). */
|
|
42
37
|
export interface ToolModelGateRule {
|
|
43
|
-
/** claude-syntax family+floor rows — meaningful only for
|
|
44
|
-
* `claude
|
|
45
|
-
*
|
|
46
|
-
*
|
|
38
|
+
/** claude-syntax family+floor rows — meaningful only for an id the one reading of a Claude model id parses
|
|
39
|
+
* (`parseClaudeModelId`, `src/brain/claude-model-id.ts`: a provider or region prefix, a dated or versioned snapshot
|
|
40
|
+
* and a window suffix read as the model they name). Its (major, minor) tuple compares positionally, missing positions
|
|
41
|
+
* read 0, tuple ≥ floor ⇒ gated (the reference's comparator semantics). Any other id shape falls through this axis
|
|
42
|
+
* entirely (fail-open). */
|
|
47
43
|
floors?: ReadonlyArray<readonly [family: string, floor: ReadonlyArray<number>]>;
|
|
48
44
|
/** Exact-id rows (explicit-id discipline): the resolved `Model.id`'s tail segment must equal the
|
|
49
45
|
* row case-insensitively. The ONLY channel by which a BYOM deployment gates its own non-claude
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import { modelIdTail, parseClaudeModelId } from "../brain/claude-model-id.js";
|
|
1
2
|
import { callerKey } from "./caller-text.js";
|
|
2
3
|
import { readMember, thrownText } from "./thrown-value.js";
|
|
3
|
-
export function modelIdTail(id) {
|
|
4
|
-
return id.toLowerCase().split("/").pop() ?? "";
|
|
5
|
-
}
|
|
6
4
|
export const TOOL_MODEL_GATE_CLASSES = Object.freeze({
|
|
7
5
|
"task-scaffold": Object.freeze({
|
|
8
6
|
floors: Object.freeze([
|
|
@@ -13,7 +11,6 @@ export const TOOL_MODEL_GATE_CLASSES = Object.freeze({
|
|
|
13
11
|
]),
|
|
14
12
|
}),
|
|
15
13
|
});
|
|
16
|
-
const CLAUDE_ID_RE = /^claude-([a-z]+)-(\d+(?:-\d+)*)$/;
|
|
17
14
|
function versionTupleGte(version, floor) {
|
|
18
15
|
const n = Math.max(version.length, floor.length);
|
|
19
16
|
for (let i = 0; i < n; i++) {
|
|
@@ -35,10 +32,10 @@ export function isModelGatedForClass(modelId, rule) {
|
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
if (rule.floors !== undefined) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
const family =
|
|
41
|
-
const version =
|
|
35
|
+
const parsed = parseClaudeModelId(modelId);
|
|
36
|
+
if (parsed !== undefined) {
|
|
37
|
+
const family = parsed.family;
|
|
38
|
+
const version = parsed.minor !== undefined ? [parsed.major, parsed.minor] : [parsed.major];
|
|
42
39
|
for (const row of rule.floors) {
|
|
43
40
|
if (!Array.isArray(row) || row.length !== 2)
|
|
44
41
|
continue;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { judgeRuleToolName,
|
|
1
|
+
import { judgeRuleToolName, retiredToolNameList, ruleSpellingOf, splitNamespacedName } from "@sema-agent/primitives";
|
|
2
2
|
import { catalogToolNames } from "./tool-registry.js";
|
|
3
|
-
import { ruleSpellingOf } from "./permission-rule-syntax.js";
|
|
4
3
|
import { readToolNameList } from "./tool-name-list.js";
|
|
5
4
|
import { withFormerRuleNames } from "./tool-name-readings.js";
|
|
6
5
|
function mountedSpellingOf(name, roster) {
|
|
@@ -70,7 +69,7 @@ export const NO_RETIRED_READING = Object.freeze({ successorOf: () => undefined,
|
|
|
70
69
|
export function retiredNameView(roster) {
|
|
71
70
|
const successorBy = new Map();
|
|
72
71
|
const formerBy = new Map();
|
|
73
|
-
for (const name of
|
|
72
|
+
for (const name of retiredToolNameList()) {
|
|
74
73
|
const successor = successorReadingOf(name, roster);
|
|
75
74
|
if (successor === undefined)
|
|
76
75
|
continue;
|
|
@@ -172,6 +172,10 @@ export declare const NAME_READINGS: {
|
|
|
172
172
|
readonly kind: "wire";
|
|
173
173
|
readonly file: string;
|
|
174
174
|
};
|
|
175
|
+
readonly "offer.callGrantTool": {
|
|
176
|
+
readonly kind: "wire";
|
|
177
|
+
readonly file: string;
|
|
178
|
+
};
|
|
175
179
|
readonly "offer.marks": {
|
|
176
180
|
readonly kind: "seat";
|
|
177
181
|
readonly rank: "tier";
|
|
@@ -43,6 +43,7 @@ export const NAME_READINGS = {
|
|
|
43
43
|
"mode.planRosterRow": wire("src/core/mode-policy.ts"),
|
|
44
44
|
"offer.laneTool": wire(OFFER),
|
|
45
45
|
"offer.orgQuestionExemption": wire(OFFER),
|
|
46
|
+
"offer.callGrantTool": wire("src/core/runner/session-call-grant-station.ts"),
|
|
46
47
|
"offer.marks": seat("tier", OFFER),
|
|
47
48
|
"offer.marks.egress": any(OFFER),
|
|
48
49
|
"park.riskDescriptor": seat("tier", PARK),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AskClass, type AskOrigin, type AssertAllKeysHandled } from "./ask-origin.js";
|
|
1
|
+
import { type AskClass, type AskOrigin, type AssertAllKeysHandled, type UnresolvedAskCause } from "./ask-origin.js";
|
|
2
2
|
import { type EngineAttestation } from "./engine-attestation.js";
|
|
3
3
|
import { type ReadRootGrantScreen } from "./read-root-grant-screen.js";
|
|
4
4
|
import { type ApprovalWordsSeat } from "./approval-words.js";
|
|
@@ -1042,6 +1042,7 @@ export type ApprovalSeatOutcome = boolean | (Extract<AskOutcome, {
|
|
|
1042
1042
|
updatedInput?: never;
|
|
1043
1043
|
readRootGrant?: never;
|
|
1044
1044
|
readRootGrantLasts?: never;
|
|
1045
|
+
sessionCallGrant?: never;
|
|
1045
1046
|
feedback?: never;
|
|
1046
1047
|
});
|
|
1047
1048
|
/**
|
|
@@ -1351,6 +1352,12 @@ export interface AskRequest {
|
|
|
1351
1352
|
* parked out-of-root ask renders the confirmation alone.
|
|
1352
1353
|
*/
|
|
1353
1354
|
readonly readRootCandidate?: import("./types.js").ReadRootGrantCandidate;
|
|
1355
|
+
/** "Allow this call for the rest of the session" (`session-call-grant.ts`): present when the question is one a standing rule
|
|
1356
|
+
* could clear, the call is a shell command whose binding the run's environment can read, and the run keeps session rules
|
|
1357
|
+
* (the same predicate as a session-long read grant). A person who takes it answers `{ allow: true, sessionCallGrant: <grant> }`.
|
|
1358
|
+
* Minted only by the synchronous station (the run that asks is the run that writes); a parked or inherited card carries none.
|
|
1359
|
+
* ABSENT is no claim of why. Display members besides `grant` are for rendering and are never read back. */
|
|
1360
|
+
readonly sessionCallGrant?: import("./session-call-grant-screen.js").SessionCallGrantOffer;
|
|
1354
1361
|
/** design/252 G-2: the RULE-PROVENANCE evidence behind this ask — the org snapshot revision and the
|
|
1355
1362
|
* matched rules' own identity keys, each present as a value or as a named absence (see
|
|
1356
1363
|
* {@link AskRuleEvidence}). Present on EVERY ask the engine mints, so a consumer never has to tell a
|
|
@@ -1936,6 +1943,19 @@ export type OnAsk = "deny" | "allow" | ((req: AskRequest, signal?: AbortSignal)
|
|
|
1936
1943
|
* value, or the member without a `readRootGrant`, rejects the grant (nothing added; the verdict stands); on a seat with no
|
|
1937
1944
|
* card (a policy's `approve`) it denies the call, as a `readRootGrant` does. Beyond the session: `TaskSpec.additionalReadDirectories`.
|
|
1938
1945
|
*
|
|
1946
|
+
* `sessionCallGrant` — "yes, and allow this call for the rest of the session": the card's
|
|
1947
|
+
* {@link AskRequest.sessionCallGrant} `grant`, sent back byte for byte, beside `allow: true` and no `updatedInput`, from a person.
|
|
1948
|
+
* The engine writes one session row binding the call (programs, scripts, directories, digests — never the command's words), and a
|
|
1949
|
+
* later call of the same session that reads back the same binding is allowed by it as a standing allow rule is (mandated
|
|
1950
|
+
* questions still ask). Announced `approval.session_call_granted`; a choice that does not take is `approval.session_call_grant_rejected`
|
|
1951
|
+
* (`detail.reason` ∈ `SESSION_CALL_GRANT_REJECTIONS`), the verdict stands; a refusal, or the card's key in an answer no person gave, keeps and
|
|
1952
|
+
* announces nothing. Taken back by `removePersistedRule` on its session scope. A seat with no card (a policy's `approve`) refuses it.
|
|
1953
|
+
* The engine reads only whether the answer carries the member: a host that does not render the option (a card it cannot show
|
|
1954
|
+
* as the engine recorded it, say) simply never sends it. WHO answered is read as for every answer, by the existing members: the
|
|
1955
|
+
* `settledBy` word (omitted reads as a person) and a seat declared a policy (`asPolicyApprover`, whose card offers no option). A host
|
|
1956
|
+
* answering without a person says `settledBy: "policy"` (settled `policy_allowed`: the call runs, the key keeps and announces nothing;
|
|
1957
|
+
* with `feedback` the whole answer is refused). A hook's allow and a mode that shows no card never reach this member at all.
|
|
1958
|
+
*
|
|
1939
1959
|
* `feedback` — "yes, and tell the agent what to do next": what the approving PERSON typed into the card's input, the allow arm's
|
|
1940
1960
|
* counterpart of a refusal's `reason` and the exact twin of the durable resume's `ResumeOutcome` `policy_ask` `feedback`. PRESENT
|
|
1941
1961
|
* only when the person wrote something: it is read by the one reading the durable decide uses (the outer whitespace dropped; empty
|
|
@@ -1957,6 +1977,7 @@ export type AskOutcome = boolean | "unavailable" | {
|
|
|
1957
1977
|
decidedVia?: DecidedVia;
|
|
1958
1978
|
readRootGrant?: string;
|
|
1959
1979
|
readRootGrantLasts?: import("./read-root-grant-screen.js").ReadRootGrantLasts;
|
|
1980
|
+
sessionCallGrant?: string;
|
|
1960
1981
|
feedback?: string;
|
|
1961
1982
|
};
|
|
1962
1983
|
/** A word a synchronous approver may report on `settledBy` — read off {@link AskOutcome}, the one place it is spelled as a type. */
|
|
@@ -2316,6 +2337,8 @@ export type ResolvedAsk = (Extract<PermissionResult, {
|
|
|
2316
2337
|
approverUnavailable?: never;
|
|
2317
2338
|
/** The answer's `readRootGrant` ({@link AskOutcome}), screened against the request's candidate. */
|
|
2318
2339
|
readRootGrant?: ReadRootGrantScreen;
|
|
2340
|
+
/** The answer's `sessionCallGrant` ({@link AskOutcome}), screened against the request's option. */
|
|
2341
|
+
sessionCallGrant?: import("./session-call-grant-screen.js").SessionCallGrantScreen;
|
|
2319
2342
|
/** The words a person's allow carried ({@link AskOutcome} `feedback`), fit to deliver. Handed to the station's
|
|
2320
2343
|
* {@link ApprovalWordsSeat} by {@link resolveAskFor} and gone from the resolution it returns. */
|
|
2321
2344
|
feedback?: string;
|
|
@@ -2324,8 +2347,9 @@ export type ResolvedAsk = (Extract<PermissionResult, {
|
|
|
2324
2347
|
}> & {
|
|
2325
2348
|
presentedInput?: unknown;
|
|
2326
2349
|
approverUnavailable?: true;
|
|
2327
|
-
/** A grant riding a refusal:
|
|
2328
|
-
readRootGrant?:
|
|
2350
|
+
/** A grant riding a refusal does not apply: a deny carries no grant screen (nothing to keep, nothing to announce). */
|
|
2351
|
+
readRootGrant?: never;
|
|
2352
|
+
sessionCallGrant?: never;
|
|
2329
2353
|
feedback?: never;
|
|
2330
2354
|
});
|
|
2331
2355
|
/** What one resolver ARM composes: the resolution plus the settlement it ended the wait with — composed at the arm, every deny
|
|
@@ -2337,16 +2361,18 @@ export type ResolverArmResult = (Extract<ResolvedAsk, {
|
|
|
2337
2361
|
settlement?: Settlement;
|
|
2338
2362
|
bindingRefusal?: undefined;
|
|
2339
2363
|
quotesQuestion?: undefined;
|
|
2364
|
+
unanswered?: undefined;
|
|
2340
2365
|
})
|
|
2341
2366
|
/** `bindingRefusal`: the arm refused arguments no approval can be bound to — the record carries the sentence. `quotesQuestion`:
|
|
2342
2367
|
* the arm's sentence quotes the ask's question (`req.message`) whole, so the resolution may carry the literals that question
|
|
2343
|
-
* quotes ({@link quotingQuestion}; read by {@link resolveAskFor} alone, never on the resolution). */
|
|
2368
|
+
* quotes ({@link quotingQuestion}; read by {@link resolveAskFor} alone, never on the resolution). `unanswered`: why nobody could answer the ask the arm refused with {@link unresolvedAskDenialMessage}, recorded with its question and sentence. */
|
|
2344
2369
|
| (Extract<ResolvedAsk, {
|
|
2345
2370
|
action: "deny";
|
|
2346
2371
|
}> & {
|
|
2347
2372
|
settlement: Settlement;
|
|
2348
2373
|
bindingRefusal?: string;
|
|
2349
2374
|
quotesQuestion?: true;
|
|
2375
|
+
unanswered?: UnresolvedAskCause;
|
|
2350
2376
|
});
|
|
2351
2377
|
/**
|
|
2352
2378
|
* The DIRECTIONAL format controls, as a closed set (see {@link AskRequest.hasBidiControls}):
|
|
@@ -2462,3 +2488,19 @@ say?: import("../prompt-assembly/engine-text.js").EngineText,
|
|
|
2462
2488
|
/** The station's landing for THIS delivery ({@link AskRequest.ifUnavailable}: the gate's for its own deliveries, the inherited
|
|
2463
2489
|
* station's for an ancestor's approver, `close` where no park route reaches); absent ⇒ the request carries none. */
|
|
2464
2490
|
ifUnavailable?: import("./unavailable-landing.js").UnavailableLanding): Promise<ResolvedAsk>;
|
|
2491
|
+
/**
|
|
2492
|
+
* The members of a host resolver's answer the gate's readers read after they receive it — the one list {@link receivedResolution}
|
|
2493
|
+
* projects and nothing else: the word (`action`), the words for the model (`message`, `decisionReason`), the bytes (`updatedInput`, the
|
|
2494
|
+
* shown snapshot `presentedInput`), the routing mark (`approverUnavailable`), the engine's record (`attestation`) and the retired
|
|
2495
|
+
* `settlement` (carried only so the ledger refuses it). An answer's grant members (`readRootGrant`, `sessionCallGrant`, `feedback`) are
|
|
2496
|
+
* read by the engine's own resolver before it answers, never by the gate after; anything else an answer carries is not received.
|
|
2497
|
+
*/
|
|
2498
|
+
export declare const RECEIVED_RESOLUTION_MEMBERS: readonly ["action", "message", "decisionReason", "updatedInput", "presentedInput", "approverUnavailable", "attestation", "settlement"];
|
|
2499
|
+
/** A host resolver's answer as the gate receives it (once awaited): PROJECTED BY NAME — each of {@link RECEIVED_RESOLUTION_MEMBERS} read
|
|
2500
|
+
* exactly once as the answer reads it (`answer[name]`: a getter on its prototype, a hidden member, a Proxy's `get` — what that read
|
|
2501
|
+
* answers is the member) onto a fresh frozen plain object the engine owns, a member read as `undefined` left absent. Only that object is
|
|
2502
|
+
* handed on: the allow and the deny (the refusal rebuilt over it too) read it, and nothing reads the answer again; members outside the
|
|
2503
|
+
* list are not carried. A projection whose `action` is `allow` or `deny` is the answer; any other value (or a member whose read throws)
|
|
2504
|
+
* is nobody's yes, refused in that sentence (the gate's ledger records an answer with no engine record as the approver's contract
|
|
2505
|
+
* failing) — never read as an allow. */
|
|
2506
|
+
export declare function receivedResolution(answer: unknown, toolName: string): ResolvedAsk;
|