@sema-agent/core 7.59.0 → 7.60.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 +564 -0
- package/dist/agents/agent-definition.d.ts +7 -0
- package/dist/agents/agent-definition.js +12 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +3 -1
- package/dist/agents/child-model-seat.js +6 -3
- package/dist/agents/cumulative-stats.js +0 -1
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +22 -0
- package/dist/agents/retain-ledger.d.ts +11 -1
- package/dist/agents/retain-ledger.js +13 -2
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +3 -1
- package/dist/agents/send-message-tool.d.ts +8 -19
- package/dist/agents/send-message-tool.js +11 -38
- package/dist/agents/subagent.d.ts +51 -17
- package/dist/agents/subagent.js +117 -78
- package/dist/agents/tool-filter.d.ts +1 -3
- package/dist/agents/tool-filter.js +4 -12
- package/dist/bench/metrics.d.ts +3 -5
- package/dist/bench/metrics.js +0 -1
- package/dist/brain/degrading.js +3 -1
- package/dist/brain/route-adjudicator.js +3 -1
- package/dist/brain/status-sink.d.ts +7 -1
- package/dist/brain/status-sink.js +6 -0
- package/dist/brain/timeout.d.ts +3 -1
- package/dist/brain/timeout.js +18 -5
- package/dist/core/a2a.d.ts +15 -5
- package/dist/core/a2a.js +34 -19
- package/dist/core/agent-definition.d.ts +20 -0
- package/dist/core/allow-entry.d.ts +2 -0
- package/dist/core/allow-entry.js +3 -1
- package/dist/core/artifact-host.d.ts +0 -2
- package/dist/core/artifact-host.js +0 -1
- package/dist/core/auto-mode-defaults.d.ts +8 -0
- package/dist/core/auto-mode-defaults.js +1 -0
- package/dist/core/auto-mode-rebuild.d.ts +2 -1
- package/dist/core/auto-mode.d.ts +39 -4
- package/dist/core/auto-mode.js +63 -12
- package/dist/core/background-agent-store.d.ts +10 -1
- package/dist/core/background-agent-store.js +3 -2
- package/dist/core/background-shell.d.ts +12 -1
- package/dist/core/background-shell.js +12 -0
- package/dist/core/checkpoint-store.d.ts +8 -13
- package/dist/core/checkpoint-store.js +4 -3
- package/dist/core/compliance.d.ts +1 -1
- package/dist/core/credential-echo.d.ts +52 -0
- package/dist/core/credential-echo.js +65 -0
- package/dist/core/credential-vocabulary.d.ts +13 -3
- package/dist/core/credential-vocabulary.js +12 -4
- package/dist/core/cross-boundary-taint.d.ts +4 -5
- package/dist/core/engine-notice.d.ts +58 -15
- package/dist/core/frame-settlement.d.ts +5 -0
- package/dist/core/frame-settlement.js +4 -0
- package/dist/core/gate-fold.js +7 -5
- package/dist/core/gate-lanes.js +39 -8
- package/dist/core/governance-codes.d.ts +9 -1
- package/dist/core/governance-codes.js +12 -0
- package/dist/core/hands-band-screen.js +0 -1
- package/dist/core/hands-band.d.ts +0 -3
- package/dist/core/hooks.d.ts +39 -56
- package/dist/core/hooks.js +123 -77
- package/dist/core/image-admission.d.ts +104 -51
- package/dist/core/image-admission.js +170 -46
- package/dist/core/image-downsample.d.ts +36 -69
- package/dist/core/image-downsample.js +111 -73
- package/dist/core/integer-option.d.ts +21 -0
- package/dist/core/integer-option.js +13 -0
- package/dist/core/locked-config.d.ts +54 -3
- package/dist/core/locked-config.js +81 -50
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-call-meta.js +9 -10
- package/dist/core/mcp-failure.d.ts +9 -3
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-host-seat.d.ts +92 -0
- package/dist/core/mcp-host-seat.js +131 -0
- package/dist/core/mcp-probe.d.ts +7 -2
- package/dist/core/mcp-probe.js +7 -2
- package/dist/core/mcp-server-spec.d.ts +38 -9
- package/dist/core/mcp-server-spec.js +55 -21
- package/dist/core/mcp.d.ts +17 -6
- package/dist/core/mcp.js +67 -55
- package/dist/core/memory-admission.d.ts +23 -6
- package/dist/core/memory-admission.js +19 -9
- package/dist/core/memory-engine/content-origin.d.ts +13 -0
- package/dist/core/memory-engine/content-origin.js +21 -3
- package/dist/core/memory-engine/index.d.ts +2 -1
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/scope-contract.d.ts +13 -3
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.d.ts +45 -11
- package/dist/core/memory-engine/sync-client.js +82 -11
- package/dist/core/memory-engine/sync-report.d.ts +103 -0
- package/dist/core/memory-engine/sync-report.js +119 -0
- package/dist/core/memory-engine/sync.d.ts +4 -2
- package/dist/core/mode-policy.d.ts +9 -1
- package/dist/core/mode-policy.js +11 -1
- package/dist/core/model-receipt.d.ts +39 -0
- package/dist/core/model-receipt.js +139 -0
- package/dist/core/mods/agent-stations.d.ts +65 -0
- package/dist/core/mods/agent-stations.js +105 -0
- package/dist/core/mods/kernel/dispatch.d.ts +5 -1
- package/dist/core/mods/kernel/dispatch.js +4 -4
- package/dist/core/mods/kernel/events.d.ts +10 -4
- package/dist/core/mods/kernel/events.js +10 -6
- package/dist/core/mods/kernel/receive.d.ts +5 -0
- package/dist/core/mods/kernel/receive.js +10 -0
- package/dist/core/mods/lifecycle-stations.d.ts +41 -0
- package/dist/core/mods/lifecycle-stations.js +35 -0
- package/dist/core/mods/stations.d.ts +51 -59
- package/dist/core/mods/stations.js +32 -42
- package/dist/core/mods/tool-call.d.ts +10 -4
- package/dist/core/mods/tool-call.js +28 -12
- package/dist/core/mounted-mcp.d.ts +5 -0
- package/dist/core/mounted-mcp.js +2 -2
- package/dist/core/namespaced-rule-name.d.ts +7 -1
- package/dist/core/namespaced-rule-name.js +13 -2
- package/dist/core/oracle-isolation.js +1 -1
- package/dist/core/own-property-receipt.d.ts +3 -0
- package/dist/core/own-property-receipt.js +3 -0
- package/dist/core/park-selfcheck.js +8 -8
- package/dist/core/peer-seat.d.ts +63 -8
- package/dist/core/peer-seat.js +179 -34
- package/dist/core/permission-rule-consent.d.ts +0 -21
- package/dist/core/permission-rule-consent.js +1 -2
- package/dist/core/permission-rule-model.d.ts +4 -2
- package/dist/core/permission-rule-model.js +7 -6
- package/dist/core/protocol-http-auth.d.ts +14 -2
- package/dist/core/protocol-http-auth.js +16 -7
- package/dist/core/read-face-seats.d.ts +7 -5
- package/dist/core/read-face-seats.js +4 -1
- package/dist/core/redaction-marks.d.ts +4 -3
- package/dist/core/redaction-marks.js +2 -2
- package/dist/core/remote-env.d.ts +146 -98
- package/dist/core/remote-env.js +113 -14
- package/dist/core/retention.js +37 -12
- package/dist/core/retired-keys.d.ts +6 -1
- package/dist/core/retired-keys.js +4 -1
- package/dist/core/rewrite-rejudge.d.ts +12 -5
- package/dist/core/rewrite-rejudge.js +9 -5
- package/dist/core/roles.d.ts +37 -3
- package/dist/core/roles.js +126 -78
- package/dist/core/rule-owner.d.ts +3 -0
- package/dist/core/runner/assemble-result.d.ts +0 -5
- package/dist/core/runner/assemble-result.js +0 -1
- package/dist/core/runner/call-hook-stations.d.ts +17 -10
- package/dist/core/runner/call-hook-stations.js +21 -10
- package/dist/core/runner/child-tree.d.ts +7 -8
- package/dist/core/runner/child-tree.js +6 -6
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +39 -8
- package/dist/core/runner/construction-doors.js +5 -0
- package/dist/core/runner/contracts.d.ts +62 -41
- package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
- package/dist/core/runner/cross-boundary-lane.js +11 -2
- package/dist/core/runner/env-capability-census.d.ts +15 -20
- package/dist/core/runner/env-capability-census.js +25 -34
- package/dist/core/runner/file-history-request.d.ts +2 -2
- package/dist/core/runner/file-history-request.js +0 -8
- package/dist/core/runner/gate-exit.d.ts +75 -7
- package/dist/core/runner/gate-exit.js +20 -1
- package/dist/core/runner/git-status-frame.d.ts +5 -2
- package/dist/core/runner/git-status-frame.js +3 -4
- package/dist/core/runner/image.d.ts +7 -2
- package/dist/core/runner/image.js +14 -8
- package/dist/core/runner/inline-image.d.ts +10 -8
- package/dist/core/runner/inline-image.js +11 -9
- package/dist/core/runner/memory-consolidation-driver.js +4 -4
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
- package/dist/core/runner/prepare-boundary-parks.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +6 -1
- package/dist/core/runner/prepare-config-doors.js +14 -9
- package/dist/core/runner/prepare-delegation-surface.d.ts +5 -3
- package/dist/core/runner/prepare-delegation-surface.js +4 -4
- package/dist/core/runner/prepare-file-history.d.ts +10 -12
- package/dist/core/runner/prepare-file-history.js +3 -12
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +3 -1
- package/dist/core/runner/prepare-hands-readface.js +15 -7
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -4
- package/dist/core/runner/prepare-inherited-gate.js +9 -5
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +2 -2
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +3 -5
- package/dist/core/runner/prepare-park-ask.js +3 -8
- package/dist/core/runner/prepare-policy-chain.d.ts +5 -4
- package/dist/core/runner/prepare-policy-chain.js +120 -108
- package/dist/core/runner/prepare-project-context.js +8 -5
- package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -1
- package/dist/core/runner/prepare-prompt-inputs.js +3 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
- package/dist/core/runner/prepare-protocol-tools.js +9 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
- package/dist/core/runner/prepare-suspend-saga.js +5 -7
- package/dist/core/runner/prepare-task.js +41 -27
- package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
- package/dist/core/runner/prepare-turn-wiring.js +7 -2
- package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -3
- package/dist/core/runner/prepare-wiring-manifest.js +32 -18
- package/dist/core/runner/prepare-workspace-restore.js +3 -3
- package/dist/core/runner/resume-checkpoint-screen.js +4 -4
- package/dist/core/runner/retired-runner-deps.js +4 -1
- package/dist/core/runner/run-attachment-seats.js +3 -3
- package/dist/core/runner/run-brain-sinks.js +1 -0
- package/dist/core/runner/run-git-lane.d.ts +3 -1
- package/dist/core/runner/run-git-lane.js +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +3 -1
- package/dist/core/runner/run-harness-handlers.js +3 -1
- package/dist/core/runner/run-identity-wiring.js +1 -1
- package/dist/core/runner/run-leg.js +26 -28
- package/dist/core/runner/run-notification-lane.d.ts +3 -1
- package/dist/core/runner/run-notification-lane.js +16 -10
- package/dist/core/runner/run-settle-and-teardown.js +5 -1
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +12 -4
- package/dist/core/runner/run-turn-boundary.js +12 -7
- package/dist/core/runner/runtask.d.ts +7 -4
- package/dist/core/runner/runtask.js +19 -11
- package/dist/core/runner/skills-seat.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.js +10 -7
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-disclosure.js +0 -2
- package/dist/core/runner/tool-face-overlay.d.ts +1 -1
- package/dist/core/runner/tool-face-overlay.js +26 -19
- package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
- package/dist/core/runner/tool-result-media-seat.js +17 -1
- package/dist/core/runner/turn-attachments.d.ts +3 -5
- package/dist/core/runner/turn-attachments.js +3 -16
- package/dist/core/runner-deps.d.ts +31 -18
- package/dist/core/secret-env.d.ts +3 -2
- package/dist/core/session-policy-store.d.ts +9 -2
- package/dist/core/session-policy-store.js +16 -1
- package/dist/core/session-store.d.ts +3 -2
- package/dist/core/session-store.js +50 -11
- package/dist/core/skill-grant.d.ts +9 -0
- package/dist/core/skill-grant.js +18 -0
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
- package/dist/core/stub-env.d.ts +5 -5
- package/dist/core/stub-env.js +11 -1
- package/dist/core/swappable-deps.d.ts +17 -43
- package/dist/core/swappable-deps.js +15 -5
- package/dist/core/synthetic-read-verdict.d.ts +1 -1
- package/dist/core/task-event.d.ts +18 -2
- package/dist/core/task-notification.d.ts +88 -5
- package/dist/core/task-notification.js +130 -7
- package/dist/core/task-registry-agent.d.ts +18 -12
- package/dist/core/task-registry-agent.js +18 -6
- package/dist/core/task-registry-monitor.d.ts +7 -0
- package/dist/core/task-registry-monitor.js +28 -1
- package/dist/core/task-registry-shared.d.ts +38 -3
- package/dist/core/task-registry-shared.js +21 -7
- package/dist/core/task-registry-workflow.js +1 -1
- package/dist/core/task-registry.d.ts +50 -35
- package/dist/core/task-registry.js +64 -23
- package/dist/core/task-result.d.ts +3 -12
- package/dist/core/task-spec.d.ts +3 -6
- package/dist/core/task-stream.d.ts +1 -1
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-face-reader.d.ts +7 -6
- package/dist/core/tool-face-reader.js +4 -3
- package/dist/core/tool-name-aliases.d.ts +19 -0
- package/dist/core/tool-name-aliases.js +54 -2
- package/dist/core/tool-policy.d.ts +5 -4
- package/dist/core/tool-policy.js +1 -1
- package/dist/core/tool-registry.d.ts +5 -5
- package/dist/core/tool-registry.js +2 -2
- package/dist/core/tool-result-store.d.ts +88 -5
- package/dist/core/tool-result-store.js +51 -12
- package/dist/core/tool-spec.d.ts +20 -4
- package/dist/core/trace.d.ts +0 -1
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.js +1 -1
- package/dist/core/user-attachment.d.ts +10 -5
- package/dist/core/user-attachment.js +14 -6
- package/dist/engine/execution-env/node-execution-env.d.ts +7 -2
- package/dist/engine/execution-env/node-execution-env.js +12 -1
- package/dist/engine/harness/agent-harness.d.ts +1 -1
- package/dist/engine/harness/agent-harness.js +8 -4
- package/dist/engine/harness/types.d.ts +112 -29
- package/dist/engine/loop/agent-loop.d.ts +12 -12
- package/dist/engine/loop/agent-loop.js +153 -21
- package/dist/engine/loop/types.d.ts +9 -2
- package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
- package/dist/engine/lsp/node-lsp-manager.js +32 -13
- package/dist/index.d.ts +22 -14
- package/dist/index.js +15 -10
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +9 -3
- package/dist/orchestration/run-workflow-tool.js +59 -29
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-governance.js +2 -1
- package/dist/orchestration/workflow.d.ts +4 -0
- package/dist/orchestration/workflow.js +25 -4
- package/dist/prompts/default.d.ts +1 -10
- package/dist/prompts/default.js +0 -2
- package/dist/stores/file/background-agent-store.d.ts +1 -1
- package/dist/stores/file/background-agent-store.js +3 -1
- package/dist/stores/file/checkpoint-store.d.ts +127 -2
- package/dist/stores/file/checkpoint-store.js +19 -14
- package/dist/stores/file/file-history-store.d.ts +1 -1
- package/dist/stores/file/file-history-store.js +3 -1
- package/dist/stores/file/index.d.ts +4 -3
- package/dist/stores/file/index.js +17 -8
- package/dist/stores/file/mailbox-store.d.ts +1 -1
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/memory-store.d.ts +1 -1
- package/dist/stores/file/memory-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +1 -1
- package/dist/stores/file/session-policy-store.js +3 -1
- package/dist/stores/file/session-store.d.ts +1 -1
- package/dist/stores/file/session-store.js +3 -1
- package/dist/stores/file/shared-ledger.d.ts +26 -0
- package/dist/stores/file/shared-ledger.js +38 -9
- package/dist/stores/file/tool-result-store.d.ts +20 -2
- package/dist/stores/file/tool-result-store.js +74 -6
- package/dist/stores/file/usage-window-store.d.ts +1 -1
- package/dist/stores/file/usage-window-store.js +3 -1
- package/dist/stores/file/workflow-journal-store.d.ts +1 -11
- package/dist/stores/file/workflow-journal-store.js +3 -2
- package/dist/tools/fs/containment-face.d.ts +5 -0
- package/dist/tools/fs/encoding.d.ts +13 -4
- package/dist/tools/fs/encoding.js +17 -2
- package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
- package/dist/tools/fs/fs-bash-background-text.js +1 -0
- package/dist/tools/fs/fs-bash.d.ts +8 -4
- package/dist/tools/fs/fs-bash.js +26 -35
- package/dist/tools/fs/fs-pdf.d.ts +2 -2
- package/dist/tools/fs/fs-pdf.js +26 -21
- package/dist/tools/fs/fs-read.d.ts +5 -4
- package/dist/tools/fs/fs-read.js +35 -18
- package/dist/tools/fs/fs-search-tools.js +4 -1
- package/dist/tools/fs/fs-shared.d.ts +11 -13
- package/dist/tools/fs/fs-shared.js +11 -7
- package/dist/tools/fs/fs-write.js +5 -5
- package/dist/tools/fs/index.d.ts +14 -8
- package/dist/tools/fs/index.js +8 -4
- package/dist/tools/fs/read-floor.d.ts +44 -1
- package/dist/tools/fs/read-floor.js +35 -0
- package/dist/tools/fs/removal-targets.d.ts +9 -4
- package/dist/tools/fs/removal-targets.js +17 -9
- package/dist/tools/fs/search.d.ts +3 -3
- package/dist/tools/fs/search.js +4 -4
- package/dist/tools/monitor.d.ts +5 -4
- package/dist/tools/monitor.js +15 -8
- package/dist/tools/scheduler-tools.js +42 -4
- package/dist/tools/web.d.ts +0 -10
- package/dist/tools/web.js +1 -4
- package/package.json +4 -2
- package/test/export-surface.snapshot.json +75 -21
- package/wire-changes/core-stores-sql@7.60.0.json +30 -0
- package/wire-changes/core@7.60.0.json +3274 -0
- package/wire-changes/mods-kernel@7.60.0.json +62 -0
- package/wire-changes/primitives@7.60.0.json +30 -0
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* leg reaches declares itself the target NOW, and the tree's state NOW.
|
|
22
22
|
*/
|
|
23
23
|
import type { AgentTool } from "../../internal/harness.js";
|
|
24
|
-
import type { SessionTreeEntry } from "../../internal/harness-types.js";
|
|
24
|
+
import type { ExecutionEnv, SessionTreeEntry } from "../../internal/harness-types.js";
|
|
25
25
|
import { type CrossBoundaryCheck, type CrossBoundaryPosture, type CrossBoundaryTreeToken, type OwedDeliveries } from "../cross-boundary-taint.js";
|
|
26
26
|
import { type ToolRoster } from "../tool-roster.js";
|
|
27
27
|
import type { RunnerDeps } from "../types.js";
|
|
@@ -73,10 +73,8 @@ export interface CrossBoundaryLaneInput {
|
|
|
73
73
|
posture: CrossBoundaryPosture | undefined;
|
|
74
74
|
/** The run fold: this leg's environment declares the target, or the row it resumes was minted on one. */
|
|
75
75
|
externalContentTargetActive: boolean;
|
|
76
|
-
/** The leg's own environment — read for its CURRENT declaration at each judgment. */
|
|
77
|
-
env:
|
|
78
|
-
readonly externalContentTarget?: boolean;
|
|
79
|
-
};
|
|
76
|
+
/** The leg's own environment — read for its CURRENT declaration (`targetIsExternal`) at each judgment. */
|
|
77
|
+
env: Pick<ExecutionEnv, "capabilities">;
|
|
80
78
|
session: {
|
|
81
79
|
getBranch(): Promise<ReadonlyArray<SessionTreeEntry>>;
|
|
82
80
|
getLeafId(): Promise<string | null>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { targetIsExternal } from "../remote-env.js";
|
|
1
2
|
import { BOUNDARY_LEGS, CROSS_BOUNDARY_RECORD_TYPE, CROSS_BOUNDARY_TAINT_BITS, STRICTEST_CROSS_BOUNDARY_TREE, crossBoundaryObligation, crossBoundaryPostureUndeclaredNotice, crossBoundaryRecordUnwrittenNotice, crossBoundaryRecordData, crossBoundaryTreeCovers, crossBoundaryTreeGoverned, joinCrossBoundaryTree, readCrossBoundaryRecord, } from "../cross-boundary-taint.js";
|
|
2
3
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
3
4
|
import { policyCannotAnswer } from "../real-approval.js";
|
|
@@ -23,6 +24,14 @@ export function joinedCrossBoundaryTree(handed, report) {
|
|
|
23
24
|
const EVERY_LEG = Object.freeze([...BOUNDARY_LEGS]);
|
|
24
25
|
const ONE_OUTSIDE_READ = Object.freeze([Object.freeze({ legs: Object.freeze(["outside_read"]) })]);
|
|
25
26
|
const bitsOf = (t) => CROSS_BOUNDARY_TAINT_BITS.filter((b) => t[b] === true);
|
|
27
|
+
function obligationReaching(legs, reached, tree) {
|
|
28
|
+
const declared = reached === undefined ? false : targetIsExternal(reached);
|
|
29
|
+
if (declared !== "undeclared")
|
|
30
|
+
return crossBoundaryObligation(legs, declared, tree);
|
|
31
|
+
const onTarget = crossBoundaryObligation(legs, true, tree);
|
|
32
|
+
const offTarget = crossBoundaryObligation(legs, false, tree);
|
|
33
|
+
return Object.freeze({ mandate: onTarget.mandate || offTarget.mandate, record: onTarget.record || offTarget.record });
|
|
34
|
+
}
|
|
26
35
|
function legsOfCall(view, legEnv, token, call, report) {
|
|
27
36
|
const roster = view.roster.current;
|
|
28
37
|
const row = roster !== undefined ? rosterEntryNamed(roster, call.toolName) : undefined;
|
|
@@ -137,7 +146,7 @@ export async function prepareCrossBoundaryLane(input) {
|
|
|
137
146
|
const OBSERVED = Object.freeze({ offTargetReadObserved: true });
|
|
138
147
|
const addedBy = (record) => (record && ref.current.offTargetReadObserved !== true ? OBSERVED : undefined);
|
|
139
148
|
const owedBit = (owed) => {
|
|
140
|
-
const records = (given) => given.some((d) =>
|
|
149
|
+
const records = (given) => given.some((d) => obligationReaching(d.legs, d.env, ref.current).record);
|
|
141
150
|
try {
|
|
142
151
|
return addedBy(records(owed()));
|
|
143
152
|
}
|
|
@@ -166,7 +175,7 @@ export async function prepareCrossBoundaryLane(input) {
|
|
|
166
175
|
const obligationOf = (call, say) => {
|
|
167
176
|
const { legs, env: reached } = legsOfCall(view, env, token, call, say);
|
|
168
177
|
try {
|
|
169
|
-
return
|
|
178
|
+
return obligationReaching(legs, reached, ref.current);
|
|
170
179
|
}
|
|
171
180
|
catch (err) {
|
|
172
181
|
say(`the cross-boundary obligation of "${call.toolName}" could not be read (${thrownText(err)}) — the call reads as every leg, off the target`);
|
|
@@ -4,30 +4,25 @@ import type { EngineNotice } from "../engine-notice.js";
|
|
|
4
4
|
export interface MalformedCapabilityDeclaration {
|
|
5
5
|
readonly key: string;
|
|
6
6
|
readonly valueType: string;
|
|
7
|
-
/** The shape the seat takes: a `capabilities.*` boolean
|
|
8
|
-
|
|
7
|
+
/** The shape the seat takes: a `capabilities.*` boolean (or the block itself, an object), an optional seam method, or
|
|
8
|
+
* nothing (`absent`: a member of the block that is no capability). */
|
|
9
|
+
readonly expected: "boolean" | "object" | "function" | "absent";
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
|
-
* Every
|
|
12
|
+
* Every capability this env does not DECLARE as a boolean: each key of the block that is absent, not a boolean, or
|
|
13
|
+
* cannot be received — or the block itself, when it is present but not an object or cannot be received — and each
|
|
14
|
+
* member the block carries outside the eight keys (a misspelled key leaves the key it meant undeclared).
|
|
12
15
|
*
|
|
13
|
-
* The
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* outside {@link NO_ABSENT_READING} (and announced, alike, for a key inside it) — so one test covers both and
|
|
18
|
-
* the census needs no membership rule at all.
|
|
16
|
+
* The block is judged on its one receipt (`capabilityReceiptOf`), the frozen copy every reader reads. `undefined` is
|
|
17
|
+
* where absence lands — an absent key and an explicit `undefined` are the same word to every reader — and both are
|
|
18
|
+
* announced, as a wrong shape is. An env with no block at all is announced once per key: every reader takes every key's
|
|
19
|
+
* safe side, and the operator learns which.
|
|
19
20
|
*
|
|
20
|
-
* TOTAL by construction: a diagnostic may not be the thing that fails a run. Every read of the adapter
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* could not be had).
|
|
25
|
-
*
|
|
26
|
-
* What a snapshot cannot promise: this is taken once, at admission. An adapter whose capability values
|
|
27
|
-
* CHANGE afterwards can hand a later reader something this census never saw; the declaration is
|
|
28
|
-
* documented as a constant property of the adapter, and a mutable one is outside what any one-time
|
|
29
|
-
* reading covers.
|
|
21
|
+
* TOTAL by construction: a diagnostic may not be the thing that fails a run. Every read of the adapter can throw on a
|
|
22
|
+
* getter or a Proxy trap — the block acquisition, each key, each optional method — and a read that throws is itself a
|
|
23
|
+
* declaration nobody can use, so it is reported rather than raised (`unreadable`, under the key when there is one and
|
|
24
|
+
* under `capabilities` when the block itself could not be had).
|
|
30
25
|
*/
|
|
31
26
|
export declare function malformedCapabilityDeclarations(env: ExecutionEnv): MalformedCapabilityDeclaration[];
|
|
32
|
-
/** Announce each malformed declaration once, to the operator who wired the adapter. */
|
|
27
|
+
/** Announce each undeclared or malformed declaration once, to the operator who wired the adapter. */
|
|
33
28
|
export declare function announceMalformedCapabilities(env: ExecutionEnv, onNotice: ((notice: EngineNotice) => void) | undefined): void;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CAPABILITY_KEYS, UNDECLARED_CAPABILITY_READING, capabilityReceiptOf } from "../remote-env.js";
|
|
2
2
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
3
|
-
const BOOLEAN_CAPABILITY_KEYS = ["isolation", "suspendable", "canonicalPathAuthoritative", "sharesProcessTable"];
|
|
4
|
-
const NO_ABSENT_READING = {
|
|
5
|
-
sharesProcessTable: "whether the commands it runs are processes on this engine's own process table has no default, so the Bash tool refuses every pattern kill that needs the question (`pkill`, `killall`, a `kill` fed by `pgrep`; `pkill -P $$`, the shell's own children, runs) on this environment until the adapter declares it — `true` when its commands run on a table that holds the engine (a host lane, or a PID namespace that contains the engine's), `false` only when they run where the engine is not (another machine, a PID namespace that does not contain it)",
|
|
6
|
-
};
|
|
7
3
|
const OPTIONAL_METHOD_KEYS = ["writeFileExclusive", "writeFileGuarded", "setFileMode", "readLink", "canonicalChain", "fileIdentity", "openBound"];
|
|
8
4
|
export function malformedCapabilityDeclarations(env) {
|
|
9
5
|
const out = [];
|
|
@@ -20,41 +16,36 @@ export function malformedCapabilityDeclarations(env) {
|
|
|
20
16
|
continue;
|
|
21
17
|
out.push({ key, valueType: value === null ? "null" : typeof value, expected: "function" });
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!isRemoteExecutionEnv(env))
|
|
26
|
-
return out;
|
|
27
|
-
caps = env.capabilities;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
out.push({ key: "capabilities", valueType: "unreadable", expected: "boolean" });
|
|
31
|
-
return out;
|
|
32
|
-
}
|
|
33
|
-
for (const key of BOOLEAN_CAPABILITY_KEYS) {
|
|
34
|
-
let value;
|
|
35
|
-
try {
|
|
36
|
-
value = caps[key];
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
out.push({ key, valueType: "unreadable", expected: "boolean" });
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (typeof value === "boolean" || (value === undefined && NO_ABSENT_READING[key] === undefined))
|
|
43
|
-
continue;
|
|
44
|
-
out.push({ key, valueType: value === null ? "null" : typeof value, expected: "boolean" });
|
|
45
|
-
}
|
|
19
|
+
for (const finding of capabilityReceiptOf(env).findings)
|
|
20
|
+
out.push(finding);
|
|
46
21
|
return out;
|
|
47
22
|
}
|
|
23
|
+
function declaredAs({ key, valueType, expected }) {
|
|
24
|
+
if (expected === "function")
|
|
25
|
+
return `declares ${key} as a ${valueType}, not a function`;
|
|
26
|
+
if (expected === "object")
|
|
27
|
+
return valueType === "unreadable" ? "declares a capabilities block that cannot be read" : `declares capabilities as a ${valueType}, not an object`;
|
|
28
|
+
if (expected === "absent")
|
|
29
|
+
return `declares capabilities.${key}, which is no capability`;
|
|
30
|
+
if (valueType === "undefined")
|
|
31
|
+
return `does not declare capabilities.${key}`;
|
|
32
|
+
if (valueType === "unreadable")
|
|
33
|
+
return `declares capabilities.${key} with a value that cannot be read`;
|
|
34
|
+
return `declares capabilities.${key} as a ${valueType}, not a boolean`;
|
|
35
|
+
}
|
|
48
36
|
export function announceMalformedCapabilities(env, onNotice) {
|
|
49
|
-
for (const
|
|
50
|
-
const
|
|
37
|
+
for (const finding of malformedCapabilityDeclarations(env)) {
|
|
38
|
+
const { key, valueType, expected } = finding;
|
|
39
|
+
const row = expected === "boolean" ? UNDECLARED_CAPABILITY_READING[key] : undefined;
|
|
51
40
|
deliverEngineNotice(onNotice, {
|
|
52
41
|
code: "config.execution_env_capability_invalid",
|
|
53
42
|
message: expected === "function"
|
|
54
|
-
? `The execution environment
|
|
55
|
-
:
|
|
56
|
-
? `The execution environment ${
|
|
57
|
-
:
|
|
43
|
+
? `The execution environment ${declaredAs(finding)}. This seat is declared by being present as a callable method and undeclared by being absent, so every reader takes the absent reading — the reach the adapter meant to declare is silently the old one. Fix the adapter — this is a wiring fault, not a supported way to leave the seat unset.`
|
|
44
|
+
: expected === "absent"
|
|
45
|
+
? `The execution environment ${declaredAs(finding)}: the block holds exactly ${CAPABILITY_KEYS.join(", ")}, so no reader takes this member, and a misspelled key leaves the key it meant undeclared. Fix the adapter — this is a wiring fault, not a supported extension of the block.`
|
|
46
|
+
: expected === "object"
|
|
47
|
+
? `The execution environment ${declaredAs(finding)}. Every capability is required and none can be read, so every reader takes its key's undeclared reading (${CAPABILITY_KEYS.map((k) => `${k} as ${JSON.stringify(UNDECLARED_CAPABILITY_READING[k].reads)}`).join(", ")}). Fix the adapter — this is a wiring fault, not a supported way to leave the capabilities unset.`
|
|
48
|
+
: `The execution environment ${declaredAs(finding)}. Every capability is required and has no default reading, so the engine reads it as ${JSON.stringify(row?.reads)}: ${row?.so}. Fix the adapter — this is a wiring fault, not a supported way to leave the capability unset.`,
|
|
58
49
|
detail: { key, valueType },
|
|
59
50
|
});
|
|
60
51
|
}
|
|
@@ -4,8 +4,8 @@ import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* The file-history REQUEST door: every refusal the request (`TaskSpec`) and the deployment's own seats decide
|
|
6
6
|
* without the session, the env or the store's contents — the three bad-value doors (`RunnerDeps.onTrackFailure`,
|
|
7
|
-
* `RunnerDeps.fileHistoryStore` / `fileHistoryCapture`, `TaskSpec.fileHistory`), the
|
|
8
|
-
*
|
|
7
|
+
* `RunnerDeps.fileHistoryStore` / `fileHistoryCapture`, `TaskSpec.fileHistory`), the restoreFiles / resumeAt /
|
|
8
|
+
* rewindFilesTo contradictions, and a restore asked of a run that holds no
|
|
9
9
|
* history (`rewind.capture_disabled` / `rewind.store_unconfigured`). SYNCHRONOUS and side-effect free; the driver
|
|
10
10
|
* calls it BEFORE the session is acquired, so a request refused here leaves the session — its leaf included —
|
|
11
11
|
* exactly as it was. What it resolves rides into the file-history phase (`prepareFileHistory`) unchanged.
|
|
@@ -4,14 +4,6 @@ export function resolveFileHistoryRequest(spec, deps) {
|
|
|
4
4
|
const declaredOff = wiredSeat === "disabled" || runDeclaredOff;
|
|
5
5
|
const fileHistoryStore = declaredOff ? undefined : wiredSeat;
|
|
6
6
|
const captureStore = captureOff ? undefined : fileHistoryStore;
|
|
7
|
-
const legacyRewindFiles = spec.rewindFiles;
|
|
8
|
-
if (legacyRewindFiles === true) {
|
|
9
|
-
if (spec.resumeAt !== undefined) {
|
|
10
|
-
const e = new Error(`rewind-files: TaskSpec.rewindFiles is retired (design/381 — rewind now converges the per-edited-file history, not a whole-tree snapshot). This request pairs it with resumeAt, i.e. the RESTORE sense: set restoreFiles: true instead. (The capture sense needs no request anymore — first-touch tracking is on whenever a RunnerDeps.fileHistoryStore is wired and neither RunnerDeps.fileHistoryCapture nor TaskSpec.fileHistory turns it off.)`);
|
|
11
|
-
e.code = "rewind.rewind_files_retired";
|
|
12
|
-
throw e;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
7
|
if (spec.restoreFiles === true && spec.resumeAt === undefined) {
|
|
16
8
|
const e = new Error(`rewind-files: restoreFiles: true needs a resumeAt anchor — restoring files means converging them to a specific prior entry's boundary, and this spec names none. Use resumeAt + restoreFiles to move conversation and files together, or rewindFilesTo alone for a code-only restore.`);
|
|
17
9
|
e.code = "rewind.invalid_spec";
|
|
@@ -140,24 +140,55 @@ export declare function frozenInputSnapshot(input: unknown): unknown;
|
|
|
140
140
|
/** What one `classic.PreToolUse` screening came to: an answer the receipt took (`undefined` = no opinion), or the
|
|
141
141
|
* engine's fail-closed refusal of the call with its sentence (a handler that failed or broke the site's contract,
|
|
142
142
|
* or a cancel). */
|
|
143
|
-
/** A screen's outcome
|
|
144
|
-
*
|
|
145
|
-
*
|
|
143
|
+
/** A screen's outcome over every installation that screens the call (the leg's own bus, then each inherited installation). An
|
|
144
|
+
* answer is the leg's own verdict — or an inherited installation's `deny`, which ends the screen — naming the registration that
|
|
145
|
+
* answered it (`answeredBy`, absent when no handler spoke); its `updatedInput` is the bytes the screen ended on when any
|
|
146
|
+
* installation rewrote, `rewrittenBy` the extensions that authored them (in the order they rewrote). `contexts` are every
|
|
147
|
+
* `additionalContext` line the screen collected, in raise order. `settled`: an inherited installation's question was refused
|
|
148
|
+
* where its installation froze it (`deniedBy` / `cause` as the pass's ledger read the refusal). A refusal — a deny, a failure, a
|
|
149
|
+
* settled refusal — names the bytes its judge judged (`judged`) when a rewrite earlier in the screen made them other bytes than
|
|
150
|
+
* those the screen was given. */
|
|
146
151
|
export type PreToolUseScreen = {
|
|
147
152
|
readonly kind: "answered";
|
|
148
153
|
readonly answer: PreToolUseResult | undefined;
|
|
149
154
|
readonly answeredBy?: string;
|
|
150
155
|
readonly rewrittenBy?: readonly string[];
|
|
156
|
+
readonly contexts: readonly string[];
|
|
157
|
+
readonly inherited?: InheritedScreenRead;
|
|
158
|
+
readonly judged?: unknown;
|
|
151
159
|
} | {
|
|
152
160
|
readonly kind: "refused";
|
|
153
161
|
readonly reason: string; /** the registration the bus names for the failed screening (the mint reads whether it names an extension); absent on a cancel */
|
|
154
162
|
readonly extension?: string;
|
|
163
|
+
readonly judged?: unknown;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: "settled";
|
|
166
|
+
readonly deny: PermissionResult;
|
|
167
|
+
readonly deniedBy: DeniedBy;
|
|
168
|
+
readonly cause?: ClassifierDenyCause;
|
|
169
|
+
readonly judged?: unknown;
|
|
155
170
|
};
|
|
171
|
+
/** What the inherited installations' `classic.PreToolUse` came to beside the leg's own answer (present when one was raised): the
|
|
172
|
+
* registrations whose `allow` is no objection here (the allow layer's `hook` member discloses them; an inherited allow clears
|
|
173
|
+
* nothing of this leg's), the question a settlement floated to this leg's park (the call is marked; it folds as the leg's own
|
|
174
|
+
* hook ask does), and a person's approval of an edit at an installation's question (the gate's approved-edit pass takes it). */
|
|
175
|
+
export interface InheritedScreenRead {
|
|
176
|
+
readonly allowedBy: readonly string[];
|
|
177
|
+
readonly floated?: Extract<PermissionResult, {
|
|
178
|
+
action: "ask";
|
|
179
|
+
}>;
|
|
180
|
+
readonly approved?: Extract<PermissionResult, {
|
|
181
|
+
action: "allow";
|
|
182
|
+
}> & {
|
|
183
|
+
readonly updatedInput: unknown;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
156
186
|
/**
|
|
157
|
-
* The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus
|
|
158
|
-
* per-screening e, the answer receipt
|
|
159
|
-
*
|
|
160
|
-
*
|
|
187
|
+
* The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus and then on each
|
|
188
|
+
* inherited installation's, the per-screening e, the answer receipt, the installations' settlements and the fail-closed
|
|
189
|
+
* sentences behind one method, so every re-screen (the fold's second look, the approved-edit pass) runs the SAME screening
|
|
190
|
+
* the phase-1 pass ran. Present on the pass exactly when a handler hangs on the event on one of those buses (an observe
|
|
191
|
+
* handler of the leg's own runs inside the screening too; it never decides).
|
|
161
192
|
*/
|
|
162
193
|
export interface PreToolUseScreening {
|
|
163
194
|
/** Raise `classic.PreToolUse` over `args`; `subject` names what is screened in a fail-closed sentence; `readAs` is the call
|
|
@@ -169,6 +200,31 @@ export interface PreToolUseScreening {
|
|
|
169
200
|
/** The model-facing text for the screen's OWN deny of this call (unwrapped; every exit wraps it with the leg's mark). */
|
|
170
201
|
deniedReason(answer: PreToolUseResult): string;
|
|
171
202
|
}
|
|
203
|
+
/** What the inherited installations said in a screen, taken onto the pass — the one reading for phase 1 and the fold's second
|
|
204
|
+
* look: a floated question folds as the leg's own hook ask does (the call is marked, so no layer of this leg answers it), the
|
|
205
|
+
* allow speakers go to the allow layer's disclosure (the latest screen's reading replaces an earlier one), and a person's
|
|
206
|
+
* approved edit waits for the lanes' approved-edit pass. */
|
|
207
|
+
export declare function takeInheritedScreen(pass: GatePass, read: InheritedScreenRead | undefined): void;
|
|
208
|
+
/** A screen's `settled` outcome: an inherited installation's question refused where its installation froze it, in the layer word
|
|
209
|
+
* and the cause its reader read (`policy` when it read none), over the bytes its judge judged when a rewrite made them others. */
|
|
210
|
+
export declare function settledScreen(read: {
|
|
211
|
+
readonly decision: PermissionResult;
|
|
212
|
+
readonly deniedBy?: DeniedBy;
|
|
213
|
+
readonly cause?: ClassifierDenyCause;
|
|
214
|
+
}, judged: {
|
|
215
|
+
readonly judged?: unknown;
|
|
216
|
+
}): Extract<PreToolUseScreen, {
|
|
217
|
+
kind: "settled";
|
|
218
|
+
}>;
|
|
219
|
+
/** A settled screen taken onto the pass — the one reading for phase 1, the fold's second look and the approved-edit pass's two
|
|
220
|
+
* screens: its layer word and cause are the pass's; the refusal is returned for the site to stand (the decision, or the edit's). */
|
|
221
|
+
export declare function takeSettledScreen(pass: GatePass, settled: Extract<PreToolUseScreen, {
|
|
222
|
+
kind: "settled";
|
|
223
|
+
}>): PermissionResult;
|
|
224
|
+
/** A settled screen ends the pass as the call's settlement: its refusal is the decision, through the single deny exit. */
|
|
225
|
+
export declare function settledScreenExit(pass: GatePass, settled: Extract<PreToolUseScreen, {
|
|
226
|
+
kind: "settled";
|
|
227
|
+
}>): Promise<ToolGateResult>;
|
|
172
228
|
/** The FACE a pass's questions are put on ({@link askFaceOf} of the call's wire name) — the one reading of it the
|
|
173
229
|
* write-protection tighten (the fold) and every class derivation (the lanes) make. */
|
|
174
230
|
export declare function passAskFace(pass: Pick<GatePass, "req">): AskFace;
|
|
@@ -255,6 +311,18 @@ export interface GatePass {
|
|
|
255
311
|
* that answered it: the allow layer's hook member (its `entries`). Writers: the dispatch (phase 1) and the fold's second
|
|
256
312
|
* look after a policy rewrite (rewrite-rejudge.ts), whose answer replaces the first. Reader: the lanes' allow layer. */
|
|
257
313
|
hookAllowedBy?: readonly string[];
|
|
314
|
+
/** borrowed-mutable — the inherited installations whose `classic.PreToolUse` answered `allow` for the bytes that run: no
|
|
315
|
+
* objection, disclosed as the allow layer's `hook` member over a standing ask (never a clear). Writers: the dispatch (phase 1)
|
|
316
|
+
* and the fold's second look (its reading replaces the first). Reader: the lanes' allow layer. */
|
|
317
|
+
inheritedAllowedBy?: readonly string[];
|
|
318
|
+
/** borrowed-mutable — a person at an inherited installation's question approved an EDIT of the call during a screen: the lanes
|
|
319
|
+
* take it into the approved-edit pass after the fold (as a `tool.check` raise's approval is taken). Writers: the dispatch
|
|
320
|
+
* (phase 1) and the fold's second look. Reader: the lanes. */
|
|
321
|
+
screenApproval?: Extract<PermissionResult, {
|
|
322
|
+
action: "allow";
|
|
323
|
+
}> & {
|
|
324
|
+
readonly updatedInput: unknown;
|
|
325
|
+
};
|
|
258
326
|
/** borrowed-mutable — `tool.check` was raised in this pass's first adjudication, which raises it once: set by the
|
|
259
327
|
* raise in front of the ask branch, read by the raise behind the read-only arm (it then raises nothing). Writer and
|
|
260
328
|
* reader: the lanes. */
|
|
@@ -2,7 +2,7 @@ import { screenGateOutcome, SETTLEMENT_IS_REFUSAL } from "../gate-outcome.js";
|
|
|
2
2
|
import { askFaceOf, classifyAsk, headlessApprovalRemedy } from "../ask-origin.js";
|
|
3
3
|
import { wireOf } from "../tool-name-readings.js";
|
|
4
4
|
import { isProtectedWrite } from "../tool-registry.js";
|
|
5
|
-
import { attestationOf, decisionText, licenseCovers } from "../tool-policy.js";
|
|
5
|
+
import { attestationOf, decisionText, foldHookAsk, licenseCovers } from "../tool-policy.js";
|
|
6
6
|
import { pathDenialCardOf } from "../../tools/fs/safety.js";
|
|
7
7
|
import { argsAsTheToolReads } from "../effective-path-target.js";
|
|
8
8
|
import { rewriteRecordOf } from "../rewrite-rejudge.js";
|
|
@@ -218,6 +218,25 @@ function withParkFailureCause(reason, parkFailed, nobodyJudged) {
|
|
|
218
218
|
const note = `${reason} — note: a durable approval park was attempted for this call and could not be minted (${inlineUntrusted(parkFailed, PARK_FAILURE_CAUSE_MAX)})`;
|
|
219
219
|
return nobodyJudged ? `${note}; with nobody to judge the call, that is why it stopped — it can be issued again once its park can be minted.` : `${note}.`;
|
|
220
220
|
}
|
|
221
|
+
export function takeInheritedScreen(pass, read) {
|
|
222
|
+
if (read?.floated !== undefined)
|
|
223
|
+
pass.hookAsk = pass.hookAsk !== undefined ? foldHookAsk(pass.hookAsk, read.floated) : read.floated;
|
|
224
|
+
pass.inheritedAllowedBy = read !== undefined && read.allowedBy.length > 0 ? read.allowedBy : undefined;
|
|
225
|
+
if (read?.approved !== undefined)
|
|
226
|
+
pass.screenApproval = read.approved;
|
|
227
|
+
}
|
|
228
|
+
export function settledScreen(read, judged) {
|
|
229
|
+
return { kind: "settled", deny: read.decision, deniedBy: read.deniedBy ?? "policy", ...(read.cause !== undefined ? { cause: read.cause } : {}), ...judged };
|
|
230
|
+
}
|
|
231
|
+
export function takeSettledScreen(pass, settled) {
|
|
232
|
+
pass.deniedBy = settled.deniedBy;
|
|
233
|
+
pass.denyCause = settled.cause;
|
|
234
|
+
return settled.deny;
|
|
235
|
+
}
|
|
236
|
+
export async function settledScreenExit(pass, settled) {
|
|
237
|
+
pass.decision = takeSettledScreen(pass, settled);
|
|
238
|
+
return await exitGate(pass);
|
|
239
|
+
}
|
|
221
240
|
export function passAskFace(pass) {
|
|
222
241
|
return askFaceOf(wireOf("gate.askFace", pass.req));
|
|
223
242
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentMessage, ExecutionEnv, GitAnnouncementKind, SessionTreeEntry } from "../../internal/harness-types.js";
|
|
1
|
+
import type { AgentMessage, ExecutionEnv, GitAnnouncementKind, ReadFloor, SessionTreeEntry } from "../../internal/harness-types.js";
|
|
2
2
|
/** Bound into the hash domain: bump when the frame's wording/structure changes so the upgraded
|
|
3
3
|
* renderer re-announces on its first leg instead of being suppressed by a pre-upgrade hash. */
|
|
4
4
|
export declare const GIT_STATUS_FRAME_FORMAT_VERSION = 1;
|
|
@@ -155,6 +155,9 @@ export declare function probeGitStatusLane(args: {
|
|
|
155
155
|
};
|
|
156
156
|
handsEnabled: boolean;
|
|
157
157
|
taskRoot: string;
|
|
158
|
+
/** The byte floor of the run's base read-deny table: the snapshot's lines enter the frame the model reads, so its start
|
|
159
|
+
* carries it (`git config` reads what an `include.path` names). */
|
|
160
|
+
readFloor?: ReadFloor;
|
|
158
161
|
onDegrade: (reason: string) => void;
|
|
159
162
|
}): Promise<GitStatusLaneRef>;
|
|
160
163
|
/**
|
|
@@ -189,7 +192,7 @@ export declare function newestEngineGitFrame(branch: SessionTreeEntry[], mark?:
|
|
|
189
192
|
entryId: string;
|
|
190
193
|
positive: boolean;
|
|
191
194
|
} | undefined;
|
|
192
|
-
export declare function stripGitStatusUnits(text: string
|
|
195
|
+
export declare function stripGitStatusUnits(text: string): string;
|
|
193
196
|
/**
|
|
194
197
|
* The readable-absence tombstone question (R2-1), answered by the classifier above: does the
|
|
195
198
|
* branch carry a still-context-visible POSITIVE engine frame as its newest git frame? A newest
|
|
@@ -62,7 +62,7 @@ export function resolveGitStatusFrame(outcome, canonicalRoot, degradedMaterial)
|
|
|
62
62
|
return resolved;
|
|
63
63
|
}
|
|
64
64
|
export async function probeGitStatusLane(args) {
|
|
65
|
-
const { executionEnv, envFacts, handsEnabled, taskRoot, onDegrade } = args;
|
|
65
|
+
const { executionEnv, envFacts, handsEnabled, taskRoot, readFloor, onDegrade } = args;
|
|
66
66
|
const ref = {};
|
|
67
67
|
if (!handsEnabled)
|
|
68
68
|
return ref;
|
|
@@ -75,7 +75,7 @@ export async function probeGitStatusLane(args) {
|
|
|
75
75
|
...(envFacts.gitDirty !== undefined ? { dirty: envFacts.gitDirty } : {}),
|
|
76
76
|
};
|
|
77
77
|
try {
|
|
78
|
-
const snap = await executionEnv.exec(`(m=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null); m=\${m#origin/}; for s in "$m" main master; do if [ -n "$s" ] && git show-ref --verify --quiet "refs/remotes/origin/$s"; then echo "$s"; break; fi; done) || true; echo "${SEP}"; (git config user.name 2>/dev/null || true); echo "${SEP}"; gs=$(git --no-optional-locks status --short) || exit 41; printf '%s\\n' "$gs"; echo "${SEP}"; gl=$(git --no-optional-locks log --oneline -n 5) || exit 42; printf '%s\\n' "$gl"`, { cwd: envFacts.cwd, timeout: 10 });
|
|
78
|
+
const snap = await executionEnv.exec(`(m=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null); m=\${m#origin/}; for s in "$m" main master; do if [ -n "$s" ] && git show-ref --verify --quiet "refs/remotes/origin/$s"; then echo "$s"; break; fi; done) || true; echo "${SEP}"; (git config user.name 2>/dev/null || true); echo "${SEP}"; gs=$(git --no-optional-locks status --short) || exit 41; printf '%s\\n' "$gs"; echo "${SEP}"; gl=$(git --no-optional-locks log --oneline -n 5) || exit 42; printf '%s\\n' "$gl"`, { cwd: envFacts.cwd, timeout: 10, ...(readFloor !== undefined ? { readFloor } : {}) });
|
|
79
79
|
if (snap.ok && snap.value.exitCode === 0) {
|
|
80
80
|
const parts = snap.value.stdout.split(`${SEP}\n`);
|
|
81
81
|
if (parts.length === 4) {
|
|
@@ -208,8 +208,7 @@ function hasNestedReminderOpenTag(seg) {
|
|
|
208
208
|
}
|
|
209
209
|
return false;
|
|
210
210
|
}
|
|
211
|
-
export function stripGitStatusUnits(text
|
|
212
|
-
void mark;
|
|
211
|
+
export function stripGitStatusUnits(text) {
|
|
213
212
|
const close = "</system-reminder>";
|
|
214
213
|
const findHead = (out, from) => {
|
|
215
214
|
for (let at = out.indexOf("<system-reminder", from); at !== -1; at = out.indexOf("<system-reminder", at + 1)) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ImageContent } from "../../internal/llm.js";
|
|
2
2
|
import { type HostFloor } from "../host-floor.js";
|
|
3
3
|
import type { ImageInput } from "../types.js";
|
|
4
|
+
import { type ImageDownsampler } from "../image-downsample.js";
|
|
4
5
|
/**
|
|
5
6
|
* The guard of a remote image URL: https only, then the one egress hop judge with the private-network floor (`hopRefusal`,
|
|
6
7
|
* host-floor.ts) — the deployment's host floor (`RunnerDeps.hostFloor`, `floor`) must admit the host, and a private host is
|
|
@@ -8,5 +9,9 @@ import type { ImageInput } from "../types.js";
|
|
|
8
9
|
* `169.254.169.254` or a private box. The host is read literally (no DNS resolution). Throws on a refused URL.
|
|
9
10
|
*/
|
|
10
11
|
export declare function defaultImageUrlGuard(raw: string, floor?: HostFloor): void;
|
|
11
|
-
/** Resolve an {@link ImageInput} (inline base64 or a URL to fetch) into a vendored `ImageContent` block
|
|
12
|
-
|
|
12
|
+
/** Resolve an {@link ImageInput} (inline base64 or a URL to fetch) into a vendored `ImageContent` block: both arms pass
|
|
13
|
+
* the one byte admission with the run's processor (inline-image.ts) — a fetched body after the URL's own guard and cap. */
|
|
14
|
+
export declare function toImageContent(img: ImageInput, floor: HostFloor | undefined, processor: ImageDownsampler | "none"): Promise<ImageContent>;
|
|
15
|
+
/** The task's images (`TaskSpec.images`), each through {@link toImageContent} with the run's one processor (`seat` =
|
|
16
|
+
* `RunnerDeps.imageProcessor`); the first one sent unprocessed over the soft target is told to `unprocessed`. */
|
|
17
|
+
export declare function toImageContents(images: readonly ImageInput[], floor: HostFloor | undefined, seat: ImageDownsampler | false | undefined, unprocessed: (bytes: number) => void): Promise<ImageContent[]>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { hopRefusal } from "../host-floor.js";
|
|
2
|
-
import {
|
|
2
|
+
import { firstUnprocessedOverTarget, IMAGE_ADMISSION, sniffImageMime } from "../image-admission.js";
|
|
3
|
+
import { resolveImageProcessor } from "../image-downsample.js";
|
|
3
4
|
import { admitInlineImage } from "./inline-image.js";
|
|
4
|
-
function sniffImageMime(bytes) {
|
|
5
|
-
return ADMITTED_IMAGE_MIME_TYPES.find((mime) => imageMagicMatches(bytes, mime));
|
|
6
|
-
}
|
|
7
5
|
export function defaultImageUrlGuard(raw, floor) {
|
|
8
6
|
let u;
|
|
9
7
|
try {
|
|
@@ -20,7 +18,7 @@ export function defaultImageUrlGuard(raw, floor) {
|
|
|
20
18
|
throw new Error(`image url not fetched — ${refused}`);
|
|
21
19
|
}
|
|
22
20
|
const IMAGE_FETCH_TIMEOUT_MS = 30_000;
|
|
23
|
-
const IMAGE_MAX_BYTES =
|
|
21
|
+
const IMAGE_MAX_BYTES = IMAGE_ADMISSION.hard.urlBytes;
|
|
24
22
|
async function readImageBodyCapped(res) {
|
|
25
23
|
const reader = res.body?.getReader();
|
|
26
24
|
if (!reader) {
|
|
@@ -67,12 +65,20 @@ async function fetchImageCapped(url) {
|
|
|
67
65
|
}
|
|
68
66
|
return { buf, mimeType: sniffed };
|
|
69
67
|
}
|
|
70
|
-
export async function toImageContent(img, floor) {
|
|
68
|
+
export async function toImageContent(img, floor, processor) {
|
|
71
69
|
if ("url" in img) {
|
|
72
70
|
const url = img.url;
|
|
73
71
|
defaultImageUrlGuard(url, floor);
|
|
74
72
|
const { buf, mimeType } = await fetchImageCapped(url);
|
|
75
|
-
return {
|
|
73
|
+
return admitInlineImage({ data: buf.toString("base64"), mimeType }, processor, "the image fetched from its url");
|
|
76
74
|
}
|
|
77
|
-
return admitInlineImage(img);
|
|
75
|
+
return admitInlineImage(img, processor);
|
|
76
|
+
}
|
|
77
|
+
export async function toImageContents(images, floor, seat, unprocessed) {
|
|
78
|
+
const processor = await resolveImageProcessor(seat);
|
|
79
|
+
const blocks = await Promise.all(images.map((img) => toImageContent(img, floor, processor)));
|
|
80
|
+
const over = firstUnprocessedOverTarget(blocks, processor);
|
|
81
|
+
if (over !== undefined)
|
|
82
|
+
unprocessed(over);
|
|
83
|
+
return blocks;
|
|
78
84
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `TaskSpec.images`
|
|
3
|
-
* (image-admission.ts) — a claimed type the API accepts, within the raw cap, that type's
|
|
4
|
-
* the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The `TaskSpec.images` arms' admission: the same byte admission a file the Read tool serves passes
|
|
3
|
+
* (image-admission.ts), with the run's processor — a claimed type the API accepts, within the raw cap, that type's
|
|
4
|
+
* signature, then the processor (or, with none, a header-stated size within the reject edge), under the provider's
|
|
5
|
+
* base64 limit. Without it a mis-declared image rode straight to the provider and 400'd the whole request. Like the
|
|
6
|
+
* Read lane it checks the SIGNATURE, not decodability: a file cut short after its signature passes when no processor
|
|
7
|
+
* reads it (KL-1311a-c). The block is built from the bytes that were checked (or the processor made from them).
|
|
8
8
|
*/
|
|
9
9
|
import type { ImageContent } from "../../internal/llm.js";
|
|
10
10
|
import type { ImageInput } from "../types.js";
|
|
11
|
-
|
|
11
|
+
import type { ImageDownsampler } from "../image-downsample.js";
|
|
12
|
+
/** Admit one entry's bytes (`{ data, mimeType }` — inline, or a URL arm's fetched body, `subject` naming which) or throw
|
|
13
|
+
* `config.image_invalid`. */
|
|
12
14
|
export declare function admitInlineImage(img: Extract<ImageInput, {
|
|
13
15
|
data: string;
|
|
14
|
-
}
|
|
16
|
+
}>, processor: ImageDownsampler | "none", subject?: string): Promise<ImageContent>;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES } from "../image-admission.js";
|
|
2
|
-
import { MCP_IMAGE_MAX_BASE64 } from "../image-downsample.js";
|
|
1
|
+
import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES, IMAGE_ADMISSION, unprocessedSizeClause } from "../image-admission.js";
|
|
3
2
|
function inlineImageRefusal(detail) {
|
|
4
3
|
const e = new Error(`TaskSpec.images: ${detail}`);
|
|
5
4
|
e.code = "config.image_invalid";
|
|
6
5
|
return e;
|
|
7
6
|
}
|
|
8
|
-
export async function admitInlineImage(img) {
|
|
7
|
+
export async function admitInlineImage(img, processor, subject = "an inline image") {
|
|
9
8
|
const data = img.data;
|
|
10
9
|
const mimeType = img.mimeType;
|
|
11
10
|
if (typeof data !== "string" || typeof mimeType !== "string")
|
|
12
|
-
throw inlineImageRefusal(
|
|
13
|
-
const admitted = await admitImageBytes(Buffer.from(data, "base64"), mimeType,
|
|
11
|
+
throw inlineImageRefusal(`${subject} needs a base64 string \`data\` and a string \`mimeType\`.`);
|
|
12
|
+
const admitted = await admitImageBytes(Buffer.from(data, "base64"), mimeType, processor);
|
|
14
13
|
if (admitted.ok)
|
|
15
14
|
return admitted.block;
|
|
16
15
|
switch (admitted.reason) {
|
|
17
16
|
case "mime_unsupported":
|
|
18
|
-
throw inlineImageRefusal(
|
|
17
|
+
throw inlineImageRefusal(`${subject} declares mimeType ${JSON.stringify(mimeType.slice(0, 80))}, which the model API does not accept (accepted: ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}).`);
|
|
19
18
|
case "magic_mismatch":
|
|
20
|
-
throw inlineImageRefusal(
|
|
19
|
+
throw inlineImageRefusal(`${subject}'s bytes do not open with a valid ${mimeType} header (empty, truncated, mis-declared, not base64, or a variant such as an Apple-optimized PNG that model APIs cannot read) — refused rather than sent.`);
|
|
21
20
|
case "raw_too_large":
|
|
22
|
-
throw inlineImageRefusal(
|
|
21
|
+
throw inlineImageRefusal(`${subject} is ${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
|
|
22
|
+
case "dimensions_unreadable":
|
|
23
|
+
case "dimensions_too_large":
|
|
24
|
+
throw inlineImageRefusal(`${subject} is refused rather than sent: ${unprocessedSizeClause(admitted)}.`);
|
|
23
25
|
case "base64_too_large":
|
|
24
|
-
throw inlineImageRefusal(
|
|
26
|
+
throw inlineImageRefusal(`${subject}'s base64 is ${admitted.base64.length} chars, over the ${IMAGE_ADMISSION.hard.imageBase64Chars}-char / 5MB API image limit — shrink it before sending.`);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brainToRuntime } from "../runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { catalogOfDeps, roleModelIfSet, unheldChainRefusal } from "../roles.js";
|
|
3
3
|
import { isAliasModelId, openAiCompatChatSeat } from "../memory-engine/distiller.js";
|
|
4
4
|
import { runMemoryConsolidationDriver } from "../memory-engine/consolidation-driver.js";
|
|
5
5
|
import { recommendationUnconsumed } from "../memory-engine/consolidation.js";
|
|
@@ -26,7 +26,7 @@ export function resolveMemoryConsolidationDriver(deps) {
|
|
|
26
26
|
model = seat.chat.model;
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
const models =
|
|
29
|
+
const models = catalogOfDeps(deps);
|
|
30
30
|
const resolved = roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles });
|
|
31
31
|
if (resolved === undefined) {
|
|
32
32
|
throw unheldChainRefusal(["consolidate", "summarize"], models, deps.roles) ?? seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
|
|
@@ -65,7 +65,7 @@ export function resolveMemoryConsolidationDriver(deps) {
|
|
|
65
65
|
export function consolidationSeatResolvable(deps) {
|
|
66
66
|
if (deps.memoryConsolidationDriver?.chat !== undefined)
|
|
67
67
|
return true;
|
|
68
|
-
const models =
|
|
68
|
+
const models = catalogOfDeps(deps);
|
|
69
69
|
return (roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles })) !== undefined;
|
|
70
70
|
}
|
|
71
71
|
export function autoRunConsolidationFromRecommendation(args) {
|
|
@@ -116,6 +116,6 @@ export function assertAutoConsolidationWirable(deps) {
|
|
|
116
116
|
throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but RunnerDeps.memoryConsolidation is absent — the recommendation that would trigger a run is never minted (consolidation is OFF) and the engine's verbs refuse coded, so the trigger can never fire. An armed-but-unrunnable trigger is refused, never folded to off: wire memoryConsolidation, or leave autoRunOnRecommendation unset.");
|
|
117
117
|
}
|
|
118
118
|
if (!consolidationSeatResolvable(deps)) {
|
|
119
|
-
throw unheldChainRefusal(["consolidate", "summarize"],
|
|
119
|
+
throw unheldChainRefusal(["consolidate", "summarize"], catalogOfDeps(deps), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -123,7 +123,7 @@ export function createPermissionRuleLanes(cfg) {
|
|
|
123
123
|
if (!judged.some(([, g]) => g === "path") && faceRowsSpeakFor(callPathFaceOf(req)))
|
|
124
124
|
judged.push([req.toolName, "path"]);
|
|
125
125
|
const view = await reader.pin(req.toolCallId, req.args);
|
|
126
|
-
const ownRow = (r) => judged.some(([n]) => n === r.tool) || wholeToolRuleReaches(r.tool, req);
|
|
126
|
+
const ownRow = (r) => judged.some(([n]) => n === r.tool) || wholeToolRuleReaches(r.tool, req, r.behavior);
|
|
127
127
|
if (judged.length === 0 && !view.rules.some(ownRow))
|
|
128
128
|
return view.unreadable !== undefined ? { unreadable: true } : undefined;
|
|
129
129
|
try {
|