@sema-agent/core 7.55.0 → 7.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1054 -0
- package/LICENSE +1 -1
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +7 -7
- package/dist/agents/org-delivery-gate.js +3 -4
- package/dist/agents/peer-directory.d.ts +22 -4
- package/dist/agents/peer-directory.js +24 -2
- package/dist/agents/peer-held-queue.d.ts +69 -49
- package/dist/agents/peer-held-queue.js +255 -106
- package/dist/agents/peer-session-drain.js +65 -45
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/send-message-tool.js +7 -6
- package/dist/agents/subagent.d.ts +6 -4
- package/dist/agents/subagent.js +72 -68
- package/dist/agents/tool-filter.d.ts +7 -5
- package/dist/agents/tool-filter.js +12 -9
- package/dist/agents/verify.d.ts +3 -2
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +45 -80
- package/dist/brain/media-degrade.d.ts +18 -7
- package/dist/brain/media-degrade.js +13 -2
- package/dist/brain/model-capability.d.ts +37 -0
- package/dist/brain/model-capability.js +34 -0
- package/dist/brain/model-presets.d.ts +2 -8
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +23 -34
- package/dist/brain/openai.js +25 -96
- package/dist/brain/provider-dialect.d.ts +3 -2
- package/dist/brain/provider-dialect.js +2 -2
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +11 -11
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +13 -4
- package/dist/brain/request-params.js +21 -5
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.d.ts +9 -0
- package/dist/brain/stream-engine.js +24 -10
- package/dist/brain/stream-shared.d.ts +5 -4
- package/dist/brain/stream-shared.js +4 -4
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/agent-definition.d.ts +10 -0
- package/dist/core/allow-entry.d.ts +23 -23
- package/dist/core/allow-entry.js +42 -46
- package/dist/core/allow-rule-shadow.d.ts +3 -3
- package/dist/core/approval-object.d.ts +21 -5
- package/dist/core/approval-object.js +44 -17
- package/dist/core/ask-origin.d.ts +66 -20
- package/dist/core/ask-origin.js +63 -23
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +3 -4
- package/dist/core/ask-unresolvable-notice.d.ts +8 -3
- package/dist/core/ask-unresolvable-notice.js +16 -2
- package/dist/core/auto-compaction.d.ts +71 -6
- package/dist/core/auto-compaction.js +42 -26
- package/dist/core/background-agent-store.d.ts +6 -2
- package/dist/core/background-agent-store.js +1 -1
- package/dist/core/checkpoint-generation.d.ts +53 -0
- package/dist/core/checkpoint-generation.js +35 -0
- package/dist/core/checkpoint-queries.d.ts +180 -0
- package/dist/core/checkpoint-queries.js +272 -0
- package/dist/core/checkpoint-requirements.d.ts +19 -1
- package/dist/core/checkpoint-requirements.js +6 -0
- package/dist/core/checkpoint-store.d.ts +105 -53
- package/dist/core/checkpoint-store.js +43 -20
- package/dist/core/cross-boundary-taint.d.ts +6 -5
- package/dist/core/cross-boundary-taint.js +5 -5
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +17 -17
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- package/dist/core/engine-attestation.d.ts +93 -0
- package/dist/core/engine-attestation.js +70 -0
- package/dist/core/engine-capabilities.d.ts +4 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +32 -12
- package/dist/core/engine-notice.js +6 -0
- package/dist/core/file-history-store.d.ts +104 -22
- package/dist/core/file-history-store.js +37 -19
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +22 -10
- package/dist/core/gate-lanes.js +73 -65
- package/dist/core/gate-outcome.d.ts +26 -5
- package/dist/core/gate-outcome.js +26 -0
- package/dist/core/governance-codes.d.ts +5 -1
- package/dist/core/governance-codes.js +6 -0
- package/dist/core/hooks.d.ts +19 -18
- package/dist/core/hooks.js +3 -1
- package/dist/core/host-floor.d.ts +128 -0
- package/dist/core/host-floor.js +206 -0
- package/dist/core/host-target.d.ts +38 -3
- package/dist/core/host-target.js +38 -5
- package/dist/core/mailbox-store.d.ts +62 -1
- package/dist/core/mailbox-store.js +59 -0
- package/dist/core/mcp-name-judge.d.ts +46 -0
- package/dist/core/mcp-name-judge.js +61 -0
- package/dist/core/mcp-probe.d.ts +1 -1
- package/dist/core/mcp-probe.js +2 -5
- package/dist/core/mcp.d.ts +5 -1
- package/dist/core/mcp.js +70 -64
- package/dist/core/memory-engine/consolidation-driver.js +4 -3
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/distiller.js +26 -17
- package/dist/core/memory-engine/engine.js +4 -4
- package/dist/core/memory-engine/layout.d.ts +60 -8
- package/dist/core/memory-engine/layout.js +70 -8
- package/dist/core/model-seat.d.ts +10 -3
- package/dist/core/mods/classic-events.d.ts +67 -0
- package/dist/core/mods/classic-events.js +1 -0
- package/dist/core/mods/dollar.d.ts +13 -0
- package/dist/core/mods/extension-call.d.ts +31 -0
- package/dist/core/mods/extension-call.js +43 -0
- package/dist/core/mods/kernel/dispatch.d.ts +20 -3
- package/dist/core/mods/kernel/dispatch.js +140 -69
- package/dist/core/mods/kernel/events.d.ts +47 -11
- package/dist/core/mods/kernel/events.js +66 -42
- package/dist/core/mods/kernel/index.d.ts +4 -4
- package/dist/core/mods/kernel/index.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +39 -5
- package/dist/core/mods/kernel/receive.js +290 -17
- package/dist/core/mods/kernel/registration.d.ts +33 -2
- package/dist/core/mods/kernel/registration.js +6 -7
- package/dist/core/mods/kernel/site-rules.d.ts +44 -16
- package/dist/core/mods/kernel/site-rules.js +24 -42
- package/dist/core/mods/spec-seats.d.ts +69 -0
- package/dist/core/mods/spec-seats.js +114 -0
- package/dist/core/mods/stations.d.ts +28 -8
- package/dist/core/mods/stations.js +29 -13
- package/dist/core/mods/tool-call.d.ts +79 -0
- package/dist/core/mods/tool-call.js +152 -0
- package/dist/core/namespaced-rule-name.d.ts +32 -38
- package/dist/core/namespaced-rule-name.js +29 -36
- package/dist/core/parent-spec-seat.d.ts +6 -1
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-selfcheck.js +3 -0
- package/dist/core/permission-rule-consent.d.ts +24 -3
- package/dist/core/permission-rule-consent.js +136 -41
- package/dist/core/permission-rule-model.d.ts +57 -5
- package/dist/core/permission-rule-model.js +90 -31
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +8 -4
- package/dist/core/permission-rule-provider.d.ts +5 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +3 -2
- package/dist/core/permission-rule-store.js +11 -2
- package/dist/core/permission-rule-sync.js +3 -2
- package/dist/core/permission-rule-syntax.d.ts +5 -4
- package/dist/core/permission-rule-syntax.js +2 -2
- package/dist/core/permission-rules.d.ts +4 -4
- package/dist/core/permission-rules.js +11 -20
- package/dist/core/persisted-rule-arms.d.ts +2 -2
- package/dist/core/persisted-rule-arms.js +10 -12
- package/dist/core/principal-name.d.ts +20 -0
- package/dist/core/principal-name.js +22 -0
- package/dist/core/prompt-section-seat.js +4 -6
- package/dist/core/protocol-http-auth.d.ts +40 -5
- package/dist/core/protocol-http-auth.js +168 -4
- package/dist/core/protocol-naming.d.ts +20 -0
- package/dist/core/protocol-naming.js +20 -3
- package/dist/core/read-only-shell.d.ts +20 -5
- package/dist/core/read-only-shell.js +29 -14
- package/dist/core/remote-env.d.ts +37 -1
- package/dist/core/remote-env.js +11 -0
- package/dist/core/resume-startup-cause.d.ts +24 -2
- package/dist/core/resume-startup-cause.js +20 -1
- package/dist/core/retired-keys.d.ts +16 -0
- package/dist/core/retired-keys.js +16 -4
- package/dist/core/rewrite-rejudge.d.ts +60 -0
- package/dist/core/rewrite-rejudge.js +36 -0
- package/dist/core/roles.d.ts +28 -1
- package/dist/core/roles.js +81 -26
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-owner.d.ts +3 -3
- package/dist/core/rule-owner.js +3 -2
- package/dist/core/runner/announce-once-ledger.d.ts +14 -0
- package/dist/core/runner/announce-once-ledger.js +5 -0
- package/dist/core/runner/assemble-result.d.ts +1 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/caller-roster.d.ts +16 -4
- package/dist/core/runner/caller-roster.js +33 -6
- package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
- package/dist/core/runner/capability-withheld-seat.js +24 -0
- package/dist/core/runner/classifier-ladder.d.ts +7 -9
- package/dist/core/runner/classifier-ladder.js +3 -3
- package/dist/core/runner/compact-session.d.ts +10 -0
- package/dist/core/runner/compact-session.js +202 -0
- package/dist/core/runner/compaction-call-options.d.ts +2 -2
- package/dist/core/runner/compaction-seams.d.ts +21 -1
- package/dist/core/runner/compaction-seams.js +11 -8
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +50 -40
- package/dist/core/runner/cross-boundary-lane.d.ts +17 -13
- package/dist/core/runner/cross-boundary-lane.js +40 -27
- package/dist/core/runner/denial-limit-arms.d.ts +2 -2
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +13 -0
- package/dist/core/runner/derived-route-fallback.js +6 -0
- package/dist/core/runner/env-capability-census.d.ts +3 -2
- package/dist/core/runner/env-capability-census.js +9 -3
- package/dist/core/runner/file-history-request.d.ts +18 -0
- package/dist/core/runner/file-history-request.js +21 -13
- package/dist/core/runner/file-history-restore.d.ts +45 -0
- package/dist/core/runner/file-history-restore.js +46 -0
- package/dist/core/runner/gate-exit.d.ts +3 -3
- package/dist/core/runner/gate-exit.js +4 -3
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/permission-rule-lanes.d.ts +11 -11
- package/dist/core/runner/permission-rule-lanes.js +39 -17
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +18 -7
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -0
- package/dist/core/runner/prepare-acquire-reconcile.js +2 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
- package/dist/core/runner/prepare-ask-lane.js +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +35 -38
- package/dist/core/runner/prepare-config-doors.js +46 -28
- package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
- package/dist/core/runner/prepare-defer-classify.js +7 -8
- package/dist/core/runner/prepare-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +7 -39
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -1
- package/dist/core/runner/prepare-gate-stations.js +10 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -9
- package/dist/core/runner/prepare-hands-readface.js +17 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +5 -3
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.d.ts +2 -0
- package/dist/core/runner/prepare-park-ask.js +7 -7
- package/dist/core/runner/prepare-policy-chain.d.ts +6 -3
- package/dist/core/runner/prepare-policy-chain.js +67 -76
- package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
- package/dist/core/runner/prepare-prompt-assembly.js +10 -8
- package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
- package/dist/core/runner/prepare-prompt-inputs.js +3 -5
- package/dist/core/runner/prepare-protocol-tools.d.ts +2 -0
- package/dist/core/runner/prepare-protocol-tools.js +3 -3
- package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
- package/dist/core/runner/prepare-safety-scan.js +0 -17
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +5 -6
- package/dist/core/runner/prepare-task.d.ts +5 -2
- package/dist/core/runner/prepare-task.js +48 -43
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +20 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +33 -23
- package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
- package/dist/core/runner/prepare-turn-wiring.js +2 -7
- package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -2
- package/dist/core/runner/prepare-wiring-manifest.js +3 -3
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -12
- package/dist/core/runner/resume-checkpoint-screen.js +3 -0
- package/dist/core/runner/resume-claim.d.ts +4 -2
- package/dist/core/runner/resume-claim.js +15 -8
- package/dist/core/runner/retired-runner-deps.js +1 -0
- package/dist/core/runner/rewind-files.d.ts +12 -0
- package/dist/core/runner/rewind-files.js +90 -0
- package/dist/core/runner/run-attachment-seats.js +2 -1
- package/dist/core/runner/run-brain-sinks.d.ts +4 -1
- package/dist/core/runner/run-brain-sinks.js +4 -2
- package/dist/core/runner/run-harness-handlers.js +12 -4
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +40 -39
- package/dist/core/runner/run-notification-lane.d.ts +2 -0
- package/dist/core/runner/run-notification-lane.js +2 -2
- package/dist/core/runner/run-recovery-lanes.js +3 -4
- package/dist/core/runner/run-settle-and-teardown.js +7 -12
- package/dist/core/runner/run-terminal-adoption.js +3 -4
- package/dist/core/runner/run-turn-boundary.js +4 -15
- package/dist/core/runner/runtask.d.ts +10 -0
- package/dist/core/runner/runtask.js +35 -42
- package/dist/core/runner/send-message-continuation.js +1 -1
- package/dist/core/runner/session-read-file-states.d.ts +15 -0
- package/dist/core/runner/session-read-file-states.js +28 -0
- package/dist/core/runner/session-rule-policy.js +4 -3
- package/dist/core/runner/session-verb-doors.d.ts +28 -0
- package/dist/core/runner/session-verb-doors.js +48 -0
- package/dist/core/runner/session-write-ledger.d.ts +30 -0
- package/dist/core/runner/session-write-ledger.js +101 -0
- package/dist/core/runner/shell-env-withheld.d.ts +33 -0
- package/dist/core/runner/shell-env-withheld.js +51 -0
- package/dist/core/runner/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +12 -15
- package/dist/core/runner/sub-agent-deny-lists.d.ts +25 -3
- package/dist/core/runner/sub-agent-deny-lists.js +25 -17
- package/dist/core/runner/synthetic-tools.d.ts +6 -0
- package/dist/core/runner/synthetic-tools.js +4 -1
- package/dist/core/runner/teardown-bounded.d.ts +1 -0
- package/dist/core/runner/teardown-bounded.js +1 -0
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +1 -3
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-end-body.js +10 -9
- package/dist/core/runner/tool-not-executed.d.ts +5 -0
- package/dist/core/runner/tool-not-executed.js +11 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -0
- package/dist/core/runner/tool-occurrence.js +7 -0
- package/dist/core/runner/turn-attachments.d.ts +33 -15
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +7 -7
- package/dist/core/safety-axis-vocab.d.ts +6 -4
- package/dist/core/safety-axis-vocab.js +6 -5
- package/dist/core/safety-merge-corpus.js +11 -3
- package/dist/core/secret-env.d.ts +30 -3
- package/dist/core/secret-env.js +47 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/session-policy-store.d.ts +32 -15
- package/dist/core/session-policy-store.js +156 -36
- package/dist/core/session-store.d.ts +29 -10
- package/dist/core/session-store.js +51 -19
- package/dist/core/session.d.ts +82 -16
- package/dist/core/session.js +53 -0
- package/dist/core/shell-read-silence.d.ts +11 -12
- package/dist/core/shell-read-silence.js +9 -5
- package/dist/core/shell-run-candidates.js +3 -1
- package/dist/core/shell-wrapper-projection.d.ts +1 -1
- package/dist/core/shell-wrapper-projection.js +1 -1
- package/dist/core/shell-wrapper-table.d.ts +14 -7
- package/dist/core/shell-wrapper-table.js +5 -4
- package/dist/core/side-query.js +10 -1
- package/dist/core/skill-grant.d.ts +7 -2
- package/dist/core/skill-grant.js +5 -0
- package/dist/core/skills-directory.js +6 -2
- package/dist/core/store-contracts/background-agent-store-contract.js +1 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +141 -2
- package/dist/core/store-contracts/file-history-store-contract.js +40 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +49 -1
- package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
- package/dist/core/store-contracts/peer-directory-contract.js +14 -2
- package/dist/core/store-contracts/session-repo-contract.js +51 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/session-store-contract.js +150 -14
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +32 -4
- package/dist/core/task-notification.d.ts +16 -12
- package/dist/core/task-registry-agent.d.ts +8 -4
- package/dist/core/task-registry-agent.js +14 -8
- package/dist/core/task-registry-shared.d.ts +35 -6
- package/dist/core/task-registry-shared.js +11 -0
- package/dist/core/task-registry.d.ts +10 -1
- package/dist/core/task-registry.js +12 -2
- package/dist/core/task-result.d.ts +18 -0
- package/dist/core/task-spec.d.ts +18 -13
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +23 -0
- package/dist/core/tool-catalog-entries.js +14 -2
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-model-gate.d.ts +2 -2
- package/dist/core/tool-name-aliases.d.ts +48 -18
- package/dist/core/tool-name-aliases.js +36 -19
- package/dist/core/tool-name-readings.d.ts +6 -32
- package/dist/core/tool-name-readings.js +2 -9
- package/dist/core/tool-policy.d.ts +78 -204
- package/dist/core/tool-policy.js +152 -204
- package/dist/core/tool-result-store.js +3 -0
- package/dist/core/tool-roster.d.ts +14 -19
- package/dist/core/tool-roster.js +11 -44
- package/dist/core/tool-spec-members.js +7 -2
- package/dist/core/tool-spec.d.ts +19 -11
- package/dist/core/tools.js +49 -9
- package/dist/core/trace.d.ts +6 -3
- package/dist/core/trace.js +2 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +20 -0
- package/dist/core/untrusted-egress.js +77 -3
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/wiring-manifest.d.ts +9 -0
- package/dist/core/wiring-manifest.js +1 -0
- package/dist/core/workflow-journal-store.js +1 -1
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +7 -3
- package/dist/engine/execution-env/node-execution-env.js +11 -2
- package/dist/engine/harness/agent-harness.d.ts +32 -6
- package/dist/engine/harness/agent-harness.js +65 -9
- package/dist/engine/harness/types.d.ts +29 -2
- package/dist/engine/llm/types.d.ts +28 -11
- package/dist/engine/loop/agent-loop.d.ts +23 -4
- package/dist/engine/loop/agent-loop.js +42 -30
- package/dist/engine/loop/types.d.ts +16 -6
- package/dist/engine/session/memory-repo.d.ts +9 -2
- package/dist/engine/session/memory-repo.js +11 -1
- package/dist/engine/session/repo-utils.d.ts +6 -5
- package/dist/engine/session/repo-utils.js +14 -6
- package/dist/index.d.ts +34 -17
- package/dist/index.js +22 -11
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +2 -1
- package/dist/internal/harness.js +1 -0
- package/dist/internal/llm.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +6 -4
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +36 -18
- package/dist/primitives/credential-ref.d.ts +89 -0
- package/dist/primitives/credential-ref.js +125 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.js +1 -0
- package/dist/prompt-assembly/artifact.d.ts +2 -2
- package/dist/prompt-assembly/artifact.js +5 -3
- package/dist/prompt-assembly/assemble.d.ts +3 -2
- package/dist/prompt-assembly/assemble.js +1 -1
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
- package/dist/prompt-assembly/catalog/schema.js +34 -2
- package/dist/prompt-assembly/catalog/sections.js +0 -1
- package/dist/prompt-assembly/composer.d.ts +3 -1
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/event-registry.js +1 -0
- package/dist/prompt-assembly/overlay.js +3 -3
- package/dist/prompt-assembly/renderers.d.ts +1 -1
- package/dist/prompt-assembly/renderers.js +0 -3
- package/dist/prompt-assembly/role-base.d.ts +15 -0
- package/dist/prompt-assembly/role-base.js +9 -0
- package/dist/prompt-assembly/select.d.ts +39 -14
- package/dist/prompt-assembly/select.js +47 -16
- package/dist/prompt-assembly/sugar.d.ts +17 -11
- package/dist/prompt-assembly/sugar.js +8 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +37 -3
- package/dist/prompt-assembly/tool-catalog.js +114 -4
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
- package/dist/prompt-assembly/turn-snapshot.js +0 -3
- package/dist/prompt-assembly/types.d.ts +0 -7
- package/dist/scenarios/full-body.d.ts +11 -11
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.js +4 -3
- package/dist/stores/file/adoption/marker.js +3 -2
- package/dist/stores/file/checkpoint-store.d.ts +21 -4
- package/dist/stores/file/checkpoint-store.js +38 -7
- package/dist/stores/file/file-history-store.js +18 -11
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +2 -1
- package/dist/stores/file/mailbox-store.js +26 -1
- package/dist/stores/file/permission-rule-adopt.js +4 -3
- package/dist/stores/file/permission-rule-store.js +11 -5
- package/dist/stores/file/session-store.d.ts +29 -6
- package/dist/stores/file/session-store.js +42 -50
- package/dist/tools/artifact/artifact-tool.js +3 -2
- package/dist/tools/fs/bash-program-position.d.ts +19 -2
- package/dist/tools/fs/bash-program-position.js +56 -9
- package/dist/tools/fs/bash-readonly-classifier.d.ts +15 -19
- package/dist/tools/fs/bash-readonly-classifier.js +5 -10
- package/dist/tools/fs/fs-bash.js +15 -8
- package/dist/tools/fs/fs-glob.d.ts +86 -0
- package/dist/tools/fs/fs-glob.js +226 -0
- package/dist/tools/fs/fs-read.js +14 -14
- package/dist/tools/fs/fs-search-tools.js +7 -7
- package/dist/tools/fs/pattern-kill-guard.d.ts +23 -0
- package/dist/tools/fs/pattern-kill-guard.js +429 -0
- package/dist/tools/fs/pdf.d.ts +9 -6
- package/dist/tools/fs/pdf.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +57 -7
- package/dist/tools/fs/program-read-model.js +11 -1
- package/dist/tools/fs/program-read-model.rows.js +78 -21
- package/dist/tools/fs/read-deny-home.js +3 -2
- package/dist/tools/fs/removal-targets.d.ts +17 -7
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/search.d.ts +10 -0
- package/dist/tools/fs/search.js +20 -26
- package/dist/tools/fs/shell-read-argv.js +89 -12
- package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
- package/dist/tools/fs/shell-read-bindings.js +41 -0
- package/dist/tools/fs/shell-read-check.d.ts +10 -0
- package/dist/tools/fs/shell-read-check.js +13 -20
- package/dist/tools/fs/shell-read-environment.d.ts +5 -1
- package/dist/tools/fs/shell-read-environment.js +3 -2
- package/dist/tools/fs/shell-read-establish.d.ts +15 -0
- package/dist/tools/fs/shell-read-establish.js +19 -20
- package/dist/tools/fs/shell-read-identity.d.ts +12 -9
- package/dist/tools/fs/shell-read-identity.js +9 -4
- package/dist/tools/fs/shell-read-plan.js +24 -16
- package/dist/tools/fs/shell-read-start.d.ts +6 -1
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
- package/dist/tools/fs/shell-read-write-targets.js +2 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
- package/dist/tools/fs/shell-reentry-text.js +40 -2
- package/dist/tools/todo.js +63 -63
- package/dist/tools/web.d.ts +19 -14
- package/dist/tools/web.js +46 -61
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +221 -7
- package/wire-changes/core-stores-sql@7.57.0.json +29 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/core@7.57.0.json +1487 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/wire-changes/mods-kernel@7.57.0.json +29 -0
- package/wire-changes/primitives@7.57.0.json +245 -0
|
@@ -10,6 +10,8 @@ import { commitReminderDisclosureEffects, planReminderDisclosure } from "./remin
|
|
|
10
10
|
import { DEFAULT_CHARS_PER_TOKEN, estimateTokens, uuidv7 } from "../internal/harness.js";
|
|
11
11
|
import { thrownText } from "./thrown-value.js";
|
|
12
12
|
import { guardBudget } from "./context-guard.js";
|
|
13
|
+
import { agentIdOf, failedHandlerClause } from "./mods/stations.js";
|
|
14
|
+
import { extensionWords } from "./untrusted-egress.js";
|
|
13
15
|
export const USER_ATTACHMENTS_MAX = 20;
|
|
14
16
|
export const USER_ATTACHMENT_LABEL_MAX = 4096;
|
|
15
17
|
export const USER_ATTACHMENT_KINDS = Object.freeze(["text", "notebook", "image", "pdf", "directory", "client_text", "client_image"]);
|
|
@@ -142,9 +144,12 @@ export function refuseUserAttachmentPathsWithoutWorkspace(screened) {
|
|
|
142
144
|
throw userAttachmentRefusal(memberRef(entryRef(i), "path"), "this run has no workspace (its hand tools are off), so the engine has no file to read — send the file's bytes as a `text` or `image` entry instead.");
|
|
143
145
|
}
|
|
144
146
|
export function userAttachmentDeclarations(screened) {
|
|
145
|
-
return screened.map((a, i) => a
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
return screened.map((a, i) => declarationOf(a, i + 1));
|
|
148
|
+
}
|
|
149
|
+
function declarationOf(a, ordinal) {
|
|
150
|
+
return a.supply === "path"
|
|
151
|
+
? { ordinal, supply: a.supply, path: a.path }
|
|
152
|
+
: { ordinal, supply: a.supply, name: a.name, bytes: a.supply === "content_text" ? Buffer.byteLength(a.text, "utf8") : Buffer.from(a.data, "base64").byteLength };
|
|
148
153
|
}
|
|
149
154
|
export async function admitUserAttachmentImages(screened) {
|
|
150
155
|
const out = new Map();
|
|
@@ -218,6 +223,8 @@ function noteSentence(note, origin) {
|
|
|
218
223
|
return "The listing was cut short, so it is incomplete.";
|
|
219
224
|
case "too_large_to_restore":
|
|
220
225
|
return "The file was read before the conversation was summarized, but its contents are too large to include here. Use the Read tool if you need them.";
|
|
226
|
+
case "extension_declined":
|
|
227
|
+
return "An extension of this deployment did not let this attachment through, so its contents were not attached; what it said is stated above.";
|
|
221
228
|
}
|
|
222
229
|
}
|
|
223
230
|
function disclosureSentence(v) {
|
|
@@ -290,13 +297,65 @@ export async function readUserAttachments(input) {
|
|
|
290
297
|
const count = input.screened.length;
|
|
291
298
|
const seat = disclosureSeatOf(input.reader, input.mark, input.counts);
|
|
292
299
|
const frames = [];
|
|
300
|
+
const mentions = input.mentions !== undefined && input.mentions.bus.hasHandlers("prompt.mention") ? input.mentions : undefined;
|
|
293
301
|
for (const [i, a] of input.screened.entries()) {
|
|
294
302
|
const ordinal = i + 1;
|
|
295
|
-
const r = await readOne(a, ordinal, input);
|
|
303
|
+
const r = mentions !== undefined ? await readMentioned(a, ordinal, input, mentions) : await readOne(a, ordinal, input);
|
|
296
304
|
frames.push(mintFrame(r, { inputId: input.inputId, ordinal, count, mark: input.mark, origin: "user" }, seat));
|
|
297
305
|
}
|
|
298
306
|
return frames;
|
|
299
307
|
}
|
|
308
|
+
const declineOf = (x) => isPlainObject(x) && Object.keys(x).length === 1 && ((typeof x["deny"] === "string" && x["deny"] !== "") || (Object.hasOwn(x, "type") && x["type"] === null))
|
|
309
|
+
? typeof x["deny"] === "string" ? { reason: x["deny"] } : {}
|
|
310
|
+
: undefined;
|
|
311
|
+
async function readMentioned(a, ordinal, input, mentions) {
|
|
312
|
+
const label = a.supply === "path" ? a.path : a.name;
|
|
313
|
+
const declined = (text) => ({ supply: a.supply, label, outcome: "not_attached", shape: "file", data: [{ type: "text", text }], notes: [{ kind: "extension_declined" }], unscanned: [label, text], truncated: false });
|
|
314
|
+
const window = a.supply === "path" && a.lines !== undefined ? { offset: a.lines.start, ...(a.lines.end !== undefined ? { limit: a.lines.end - a.lines.start + 1 } : {}) } : {};
|
|
315
|
+
const e = { mention: declarationOf(a, ordinal), ...(mentions.agentId !== undefined ? { agentId: mentions.agentId } : {}), ...(a.supply === "path" ? { path: a.path, ...window } : {}) };
|
|
316
|
+
const reads = new Map();
|
|
317
|
+
const bottom = async (handed) => {
|
|
318
|
+
const spelled = respelled(a, handed);
|
|
319
|
+
const read = typeof spelled === "string" ? declined(`Not attached: ${spelled}.`) : await readOne(spelled, ordinal, input);
|
|
320
|
+
const answer = Object.freeze({ type: read.outcome === "not_attached" ? null : (read.kind ?? null), outcome: read.outcome });
|
|
321
|
+
reads.set(answer, read);
|
|
322
|
+
return answer;
|
|
323
|
+
};
|
|
324
|
+
let outcome;
|
|
325
|
+
try {
|
|
326
|
+
outcome = await mentions.bus.dispatch("prompt.mention", e, {
|
|
327
|
+
bottom,
|
|
328
|
+
signal: input.signal,
|
|
329
|
+
checkAnswer: (x) => (typeof x === "object" && x !== null && reads.has(x)) || declineOf(x) !== undefined ? undefined : "prompt.mention takes next(e), { deny: <reason> } or { type: null } — an extension does not supply an attachment's contents",
|
|
330
|
+
ranks: { of: (x) => (typeof x === "object" && x !== null && reads.has(x) ? 0 : 1), top: 1 },
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
catch (err) {
|
|
334
|
+
outcome = { kind: "failed", registration: "engine", cause: "threw", reason: `could not raise the station: ${thrownText(err)}`, skipped: [] };
|
|
335
|
+
}
|
|
336
|
+
if (outcome.kind === "aborted")
|
|
337
|
+
return declined("Not attached: the run was cancelled while an extension was judging it.");
|
|
338
|
+
if (outcome.kind === "failed")
|
|
339
|
+
return declined(`Not attached: a prompt.mention extension ${failedHandlerClause(outcome)}.`);
|
|
340
|
+
const read = typeof outcome.answer === "object" && outcome.answer !== null ? reads.get(outcome.answer) : undefined;
|
|
341
|
+
if (read !== undefined)
|
|
342
|
+
return read;
|
|
343
|
+
const reason = declineOf(outcome.answer)?.reason;
|
|
344
|
+
return declined(`Not attached: extension "${extensionWords(outcome.answeredBy ?? "engine", 80)}" declined it${reason !== undefined ? `: ${extensionWords(reason, 300)}` : ""}.`);
|
|
345
|
+
}
|
|
346
|
+
function respelled(a, handed) {
|
|
347
|
+
if (a.supply !== "path") {
|
|
348
|
+
return ["path", "offset", "limit"].some((k) => Object.hasOwn(handed, k)) ? "an extension handed down a path or line window for an attachment the host supplied (its bytes are its own; nothing is read)" : a;
|
|
349
|
+
}
|
|
350
|
+
const { path, offset, limit } = handed;
|
|
351
|
+
const line = (v) => v === undefined || (typeof v === "number" && Number.isInteger(v) && v >= 1);
|
|
352
|
+
if (typeof path !== "string" || path === "" || path.length > USER_ATTACHMENT_LABEL_MAX)
|
|
353
|
+
return "an extension handed down a path that is not one";
|
|
354
|
+
if (!line(offset) || !line(limit))
|
|
355
|
+
return "an extension handed down a line window that is not one (offset and limit are whole numbers from 1)";
|
|
356
|
+
const start = typeof offset === "number" ? offset : typeof limit === "number" ? 1 : undefined;
|
|
357
|
+
return start === undefined ? { supply: "path", path } : { supply: "path", path, lines: { start, ...(typeof limit === "number" ? { end: start + limit - 1 } : {}) } };
|
|
358
|
+
}
|
|
300
359
|
const refusalData = (r) => {
|
|
301
360
|
const c = r.refusal?.content;
|
|
302
361
|
return typeof c === "string" && c.length > 0 ? [{ type: "text", text: c }] : [];
|
|
@@ -439,6 +498,7 @@ export async function readObjectiveAttachments(prepared, inputId, blocked, windo
|
|
|
439
498
|
mark: prepared.reminderMark,
|
|
440
499
|
counts: prepared.reminderDisclosureCounts,
|
|
441
500
|
signal: prepared.abortController.signal,
|
|
501
|
+
mentions: { bus: prepared.modBus, ...(agentIdOf(prepared.hookIdentity) !== undefined ? { agentId: agentIdOf(prepared.hookIdentity) } : {}) },
|
|
442
502
|
});
|
|
443
503
|
refuseFramesOverWindow(frames, prepared.harness.getModel(), window);
|
|
444
504
|
return { frames, chars: frames.reduce((n, f) => n + f.seed.content.reduce((m, b) => m + (b.type === "text" ? b.text.length : 0), 0), 0) };
|
|
@@ -496,6 +496,13 @@ export interface WiringManifest {
|
|
|
496
496
|
sessionRules?: {
|
|
497
497
|
childrenReadLive: boolean;
|
|
498
498
|
};
|
|
499
|
+
/**
|
|
500
|
+
* EFFECTIVE half only; present ⇔ the deployment declared a host floor (`RunnerDeps.hostFloor`): its POSTURE — whether an `only` list
|
|
501
|
+
* bounds what is reachable (`onlyMode`; `onlyCount: 0` with it = no structured egress at all) and how many entries each list holds.
|
|
502
|
+
* Deliberately not the entries' text (deployment-supplied hosts, the {@link WiringManifest.readDeny} class). IN the fingerprint: the
|
|
503
|
+
* declaration is the deployment's, so legs of one assembly agree.
|
|
504
|
+
*/
|
|
505
|
+
hostFloor?: import("./host-floor.js").HostFloorPosture;
|
|
499
506
|
/**
|
|
500
507
|
* EFFECTIVE half only — the advisor tool on this leg, as the leg STARTED (a snapshot: a switch-off that lands later in the
|
|
501
508
|
* leg is not in it; a host reads the conversation's current state off the transcript, `advisorHoldOf`). Present ⇔ the leg's
|
|
@@ -612,6 +619,8 @@ export interface WiringFacts {
|
|
|
612
619
|
sessionRulesChildrenReadLive?: boolean;
|
|
613
620
|
/** Effective half only — the advisor phase's answer ({@link WiringManifest.advisor}), relayed, never re-derived. */
|
|
614
621
|
advisor?: WiringAdvisorFact;
|
|
622
|
+
/** Effective half only — the compiled host floor's posture ({@link WiringManifest.hostFloor}); absent ⇒ none declared. */
|
|
623
|
+
hostFloor?: import("./host-floor.js").HostFloorPosture;
|
|
615
624
|
}
|
|
616
625
|
/** {@link WiringManifest.advisor}. */
|
|
617
626
|
export interface WiringAdvisorFact {
|
|
@@ -228,6 +228,7 @@ export function deriveWiringManifest(facts) {
|
|
|
228
228
|
...(facts.half === "effective" && facts.projectMemory !== undefined ? { projectMemory: readWordFact(facts.projectMemory, ["on", "disabled", "absent"], "project-memory") } : {}),
|
|
229
229
|
...(facts.half === "effective" && facts.sessionRulesChildrenReadLive !== undefined ? { sessionRules: readSessionRulesFact(facts.sessionRulesChildrenReadLive) } : {}),
|
|
230
230
|
...(facts.half === "effective" && facts.advisor !== undefined ? { advisor: { ...facts.advisor, ...(facts.advisor.hold !== undefined ? { hold: { ...facts.advisor.hold } } : {}) } } : {}),
|
|
231
|
+
...(facts.half === "effective" && facts.hostFloor !== undefined ? { hostFloor: { onlyMode: facts.hostFloor.onlyMode, denyCount: facts.hostFloor.denyCount, onlyCount: facts.hostFloor.onlyCount } } : {}),
|
|
231
232
|
...(facts.half === "effective" && facts.teamRole !== undefined ? { teamRole: facts.teamRole } : {}),
|
|
232
233
|
...(facts.half === "effective" && facts.peerPresence !== undefined && (facts.peerPresence.agent !== undefined || facts.peerPresence.intent !== undefined)
|
|
233
234
|
? { peerPresence: { ...(facts.peerPresence.agent !== undefined ? { agent: facts.peerPresence.agent } : {}), ...(facts.peerPresence.intent !== undefined ? { intent: facts.peerPresence.intent } : {}) } }
|
|
@@ -102,7 +102,7 @@ export function journalOversizeTombstone(result, bytes) {
|
|
|
102
102
|
taskId: result.taskId,
|
|
103
103
|
sessionId: result.sessionId,
|
|
104
104
|
terminal: { kind: "failed", code: JOURNAL_OVERSIZE_ERROR_CODE, message },
|
|
105
|
-
result: message,
|
|
105
|
+
result: message, resultEntryIds: [],
|
|
106
106
|
stats: result.stats,
|
|
107
107
|
};
|
|
108
108
|
}
|
|
@@ -7,6 +7,7 @@ import { budgetInvokedSkillsRetention, computeFileLists, createFileOps, extractF
|
|
|
7
7
|
import { ENGINE_AUTHORITY_ENVELOPE_TAGS, sanitizeUntrustedText } from "../../core/untrusted-text.js";
|
|
8
8
|
import { sliceHeadSafe } from "../../core/surrogate-safe-slice.js";
|
|
9
9
|
import { thrownText } from "../../core/thrown-value.js";
|
|
10
|
+
import { capabilityHeld } from "../../brain/model-capability.js";
|
|
10
11
|
function safeJsonStringify(value) {
|
|
11
12
|
try {
|
|
12
13
|
return JSON.stringify(value) ?? "undefined";
|
|
@@ -576,7 +577,7 @@ First, inside an <analysis>...</analysis> block, note what is new since the prev
|
|
|
576
577
|
Keep each section concise. Preserve exact file paths, function names, and error messages.`;
|
|
577
578
|
function createSummarizationOptions(model, maxTokens, apiKey, headers, signal, thinkingLevel) {
|
|
578
579
|
const options = { maxTokens, signal, apiKey, headers };
|
|
579
|
-
if (model
|
|
580
|
+
if (capabilityHeld(model, "reasoning") && thinkingLevel) {
|
|
580
581
|
options.reasoning = thinkingLevel;
|
|
581
582
|
}
|
|
582
583
|
return options;
|
|
@@ -868,7 +869,7 @@ async function summarizeWithLengthRecovery(label, model, context, baseMaxTokens,
|
|
|
868
869
|
? Math.max(baseMaxTokens, model.contextWindow - estimateSummarizationInputTokens(context, cpt) - SUMMARY_WINDOW_MARGIN)
|
|
869
870
|
: Number.POSITIVE_INFINITY;
|
|
870
871
|
const cap = Math.min(modelCap, windowCap);
|
|
871
|
-
let maxTokens = Math.min(cap, model
|
|
872
|
+
let maxTokens = Math.min(cap, capabilityHeld(model, "reasoning") ? Math.max(baseMaxTokens, SUMMARY_REASONING_FLOOR) : baseMaxTokens);
|
|
872
873
|
for (let attempt = 0;; attempt++) {
|
|
873
874
|
const canEscalate = attempt < SUMMARY_MAX_ESCALATIONS && maxTokens < cap;
|
|
874
875
|
const response = await completeSummarization(model, context, createSummarizationOptions(model, maxTokens, apiKey, headers, signal, thinkingLevel), streamFn, runtime);
|
|
@@ -88,9 +88,13 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
|
|
|
88
88
|
/** `ExecutionEnv.cdPath` = the `CDPATH` the shell child receives, read LIVE off the same merge each exec gets (never the
|
|
89
89
|
* engine process's own environment): its entries, `[]` when the child gets none. Residual: a per-exec `env.CDPATH`. */
|
|
90
90
|
get cdPath(): readonly string[];
|
|
91
|
-
/**
|
|
92
|
-
* `
|
|
93
|
-
|
|
91
|
+
/** `ExecutionEnv.withheldEnv` = what the same merge withholds from the shell child (an entry `shellEnv` re-supplies is
|
|
92
|
+
* no loss), read LIVE; `[]` when no child would be spawned at all. Residual: a per-exec `env` re-supplying one. */
|
|
93
|
+
get withheldEnv(): readonly SecretEnvFinding[];
|
|
94
|
+
/** The environment the next shell child would receive, for a READ (the scrub seat is the reader's collector or a
|
|
95
|
+
* no-op: a read announces nothing). `undefined` when no child would be spawned at all — the policy is refused against
|
|
96
|
+
* the own credentials declared since construction, and every spawn throws that reason — so a reader sees "the child
|
|
97
|
+
* gets none", never a throw. */
|
|
94
98
|
private childEnvForRead;
|
|
95
99
|
private shellPath?;
|
|
96
100
|
private shellEnv?;
|
|
@@ -116,6 +116,10 @@ function toFileError(error, path) {
|
|
|
116
116
|
return new FileError("not_directory", message, path, cause);
|
|
117
117
|
case "EISDIR":
|
|
118
118
|
return new FileError("is_directory", message, path, cause);
|
|
119
|
+
case "ENAMETOOLONG":
|
|
120
|
+
if (path !== undefined && path.split(/[\\/]/).some((part) => Buffer.byteLength(part, "utf8") > 255))
|
|
121
|
+
return new FileError("name_too_long", message, path, cause);
|
|
122
|
+
break;
|
|
119
123
|
case "EINVAL":
|
|
120
124
|
return new FileError("invalid", message, path, cause);
|
|
121
125
|
default:
|
|
@@ -321,10 +325,15 @@ export class NodeExecutionEnv {
|
|
|
321
325
|
const value = this.childEnvForRead()?.CDPATH;
|
|
322
326
|
return value === undefined || value === "" ? [] : value.split(":");
|
|
323
327
|
}
|
|
324
|
-
|
|
328
|
+
get withheldEnv() {
|
|
329
|
+
let withheld = [];
|
|
330
|
+
this.childEnvForRead((f) => (withheld = f));
|
|
331
|
+
return withheld;
|
|
332
|
+
}
|
|
333
|
+
childEnvForRead(collect = () => { }) {
|
|
325
334
|
if (inheritEnvPolicyProblem(this.inheritEnv) !== undefined)
|
|
326
335
|
return undefined;
|
|
327
|
-
return getShellEnv(this.inheritEnv, this.shellEnv, undefined,
|
|
336
|
+
return getShellEnv(this.inheritEnv, this.shellEnv, undefined, collect);
|
|
328
337
|
}
|
|
329
338
|
shellPath;
|
|
330
339
|
shellEnv;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ActorAssertion, AssistantMessage, ImageContent, Model, TextContent, UserMessage, UserMessageAttachment } from "../llm/index.js";
|
|
2
2
|
import { type ToolTurnRepair } from "../llm/index.js";
|
|
3
|
-
import { type ExecutedToolCallOutcome } from "../loop/agent-loop.js";
|
|
3
|
+
import { runToolCall, type ExecutedToolCallOutcome } from "../loop/agent-loop.js";
|
|
4
4
|
import type { HaltRemainingDirective } from "../loop/types.js";
|
|
5
5
|
import type { AgentMessage, AgentTool, AgentToolCall, LoopMalformedToolUseRecovery, LoopThinkingOnlyRecovery, LoopTruncatedOutputRecovery, QueueMode, ThinkingLevel } from "../loop/types.js";
|
|
6
6
|
import { type EngineSegment } from "../../core/untrusted-text.js";
|
|
@@ -34,10 +34,11 @@ export interface HaltConsumption {
|
|
|
34
34
|
export interface TrailingToolBatchOptions {
|
|
35
35
|
readonly halt?: HaltRemainingDirective;
|
|
36
36
|
}
|
|
37
|
-
/** `prompt()` option: called
|
|
38
|
-
*
|
|
39
|
-
* caller then still owns whatever the
|
|
40
|
-
|
|
37
|
+
/** `prompt()` option: the prompt's own receipt — called with the entry id once the prompt's user message is in the
|
|
38
|
+
* session (its append returned), before its `message_end` is published. Not called when the append fails or when a
|
|
39
|
+
* trailing-batch settlement ends the run before the prompt is delivered — the caller then still owns whatever the
|
|
40
|
+
* prompt was carrying. */
|
|
41
|
+
export type PromptCommittedCallback = (entryId: string) => void;
|
|
41
42
|
/** An engine-minted message that TRAILS the prompt's human message in the same request (a user-attachment frame):
|
|
42
43
|
* minted from its content blocks, always an engine note, carrying its delivery record. */
|
|
43
44
|
export interface TrailingMessageSeed {
|
|
@@ -173,7 +174,10 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
173
174
|
private lastPublishedSeat?;
|
|
174
175
|
private readonly seatCutSources;
|
|
175
176
|
private trailingBatchEndedOn?;
|
|
177
|
+
private promptReceipt?;
|
|
176
178
|
private turnCutConsumed?;
|
|
179
|
+
private readonly committedEntryIds;
|
|
180
|
+
private readonly answerSources;
|
|
177
181
|
/** backlog #389 — one-way latch set by {@link abort}. Read by `drainQueuedMessages`: no boundary may
|
|
178
182
|
* hand a queued frame to the model once the run is unwinding, and — crucially — none may SPLICE one
|
|
179
183
|
* out of the queue either (that would delete the terminal undrained account the abort path owes it). */
|
|
@@ -308,6 +312,8 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
308
312
|
private maxOutputTokensPerCall?;
|
|
309
313
|
private stallTimeoutsPerCall?;
|
|
310
314
|
private abortResultDetails?;
|
|
315
|
+
private executeTool?;
|
|
316
|
+
private activeRun?;
|
|
311
317
|
private loopTrace?;
|
|
312
318
|
private onToolInputValidationFault?;
|
|
313
319
|
private onToolMediaRefused?;
|
|
@@ -406,7 +412,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
406
412
|
prompt(text: string, options?: {
|
|
407
413
|
images?: ImageContent[];
|
|
408
414
|
settleUnansweredToolCalls?: TrailingToolBatchOptions;
|
|
409
|
-
|
|
415
|
+
onCommitted?: PromptCommittedCallback;
|
|
410
416
|
} & UserMessageProvenance & PromptTrailing): Promise<AssistantMessage | undefined>;
|
|
411
417
|
/** R2-③: an empty/whitespace-only injection with no images carries ZERO information — it
|
|
412
418
|
* must not mint a user frame (strict endpoints reject empty user content, and an empty follow-up would
|
|
@@ -509,6 +515,15 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
509
515
|
* the loop takes the run-terminal path and never reports that settlement, so the consumption is recorded here, the
|
|
510
516
|
* only point that can see the causation (synchronous, single-threaded). A LATER abort is the run's own ending. */
|
|
511
517
|
private cutSeat;
|
|
518
|
+
/** The entry ids of the committed messages an answer `prompt()` returned was read from, in conversation order: the
|
|
519
|
+
* final assistant message, or every member of the continuation chain merged into it (members never appended — an
|
|
520
|
+
* empty failure — have no id). Bound to the returned object, so a prompt that rejects, or one overlapping another,
|
|
521
|
+
* hands its caller nothing to misread. Empty for `undefined` (no answer, read from nothing); `undefined` when the
|
|
522
|
+
* sources are not this harness's to state — an object it did not return, or an answer read from a message the
|
|
523
|
+
* transcript held before the run began whose append this harness never saw. */
|
|
524
|
+
answerEntryIdsOf(answer: AssistantMessage | undefined): readonly string[] | undefined;
|
|
525
|
+
/** Record what an answer was read from (the append receipts of its source messages) and hand the answer back. */
|
|
526
|
+
private answeredFrom;
|
|
512
527
|
/** The harness's statement of what this run's halt (and its stop siblings) did — {@link HaltConsumption}. Readable
|
|
513
528
|
* during the run and after `prompt()` settled (cleared by the NEXT prompt). */
|
|
514
529
|
haltConsumption(): HaltConsumption;
|
|
@@ -550,6 +565,17 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
550
565
|
finalizeToolCall(toolCall: AgentToolCall, args: unknown, executed: ExecutedToolCallOutcome): Promise<ExecutedToolCallOutcome & {
|
|
551
566
|
toolCall: AgentToolCall;
|
|
552
567
|
}>;
|
|
568
|
+
/**
|
|
569
|
+
* A call the host makes while a run is running (an extension's `$.tool.call`): the loop's own per-call pipeline
|
|
570
|
+
* ({@link runToolCall}) under the run's config and current roster — announced, judged at the gate, executed through the
|
|
571
|
+
* execution seat, finalized and closed on the run's event stream — with no model message carrying it and nothing added
|
|
572
|
+
* to the transcript. `admit` reads the tool the name resolves to before anything is announced; its throw is the caller's.
|
|
573
|
+
* Throws when no run is running or the run mounts no tool of that name.
|
|
574
|
+
*/
|
|
575
|
+
callTool(toolCall: AgentToolCall, signal: AbortSignal | undefined, admit: (tool: AgentTool) => void): Promise<Awaited<ReturnType<typeof runToolCall>>["finalized"]>;
|
|
576
|
+
/** Whether the loop would run this call beside others (`isBatchSafeToolCall`, the partitioner's own predicate) on the running
|
|
577
|
+
* prompt's roster — false for a name it does not mount, and when no prompt is running. */
|
|
578
|
+
isBatchSafe(toolName: string, args: unknown): boolean;
|
|
553
579
|
getModel(): Model;
|
|
554
580
|
/** The ref that chose the CURRENT model — {@link getModel}'s companion (a word re-resolves, an object pins). */
|
|
555
581
|
getModelRef(): import("../../core/model-seat.js").ModelRef;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { createAssistantMessageEventStream, ensureToolTurnInvariants, snapshotActorAssertion, stripEngineMetadata, userAttachmentOf } from "../llm/index.js";
|
|
2
|
-
import { finalizeToolOutcome, runAgentLoop } from "../loop/agent-loop.js";
|
|
1
|
+
import { createAssistantMessageEventStream, ensureToolTurnInvariants, findToolByName, snapshotActorAssertion, stripEngineMetadata, userAttachmentOf } from "../llm/index.js";
|
|
2
|
+
import { finalizeToolOutcome, isBatchSafeToolCall, runAgentLoop, runToolCall } from "../loop/agent-loop.js";
|
|
3
3
|
import { resolveAgentCoreStreamFn } from "../loop/runtime-deps.js";
|
|
4
4
|
import { normalizeEngineSegments } from "../../core/untrusted-text.js";
|
|
5
5
|
import { isCredentialHeaderName } from "../../core/secret-env.js";
|
|
6
6
|
import { isProviderEchoShape } from "../../brain/errors.js";
|
|
7
7
|
import { convertToLlm } from "./messages.js";
|
|
8
8
|
import { readMember, thrownText } from "../../core/thrown-value.js";
|
|
9
|
+
import { remoteWords } from "../../core/protocol-http-auth.js";
|
|
9
10
|
import { AgentHarnessError, CompactionError, SessionError, SYNTHETIC_MESSAGE_MODEL, toError, } from "./types.js";
|
|
10
11
|
const API_FAILURE_RECORD_MAX_CHARS = 2000;
|
|
11
12
|
function createUserMessage(text, images, provenance) {
|
|
@@ -66,7 +67,7 @@ function createFailureMessage(model, error, aborted) {
|
|
|
66
67
|
provider: model.provider,
|
|
67
68
|
model: model.id,
|
|
68
69
|
stopReason: aborted ? "aborted" : "error",
|
|
69
|
-
errorMessage: thrownText(error),
|
|
70
|
+
errorMessage: remoteWords(thrownText(error), []),
|
|
70
71
|
timestamp: Date.now(),
|
|
71
72
|
usage: {
|
|
72
73
|
input: 0,
|
|
@@ -207,7 +208,10 @@ export class AgentHarness {
|
|
|
207
208
|
lastPublishedSeat;
|
|
208
209
|
seatCutSources = new WeakMap();
|
|
209
210
|
trailingBatchEndedOn;
|
|
211
|
+
promptReceipt;
|
|
210
212
|
turnCutConsumed;
|
|
213
|
+
committedEntryIds = new WeakMap();
|
|
214
|
+
answerSources = new WeakMap();
|
|
211
215
|
aborting = false;
|
|
212
216
|
drainedPendingInjection = [];
|
|
213
217
|
runAbortController;
|
|
@@ -295,6 +299,8 @@ export class AgentHarness {
|
|
|
295
299
|
maxOutputTokensPerCall;
|
|
296
300
|
stallTimeoutsPerCall;
|
|
297
301
|
abortResultDetails;
|
|
302
|
+
executeTool;
|
|
303
|
+
activeRun;
|
|
298
304
|
loopTrace;
|
|
299
305
|
onToolInputValidationFault;
|
|
300
306
|
onToolMediaRefused;
|
|
@@ -331,6 +337,7 @@ export class AgentHarness {
|
|
|
331
337
|
this.maxOutputTokensPerCall = options.maxOutputTokensPerCall;
|
|
332
338
|
this.stallTimeoutsPerCall = options.stallTimeoutsPerCall;
|
|
333
339
|
this.abortResultDetails = options.abortResultDetails;
|
|
340
|
+
this.executeTool = options.executeTool;
|
|
334
341
|
this.loopTrace = options.loopTrace;
|
|
335
342
|
this.onToolInputValidationFault = options.onToolInputValidationFault;
|
|
336
343
|
this.onToolMediaRefused = options.onToolMediaRefused;
|
|
@@ -650,6 +657,7 @@ export class AgentHarness {
|
|
|
650
657
|
...(this.maxOutputTokensPerCall !== undefined ? { maxTokensPerCall: this.maxOutputTokensPerCall } : {}),
|
|
651
658
|
...(this.stallTimeoutsPerCall !== undefined ? { stallTimeoutsPerCall: this.stallTimeoutsPerCall } : {}),
|
|
652
659
|
...(this.abortResultDetails !== undefined ? { abortResultDetails: this.abortResultDetails } : {}),
|
|
660
|
+
...(this.executeTool !== undefined ? { executeTool: this.executeTool } : {}),
|
|
653
661
|
...(this.onToolInputValidationFault !== undefined ? { onToolInputValidationFault: this.onToolInputValidationFault } : {}),
|
|
654
662
|
...(this.onToolMediaRefused !== undefined ? { onToolMediaRefused: this.onToolMediaRefused } : {}),
|
|
655
663
|
...(this.resilience !== undefined ? { resilience: this.resilience } : {}),
|
|
@@ -834,7 +842,13 @@ export class AgentHarness {
|
|
|
834
842
|
let entryId;
|
|
835
843
|
if (!isEmptyFailureAssistant(event.message)) {
|
|
836
844
|
entryId = await this.session.appendMessage(event.message);
|
|
845
|
+
this.committedEntryIds.set(event.message, entryId);
|
|
837
846
|
this.settleInjectedFrame(event.message, entryId);
|
|
847
|
+
if (this.promptReceipt?.message === event.message) {
|
|
848
|
+
const { commit } = this.promptReceipt;
|
|
849
|
+
this.promptReceipt = undefined;
|
|
850
|
+
commit(entryId);
|
|
851
|
+
}
|
|
838
852
|
if (entryId !== undefined && event.message.role === "toolResult" && typeof event.message.toolCallId === "string") {
|
|
839
853
|
try {
|
|
840
854
|
this.onFrameCommitted?.({ kind: "tool_result", toolCallId: event.message.toolCallId, content: event.message.content }, entryId);
|
|
@@ -901,6 +915,7 @@ export class AgentHarness {
|
|
|
901
915
|
async executeTurn(turnState, text, options, abortController) {
|
|
902
916
|
let activeTurnState = turnState;
|
|
903
917
|
const userMessage = createUserMessage(text, options?.images, options);
|
|
918
|
+
this.promptReceipt = options?.onCommitted !== undefined ? { message: userMessage, commit: options.onCommitted } : undefined;
|
|
904
919
|
const trailingMessages = (options?.trailing ?? []).map(createTrailingMessage);
|
|
905
920
|
this.runHistory = new WeakSet(turnState.messages.filter((m) => m.role === "assistant"));
|
|
906
921
|
const beforeResult = await this.emitHook({
|
|
@@ -943,9 +958,12 @@ export class AgentHarness {
|
|
|
943
958
|
const setTurnState = (nextTurnState) => {
|
|
944
959
|
activeTurnState = nextTurnState;
|
|
945
960
|
};
|
|
961
|
+
const loopConfig = this.createLoopConfig(getTurnState, setTurnState, beforeResult?.systemPrompt);
|
|
962
|
+
const emitRunEvent = (event) => this.handleAgentEvent(event, abortController.signal);
|
|
963
|
+
this.activeRun = { config: loopConfig, context: () => this.createContext(getTurnState(), beforeResult?.systemPrompt), emit: emitRunEvent, signal: abortController.signal };
|
|
946
964
|
const runResultPromise = (async () => {
|
|
947
965
|
try {
|
|
948
|
-
return await runAgentLoop(takePrompts, this.createContext(turnState, beforeResult?.systemPrompt),
|
|
966
|
+
return await runAgentLoop(takePrompts, this.createContext(turnState, beforeResult?.systemPrompt), loopConfig, emitRunEvent, abortController.signal, this.createStreamFn(getTurnState), undefined, this.loopTrace, {
|
|
949
967
|
...(options?.settleUnansweredToolCalls !== undefined
|
|
950
968
|
? {
|
|
951
969
|
settle: {
|
|
@@ -957,7 +975,6 @@ export class AgentHarness {
|
|
|
957
975
|
},
|
|
958
976
|
}
|
|
959
977
|
: {}),
|
|
960
|
-
...(options?.onDelivered !== undefined ? { onPromptsDelivered: options.onDelivered } : {}),
|
|
961
978
|
});
|
|
962
979
|
}
|
|
963
980
|
catch (error) {
|
|
@@ -975,13 +992,14 @@ export class AgentHarness {
|
|
|
975
992
|
for (let i = newMessages.length - 1; i >= 0; i--) {
|
|
976
993
|
const message = newMessages[i];
|
|
977
994
|
if (message.role === "assistant") {
|
|
978
|
-
|
|
995
|
+
const answer = mergeTruncatedOutputChain(newMessages, i);
|
|
996
|
+
return this.answeredFrom(answer.message, answer.members);
|
|
979
997
|
}
|
|
980
998
|
}
|
|
981
999
|
if (this.stopRequested || abortController.signal.aborted)
|
|
982
1000
|
return undefined;
|
|
983
1001
|
if (this.trailingBatchEndedOn !== undefined)
|
|
984
|
-
return this.trailingBatchEndedOn;
|
|
1002
|
+
return this.answeredFrom(this.trailingBatchEndedOn, [this.trailingBatchEndedOn]);
|
|
985
1003
|
throw new AgentHarnessError("invalid_state", "AgentHarness prompt completed without an assistant message");
|
|
986
1004
|
}
|
|
987
1005
|
finally {
|
|
@@ -990,6 +1008,9 @@ export class AgentHarness {
|
|
|
990
1008
|
}
|
|
991
1009
|
finally {
|
|
992
1010
|
this.runAbortController = undefined;
|
|
1011
|
+
this.activeRun = undefined;
|
|
1012
|
+
if (this.promptReceipt?.message === userMessage)
|
|
1013
|
+
this.promptReceipt = undefined;
|
|
993
1014
|
}
|
|
994
1015
|
}
|
|
995
1016
|
}
|
|
@@ -1145,6 +1166,21 @@ export class AgentHarness {
|
|
|
1145
1166
|
if (runQuietBefore && this.runAbortController?.signal.aborted === true)
|
|
1146
1167
|
this.turnCutConsumed = { source };
|
|
1147
1168
|
}
|
|
1169
|
+
answerEntryIdsOf(answer) {
|
|
1170
|
+
return answer === undefined ? [] : this.answerSources.get(answer);
|
|
1171
|
+
}
|
|
1172
|
+
answeredFrom(answer, members) {
|
|
1173
|
+
const ids = [];
|
|
1174
|
+
for (const m of members) {
|
|
1175
|
+
const id = this.committedEntryIds.get(m);
|
|
1176
|
+
if (id !== undefined)
|
|
1177
|
+
ids.push(id);
|
|
1178
|
+
else if (this.runHistory?.has(m) === true)
|
|
1179
|
+
return answer;
|
|
1180
|
+
}
|
|
1181
|
+
this.answerSources.set(answer, ids);
|
|
1182
|
+
return answer;
|
|
1183
|
+
}
|
|
1148
1184
|
haltConsumption() {
|
|
1149
1185
|
const turnCut = this.turnCutConsumed?.source;
|
|
1150
1186
|
return {
|
|
@@ -1244,6 +1280,23 @@ export class AgentHarness {
|
|
|
1244
1280
|
finalizeToolCall(toolCall, args, executed) {
|
|
1245
1281
|
return finalizeToolOutcome(toolCall, executed, (result, isError) => this.afterToolCallHook(toolCall, args, result, isError), this.onToolMediaRefused);
|
|
1246
1282
|
}
|
|
1283
|
+
async callTool(toolCall, signal, admit) {
|
|
1284
|
+
const run = this.activeRun;
|
|
1285
|
+
if (run === undefined)
|
|
1286
|
+
throw new AgentHarnessError("invalid_state", "a host's tool call runs inside a running prompt, and none is running");
|
|
1287
|
+
const context = run.context();
|
|
1288
|
+
const tool = findToolByName(context.tools, toolCall.name);
|
|
1289
|
+
if (tool === undefined)
|
|
1290
|
+
throw new AgentHarnessError("invalid_state", `no tool named "${toolCall.name}" in this run (it has ${(context.tools ?? []).map((t) => t.name).join(", ") || "none"})`);
|
|
1291
|
+
admit(tool);
|
|
1292
|
+
const both = signal !== undefined ? AbortSignal.any([signal, run.signal]) : run.signal;
|
|
1293
|
+
return (await runToolCall(context, undefined, toolCall, run.config, both, run.emit)).finalized;
|
|
1294
|
+
}
|
|
1295
|
+
isBatchSafe(toolName, args) {
|
|
1296
|
+
const tools = this.activeRun?.context().tools;
|
|
1297
|
+
const tool = findToolByName(tools, toolName);
|
|
1298
|
+
return tool !== undefined && isBatchSafeToolCall(tool, { type: "toolCall", id: "", name: toolName, arguments: (typeof args === "object" && args !== null ? args : {}) });
|
|
1299
|
+
}
|
|
1247
1300
|
getModel() {
|
|
1248
1301
|
return this.model;
|
|
1249
1302
|
}
|
|
@@ -1463,6 +1516,7 @@ function mergeTruncatedOutputChain(messages, lastAssistantIndex) {
|
|
|
1463
1516
|
const last = messages[lastAssistantIndex];
|
|
1464
1517
|
const lastText = last.content.map((c) => (c.type === "text" ? c.text : "")).join("");
|
|
1465
1518
|
const parts = [];
|
|
1519
|
+
const members = [last];
|
|
1466
1520
|
let i = lastAssistantIndex;
|
|
1467
1521
|
while (i - 2 >= 0) {
|
|
1468
1522
|
const mid = messages[i - 1];
|
|
@@ -1477,18 +1531,20 @@ function mergeTruncatedOutputChain(messages, lastAssistantIndex) {
|
|
|
1477
1531
|
if (!step)
|
|
1478
1532
|
break;
|
|
1479
1533
|
parts.unshift(head.content.map((c) => (c.type === "text" ? c.text : "")).join(""));
|
|
1534
|
+
members.unshift(head);
|
|
1480
1535
|
i = i - 2;
|
|
1481
1536
|
}
|
|
1482
1537
|
if (parts.length === 0) {
|
|
1483
|
-
return last;
|
|
1538
|
+
return { message: last, members };
|
|
1484
1539
|
}
|
|
1485
|
-
|
|
1540
|
+
const message = {
|
|
1486
1541
|
...last,
|
|
1487
1542
|
content: [
|
|
1488
1543
|
{ type: "text", text: parts.join("") + lastText },
|
|
1489
1544
|
...last.content.filter((c) => c.type !== "text"),
|
|
1490
1545
|
],
|
|
1491
1546
|
};
|
|
1547
|
+
return { message, members };
|
|
1492
1548
|
}
|
|
1493
1549
|
function toLintErrorObject(value, fallbackMessage) {
|
|
1494
1550
|
if (value instanceof Error) {
|
|
@@ -2,6 +2,7 @@ import type { PromptEpochDescriptor } from "../../prompt-assembly/epoch.js";
|
|
|
2
2
|
import type { DocumentContent, ImageContent, Model, SimpleStreamOptions, TextContent, Transport } from "../llm/index.js";
|
|
3
3
|
import type { AfterToolCallResult, AgentEvent, AgentMessage, AgentTool, BeforeToolCallResult, QueueMode, ThinkingLevel } from "../loop/types.js";
|
|
4
4
|
import type { AgentCoreRuntimeDeps } from "../loop/runtime-deps.js";
|
|
5
|
+
import type { SecretEnvFinding } from "../../core/secret-env.js";
|
|
5
6
|
/** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */
|
|
6
7
|
export type Result<TValue, TError> = {
|
|
7
8
|
ok: true;
|
|
@@ -103,7 +104,11 @@ export interface WriteReceipt {
|
|
|
103
104
|
created: boolean;
|
|
104
105
|
}
|
|
105
106
|
/** Stable, backend-independent file error codes returned by {@link FileSystem} file operations. */
|
|
106
|
-
export type FileErrorCode = "aborted" | "not_found" | "permission_denied" | "not_directory" | "is_directory"
|
|
107
|
+
export type FileErrorCode = "aborted" | "not_found" | "permission_denied" | "not_directory" | "is_directory"
|
|
108
|
+
/** A name this filesystem cannot hold (POSIX `ENAMETOOLONG` for a path component past `NAME_MAX`) — nothing can be there, and
|
|
109
|
+
* a program that opens it fails the same way: an absence as conclusive as `not_found`. A path past `PATH_MAX` whose
|
|
110
|
+
* components are short is not this word (such a file may exist, reached from a directory below it). */
|
|
111
|
+
| "name_too_long" | "invalid" | "not_supported"
|
|
107
112
|
/** Exclusive create refused because the path already exists ({@link FileSystem.writeFileExclusive},
|
|
108
113
|
* POSIX `O_EXCL` shape). Discriminable so a caller can distinguish "lost the create race" from a
|
|
109
114
|
* write failure and give honest guidance instead of overwriting. */
|
|
@@ -550,6 +555,11 @@ export interface ExecutionEnv extends FileSystem, Shell {
|
|
|
550
555
|
readonly homeDir?: string;
|
|
551
556
|
/** #1554 — the `CDPATH` entries the shell child receives (`[]` = none), or `"unknown"` when the adapter cannot say. */
|
|
552
557
|
readonly cdPath: readonly string[] | "unknown";
|
|
558
|
+
/** #1963 — the entries of the environment the shell child inherits that it does NOT receive: the findings of the one
|
|
559
|
+
* composition its spawns read (`inheritedHostEnv(policy, findings)`), less the keys the adapter's explicit grants
|
|
560
|
+
* re-supply — names and rules, never a value. `[]` = none withheld, or none inherited (a shell environment built
|
|
561
|
+
* rather than inherited from this process); `"unknown"` = the adapter cannot say. A read: it announces nothing. */
|
|
562
|
+
readonly withheldEnv: readonly SecretEnvFinding[] | "unknown";
|
|
553
563
|
}
|
|
554
564
|
/** Base fields shared by append-only session tree entries. */
|
|
555
565
|
export interface SessionTreeEntryBase {
|
|
@@ -916,6 +926,16 @@ export interface SessionMetadata {
|
|
|
916
926
|
/** WHO owns this row, recorded by the write that creates it and changed by no later write; `null` = anonymous; absent reads as `null`. */
|
|
917
927
|
owner?: string | null;
|
|
918
928
|
}
|
|
929
|
+
/**
|
|
930
|
+
* One row of {@link SessionRepo.list}: the row's metadata, plus the newest activity the repo records for the row. `lastActiveAt` is
|
|
931
|
+
* epoch ms — on the File repo its log's modification time (every write to a row is an append to its log, and {@link SessionRepo.touch}
|
|
932
|
+
* moves the same time), on the in-memory repo its last {@link SessionRepo.touch} (it never sees its sessions' writes). Absent = the repo
|
|
933
|
+
* records none; a reader then takes the row's `createdAt`. It is what the repo records, never what one process saw — so a dropped
|
|
934
|
+
* cache, a restart or another replica reads the same time, and only a later activity moves it.
|
|
935
|
+
*/
|
|
936
|
+
export type SessionRow<TMetadata extends SessionMetadata = SessionMetadata> = TMetadata & {
|
|
937
|
+
readonly lastActiveAt?: number;
|
|
938
|
+
};
|
|
919
939
|
/** One row's owner, occupant (`undefined` = unknown) and active leaf (`null` = none), read in ONE read so the three answer for one row generation. */
|
|
920
940
|
export interface SessionHead {
|
|
921
941
|
readonly owner: string | null;
|
|
@@ -1078,7 +1098,12 @@ export interface SessionForkOptions {
|
|
|
1078
1098
|
export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata, TCreateOptions extends SessionCreateOptions = SessionCreateOptions, TListOptions = void> {
|
|
1079
1099
|
create(options: TCreateOptions): Promise<Session<TMetadata>>;
|
|
1080
1100
|
open(metadata: TMetadata): Promise<Session<TMetadata>>;
|
|
1081
|
-
|
|
1101
|
+
/** Every ordinary row (placed rows are not listed), each with the newest write the repo holds for it ({@link SessionRow}), in no
|
|
1102
|
+
* promised order. The source `TtlSessionStore.list` reads; the store, not the repo, orders, filters and pages. */
|
|
1103
|
+
list(options?: TListOptions): Promise<SessionRow<TMetadata>[]>;
|
|
1104
|
+
/** Record activity on the row now: the time {@link list} answers as the row's `lastActiveAt` moves to now. A missing row is a no-op; a
|
|
1105
|
+
* fault rejects. Optional: a repo without it records only what its writes record. */
|
|
1106
|
+
touch?(sessionId: string): Promise<void>;
|
|
1082
1107
|
delete(metadata: TMetadata): Promise<void>;
|
|
1083
1108
|
/** A fork is a NEW row: `options.id` equal to the source's id is refused (`invalid_fork_target`) — onto its source it would mint a new occupant over the source's own transcript. */
|
|
1084
1109
|
fork(source: TMetadata, options: SessionForkOptions & TCreateOptions): Promise<Session<TMetadata>>;
|
|
@@ -1464,6 +1489,8 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
|
|
|
1464
1489
|
* texts themselves never change.
|
|
1465
1490
|
*/
|
|
1466
1491
|
abortResultDetails?: () => Record<string, unknown> | undefined;
|
|
1492
|
+
/** The host's station around one tool execution, forwarded verbatim to the loop config (`AgentLoopConfig.executeTool`). */
|
|
1493
|
+
executeTool?: import("../loop/types.js").AgentLoopConfig["executeTool"];
|
|
1467
1494
|
/**
|
|
1468
1495
|
* C2: the loop's recovery/terminal trace sink, forwarded to `runAgentLoop`'s trace
|
|
1469
1496
|
* parameter (previously test-only — never passed in production, so the loop's six self-heal
|