@sema-agent/core 7.67.3 → 7.68.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 +1537 -0
- package/README.md +18 -9
- package/README.zh-CN.md +16 -8
- package/dist/agents/agent-definition.d.ts +1 -1
- package/dist/agents/agent-definition.js +4 -1
- package/dist/agents/cascade.d.ts +2 -2
- package/dist/agents/cascade.js +3 -1
- package/dist/agents/cumulative-stats.d.ts +2 -1
- package/dist/agents/cumulative-stats.js +4 -1
- package/dist/agents/list-agents-tool.d.ts +30 -0
- package/dist/agents/list-agents-tool.js +45 -3
- package/dist/agents/peer-admission.d.ts +2 -2
- package/dist/agents/peer-session-drain.d.ts +2 -0
- package/dist/agents/peer-session-drain.js +1 -0
- package/dist/agents/repair-loop.js +3 -1
- package/dist/agents/retain-ledger.d.ts +61 -8
- package/dist/agents/retain-ledger.js +25 -3
- package/dist/agents/roster-store.d.ts +4 -2
- package/dist/agents/send-message-tool.d.ts +1 -1
- package/dist/agents/send-message-tool.js +20 -15
- package/dist/agents/subagent-steps.js +2 -10
- package/dist/agents/subagent.d.ts +3 -0
- package/dist/agents/subagent.js +106 -76
- package/dist/agents/tool-filter.d.ts +20 -11
- package/dist/agents/tool-filter.js +8 -4
- package/dist/agents/verify.d.ts +3 -1
- package/dist/agents/verify.js +2 -0
- package/dist/brain/anthropic.js +4 -4
- package/dist/brain/open-responses.js +3 -1
- package/dist/brain/openai.js +3 -1
- package/dist/brain/reasoning-request.d.ts +73 -19
- package/dist/brain/reasoning-request.js +164 -72
- package/dist/brain/reasoning-stamp.d.ts +26 -0
- package/dist/brain/reasoning-stamp.js +10 -0
- package/dist/brain/reasoning.d.ts +95 -162
- package/dist/brain/reasoning.js +31 -86
- package/dist/brain/route-adjudicator.d.ts +9 -7
- package/dist/brain/route-adjudicator.js +12 -10
- package/dist/brain/status-sink.d.ts +19 -64
- package/dist/brain/status-sink.js +5 -21
- package/dist/brain/stream-engine.d.ts +11 -2
- package/dist/brain/stream-engine.js +10 -0
- package/dist/core/a2a.d.ts +17 -5
- package/dist/core/a2a.js +11 -3
- package/dist/core/allow-entry.d.ts +35 -15
- package/dist/core/allow-entry.js +47 -60
- package/dist/core/ask-headline.d.ts +68 -0
- package/dist/core/ask-headline.js +23 -0
- package/dist/core/ask-origin.d.ts +36 -8
- package/dist/core/ask-origin.js +17 -10
- package/dist/core/ask-question.d.ts +34 -7
- package/dist/core/ask-question.js +10 -1
- package/dist/core/ask-unresolvable-notice.d.ts +7 -0
- package/dist/core/ask-unresolvable-notice.js +9 -3
- package/dist/core/auto-strip.d.ts +53 -0
- package/dist/core/auto-strip.js +76 -0
- package/dist/core/background-agent-store.d.ts +45 -5
- package/dist/core/background-agent-store.js +69 -15
- package/dist/core/background-shell.d.ts +2 -2
- package/dist/core/caller-text.js +2 -2
- package/dist/core/canonical-json.d.ts +13 -0
- package/dist/core/canonical-json.js +7 -0
- package/dist/core/checkpoint-features.d.ts +66 -20
- package/dist/core/checkpoint-features.js +12 -1
- package/dist/core/checkpoint-generation.d.ts +1 -1
- package/dist/core/checkpoint-queries.d.ts +1 -1
- package/dist/core/checkpoint-queries.js +4 -1
- package/dist/core/checkpoint-requirements.d.ts +45 -2
- package/dist/core/checkpoint-requirements.js +16 -6
- package/dist/core/checkpoint-row-verdict.d.ts +1 -0
- package/dist/core/checkpoint-row-verdict.js +4 -0
- package/dist/core/checkpoint-store.d.ts +66 -38
- package/dist/core/checkpoint-store.js +15 -6
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +1 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/delegation-frames.d.ts +9 -12
- package/dist/core/delegation-frames.js +9 -8
- package/dist/core/engine-capabilities.d.ts +21 -8
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +147 -34
- package/dist/core/engine-notice.js +27 -16
- package/dist/core/engine-storage-backend.d.ts +2 -1
- package/dist/core/env-budget.js +3 -3
- package/dist/core/env-knob-announce.d.ts +10 -10
- package/dist/core/env-knob-announce.js +3 -6
- package/dist/core/file-history-store.d.ts +29 -4
- package/dist/core/file-history-store.js +13 -0
- package/dist/core/frame-settlement.d.ts +2 -1
- package/dist/core/gate-fold.js +1 -1
- package/dist/core/gate-lanes.js +56 -49
- package/dist/core/governance-codes.d.ts +39 -3
- package/dist/core/governance-codes.js +61 -3
- package/dist/core/hooks.d.ts +29 -11
- package/dist/core/hooks.js +5 -2
- package/dist/core/human-input-projection.js +3 -3
- package/dist/core/input-author.d.ts +17 -3
- package/dist/core/input-author.js +15 -3
- package/dist/core/leg-identity.d.ts +10 -28
- package/dist/core/leg-identity.js +1 -21
- package/dist/core/lsp.d.ts +18 -13
- package/dist/core/lsp.js +30 -22
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/mailbox-store.js +4 -4
- package/dist/core/mcp-connection-pool.d.ts +93 -4
- package/dist/core/mcp-connection-pool.js +104 -1
- package/dist/core/mcp-failure.d.ts +38 -12
- package/dist/core/mcp-failure.js +9 -13
- package/dist/core/mcp-probe.d.ts +4 -3
- package/dist/core/mcp-server-link.d.ts +4 -2
- package/dist/core/mcp-server-link.js +4 -5
- package/dist/core/mcp-server-spec.d.ts +3 -3
- package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
- package/dist/core/mcp-server-unavailable-notice.js +18 -4
- package/dist/core/mcp.d.ts +40 -6
- package/dist/core/mcp.js +39 -13
- package/dist/core/memory-engine/content-origin.js +2 -2
- package/dist/core/memory-engine/control-objects.d.ts +2 -4
- package/dist/core/memory-engine/control-objects.js +2 -10
- package/dist/core/memory-engine/delegation-settlement.js +6 -1
- package/dist/core/memory-engine/dual-root.js +3 -0
- package/dist/core/memory-engine/engine.d.ts +6 -4
- package/dist/core/memory-engine/engine.js +32 -29
- package/dist/core/memory-engine/file-backend.d.ts +20 -5
- package/dist/core/memory-engine/file-backend.js +21 -31
- package/dist/core/memory-engine/frontmatter.d.ts +2 -0
- package/dist/core/memory-engine/frontmatter.js +4 -0
- package/dist/core/memory-engine/layout.d.ts +114 -20
- package/dist/core/memory-engine/layout.js +340 -22
- package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
- package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
- package/dist/core/memory-engine/mount-failed-notice.js +43 -10
- package/dist/core/memory-engine/sync-client.js +4 -5
- package/dist/core/model-fallbacks.d.ts +5 -1
- package/dist/core/model-fallbacks.js +3 -3
- package/dist/core/model-receipt.d.ts +2 -1
- package/dist/core/model-receipt.js +12 -1
- package/dist/core/mods/kernel/dispatch.d.ts +2 -2
- package/dist/core/mods/kernel/dispatch.js +14 -6
- package/dist/core/mods/kernel/events.d.ts +8 -5
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/index.d.ts +1 -1
- package/dist/core/mods/kernel/registration.d.ts +9 -0
- package/dist/core/mods/package.js +1 -1
- package/dist/core/mods/session-append.d.ts +4 -2
- package/dist/core/mods/session-append.js +3 -0
- package/dist/core/mods/stations.d.ts +7 -11
- package/dist/core/mods/stations.js +4 -7
- package/dist/core/mods/tool-call.d.ts +10 -8
- package/dist/core/mods/tool-call.js +15 -18
- package/dist/core/mounted-mcp.d.ts +0 -4
- package/dist/core/mounted-mcp.js +1 -1
- package/dist/core/park-noun.d.ts +24 -0
- package/dist/core/park-noun.js +21 -0
- package/dist/core/park-resumability.d.ts +60 -0
- package/dist/core/park-resumability.js +30 -0
- package/dist/core/permission-rule-provider.d.ts +24 -2
- package/dist/core/permission-rule-provider.js +11 -8
- package/dist/core/permission-rule-store.d.ts +8 -1
- package/dist/core/permission-rule-store.js +2 -3
- package/dist/core/permission-rules.d.ts +2 -1
- package/dist/core/permission-rules.js +8 -4
- package/dist/core/persisted-rule-arms.d.ts +3 -0
- package/dist/core/persisted-rule-arms.js +2 -1
- package/dist/core/present-plan-tool.d.ts +47 -3
- package/dist/core/present-plan-tool.js +62 -4
- package/dist/core/principal-name.d.ts +1 -1
- package/dist/core/principal-name.js +5 -5
- package/dist/core/process-identity.js +10 -5
- package/dist/core/protocol-http-auth.d.ts +20 -14
- package/dist/core/protocol-http-auth.js +70 -50
- package/dist/core/read-only-shell.js +9 -5
- package/dist/core/redaction-marks.d.ts +4 -26
- package/dist/core/redaction-marks.js +9 -21
- package/dist/core/remote-env.d.ts +43 -16
- package/dist/core/remote-env.js +1 -1
- package/dist/core/request-copy-projection.d.ts +1 -1
- package/dist/core/request-copy-projection.js +40 -50
- package/dist/core/resume-config-judge.js +1 -1
- package/dist/core/resume-startup-cause.d.ts +35 -18
- package/dist/core/resume-startup-cause.js +13 -10
- package/dist/core/retention.d.ts +167 -25
- package/dist/core/retention.js +100 -20
- package/dist/core/roles.d.ts +6 -0
- package/dist/core/roles.js +11 -5
- package/dist/core/rule-lane-reads.d.ts +3 -0
- package/dist/core/rule-lane-reads.js +5 -1
- package/dist/core/rule-store-fault.d.ts +70 -0
- package/dist/core/rule-store-fault.js +102 -0
- package/dist/core/runner/advertised-writable-dirs.js +16 -31
- package/dist/core/runner/announce-once-ledger.d.ts +19 -2
- package/dist/core/runner/announce-once-ledger.js +24 -2
- package/dist/core/runner/assemble-result.d.ts +6 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/auto-strip-notice.d.ts +36 -0
- package/dist/core/runner/auto-strip-notice.js +59 -0
- package/dist/core/runner/branch-window.d.ts +3 -0
- package/dist/core/runner/branch-window.js +37 -0
- package/dist/core/runner/caller-roster.d.ts +8 -3
- package/dist/core/runner/capability-withheld-seat.js +3 -9
- package/dist/core/runner/clock-and-limits.d.ts +22 -1
- package/dist/core/runner/clock-and-limits.js +30 -0
- package/dist/core/runner/contracts.d.ts +58 -35
- package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
- package/dist/core/runner/credential-refusal-seat.js +47 -0
- package/dist/core/runner/cross-boundary-lane.js +6 -4
- package/dist/core/runner/decide-continuation.js +1 -1
- package/dist/core/runner/file-history-restore.d.ts +53 -2
- package/dist/core/runner/file-history-restore.js +29 -10
- package/dist/core/runner/forward-sink.d.ts +14 -1
- package/dist/core/runner/forward-sink.js +14 -12
- package/dist/core/runner/gate-exit.d.ts +8 -7
- package/dist/core/runner/gate-exit.js +13 -13
- package/dist/core/runner/git-status-frame.js +2 -4
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/main-call-account.d.ts +3 -1
- package/dist/core/runner/main-call-account.js +5 -3
- package/dist/core/runner/mcp-redial.d.ts +2 -5
- package/dist/core/runner/mcp-redial.js +2 -2
- package/dist/core/runner/nested-memory-content.d.ts +7 -1
- package/dist/core/runner/nested-memory-content.js +73 -13
- package/dist/core/runner/nested-memory-lane.d.ts +44 -19
- package/dist/core/runner/nested-memory-lane.js +152 -76
- package/dist/core/runner/park-commit.js +3 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
- package/dist/core/runner/permission-rule-lanes.js +29 -3
- package/dist/core/runner/person-path-rows.d.ts +3 -11
- package/dist/core/runner/person-path-rows.js +21 -24
- package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
- package/dist/core/runner/prepare-artifact.d.ts +1 -1
- package/dist/core/runner/prepare-artifact.js +20 -14
- package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
- package/dist/core/runner/prepare-ask-lane.js +6 -5
- package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
- package/dist/core/runner/prepare-boundary-parks.js +27 -24
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -24
- package/dist/core/runner/prepare-config-doors.js +58 -41
- package/dist/core/runner/prepare-context-lane.d.ts +2 -2
- package/dist/core/runner/prepare-context-lane.js +3 -5
- package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
- package/dist/core/runner/prepare-defer-classify.js +1 -1
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +3 -2
- package/dist/core/runner/prepare-file-history.d.ts +62 -26
- package/dist/core/runner/prepare-file-history.js +117 -46
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
- package/dist/core/runner/prepare-gate-stations.js +6 -5
- package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
- package/dist/core/runner/prepare-hands-readface.js +8 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
- package/dist/core/runner/prepare-inherited-gate.js +6 -6
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +1 -1
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
- package/dist/core/runner/prepare-offload-wrappers.js +1 -1
- package/dist/core/runner/prepare-park-ask.d.ts +10 -3
- package/dist/core/runner/prepare-park-ask.js +7 -9
- package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
- package/dist/core/runner/prepare-policy-chain.js +18 -13
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +5 -3
- package/dist/core/runner/prepare-prompt-assembly.js +2 -1
- package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
- package/dist/core/runner/prepare-protocol-tools.js +7 -7
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-run-refs.d.ts +7 -2
- package/dist/core/runner/prepare-run-refs.js +8 -7
- package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
- package/dist/core/runner/prepare-suspend-saga.js +4 -3
- package/dist/core/runner/prepare-task.js +66 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
- package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
- package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
- package/dist/core/runner/prepare-turn-wiring.js +1 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
- package/dist/core/runner/prepare-wiring-manifest.js +14 -6
- package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
- package/dist/core/runner/prepare-workspace-restore.js +15 -6
- package/dist/core/runner/remote-env-retry.d.ts +3 -3
- package/dist/core/runner/restore-seat.d.ts +41 -0
- package/dist/core/runner/restore-seat.js +38 -0
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +4 -3
- package/dist/core/runner/resume-checkpoint-screen.js +2 -1
- package/dist/core/runner/resume-internals-and-config.js +2 -1
- package/dist/core/runner/resume-preflight.js +2 -1
- package/dist/core/runner/rewind-files.js +22 -6
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
- package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
- package/dist/core/runner/run-brain-sinks.d.ts +3 -6
- package/dist/core/runner/run-brain-sinks.js +6 -6
- package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +2 -1
- package/dist/core/runner/run-harness-handlers.js +5 -4
- package/dist/core/runner/run-identity-wiring.js +20 -12
- package/dist/core/runner/run-leg.js +31 -72
- package/dist/core/runner/run-notification-lane.d.ts +3 -0
- package/dist/core/runner/run-notification-lane.js +2 -4
- package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
- package/dist/core/runner/run-reasoning-seat.js +13 -18
- package/dist/core/runner/run-settle-and-teardown.js +13 -9
- package/dist/core/runner/run-terminal-adoption.js +4 -8
- package/dist/core/runner/run-turn-boundary.js +6 -3
- package/dist/core/runner/runtask.d.ts +9 -4
- package/dist/core/runner/runtask.js +29 -22
- package/dist/core/runner/session-rule-policy.d.ts +11 -1
- package/dist/core/runner/shell-env-withheld.js +2 -7
- package/dist/core/runner/side-call-account.d.ts +5 -6
- package/dist/core/runner/side-call-account.js +2 -2
- package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
- package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
- package/dist/core/runner/stream-settle-backstop.js +4 -6
- package/dist/core/runner/stream-steer-verb.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +4 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
- package/dist/core/runner/sub-agent-deny-lists.js +7 -4
- package/dist/core/runner/teardown-bounded.d.ts +7 -0
- package/dist/core/runner/teardown-bounded.js +7 -0
- package/dist/core/runner/terminal-account.js +41 -13
- package/dist/core/runner/terminal-projection.d.ts +1 -5
- package/dist/core/runner/tool-end-body.d.ts +9 -3
- package/dist/core/runner/tool-end-body.js +6 -3
- package/dist/core/runner/tool-output-projection.d.ts +13 -4
- package/dist/core/runner/tool-output-projection.js +10 -14
- package/dist/core/runner/turn-attachments.d.ts +3 -2
- package/dist/core/runner/turn-attachments.js +12 -5
- package/dist/core/runner-deps.d.ts +6 -6
- package/dist/core/runtime-caps.d.ts +2 -1
- package/dist/core/secret-env.d.ts +20 -3
- package/dist/core/secret-env.js +13 -15
- package/dist/core/session-checkout.d.ts +115 -15
- package/dist/core/session-checkout.js +435 -136
- package/dist/core/session-policy-store.js +21 -3
- package/dist/core/session-reconcile.js +1 -0
- package/dist/core/session-store.js +2 -0
- package/dist/core/session.d.ts +11 -1
- package/dist/core/shell-run-candidates.d.ts +1 -0
- package/dist/core/shell-run-candidates.js +1 -1
- package/dist/core/shutdown-debug.d.ts +6 -5
- package/dist/core/shutdown-debug.js +5 -1
- package/dist/core/skill-grant.js +4 -1
- package/dist/core/skills-directory.js +5 -3
- package/dist/core/spec-contract.d.ts +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
- package/dist/core/store-contracts/file-history-store-contract.js +26 -2
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
- package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/task-list-store-contract.js +28 -1
- package/dist/core/task-event.d.ts +48 -27
- package/dist/core/task-notification.d.ts +15 -9
- package/dist/core/task-notification.js +12 -0
- package/dist/core/task-registry-agent.d.ts +24 -22
- package/dist/core/task-registry-agent.js +65 -46
- package/dist/core/task-registry-shared.d.ts +17 -5
- package/dist/core/task-registry.d.ts +17 -6
- package/dist/core/task-registry.js +6 -1
- package/dist/core/task-result.d.ts +71 -25
- package/dist/core/task-spec-members.d.ts +0 -1
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +60 -52
- package/dist/core/task-stream.d.ts +45 -12
- package/dist/core/terminal-cause.d.ts +45 -8
- package/dist/core/terminal-cause.js +5 -0
- package/dist/core/tool-card-bound.d.ts +32 -0
- package/dist/core/tool-card-bound.js +33 -0
- package/dist/core/tool-catalog-entries.d.ts +9 -0
- package/dist/core/tool-catalog-entries.js +48 -0
- package/dist/core/tool-errors.d.ts +4 -3
- package/dist/core/tool-face.d.ts +3 -3
- package/dist/core/tool-mount-facts.d.ts +3 -2
- package/dist/core/tool-mount-facts.js +1 -1
- package/dist/core/tool-mount-static.js +7 -5
- package/dist/core/tool-policy.d.ts +21 -19
- package/dist/core/tool-policy.js +5 -6
- package/dist/core/tool-registry.d.ts +3 -1
- package/dist/core/tool-registry.js +15 -1
- package/dist/core/tool-result-store.d.ts +9 -3
- package/dist/core/tool-result-store.js +14 -1
- package/dist/core/tool-roster.d.ts +18 -0
- package/dist/core/tool-roster.js +30 -1
- package/dist/core/tool-spec.d.ts +17 -8
- package/dist/core/trace.d.ts +35 -31
- package/dist/core/types.d.ts +2 -2
- package/dist/core/untrusted-egress.d.ts +10 -9
- package/dist/core/untrusted-egress.js +9 -9
- package/dist/core/untrusted-text.d.ts +0 -18
- package/dist/core/untrusted-text.js +7 -3
- package/dist/core/user-attachment.d.ts +9 -6
- package/dist/core/user-attachment.js +12 -10
- package/dist/core/user-row-origin.d.ts +44 -25
- package/dist/core/user-row-origin.js +30 -20
- package/dist/core/wiring-manifest.d.ts +26 -7
- package/dist/core/wiring-manifest.js +14 -11
- package/dist/core/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
- package/dist/engine/execution-env/node-execution-env.js +127 -67
- package/dist/engine/harness/agent-harness.d.ts +4 -5
- package/dist/engine/harness/agent-harness.js +2 -7
- package/dist/engine/harness/types.d.ts +51 -19
- package/dist/engine/harness/types.js +28 -1
- package/dist/engine/llm/types.d.ts +26 -14
- package/dist/engine/llm/types.js +2 -2
- package/dist/engine/loop/agent-loop.d.ts +2 -2
- package/dist/engine/loop/agent-loop.js +51 -275
- package/dist/engine/loop/types.d.ts +0 -18
- package/dist/engine/session/import-validate.d.ts +3 -0
- package/dist/engine/session/import-validate.js +34 -2
- package/dist/engine/session/repo-utils.d.ts +42 -4
- package/dist/engine/session/repo-utils.js +33 -5
- package/dist/engine/session/session.d.ts +41 -14
- package/dist/engine/session/session.js +96 -25
- package/dist/index.d.ts +21 -16
- package/dist/index.js +16 -10
- package/dist/orchestration/run-spec.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +12 -9
- package/dist/orchestration/run-workflow-tool.js +15 -19
- package/dist/orchestration/workflow-governance.js +13 -21
- package/dist/orchestration/workflow-observe.d.ts +4 -3
- package/dist/orchestration/workflow-primitives.d.ts +1 -1
- package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
- package/dist/orchestration/workflow-record-artifact.js +32 -0
- package/dist/orchestration/workflow-script-store.d.ts +9 -0
- package/dist/orchestration/workflow-script-store.js +20 -1
- package/dist/orchestration/workflow-types.d.ts +33 -3
- package/dist/orchestration/workflow.d.ts +24 -14
- package/dist/orchestration/workflow.js +52 -23
- package/dist/prompt-assembly/artifact.js +4 -8
- package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
- package/dist/prompt-assembly/catalog/engine.js +30 -0
- package/dist/prompt-assembly/catalog/index.d.ts +1 -1
- package/dist/prompt-assembly/catalog/index.js +2 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
- package/dist/prompt-assembly/epoch.js +6 -8
- package/dist/prompt-assembly/turn-snapshot.js +8 -9
- package/dist/stores/file/background-agent-store.js +5 -6
- package/dist/stores/file/checkpoint-store.d.ts +0 -4
- package/dist/stores/file/checkpoint-store.js +7 -3
- package/dist/stores/file/file-history-store.d.ts +8 -0
- package/dist/stores/file/file-history-store.js +72 -0
- package/dist/stores/file/fs-atomic.js +17 -12
- package/dist/stores/file/index.js +11 -5
- package/dist/stores/file/mailbox-store.js +13 -4
- package/dist/stores/file/permission-rule-store.js +14 -13
- package/dist/stores/file/shared-ledger.d.ts +4 -0
- package/dist/stores/file/shared-ledger.js +4 -0
- package/dist/stores/file/task-list-store.js +12 -3
- package/dist/stores/file/workflow-run-store.js +1 -0
- package/dist/tools/fs/bash-program-position.d.ts +4 -2
- package/dist/tools/fs/bash-program-position.js +1 -1
- package/dist/tools/fs/bash-readonly-classifier.js +1 -1
- package/dist/tools/fs/bound-open.d.ts +97 -0
- package/dist/tools/fs/bound-open.js +103 -0
- package/dist/tools/fs/containment-face.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.d.ts +7 -1
- package/dist/tools/fs/fs-pdf.js +31 -23
- package/dist/tools/fs/fs-read.d.ts +24 -17
- package/dist/tools/fs/fs-read.js +84 -53
- package/dist/tools/fs/fs-shared.d.ts +14 -12
- package/dist/tools/fs/fs-shared.js +5 -4
- package/dist/tools/fs/fs-write.d.ts +2 -2
- package/dist/tools/fs/fs-write.js +20 -12
- package/dist/tools/fs/index.d.ts +4 -4
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/notebook.d.ts +1 -1
- package/dist/tools/fs/pdf.d.ts +12 -3
- package/dist/tools/fs/pdf.js +22 -9
- package/dist/tools/fs/read-deny-home.d.ts +3 -2
- package/dist/tools/fs/read-deny-home.js +8 -11
- package/dist/tools/fs/safety.d.ts +3 -2
- package/dist/tools/fs/shell-read-check.js +10 -9
- package/dist/tools/monitor.d.ts +6 -5
- package/dist/tools/task-list.d.ts +16 -6
- package/dist/tools/task-list.js +4 -0
- package/dist/tools/web.d.ts +9 -1
- package/dist/tools/web.js +8 -3
- package/dist/tools/worktree.d.ts +7 -5
- package/dist/tools/worktree.js +4 -3
- package/package.json +4 -3
- package/test/export-surface.snapshot.json +93 -7
- package/wire-changes/core-stores-sql@7.68.0.json +39 -0
- package/wire-changes/core-stores-sql@7.68.1.json +39 -0
- package/wire-changes/core@7.68.0.json +4257 -0
- package/wire-changes/core@7.68.1.json +95 -0
- package/wire-changes/mods-kernel@7.68.0.json +129 -0
- package/wire-changes/mods-kernel@7.68.1.json +39 -0
- package/wire-changes/primitives@7.68.0.json +253 -0
- package/wire-changes/primitives@7.68.1.json +39 -0
- package/wire-changes/wiki-gate@7.68.0.json +39 -0
- package/wire-changes/wiki-gate@7.68.1.json +39 -0
- package/dist/core/runner/credential-origin-seat.d.ts +0 -2
- package/dist/core/runner/credential-origin-seat.js +0 -20
package/dist/core/tool-face.d.ts
CHANGED
|
@@ -265,8 +265,8 @@ export type ToolLegKind = (typeof TOOL_LEG_KINDS)[number];
|
|
|
265
265
|
export declare const SPAWNER_SURFACE_LEG_KINDS: readonly ToolLegKind[];
|
|
266
266
|
/**
|
|
267
267
|
* One layer of a tool selector, as data: an allowed-tools list (absent = no allowlist on this layer) and a denied-tools list,
|
|
268
|
-
* each a frozen copy of the entries a list was written with. A run's own layer is its `allowTools` and `excludeTools
|
|
269
|
-
* layers above it are the ones the run that spawned it was bounded by, plus that run's own.
|
|
268
|
+
* each a frozen copy of the entries a list was written with. A run's own layer is its `allowTools` and `excludeTools` — its
|
|
269
|
+
* allowlist names nothing under `excludeAllTools`; the layers above it are the ones the run that spawned it was bounded by, plus that run's own.
|
|
270
270
|
*/
|
|
271
271
|
export interface ToolSelectorLayer {
|
|
272
272
|
readonly allow?: readonly string[];
|
|
@@ -313,7 +313,7 @@ export interface ToolCatalogEntry {
|
|
|
313
313
|
/** A `modelGate` class the default-bundle assembler stamps on this definition's default arm. */
|
|
314
314
|
modelGate?: string;
|
|
315
315
|
/** The leg kinds whose legs rely on this tool as part of their protocol: the leg's OWN lists do not decide it (an allowlist need not
|
|
316
|
-
* name it), and a denylist of the leg's own that reaches it is a contradiction the run refuses at prepare. Whether the layers ABOVE
|
|
316
|
+
* name it, the whole-face switch does not take it out), and a denylist of the leg's own that reaches it is a contradiction the run refuses at prepare. Whether the layers ABOVE
|
|
317
317
|
* the leg decide it follows the row's kinds ({@link SPAWNER_SURFACE_LEG_KINDS}): a row some kind of which shares its spawner's tool
|
|
318
318
|
* surface is held exactly when the spawner may hold it; any other row is the leg's own channel, which no layer decides — an inherited
|
|
319
319
|
* deny that reaches it is the same contradiction. */
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* phase's point) are not here: the phase that computes one states it beside the judgment that reads it.
|
|
10
10
|
*/
|
|
11
11
|
import type { ExecutionEnv } from "../internal/harness-types.js";
|
|
12
|
+
import type { ApprovalParkNotResumable } from "./park-resumability.js";
|
|
12
13
|
import type { ToolMountFact } from "./tool-mount-plan.js";
|
|
13
14
|
import type { RunnerDeps, TaskSpec } from "./types.js";
|
|
14
15
|
/** Facts a reader of the mount table states; a fact absent from the record is one it cannot read. */
|
|
@@ -37,8 +38,8 @@ export interface QuestionSeatInputs<F extends boolean | undefined = boolean | un
|
|
|
37
38
|
readonly parkStore: boolean;
|
|
38
39
|
readonly forceDurableGate: F;
|
|
39
40
|
readonly durableApprovalDeclared: boolean;
|
|
40
|
-
/** The leg's one fact `approvalParkNotResumable` (`approvalParkNotResumableOf`; a static reader reads a top-level leg:
|
|
41
|
-
readonly approvalParkNotResumable:
|
|
41
|
+
/** The leg's one fact `approvalParkNotResumable` (`approvalParkNotResumableOf`; a static reader reads a top-level leg: the host's word only). */
|
|
42
|
+
readonly approvalParkNotResumable: ApprovalParkNotResumable | undefined;
|
|
42
43
|
}
|
|
43
44
|
/** `seat.question`: a seat that answers — a live face, or the durable park (a store to wait in AND a declared opt-in). */
|
|
44
45
|
export declare function questionSeatFact(input: QuestionSeatInputs<boolean>): boolean;
|
|
@@ -34,7 +34,7 @@ export function offloadSeatFact(effectiveThreshold) {
|
|
|
34
34
|
export function questionSeatFact(input) {
|
|
35
35
|
if (input.face)
|
|
36
36
|
return true;
|
|
37
|
-
if (!input.parkStore)
|
|
37
|
+
if (!input.parkStore || input.approvalParkNotResumable !== undefined)
|
|
38
38
|
return false;
|
|
39
39
|
if (input.forceDurableGate === undefined)
|
|
40
40
|
return input.durableApprovalDeclared ? true : undefined;
|
|
@@ -90,8 +90,9 @@ function envFacts(deps) {
|
|
|
90
90
|
}
|
|
91
91
|
function seatFacts(deps, spec, leavesOffloadReader) {
|
|
92
92
|
const checkpoint = resolveCheckpointStore(spec, deps) !== undefined;
|
|
93
|
+
const hostNotResumable = spec.durableApproval === false;
|
|
93
94
|
const facts = {
|
|
94
|
-
"seat.checkpoint": checkpoint,
|
|
95
|
+
"seat.checkpoint": checkpoint && !hostNotResumable,
|
|
95
96
|
"seat.offload": offloadSeatFact(offloadThresholdsOf(spec, deps).effective) && leavesOffloadReader,
|
|
96
97
|
"seat.offloadBytes": offloadSeatFact(offloadThresholdsOf(spec, deps).effective) && deps.toolResultStore?.bytesOf !== undefined,
|
|
97
98
|
};
|
|
@@ -99,8 +100,8 @@ function seatFacts(deps, spec, leavesOffloadReader) {
|
|
|
99
100
|
face: (spec.onQuestion ?? deps.onQuestion) !== undefined,
|
|
100
101
|
parkStore: checkpoint,
|
|
101
102
|
forceDurableGate: deps.runtimeCapsResolver === undefined ? false : undefined,
|
|
102
|
-
durableApprovalDeclared: spec.durableApproval !== undefined,
|
|
103
|
-
approvalParkNotResumable:
|
|
103
|
+
durableApprovalDeclared: spec.durableApproval !== undefined && !hostNotResumable,
|
|
104
|
+
approvalParkNotResumable: hostNotResumable ? "host" : undefined,
|
|
104
105
|
});
|
|
105
106
|
if (question !== undefined)
|
|
106
107
|
facts["seat.question"] = question;
|
|
@@ -132,11 +133,12 @@ export function planStaticToolMounts(deps, spec) {
|
|
|
132
133
|
layers: [{ ...(lists.allow !== undefined ? { allow: lists.allow } : {}), deny: lists.exclude ?? [] }],
|
|
133
134
|
where: undefined,
|
|
134
135
|
legs: spec.outputSchema !== undefined ? ["structured"] : [],
|
|
136
|
+
spec,
|
|
135
137
|
});
|
|
136
|
-
const leaves = valveLeaves(
|
|
138
|
+
const leaves = valveLeaves(selector);
|
|
137
139
|
const preflight = spec.mcp !== undefined || spec.a2a !== undefined ? preflightLockedConfig(spec, deps) : undefined;
|
|
138
140
|
const entries = callerEntries(deps, spec, lists);
|
|
139
|
-
const protocol = protocolReading(preflight, valveLeavesPeer(
|
|
141
|
+
const protocol = protocolReading(preflight, valveLeavesPeer(selector));
|
|
140
142
|
const facts = new Map();
|
|
141
143
|
const state = (record) => {
|
|
142
144
|
for (const f of TOOL_MOUNT_FACTS) {
|
|
@@ -9,6 +9,7 @@ import { type DecisionReason } from "./decision-receipt.js";
|
|
|
9
9
|
export { isEngineRefusal } from "./decision-receipt.js";
|
|
10
10
|
import { type RuleBehavior } from "./permission-rule-model.js";
|
|
11
11
|
import { type RemovalGuardSeat } from "../tools/fs/removal-targets.js";
|
|
12
|
+
import type { ApprovalParkNotResumable } from "./park-resumability.js";
|
|
12
13
|
/** A tool call presented to a policy before it executes. */
|
|
13
14
|
/** design/388 B6 — the per-call face (see {@link ToolCallRequest.face}). */
|
|
14
15
|
export interface ToolCallFace {
|
|
@@ -1463,6 +1464,12 @@ export interface AskRequest {
|
|
|
1463
1464
|
* ask's reasons from {@link askReasons} (the askers' own words) and the typed members (the class, the origin, the mandate
|
|
1464
1465
|
* word, {@link probeReason}), never from this line. */
|
|
1465
1466
|
message: string;
|
|
1467
|
+
/** The card's first line for a PERSON — why they are asked, and whether saving an allow rule would stop it being asked again —
|
|
1468
|
+
* in the run's language (canonical where no run called the resolver): a rendering of {@link askClass} alone (`core/ask-headline.ts`),
|
|
1469
|
+
* **for people to read, never a branch input** (branch on the class / origin / mandate words); {@link message} stays the account.
|
|
1470
|
+
* ABSENT ⇔ no {@link askClass}, or the agent's own question (its card is the question): show {@link message}; not "no reason".
|
|
1471
|
+
* Minted at the resolver's chokepoint (a caller's value is replaced); the parked row and the listing carry it under the same name. */
|
|
1472
|
+
readonly headline?: string;
|
|
1466
1473
|
/** Runner-filled source identity (design S1d §1): the end-user {@link AskRequest} issuing task's
|
|
1467
1474
|
* `principal` (design/62). An AGGREGATING `onAsk` (one approver fanning over N delegated workers)
|
|
1468
1475
|
* attributes asks per-user by this. Worker/tool cannot set it (not a tool arg). Undefined ⇒ no principal.
|
|
@@ -1491,7 +1498,8 @@ export interface AskRequest {
|
|
|
1491
1498
|
* belongs to a DELEGATED SUBAGENT (the prepareTask `isSubagent` fact — trusted `internals.parentTaskId`
|
|
1492
1499
|
* presence; a child cannot self-declare or suppress it, internals never ride a TaskSpec). Undefined ⇒ the
|
|
1493
1500
|
* host / a top-level task. THE explicit "from a background agent" discriminator (replaces presence-
|
|
1494
|
-
* or equality-heuristics on {@link sourceSessionId}). `readonly`, sync-path-only, S1d posture.
|
|
1501
|
+
* or equality-heuristics on {@link sourceSessionId}). `readonly`, sync-path-only, S1d posture.
|
|
1502
|
+
* Every row the leg parks records it (`CheckpointState.fromSubagent`); a resumed leg handed no parent task reads it back. */
|
|
1495
1503
|
readonly fromSubagent?: true;
|
|
1496
1504
|
/** design/153 §1 — Runner-filled: the issuing task's display identity (a subagent's explicit agent
|
|
1497
1505
|
* name, else its agent-type; undefined for the host and unnamed children). **UNTRUSTED-for-display**
|
|
@@ -1624,11 +1632,8 @@ export interface AskRequest {
|
|
|
1624
1632
|
* safety tightens read (tool declarations + caller `toolAxes` folds) — never derived from tool
|
|
1625
1633
|
* names, never caller/worker-settable. `irreversible: true` covers both the declared-`"always"`
|
|
1626
1634
|
* and the `"maybe"` (unproven-reversible) tiers. ABSENT — the whole object or either member —
|
|
1627
|
-
* means the engine did not judge that axis: render it as unjudged, never fold absence to `false`. */
|
|
1628
|
-
readonly riskAxes?:
|
|
1629
|
-
readonly irreversible?: boolean;
|
|
1630
|
-
readonly egress?: boolean;
|
|
1631
|
-
};
|
|
1635
|
+
* means the engine did not judge that axis: render it as unjudged, never fold absence to `false`. Twin: `RiskDescriptor.riskAxes`. */
|
|
1636
|
+
readonly riskAxes?: import("./ask-origin.js").CallRiskAxes;
|
|
1632
1637
|
/** Which approval card this ask renders under — the closed set `TOOL_APPROVAL_CARDS`, `generic` when the tool declares
|
|
1633
1638
|
* none; the same word the parked gate and the pending row carry for the same call. Display routing only: the card is
|
|
1634
1639
|
* untrusted-for-display input (a tool may declare any non-reserved card), so a specialised card validates the call's
|
|
@@ -1979,28 +1984,23 @@ export declare function durableMandateSourceOf(args: {
|
|
|
1979
1984
|
* Does this leg carry a durable park opt-in, with NO live-seat narrowing (unlike {@link durableMandateSourceOf}, "is every ask
|
|
1980
1985
|
* MANDATED to gate durably")? Read by the question face and mount, the inherited-mandate float and the sandbox prerequisite. The
|
|
1981
1986
|
* sources: the leg's `durableApproval` (a delegated leg's is the one its parent forwarded), or the `forceDurableGate` entitlement
|
|
1982
|
-
* (synthesized into an opt-in). Where the leg's
|
|
1987
|
+
* (synthesized into an opt-in). Where the leg's decision parks cannot be resumed ({@link approvalParkNotResumableOf}) neither counts. */
|
|
1983
1988
|
export declare function durableParkOptInDeclared(args: {
|
|
1984
1989
|
forceDurableGate: boolean;
|
|
1985
1990
|
durableApprovalDeclared: boolean;
|
|
1986
|
-
approvalParkNotResumable:
|
|
1987
|
-
}): boolean;
|
|
1988
|
-
/** THE leg fact "an approval park of this leg cannot be resumed", derived once per leg (the driver) and read by name: today's one
|
|
1989
|
-
* source is a DELEGATED leg its parent forwarded no opt-in to (a synchronous or fork child; a background child whose lane cannot park). */
|
|
1990
|
-
export declare function approvalParkNotResumableOf(leg: {
|
|
1991
|
-
delegated: boolean;
|
|
1992
|
-
durableApprovalDeclared: boolean;
|
|
1991
|
+
approvalParkNotResumable: ApprovalParkNotResumable | undefined;
|
|
1993
1992
|
}): boolean;
|
|
1994
1993
|
/** The leg's EFFECTIVE opt-in: its own (the caller's word wins — it may carry a tighter scope / ttl), else the one the entitlement
|
|
1995
|
-
* synthesizes where {@link durableParkOptInDeclared} lets it (the leg's scope, no ttl)
|
|
1996
|
-
*
|
|
1994
|
+
* synthesizes where {@link durableParkOptInDeclared} lets it (the leg's scope, no ttl) — on ANY leg whose parks can be resumed, a
|
|
1995
|
+
* delegated one included (a background child on a lane that can park synthesizes its own under a forced principal). ONE derivation
|
|
1996
|
+
* for the leg's park mint and the opt-in it forwards. */
|
|
1997
1997
|
export declare function effectiveDurableApprovalOf(args: {
|
|
1998
1998
|
declared: {
|
|
1999
1999
|
scope: string;
|
|
2000
2000
|
ttlMs?: number;
|
|
2001
2001
|
} | undefined;
|
|
2002
2002
|
forceDurableGate: boolean;
|
|
2003
|
-
approvalParkNotResumable:
|
|
2003
|
+
approvalParkNotResumable: ApprovalParkNotResumable | undefined;
|
|
2004
2004
|
scope: string;
|
|
2005
2005
|
}): {
|
|
2006
2006
|
scope: string;
|
|
@@ -2314,7 +2314,7 @@ export interface ApproverDefect {
|
|
|
2314
2314
|
* another sentence there), the refusal's record carries the literals that sentence quotes. The list's only source is the record
|
|
2315
2315
|
* of the station that composed the question; the request carries none. Not re-exported from `src/index.ts`.
|
|
2316
2316
|
*/
|
|
2317
|
-
export declare function resolveAskFor(
|
|
2317
|
+
export declare function resolveAskFor(asRequested: AskRequest, onAsk: OnAsk | undefined, signal: AbortSignal | undefined, onLateSettlement: ((late: {
|
|
2318
2318
|
kind: "approve";
|
|
2319
2319
|
} | {
|
|
2320
2320
|
kind: "error";
|
|
@@ -2322,4 +2322,6 @@ export declare function resolveAskFor(req: AskRequest, onAsk: OnAsk | undefined,
|
|
|
2322
2322
|
}) => void) | undefined, asked: object | undefined, onApproverDefect?: (defect: ApproverDefect) => void,
|
|
2323
2323
|
/** The station's carrier for a person's written `feedback` ({@link AskOutcome}). A station without one is a seat with no lane for
|
|
2324
2324
|
* words: the answer that brings them is refused, never approved with the words gone. */
|
|
2325
|
-
approvalWords?: ApprovalWordsSeat
|
|
2325
|
+
approvalWords?: ApprovalWordsSeat,
|
|
2326
|
+
/** The run's engine text reading, which the card's {@link AskRequest.headline} is minted in; absent ⇒ the canonical text. */
|
|
2327
|
+
say?: import("../prompt-assembly/engine-text.js").EngineText): Promise<ResolvedAsk>;
|
package/dist/core/tool-policy.js
CHANGED
|
@@ -9,6 +9,7 @@ import { ownReadRootCandidate, readRootGrantSeat } from "./read-root-grant-scree
|
|
|
9
9
|
import { liveWordsOf } from "./approval-words.js";
|
|
10
10
|
import { DECIDED_VIA, decidersNote, isDecidedVia, policyDeciderOf, settledByDecider } from "./gate-outcome.js";
|
|
11
11
|
import { unjudgedAllowRefused } from "./real-approval.js";
|
|
12
|
+
import { withEngineHeadline } from "./ask-headline.js";
|
|
12
13
|
import { receiveMembers } from "./own-property-receipt.js";
|
|
13
14
|
import { isBlankInput } from "./input-author.js";
|
|
14
15
|
export { policyCannotAnswer, rowDemandsAPerson } from "./real-approval.js";
|
|
@@ -978,10 +979,7 @@ export function durableMandateSourceOf(args) {
|
|
|
978
979
|
return undefined;
|
|
979
980
|
}
|
|
980
981
|
export function durableParkOptInDeclared(args) {
|
|
981
|
-
return
|
|
982
|
-
}
|
|
983
|
-
export function approvalParkNotResumableOf(leg) {
|
|
984
|
-
return leg.delegated && !leg.durableApprovalDeclared;
|
|
982
|
+
return args.approvalParkNotResumable === undefined && (args.durableApprovalDeclared || args.forceDurableGate);
|
|
985
983
|
}
|
|
986
984
|
export function effectiveDurableApprovalOf(args) {
|
|
987
985
|
if (!durableParkOptInDeclared({ forceDurableGate: args.forceDurableGate, durableApprovalDeclared: args.declared !== undefined, approvalParkNotResumable: args.approvalParkNotResumable }))
|
|
@@ -1010,7 +1008,7 @@ export function extensionNamed(registration) {
|
|
|
1010
1008
|
}
|
|
1011
1009
|
export function extensionQuestionText(toolName, entry) {
|
|
1012
1010
|
const who = entry.registration !== undefined ? extensionNamed(entry.registration) : "an extension";
|
|
1013
|
-
const why = entry.
|
|
1011
|
+
const why = entry.words !== undefined ? `: ${entry.words}` : "";
|
|
1014
1012
|
return `tool "${toolName}" needs approval (asked by ${who}${why})`;
|
|
1015
1013
|
}
|
|
1016
1014
|
export function foldHookAsk(verdict, hookAsk) {
|
|
@@ -1208,7 +1206,8 @@ export function cardCarriesBidiControls(card) {
|
|
|
1208
1206
|
export async function resolveAsk(req, onAsk, signal, onLateSettlement) {
|
|
1209
1207
|
return resolveAskFor(req, onAsk, signal, onLateSettlement, undefined);
|
|
1210
1208
|
}
|
|
1211
|
-
export async function resolveAskFor(
|
|
1209
|
+
export async function resolveAskFor(asRequested, onAsk, signal, onLateSettlement, asked, onApproverDefect, approvalWords, say) {
|
|
1210
|
+
const req = withEngineHeadline(asRequested, say);
|
|
1212
1211
|
const askedDigest = exactBoundInputHashOf(req.toolName, req.args);
|
|
1213
1212
|
const question = asked !== undefined ? engineSentenceOf(asked, req) : undefined;
|
|
1214
1213
|
const { settlement, bindingRefusal, quotesQuestion, feedback: words, ...r } = await resolveAskArms(req, onAsk, signal, onLateSettlement, approvalWords !== undefined);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* name matches" — the rule that pins the two fail-open shapes a per-name table had (one name, two
|
|
9
9
|
* definitions; the table could only hold one).
|
|
10
10
|
*
|
|
11
|
-
* Layer-0 vocabulary: depends on the leaf catalog
|
|
11
|
+
* Layer-0 vocabulary: depends on the leaf catalog, the face vocabulary and the engine's one name judgment only.
|
|
12
12
|
*/
|
|
13
13
|
import { type ToolCallPathTarget, type ToolCatalogEntry, type ToolFamily, type ToolHostTarget, type ToolPathAccess } from "./tool-face.js";
|
|
14
14
|
/** The whole static catalog, one frozen row per definition (design/388 §2.1 `describeToolCatalog()`).
|
|
@@ -191,6 +191,8 @@ export declare function handBandEffects(): ReadonlyMap<string, NonNullable<ToolC
|
|
|
191
191
|
/** A-3 / L4 — every `details.type` card the engine owns: the catalog's per-definition cards plus the
|
|
192
192
|
* engine-minted ones (protocol channels, fs refusals). */
|
|
193
193
|
export declare function engineCardTypes(): ReadonlySet<string>;
|
|
194
|
+
/** The members a card of kind `type` keeps in its skeleton (`CARD_SKELETONS`); none for a kind with no row — a caller's card. */
|
|
195
|
+
export declare function cardSkeletonMembers(type: string): readonly string[];
|
|
194
196
|
/** The closed set as a Set, for callers that validate a tag read off the wire. */
|
|
195
197
|
export declare const TOOL_MOUNT_TAG_SET: ReadonlySet<string>;
|
|
196
198
|
export { HANDS_BAND_TAGS, MOUNT_TAG_IN_HANDS_BAND } from "./tool-face.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TOOL_MOUNT_TAGS, pathTargetSlotOnly } from "./tool-face.js";
|
|
2
|
-
import { ENGINE_CARDS, TOOL_CATALOG_ENTRIES } from "./tool-catalog-entries.js";
|
|
2
|
+
import { CARD_SKELETONS, ENGINE_CARDS, TOOL_CATALOG_ENTRIES } from "./tool-catalog-entries.js";
|
|
3
|
+
import { strayMembersOf } from "./own-property-receipt.js";
|
|
3
4
|
import { seatOf } from "./tool-name-readings.js";
|
|
4
5
|
export function describeToolCatalog() {
|
|
5
6
|
return TOOL_CATALOG_ENTRIES;
|
|
@@ -167,5 +168,18 @@ export function engineCardTypes() {
|
|
|
167
168
|
out.add(card);
|
|
168
169
|
return out;
|
|
169
170
|
}
|
|
171
|
+
{
|
|
172
|
+
const cards = [...engineCardTypes()];
|
|
173
|
+
const moment = "when the tool catalog loads";
|
|
174
|
+
const rowWithoutCard = strayMembersOf(CARD_SKELETONS, { subject: "CARD_SKELETONS", unit: "card", moment }, cards);
|
|
175
|
+
const cardWithoutRow = strayMembersOf(Object.fromEntries(cards.map((c) => [c, true])), { subject: "the engine card set", unit: "skeleton row", moment }, Object.keys(CARD_SKELETONS));
|
|
176
|
+
for (const [stray, what] of [[rowWithoutCard, "CARD_SKELETONS rows naming no card the engine mints"], [cardWithoutRow, "engine cards with no CARD_SKELETONS row"]]) {
|
|
177
|
+
if (stray !== undefined)
|
|
178
|
+
throw new Error(`tool catalog: ${what}: ${stray.names.map((n) => JSON.stringify(String(n))).join(", ")} — refused ${moment}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export function cardSkeletonMembers(type) {
|
|
182
|
+
return Object.hasOwn(CARD_SKELETONS, type) ? CARD_SKELETONS[type] : [];
|
|
183
|
+
}
|
|
170
184
|
export const TOOL_MOUNT_TAG_SET = new Set(TOOL_MOUNT_TAGS);
|
|
171
185
|
export { HANDS_BAND_TAGS, MOUNT_TAG_IN_HANDS_BAND } from "./tool-face.js";
|
|
@@ -422,6 +422,12 @@ export declare function buildToolResultRef(sessionId: string, toolCallId: string
|
|
|
422
422
|
* owner: who may read the bytes is still {@link ToolResultStore.ownerOf}'s answer. A task id the mint had to fold comes back as
|
|
423
423
|
* its folded segment, which names no task — the reading of a task that is gone. */
|
|
424
424
|
export declare function taskArtifactOriginOf(ref: string): string | undefined;
|
|
425
|
+
/** Whether `ref` has the shape {@link buildTaskArtifactRef} writes — `tr_<session>~fold.task~<task>~<content>`, four segments, each
|
|
426
|
+
* one {@link isRefSegment} accepts — and nothing else: a string with a path separator, a control character, a quote, whitespace,
|
|
427
|
+
* an empty or over-long segment or a different segment count is not a ref the mint ever wrote. Shape only: it says nothing about
|
|
428
|
+
* whether the row is still held or who may read it ({@link ToolResultStore.ownerOf}), and {@link taskArtifactOriginOf} stays the
|
|
429
|
+
* lenient origin reading a read face's boundary legs rest on. */
|
|
430
|
+
export declare function isTaskArtifactRef(ref: string): boolean;
|
|
425
431
|
/**
|
|
426
432
|
* Backlog #119 — the ceiling on a ref this module can mint, so a durable backend can size its key
|
|
427
433
|
* column from a stated invariant instead of a guess (TiDB's was `VARCHAR(191)`, which a long
|
|
@@ -576,7 +582,7 @@ export declare const OFFLOAD_TOOL_NAME = "ReadToolResult";
|
|
|
576
582
|
* transient first failure served the marker forever even though the full text was still in hand.
|
|
577
583
|
* Now the failure arm writes NOTHING (a later persist call retries the real bytes against an empty
|
|
578
584
|
* ref) and announces the failed write loudly instead: through the deployment's structured notice sink
|
|
579
|
-
* when one is wired, else
|
|
585
|
+
* when one is wired, else the process's default seat, else one process line (the loud-bad-value announcement dialect — a silent catch
|
|
580
586
|
* here would be a silent data loss). The announcement claims only what this arm can know: THIS
|
|
581
587
|
* attempt stored nothing — the same (toolCallId, fullText) persist recurs per request (write-once
|
|
582
588
|
* idempotent re-put), so an EARLIER attempt may already have landed the row and a rejected re-put is
|
|
@@ -588,8 +594,8 @@ export declare function createOffloadPersist(store: ToolResultStore, sessionId:
|
|
|
588
594
|
/** Structured sink for the loss announcement, delivered through the shared guarded form
|
|
589
595
|
* (`deliverEngineNotice`, #170): a wired FUNCTION seat REPLACES the console line, swallow-guarded
|
|
590
596
|
* (a throwing/rejecting sink never turns an announcement into a failure); a present NON-function
|
|
591
|
-
* seat falls back to
|
|
592
|
-
*
|
|
597
|
+
* seat falls back to the process line plus the once-per-process seat-defect announcement; absent ⇒
|
|
598
|
+
* the process's default seat, else the process line. */
|
|
593
599
|
onNotice?: (notice: import("./types.js").EngineNotice) => void): (toolCallId: string, fullText: string) => string;
|
|
594
600
|
/**
|
|
595
601
|
* The byte sibling of {@link createOffloadPersist}: keep `bytes` (claimed `mimeType`) a tool result carried for the call
|
|
@@ -73,8 +73,21 @@ export function taskArtifactOriginOf(ref) {
|
|
|
73
73
|
const segments = ref.split(REF_SEGMENT_SEPARATOR);
|
|
74
74
|
return segments[1] === TASK_ARTIFACT_SEGMENT ? segments[2] : undefined;
|
|
75
75
|
}
|
|
76
|
+
const TOOL_RESULT_REF_PREFIX = composeToolResultRef("s", []).slice(0, -1);
|
|
77
|
+
function isRefSegment(text) {
|
|
78
|
+
return text.length <= MAX_REF_SEGMENT_CHARS && NATIVE_REF_CHARSET.test(text);
|
|
79
|
+
}
|
|
80
|
+
export function isTaskArtifactRef(ref) {
|
|
81
|
+
const [session, marker, ...ids] = ref.split(REF_SEGMENT_SEPARATOR);
|
|
82
|
+
return (session !== undefined &&
|
|
83
|
+
session.startsWith(TOOL_RESULT_REF_PREFIX) &&
|
|
84
|
+
isRefSegment(session.slice(TOOL_RESULT_REF_PREFIX.length)) &&
|
|
85
|
+
marker === TASK_ARTIFACT_SEGMENT &&
|
|
86
|
+
ids.length === 2 &&
|
|
87
|
+
ids.every(isRefSegment));
|
|
88
|
+
}
|
|
76
89
|
function refSegment(raw) {
|
|
77
|
-
if (
|
|
90
|
+
if (isRefSegment(raw) && !raw.startsWith(FOLDED_SEGMENT_PREFIX))
|
|
78
91
|
return raw;
|
|
79
92
|
const base = raw.replace(/[^A-Za-z0-9_.-]/g, "-").slice(0, 32);
|
|
80
93
|
return `${FOLDED_SEGMENT_PREFIX}${base || "x"}-${digestOfString(raw)}`;
|
|
@@ -523,6 +523,18 @@ export declare function mintCapabilityId(t: {
|
|
|
523
523
|
contractId: string;
|
|
524
524
|
remote?: string | undefined;
|
|
525
525
|
}): string;
|
|
526
|
+
/** Whether a mount of `source` names a peer (its `origin`): a protocol tool's server or agent, an external tool's. ONE reading — the
|
|
527
|
+
* mount's admission and {@link identityHoldsNoServerName} ask it. */
|
|
528
|
+
export declare function rosterSourceNamesPeer(source: RosterSource): boolean;
|
|
529
|
+
/**
|
|
530
|
+
* Whether a parked approval's tool identity, read off the row's own members, holds no name an MCP server lists a tool under: its
|
|
531
|
+
* `capabilityId` is the identity {@link mintCapabilityId} mints over the row's own `toolName` and `contractId` for a source that names
|
|
532
|
+
* no peer. Only the MCP listing hands a tool a server's name, and every MCP mount names its server as the peer, so such an identity has
|
|
533
|
+
* no `remote` member under any reading — the identity an engine that minted no server name wrote for the tool is the one this engine
|
|
534
|
+
* mints. A row of an MCP tool never answers yes, nor does one whose three members do not recompute (a member changed, a name other than
|
|
535
|
+
* the wire name the identity was minted over). A pure function of the record's own members; total over a record.
|
|
536
|
+
*/
|
|
537
|
+
export declare function identityHoldsNoServerName(pending: object): boolean;
|
|
526
538
|
export declare function rosterDigestOf(entries: readonly ToolRosterEntry[]): string;
|
|
527
539
|
/** The materialized schema's top-level properties, in declaration order. */
|
|
528
540
|
export declare function inputKeysOf(schema: TSchema | undefined): {
|
|
@@ -719,6 +731,12 @@ export declare function boundaryLegsRefusal(toolName: unknown): Error & {
|
|
|
719
731
|
* an entry or a list of another prototype (its prototype chain answers), a Proxy, an accessor (or a non-enumerable member the receipt
|
|
720
732
|
* does not take) as the name, the declaration or a slot of the list. The row mint judges every other source. */
|
|
721
733
|
export declare function assertToolBoundaryLegs(tools: unknown): void;
|
|
734
|
+
/** Whether a caller roster mounts a delegation tool — an entry carrying the `withAgents` rebuild seam — read as the one receipt reads
|
|
735
|
+
* the roster (no getter or trap runs): `false` when there is no roster, or every entry is a plain record the receipt took whole and none
|
|
736
|
+
* carries a function `withAgents`; `true` when one does; `undefined` when an entry could carry it only by running the caller's code (an
|
|
737
|
+
* entry of another prototype — its prototype chain answers —, a Proxy, an accessor or a member the receipt does not take). A resume's
|
|
738
|
+
* screen asks it before the claim; the `undefined` remainder is answered by the leg's own live read, after the claim. */
|
|
739
|
+
export declare function rosterMountsDelegation(tools: unknown): boolean | undefined;
|
|
722
740
|
/** One row (design/388 §2.5). Every axis is read off the instance or the leg facts; nothing off a name table. */
|
|
723
741
|
export declare function mintRosterEntry(tool: AgentTool, meta: RosterMountMeta, facts: RosterSnapshotFacts): ToolRosterEntry;
|
|
724
742
|
/**
|
package/dist/core/tool-roster.js
CHANGED
|
@@ -227,6 +227,17 @@ export function toolDeclarationDigestOf(entry) {
|
|
|
227
227
|
export function mintCapabilityId(t) {
|
|
228
228
|
return sha16(canonicalJsonStringify({ source: t.source, peer: t.peer, name: t.name, contractId: t.contractId, ...(t.remote !== undefined ? { remote: t.remote } : {}) }));
|
|
229
229
|
}
|
|
230
|
+
export function rosterSourceNamesPeer(source) {
|
|
231
|
+
return source === "mcp" || source === "a2a" || source === "external";
|
|
232
|
+
}
|
|
233
|
+
export function identityHoldsNoServerName(pending) {
|
|
234
|
+
const name = Reflect.get(pending, "toolName");
|
|
235
|
+
const contractId = Reflect.get(pending, "contractId");
|
|
236
|
+
const id = Reflect.get(pending, "capabilityId");
|
|
237
|
+
if (typeof name !== "string" || typeof contractId !== "string" || typeof id !== "string")
|
|
238
|
+
return false;
|
|
239
|
+
return ROSTER_SOURCES.some((source) => !rosterSourceNamesPeer(source) && mintCapabilityId({ source, peer: null, name, contractId }) === id);
|
|
240
|
+
}
|
|
230
241
|
export function rosterDigestOf(entries) {
|
|
231
242
|
return sha16(canonicalJsonStringify(entries));
|
|
232
243
|
}
|
|
@@ -432,7 +443,7 @@ export class RosterBuilder {
|
|
|
432
443
|
this.#settleEffects(this.#mountOne(tool, meta, this.#engineLane));
|
|
433
444
|
}
|
|
434
445
|
#admit(tool, meta) {
|
|
435
|
-
if ((meta.source
|
|
446
|
+
if (rosterSourceNamesPeer(meta.source) !== (meta.origin !== undefined)) {
|
|
436
447
|
throw configError("config.tool_roster_origin", `tool ${JSON.stringify(tool.name)}: a ${meta.source} mount ${meta.origin === undefined ? "requires" : "must not carry"} an origin`);
|
|
437
448
|
}
|
|
438
449
|
if (!TOOL_MOUNT_TAGS.includes(meta.mountedBy))
|
|
@@ -601,6 +612,24 @@ export function assertToolBoundaryLegs(tools) {
|
|
|
601
612
|
throw boundaryLegsRefusal(t["name"]);
|
|
602
613
|
});
|
|
603
614
|
}
|
|
615
|
+
export function rosterMountsDelegation(tools) {
|
|
616
|
+
if (tools === undefined)
|
|
617
|
+
return false;
|
|
618
|
+
const got = receive(tools, ROSTER_LEGS_RECEIPT);
|
|
619
|
+
const list = got.ok ? got.value : undefined;
|
|
620
|
+
if (!got.ok || !Array.isArray(list))
|
|
621
|
+
return undefined;
|
|
622
|
+
if ((got.faults ?? []).some((f) => f.path.length <= 1 || f.path[1] === "withAgents"))
|
|
623
|
+
return undefined;
|
|
624
|
+
let mounted = false;
|
|
625
|
+
for (const t of list) {
|
|
626
|
+
if (!isPlainRecord(t))
|
|
627
|
+
return undefined;
|
|
628
|
+
if (typeof t["withAgents"] === "function")
|
|
629
|
+
mounted = true;
|
|
630
|
+
}
|
|
631
|
+
return mounted;
|
|
632
|
+
}
|
|
604
633
|
export function mintRosterEntry(tool, meta, facts) {
|
|
605
634
|
const face = faceOf(tool);
|
|
606
635
|
const fallbackOrigin = meta.source === "builtin" ? "core" : meta.source === "synthetic" ? "synthetic" : meta.source === "mcp" || meta.source === "a2a" ? meta.source : "caller";
|
package/dist/core/tool-spec.d.ts
CHANGED
|
@@ -445,10 +445,9 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
445
445
|
executionMode?: "sequential" | "parallel";
|
|
446
446
|
/**
|
|
447
447
|
* design/120 P1.5 (CC `isConcurrencySafe(parsedInput)` parity): input-level concurrency
|
|
448
|
-
* refinement for a non-`"parallel"` tool — return `true` to let THIS CALL run in a parallel batch
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
* hook receives schema-VALIDATED (coerced) args — `parsed.data` parity; a schema-invalid
|
|
448
|
+
* refinement for a non-`"parallel"` tool — return `true` to let THIS CALL run in a parallel batch.
|
|
449
|
+
* An explicit `executionMode:"parallel"` needs no refinement (always safe); a throw = false
|
|
450
|
+
* (fail-closed). The hook receives schema-VALIDATED (coerced) args — `parsed.data` parity; a schema-invalid
|
|
452
451
|
* call is judged unsafe before the hook runs. Still treat defensively (direct callers may pass raw).
|
|
453
452
|
* The one real consumer is Bash's read-only classifier.
|
|
454
453
|
*/
|
|
@@ -1054,6 +1053,9 @@ export interface ToolExecuteContext {
|
|
|
1054
1053
|
* carrier, and independent of {@link readFace}.
|
|
1055
1054
|
*/
|
|
1056
1055
|
writeFace?: "roots";
|
|
1056
|
+
/** The host's word that this run's decision parks cannot be resumed ({@link TaskSpec.durableApproval} `false`), a tighten-only clamp
|
|
1057
|
+
* carrier: present (as `false`) ONLY when the run was declared so, and handed to every child spec a delegation tool builds. */
|
|
1058
|
+
durableApproval?: false;
|
|
1057
1059
|
/**
|
|
1058
1060
|
* design/199 件B — the parent task's OWN deny-set additions ({@link TaskSpec.readDenyPatterns}),
|
|
1059
1061
|
* traveling the delegation tree add-only (a child judges at least every entry its parent judged).
|
|
@@ -1107,12 +1109,18 @@ export interface ToolExecuteContext {
|
|
|
1107
1109
|
/**
|
|
1108
1110
|
* The MCP surface THIS run mounts (Runner-filled, read-only, answered at call time off the live roster): per declared server,
|
|
1109
1111
|
* the tools of it mounted right now, and the aggregate tools no server owns. A delegation tool reads it AT SPAWN TIME for the
|
|
1110
|
-
* protocol half of the one universe a child's lists govern, and declares the child the servers the lists leave
|
|
1111
|
-
* connects for itself (it outlives the spawning leg when it runs in the background or is kept for a later turn). Absent when
|
|
1112
|
+
* protocol half of the one universe a child's lists govern, and declares the child the servers the lists leave. Absent when
|
|
1112
1113
|
* the tool runs outside a Runner task, and for a run that declared no server.
|
|
1113
1114
|
*/
|
|
1114
1115
|
mountedMcp?: () => import("./mounted-mcp.js").MountedMcp;
|
|
1115
|
-
/**
|
|
1116
|
+
/**
|
|
1117
|
+
* The run tree's MCP connection pool (Runner-filled, read-only): a delegation tool and a workflow hand it to every leg they spawn, so
|
|
1118
|
+
* the child leases its connections from it and reads what it remembers of a failed attempt (mcp-connection-pool.ts) — a child that
|
|
1119
|
+
* outlives the spawning leg (background, kept) keeps leasing from it. Inside a Runner it is the session's pool and is present whether
|
|
1120
|
+
* or not the run declared a server; absent outside a Runner task.
|
|
1121
|
+
*/
|
|
1122
|
+
mcpPool?: import("./mcp-connection-pool.js").McpConnectionPool;
|
|
1123
|
+
/** The run's compiled tool selector (its `allowTools` / `excludeTools` — the allowlist naming nothing under `excludeAllTools` — under the ceiling it was spawned with): `admits` answers
|
|
1116
1124
|
* "may this run use this tool", and `layers` is the ceiling every child this run spawns inherits, so a scenario-wide roster cannot
|
|
1117
1125
|
* be escaped by delegating to a child that remounts a tool this run may not use (Runner-filled, read-only, never a model argument). */
|
|
1118
1126
|
toolSelector?: import("./tool-face.js").ToolSelector;
|
|
@@ -1486,7 +1494,8 @@ export interface ToolExecuteContext {
|
|
|
1486
1494
|
* (`status:"needs_review"`) so a human approves/edits/rejects before the run continues. The tool still returns
|
|
1487
1495
|
* its `content` normally first (the plan/diff lives there → reaches the reviewer via the transcript). HONORED
|
|
1488
1496
|
* only when the deployment can actually pause (a `checkpointStore` is wired); otherwise the request is a silent
|
|
1489
|
-
* no-op (read-only/headless degrade)
|
|
1497
|
+
* no-op (read-only/headless degrade) — except on a leg whose parks nobody resumes, where the call THROWS the refusal
|
|
1498
|
+
* ("This plan was not presented to anyone…" + the way out), so the asking call's result never reads as presented. The first-party `present_plan` tool (CC `ExitPlanMode` parity) is a thin
|
|
1490
1499
|
* caller of this; any tool may use it to gate a high-blast step on human review. Idempotent within a batch (the
|
|
1491
1500
|
* first request wins; the suspend fires once at the boundary). The Runner fills it; not a tool arg. The Runner
|
|
1492
1501
|
* binds the id of the calling tool call to the request (a tool cannot name another call): the parked `plan_review`
|
package/dist/core/trace.d.ts
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import type { BrainRetryErrClass, TaskStatus, ToolEffect } from "./types.js";
|
|
20
20
|
import type { ThinkingLevel } from "../internal/harness-types.js";
|
|
21
|
+
import type { ReasoningEffective } from "../brain/reasoning.js";
|
|
21
22
|
import type { ToolManifestRow } from "../prompt-assembly/tool-catalog.js";
|
|
22
23
|
import type { PromptEpochActivation, PromptIdentityLayers } from "../prompt-assembly/epoch.js";
|
|
23
24
|
import type { ChainLink, SupersededOverlay } from "../prompt-assembly/overlay.js";
|
|
@@ -191,27 +192,23 @@ export type TraceEvent = {
|
|
|
191
192
|
ts: number;
|
|
192
193
|
} | {
|
|
193
194
|
/**
|
|
194
|
-
* How a task's requested reasoning intensity RESOLVED
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* clamped it down (`clamped:true`), or that
|
|
198
|
-
* (`dropped:true` — the frame fires for that model too; it used to be the one arm with no report).
|
|
195
|
+
* How a task's requested reasoning intensity RESOLVED on the leg's request (design/96 S6): what the request's
|
|
196
|
+
* thinking keys say (`effective`), and its three projections. Emitted at task start for every leg with a tier —
|
|
197
|
+
* `off` included — so a deployment can SEE that a switch-only dialect took the tier as `on`, that an effort
|
|
198
|
+
* endpoint clamped it down (`clamped:true`), or that nothing reached the wire (`dropped:true`).
|
|
199
199
|
* Metadata-only (tiers + format + endpoint, never prompt content). The resolution is against the
|
|
200
200
|
* task's PRIMARY serving model at leg entry (same law as `TaskResult.model`): a mid-run
|
|
201
201
|
* degradation does not re-emit this frame — the switch is observed on its own seats
|
|
202
202
|
* (`TaskResult.degraded`).
|
|
203
203
|
*
|
|
204
|
-
* A SECOND frame follows, for the same taskId, in exactly one case: the leg's
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* always reading the truth, and one that kept only the first now under-reports a drop it could not
|
|
213
|
-
* have seen before. The result-face twin `TaskResult.effectiveReasoning` moves with it — the two
|
|
214
|
-
* faces are one mint at every instant.
|
|
204
|
+
* A SECOND frame follows, for the same taskId, in exactly one case: the leg's first request whose terminal
|
|
205
|
+
* message reaches the leg carried an answer that differs from the task-start frame (a budget knob or a hard
|
|
206
|
+
* output cap only the brain held: a fixed budget says `on`, a cap too small for a legal budget says
|
|
207
|
+
* `provider_default`). It follows that message's `message_end`, is deduped (a first request that changes nothing
|
|
208
|
+
* emits nothing) and capped at one. Requests a mod, a tool or an internal lane makes never reach the leg's
|
|
209
|
+
* messages, so they cannot rewrite the leg's posture. A consumer that keeps only the LATEST frame per taskId
|
|
210
|
+
* reads the truth. The result-face twin `TaskResult.effectiveReasoning` moves with it — the two faces are one
|
|
211
|
+
* mint at every instant.
|
|
215
212
|
*/
|
|
216
213
|
kind: "reasoning.resolved";
|
|
217
214
|
version: 1;
|
|
@@ -220,24 +217,21 @@ export type TraceEvent = {
|
|
|
220
217
|
model: string;
|
|
221
218
|
/** The intensity the task asked for. */
|
|
222
219
|
requested: ThinkingLevel;
|
|
223
|
-
/**
|
|
224
|
-
|
|
225
|
-
|
|
220
|
+
/** What the request's thinking keys say: a tier, `"on"` (thinking on, no tier named), or `"provider_default"` on the
|
|
221
|
+
* `dropped` arm, where the request carried no thinking key (the provider's own default governs). */
|
|
222
|
+
effective: ReasoningEffective;
|
|
223
|
+
/** {@link import("../brain/reasoning.js").ResolvedReasoning.graded}, the same value. */
|
|
226
224
|
graded: boolean;
|
|
227
|
-
/** True
|
|
225
|
+
/** True exactly when `effective` differs from `requested`. */
|
|
228
226
|
clamped: boolean;
|
|
229
227
|
/** The wire format the request uses (`openai`/`deepseek`/`qwen`/`budget`/…) — the reason for graded/clamped. */
|
|
230
228
|
format: string;
|
|
231
229
|
/** Coarse endpoint label (`model.api`, e.g. `openai-completions` / `anthropic-messages`). */
|
|
232
230
|
endpoint: string;
|
|
233
231
|
/**
|
|
234
|
-
* Present (true)
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* on the binary enable-only formats (qwen/zai/qwen-chat-template) parameter absence is
|
|
238
|
-
* provider-default and a default-on gateway may still reason at its own tier — read `format` to
|
|
239
|
-
* know which family applies. `format`/`endpoint` report the family that WOULD have carried the
|
|
240
|
-
* tier. Absent on every reasoning-capable resolution (old consumers see identical frames).
|
|
232
|
+
* Present (true) exactly when `effective` is `"provider_default"`: the request carried no thinking key at all (a model
|
|
233
|
+
* that holds no reasoning, an `off` the wire cannot spell, a withheld effort carrier, a cap-wins skip), so a default-on
|
|
234
|
+
* gateway may still reason at its own tier — read `format` to know which family applies. Absent otherwise.
|
|
241
235
|
*/
|
|
242
236
|
dropped?: true;
|
|
243
237
|
/** design/148 S3 (additive, §10.2): the eight-element cache identity — digests only. */
|
|
@@ -369,7 +363,8 @@ export type TraceEvent = {
|
|
|
369
363
|
/** Prompt tokens this call wrote to the provider's prefix cache; ABSENT when the call did not report it (the
|
|
370
364
|
* OpenAI-shaped wires never do). */
|
|
371
365
|
cacheWrite?: number;
|
|
372
|
-
/** Wall time from the
|
|
366
|
+
/** Wall time from the call's FIRST DELTA to its final message (0 for a call that streamed nothing). The call's wall time from its
|
|
367
|
+
* delivery to the brain is `ts − callStartedAt`. */
|
|
373
368
|
latencyMs: number;
|
|
374
369
|
/** Time to the first content delta (excludes thinking) — maps to OTel time_to_first_chunk (×1000). */
|
|
375
370
|
firstTokenMs?: number;
|
|
@@ -378,7 +373,8 @@ export type TraceEvent = {
|
|
|
378
373
|
* which anchors on the FIRST DELTA and reads 0 for a zero-delta call). Distinguishes an
|
|
379
374
|
* in-flight call cut before its first delta (present, latencyMs 0, stopReason "aborted")
|
|
380
375
|
* from a call that was never issued (absent). Compaction-summarizer rows never carry it (they
|
|
381
|
-
* circumvent the loop's per-call closures).
|
|
376
|
+
* circumvent the loop's per-call closures). `ts − callStartedAt` is this call's API wall time — the row's share of
|
|
377
|
+
* `turn_end.usage.apiDurationMs` / `TaskResult.stats.apiDurationMs` (a row without the stamp shares 0). */
|
|
382
378
|
callStartedAt?: number;
|
|
383
379
|
/** ABSENT when THIS call's serving model was unpriced (RB-368 — no fabricated 0). */
|
|
384
380
|
costMicroUsd?: number;
|
|
@@ -593,11 +589,19 @@ export type TraceEvent = {
|
|
|
593
589
|
version: 1;
|
|
594
590
|
taskId: string;
|
|
595
591
|
runId: string;
|
|
596
|
-
/** Where the frame is filed. A top-level leg: its own session,
|
|
597
|
-
*
|
|
592
|
+
/** Where the frame is filed. A top-level leg: its own session, and neither `occupant` nor `occupantUnknown`. A delegated leg
|
|
593
|
+
* whose route names its tree's root: that root session and the occupant it held when the tree was born — or, when the tree
|
|
594
|
+
* does not know that occupant (no token: the root's row has none or the root leg's read of it failed, or the root facts the
|
|
595
|
+
* leg was handed — a host's internals, a revived row — carried none), `occupantUnknown: true` in its place; never both.
|
|
596
|
+
* `occupantUnknown` is that root address with no token, judged as the engine judges the same address for the leg's notices
|
|
597
|
+
* and frames — `sameOccupant(undefined, current)`: the same generation only as a current row with no token, since a row
|
|
598
|
+
* deleted and created again always has one (another generation). The word is the one `delegation.delivery_discarded`
|
|
599
|
+
* carries as `detail.addressed: "unknown"` for an address with no token. A delegated leg whose route names no root (its host
|
|
600
|
+
* handed none) files under its own session, like a top-level leg. */
|
|
598
601
|
root: {
|
|
599
602
|
sessionId: string;
|
|
600
603
|
occupant?: string;
|
|
604
|
+
occupantUnknown?: true;
|
|
601
605
|
};
|
|
602
606
|
phase: "prepare" | "resume" | "observed";
|
|
603
607
|
/** The tree's taint bits after the event. */
|