@sema-agent/core 7.15.0 → 7.17.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 +202 -0
- package/dist/agents/builtin-agents.d.ts +3 -3
- package/dist/agents/cross-session-envelope.d.ts +0 -1
- package/dist/agents/cross-session-envelope.js +0 -1
- package/dist/agents/peer-notices.d.ts +0 -9
- package/dist/agents/peer-notices.js +0 -63
- package/dist/agents/subagent.js +7 -15
- package/dist/brain/request-params.d.ts +2 -2
- package/dist/config/defaults.d.ts +0 -7
- package/dist/config/defaults.js +0 -2
- package/dist/core/artifact-host.d.ts +218 -0
- package/dist/core/artifact-host.js +92 -0
- package/dist/core/ask-origin.d.ts +29 -3
- package/dist/core/ask-origin.js +17 -9
- package/dist/core/ask-question.d.ts +25 -0
- package/dist/core/ask-question.js +4 -0
- package/dist/core/ask-unresolvable-notice.d.ts +30 -21
- package/dist/core/ask-unresolvable-notice.js +16 -8
- package/dist/core/auto-compaction.d.ts +10 -10
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/background-agent-store.d.ts +5 -5
- package/dist/core/background-shell.d.ts +1 -1
- package/dist/core/checkpoint-execution-record.d.ts +0 -3
- package/dist/core/checkpoint-execution-record.js +0 -4
- package/dist/core/checkpoint-store.d.ts +71 -99
- package/dist/core/checkpoint-store.js +9 -16
- package/dist/core/context-edit.d.ts +36 -104
- package/dist/core/context-edit.js +37 -60
- package/dist/core/effective-path-target.d.ts +68 -8
- package/dist/core/effective-path-target.js +42 -30
- package/dist/core/engine-notice.d.ts +46 -32
- package/dist/core/env-budget.d.ts +31 -0
- package/dist/core/env-budget.js +39 -0
- package/dist/core/exec-output-tail.d.ts +5 -5
- package/dist/core/file-history-store.js +3 -6
- package/dist/core/fs-write-gate-policy.d.ts +1 -1
- package/dist/core/fs-write-gate-policy.js +3 -3
- package/dist/core/gate-lanes.js +9 -15
- package/dist/core/governance-codes.d.ts +1 -1
- package/dist/core/governance-codes.js +4 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +18 -17
- package/dist/core/lsp-session.d.ts +1 -1
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/lsp.js +5 -4
- package/dist/core/mcp.d.ts +5 -5
- package/dist/core/mcp.js +4 -48
- package/dist/core/memory-engine/delegation-settlement.d.ts +37 -12
- package/dist/core/memory-engine/delegation-settlement.js +128 -39
- package/dist/core/memory-engine/engine.d.ts +9 -8
- package/dist/core/memory-engine/engine.js +115 -120
- package/dist/core/memory-engine/file-backend.d.ts +17 -5
- package/dist/core/memory-engine/file-backend.js +78 -34
- package/dist/core/memory-engine/index.d.ts +2 -2
- package/dist/core/memory-engine/index.js +2 -2
- package/dist/core/memory-engine/layout.d.ts +152 -54
- package/dist/core/memory-engine/layout.js +441 -104
- package/dist/core/memory-engine/types.d.ts +8 -3
- package/dist/core/memory-engine/types.js +5 -0
- package/dist/core/memory-recall.d.ts +0 -8
- package/dist/core/memory.d.ts +1 -1
- package/dist/core/oracle-isolation.js +2 -2
- package/dist/core/parent-spec-seat.d.ts +66 -0
- package/dist/core/parent-spec-seat.js +47 -0
- package/dist/core/permission-rule-model.d.ts +11 -6
- package/dist/core/permission-rule-model.js +53 -37
- package/dist/core/permission-rules.js +8 -3
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/remote-env.d.ts +1 -1
- package/dist/core/retired-keys.d.ts +19 -0
- package/dist/core/retired-keys.js +15 -0
- package/dist/core/runner/abort-race.d.ts +3 -3
- package/dist/core/runner/active-skill-scope.d.ts +2 -2
- package/dist/core/runner/active-skill-scope.js +3 -3
- package/dist/core/runner/assemble-result.d.ts +42 -40
- package/dist/core/runner/assemble-result.js +5 -4
- package/dist/core/runner/checkpoint-scope.d.ts +4 -4
- package/dist/core/runner/clock-and-limits.d.ts +3 -3
- package/dist/core/runner/compaction-call-options.d.ts +35 -99
- package/dist/core/runner/compaction-knobs.d.ts +4 -4
- package/dist/core/runner/compaction-seams.d.ts +5 -5
- package/dist/core/runner/contracts.d.ts +232 -233
- package/dist/core/runner/decide-continuation.d.ts +6 -6
- package/dist/core/runner/denial-limit-arms.d.ts +8 -8
- package/dist/core/runner/derived-route-fallback.d.ts +2 -2
- package/dist/core/runner/gate-exit.d.ts +6 -6
- package/dist/core/runner/gate-exit.js +15 -1
- package/dist/core/runner/git-status-frame.d.ts +7 -7
- package/dist/core/runner/halt-attribution.d.ts +35 -0
- package/dist/core/runner/halt-attribution.js +16 -0
- package/dist/core/runner/inherited-ask-grants.d.ts +6 -6
- package/dist/core/runner/memory-capture-optout.d.ts +1 -1
- package/dist/core/runner/memory-consolidation-driver.d.ts +4 -4
- package/dist/core/runner/memory-consolidation.d.ts +6 -8
- package/dist/core/runner/memory-consolidation.js +0 -1
- package/dist/core/runner/park-commit.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.d.ts +19 -19
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -4
- package/dist/core/runner/prepare-artifact.d.ts +53 -0
- package/dist/core/runner/prepare-artifact.js +77 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +3 -3
- package/dist/core/runner/prepare-boundary-parks.d.ts +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +9 -7
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -3
- package/dist/core/runner/prepare-config-doors.d.ts +24 -24
- package/dist/core/runner/prepare-config-doors.js +5 -2
- package/dist/core/runner/prepare-context-lane.d.ts +8 -8
- package/dist/core/runner/prepare-context-lane.js +2 -13
- package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +3 -3
- package/dist/core/runner/prepare-file-history.js +3 -52
- package/dist/core/runner/prepare-gate-stations.d.ts +5 -5
- package/dist/core/runner/prepare-hands-readface.d.ts +35 -38
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-inherited-gate.d.ts +9 -6
- package/dist/core/runner/prepare-inherited-gate.js +7 -8
- package/dist/core/runner/prepare-listings.d.ts +3 -3
- package/dist/core/runner/prepare-lsp.d.ts +3 -3
- package/dist/core/runner/prepare-memory-engine-session.d.ts +5 -5
- package/dist/core/runner/prepare-memory.d.ts +4 -6
- package/dist/core/runner/prepare-memory.js +10 -9
- package/dist/core/runner/prepare-offload-wrappers.d.ts +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +6 -6
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -7
- package/dist/core/runner/prepare-policy-chain.js +15 -30
- package/dist/core/runner/prepare-prompt-assembly.js +1 -1
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -5
- package/dist/core/runner/prepare-protocol-tools.d.ts +1 -1
- package/dist/core/runner/prepare-question-face.d.ts +4 -4
- package/dist/core/runner/prepare-run-refs.d.ts +11 -11
- package/dist/core/runner/prepare-safety-scan.d.ts +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -4
- package/dist/core/runner/prepare-suspend-saga.js +0 -2
- package/dist/core/runner/prepare-task.d.ts +12 -12
- package/dist/core/runner/prepare-task.js +10 -9
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +2 -3
- package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -4
- package/dist/core/runner/prepare-wiring-manifest.js +9 -7
- package/dist/core/runner/prepare-workspace-restore.d.ts +1 -1
- package/dist/core/runner/remote-env-retry.d.ts +3 -3
- package/dist/core/runner/resume-admission.d.ts +1 -1
- package/dist/core/runner/resume-admission.js +2 -1
- package/dist/core/runner/resume-claim.d.ts +1 -1
- package/dist/core/runner/resume-internals-and-config.d.ts +1 -1
- package/dist/core/runner/resume-internals-and-config.js +4 -0
- package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
- package/dist/core/runner/resume-preflight.d.ts +1 -1
- package/dist/core/runner/resume-review-outcome.d.ts +1 -1
- package/dist/core/runner/retired-runner-deps.d.ts +3 -0
- package/dist/core/runner/retired-runner-deps.js +7 -0
- package/dist/core/runner/run-brain-sinks.d.ts +1 -1
- package/dist/core/runner/run-clock-and-content.d.ts +4 -4
- package/dist/core/runner/run-compaction-machinery.d.ts +3 -3
- package/dist/core/runner/run-git-lane.d.ts +1 -1
- package/dist/core/runner/run-harness-handlers.d.ts +2 -2
- package/dist/core/runner/run-harness-handlers.js +2 -3
- package/dist/core/runner/run-identity-wiring.d.ts +4 -4
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-notification-lane.d.ts +2 -2
- package/dist/core/runner/run-reasoning-seat.d.ts +2 -2
- package/dist/core/runner/run-settle-and-teardown.d.ts +5 -5
- package/dist/core/runner/run-settle-and-teardown.js +3 -1
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +2 -2
- package/dist/core/runner/run-terminal-adoption.d.ts +5 -5
- package/dist/core/runner/runtask.d.ts +14 -14
- package/dist/core/runner/session-file-state-replay.d.ts +3 -3
- package/dist/core/runner/session-file-state-replay.js +3 -3
- package/dist/core/runner/session-rule-policy.d.ts +2 -2
- package/dist/core/runner/session-rule-policy.js +3 -4
- package/dist/core/runner/steer-admission.d.ts +2 -2
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -1
- package/dist/core/runner/stream-halt-verbs.js +1 -1
- package/dist/core/runner/stream-reap.d.ts +1 -1
- package/dist/core/runner/stream-steer-verb.js +1 -4
- package/dist/core/runner/synthetic-tools.d.ts +8 -8
- package/dist/core/runner/teardown-bounded.d.ts +2 -2
- package/dist/core/runner/tool-defer-gate.d.ts +1 -1
- package/dist/core/runner/tool-disclosure.d.ts +33 -33
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-face-overlay.d.ts +2 -2
- package/dist/core/runner/tool-output-projection.d.ts +2 -2
- package/dist/core/runner/turn-attachments.d.ts +53 -53
- package/dist/core/runner/usage-accounting.d.ts +4 -4
- package/dist/core/runner/workspace-path.d.ts +1 -1
- package/dist/core/runner/workspace-path.js +3 -0
- package/dist/core/runner-deps.d.ts +30 -49
- package/dist/core/safe-notify.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +4 -4
- package/dist/core/session.d.ts +2 -2
- package/dist/core/skill-tool-specifier.d.ts +1 -1
- package/dist/core/skills-directory.d.ts +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +1 -1
- package/dist/core/strategy-store.d.ts +8 -11
- package/dist/core/task-event.d.ts +20 -17
- package/dist/core/task-limits.d.ts +1 -1
- package/dist/core/task-notification.d.ts +5 -5
- package/dist/core/task-registry-agent.d.ts +5 -5
- package/dist/core/task-registry-monitor.d.ts +2 -2
- package/dist/core/task-registry-shared.d.ts +27 -27
- package/dist/core/task-registry-shared.js +3 -13
- package/dist/core/task-registry.d.ts +8 -8
- package/dist/core/task-result.d.ts +37 -37
- package/dist/core/task-spec.d.ts +5 -5
- package/dist/core/task-stream.d.ts +16 -11
- package/dist/core/tool-catalog-entries.d.ts +1 -0
- package/dist/core/tool-catalog-entries.js +5 -0
- package/dist/core/tool-conformance.d.ts +0 -2
- package/dist/core/tool-conformance.js +1 -3
- package/dist/core/tool-errors.d.ts +5 -0
- package/dist/core/tool-errors.js +1 -0
- package/dist/core/tool-policy.d.ts +51 -22
- package/dist/core/tool-policy.js +28 -5
- package/dist/core/tool-result-budget.d.ts +1 -1
- package/dist/core/tool-result-store.d.ts +11 -11
- package/dist/core/tool-spec.d.ts +34 -38
- package/dist/core/tools.d.ts +2 -2
- package/dist/core/trace.d.ts +12 -15
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +4 -3
- package/dist/core/workflow-journal-store.d.ts +11 -11
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -2
- package/dist/engine/execution-env/node-execution-env.js +4 -2
- package/dist/engine/harness/agent-harness.d.ts +47 -4
- package/dist/engine/harness/agent-harness.js +52 -9
- package/dist/engine/llm/types.d.ts +1 -1
- package/dist/engine/loop/agent-loop.js +15 -8
- package/dist/engine/loop/types.d.ts +5 -0
- package/dist/index.d.ts +21 -16
- package/dist/index.js +17 -12
- package/dist/internal/harness.d.ts +1 -0
- package/dist/orchestration/run-spec.d.ts +3 -0
- package/dist/orchestration/run-spec.js +3 -3
- package/dist/orchestration/run-workflow-tool.d.ts +12 -6
- package/dist/orchestration/run-workflow-tool.js +23 -5
- package/dist/orchestration/workflow-primitives.d.ts +4 -2
- package/dist/orchestration/workflow-primitives.js +1 -4
- package/dist/orchestration/workflow-types.d.ts +34 -4
- package/dist/orchestration/workflow-types.js +2 -0
- package/dist/orchestration/workflow.d.ts +39 -7
- package/dist/orchestration/workflow.js +234 -113
- package/dist/prompt-assembly/assemble.d.ts +2 -2
- package/dist/prompt-assembly/assemble.js +9 -9
- package/dist/prompt-assembly/composer.d.ts +6 -7
- package/dist/prompt-assembly/composer.js +10 -10
- package/dist/prompt-assembly/epoch.js +1 -1
- package/dist/prompt-assembly/event-registry.d.ts +0 -21
- package/dist/prompt-assembly/packs/sema-default.js +30 -30
- package/dist/prompt-assembly/types.d.ts +14 -14
- package/dist/prompts/coordinator.d.ts +0 -13
- package/dist/prompts/coordinator.js +0 -3
- package/dist/stores/file/checkpoint-store.js +1 -5
- package/dist/stores/file/file-history-store.js +2 -2
- package/dist/stores/file/permission-rule-store.d.ts +4 -35
- package/dist/stores/file/permission-rule-store.js +4 -148
- package/dist/tools/artifact/artifact-text.d.ts +62 -0
- package/dist/tools/artifact/artifact-text.js +68 -0
- package/dist/tools/artifact/artifact-tool.d.ts +52 -0
- package/dist/tools/artifact/artifact-tool.js +351 -0
- package/dist/tools/artifact/local-stub.d.ts +26 -0
- package/dist/tools/artifact/local-stub.js +296 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +114 -48
- package/dist/tools/fs/bash-readonly-classifier.js +171 -60
- package/dist/tools/fs/encoding.d.ts +31 -40
- package/dist/tools/fs/fs-bash.d.ts +49 -45
- package/dist/tools/fs/fs-bash.js +19 -27
- package/dist/tools/fs/fs-pdf.d.ts +8 -8
- package/dist/tools/fs/fs-search-tools.d.ts +4 -4
- package/dist/tools/fs/fs-search-tools.js +5 -2
- package/dist/tools/fs/fs-shared.d.ts +146 -158
- package/dist/tools/fs/fs-shared.js +3 -11
- package/dist/tools/fs/fs-write.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +13 -14
- package/dist/tools/fs/index.d.ts +78 -78
- package/dist/tools/fs/index.js +4 -1
- package/dist/tools/fs/notebook.d.ts +24 -25
- package/dist/tools/fs/pdf.d.ts +3 -3
- package/dist/tools/fs/read-deny.d.ts +22 -22
- package/dist/tools/fs/read-face.d.ts +21 -24
- package/dist/tools/fs/repo-map.d.ts +8 -8
- package/dist/tools/fs/safety.d.ts +233 -130
- package/dist/tools/fs/safety.js +131 -31
- package/dist/tools/fs/search.d.ts +63 -71
- package/dist/tools/fs/search.js +8 -6
- package/package.json +6 -2
- package/test/export-surface.snapshot.json +119 -39
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The permission-rule LANES the unified store feeds (prepare-path machinery): the two gate
|
|
3
3
|
* lanes, and — since the policy-chain phase took the chain assembly — the rule-offer factory every ask-mint site calls.
|
|
4
4
|
*
|
|
5
5
|
* `prepareTask` used to assemble the personal lane inline (a store read + a hand-spliced session
|
|
@@ -35,7 +35,7 @@ import type { PermissionRuleStoreProvider } from "../permission-rule-provider.js
|
|
|
35
35
|
* it alone). The PATH grammar's tools are derived from the catalog (`ruleToolGrammarOf`). */
|
|
36
36
|
export declare const PERSISTED_RULE_TOOL = "Bash";
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* The evidence an INHERITED-lane ask carries.
|
|
39
39
|
*
|
|
40
40
|
* The three inherited mint sites present an ANCESTOR policy's own decision, resolved at the ancestor's
|
|
41
41
|
* approver, from inside the policy fold — upstream of the gate's org layer and its rule lane, neither of
|
|
@@ -52,10 +52,10 @@ export declare const PERSISTED_RULE_TOOL = "Bash";
|
|
|
52
52
|
*/
|
|
53
53
|
export declare function inheritedAskRuleEvidence(provider: PermissionRuleStoreProvider | undefined): AskRuleEvidence;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* The snapshot REVISION an org answer was read off, screened before it becomes
|
|
56
56
|
* evidence.
|
|
57
57
|
*
|
|
58
|
-
*
|
|
58
|
+
* The org partition's own install and serving gates screen a snapshot's revision,
|
|
59
59
|
* so a healthy in-tree partition cannot reach here with junk; a FOREIGN store (the interface is public)
|
|
60
60
|
* can. A non-finite value is refused rather than carried — an evidence field is worthless if `NaN` can
|
|
61
61
|
* wear the same shape as revision 41 — and the defect is announced through `onDefect` instead of quietly
|
|
@@ -68,7 +68,7 @@ export declare function orgRevisionEvidenceOf(resolution: OrgRuleResolution, onD
|
|
|
68
68
|
revision?: number;
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* Project the model's verdict onto the gate's rule-lane answer: the
|
|
72
72
|
* behavior that spoke, and each member's canonical text plus its own add DOTS. For an allow the set is
|
|
73
73
|
* the admitting COVERAGE SET (a single rule admitting the whole command is a one-element set; a compound
|
|
74
74
|
* admitted by the per-segment conjunction is the set of covering rules in segment order — the model's
|
|
@@ -87,14 +87,14 @@ export declare function persistedRuleHitOf(verdict: PersistedRuleVerdict | undef
|
|
|
87
87
|
* other verdict is {@link persistedRuleHitOf}'s hit. */
|
|
88
88
|
export declare function persistedRuleAnswerOf(verdict: PersistedRuleVerdict | undefined): PersistedRuleHit | PersistedRuleUnreadable | undefined;
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* Widened to every path-targeting tool — the persisted-rule lane's PATH arm: the call's
|
|
91
91
|
* target path in the SAME lexical identity the rule family is defined over, resolved by the ONE reader every
|
|
92
92
|
* fence and every tool goes through (`effectivePathTargetOf`), so the lane judges the path the tool will
|
|
93
93
|
* really open. The tool's own declaration decides which base a relative spelling takes and what an ABSENT
|
|
94
94
|
* slot means — the lane no longer guesses `liveCwd ?? root` for every tool, which was wrong for the two
|
|
95
95
|
* search tools in three separate shapes (see effective-path-target.ts). Still zero IO.
|
|
96
96
|
*
|
|
97
|
-
* TWO readings of the call's path slot, one per direction
|
|
97
|
+
* TWO readings of the call's path slot, one per direction: the tightening arms judge
|
|
98
98
|
* the PROTECTIVE target (the object face's declaration, the catalog's for the name as the floor — reading
|
|
99
99
|
* the catalog for an undeclared same-name tool can only tighten a deny); the allow arm judges the DECLARED
|
|
100
100
|
* target (the face's OWN declaration only — a same-name tool that declares no path target is unconfirmable
|
|
@@ -123,7 +123,7 @@ export interface PermissionRuleLanes {
|
|
|
123
123
|
/**
|
|
124
124
|
* Build the gate's two permission-rule lanes over the unified store, resolved once per task.
|
|
125
125
|
*
|
|
126
|
-
*
|
|
126
|
+
* The LOCAL-OWNER declaration is judged here, at prepare. It is a declaration,
|
|
127
127
|
* so one that cannot be honored is refused LOUDLY rather than degrading into "this deployment's standing
|
|
128
128
|
* approvals silently stopped applying" (the §7.4 org bit's rule, applied to the availability direction:
|
|
129
129
|
* the failure is deterministic and belongs at wiring time).
|
|
@@ -136,10 +136,10 @@ export declare function createPermissionRuleLanes(cfg: {
|
|
|
136
136
|
/** The isolation-aware task root — the same value the file fence, the prompt cwd and the session rules
|
|
137
137
|
* use, so a project-scoped rule agrees with every other place that says "this project". */
|
|
138
138
|
root: string;
|
|
139
|
-
/** The LIVE tracked working directory
|
|
139
|
+
/** The LIVE tracked working directory: the base a relative cd resolves against
|
|
140
140
|
* after an earlier observable `cd`; read per call. */
|
|
141
141
|
liveCwd: () => string | undefined;
|
|
142
|
-
/**
|
|
142
|
+
/** The EXECUTION ENVIRONMENT's home directory (`ExecutionEnv.homeDir`, adapter-declared), the base a
|
|
143
143
|
* `~/` path rule resolves against. `undefined` = the adapter declares none: a `~/` deny/ask row then reads
|
|
144
144
|
* UNREADABLE for every call (a fail-closed ask), never the engine process's home. A declared value that is
|
|
145
145
|
* not an absolute path is refused HERE, loudly (a bad declaration is a wiring defect, not an absence). */
|
|
@@ -153,7 +153,7 @@ export declare function createPermissionRuleLanes(cfg: {
|
|
|
153
153
|
* lane took the read. */
|
|
154
154
|
onDisclosure: (message: string) => void;
|
|
155
155
|
}): PermissionRuleLanes;
|
|
156
|
-
/** The closed reason set for the rule-offer factory's empty answer
|
|
156
|
+
/** The closed reason set for the rule-offer factory's empty answer — the same three
|
|
157
157
|
* spellings the `AskRequest` and durable-row seats declare, kept at the one factory that fills both.
|
|
158
158
|
* Deliberately not exported: this is a wire vocabulary, and its two faces declare it literally (the
|
|
159
159
|
* `previewWithheld` precedent) so a consumer reads the closed set on the type it is holding rather
|
|
@@ -166,10 +166,10 @@ interface RuleOffersAskFacts {
|
|
|
166
166
|
requiresRealApproval?: boolean;
|
|
167
167
|
persistedRuleShadowed?: string;
|
|
168
168
|
decisionReason?: import("../tool-policy.js").DecisionReason;
|
|
169
|
-
/**
|
|
169
|
+
/** An EXPLICIT `ask` permission rule matched this call (DSL, stamped at
|
|
170
170
|
* the rule policy's three matched-ask exits — bare, covering and param). */
|
|
171
171
|
matchedAskRule?: string;
|
|
172
|
-
/**
|
|
172
|
+
/** The engine-stamped probe mandate (the reversibility probe declared this call's
|
|
173
173
|
* demotion structural — for the built-in shell probe, a read outside the session's
|
|
174
174
|
* allowed directories). */
|
|
175
175
|
probeMandated?: boolean;
|
|
@@ -177,13 +177,13 @@ interface RuleOffersAskFacts {
|
|
|
177
177
|
/** The ask is being resolved at an ANCESTOR's frozen approver (the three inherited-lane
|
|
178
178
|
* mint sites pass it literally) — this task's rule lane never adjudicates it. */
|
|
179
179
|
ancestorResolved?: boolean;
|
|
180
|
-
/**
|
|
180
|
+
/** The surviving ask's engine-stamped per-segment coverage table — the
|
|
181
181
|
* batch offer carries exactly the segments this table calls uncovered. Absent ⇒ all
|
|
182
182
|
* segments read as uncovered (over-offer, the safe direction). */
|
|
183
183
|
segmentCoverage?: readonly SegmentCoverage[];
|
|
184
184
|
}
|
|
185
185
|
/**
|
|
186
|
-
*
|
|
186
|
+
* The rule forms that could cover this exact call, for a surface's "stop asking me
|
|
187
187
|
* this" option (extracted from the prepare body, the spliceSessionOverlayRows precedent; the maker
|
|
188
188
|
* captures the per-task wiring once and the returned factory serves all five ask-mint sites — the
|
|
189
189
|
* approval-preview field is a standing example of what happens otherwise: it reached two of the
|
|
@@ -197,7 +197,7 @@ interface RuleOffersAskFacts {
|
|
|
197
197
|
* questions, never a mandated one". Two doors, matching the two halves of that boundary:
|
|
198
198
|
* · the marks half, judged from the SAME resolved sources the gate input is built from, through the
|
|
199
199
|
* gate's own single-source predicate (an operator's shellGate:"always", the tool's own
|
|
200
|
-
* egress/irreversibility marks, and —
|
|
200
|
+
* egress/irreversibility marks, and — separately — the PER-CALL member that predicate also takes: a
|
|
201
201
|
* demotion this call's reversibility probe declared structural, read off the ask the gate
|
|
202
202
|
* stamped rather than off the tool seat, because it is true of one call and not of the seat) —
|
|
203
203
|
* a drift here would offer a rule the lane then refuses to honor;
|
|
@@ -211,7 +211,7 @@ interface RuleOffersAskFacts {
|
|
|
211
211
|
* "stop asking me this" on a card that will keep asking lets a person mint a rule that never
|
|
212
212
|
* takes effect where they minted it.
|
|
213
213
|
*
|
|
214
|
-
*
|
|
214
|
+
* (CC 2.1.245 toolPolicy 对表, F11: "wildcard `ask` … keeps every matching tool behind a
|
|
215
215
|
* per-call prompt (no persistent always-allow)") — `matchedAskRule` was the one conjunct of the
|
|
216
216
|
* lane's own clearing predicate this door did not mirror, and the asymmetry was live: the
|
|
217
217
|
* persisted-rule lane refuses to clear ANY ask carrying it (`hooks.ts`, the
|
|
@@ -222,7 +222,7 @@ interface RuleOffersAskFacts {
|
|
|
222
222
|
* suppressed one call too late, after the useless rule existed. The shadowed conjunct stays: it
|
|
223
223
|
* covers the person who ALREADY has the allow rule; this one covers the person about to mint it.
|
|
224
224
|
*
|
|
225
|
-
*
|
|
225
|
+
* Every door above that answers "no offers" now also names WHICH door, on the
|
|
226
226
|
* `ruleOffersAbsence` seat (`AskRequest`'s and the durable row's, ONE factory so the two faces
|
|
227
227
|
* cannot disagree). The doctrine it serves is the loud-bad-value one, applied to an absence: a
|
|
228
228
|
* surface reading an empty card could not tell "there is nothing this lane could offer" from
|
|
@@ -249,7 +249,7 @@ export declare function createRuleOffersOf(cfg: {
|
|
|
249
249
|
has(name: string): boolean;
|
|
250
250
|
};
|
|
251
251
|
taskRoot: string | undefined;
|
|
252
|
-
/** The live tracked-cwd ref (read per call — the relative-cd resolution base
|
|
252
|
+
/** The live tracked-cwd ref (read per call — the relative-cd resolution base). */
|
|
253
253
|
cwdRef: {
|
|
254
254
|
current: string;
|
|
255
255
|
} | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* PrepareTask's session acquire+reconcile phase. Acquire the session
|
|
3
3
|
* and, when resuming, reconcile any interrupted (orphan) tool call before the turn. Both are retried
|
|
4
4
|
* together on a F2 optimistic-lock conflict: a concurrent writer on another instance can move the
|
|
5
5
|
* leaf during reconcile's append, and the fix can't be applied to a now-stale in-memory view — so we
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* (resume-at validation + rebranch + reconcile re-run as one unit against the fresh view) — pinned
|
|
9
9
|
* in `prepare-task-phase-pins`.
|
|
10
10
|
*
|
|
11
|
-
* Ownership
|
|
11
|
+
* Ownership: on SUCCESS the acquired session's ownership transfers whole
|
|
12
12
|
* to the caller (the driver's forgetOnThrow / the Runner's finish own the cleanup from then on);
|
|
13
13
|
* every failure path INSIDE this phase drops its own cached view first (`forget`, never `release` —
|
|
14
14
|
* audit B-17: release deletes the history on the default store), so a throw here never strands a
|
|
@@ -46,14 +46,14 @@ export interface PrepareAcquireReconcileInput {
|
|
|
46
46
|
* partition. Never combined with `requireExistingSession` semantics: the require-existing form
|
|
47
47
|
* re-opens and placement is first-write immutable, so it rides only the create-capable arm. */
|
|
48
48
|
placement?: import("../session.js").SessionPlacement;
|
|
49
|
-
/** borrowed-readonly —
|
|
49
|
+
/** borrowed-readonly — the durable-park TOPOLOGY gap sentence for this
|
|
50
50
|
* deployment (`durableParkGapFor`), or `undefined` when the topology is whole / does not apply.
|
|
51
51
|
* Read ONLY on the fail-loud missing-session path below, where it turns a symptom into a named
|
|
52
52
|
* absent seat; nothing in the phase's control flow depends on it. Computed by the driver (which
|
|
53
53
|
* holds `deps`) rather than here, keeping this slice's input the narrow Pick its contract says. */
|
|
54
54
|
durableParkGap?: string;
|
|
55
55
|
}
|
|
56
|
-
/** The phase's outputs (
|
|
56
|
+
/** The phase's outputs (four-class form). All five are fresh bindings —
|
|
57
57
|
* the driver destructures them into consts, so a consumer moved ahead of this call is a lexical
|
|
58
58
|
* error, which is the static guarantee the extraction keeps. */
|
|
59
59
|
export interface PrepareAcquireReconcileResult {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PrepareTask's Artifact phase: the `RunnerDeps.artifactHost` seat is read once; an absent seat mounts
|
|
3
|
+
* nothing and announces nothing; a seat whose declaration fails an invariant mounts nothing and announces
|
|
4
|
+
* `config.artifact_host_invalid` (operator audience) so a bad wiring can never read as "no hosting"; a
|
|
5
|
+
* valid seat mounts ONE `Artifact` tool assembled from the declaration, on the same optional band the LSP
|
|
6
|
+
* seat uses. The tool's local-file read goes through the run's fs fence (root containment, read-deny,
|
|
7
|
+
* read face) exactly as `Read` does, then reads the bytes once from the execution env. A local stub's store
|
|
8
|
+
* (`capabilities.storageDir`) must lie OUTSIDE every root the run may write or read — the task root and both
|
|
9
|
+
* classes of additional directories — because a ledger the model can edit through the fs tools is not a trust
|
|
10
|
+
* boundary; a store inside one refuses the mount with the same loud notice, naming the directory and the root.
|
|
11
|
+
* Synchronous: the stretch has no await (the file read is a closure the tool calls later).
|
|
12
|
+
*/
|
|
13
|
+
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
14
|
+
import { type ArtifactPlane } from "../artifact-host.js";
|
|
15
|
+
import { RosterBuilder } from "../tool-roster.js";
|
|
16
|
+
import type { AgentTool, RunnerDeps } from "../types.js";
|
|
17
|
+
import type { ReadDenyMatcher, ReadFace } from "../../tools/fs/index.js";
|
|
18
|
+
import type { Prepared } from "./contracts.js";
|
|
19
|
+
export interface PrepareArtifactInput {
|
|
20
|
+
/** borrowed-readonly — the deployment's hosting seat and the notice sink the refusal arm announces on. */
|
|
21
|
+
deps: Pick<RunnerDeps, "artifactHost" | "onNotice">;
|
|
22
|
+
/** borrowed-readonly — the engine-minted run id: the host's `onMount` key and every call context's `runId`. */
|
|
23
|
+
runId: string;
|
|
24
|
+
/** borrowed-readonly — the host task id, the call context's audit attribution. */
|
|
25
|
+
taskId: string;
|
|
26
|
+
/** borrowed-readonly — the acquired session id (notice attribution and the call context's `sessionId`). */
|
|
27
|
+
sessionId: string;
|
|
28
|
+
/** borrowed-readonly — the spawned name this run carries, when any (call-context attribution only). */
|
|
29
|
+
agentName: string | undefined;
|
|
30
|
+
/** borrowed-readonly — the run's resolved env: the byte source of a published local file. */
|
|
31
|
+
executionEnv: ExecutionEnv;
|
|
32
|
+
/** borrowed-readonly — the canonical task root the fs fence contains reads to; undefined ⇒ no local-file publish. */
|
|
33
|
+
rootCanonical: string | undefined;
|
|
34
|
+
/** borrowed-readonly — the extra containment roots (write and read-only) the fence admits. */
|
|
35
|
+
additionalRootsCanonical: readonly string[];
|
|
36
|
+
/** borrowed-readonly — the read-deny matcher in force for the run, when any. */
|
|
37
|
+
readDenyMatcher: ReadDenyMatcher | undefined;
|
|
38
|
+
/** borrowed-readonly — the resolved read face (`"open"` lifts root containment for reads). */
|
|
39
|
+
resolvedReadFace: ReadFace | undefined;
|
|
40
|
+
/** borrowed-readonly — the tracked-cwd cell; `current` is read per call as the relative-path base. */
|
|
41
|
+
handsCwdRef: Prepared["cwdRef"];
|
|
42
|
+
/** borrowed-mutable — the run's roster builder; writer here: ONE mount when the seat is valid. */
|
|
43
|
+
roster: RosterBuilder;
|
|
44
|
+
/** borrowed-readonly — the first-party result-offload wrapper every core mount passes through (a large read or a conflict snapshot is offloaded, not inlined). */
|
|
45
|
+
firstPartyOffload: (tool: AgentTool) => AgentTool;
|
|
46
|
+
/** borrowed-mutable — the env-hand membership set the memory content-origin face reads (a tool that reads the execution env's files is a hand); writer here: `add("Artifact")` on the mount. */
|
|
47
|
+
envHandToolNames: Set<string>;
|
|
48
|
+
}
|
|
49
|
+
export interface PrepareArtifactResult {
|
|
50
|
+
/** owned — the mounted face's plane, or undefined when nothing mounted (absent seat, or an invalid one). */
|
|
51
|
+
artifactPlane: ArtifactPlane | undefined;
|
|
52
|
+
}
|
|
53
|
+
export declare function prepareArtifact(input: PrepareArtifactInput): PrepareArtifactResult;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { readArtifactHostCapabilities } from "../artifact-host.js";
|
|
2
|
+
import { ARTIFACT_TOOL_NAME } from "../tool-catalog-entries.js";
|
|
3
|
+
import { deliverEngineNotice } from "../engine-notice.js";
|
|
4
|
+
import { RosterBuilder } from "../tool-roster.js";
|
|
5
|
+
import { defineTool } from "../tools.js";
|
|
6
|
+
import { inlineUntrusted } from "../untrusted-text.js";
|
|
7
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
8
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
9
|
+
import { resolveKey, violationDetails, violationText, withinAnyRoot } from "../../tools/fs/safety.js";
|
|
10
|
+
import { createArtifactTool } from "../../tools/artifact/artifact-tool.js";
|
|
11
|
+
function realAncestorPath(p) {
|
|
12
|
+
const abs = resolve(p);
|
|
13
|
+
const tail = [];
|
|
14
|
+
let cur = abs;
|
|
15
|
+
while (!existsSync(cur)) {
|
|
16
|
+
const parent = dirname(cur);
|
|
17
|
+
if (parent === cur)
|
|
18
|
+
return abs;
|
|
19
|
+
tail.unshift(basename(cur));
|
|
20
|
+
cur = parent;
|
|
21
|
+
}
|
|
22
|
+
return tail.length === 0 ? realpathSync(cur) : join(realpathSync(cur), ...tail);
|
|
23
|
+
}
|
|
24
|
+
export function prepareArtifact(input) {
|
|
25
|
+
const { deps, runId, taskId, sessionId, agentName, executionEnv, rootCanonical, additionalRootsCanonical, readDenyMatcher, resolvedReadFace, handsCwdRef, roster, firstPartyOffload, envHandToolNames } = input;
|
|
26
|
+
const host = deps.artifactHost;
|
|
27
|
+
if (host === undefined)
|
|
28
|
+
return { artifactPlane: undefined };
|
|
29
|
+
const refuse = (problem) => {
|
|
30
|
+
deliverEngineNotice(deps.onNotice, {
|
|
31
|
+
code: "config.artifact_host_invalid",
|
|
32
|
+
message: `RunnerDeps.artifactHost is wired but unusable, so no Artifact tool is mounted for this task: ${problem}`,
|
|
33
|
+
detail: { problem, sessionId, runId },
|
|
34
|
+
});
|
|
35
|
+
return { artifactPlane: undefined };
|
|
36
|
+
};
|
|
37
|
+
const verdict = readArtifactHostCapabilities(host);
|
|
38
|
+
if (!verdict.ok)
|
|
39
|
+
return refuse(verdict.problem);
|
|
40
|
+
const storageDir = verdict.capabilities.storageDir;
|
|
41
|
+
if (storageDir !== undefined && rootCanonical !== undefined) {
|
|
42
|
+
const real = realAncestorPath(storageDir);
|
|
43
|
+
const inside = [rootCanonical, ...additionalRootsCanonical].find((root) => withinAnyRoot([root], real));
|
|
44
|
+
if (inside !== undefined)
|
|
45
|
+
return refuse(`the local artifact store ${storageDir} lies inside a root this run may reach through its file tools (${inside}); put the store outside every task root and additional directory`);
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
host.onMount?.(runId);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
return refuse(`artifactHost.onMount threw: ${err instanceof Error ? err.message : String(err)}`);
|
|
52
|
+
}
|
|
53
|
+
const readLocalFile = async (path, maxBytes, signal) => {
|
|
54
|
+
if (rootCanonical === undefined)
|
|
55
|
+
return { ok: false, reason: "refused", text: "Error (Artifact): this task has no filesystem root, so a local file cannot be published." };
|
|
56
|
+
const rk = await resolveKey(executionEnv, rootCanonical, path, signal, handsCwdRef?.current, additionalRootsCanonical, undefined, readDenyMatcher, resolvedReadFace);
|
|
57
|
+
if (!rk.ok)
|
|
58
|
+
return { ok: false, reason: "refused", text: violationText("Artifact", rk.violation), details: violationDetails(rk.violation) };
|
|
59
|
+
const meta = await executionEnv.fileInfo(rk.key, signal);
|
|
60
|
+
if (!meta.ok)
|
|
61
|
+
return { ok: false, reason: "refused", text: `Error (Artifact): cannot stat ${inlineUntrusted(path, 200)} (${inlineUntrusted(meta.error.code, 40)}).` };
|
|
62
|
+
if (meta.value.kind !== "file")
|
|
63
|
+
return { ok: false, reason: "not_a_file", kind: meta.value.kind };
|
|
64
|
+
if (meta.value.size > maxBytes)
|
|
65
|
+
return { ok: false, reason: "too_large", size: meta.value.size, limit: maxBytes, judgedOn: "metadata" };
|
|
66
|
+
const r = await executionEnv.readBinaryFile(rk.key, signal);
|
|
67
|
+
if (!r.ok)
|
|
68
|
+
return { ok: false, reason: "refused", text: `Error (Artifact): cannot read ${inlineUntrusted(path, 200)} (${inlineUntrusted(r.error.code, 40)}).` };
|
|
69
|
+
if (r.value.byteLength > maxBytes)
|
|
70
|
+
return { ok: false, reason: "too_large", size: r.value.byteLength, limit: maxBytes, judgedOn: "bytes" };
|
|
71
|
+
return { ok: true, key: rk.key, bytes: r.value };
|
|
72
|
+
};
|
|
73
|
+
const artifactSpec = createArtifactTool({ host, capabilities: verdict.capabilities, runId, taskId, sessionId, ...(agentName !== undefined ? { agentName } : {}), readLocalFile });
|
|
74
|
+
roster.mount(firstPartyOffload(defineTool(artifactSpec)), { source: "builtin", mountedBy: "optional" });
|
|
75
|
+
envHandToolNames.add(ARTIFACT_TOOL_NAME);
|
|
76
|
+
return { artifactPlane: verdict.capabilities.plane };
|
|
77
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* PrepareTask's IN-STREAM ASK LANE, verbatim from the driver's gate-machinery block:
|
|
3
3
|
* the per-call signal composition bound to this task's run signal, the abort-bound `adjudicate` wrapper (the budget
|
|
4
4
|
* snapshot and the live tracked cwd stamped onto every request), the approval-preview projection over the live roster,
|
|
5
5
|
* the `resolveAskBound` mint (the inherited-unavailable intercept, the duplicate-frame grant reuse, the human-review
|
|
6
6
|
* ledger, the bare-human-rejection record), the pre-wrapped deny observer and the hook-crash notifier. The three
|
|
7
7
|
* module-scope helpers only this segment called moved with it (the deny-observer factory, the preview sanitizer and
|
|
8
|
-
* resolver). The interface is the dependency list the segment had implicitly
|
|
8
|
+
* resolver). The interface is the dependency list the segment had implicitly — the closures below
|
|
9
9
|
* used to capture every seat here off the driver's scope.
|
|
10
10
|
*
|
|
11
11
|
* SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await of its own (every await lives inside the closures
|
|
12
12
|
* it builds, which run per tool call), so the phase adds no yield between the wiring-manifest station before it and
|
|
13
|
-
* the suspend saga after it (
|
|
13
|
+
* the suspend saga after it (a stretch with no await is extracted as a sync function). Read-stability
|
|
14
14
|
* of the host handles for the call: {@link RunInternals} (`@contract prepare.deps-read-stable`).
|
|
15
15
|
*
|
|
16
16
|
* The lane exists exactly when the wiring-manifest phase's `gateMachineryActive` holds — the driver's `if` around the
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* PrepareTask's three BOUNDARY-FAMILY park lanes, verbatim from the driver's
|
|
3
3
|
* gate-machinery block: the ONE resource mint (`mintResourceSuspend`) behind the task-axis `suspendForResource` (exposed
|
|
4
4
|
* under the caller's `resourceSuspend` opt-in) and the infrastructure `suspendForPlatformLimit` (exposed on durable infra
|
|
5
5
|
* alone), and the `plan_review` mint behind `suspendForReview` (exposed with a checkpoint store). Every mint reuses the
|
|
6
6
|
* suspend saga's serializer, commit saga, loop cap and env split — this phase adds no second copy of any of them. The
|
|
7
|
-
* interface is the dependency list the segment had implicitly
|
|
7
|
+
* interface is the dependency list the segment had implicitly; the three lanes used to be forward-declared
|
|
8
8
|
* `let`s at task scope, assigned inside the block, so the driver's Prepared could expose them — they are this phase's
|
|
9
9
|
* Result now, and the driver binds them as consts.
|
|
10
10
|
*
|
|
11
11
|
* SYNCHRONOUS FUNCTION, SYNCHRONOUS CALL: the stretch has no await of its own (the mints run at a turn boundary), so the
|
|
12
|
-
* phase adds no yield between the suspend saga before it and the park closure after it
|
|
12
|
+
* phase adds no yield between the suspend saga before it and the park closure after it. Read-stability
|
|
13
13
|
* of the host handles for the call: {@link RunInternals} (`@contract prepare.deps-read-stable`).
|
|
14
14
|
*
|
|
15
15
|
* The lanes exist exactly when the saga does (the ask lane's presence law) — an absent saga answers three absent lanes,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* PrepareTask's CAPS-AND-WORKFLOW phase, verbatim from the driver: the caller-tool roster
|
|
3
3
|
* map (the defineTool-product branch and the rich-ctx wrap through the large-result wrapper), the ReportBlocked /
|
|
4
4
|
* ReportFindings / plan-pair mounts, the per-principal runtime caps resolve with its fail-closed degrade and value
|
|
5
5
|
* screen, the compliance posture veto with its two refusal codes, the fork verdict and the observers grant, the
|
|
6
6
|
* auto-mode arming (classifier model, lane rule, decider + denial tracker + persisted recipe) with its manifest
|
|
7
7
|
* reason, the self-orchestration gate with its governance note, and the Workflow mount with its size-guideline
|
|
8
8
|
* seat. The three arming helpers and the parent-capture-state join moved with the segment (only this phase calls
|
|
9
|
-
* them). The interface is the dependency list the segment had implicitly
|
|
9
|
+
* them). The interface is the dependency list the segment had implicitly.
|
|
10
10
|
*
|
|
11
11
|
* ASYNC PHASE: the segment awaits the two resolvers, the classifier route pre-flight and the Workflow factory,
|
|
12
12
|
* exactly where the driver awaited them; the roster map and the synthetic mounts before the first of those awaits
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* (`@contract prepare.deps-read-stable`).
|
|
15
15
|
*
|
|
16
16
|
* THE ROSTER IS MINTED HERE (`tools`): every later phase that mounts pushes into this same array — the writer table
|
|
17
|
-
* lives on {@link Prepared.tools}
|
|
17
|
+
* lives on {@link Prepared.tools}. LATE-BOUND SEATS: the Workflow mount's call-time getters read
|
|
18
18
|
* three facts later stations resolve (the memory session, the center adoption, the hands mount's deny additions);
|
|
19
19
|
* each enters as a getter on the Input and is read exactly where the driver's getter read the variable.
|
|
20
20
|
*/
|
|
@@ -37,10 +37,11 @@ import type { ReadFace } from "../../tools/fs/index.js";
|
|
|
37
37
|
import type { InheritedGate, Prepared, RunInternals, RunnerSelfSeat, ToolFaceSnapshot } from "./contracts.js";
|
|
38
38
|
import { type BlockedRef } from "./synthetic-tools.js";
|
|
39
39
|
import { RosterBuilder } from "../tool-roster.js";
|
|
40
|
+
import type { ParentSpecSeat } from "../parent-spec-seat.js";
|
|
40
41
|
export interface PrepareCapsAndWorkflowInput {
|
|
41
42
|
/** borrowed-readonly — the REBOUND spec, whole: the roster map reads `tools`; the mounts read `enableBlockedReport`,
|
|
42
43
|
* `enablePlanMode`, `interactiveTools`; the caps/compliance stations read `principal`, `selfOrchestration`,
|
|
43
|
-
* `enableFork`, `getApiKeyAndHeaders`; the Workflow mount forwards `
|
|
44
|
+
* `enableFork`, `getApiKeyAndHeaders`; the Workflow mount forwards `handsReadOnly`, `interactiveTools`. The
|
|
44
45
|
* self-orchestration predicate takes the whole spec. Never mutated. */
|
|
45
46
|
spec: TaskSpec;
|
|
46
47
|
/** borrowed-readonly — the deployment seats, whole: `runtimeCapsResolver`, `compliancePostureResolver`, `onError`, `onNotice`,
|
|
@@ -54,7 +55,7 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
54
55
|
checkpointSeat: CheckpointSeat | undefined;
|
|
55
56
|
/** borrowed-readonly — the trusted spawn-side channel; the Workflow mount forwards `rootSessionId`, `placementRoot`,
|
|
56
57
|
* `onTaskNotification`, `workflowDepth`, and the capture-floor getter reads `memoryCaptureAncestors`. */
|
|
57
|
-
internals: Pick<RunInternals, "rootSessionId" | "placementRoot" | "onTaskNotification" | "workflowDepth" | "memoryCaptureAncestors" | "workflowParkedResume"> | undefined;
|
|
58
|
+
internals: Pick<RunInternals, "rootSessionId" | "placementRoot" | "onTaskNotification" | "workflowDepth" | "memoryCaptureAncestors" | "workflowParkedResume" | "questionFaceStripped"> | undefined;
|
|
58
59
|
/** borrowed-readonly — the acquired session; the classifier leg rebuilds its transcript window from `buildContext`. */
|
|
59
60
|
session: Pick<StoredSession, "buildContext">;
|
|
60
61
|
/** borrowed-readonly — the acquired session id (operator-line context, the refusal codes' phase record). */
|
|
@@ -88,6 +89,7 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
88
89
|
};
|
|
89
90
|
/** borrowed-readonly — the FROZEN approver seat (the Workflow mount's parentOnAsk). */
|
|
90
91
|
frozenOnAsk: OnAsk | undefined;
|
|
92
|
+
/** borrowed-readonly — the parent SPEC seat the children inherit (minted once by the inherited-gate phase; the Workflow mount's dep, the same value the delegation ctx carries). */ parentSpecSeat: ParentSpecSeat;
|
|
91
93
|
/** borrowed-readonly — the ONE read-face carrier expression (the Workflow mount's parentReadFace getter calls it). */
|
|
92
94
|
carrierReadFace: () => ReadFace | undefined;
|
|
93
95
|
/** borrowed-readonly — the filtered display-forwarding wrapper (the Workflow mount's forwardEvent; absent ⇒ no key). */
|
|
@@ -130,7 +132,7 @@ export interface PrepareCapsAndWorkflowInput {
|
|
|
130
132
|
}>;
|
|
131
133
|
}
|
|
132
134
|
export interface PrepareCapsAndWorkflowResult {
|
|
133
|
-
/** owned — THE run's roster BUILDER (
|
|
135
|
+
/** owned — THE run's roster BUILDER (the mount array is private to it; `Prepared.tools` is its read face,
|
|
134
136
|
* whose JSDoc carries the writer table). Minted here from the caller's tools; every later mount goes through its verbs.
|
|
135
137
|
* Writers here: the caller mounts, then the ReportBlocked, ReportFindings, ExitPlanMode, EnterPlanMode and Workflow mounts. */
|
|
136
138
|
roster: RosterBuilder;
|
|
@@ -150,7 +152,7 @@ export interface PrepareCapsAndWorkflowResult {
|
|
|
150
152
|
/** owned — the observers grant (`allowObservers === true`, explicit opt-in). */
|
|
151
153
|
observersActive: boolean;
|
|
152
154
|
/** owned — the arming outcome as a closed reason (the manifest's auto-mode face). */
|
|
153
|
-
/**
|
|
155
|
+
/** The leg's auto-mode arming fact (`armed` ⇔ `reason === "armed"`; `deniedSource` only beside a STATED `denied`). */
|
|
154
156
|
autoModeArmReason: AutoModeArmFact;
|
|
155
157
|
/** owned — the armed classifier, or undefined when any arming arm failed. */
|
|
156
158
|
autoModeDecider: AutoModeDecider | undefined;
|
|
@@ -112,7 +112,7 @@ function autoModeArmReasonOf(intent, facePresent, caps, capsFaulted) {
|
|
|
112
112
|
return { armed: true, reason: "armed" };
|
|
113
113
|
}
|
|
114
114
|
export async function prepareCapsAndWorkflow(input) {
|
|
115
|
-
const { spec, deps, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, frozenOnAsk, carrierReadFace, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, autoModeIntent, peerLaneActive, peerSendMessageBuiltIn, runnerSelf } = input;
|
|
115
|
+
const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, frozenOnAsk, carrierReadFace, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, autoModeIntent, peerLaneActive, peerSendMessageBuiltIn, runnerSelf } = input;
|
|
116
116
|
const roster = new RosterBuilder(toolEffects);
|
|
117
117
|
for (const t of spec.tools ?? []) {
|
|
118
118
|
const mounted = mountCallerTool(t);
|
|
@@ -312,8 +312,7 @@ export async function prepareCapsAndWorkflow(input) {
|
|
|
312
312
|
return mine.length > 0 ? mine : undefined;
|
|
313
313
|
} }
|
|
314
314
|
: {}),
|
|
315
|
-
|
|
316
|
-
oneShot: spec.oneShot,
|
|
315
|
+
parentSpecSeat, ...(internals?.questionFaceStripped === true ? { parentQuestionFaceStripped: true } : {}),
|
|
317
316
|
...(resolvedInteractionPosture !== undefined ? { parentInteractionPosture: resolvedInteractionPosture } : {}),
|
|
318
317
|
parentMemoryCaptureState: () => {
|
|
319
318
|
const memoryEngineSession = input.memoryEngineSession();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* PrepareTask's config-doors phase: the synchronous stretch from the
|
|
3
3
|
* tool-face snapshot freeze through model/thinking/compaction-model resolution. The inputs are
|
|
4
4
|
* exactly the fields of {@link PrepareConfigDoorsInput} (the original extraction slice — spec, deps,
|
|
5
5
|
* sessions, the resume/internals seats); the outputs are the fields of
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* `prepare-task-phase-pins` microtask-latch tests.
|
|
15
15
|
*
|
|
16
16
|
* Throws pass through unchanged: every `config.*` / `resume_at.*` refusal here is a DELIBERATE
|
|
17
|
-
* at-the-door rejection (
|
|
17
|
+
* at-the-door rejection (a throw before acquisition needs no cleanup), and the
|
|
18
18
|
* interaction-posture door's `deps.onError` disclosure (call order and payload) is part of the
|
|
19
19
|
* contract. The per-task agents rebind returns a REBOUND spec (shallow copy, only `tools`
|
|
20
20
|
* replaced) — the caller's object is never mutated; the safety scan must receive the rebound one.
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import { type BrainCallGuardrailRef } from "../../brain/timeout.js";
|
|
23
23
|
import type { Model } from "../../internal/llm.js";
|
|
24
24
|
import type { ThinkingLevel } from "../../internal/harness.js";
|
|
25
|
-
import type
|
|
25
|
+
import { type MicroCompactMachine } from "../context-edit.js";
|
|
26
26
|
import { type LockedPreflight } from "../locked-config.js";
|
|
27
27
|
import { type ResolvedRole } from "../roles.js";
|
|
28
28
|
import type { SessionStore } from "../session.js";
|
|
@@ -33,7 +33,7 @@ export declare function limitConfigError(code: string, message: string): Error &
|
|
|
33
33
|
code?: string;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Validate `TaskSpec.limits` at the door and return it unchanged.
|
|
37
37
|
*
|
|
38
38
|
* Two refusals, both fail-loud (the {@link resolveStallTimeoutMs} posture: a bound nobody can evaluate is
|
|
39
39
|
* not a bound, and folding it to a default would silently run the task under limits nobody chose):
|
|
@@ -47,7 +47,7 @@ export declare function limitConfigError(code: string, message: string): Error &
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function resolveTaskLimits(limits: TaskLimits | undefined): TaskLimits | undefined;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Validate the MODE-VALUED members of `TaskSpec.attachments` at the same door, and return the
|
|
51
51
|
* config unchanged. Today that is exactly one member, `totalTokensReminderMode`.
|
|
52
52
|
*
|
|
53
53
|
* WHY A DOOR AT ALL (坏值响亮度律): a knob whose bad value silently folds to the default is a knob the
|
|
@@ -66,14 +66,14 @@ export declare function resolveTaskLimits(limits: TaskLimits | undefined): TaskL
|
|
|
66
66
|
* folded into this lane's change.
|
|
67
67
|
*
|
|
68
68
|
* A NON-OBJECT CONTAINER (`attachments: null` off a wire, above all) is neither refused nor crashed on
|
|
69
|
-
* (
|
|
69
|
+
* (verified by reading): every consumer reads this config through `attachmentsCfg?.…`,
|
|
70
70
|
* so a null container already means "no lanes are wired" and the spec RUNS today. An unguarded property
|
|
71
71
|
* read here — the first cut — turned that running spec into an untyped `TypeError` from inside a door
|
|
72
72
|
* that promises a typed `config.attachment_invalid`, and refusing it instead would newly reject a spec
|
|
73
73
|
* that works. There is no container-shape door in this family yet; that is a separate widening, not
|
|
74
74
|
* something this lane gets to invent on the way past.
|
|
75
75
|
*
|
|
76
|
-
* The bypass is narrowed to values that CANNOT supply attachment fields
|
|
76
|
+
* The bypass is narrowed to values that CANNOT supply attachment fields: a
|
|
77
77
|
* plain-JS caller can hand this a FUNCTION carrying `totalTokensReminderMode` as a property, and every
|
|
78
78
|
* downstream `attachmentsCfg?.…` read would happily find it — so skipping a function here would fold a
|
|
79
79
|
* typo'd mode to the default through exactly the hole this door exists to close. Functions are
|
|
@@ -85,13 +85,13 @@ export declare function resolveAttachmentsConfig(attachments: TaskSpec["attachme
|
|
|
85
85
|
* `fable_5_mitigations` capability / claude-mythos-5), ORTHOGONAL to the simple/classic profile.
|
|
86
86
|
* sema is BYOM, so the id may carry provider prefixes ("anthropic/claude-fable-5",
|
|
87
87
|
* "openrouter/anthropic/claude-fable-5"): BOUNDARY-AWARE family match on the last path segment
|
|
88
|
-
* (
|
|
88
|
+
* (raw substring classified "vendor/not-claude-fable-5" and "claude-mythos-50"
|
|
89
89
|
* as fable), case-normalized. Recognition set = CC's _Nr (startsWith "claude-fable-") + b9e
|
|
90
90
|
* (mythos-5). R3 system sections fork on the resulting fact.
|
|
91
91
|
*/
|
|
92
92
|
export declare function isFableFamilyModelId(id: string): boolean;
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* The SINGLE decision point for the two prompt-shape axes.
|
|
95
95
|
* Both were resolved in separate places with different mechanisms — `promptProfile` off a TaskSpec field,
|
|
96
96
|
* `fableMitigations` off a raw model-id prefix test — so "which shape does this task speak" had no one
|
|
97
97
|
* place to read. CC 2.1.220's counterpart is a model-registry `capabilities` array (one table drives
|
|
@@ -139,18 +139,18 @@ export interface PrepareConfigDoorsResult {
|
|
|
139
139
|
* later face reads consult (own-task filter, defer classify, delegation ctx). Frozen-immutable ⇒
|
|
140
140
|
* shared by reference into tool execution ctxs. */
|
|
141
141
|
toolFaceSnapshot: ToolFaceSnapshot;
|
|
142
|
-
/** owned — the profile half of the
|
|
142
|
+
/** owned — the profile half of the single decision point (model-independent by contract). */
|
|
143
143
|
promptProfile: "simple" | "classic";
|
|
144
144
|
/** owned — the administrator lock snapshot; the rest of prepare reads guarded slots through it. */
|
|
145
145
|
lockedPreflight: LockedPreflight;
|
|
146
146
|
/** owned — the resolved interaction posture (spec > spawning run > deployment); the
|
|
147
147
|
* AskUserQuestion mount and the child-ctx injection read this same value. */
|
|
148
148
|
resolvedInteractionPosture: "interactive" | "headless" | undefined;
|
|
149
|
-
/** owned — the validated/resolved microCompact knob (
|
|
149
|
+
/** owned — the validated/resolved microCompact knob ({@link resolveMicroCompactKnob}
|
|
150
150
|
* for the door + placement reasoning). The per-run state builder consumes exactly these values —
|
|
151
151
|
* the deps bag is never re-read after this door. */
|
|
152
152
|
microCompactKnob: {
|
|
153
|
-
machine:
|
|
153
|
+
machine: MicroCompactMachine;
|
|
154
154
|
clearOnRejection: boolean;
|
|
155
155
|
};
|
|
156
156
|
/** owned — the resolved role; its `systemPrompt` seat is still read at prompt-input time. */
|
|
@@ -163,9 +163,9 @@ export interface PrepareConfigDoorsResult {
|
|
|
163
163
|
/** owned — the compaction model: explicit wins, else the `summarize` role, else undefined (main
|
|
164
164
|
* model fallback inside maybeCompact). NOT derivable from {@link resolvedRole}. */
|
|
165
165
|
compModel: Model | undefined;
|
|
166
|
-
/** owned — the mitigations half of the
|
|
166
|
+
/** owned — the mitigations half of the decision point (model-family fact). */
|
|
167
167
|
fableMitigations: boolean;
|
|
168
|
-
/** owned, frozen —
|
|
168
|
+
/** owned, frozen — model-gate DISCLOSURE data (the application itself already
|
|
169
169
|
* happened on {@link spec}: its `tools` is the survivor rebind when anything was removed).
|
|
170
170
|
* prepareTask emits the notices from this after the doors return (the onNotice station);
|
|
171
171
|
* the doors stay side-effect-free on the announcement axis. */
|
|
@@ -178,18 +178,18 @@ export interface PrepareConfigDoorsResult {
|
|
|
178
178
|
* material; the in-force arm never lands here — it throws at the door). */
|
|
179
179
|
discardedEnvRaw: string | undefined;
|
|
180
180
|
};
|
|
181
|
-
/** owned — the NORMALIZED per-leg delegation-evidence standard
|
|
181
|
+
/** owned — the NORMALIZED per-leg delegation-evidence standard: the deps seat read
|
|
182
182
|
* ONCE, in this synchronous pre-await stretch, screened, and absent folded to the "static-face"
|
|
183
183
|
* default. The delegation wrap consumes THIS value, never the live deps object — a deps seat
|
|
184
184
|
* mutated (or getter-backed) after the door must not present an unscreened value to the mark
|
|
185
|
-
* branch (the
|
|
185
|
+
* branch (the read-once posture). */
|
|
186
186
|
memoryDelegationEvidence: "static-face" | "attested-only";
|
|
187
|
-
/** owned — the NORMALIZED memory-provenance mode
|
|
188
|
-
|
|
187
|
+
/** owned — the NORMALIZED memory-provenance mode: the deps seat read ONCE in
|
|
188
|
+
* the synchronous pre-await stretch, screened, absent folded to the `"carry"` default.
|
|
189
189
|
* The memory phase constructs every engine with THIS value — never a live deps re-read. */
|
|
190
190
|
memoryProvenance: "off" | "carry";
|
|
191
|
-
/** owned — the NORMALIZED memory-capture posture
|
|
192
|
-
* screened (
|
|
191
|
+
/** owned — the NORMALIZED memory-capture posture: the deps seat read ONCE,
|
|
192
|
+
* screened (a bad value refuses, never folds), absent folded to `"open"`. The capture
|
|
193
193
|
* opt-out adjudicator consumes THIS value on every leg (declaration, resume record re-check,
|
|
194
194
|
* and the flip verb's frozen closure) — never a live deps re-read. */
|
|
195
195
|
memoryCapturePolicy: "open" | "governed" | "capture-required";
|
|
@@ -202,9 +202,9 @@ export interface PrepareConfigDoorsResult {
|
|
|
202
202
|
* the resolver's off states). */
|
|
203
203
|
brainCallGuardrailMs: number | undefined;
|
|
204
204
|
}
|
|
205
|
-
/**
|
|
206
|
-
* interactionPosture / toolModelGate / staleToolResultOffload). Placement is load-bearing
|
|
207
|
-
*
|
|
205
|
+
/** The microCompact knob door (坏值响亮度默认律, the sibling knob doors' form:
|
|
206
|
+
* interactionPosture / toolModelGate / staleToolResultOffload). Placement is load-bearing:
|
|
207
|
+
* it runs in THIS pre-first-await config-doors phase so a malformed declaration refuses
|
|
208
208
|
* BEFORE any resource-bearing preparation — session acquisition, execution-env creation, the MCP
|
|
209
209
|
* dial — whose external effects a late refusal's teardown cannot undo. SINGLE READ per seat, and
|
|
210
210
|
* the CONTAINER is judged first (reviews r1/r2): an accessor-backed bag answering a legal value at
|
|
@@ -213,7 +213,7 @@ export interface PrepareConfigDoorsResult {
|
|
|
213
213
|
* it must refuse exactly like a malformed field, never fold to the defaults. The RESOLVED values
|
|
214
214
|
* returned here are immutable and are the state builder's ONLY source — nothing re-reads the bag. */
|
|
215
215
|
export declare function resolveMicroCompactKnob(bag: RunnerDeps["microCompact"]): {
|
|
216
|
-
machine:
|
|
216
|
+
machine: MicroCompactMachine;
|
|
217
217
|
clearOnRejection: boolean;
|
|
218
218
|
};
|
|
219
219
|
export declare function prepareConfigDoors(input: PrepareConfigDoorsInput): PrepareConfigDoorsResult;
|