@sema-agent/core 7.54.1 → 7.56.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 +950 -0
- package/dist/agents/agent-transcript-tool.js +2 -1
- package/dist/agents/builtin-agents.d.ts +12 -14
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.d.ts +36 -0
- package/dist/agents/cc-peer-directory.js +139 -0
- package/dist/agents/cc-peer-wire.d.ts +105 -0
- package/dist/agents/cc-peer-wire.js +98 -0
- package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
- package/dist/agents/cc-uds-peer-channel.js +457 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/cross-session-envelope.d.ts +4 -1
- package/dist/agents/cross-session-envelope.js +8 -1
- package/dist/agents/cross-session-judge.d.ts +2 -2
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +9 -8
- package/dist/agents/observer.d.ts +4 -5
- package/dist/agents/observer.js +2 -1
- package/dist/agents/peer-admission.d.ts +6 -0
- package/dist/agents/peer-admission.js +4 -1
- package/dist/agents/peer-directory.d.ts +65 -13
- package/dist/agents/peer-directory.js +90 -25
- package/dist/agents/peer-notices.d.ts +1 -1
- package/dist/agents/peer-session-drain.d.ts +3 -1
- package/dist/agents/peer-session-drain.js +3 -2
- package/dist/agents/read-inbox-tool.js +2 -1
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/send-message-tool.d.ts +10 -0
- package/dist/agents/send-message-tool.js +37 -8
- package/dist/agents/subagent.d.ts +39 -82
- package/dist/agents/subagent.js +109 -106
- package/dist/agents/tool-filter.d.ts +31 -46
- package/dist/agents/tool-filter.js +13 -33
- package/dist/agents/verify.d.ts +6 -5
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +43 -81
- package/dist/brain/errors.d.ts +15 -0
- package/dist/brain/errors.js +10 -0
- 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 +6 -12
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +27 -35
- package/dist/brain/openai.js +30 -98
- package/dist/brain/provider-dialect.d.ts +39 -3
- package/dist/brain/provider-dialect.js +28 -0
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +12 -12
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +62 -9
- package/dist/brain/request-params.js +42 -7
- package/dist/brain/retry.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +15 -0
- package/dist/brain/route-adjudicator.js +15 -0
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.js +6 -5
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/advisor-verdict.d.ts +120 -0
- package/dist/core/advisor-verdict.js +92 -0
- package/dist/core/agent-definition.d.ts +17 -8
- package/dist/core/allow-entry.d.ts +69 -36
- package/dist/core/allow-entry.js +81 -52
- package/dist/core/allow-rule-shadow.d.ts +10 -3
- package/dist/core/approval-object.d.ts +2 -1
- package/dist/core/approval-object.js +6 -6
- package/dist/core/ask-origin.d.ts +127 -29
- package/dist/core/ask-origin.js +87 -25
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +12 -7
- 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 +11 -8
- package/dist/core/auto-compaction.js +4 -2
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/auto-mode-defaults.d.ts +8 -8
- package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
- package/dist/core/auto-mode-prompt.d.ts +1 -1
- package/dist/core/auto-mode.d.ts +17 -9
- package/dist/core/auto-mode.js +9 -6
- package/dist/core/background-agent-store.d.ts +3 -3
- package/dist/core/canonical-json.d.ts +1 -1
- package/dist/core/canonical-json.js +2 -2
- 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 -4
- package/dist/core/checkpoint-requirements.js +8 -14
- package/dist/core/checkpoint-store.d.ts +165 -72
- package/dist/core/checkpoint-store.js +79 -82
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +3 -16
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/context-edit.d.ts +6 -7
- package/dist/core/cross-boundary-taint.d.ts +11 -4
- package/dist/core/cross-boundary-taint.js +3 -3
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +19 -19
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- package/dist/core/effective-path-target.d.ts +1 -1
- 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 +45 -12
- package/dist/core/exec-output-tail.d.ts +1 -1
- package/dist/core/file-history-retention.d.ts +1 -1
- package/dist/core/file-history-store.d.ts +147 -21
- package/dist/core/file-history-store.js +58 -32
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -11
- package/dist/core/gate-lanes.js +81 -68
- package/dist/core/gate-outcome.d.ts +40 -6
- package/dist/core/gate-outcome.js +56 -0
- package/dist/core/governance-codes.d.ts +17 -3
- package/dist/core/governance-codes.js +16 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +21 -20
- 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 +84 -0
- package/dist/core/host-target.js +92 -0
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/lsp-diagnostics.d.ts +4 -4
- package/dist/core/lsp.d.ts +3 -3
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mcp-connection-pool.d.ts +18 -2
- package/dist/core/mcp-connection-pool.js +53 -6
- package/dist/core/mcp-failure.d.ts +23 -4
- package/dist/core/mcp-failure.js +26 -11
- package/dist/core/mcp-listing-drift.d.ts +10 -0
- package/dist/core/mcp-listing-drift.js +6 -0
- package/dist/core/mcp-server-link.d.ts +173 -0
- package/dist/core/mcp-server-link.js +127 -0
- package/dist/core/mcp-server-spec.d.ts +4 -2
- package/dist/core/mcp-session-end.d.ts +26 -0
- package/dist/core/mcp-session-end.js +29 -0
- package/dist/core/mcp-startup-request.d.ts +17 -0
- package/dist/core/mcp-startup-request.js +17 -0
- package/dist/core/mcp.d.ts +17 -13
- package/dist/core/mcp.js +240 -189
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/engine.d.ts +9 -9
- 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 +65 -6
- package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
- package/dist/core/memory-engine/tools.js +4 -1
- package/dist/core/mode-policy.d.ts +1 -1
- 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 +44 -24
- package/dist/core/namespaced-rule-name.js +50 -43
- package/dist/core/output-style.d.ts +1 -1
- package/dist/core/param-rule-reach.d.ts +15 -0
- package/dist/core/param-rule-reach.js +30 -0
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +6 -0
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/pause-registry.d.ts +16 -5
- package/dist/core/pause-registry.js +6 -2
- package/dist/core/peer-channel.d.ts +70 -0
- package/dist/core/peer-channel.js +1 -0
- package/dist/core/permission-rule-consent.d.ts +30 -5
- package/dist/core/permission-rule-consent.js +147 -50
- package/dist/core/permission-rule-model.d.ts +245 -65
- package/dist/core/permission-rule-model.js +421 -107
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +7 -3
- package/dist/core/permission-rule-provider.d.ts +6 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +22 -26
- package/dist/core/permission-rule-store.js +12 -6
- package/dist/core/permission-rule-sync.d.ts +11 -2
- package/dist/core/permission-rule-sync.js +11 -3
- 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 +53 -15
- package/dist/core/permission-rules.js +125 -100
- package/dist/core/persisted-rule-arms.d.ts +6 -4
- package/dist/core/persisted-rule-arms.js +10 -12
- package/dist/core/present-plan-tool.js +3 -1
- 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 +26 -5
- package/dist/core/protocol-http-auth.js +137 -4
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/read-only-shell-table.d.ts +1 -1
- package/dist/core/read-only-shell.d.ts +1 -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 +34 -3
- package/dist/core/roles.js +66 -53
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-offer-read.d.ts +53 -0
- package/dist/core/rule-offer-read.js +146 -0
- package/dist/core/rule-owner.d.ts +46 -0
- package/dist/core/rule-owner.js +29 -0
- package/dist/core/runner/advisor-instructions.d.ts +70 -0
- package/dist/core/runner/advisor-instructions.js +61 -0
- package/dist/core/runner/advisor-tool.d.ts +33 -0
- package/dist/core/runner/advisor-tool.js +112 -0
- package/dist/core/runner/announce-once-ledger.d.ts +18 -26
- package/dist/core/runner/announce-once-ledger.js +19 -46
- package/dist/core/runner/approval-feedback.js +6 -3
- package/dist/core/runner/assemble-result.d.ts +2 -1
- 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 +21 -2
- package/dist/core/runner/caller-roster.js +38 -0
- 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 +33 -13
- package/dist/core/runner/classifier-ladder.js +15 -14
- package/dist/core/runner/compaction-restate.d.ts +10 -6
- package/dist/core/runner/compaction-restate.js +9 -3
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +40 -33
- package/dist/core/runner/conversation-segment.d.ts +28 -0
- package/dist/core/runner/conversation-segment.js +42 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
- package/dist/core/runner/cross-boundary-lane.js +58 -34
- package/dist/core/runner/decide-continuation.d.ts +7 -4
- package/dist/core/runner/decide-continuation.js +2 -2
- package/dist/core/runner/denial-limit-arms.d.ts +4 -4
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +24 -24
- package/dist/core/runner/derived-route-fallback.js +9 -7
- 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 +9 -3
- package/dist/core/runner/gate-exit.js +11 -5
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.js +38 -15
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +19 -8
- package/dist/core/runner/prepare-advisor.d.ts +63 -0
- package/dist/core/runner/prepare-advisor.js +77 -0
- 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 +5 -4
- package/dist/core/runner/prepare-config-doors.d.ts +31 -38
- package/dist/core/runner/prepare-config-doors.js +57 -34
- 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-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +41 -73
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
- package/dist/core/runner/prepare-gate-stations.js +12 -8
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
- package/dist/core/runner/prepare-hands-readface.js +15 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
- package/dist/core/runner/prepare-inherited-gate.js +8 -6
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +12 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
- package/dist/core/runner/prepare-policy-chain.js +68 -81
- package/dist/core/runner/prepare-project-context.d.ts +5 -2
- package/dist/core/runner/prepare-project-context.js +6 -3
- 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 +4 -6
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +5 -4
- package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
- package/dist/core/runner/prepare-safety-scan.js +8 -23
- 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 +1 -1
- package/dist/core/runner/prepare-task.js +41 -35
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
- 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 +11 -4
- 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/resume-policy-outcome.js +1 -1
- package/dist/core/runner/retired-runner-deps.js +2 -1
- package/dist/core/runner/rewind-files.d.ts +15 -0
- package/dist/core/runner/rewind-files.js +132 -0
- package/dist/core/runner/run-attachment-seats.js +2 -2
- 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-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -12
- package/dist/core/runner/run-git-lane.d.ts +1 -0
- package/dist/core/runner/run-harness-handlers.js +14 -7
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +43 -18
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/run-turn-boundary.d.ts +1 -0
- package/dist/core/runner/run-turn-boundary.js +15 -22
- package/dist/core/runner/runtask.d.ts +3 -0
- package/dist/core/runner/runtask.js +8 -9
- 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.d.ts +22 -21
- package/dist/core/runner/session-rule-policy.js +17 -31
- 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/side-call-account.d.ts +32 -8
- package/dist/core/runner/side-call-account.js +23 -1
- package/dist/core/runner/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +1 -1
- package/dist/core/runner/strict-output-schema.d.ts +1 -1
- package/dist/core/runner/sub-agent-deny-lists.js +4 -6
- package/dist/core/runner/synthetic-tools.d.ts +16 -13
- package/dist/core/runner/synthetic-tools.js +8 -3
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +3 -4
- 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-face-overlay.d.ts +2 -1
- package/dist/core/runner/tool-face-overlay.js +17 -1
- 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/tool-progress-lane.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
- package/dist/core/runner/turn-attachments.d.ts +91 -80
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +42 -42
- package/dist/core/runtime-caps.d.ts +4 -4
- 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 +26 -2
- package/dist/core/same-plain-value.d.ts +40 -0
- package/dist/core/same-plain-value.js +49 -0
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/secret-env.d.ts +26 -3
- package/dist/core/secret-env.js +44 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +1 -1
- package/dist/core/session-policy-store.d.ts +102 -35
- package/dist/core/session-policy-store.js +210 -48
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +106 -37
- package/dist/core/session-store.js +165 -91
- package/dist/core/session.d.ts +101 -57
- package/dist/core/session.js +53 -0
- package/dist/core/shared-memory/tools.js +3 -1
- package/dist/core/shared-memory/types.d.ts +1 -1
- 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.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.d.ts +10 -0
- package/dist/core/side-query.js +15 -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/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
- package/dist/core/store-contracts/file-history-store-contract.js +74 -4
- 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-policy-store-contract.d.ts +7 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
- package/dist/core/store-contracts/session-repo-contract.js +176 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
- package/dist/core/store-contracts/session-store-contract.js +361 -51
- package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/surrogate-safe-slice.d.ts +3 -3
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +42 -8
- package/dist/core/task-notification.d.ts +19 -15
- package/dist/core/task-registry-agent.d.ts +4 -4
- package/dist/core/task-registry-shared.d.ts +4 -4
- package/dist/core/task-registry-shared.js +1 -0
- package/dist/core/task-registry.d.ts +13 -4
- package/dist/core/task-registry.js +14 -2
- package/dist/core/task-result.d.ts +21 -3
- package/dist/core/task-spec.d.ts +69 -64
- package/dist/core/task-stream.d.ts +6 -6
- package/dist/core/task-tool-shape.d.ts +4 -4
- package/dist/core/tighten-task-spec.d.ts +1 -1
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +36 -2
- package/dist/core/tool-catalog-entries.js +69 -43
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-conformance.js +1 -0
- package/dist/core/tool-errors.d.ts +2 -2
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-face.d.ts +21 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +29 -8
- package/dist/core/tool-name-aliases.js +22 -4
- package/dist/core/tool-name-readings.d.ts +10 -43
- package/dist/core/tool-name-readings.js +2 -11
- package/dist/core/tool-policy.d.ts +85 -196
- package/dist/core/tool-policy.js +150 -175
- package/dist/core/tool-registry.d.ts +14 -7
- package/dist/core/tool-registry.js +17 -7
- package/dist/core/tool-result-store.js +5 -1
- package/dist/core/tool-roster.d.ts +57 -33
- package/dist/core/tool-roster.js +56 -68
- package/dist/core/tool-spec-members.js +8 -3
- package/dist/core/tool-spec.d.ts +53 -31
- package/dist/core/tools.js +51 -10
- package/dist/core/trace.d.ts +6 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/warm-resume.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +58 -0
- package/dist/core/wiring-manifest.js +14 -5
- package/dist/core/workflow-journal-store.d.ts +62 -0
- package/dist/core/workflow-journal-store.js +78 -2
- package/dist/core/workflow-run-store.d.ts +6 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +9 -9
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
- package/dist/engine/execution-env/node-execution-env.js +54 -24
- package/dist/engine/harness/agent-harness.d.ts +39 -9
- package/dist/engine/harness/agent-harness.js +87 -33
- package/dist/engine/harness/types.d.ts +58 -9
- package/dist/engine/harness/types.js +12 -1
- package/dist/engine/llm/types.d.ts +36 -19
- package/dist/engine/llm/validation.d.ts +4 -1
- package/dist/engine/llm/validation.js +13 -1
- package/dist/engine/loop/agent-loop.d.ts +23 -1
- package/dist/engine/loop/agent-loop.js +26 -34
- package/dist/engine/loop/types.d.ts +31 -19
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/memory-repo.d.ts +18 -12
- package/dist/engine/session/memory-repo.js +24 -9
- package/dist/engine/session/parent-chain-guard.d.ts +3 -2
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +32 -3
- package/dist/engine/session/repo-utils.js +50 -5
- package/dist/index.d.ts +47 -23
- package/dist/index.js +35 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +3 -3
- package/dist/internal/harness.js +2 -2
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +8 -6
- package/dist/orchestration/run-workflow-tool.js +10 -6
- package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
- package/dist/orchestration/workflow-types.d.ts +18 -0
- package/dist/orchestration/workflow-types.js +6 -0
- package/dist/orchestration/workflow.d.ts +5 -13
- package/dist/orchestration/workflow.js +57 -49
- 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 +2 -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 +39 -2
- package/dist/prompt-assembly/tool-catalog.js +117 -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/prompts/default.d.ts +14 -14
- package/dist/scenarios/full-body.d.ts +15 -15
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.d.ts +4 -3
- package/dist/stores/file/adoption/adopt.js +27 -33
- package/dist/stores/file/adoption/marker.d.ts +6 -13
- package/dist/stores/file/adoption/marker.js +9 -17
- package/dist/stores/file/checkpoint-store.d.ts +24 -0
- package/dist/stores/file/checkpoint-store.js +45 -7
- package/dist/stores/file/file-history-store.d.ts +20 -19
- package/dist/stores/file/file-history-store.js +157 -141
- package/dist/stores/file/fs-atomic.d.ts +15 -0
- package/dist/stores/file/fs-atomic.js +89 -14
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +3 -0
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
- package/dist/stores/file/permission-rule-adopt.js +18 -18
- package/dist/stores/file/permission-rule-store.d.ts +18 -2
- package/dist/stores/file/permission-rule-store.js +31 -18
- package/dist/stores/file/session-policy-store.d.ts +3 -3
- package/dist/stores/file/session-store.d.ts +54 -16
- package/dist/stores/file/session-store.js +114 -85
- package/dist/stores/file/workflow-journal-store.d.ts +10 -4
- package/dist/stores/file/workflow-journal-store.js +28 -13
- package/dist/tools/artifact/artifact-text.d.ts +1 -1
- package/dist/tools/artifact/artifact-tool.js +5 -3
- 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 +3 -3
- package/dist/tools/fs/fs-bash.d.ts +2 -2
- package/dist/tools/fs/fs-bash.js +8 -6
- 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/fs-shared.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
- package/dist/tools/fs/notebook.d.ts +2 -2
- package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
- package/dist/tools/fs/pattern-kill-guard.js +397 -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/read-deny.d.ts +29 -7
- package/dist/tools/fs/read-deny.js +63 -22
- package/dist/tools/fs/removal-targets.d.ts +18 -8
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +16 -6
- 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.js +12 -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-judge.d.ts +4 -0
- package/dist/tools/fs/shell-read-judge.js +5 -2
- 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/loop-tick.d.ts +2 -2
- package/dist/tools/scheduler-tools.js +5 -1
- package/dist/tools/task-list.d.ts +7 -7
- package/dist/tools/task-list.js +5 -1
- package/dist/tools/todo.js +65 -64
- package/dist/tools/web.d.ts +20 -15
- package/dist/tools/web.js +55 -69
- package/dist/tools/worktree.d.ts +3 -3
- package/dist/tools/worktree.js +3 -1
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +5894 -5638
- package/wire-changes/core@7.55.0.json +3318 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
- package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { strict as assert } from "node:assert";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { SESSION_RULES_GRAMMAR, SessionPolicyError, readSessionRulesShape } from "../session-policy-store.js";
|
|
4
|
+
import { beginContract } from "./contract-harness.js";
|
|
5
|
+
const OWNER = "kit-owner";
|
|
6
|
+
const G = SESSION_RULES_GRAMMAR;
|
|
7
|
+
const A = "KitToolA";
|
|
8
|
+
const B = "KitToolB";
|
|
9
|
+
const fresh = () => `kit-2151-${randomUUID()}`;
|
|
10
|
+
const isLoosenRefusal = (e) => e instanceof SessionPolicyError && e.code === "loosen_forbidden";
|
|
11
|
+
async function partOf(store, sessionId) {
|
|
12
|
+
const row = await store.getRules(sessionId, OWNER);
|
|
13
|
+
assert.ok(row !== null, "the row the case wrote must read back");
|
|
14
|
+
const read = readSessionRulesShape(row);
|
|
15
|
+
assert.ok(!("fault" in read), `the stored row must read as rules: ${"fault" in read ? read.sentence : ""}`);
|
|
16
|
+
return read.rules.operatorRules;
|
|
17
|
+
}
|
|
18
|
+
export async function sessionPolicyStoreContract(make, runAssertion) {
|
|
19
|
+
const { run, settle } = beginContract(runAssertion);
|
|
20
|
+
run("a non-operator write over no row stamps an EMPTY operator part — the owner takes its own deny back", async () => {
|
|
21
|
+
const store = make();
|
|
22
|
+
const sid = fresh();
|
|
23
|
+
await store.putRules(sid, OWNER, { toolDeny: [A] });
|
|
24
|
+
assert.deepEqual(await partOf(store, sid), { grammar: G });
|
|
25
|
+
const back = await store.putRules(sid, OWNER, {});
|
|
26
|
+
assert.equal(back.toolDeny, undefined);
|
|
27
|
+
assert.deepEqual(await partOf(store, sid), { grammar: G });
|
|
28
|
+
});
|
|
29
|
+
run("an operator write's whole value is the operator's: no part on the row, and the owner's drop of its entry is refused with nothing written", async () => {
|
|
30
|
+
const store = make();
|
|
31
|
+
const sid = fresh();
|
|
32
|
+
const stored = await store.putRules(sid, OWNER, { toolDeny: [A] }, { operator: true });
|
|
33
|
+
assert.equal(await partOf(store, sid), undefined);
|
|
34
|
+
await assert.rejects(store.putRules(sid, OWNER, {}), isLoosenRefusal);
|
|
35
|
+
const row = await store.getRules(sid, OWNER);
|
|
36
|
+
assert.equal(row?.rev, stored.rev);
|
|
37
|
+
assert.deepEqual(row?.toolDeny, [A]);
|
|
38
|
+
});
|
|
39
|
+
run("an owner write over an operator row carries the operator's buckets as its part — above them it adds and takes back, below them it is refused", async () => {
|
|
40
|
+
const store = make();
|
|
41
|
+
const sid = fresh();
|
|
42
|
+
await store.putRules(sid, OWNER, { toolDeny: [A] }, { operator: true });
|
|
43
|
+
await store.putRules(sid, OWNER, { toolDeny: [A, B] });
|
|
44
|
+
assert.deepEqual(await partOf(store, sid), { toolDeny: [A], grammar: G });
|
|
45
|
+
await store.putRules(sid, OWNER, { toolDeny: [A] });
|
|
46
|
+
assert.deepEqual((await store.getRules(sid, OWNER))?.toolDeny, [A]);
|
|
47
|
+
await assert.rejects(store.putRules(sid, OWNER, {}), isLoosenRefusal);
|
|
48
|
+
assert.deepEqual(await partOf(store, sid), { toolDeny: [A], grammar: G });
|
|
49
|
+
});
|
|
50
|
+
run("the same entry from both writers: once an operator write carries it, the owner's drop is refused", async () => {
|
|
51
|
+
const store = make();
|
|
52
|
+
const sid = fresh();
|
|
53
|
+
await store.putRules(sid, OWNER, { toolDeny: [A] });
|
|
54
|
+
await store.putRules(sid, OWNER, { toolDeny: [A] }, { operator: true });
|
|
55
|
+
await assert.rejects(store.putRules(sid, OWNER, {}), isLoosenRefusal);
|
|
56
|
+
assert.deepEqual((await store.getRules(sid, OWNER))?.toolDeny, [A]);
|
|
57
|
+
});
|
|
58
|
+
run("a part handed in with the value is no authority: the stored part is the judge's", async () => {
|
|
59
|
+
const store = make();
|
|
60
|
+
const sid = fresh();
|
|
61
|
+
await store.putRules(sid, OWNER, { toolDeny: [A] }, { operator: true });
|
|
62
|
+
const forged = { toolDeny: [A, B], operatorRules: { grammar: G } };
|
|
63
|
+
await store.putRules(sid, OWNER, forged);
|
|
64
|
+
assert.deepEqual(await partOf(store, sid), { toolDeny: [A], grammar: G });
|
|
65
|
+
await assert.rejects(store.putRules(sid, OWNER, {}), isLoosenRefusal);
|
|
66
|
+
});
|
|
67
|
+
run("allowDirs: the owner's own confinement is the owner's to remove; an operator's is not", async () => {
|
|
68
|
+
const store = make();
|
|
69
|
+
const own = fresh();
|
|
70
|
+
await store.putRules(own, OWNER, { allowDirs: ["/work/src"] });
|
|
71
|
+
await store.putRules(own, OWNER, {});
|
|
72
|
+
assert.equal((await store.getRules(own, OWNER))?.allowDirs, undefined);
|
|
73
|
+
const operators = fresh();
|
|
74
|
+
await store.putRules(operators, OWNER, { allowDirs: ["/work"] }, { operator: true });
|
|
75
|
+
await store.putRules(operators, OWNER, { allowDirs: ["/work/src"] });
|
|
76
|
+
await store.putRules(operators, OWNER, { allowDirs: ["/work"] });
|
|
77
|
+
await assert.rejects(store.putRules(operators, OWNER, {}), isLoosenRefusal);
|
|
78
|
+
assert.deepEqual((await store.getRules(operators, OWNER))?.allowDirs, ["/work"]);
|
|
79
|
+
});
|
|
80
|
+
run("a stored row replayed by a non-operator onto a fresh or erased key keeps who may take what back (an import's replay)", async () => {
|
|
81
|
+
const store = make();
|
|
82
|
+
const exported = async (sid) => {
|
|
83
|
+
const records = store.listBySession !== undefined ? await store.listBySession(sid) : [{ principal: OWNER, rules: (await store.getRules(sid, OWNER)) }];
|
|
84
|
+
assert.equal(records.length, 1);
|
|
85
|
+
return records[0].rules;
|
|
86
|
+
};
|
|
87
|
+
const opSid = fresh();
|
|
88
|
+
await store.putRules(opSid, OWNER, { toolDeny: [A] }, { operator: true });
|
|
89
|
+
const opRow = await exported(opSid);
|
|
90
|
+
const replayed = fresh();
|
|
91
|
+
await store.putRules(replayed, OWNER, opRow);
|
|
92
|
+
await assert.rejects(store.putRules(replayed, OWNER, {}), isLoosenRefusal);
|
|
93
|
+
const mixedSid = fresh();
|
|
94
|
+
await store.putRules(mixedSid, OWNER, { toolDeny: [A] }, { operator: true });
|
|
95
|
+
await store.putRules(mixedSid, OWNER, { toolDeny: [A, B] });
|
|
96
|
+
const mixed = await exported(mixedSid);
|
|
97
|
+
const target = fresh();
|
|
98
|
+
await store.putRules(target, OWNER, mixed);
|
|
99
|
+
assert.deepEqual(await partOf(store, target), { toolDeny: [A], grammar: G });
|
|
100
|
+
await store.putRules(target, OWNER, { toolDeny: [A] });
|
|
101
|
+
await assert.rejects(store.putRules(target, OWNER, {}), isLoosenRefusal);
|
|
102
|
+
if (store.deleteBySession !== undefined) {
|
|
103
|
+
await store.deleteBySession(replayed);
|
|
104
|
+
await store.putRules(replayed, OWNER, opRow);
|
|
105
|
+
await assert.rejects(store.putRules(replayed, OWNER, {}), isLoosenRefusal);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
run("a value built on the no-row record (`{ rev: 0 }`, what a read of an unwritten key answers) is written now: the owner takes back what it added through it", async () => {
|
|
109
|
+
const store = make();
|
|
110
|
+
const sid = fresh();
|
|
111
|
+
await store.putRules(sid, OWNER, { rev: 0, toolDeny: [A] });
|
|
112
|
+
assert.deepEqual(await partOf(store, sid), { grammar: G });
|
|
113
|
+
const back = await store.putRules(sid, OWNER, {});
|
|
114
|
+
assert.equal(back.toolDeny, undefined);
|
|
115
|
+
});
|
|
116
|
+
run("the part rides the session's enumeration (an export carries who may take what back)", async () => {
|
|
117
|
+
const store = make();
|
|
118
|
+
if (store.listBySession === undefined)
|
|
119
|
+
return;
|
|
120
|
+
const sid = fresh();
|
|
121
|
+
await store.putRules(sid, OWNER, { toolDeny: [A] }, { operator: true });
|
|
122
|
+
await store.putRules(sid, OWNER, { toolDeny: [A, B] });
|
|
123
|
+
const records = await store.listBySession(sid);
|
|
124
|
+
assert.equal(records.length, 1);
|
|
125
|
+
const read = readSessionRulesShape(records[0].rules);
|
|
126
|
+
assert.ok(!("fault" in read));
|
|
127
|
+
assert.deepEqual(read.rules.operatorRules, { toolDeny: [A], grammar: G });
|
|
128
|
+
});
|
|
129
|
+
await settle();
|
|
130
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { strict as assert } from "node:assert";
|
|
2
|
+
import { TtlSessionStore } from "../session-store.js";
|
|
2
3
|
import { beginContract } from "./contract-harness.js";
|
|
3
4
|
const SESSION_ENTRY = (id, parentId) => ({
|
|
4
5
|
id,
|
|
@@ -72,5 +73,180 @@ export async function sessionRepoContract(make, runAssertion) {
|
|
|
72
73
|
assert.deepEqual(after.map((e) => e.parentId), [null, "e1"]);
|
|
73
74
|
assert.equal((await repo.exportEntries(A)).length, 2, "importing into C must not disturb the donor session");
|
|
74
75
|
});
|
|
76
|
+
run("list answers each row once, with its owner cell; a row's lastActiveAt, where the repo records it, is a finite time that a later write or touch never moves back", async () => {
|
|
77
|
+
const repo = make();
|
|
78
|
+
const B = "0198fa00-0000-7000-8000-00000000000b";
|
|
79
|
+
await (await repo.create({ id: A, owner: "kit-alice" })).getStorage().appendEntry(SESSION_ENTRY("e1", null));
|
|
80
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
81
|
+
await (await repo.create({ id: B })).getStorage().appendEntry(SESSION_ENTRY("e1", null));
|
|
82
|
+
let rows = await repo.list();
|
|
83
|
+
for (const id of [A, B])
|
|
84
|
+
assert.equal(rows.filter((r) => r.id === id).length, 1, `row ${id} is listed once`);
|
|
85
|
+
const rowA = rows.find((r) => r.id === A);
|
|
86
|
+
const rowB = rows.find((r) => r.id === B);
|
|
87
|
+
assert.equal(rowA.owner ?? null, "kit-alice", "a listed row carries its owner cell");
|
|
88
|
+
assert.equal(rowB.owner ?? null, null);
|
|
89
|
+
const timeOf = (id) => {
|
|
90
|
+
const row = rows.find((r) => r.id === id);
|
|
91
|
+
return row.lastActiveAt ?? Date.parse(row.createdAt);
|
|
92
|
+
};
|
|
93
|
+
if (rowA.lastActiveAt !== undefined && rowB.lastActiveAt !== undefined) {
|
|
94
|
+
assert.ok(Number.isFinite(rowA.lastActiveAt) && Number.isFinite(rowB.lastActiveAt), "a recorded activity time is a finite epoch-ms number");
|
|
95
|
+
assert.ok(rowB.lastActiveAt >= rowA.lastActiveAt, "the row written later is not listed as older");
|
|
96
|
+
const before = rowA.lastActiveAt;
|
|
97
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
98
|
+
await (await repo.open({ id: A, createdAt: "" })).getStorage().appendEntry(SESSION_ENTRY("e2", "e1"));
|
|
99
|
+
rows = await repo.list();
|
|
100
|
+
assert.ok(timeOf(A) >= before && timeOf(A) >= rowB.lastActiveAt, "a write moves its row's time forward, past the rows written before it");
|
|
101
|
+
}
|
|
102
|
+
if (repo.touch === undefined)
|
|
103
|
+
return;
|
|
104
|
+
const latest = Math.max(timeOf(A), timeOf(B));
|
|
105
|
+
const older = timeOf(A) <= timeOf(B) ? A : B;
|
|
106
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
107
|
+
await repo.touch(older);
|
|
108
|
+
rows = await repo.list();
|
|
109
|
+
const touched = rows.find((r) => r.id === older).lastActiveAt;
|
|
110
|
+
assert.ok(touched !== undefined && Number.isFinite(touched), "a touched row lists a recorded time");
|
|
111
|
+
assert.ok(touched >= latest, "a touch moves its row's time forward, past the rows active before it");
|
|
112
|
+
await repo.touch("0198fa00-0000-7000-8000-0000000000ff");
|
|
113
|
+
});
|
|
114
|
+
run("the owner cell round-trips: create({id, owner}) records it and open() reads it back; a create naming no owner records null", async () => {
|
|
115
|
+
const repo = make();
|
|
116
|
+
const owned = await repo.create({ id: A, owner: "kit-alice" });
|
|
117
|
+
assert.equal((await owned.getMetadata()).owner, "kit-alice");
|
|
118
|
+
assert.equal((await (await repo.open({ id: A, createdAt: "" })).getMetadata()).owner, "kit-alice", "the owner is in the row, not in the handle");
|
|
119
|
+
const B = "0198fa00-0000-7000-8000-00000000000b";
|
|
120
|
+
await repo.create({ id: B });
|
|
121
|
+
assert.equal((await (await repo.open({ id: B, createdAt: "" })).getMetadata()).owner ?? null, null, "no owner named ⇒ anonymous");
|
|
122
|
+
});
|
|
123
|
+
run("a create or fork whose owner is no principal name (the empty string, a blank string, a string holding a control or invisible character) is refused and leaves no row", async () => {
|
|
124
|
+
const repo = make();
|
|
125
|
+
for (const owner of ["", " \t ", "ali\u0000ce", "\u200b"])
|
|
126
|
+
await assert.rejects(() => repo.create({ id: A, owner }), `create with owner ${JSON.stringify(owner)}`);
|
|
127
|
+
await assert.rejects(() => repo.open({ id: A, createdAt: "" }), "the refused creates stored nothing");
|
|
128
|
+
const src = await repo.create({ id: A, owner: "kit-alice" });
|
|
129
|
+
await src.getStorage().appendEntry(SESSION_ENTRY("e1", null));
|
|
130
|
+
const B = "0198fa00-0000-7000-8000-00000000000b";
|
|
131
|
+
for (const owner of ["", " \t ", "ali\u0000ce", "\u200b"])
|
|
132
|
+
await assert.rejects(() => repo.fork({ id: A, createdAt: "" }, { id: B, owner }), `fork with owner ${JSON.stringify(owner)}`);
|
|
133
|
+
await assert.rejects(() => repo.open({ id: B, createdAt: "" }), "the refused forks stored nothing");
|
|
134
|
+
assert.equal((await (await repo.open({ id: A, createdAt: "" })).getMetadata()).owner, "kit-alice", "the source row is untouched");
|
|
135
|
+
});
|
|
136
|
+
run("create({id, owner: Y}) onto an existing row owned by X reopens it untouched: the row keeps X, and the session it returns carries X", async () => {
|
|
137
|
+
const repo = make();
|
|
138
|
+
const first = await repo.create({ id: A, owner: "kit-x" });
|
|
139
|
+
const token = (await first.getMetadata()).incarnation;
|
|
140
|
+
const again = await repo.create({ id: A, owner: "kit-y" });
|
|
141
|
+
assert.equal((await again.getMetadata()).owner, "kit-x", "a caller whose create met an existing row reads that row's owner, never its own");
|
|
142
|
+
assert.equal((await again.getMetadata()).incarnation, token, "and the same occupant");
|
|
143
|
+
assert.equal((await (await repo.open({ id: A, createdAt: "" })).getMetadata()).owner, "kit-x");
|
|
144
|
+
});
|
|
145
|
+
run("fork records the owner its options name in the fork row, else (absent or null) the source row's; importEntries onto an existing row keeps its metadata whole, onto an absent id records the importer", async () => {
|
|
146
|
+
const repo = make();
|
|
147
|
+
const src = await repo.create({ id: A, owner: "kit-alice" });
|
|
148
|
+
await src.getStorage().appendEntry(SESSION_ENTRY("e1", null));
|
|
149
|
+
const B = "0198fa00-0000-7000-8000-00000000000b";
|
|
150
|
+
const C = "0198fa00-0000-7000-8000-00000000000c";
|
|
151
|
+
const D = "0198fa00-0000-7000-8000-00000000000d";
|
|
152
|
+
assert.equal((await (await repo.fork({ id: A, createdAt: "" }, { id: B, owner: "kit-bob" })).getMetadata()).owner, "kit-bob");
|
|
153
|
+
assert.equal((await (await repo.fork({ id: A, createdAt: "" }, { id: C })).getMetadata()).owner, "kit-alice", "a fork whose options name no owner records the source row's — a copy of an owned history is never anonymous");
|
|
154
|
+
assert.equal((await (await repo.fork({ id: A, createdAt: "" }, { id: D, owner: null })).getMetadata()).owner, "kit-alice", "an explicit null never downgrades the copy either");
|
|
155
|
+
if (repo.importEntries === undefined)
|
|
156
|
+
return;
|
|
157
|
+
const token = (await src.getMetadata()).incarnation;
|
|
158
|
+
await repo.importEntries(A, "kit-carol", [SESSION_ENTRY("e1", null)]);
|
|
159
|
+
const imported = await (await repo.open({ id: A, createdAt: "" })).getMetadata();
|
|
160
|
+
assert.equal(imported.owner, "kit-alice", "the owner is recorded only by the write that creates the row: an import never re-stamps it");
|
|
161
|
+
assert.equal(imported.incarnation, token, "the log is replaced, not the occupant");
|
|
162
|
+
await repo.importEntries(A, undefined, []);
|
|
163
|
+
assert.equal((await (await repo.open({ id: A, createdAt: "" })).getMetadata()).owner, "kit-alice", "an import with no principal never makes an owned row anonymous");
|
|
164
|
+
const cells = (m) => [m.createdAt, m.forkedFrom, m.forkedFromIncarnation, m.incarnation, m.owner, JSON.stringify(m.placement)];
|
|
165
|
+
const forkRow = await (await repo.open({ id: B, createdAt: "" })).getMetadata();
|
|
166
|
+
await repo.importEntries(B, "kit-carol", [SESSION_ENTRY("e1", null)]);
|
|
167
|
+
assert.deepEqual(cells(await (await repo.open({ id: B, createdAt: "" })).getMetadata()), cells(forkRow), "the log is replaced, never the row: a fork row keeps its creation time and its lineage");
|
|
168
|
+
const E = "0198fa00-0000-7000-8000-00000000000e";
|
|
169
|
+
await repo.importEntries(E, "kit-carol", [SESSION_ENTRY("e1", null)]);
|
|
170
|
+
assert.equal((await (await repo.open({ id: E, createdAt: "" })).getMetadata()).owner, "kit-carol", "an import onto an absent id is a new row of the importer");
|
|
171
|
+
});
|
|
172
|
+
run("the metadata a repo hands out is not the row: writing to it (from open() or list()) changes no identity cell the row answers", async () => {
|
|
173
|
+
const repo = make();
|
|
174
|
+
const sess = await repo.create({ id: A, owner: "kit-alice" });
|
|
175
|
+
const token = (await sess.getMetadata()).incarnation;
|
|
176
|
+
for (const meta of [await sess.getMetadata(), await (await repo.open({ id: A, createdAt: "" })).getMetadata(), ...(await repo.list()).filter((m) => m.id === A)]) {
|
|
177
|
+
try {
|
|
178
|
+
Object.assign(meta, { owner: "kit-mallory", incarnation: "kit-forged" });
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const again = await (await repo.open({ id: A, createdAt: "" })).getMetadata();
|
|
184
|
+
assert.equal(again.owner, "kit-alice", "the owner changes only through a write of the row");
|
|
185
|
+
assert.equal(again.incarnation, token);
|
|
186
|
+
if (repo.headOf !== undefined)
|
|
187
|
+
assert.deepEqual(await repo.headOf(A), { owner: "kit-alice", incarnation: token, leafId: null });
|
|
188
|
+
});
|
|
189
|
+
run("headOf (where the repo answers it): no row ⇒ undefined; a row ⇒ its owner, occupant and active leaf, as open() reads them", async () => {
|
|
190
|
+
const repo = make();
|
|
191
|
+
if (repo.headOf === undefined)
|
|
192
|
+
return;
|
|
193
|
+
assert.equal(await repo.headOf(A), undefined);
|
|
194
|
+
const sess = await repo.create({ id: A, owner: "kit-alice" });
|
|
195
|
+
await sess.getStorage().appendEntry(SESSION_ENTRY("e1", null));
|
|
196
|
+
await sess.getStorage().appendEntry(SESSION_ENTRY("e2", "e1"));
|
|
197
|
+
await sess.getStorage().setLeafId("e1");
|
|
198
|
+
const opened = await repo.open({ id: A, createdAt: "" });
|
|
199
|
+
assert.deepEqual(await repo.headOf(A), { owner: "kit-alice", incarnation: (await opened.getMetadata()).incarnation, leafId: await opened.getStorage().getLeafId() });
|
|
200
|
+
await repo.delete({ id: A, createdAt: "" });
|
|
201
|
+
assert.equal(await repo.headOf(A), undefined, "a deleted row has no head");
|
|
202
|
+
});
|
|
203
|
+
run("the store over a repo: a row replaced behind a cached session (deleted, then created again naming another owner) — the store's next acquire serves the new row, never the cached transcript", async () => {
|
|
204
|
+
const repo = make();
|
|
205
|
+
const store = new TtlSessionStore({ repo });
|
|
206
|
+
try {
|
|
207
|
+
if (store.headOf === undefined)
|
|
208
|
+
return;
|
|
209
|
+
await store.register(A, "kit-alice");
|
|
210
|
+
await (await store.acquire(A)).session.getStorage().appendEntry(SESSION_ENTRY("alice-only", null));
|
|
211
|
+
await repo.delete({ id: A, createdAt: "" });
|
|
212
|
+
await repo.create({ id: A, owner: "kit-bob" });
|
|
213
|
+
const served = (await store.acquire(A)).session;
|
|
214
|
+
assert.equal((await served.getMetadata()).owner, "kit-bob", "the session handed out is the row the owner is read from");
|
|
215
|
+
assert.deepEqual((await served.getStorage().getEntries()).map((e) => e.id), [], "the previous owner's transcript is not served under the new owner");
|
|
216
|
+
}
|
|
217
|
+
finally {
|
|
218
|
+
store.dispose();
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
run("the store over a repo answers headOf exactly when the repo does: present ⇒ the repo's own answer; absent ⇒ no headOf on the store, which still works", async () => {
|
|
222
|
+
const repo = make();
|
|
223
|
+
const store = new TtlSessionStore({ repo });
|
|
224
|
+
try {
|
|
225
|
+
assert.equal(typeof store.headOf, typeof repo.headOf === "function" ? "function" : "undefined");
|
|
226
|
+
const { sessionId } = await store.acquire(A);
|
|
227
|
+
if (store.headOf !== undefined)
|
|
228
|
+
assert.deepEqual(await store.headOf(sessionId), await repo.headOf(sessionId), "the store's head is the repo's, verbatim");
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
store.dispose();
|
|
232
|
+
}
|
|
233
|
+
const bare = {
|
|
234
|
+
create: (o) => repo.create(o),
|
|
235
|
+
open: (m) => repo.open(m),
|
|
236
|
+
list: () => repo.list(),
|
|
237
|
+
delete: (m) => repo.delete(m),
|
|
238
|
+
fork: (s, o) => repo.fork(s, o),
|
|
239
|
+
};
|
|
240
|
+
const over = new TtlSessionStore({ repo: bare });
|
|
241
|
+
try {
|
|
242
|
+
assert.equal(over.headOf, undefined, "no head read on the repo ⇒ none on the store (an authorizer takes its fail-closed arm)");
|
|
243
|
+
const B = "0198fa00-0000-7000-8000-00000000000b";
|
|
244
|
+
await over.acquire(B);
|
|
245
|
+
await over.register(B, "kit-alice");
|
|
246
|
+
}
|
|
247
|
+
finally {
|
|
248
|
+
over.dispose();
|
|
249
|
+
}
|
|
250
|
+
});
|
|
75
251
|
await settle();
|
|
76
252
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type SessionStore } from "../session.js";
|
|
2
2
|
import { type ContractAssertionRunner } from "./contract-harness.js";
|
|
3
|
-
import { type SessionStoreIncarnationContractHooks } from "./session-store-incarnation-contract.js";
|
|
4
3
|
/**
|
|
5
4
|
* The cross-backend contract for {@link SessionStore} as the interface states it TODAY — what a store must
|
|
6
5
|
* do so that the engine, a deployment's authorizer and a shell read the same answers off it whether the
|
|
@@ -18,15 +17,14 @@ import { type SessionStoreIncarnationContractHooks } from "./session-store-incar
|
|
|
18
17
|
* What the kit cannot see from outside, it does not claim: idle eviction and `pin` (the interface has no
|
|
19
18
|
* clock seam), what `release` does to an ordinary session's live set (`size` is best-effort and a durable
|
|
20
19
|
* `list` may still show the history), a durable backend's crash recovery, and a delete that fails half-way.
|
|
21
|
-
* One stated obligation is not a case yet because the bundled store does not keep it: an ownership row
|
|
22
|
-
* outliving its session across a restart (`TtlSessionStore` holds owners in process memory).
|
|
23
20
|
*
|
|
24
|
-
* Semantics since @sema-agent/core 7.
|
|
21
|
+
* Semantics since @sema-agent/core 7.56.0: the list reads the store's rows (a reopened store lists them), pages by the
|
|
22
|
+
* `(lastActiveAt, sessionId)` keyset, filters by the row's owner, and refuses a bad query through `readSessionListQuery`.
|
|
25
23
|
*/
|
|
26
24
|
export interface SessionStoreContractHooks {
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
deleteSession:
|
|
25
|
+
/** Delete `sessionId`'s session ROW through the backend's own deletion path (history and all), so that a later
|
|
26
|
+
* `acquire(sessionId)` creates a new session under the same id. */
|
|
27
|
+
deleteSession: (store: SessionStore, sessionId: string) => Promise<void>;
|
|
30
28
|
/** A SECOND, independent store instance over the same rows as `store` — what a restarted process
|
|
31
29
|
* constructs. After calling it the kit no longer uses `store`, so a backend that holds an exclusive lock
|
|
32
30
|
* may release `store`'s first (the kit still disposes `store` at the end of the case: that dispose must
|
|
@@ -40,7 +38,7 @@ export interface SessionStoreContractHooks {
|
|
|
40
38
|
/** Optional faces (plus the replica hook, and `requireExisting` — absent = the store rejects the option, its other
|
|
41
39
|
* legal mode) a run verified or found absent; reported per judging case, after its assertions held. */
|
|
42
40
|
onOptionalMember?: (report: {
|
|
43
|
-
member: "requireExisting" | "forget" | "fork" | "list" | "noteTaskRun" | "listPlaced" | "placements" | "
|
|
41
|
+
member: "requireExisting" | "forget" | "fork" | "list" | "noteTaskRun" | "listPlaced" | "placements" | "headOf" | "ownership" | "replica";
|
|
44
42
|
status: "verified" | "absent";
|
|
45
43
|
}) => void;
|
|
46
44
|
}
|