@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
|
@@ -231,11 +231,11 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
|
|
|
231
231
|
appendFile(path: string, content: string | Uint8Array): Promise<Result<void, FileError>>;
|
|
232
232
|
fileInfo(path: string): Promise<Result<FileInfo, FileError>>;
|
|
233
233
|
/**
|
|
234
|
-
* design/381 DV-8 — {@link FileInfo.mode}'s write half
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
234
|
+
* design/381 DV-8 — {@link FileInfo.mode}'s write half, applied to the descriptor of the one placed open a bound read takes
|
|
235
|
+
* ({@link openPlaced}): no link anywhere on the canonical path is followed (`precondition_failed`), a FIFO swapped in is
|
|
236
|
+
* refused without waiting (`invalid`), and a platform that cannot place an opened object answers `not_supported` — a
|
|
237
|
+
* restore must never re-permission a file a link led it to. Absent on platforms without the permission face
|
|
238
|
+
* ({@link HAS_POSIX_MODE_FACE}), where the caller's disclosure is the honest answer.
|
|
239
239
|
*/
|
|
240
240
|
setFileMode(path: string, mode: number, abortSignal?: AbortSignal): Promise<Result<void, FileError>>;
|
|
241
241
|
listDir(path: string, abortSignal?: AbortSignal): Promise<Result<FileInfo[], FileError>>;
|
|
@@ -243,22 +243,29 @@ export declare class NodeExecutionEnv implements ExecutionEnv, BackgroundShellCa
|
|
|
243
243
|
/** {@link FileSystem.fileIdentity}: `stat` (links followed) read as BIGINT — an inode past 2^53 (an APFS volume root)
|
|
244
244
|
* is not exact as a number, and two inodes that collapse to one number would name two directories as one. */
|
|
245
245
|
fileIdentity(path: string): Promise<Result<string, FileError>>;
|
|
246
|
-
/** {@link FileSystem.openBound}:
|
|
247
|
-
*
|
|
248
|
-
* file or a directory. The held object reads by position from its descriptor and sizes by `fstat`; a directory lists by
|
|
249
|
-
* {@link listOpenDirectory}. win32 holds files only. */
|
|
246
|
+
/** {@link FileSystem.openBound}: the object of the one placed open ({@link openPlaced}), held. It reads by position from its
|
|
247
|
+
* descriptor and sizes by `fstat`; a directory lists by {@link listOpenDirectory}. */
|
|
250
248
|
openBound(path: string, abortSignal?: AbortSignal): Promise<Result<BoundFileObject, FileError>>;
|
|
251
|
-
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
|
|
249
|
+
/** The one open a bound read ({@link openBound}) and a mode change ({@link setFileMode}) take at a canonical `resolved`:
|
|
250
|
+
* read-only, never blocking (a FIFO swapped in is refused, not waited on), and placed at `resolved` by ONE kernel
|
|
251
|
+
* observation — on darwin the open itself, which refuses a link on any component of the path ({@link O_NOFOLLOW_ANY}; a
|
|
252
|
+
* kernel that does not refuse them answers `not_supported`); on Linux the kernel's path of the opened descriptor
|
|
253
|
+
* ({@link heldPlace}). A platform with neither (win32, the BSDs) answers `not_supported` and opens nothing. A link where
|
|
254
|
+
* the open stood is `precondition_failed`; an opened object that is not a regular file or a directory is `invalid` (one the
|
|
255
|
+
* kernel will not open read-only, a socket, keeps the kernel's answer); a signal cancelled by the time it is placed is
|
|
256
|
+
* `aborted`, nothing handed back. The caller owns the handle. */
|
|
257
|
+
private openPlaced;
|
|
258
|
+
/** Where is the object just opened ({@link openPlaced}, Linux) against the canonical `resolved`? The descriptor answers for
|
|
259
|
+
* itself: the kernel's path of the held object (`/proc/self/fd/<fd>`) must be `resolved` — whatever the path named before
|
|
260
|
+
* or after (`elsewhere` when it is another); an unreadable answer (no `/proc`) is `unobservable`: this host cannot place
|
|
261
|
+
* the object, answered `not_supported`, the member's absence on this target. */
|
|
262
|
+
private heldPlace;
|
|
257
263
|
/** The platform's listing of a directory already held open ({@link openBound}): Linux through the descriptor
|
|
258
264
|
* (`/proc/self/fd/<fd>` — the listing is of the held object whatever the path names); darwin, which cannot enumerate an
|
|
259
265
|
* open directory from Node (`/dev/fd/<fd>` of a directory answers ENOTDIR), lists the PATH once and requires it to
|
|
260
266
|
* name the held object afterwards — a path swapped away and back during that one listing can list another directory's
|
|
261
|
-
* entry NAMES (never bytes
|
|
267
|
+
* entry NAMES (never bytes). Those entries are judged as names under the held directory's own spelling: a read-deny row
|
|
268
|
+
* that names the other directory's real location does not reach them (KL-1311a2-g). */
|
|
262
269
|
protected listOpenDirectory(held: FileHandle, resolved: string, identity: string, abortSignal?: AbortSignal): Promise<Result<FileInfo[], FileError>>;
|
|
263
270
|
readLink(path: string): Promise<Result<string, FileError>>;
|
|
264
271
|
/**
|
|
@@ -94,6 +94,36 @@ function fileKindFromStats(stats) {
|
|
|
94
94
|
return undefined;
|
|
95
95
|
}
|
|
96
96
|
const HAS_POSIX_MODE_FACE = posixModeBitsMeaningful();
|
|
97
|
+
const O_NOFOLLOW_ANY = 0x20000000;
|
|
98
|
+
let linksRefusedOnTheWay;
|
|
99
|
+
function refusesLinksOnTheWay() {
|
|
100
|
+
return (linksRefusedOnTheWay ??= probeLinksRefusedOnTheWay().then((answer) => {
|
|
101
|
+
if (answer === undefined)
|
|
102
|
+
linksRefusedOnTheWay = undefined;
|
|
103
|
+
return answer === true;
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
async function probeLinksRefusedOnTheWay() {
|
|
107
|
+
try {
|
|
108
|
+
if (!(await lstat("/var")).isSymbolicLink())
|
|
109
|
+
return undefined;
|
|
110
|
+
await stat("/var/tmp");
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
await (await open("/var/tmp", constants.O_RDONLY | (constants.O_NONBLOCK ?? 0) | O_NOFOLLOW_ANY)).close();
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
if (isNodeError(error) && error.code === "ELOOP")
|
|
121
|
+
return true;
|
|
122
|
+
if (isNodeError(error) && error.code === "EINVAL")
|
|
123
|
+
return false;
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
97
127
|
async function readUpTo(handle, size, limit, aborted) {
|
|
98
128
|
const readAt = async (into, offset, length, position) => {
|
|
99
129
|
const { bytesRead } = await handle.read(into, offset, length, position);
|
|
@@ -138,10 +168,15 @@ async function readAllFrom(handle, max, aborted) {
|
|
|
138
168
|
async function readFirstBytes(resolved, maxBytes, abortSignal) {
|
|
139
169
|
let handle;
|
|
140
170
|
try {
|
|
141
|
-
handle = await open(resolved,
|
|
171
|
+
handle = await open(resolved, constants.O_RDONLY | (constants.O_NONBLOCK ?? 0));
|
|
142
172
|
const held = await handle.stat();
|
|
143
173
|
if (held.isDirectory())
|
|
144
174
|
return err(new FileError("is_directory", `EISDIR: illegal operation on a directory, read '${resolved}'`, resolved));
|
|
175
|
+
if (!held.isFile())
|
|
176
|
+
return err(new FileError("invalid", "Not a regular file (a FIFO, socket or device is not read by name)", resolved));
|
|
177
|
+
const aborted = abortResult(abortSignal, resolved);
|
|
178
|
+
if (aborted)
|
|
179
|
+
return aborted;
|
|
145
180
|
return ok(await readUpTo(handle, Number(held.size), maxBytes, () => abortResult(abortSignal, resolved) !== undefined));
|
|
146
181
|
}
|
|
147
182
|
catch (error) {
|
|
@@ -441,11 +476,11 @@ function getShellEnv(inheritEnv, baseEnv, extraEnv, onScrub, onNotice) {
|
|
|
441
476
|
}
|
|
442
477
|
else if (onScrub !== undefined && !secretScrubSeatDefectAnnounced) {
|
|
443
478
|
secretScrubSeatDefectAnnounced = true;
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
479
|
+
deliverEngineNotice(onNotice, {
|
|
480
|
+
code: "config.seat_malformed",
|
|
481
|
+
message: `onSecretEnvScrub seat holds ${onScrub === null ? "null" : typeof onScrub} — not a function; scrub findings fall back to the console summary (once per process)`,
|
|
482
|
+
detail: { seat: "onSecretEnvScrub" },
|
|
483
|
+
});
|
|
449
484
|
}
|
|
450
485
|
if (!(typeof onScrub === "function" && onNotice === undefined)) {
|
|
451
486
|
announceSecretEnvScrub(onNotice, findings);
|
|
@@ -493,6 +528,10 @@ export function openSpoolPair(base) {
|
|
|
493
528
|
}
|
|
494
529
|
return { outPath, errPath, fds: [fdOut, fdErr] };
|
|
495
530
|
}
|
|
531
|
+
function shellChildStdio(spoolFds, stdinFed) {
|
|
532
|
+
const stdin = stdinFed ? "pipe" : "ignore";
|
|
533
|
+
return { stdio: spoolFds ? [stdin, spoolFds[0], spoolFds[1]] : [stdin, "pipe", "pipe"] };
|
|
534
|
+
}
|
|
496
535
|
export class NodeExecutionEnv {
|
|
497
536
|
cwd;
|
|
498
537
|
capabilities;
|
|
@@ -749,12 +788,13 @@ export class NodeExecutionEnv {
|
|
|
749
788
|
}
|
|
750
789
|
execSpoolFds = undefined;
|
|
751
790
|
};
|
|
791
|
+
const input = options?.stdinFrom;
|
|
752
792
|
try {
|
|
753
793
|
child = spawn(start.command, [...start.args], {
|
|
754
794
|
cwd,
|
|
755
795
|
detached: process.platform !== "win32",
|
|
756
796
|
env: this.spawnEnv(options?.env),
|
|
757
|
-
|
|
797
|
+
...shellChildStdio(execSpoolFds, input !== undefined),
|
|
758
798
|
windowsHide: true,
|
|
759
799
|
});
|
|
760
800
|
}
|
|
@@ -765,6 +805,16 @@ export class NodeExecutionEnv {
|
|
|
765
805
|
return;
|
|
766
806
|
}
|
|
767
807
|
closeSpoolFds();
|
|
808
|
+
if (input !== undefined && child.stdin !== null) {
|
|
809
|
+
const stdin = child.stdin;
|
|
810
|
+
stdin.on("error", () => { });
|
|
811
|
+
try {
|
|
812
|
+
stdin.end(Buffer.from(input.buffer, input.byteOffset, input.byteLength));
|
|
813
|
+
}
|
|
814
|
+
catch {
|
|
815
|
+
stdin.destroy();
|
|
816
|
+
}
|
|
817
|
+
}
|
|
768
818
|
const timeoutMs = resolveExecTimeoutMs(options?.timeout);
|
|
769
819
|
timeoutRef.current =
|
|
770
820
|
timeoutMs === undefined
|
|
@@ -1259,29 +1309,22 @@ export class NodeExecutionEnv {
|
|
|
1259
1309
|
}
|
|
1260
1310
|
async setFileMode(path, mode, abortSignal) {
|
|
1261
1311
|
const resolved = resolvePath(this.cwd, path);
|
|
1262
|
-
const aborted = abortResult(abortSignal, resolved);
|
|
1263
|
-
if (aborted) {
|
|
1264
|
-
return aborted;
|
|
1265
|
-
}
|
|
1266
1312
|
if (!HAS_POSIX_MODE_FACE) {
|
|
1267
1313
|
return err(new FileError("not_supported", "This platform has no POSIX permission model", resolved));
|
|
1268
1314
|
}
|
|
1315
|
+
const placed = await this.openPlaced(resolved, abortSignal);
|
|
1316
|
+
if (!placed.ok)
|
|
1317
|
+
return placed;
|
|
1269
1318
|
try {
|
|
1270
|
-
|
|
1271
|
-
try {
|
|
1272
|
-
await handle.chmod(mode & 0o7777);
|
|
1273
|
-
}
|
|
1274
|
-
finally {
|
|
1275
|
-
await handle.close().catch(() => { });
|
|
1276
|
-
}
|
|
1319
|
+
await placed.value.handle.chmod(mode & 0o7777);
|
|
1277
1320
|
return ok(undefined);
|
|
1278
1321
|
}
|
|
1279
1322
|
catch (error) {
|
|
1280
|
-
if (isNodeError(error) && error.code === "ELOOP") {
|
|
1281
|
-
return err(new FileError("invalid", "Refusing to change the mode of a symlink (the target is not the addressed path)", resolved));
|
|
1282
|
-
}
|
|
1283
1323
|
return err(toFileError(error, resolved));
|
|
1284
1324
|
}
|
|
1325
|
+
finally {
|
|
1326
|
+
await placed.value.handle.close().catch(() => { });
|
|
1327
|
+
}
|
|
1285
1328
|
}
|
|
1286
1329
|
async listDir(path, abortSignal) {
|
|
1287
1330
|
const resolved = resolvePath(this.cwd, path);
|
|
@@ -1335,16 +1378,66 @@ export class NodeExecutionEnv {
|
|
|
1335
1378
|
}
|
|
1336
1379
|
async openBound(path, abortSignal) {
|
|
1337
1380
|
const resolved = resolvePath(this.cwd, path);
|
|
1381
|
+
const placed = await this.openPlaced(resolved, abortSignal);
|
|
1382
|
+
if (!placed.ok)
|
|
1383
|
+
return placed;
|
|
1384
|
+
const { handle, held } = placed.value;
|
|
1385
|
+
const identity = `${held.dev}:${held.ino}`;
|
|
1386
|
+
const kind = held.isDirectory() ? "directory" : "file";
|
|
1387
|
+
return ok({
|
|
1388
|
+
identity,
|
|
1389
|
+
kind,
|
|
1390
|
+
size: async () => {
|
|
1391
|
+
try {
|
|
1392
|
+
return ok(Number((await handle.stat()).size));
|
|
1393
|
+
}
|
|
1394
|
+
catch (error) {
|
|
1395
|
+
return err(toFileError(error, resolved));
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1398
|
+
readBytes: async (max, signal) => {
|
|
1399
|
+
if (kind !== "file")
|
|
1400
|
+
return err(new FileError("is_directory", "The held object is a directory", resolved));
|
|
1401
|
+
try {
|
|
1402
|
+
return ok(await readAllFrom(handle, max, () => abortResult(signal, resolved) !== undefined));
|
|
1403
|
+
}
|
|
1404
|
+
catch (error) {
|
|
1405
|
+
return err(toFileError(error, resolved));
|
|
1406
|
+
}
|
|
1407
|
+
},
|
|
1408
|
+
list: async (signal) => {
|
|
1409
|
+
if (kind !== "directory")
|
|
1410
|
+
return err(new FileError("not_directory", "The held object is a file", resolved));
|
|
1411
|
+
try {
|
|
1412
|
+
return await this.listOpenDirectory(handle, resolved, identity, signal);
|
|
1413
|
+
}
|
|
1414
|
+
catch (error) {
|
|
1415
|
+
return err(toFileError(error, resolved));
|
|
1416
|
+
}
|
|
1417
|
+
},
|
|
1418
|
+
close: () => handle.close().catch(() => { }),
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
async openPlaced(resolved, abortSignal) {
|
|
1338
1422
|
const aborted = abortResult(abortSignal, resolved);
|
|
1339
1423
|
if (aborted)
|
|
1340
1424
|
return aborted;
|
|
1425
|
+
const observation = process.platform === "darwin" ? "open" : process.platform === "linux" ? "descriptor" : undefined;
|
|
1426
|
+
if (observation === undefined)
|
|
1427
|
+
return err(new FileError("not_supported", "This platform gives no kernel observation of where an opened object is, so it cannot be placed at the path that was checked", resolved));
|
|
1428
|
+
if (observation === "open" && !(await refusesLinksOnTheWay())) {
|
|
1429
|
+
return err(new FileError("not_supported", "This macOS does not refuse a link on the way of an open, so a read cannot be bound to the path that was checked", resolved));
|
|
1430
|
+
}
|
|
1431
|
+
const abortedWhileAsked = abortResult(abortSignal, resolved);
|
|
1432
|
+
if (abortedWhileAsked)
|
|
1433
|
+
return abortedWhileAsked;
|
|
1341
1434
|
let handle;
|
|
1342
1435
|
try {
|
|
1343
|
-
handle = await open(resolved, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
1436
|
+
handle = await open(resolved, constants.O_RDONLY | (observation === "open" ? O_NOFOLLOW_ANY : (constants.O_NOFOLLOW ?? 0)) | (constants.O_NONBLOCK ?? 0));
|
|
1344
1437
|
}
|
|
1345
1438
|
catch (error) {
|
|
1346
1439
|
if (isNodeError(error) && error.code === "ELOOP")
|
|
1347
|
-
return err(new FileError("precondition_failed", "
|
|
1440
|
+
return err(new FileError("precondition_failed", "A link stands on the path now, so it is not the object that was checked", resolved));
|
|
1348
1441
|
return err(toFileError(error, resolved));
|
|
1349
1442
|
}
|
|
1350
1443
|
const refuse = async (code, message) => {
|
|
@@ -1353,57 +1446,24 @@ export class NodeExecutionEnv {
|
|
|
1353
1446
|
};
|
|
1354
1447
|
try {
|
|
1355
1448
|
const held = await handle.stat({ bigint: true });
|
|
1356
|
-
|
|
1449
|
+
const place = observation === "open" ? "at" : await this.heldPlace(handle, resolved);
|
|
1450
|
+
if (place === "unobservable")
|
|
1451
|
+
return refuse("not_supported", "This platform gives no kernel path for an opened descriptor, so the opened object cannot be placed at its path");
|
|
1452
|
+
if (place === "elsewhere")
|
|
1357
1453
|
return refuse("precondition_failed", "The path named another object than the one opened");
|
|
1358
1454
|
if (!held.isFile() && !held.isDirectory())
|
|
1359
1455
|
return refuse("invalid", "Neither a regular file nor a directory");
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
return ok({
|
|
1363
|
-
identity,
|
|
1364
|
-
kind,
|
|
1365
|
-
size: async () => {
|
|
1366
|
-
try {
|
|
1367
|
-
return ok(Number((await handle.stat()).size));
|
|
1368
|
-
}
|
|
1369
|
-
catch (error) {
|
|
1370
|
-
return err(toFileError(error, resolved));
|
|
1371
|
-
}
|
|
1372
|
-
},
|
|
1373
|
-
readBytes: async (max, signal) => {
|
|
1374
|
-
if (kind !== "file")
|
|
1375
|
-
return err(new FileError("is_directory", "The held object is a directory", resolved));
|
|
1376
|
-
try {
|
|
1377
|
-
return ok(await readAllFrom(handle, max, () => abortResult(signal, resolved) !== undefined));
|
|
1378
|
-
}
|
|
1379
|
-
catch (error) {
|
|
1380
|
-
return err(toFileError(error, resolved));
|
|
1381
|
-
}
|
|
1382
|
-
},
|
|
1383
|
-
list: async (signal) => {
|
|
1384
|
-
if (kind !== "directory")
|
|
1385
|
-
return err(new FileError("not_directory", "The held object is a file", resolved));
|
|
1386
|
-
if (process.platform === "win32")
|
|
1387
|
-
return err(new FileError("not_supported", "This platform cannot list a held directory", resolved));
|
|
1388
|
-
try {
|
|
1389
|
-
return await this.listOpenDirectory(handle, resolved, identity, signal);
|
|
1390
|
-
}
|
|
1391
|
-
catch (error) {
|
|
1392
|
-
return err(toFileError(error, resolved));
|
|
1393
|
-
}
|
|
1394
|
-
},
|
|
1395
|
-
close: () => handle.close().catch(() => { }),
|
|
1396
|
-
});
|
|
1456
|
+
if (abortSignal?.aborted === true)
|
|
1457
|
+
return refuse("aborted", "aborted");
|
|
1458
|
+
return ok({ handle, held });
|
|
1397
1459
|
}
|
|
1398
1460
|
catch (error) {
|
|
1399
1461
|
return refuse(toFileError(error, resolved).code, error.message ?? "open failed");
|
|
1400
1462
|
}
|
|
1401
1463
|
}
|
|
1402
|
-
async
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
const named = await lstat(resolved, { bigint: true });
|
|
1406
|
-
return held.dev === named.dev && held.ino === named.ino && (await physicalPathOfAsync(resolved)) === resolved;
|
|
1464
|
+
async heldPlace(handle, resolved) {
|
|
1465
|
+
const placed = await readlink(`/proc/self/fd/${handle.fd}`).catch(() => undefined);
|
|
1466
|
+
return placed === undefined ? "unobservable" : placed === resolved ? "at" : "elsewhere";
|
|
1407
1467
|
}
|
|
1408
1468
|
async listOpenDirectory(held, resolved, identity, abortSignal) {
|
|
1409
1469
|
const throughHandle = process.platform === "linux";
|
|
@@ -1595,7 +1655,7 @@ export class NodeExecutionEnv {
|
|
|
1595
1655
|
cwd: options?.cwd ? resolvePath(this.cwd, options.cwd) : this.cwd,
|
|
1596
1656
|
detached: process.platform !== "win32",
|
|
1597
1657
|
env: this.spawnEnv(options?.env),
|
|
1598
|
-
|
|
1658
|
+
...shellChildStdio(spoolFds, false),
|
|
1599
1659
|
windowsHide: true,
|
|
1600
1660
|
});
|
|
1601
1661
|
}
|
|
@@ -148,10 +148,10 @@ export interface UserMessageProvenance {
|
|
|
148
148
|
* text, so annotation stays adjacent to the frame it attributes. */
|
|
149
149
|
actor?: ActorAssertion;
|
|
150
150
|
/** This message carries a person's input — and, when it is the one input a `human_input` frame accounts for, that frame's key
|
|
151
|
-
* (`inputId`; a resume's continuation merging several parked steers is a person's input with no single key).
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* is not a person's input (an engine note, an attachment frame). */
|
|
151
|
+
* (`inputId`; a resume's continuation merging several parked steers is a person's input with no single key). Minted onto the message
|
|
152
|
+
* as its row members `origin: "human_input"` and `inputId` (`personInputRow`: a key that is given and hollow is refused), which the
|
|
153
|
+
* store keeps and `userRowSourceOf` reads — for the commit frame and for a reader of the store alike; never sent to a provider. Absent
|
|
154
|
+
* on every message that is not a person's input (an engine note, an attachment frame): the leg's admission seat stamps those. */
|
|
155
155
|
input?: {
|
|
156
156
|
inputId?: string;
|
|
157
157
|
};
|
|
@@ -457,7 +457,6 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
457
457
|
private toolResultMedia;
|
|
458
458
|
private resilience?;
|
|
459
459
|
private maxToolConcurrency?;
|
|
460
|
-
private streamingToolExecution?;
|
|
461
460
|
private followUpQueue;
|
|
462
461
|
private followUpQueueMode;
|
|
463
462
|
private nextTurnQueue;
|
|
@@ -7,7 +7,7 @@ import { isCredentialHeaderName } from "../../core/secret-env.js";
|
|
|
7
7
|
import { isRunOrigin } from "../../core/run-origin.js";
|
|
8
8
|
import { readBundledAttachments } from "../../core/attachment-source.js";
|
|
9
9
|
import { countsAsOperator, isBlankInput, readInputAuthor } from "../../core/input-author.js";
|
|
10
|
-
import {
|
|
10
|
+
import { personInputRow } from "../../core/user-row-origin.js";
|
|
11
11
|
import { isProviderEchoShape } from "../../brain/errors.js";
|
|
12
12
|
import { convertToLlm } from "./messages.js";
|
|
13
13
|
import { readMember, thrownText } from "../../core/thrown-value.js";
|
|
@@ -54,7 +54,7 @@ function createUserMessage(text, images, provenance) {
|
|
|
54
54
|
if (notices !== undefined)
|
|
55
55
|
message.changedFilesNotices = notices;
|
|
56
56
|
if (provenance?.input !== undefined)
|
|
57
|
-
|
|
57
|
+
Object.assign(message, personInputRow(provenance.input.inputId));
|
|
58
58
|
return message;
|
|
59
59
|
}
|
|
60
60
|
export function turnContextOptions(model) {
|
|
@@ -378,7 +378,6 @@ export class AgentHarness {
|
|
|
378
378
|
toolResultMedia;
|
|
379
379
|
resilience;
|
|
380
380
|
maxToolConcurrency;
|
|
381
|
-
streamingToolExecution;
|
|
382
381
|
followUpQueue = [];
|
|
383
382
|
followUpQueueMode;
|
|
384
383
|
nextTurnQueue = [];
|
|
@@ -423,7 +422,6 @@ export class AgentHarness {
|
|
|
423
422
|
};
|
|
424
423
|
this.resilience = options.resilience;
|
|
425
424
|
this.maxToolConcurrency = options.maxToolConcurrency;
|
|
426
|
-
this.streamingToolExecution = options.streamingToolExecution;
|
|
427
425
|
this.followUpQueueMode = options.followUpMode ?? "one-at-a-time";
|
|
428
426
|
}
|
|
429
427
|
getHandlers(type) {
|
|
@@ -741,9 +739,6 @@ export class AgentHarness {
|
|
|
741
739
|
...this.toolResultMedia,
|
|
742
740
|
...(this.resilience !== undefined ? { resilience: this.resilience } : {}),
|
|
743
741
|
...(this.maxToolConcurrency !== undefined ? { maxToolConcurrency: this.maxToolConcurrency } : {}),
|
|
744
|
-
...(this.streamingToolExecution === true && (this.getHandlers("tool_call")?.size ?? 0) === 0
|
|
745
|
-
? { streamingToolExecution: true }
|
|
746
|
-
: {}),
|
|
747
742
|
convertToLlm: (messages) => stripEngineMetadata(this.holdToolTurnLaw(convertToLlm(messages))),
|
|
748
743
|
shouldStopAfterTurn: () => this.consultStopLatch("post_turn"),
|
|
749
744
|
shouldHaltBeforeTurn: () => this.consultStopLatch("pre_turn"),
|
|
@@ -315,9 +315,13 @@ export interface FileInfo {
|
|
|
315
315
|
*/
|
|
316
316
|
mode?: number;
|
|
317
317
|
}
|
|
318
|
-
/** A filesystem object
|
|
319
|
-
*
|
|
320
|
-
*
|
|
318
|
+
/** A filesystem object bound by {@link FileSystem.openBound}: every answer is about THIS object or is a refusal. A backend
|
|
319
|
+
* that holds a handle answers from it, whatever the path names later; one that binds again on every answer opens the
|
|
320
|
+
* canonical path, answers only when one observation of that open places it at the path with the identity and kind it
|
|
321
|
+
* had when bound (else `precondition_failed`), takes every byte, size and entry from that open alone, and may refuse
|
|
322
|
+
* after a rename or a removal — equal identities across two opens do not prove one object once an inode is reused.
|
|
323
|
+
* `list` reads a directory's entries through the held object where the backend can; where it cannot, it lists the path
|
|
324
|
+
* once and requires the path to name the held object afterwards (the implementation says where). */
|
|
321
325
|
export interface BoundFileObject {
|
|
322
326
|
/** `<device>:<inode>` of the held object. */
|
|
323
327
|
readonly identity: string;
|
|
@@ -378,6 +382,10 @@ export interface ExecutionEnvExecOptions {
|
|
|
378
382
|
* without it. Carried only to an environment that declares {@link ExecutionEnvCapabilities.commandSandbox}, only by a start
|
|
379
383
|
* a model-written command makes in a run that requires the sandbox. Absent ⇒ the start runs as it always did. */
|
|
380
384
|
sandbox?: CommandSandboxInstruction;
|
|
385
|
+
/** The bytes this start's standard input carries, then its end (a program reading `-` reads exactly them, no path): how an
|
|
386
|
+
* engine reader hands a program a file {@link FileSystem.openBound} held — carried only to an environment whose `openBound`
|
|
387
|
+
* held it, which writes them (ignored ⇒ the program reads empty input, never another file). Absent ⇒ empty, as before. */
|
|
388
|
+
stdinFrom?: Uint8Array;
|
|
381
389
|
}
|
|
382
390
|
/** The read-deny table one command start carries ({@link ExecutionEnvExecOptions.readFloor}); what an environment keeps of it is INTEGRATION-CORE §11.1.
|
|
383
391
|
* Path semantics: a path is judged as spelled, never resolved (a hard link is another path; a symbolic link is resolved where the environment opens it). Pinned at the start: a floor with an `id` judges with that start's table for its processes' life. Exec is no read: a `#!` line's bytes, a self-printing binary (KNOWN-LIMITS KL-3190-a). */
|
|
@@ -473,7 +481,7 @@ export interface FileSystem {
|
|
|
473
481
|
fileInfo(path: string, abortSignal?: AbortSignal): Promise<Result<FileInfo, FileError>>;
|
|
474
482
|
/**
|
|
475
483
|
* design/381 DV-8 — OPTIONAL companion of {@link FileInfo.mode}: set the addressed object's POSIX
|
|
476
|
-
* permission bits (`mode & 0o7777`),
|
|
484
|
+
* permission bits (`mode & 0o7777`), no symlink on the path followed, leaf or directory (an env whose backend can only chmod
|
|
477
485
|
* through a link omits this method rather than following one — a restore must never re-permission
|
|
478
486
|
* a file it was pointed at by a link it did not verify).
|
|
479
487
|
*
|
|
@@ -498,10 +506,14 @@ export interface FileSystem {
|
|
|
498
506
|
/** OPTIONAL: the identity of the object `path` names, links followed (`<device>:<inode>` on POSIX, exact): equal answers name one object, where
|
|
499
507
|
* a firmlink or bind mount keeps its own {@link canonicalPath}. Home-anchored deny rows are placed by it; omitted ⇒ by spelling only. */
|
|
500
508
|
fileIdentity?(path: string, abortSignal?: AbortSignal): Promise<Result<string, FileError>>;
|
|
501
|
-
/** OPTIONAL: open the file or directory at a canonical `path` and
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
*
|
|
509
|
+
/** OPTIONAL: open the file or directory at a canonical `path` and BIND it ({@link BoundFileObject}): no answer ever comes
|
|
510
|
+
* from an object reached through a link, and the object is placed at the path by ONE observation — an open that refuses
|
|
511
|
+
* a link anywhere on the path, or the kernel's path of the opened descriptor — never by separate reads of the path
|
|
512
|
+
* (else `precondition_failed`). An open that cannot refuse a link may pass through one and is then refused; it is
|
|
513
|
+
* bounded (a FIFO blocks it, a device has its open-time effects) and made with no more reach than the run's own
|
|
514
|
+
* commands. A backend that cannot make that one observation on this target answers `not_supported`, which every caller
|
|
515
|
+
* reads exactly as this member's absence. A caller judges the bound object and then reads, sizes or lists that same
|
|
516
|
+
* object; it closes it. Omitted, or `not_supported` ⇒ a caller that must bind its read to what it judged does not read. */
|
|
505
517
|
openBound?(path: string, abortSignal?: AbortSignal): Promise<Result<BoundFileObject, FileError>>;
|
|
506
518
|
/** Return false for missing paths. Other errors, such as permission failures, return a {@link FileError}. */
|
|
507
519
|
exists(path: string, abortSignal?: AbortSignal): Promise<Result<boolean, FileError>>;
|
|
@@ -920,13 +932,18 @@ export interface SessionCheckoutDeclared {
|
|
|
920
932
|
baseRef?: "fresh" | "head";
|
|
921
933
|
name?: string;
|
|
922
934
|
sources?: SessionCheckoutSource[];
|
|
935
|
+
/** The roots whose repositories are isolated; absent ⇒ the task root alone. */
|
|
936
|
+
roots?: Array<"taskRoot" | {
|
|
937
|
+
directory: string;
|
|
938
|
+
}>;
|
|
923
939
|
}
|
|
924
940
|
/** One repository of a session checkout. `dir` / `name` / `branch` / `baseRef` are present together iff the repository is
|
|
925
941
|
* isolated (the session's own tree); `source` iff a declared source names this repository. */
|
|
926
942
|
export interface SessionCheckoutCell {
|
|
927
943
|
/** The repository's main worktree root (canonical) — the repository this cell answers for. */
|
|
928
944
|
repository: string;
|
|
929
|
-
/**
|
|
945
|
+
/** The declared root this cell was made for: for a tree, the first listed root (`roots`, in its order) in this repository;
|
|
946
|
+
* for a repository with no tree, its source's root. Every other declared root in the repository lives in the same cell. */
|
|
930
947
|
root: "taskRoot" | {
|
|
931
948
|
directory: string;
|
|
932
949
|
};
|
|
@@ -1058,6 +1075,28 @@ export declare const SESSION_CHECKOUT_MAX_CELLS = 64;
|
|
|
1058
1075
|
* a checkout that cannot be read is a checkout the session cannot use).
|
|
1059
1076
|
*/
|
|
1060
1077
|
export declare function normalizeSessionCheckout(value: unknown): SessionCheckoutRecord | undefined;
|
|
1078
|
+
/**
|
|
1079
|
+
* #3468: a compaction's restatement of ONE session's checkout (`details.sessionCheckout`) — what the record reader answered for
|
|
1080
|
+
* `sessionId` when the compaction was written: its record (with `released` when released), no record, or a record it could not
|
|
1081
|
+
* read. A storage woken from a bounded window (F3) loads no entry below its floor, and the newest compaction is always inside
|
|
1082
|
+
* that window, so the restatement carries the record across it (a window cut in log order then reads what the whole log reads; one
|
|
1083
|
+
* cut along the branch alone does not load other branches, KNOWN-LIMITS KL-3468-b). The engine writes it (`Session.appendCompaction`),
|
|
1084
|
+
* and only a fact of the log that later entries can add to (a release) but never overturn, and that does not depend on the view it was
|
|
1085
|
+
* read through: a record; an `unreadable` no window's floor alone causes; `none` once the session can no longer declare a checkout (a
|
|
1086
|
+
* fork's `none` is never stated). A reader treats it as one more copy of the same fact; the import door refuses one that contradicts the allocation
|
|
1087
|
+
* entry its log holds. `details.sessionCheckout` is the engine's key: a caller of `appendCompaction` that names it is refused.
|
|
1088
|
+
*/
|
|
1089
|
+
export type SessionCheckoutStatement = {
|
|
1090
|
+
readonly sessionId: string;
|
|
1091
|
+
readonly kind: "none" | "unreadable";
|
|
1092
|
+
} | {
|
|
1093
|
+
readonly sessionId: string;
|
|
1094
|
+
readonly kind: "record";
|
|
1095
|
+
readonly record: SessionCheckoutRecord;
|
|
1096
|
+
};
|
|
1097
|
+
/** The strict shape gate of a {@link SessionCheckoutStatement} — the ONE normalization its write, its read and the import door
|
|
1098
|
+
* use. A `record` statement holds a valid record of the statement's own session; `undefined` = not a valid statement. */
|
|
1099
|
+
export declare function normalizeSessionCheckoutStatement(value: unknown): SessionCheckoutStatement | undefined;
|
|
1061
1100
|
/** Bounded caps for {@link normalizeAnnouncedListing} — a roster is dozens of names, never thousands;
|
|
1062
1101
|
* a "name" is a short identifier, never a document. Oversize ⇒ structurally invalid (forgery signal). */
|
|
1063
1102
|
export declare const ANNOUNCED_LISTING_MAX_NAMES = 500;
|
|
@@ -1148,7 +1187,7 @@ export interface SessionMetadata {
|
|
|
1148
1187
|
* {@link SessionPlacementRecord}). Absent on every ordinary (host-lane) session; a repo that does
|
|
1149
1188
|
* not understand placement never surfaces it (additive, old readers tolerate). */
|
|
1150
1189
|
placement?: SessionPlacementRecord;
|
|
1151
|
-
/** WHICH occupant this row is: minted by the repo once when the row comes into existence (create / fork / import onto an absent id), carried by every other write; only compared; absent = UNKNOWN, never backfilled; not wire / model-context material. */
|
|
1190
|
+
/** WHICH occupant this row is: minted by the repo once when the row comes into existence (create / fork / import onto an absent id), carried by every other write; only compared; absent = UNKNOWN, never backfilled; not wire / model-context material. A token the bundled mint point (`incarnationCell`) minted ends in `.2` and states one fact: the row was born from that write, so what is recorded per occupant for it (its file history, `fileHistoryScopeOf`) is at its address; any other value states nothing about that. An opaque string of at most 64 characters to a host that stores it. */
|
|
1152
1191
|
incarnation?: string;
|
|
1153
1192
|
/** Fork lineage's OCCUPANT half: the source row's `incarnation` at fork time (the occupant copied, not whoever holds `forkedFrom` later); absent = unknown. */
|
|
1154
1193
|
forkedFromIncarnation?: string;
|
|
@@ -1230,6 +1269,8 @@ export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetad
|
|
|
1230
1269
|
setLeafId(leafId: string | null, opts?: SessionWriteOptions): Promise<void>;
|
|
1231
1270
|
createEntryId(): Promise<string>;
|
|
1232
1271
|
appendEntry(entry: SessionTreeEntry, opts?: SessionWriteOptions): Promise<void>;
|
|
1272
|
+
/** The entry of THIS session's log with that id, or undefined. A backend that wakes a bounded window ({@link getFloorId}) answers an id below
|
|
1273
|
+
* its floor too: a branch target (`resumeAt`) and a file-rewind target are judged by this read. */
|
|
1233
1274
|
getEntry(id: string): Promise<SessionTreeEntry | undefined>;
|
|
1234
1275
|
findEntries<TType extends SessionTreeEntry["type"]>(type: TType): Promise<Array<Extract<SessionTreeEntry, {
|
|
1235
1276
|
type: TType;
|
|
@@ -1811,15 +1852,6 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
|
|
|
1811
1852
|
resilience?: import("../llm/types.js").ResilienceOptions;
|
|
1812
1853
|
/** design/120 P1: parallel-batch tool concurrency cap forwarded to the loop (default 10). */
|
|
1813
1854
|
maxToolConcurrency?: number;
|
|
1814
|
-
/**
|
|
1815
|
-
* design/120 P2: opt in to in-stream tool execution (safe tool calls start while the model is
|
|
1816
|
-
* still streaming). Default OFF. The harness forwards this to the loop ONLY when no `tool_call`
|
|
1817
|
-
* hook handler is registered at run start (snapshot per prompt()) — a policy/approval gate on
|
|
1818
|
-
* that hook could durably suspend, which has no stable leaf mid-stream. Hosts that register a
|
|
1819
|
-
* suspending `tool_call` handler mid-run after opting in get undefined behavior (documented
|
|
1820
|
-
* contract, see AgentLoopConfig.streamingToolExecution).
|
|
1821
|
-
*/
|
|
1822
|
-
streamingToolExecution?: boolean;
|
|
1823
1855
|
/** The one seat every row passes at each harness commit point (a row the loop ends, an API failure's record, a row handed
|
|
1824
1856
|
* to {@link AgentHarness.appendMessage}), before the live context and the store; absent ⇒ every row passes as made. */
|
|
1825
1857
|
admitRows?: RowAdmission;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { asThrownError } from "../../core/thrown-value.js";
|
|
2
|
+
import { isTextContentHash } from "../../core/canonical-json.js";
|
|
2
3
|
export function ok(value) {
|
|
3
4
|
return { ok: true, value };
|
|
4
5
|
}
|
|
@@ -99,7 +100,7 @@ export function normalizeGitAnnouncement(v) {
|
|
|
99
100
|
const src = v;
|
|
100
101
|
if (src.kind !== "full" && src.kind !== "degraded" && src.kind !== "unavailable" && src.kind !== "non-repo")
|
|
101
102
|
return undefined;
|
|
102
|
-
if (
|
|
103
|
+
if (!isTextContentHash(src.hash))
|
|
103
104
|
return undefined;
|
|
104
105
|
if (src.entryId !== undefined && (typeof src.entryId !== "string" || src.entryId.length === 0 || src.entryId.length > GIT_ANNOUNCEMENT_MAX_ENTRY_ID_CHARS))
|
|
105
106
|
return undefined;
|
|
@@ -205,10 +206,23 @@ export function normalizeSessionCheckout(value) {
|
|
|
205
206
|
sources.push(shaped);
|
|
206
207
|
}
|
|
207
208
|
}
|
|
209
|
+
let roots;
|
|
210
|
+
if (d.roots !== undefined) {
|
|
211
|
+
if (d.isolation === undefined || !Array.isArray(d.roots) || d.roots.length === 0 || d.roots.length > SESSION_CHECKOUT_MAX_CELLS)
|
|
212
|
+
return undefined;
|
|
213
|
+
roots = [];
|
|
214
|
+
for (const r of d.roots) {
|
|
215
|
+
const shaped = normalizeCheckoutRoot(r);
|
|
216
|
+
if (shaped === undefined)
|
|
217
|
+
return undefined;
|
|
218
|
+
roots.push(shaped);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
208
221
|
const declared = {
|
|
209
222
|
...(d.isolation !== undefined ? { isolation: "worktree" } : {}),
|
|
210
223
|
...(d.baseRef !== undefined ? { baseRef: d.baseRef } : {}),
|
|
211
224
|
...(d.name !== undefined ? { name: d.name } : {}),
|
|
225
|
+
...(roots !== undefined ? { roots } : {}),
|
|
212
226
|
...(sources !== undefined ? { sources } : {}),
|
|
213
227
|
};
|
|
214
228
|
if (!Array.isArray(v.checkouts) || v.checkouts.length > SESSION_CHECKOUT_MAX_CELLS)
|
|
@@ -252,6 +266,19 @@ export function normalizeSessionCheckout(value) {
|
|
|
252
266
|
}
|
|
253
267
|
return { allocationId: v.allocationId, sessionId: v.sessionId, declared, checkouts, ...(v.released === true ? { released: true } : {}) };
|
|
254
268
|
}
|
|
269
|
+
export function normalizeSessionCheckoutStatement(value) {
|
|
270
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
271
|
+
return undefined;
|
|
272
|
+
const v = value;
|
|
273
|
+
if (typeof v.sessionId !== "string" || v.sessionId.length === 0 || v.sessionId.length > 512)
|
|
274
|
+
return undefined;
|
|
275
|
+
if (v.kind === "none" || v.kind === "unreadable")
|
|
276
|
+
return v.record === undefined ? { sessionId: v.sessionId, kind: v.kind } : undefined;
|
|
277
|
+
if (v.kind !== "record")
|
|
278
|
+
return undefined;
|
|
279
|
+
const record = normalizeSessionCheckout(v.record);
|
|
280
|
+
return record !== undefined && record.sessionId === v.sessionId ? { sessionId: v.sessionId, kind: "record", record } : undefined;
|
|
281
|
+
}
|
|
255
282
|
export const ANNOUNCED_LISTING_MAX_NAMES = 500;
|
|
256
283
|
export const ANNOUNCED_LISTING_MAX_NAME_CHARS = 200;
|
|
257
284
|
export const ANNOUNCED_MCP_ERROR_MAX_CHARS = 400;
|