@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
|
@@ -53,7 +53,7 @@ export interface TaskPollOptions {
|
|
|
53
53
|
timeoutMs?: number;
|
|
54
54
|
/** Abort signal — a blocked wait must stop when the tool call is cancelled. */
|
|
55
55
|
signal?: AbortSignal;
|
|
56
|
-
/**
|
|
56
|
+
/** Mirrors {@link import("./types.js").TaskSpec.oneShot} (see {@link TaskToolOptions.oneShot}
|
|
57
57
|
* for the full contract): forwarded to the background_agent lane's still-running poll body so it
|
|
58
58
|
* does not teach "you will be notified" when this run has no later turn to receive one. */
|
|
59
59
|
oneShot?: boolean;
|
|
@@ -88,7 +88,7 @@ export interface TaskToolOptions extends TaskAccess {
|
|
|
88
88
|
* historical wording); prepare-task passes the real wiring state. */
|
|
89
89
|
notificationWired?: boolean;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* Mirrors {@link import("./types.js").TaskSpec.oneShot}: this run has no later turn for an
|
|
92
92
|
* async background notification to land in (a headless `-p` process exits once the turn ends).
|
|
93
93
|
* Threaded into the background_agent lane's non-blocking/blocked-timeout "still running" poll body
|
|
94
94
|
* (see {@link import("./task-registry-agent.js").pollBackgroundAgentLane}), which otherwise taught
|
|
@@ -122,7 +122,7 @@ export interface AccessibleTaskRow {
|
|
|
122
122
|
parentTaskId?: string;
|
|
123
123
|
parentSessionId?: string;
|
|
124
124
|
rootSessionId?: string;
|
|
125
|
-
/**
|
|
125
|
+
/** The row's registration instant (the original spawn time for a first-cycle row): the
|
|
126
126
|
* revive projection needs it so a revive frame's `startedAt` anchors the ROW, not the wake call. */
|
|
127
127
|
createdAt?: number;
|
|
128
128
|
}
|
|
@@ -139,11 +139,11 @@ export declare class TaskRegistry {
|
|
|
139
139
|
* (cap overflow dropped the watcher; the owner's tasks may still be running — the subscriber must
|
|
140
140
|
* NOT treat this as quiescence). */
|
|
141
141
|
private bgQuiescenceWatchers;
|
|
142
|
-
/**
|
|
142
|
+
/** One host-callback isolation scope for this registry's five notification seams (reap terminal
|
|
143
143
|
* notifier, session-reap hooks, quiescence fire + cap-overflow eviction, terminal-once send). Same swallow
|
|
144
144
|
* as the five hand-written try/catches it replaced, now counted per site and readable for diagnostics. */
|
|
145
145
|
private readonly notifier;
|
|
146
|
-
/**
|
|
146
|
+
/** The read face for this registry's CONTAINED host-callback failures (site → count).
|
|
147
147
|
* The registry has no deployment error sink of its own to disclose to (it is process-global,
|
|
148
148
|
* constructed before any RunnerDeps exists), so readability IS its disclosure grade: a deployment
|
|
149
149
|
* that suspects a broken observer polls this instead of grepping for silence. Empty on the
|
|
@@ -241,7 +241,7 @@ export declare class TaskRegistry {
|
|
|
241
241
|
agentStore: import("./background-agent-store.js").BackgroundAgentStore;
|
|
242
242
|
}, ticket: ParkedClaimTicket): Promise<boolean>;
|
|
243
243
|
finalizeParkedResume(id: string): void;
|
|
244
|
-
/**
|
|
244
|
+
/** `outcome.cycle` names the revive cycle this settle speaks for (absent = 0 = the original
|
|
245
245
|
* spawn cycle). A spawn leg never passes it; a caller that settles by LIFECYCLE AUTHORITY (reap /
|
|
246
246
|
* session release — "whatever is running under this row dies") passes the row's current cycle. See
|
|
247
247
|
* {@link settleBackgroundAgentLane} for why a stale stamp must be a no-op. */
|
|
@@ -283,7 +283,7 @@ export declare class TaskRegistry {
|
|
|
283
283
|
suggestion?: string;
|
|
284
284
|
};
|
|
285
285
|
markRetainedContinuation(id: string): void;
|
|
286
|
-
/**
|
|
286
|
+
/** The row's current stop-cycle counter, read by the spawn lanes right after registering to
|
|
287
287
|
* thread into the child's `RunInternals.cycleSeq`; see {@link backgroundAgentCycleSeqLane}. */
|
|
288
288
|
backgroundAgentCycleSeq(id: string): number | undefined;
|
|
289
289
|
/** Subagent transcript persistence (delegation entry caps) — one delegation tree's ACTIVE
|
|
@@ -399,7 +399,7 @@ export declare class TaskRegistry {
|
|
|
399
399
|
* watcher/stop lanes mark and read it too); workflow cancellation is out of scope. */
|
|
400
400
|
markStopSource(id: string, source: StopSource): void;
|
|
401
401
|
/**
|
|
402
|
-
*
|
|
402
|
+
* Attribute an ENV-LEVEL blanket sweep before it runs.
|
|
403
403
|
*
|
|
404
404
|
* The incident: a user's `run_in_background` Bash died mid-run reporting `stopped-by:"system"` with a
|
|
405
405
|
* zero-byte output file, and diagnosing it took a cross-repo investigation with a timeline argument.
|
|
@@ -35,7 +35,7 @@ import type { NestedUsage } from "./tool-spec.js";
|
|
|
35
35
|
*/
|
|
36
36
|
export type TaskStatus = "completed" | "blocked" | "failed" | "suspended" | "needs_review";
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* One remote-workspace lifecycle failure, reported as data on {@link TaskResult.remoteEnvFailures}.
|
|
39
39
|
* See that field for why the eleven-code taxonomy needed a structured channel to reach a caller at all.
|
|
40
40
|
*/
|
|
41
41
|
export interface RemoteEnvFailureNote {
|
|
@@ -127,7 +127,7 @@ export type EffectiveMemoryScopes = {
|
|
|
127
127
|
export interface TaskResult {
|
|
128
128
|
taskId: string;
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
130
|
+
* The ENGINE-minted identity of THIS run (uuidv7), minted once at the top of prepare and
|
|
131
131
|
* never rewritten. The third id of the trio, and the only one the engine owns:
|
|
132
132
|
* - {@link taskId} — the HOST's task identity, or (when the host named none) the session id: it is
|
|
133
133
|
* `spec.taskId ?? sessionId` and therefore answers the SAME value for every run of one session;
|
|
@@ -168,7 +168,7 @@ export interface TaskResult {
|
|
|
168
168
|
* requested ref. A mid-run degradation is observed separately (see the degraded-model fields). */
|
|
169
169
|
model?: string;
|
|
170
170
|
/**
|
|
171
|
-
*
|
|
171
|
+
* The leg's effective REASONING resolution: the result-face twin of {@link model} for the thinking
|
|
172
172
|
* knob. How the requested tier resolved against the serving model's real capability
|
|
173
173
|
* (`requested`/`effective`/`graded`/`clamped`/`format`/`endpoint`, plus `dropped:true` when a
|
|
174
174
|
* non-reasoning model dropped the request entirely — field semantics on
|
|
@@ -230,7 +230,7 @@ export interface TaskResult {
|
|
|
230
230
|
*/
|
|
231
231
|
salvagedOutput?: string;
|
|
232
232
|
/**
|
|
233
|
-
*
|
|
233
|
+
* The remote-workspace lifecycle failures this run hit, as DATA. The seam declares eleven
|
|
234
234
|
* distinct `RemoteExecutionErrorCode`s, but every one of them used to reach the caller as the same
|
|
235
235
|
* thing: a `suspendVM` refusal was swallowed into the `onError` side channel and the result read
|
|
236
236
|
* `limits.max_turns_exceeded` (identical for a transient auth blip and a permanently-unsupported adapter), while
|
|
@@ -430,34 +430,34 @@ export interface TaskResult {
|
|
|
430
430
|
*/
|
|
431
431
|
haltedOnUserRejection?: true;
|
|
432
432
|
/**
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
433
|
+
* Present (`true`) exactly when a {@link TaskStream.halt}
|
|
434
|
+
* (the bare user interrupt, the CC Esc form — cut the in-flight turn, stop at that boundary, wait
|
|
435
|
+
* for the person's next input) was CONSUMED by this run: the engine's own record says the run
|
|
436
|
+
* ended FOR it. The attribution law, one sentence: signed ⇔ the halt's cut settled a turn (the loop
|
|
437
|
+
* reported the interrupt settlement it took for the seat the halt aborted — stream shape, batch
|
|
438
|
+
* shape, or the recovery lane's arms) OR the halt's stop request was among the sources a boundary
|
|
439
|
+
* consult stopped the loop for (the pre-turn guard that refuses the next turn — the birth-window
|
|
440
|
+
* halt included — or the post-turn consult). The MINTER states the fact; the result assembly reads
|
|
441
|
+
* it and never infers causation from the final's shape (a brain minting its own `aborted` final
|
|
442
|
+
* beside a late halt reads as the failure it is) nor from the verb's acceptance.
|
|
443
|
+
*
|
|
444
|
+
* The ruled terminal form is completed-with-marker, this seat being the marker: `status` is
|
|
445
|
+
* `"completed"` on the ordinary path (a clean, resumable ending — the session continues via the
|
|
446
|
+
* ordinary next-run front door), and this field is what tells a person-stopped ending apart from a
|
|
447
|
+
* natural finish — same reading discipline as {@link haltedOnUserRejection}, its sibling seat
|
|
448
|
+
* ("stopped by the user, awaiting their direction", never "the task finished its work"). `result` is
|
|
449
|
+
* whatever the model had produced before the halt (possibly empty). Rides EVERY terminal a
|
|
450
|
+
* consumed halt reaches — a halt whose cut settled a turn and then raced a real failure/limit, or
|
|
451
|
+
* whose boundary stop coincided with a review/resource park (`needs_review` / `suspended`),
|
|
452
|
+
* truthfully says a person also stopped it (the slice-2 status-keyed suppression is retired).
|
|
453
|
+
*
|
|
454
|
+
* ABSENT (never `false`) whenever the halt was not consumed, however it was answered: a halt
|
|
455
|
+
* landing after the run's abort already fired (first-writer-wins, the `interrupt()` attribution
|
|
456
|
+
* law — that ending belongs to the abort); a halt accepted while the run was already ending for its
|
|
457
|
+
* own reason (a natural completion past the loop's final commit point, a brain's own terminal, a
|
|
458
|
+
* durable approval park whose commit won the race and whose abort then owned the ending); a
|
|
459
|
+
* steer-now cut (its stamp is `steer`). In every such case the halt's trace is its verb receipt plus
|
|
460
|
+
* one `task.halt_unconsumed` notice — the seat is never signed on a guess.
|
|
461
461
|
*/
|
|
462
462
|
haltedByUser?: true;
|
|
463
463
|
/**
|
|
@@ -475,7 +475,7 @@ export interface TaskResult {
|
|
|
475
475
|
toolCallId: string;
|
|
476
476
|
}>;
|
|
477
477
|
/**
|
|
478
|
-
*
|
|
478
|
+
* HOST-SUPPLIED: the approval plane's report that this leg ended with human approvals still
|
|
479
479
|
* OUTSTANDING (the ask identities it is holding, and when the OLDEST of them was created).
|
|
480
480
|
*
|
|
481
481
|
* **Who writes it, and why not the engine.** Core mints no ask identity — an ask id belongs to the
|
|
@@ -502,7 +502,7 @@ export interface TaskResult {
|
|
|
502
502
|
oldestCreatedAtMs: number;
|
|
503
503
|
};
|
|
504
504
|
/**
|
|
505
|
-
*
|
|
505
|
+
* HOST-SUPPLIED: how long this leg spent BLOCKED on human approvals, in ms, as the deployment's
|
|
506
506
|
* approval plane measured it. Same writer and same absence contract as {@link pendingApproval}: the
|
|
507
507
|
* approval clock belongs to whoever holds the ask, so the figure is SINGLE-SOURCED there and core neither
|
|
508
508
|
* estimates it nor accumulates it (two sides publishing two numbers for one wait is the drift this seat
|
|
@@ -521,7 +521,7 @@ export interface TaskResult {
|
|
|
521
521
|
*/
|
|
522
522
|
approvalWaitedMs?: number;
|
|
523
523
|
/**
|
|
524
|
-
*
|
|
524
|
+
* The READ-face this leg's read surfaces actually judged under, as an
|
|
525
525
|
* engine-filled OBSERVATION (never a knob: writing it on a spec does nothing). It is the run's ONE
|
|
526
526
|
* resolved face — the same value the hands toolkit enforced and the delegation carriers rode — with
|
|
527
527
|
* the hands-less resume pin folded in (a row resumed on a hands-less worker still reports the
|
|
@@ -543,7 +543,7 @@ export interface TaskResult {
|
|
|
543
543
|
*/
|
|
544
544
|
effectiveReadFace?: import("../tools/fs/read-face.js").ReadFace;
|
|
545
545
|
/**
|
|
546
|
-
*
|
|
546
|
+
* The sensitive-path deny ADDITIONS in force on this leg beyond the
|
|
547
547
|
* built-in table, normalized (deployment ∪ task ∪ checkpoint-frozen seed), as an engine-filled
|
|
548
548
|
* OBSERVATION. "In force" = judged by this leg's own read surfaces where they mounted, and carried
|
|
549
549
|
* to its delegation subtree either way (a hands-less resume leg reports the entries its children
|
|
@@ -638,7 +638,7 @@ export interface TaskResult {
|
|
|
638
638
|
/** The cache-INCLUSIVE prompt total across the task's turns — `promptTokens + cachedTokens +
|
|
639
639
|
* cacheWriteTokens + cacheWriteTokensLong`, matching OTel `gen_ai.usage.input_tokens`. This is the
|
|
640
640
|
* quantity cost is computed from, the denominator of `cacheHitRate`, and the figure to use for
|
|
641
|
-
* "how much context did this task present" (window/budget views).
|
|
641
|
+
* "how much context did this task present" (window/budget views). `promptTokens` carried
|
|
642
642
|
* this value up to 2.13.x; it now carries the cache MISS count and this field is its own
|
|
643
643
|
* accumulator rather than an alias. Optional BY DESIGN, like every usage field on this stats
|
|
644
644
|
* face: undefined means the gateway reported no usage (and pre-3.0.0 persisted rows never had
|
package/dist/core/task-spec.d.ts
CHANGED
|
@@ -447,7 +447,7 @@ export interface TaskSpec {
|
|
|
447
447
|
*/
|
|
448
448
|
toolMaterializeStrategy?: "swap" | "static";
|
|
449
449
|
/**
|
|
450
|
-
*
|
|
450
|
+
* The inline-pin counterpart of {@link deferTools} (same wire-name addressing, opposite
|
|
451
451
|
* direction; CC 220 `alwaysLoad` 对位): names listed here are NEVER deferred — not by
|
|
452
452
|
* `ToolSpec.defer`, not by the MCP constant-defer arm (besides the server's own
|
|
453
453
|
* `_meta["anthropic/alwaysLoad"]` declaration this list is the only channel that keeps a chosen
|
|
@@ -475,7 +475,7 @@ export interface TaskSpec {
|
|
|
475
475
|
*/
|
|
476
476
|
restoreGatedTools?: string[] | true;
|
|
477
477
|
/**
|
|
478
|
-
*
|
|
478
|
+
* Whether a schema-VALID call on a still-deferred tool runs the real tool directly
|
|
479
479
|
* (activating it as a side effect). Default `true`, matching the upstream posture where the
|
|
480
480
|
* defer gate is shape validation, not activation state (a deferred tool called with correct
|
|
481
481
|
* arguments succeeds; activation only controls whether the model has SEEN the schema). Set
|
|
@@ -1237,7 +1237,7 @@ export interface TaskSpec {
|
|
|
1237
1237
|
*/
|
|
1238
1238
|
todoReminderMode?: "baseline" | "off";
|
|
1239
1239
|
/**
|
|
1240
|
-
*
|
|
1240
|
+
* `tool_search_usage_reminder` (CC 2.1.220 producer `Nop` @608915, renderer @626269): the
|
|
1241
1241
|
* REVERSE nudge for delayed tool disclosure. When tools are deferred (design/36), a model that has
|
|
1242
1242
|
* gone N turns without calling `ToolSearch` and still has unloaded schemas is told they exist and
|
|
1243
1243
|
* how to load them, so "this capability does not exist, I will build a workaround" stops being the
|
|
@@ -1276,7 +1276,7 @@ export interface TaskSpec {
|
|
|
1276
1276
|
*/
|
|
1277
1277
|
budgetUsd?: true;
|
|
1278
1278
|
/**
|
|
1279
|
-
*
|
|
1279
|
+
* `total_tokens_reminder` (CC 2.1.245 producer `MPs`, renderer `Oje`):
|
|
1280
1280
|
* the TOKEN twin of {@link budgetUsd}. One line per collected boundary,
|
|
1281
1281
|
* `<total_tokens>N tokens left</total_tokens>`, CC-verbatim bytes.
|
|
1282
1282
|
*
|
|
@@ -1312,7 +1312,7 @@ export interface TaskSpec {
|
|
|
1312
1312
|
*/
|
|
1313
1313
|
totalTokensReminder?: boolean;
|
|
1314
1314
|
/**
|
|
1315
|
-
*
|
|
1315
|
+
* Which arm of the readout, CC 2.1.245's closed set (`off` / `infinite` / `fixed` /
|
|
1316
1316
|
* `countdown` / `padded-countdown`); absent ⇒ CC's own default `"padded-countdown"`.
|
|
1317
1317
|
*
|
|
1318
1318
|
* - `countdown` — remaining = ceiling − spend, raw.
|
|
@@ -54,7 +54,7 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
|
|
|
54
54
|
* (the parked leg's `appendPendingSteer` refuses it identically). Re-issue under a fresh id.
|
|
55
55
|
* - **Bad value ⇒ typed throw** `steering.invalid_content`, never a silent fallback to "no id": the
|
|
56
56
|
* value domain is the parked leg's (a non-empty string of at most `MAX_STEER_INPUT_ID_CHARS`
|
|
57
|
-
* characters
|
|
57
|
+
* characters), so one key is accepted or
|
|
58
58
|
* refused the same way on both legs. Validated before the liveness check, like the parked leg's.
|
|
59
59
|
* - **Liveness outranks the key**: once the run's loop-liveness latch has flipped (the same signal
|
|
60
60
|
* the injection path stops polling on) a replay is refused `steering.not_running` like any other
|
|
@@ -349,22 +349,27 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
|
|
|
349
349
|
* per-run. AUTHORITY (steer-lane law): holding this stream IS the capability — a deployment
|
|
350
350
|
* relaying this verb owns its own gate (relay IS authorization; it cancels in-flight tool work
|
|
351
351
|
* and ends the run's forward progress). No text ⇒ the `userPromptSubmit` screen has no domain
|
|
352
|
-
* here (nothing enters the model).
|
|
353
|
-
* moments (past the loop's final commit point) finds the run completing
|
|
354
|
-
*
|
|
355
|
-
*
|
|
352
|
+
* here (nothing enters the model). The late window, stated: a halt accepted
|
|
353
|
+
* in the run's last moments (past the loop's final commit point) finds the run completing
|
|
354
|
+
* naturally — nothing is cut and no boundary stops for it, so the result reports the natural
|
|
355
|
+
* completion WITHOUT the `haltedByUser` seat and the engine mints `task.halt_unconsumed` (the
|
|
356
|
+
* verb receipt and that notice are the halt's whole trace; the seat is signed from consumption,
|
|
357
|
+
* never from acceptance — see {@link TaskResult.haltedByUser}). Typed refusals: the
|
|
356
358
|
* steer-family `steering.not_running` once the task has finished (teardown included); a halt
|
|
357
359
|
* issued BEFORE the run's first prompt polls the same bounded birth window as {@link steer} and
|
|
358
360
|
* then stops the run before its first model turn (an empty, cleanly-halted completed run).
|
|
359
361
|
*
|
|
360
|
-
* **Receipt tension, stated
|
|
362
|
+
* **Receipt tension, stated:** `{turnCut:true}` and the
|
|
361
363
|
* `task.turn_interrupted` notice assert facts about the CUT — a seat was cut, no new model turn
|
|
362
364
|
* starts — and both stay true even when the gate's durable leg still collects to `suspended`:
|
|
363
|
-
*
|
|
364
|
-
* fence race, the row is redeemable,
|
|
365
|
-
* {@link TaskResult.haltedByUser}
|
|
366
|
-
*
|
|
367
|
-
*
|
|
365
|
+
* an approval park whose store commit was already in flight (or committed) when the cut landed
|
|
366
|
+
* WINS the fence race, the row is redeemable, the park's own abort then owns the ending, and the
|
|
367
|
+
* result reads `status:"suspended"` WITHOUT {@link TaskResult.haltedByUser} — the halt cut a seat
|
|
368
|
+
* but consumed nothing (no interrupt settlement took its cut, no boundary stopped for it), which
|
|
369
|
+
* `task.halt_unconsumed` discloses. A cut observed BEFORE the commit makes the park concede
|
|
370
|
+
* instead — no row, no card, and the ordinary halted ending. A BOUNDARY park (review / resource
|
|
371
|
+
* slice) beside a consumed halt is the other way round: the terminal is the park's, and the seat
|
|
372
|
+
* IS signed — a person also stopped it.
|
|
368
373
|
*/
|
|
369
374
|
halt(): Promise<{
|
|
370
375
|
turnCut: boolean;
|
|
@@ -32,6 +32,7 @@ export declare const TASK_UPDATE_TOOL_NAME = "TaskUpdate";
|
|
|
32
32
|
export declare const TASK_LIST_TOOL_NAME = "TaskList";
|
|
33
33
|
export declare const TODO_WRITE_TOOL_NAME = "TodoWrite";
|
|
34
34
|
export declare const REFRESH_MCP_TOOLS_TOOL_NAME = "RefreshMcpTools";
|
|
35
|
+
export declare const ARTIFACT_TOOL_NAME = "Artifact";
|
|
35
36
|
/**
|
|
36
37
|
* Every row. Order is documentation order (hands → delegation → scaffolds → memory → scheduler → host
|
|
37
38
|
* scenarios); nothing reads the order.
|
|
@@ -7,6 +7,7 @@ export const TASK_UPDATE_TOOL_NAME = "TaskUpdate";
|
|
|
7
7
|
export const TASK_LIST_TOOL_NAME = "TaskList";
|
|
8
8
|
export const TODO_WRITE_TOOL_NAME = "TodoWrite";
|
|
9
9
|
export const REFRESH_MCP_TOOLS_TOOL_NAME = "RefreshMcpTools";
|
|
10
|
+
export const ARTIFACT_TOOL_NAME = "Artifact";
|
|
10
11
|
const SHELL_RULE_FACE = { primaryParams: ["command"], params: ["command", "timeout", "description", "run_in_background"] };
|
|
11
12
|
const c = (contractId, implementationRevision = "1") => ({ contractId, implementationRevision });
|
|
12
13
|
export const TOOL_CATALOG_ENTRIES = [
|
|
@@ -97,6 +98,10 @@ export const TOOL_CATALOG_ENTRIES = [
|
|
|
97
98
|
},
|
|
98
99
|
{ id: "repo-map", name: "RepoMap", source: "builtin", definedIn: "src/tools/fs/repo-map.ts", mountedBy: ["hands"], cards: ["repo-map"], face: { family: "search", effect: "read", contract: c("core.repo_map@1") } },
|
|
99
100
|
{ id: "lsp", name: "LSP", source: "builtin", definedIn: "src/core/lsp.ts", mountedBy: ["optional"], cards: [], face: { family: "search", effect: "read", contract: c("core.lsp@1") } },
|
|
101
|
+
{
|
|
102
|
+
id: "artifact", name: ARTIFACT_TOOL_NAME, source: "builtin", definedIn: "src/tools/artifact/artifact-tool.ts", mountedBy: ["optional"], cards: ["artifact"],
|
|
103
|
+
face: { family: "other", effect: "write", contract: c("core.artifact@1"), ruleFace: { primaryParams: ["action"] }, renderHints: { summaryParams: ["action", "file_path", "url"] } },
|
|
104
|
+
},
|
|
100
105
|
{ id: "enter-worktree", name: "EnterWorktree", source: "builtin", definedIn: "src/tools/worktree.ts", mountedBy: ["hands"], cards: ["worktree"], face: { family: "other", effect: "write", contract: c("core.enter_worktree@1") } },
|
|
101
106
|
{ id: "exit-worktree", name: "ExitWorktree", source: "builtin", definedIn: "src/tools/worktree.ts", mountedBy: ["hands"], cards: ["worktree"], face: { family: "other", effect: "write", contract: c("core.exit_worktree@1") } },
|
|
102
107
|
{ id: "task-output-hands", name: "TaskOutput", source: "builtin", definedIn: "src/tools/fs/fs-bash.ts", mountedBy: ["hands"], cards: [], face: { family: "delegate", effect: "read", contract: TASK_OUTPUT_CONTRACT } },
|
|
@@ -18,5 +18,3 @@ export interface ToolConformanceVector {
|
|
|
18
18
|
}
|
|
19
19
|
/** The matrix. Vector ids are stable (a host's own conformance test keys on them). */
|
|
20
20
|
export declare const TOOL_CONFORMANCE_VECTORS: readonly ToolConformanceVector[];
|
|
21
|
-
/** The matrix as a host reads it (a frozen copy). */
|
|
22
|
-
export declare function describeToolConformanceVectors(): readonly ToolConformanceVector[];
|
|
@@ -25,6 +25,7 @@ export const TOOL_CONFORMANCE_VECTORS = [
|
|
|
25
25
|
], [OFFLOAD_READER]),
|
|
26
26
|
vector("plan-mode", ["always", "optional"], [
|
|
27
27
|
{ name: "LSP", why: "needs a wired LSP manager" },
|
|
28
|
+
{ name: "Artifact", why: "needs a wired artifact host" },
|
|
28
29
|
{ name: "Skill", why: "needs a skills listing" },
|
|
29
30
|
{ name: "StructuredOutput", why: "needs an output schema" },
|
|
30
31
|
{ name: "ToolSearch", why: "needs a deferred tool" },
|
|
@@ -32,6 +33,3 @@ export const TOOL_CONFORMANCE_VECTORS = [
|
|
|
32
33
|
{ name: "EnterPlanMode", why: "needs a checkpoint store beside plan mode" },
|
|
33
34
|
]),
|
|
34
35
|
];
|
|
35
|
-
export function describeToolConformanceVectors() {
|
|
36
|
-
return TOOL_CONFORMANCE_VECTORS;
|
|
37
|
-
}
|
|
@@ -27,6 +27,11 @@ export declare function truncateError(s: string): string;
|
|
|
27
27
|
* a file, legacy head+tail middle-omission (there is no path to point at, and the head often carries
|
|
28
28
|
* status a bare tail-keep would drop).
|
|
29
29
|
*/
|
|
30
|
+
/** The smallest output budget the clip primitives are given: below it a clip cannot carry its own
|
|
31
|
+
* truncation banner plus any content, so the operator knobs that feed {@link clipWithFilePointer}
|
|
32
|
+
* (`BASH_MAX_OUTPUT_LENGTH`, `TASK_MAX_OUTPUT_LENGTH`) are raised to it, loudly, never honored as a
|
|
33
|
+
* budget of one character. */
|
|
34
|
+
export declare const OUTPUT_BUDGET_MIN_CHARS = 512;
|
|
30
35
|
export declare function clipWithFilePointer(s: string, limit: number, fullOutputPath?: string): string;
|
|
31
36
|
/**
|
|
32
37
|
* Format a thrown tool error into model-facing text (design/64 §11.1/§11.2): a shell/exec error becomes
|
package/dist/core/tool-errors.js
CHANGED
|
@@ -10,6 +10,7 @@ export function truncateError(s) {
|
|
|
10
10
|
const removed = s.length - head.length - tail.length;
|
|
11
11
|
return `${head}\n\n... [${removed} characters truncated] ...\n\n${tail}`;
|
|
12
12
|
}
|
|
13
|
+
export const OUTPUT_BUDGET_MIN_CHARS = 512;
|
|
13
14
|
export function clipWithFilePointer(s, limit, fullOutputPath) {
|
|
14
15
|
if (s.length <= limit)
|
|
15
16
|
return s;
|
|
@@ -27,7 +27,7 @@ export interface ToolCallRequest {
|
|
|
27
27
|
*/
|
|
28
28
|
face?: ToolCallFace;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* The LIVE working directory this call's RELATIVE path arguments will actually resolve
|
|
31
31
|
* against, read at adjudication time from the same tracked `cwdRef` the fs hand tools resolve with
|
|
32
32
|
* (design/64 §16.3: a resident shell's `cd` persists and moves the fs tools' relative base with it).
|
|
33
33
|
*
|
|
@@ -127,6 +127,17 @@ export declare function classifierDenyCauseOf(d: unknown, call: {
|
|
|
127
127
|
toolCallId: string;
|
|
128
128
|
toolName: string;
|
|
129
129
|
}): import("./gate-outcome.js").ClassifierDenyCause | undefined;
|
|
130
|
+
/** Attest that `d` is an in-fold deny of an ask nobody could resolve, for `call`, for the named cause. */
|
|
131
|
+
export declare function attestAskUnresolvableCause<T extends object>(d: T, cause: import("./ask-unresolvable-notice.js").AskUnresolvableCause, call: {
|
|
132
|
+
toolCallId: string;
|
|
133
|
+
toolName: string;
|
|
134
|
+
}): T;
|
|
135
|
+
/** Read the attested unresolvable cause off a deny FOR the named call (the gate's exit is the consumer); a
|
|
136
|
+
* binding to a different call is a replayed object and answers absence. Internal seam — not re-exported. */
|
|
137
|
+
export declare function askUnresolvableCauseOf(d: unknown, call: {
|
|
138
|
+
toolCallId: string;
|
|
139
|
+
toolName: string;
|
|
140
|
+
}): import("./ask-unresolvable-notice.js").AskUnresolvableCause | undefined;
|
|
130
141
|
/** Read the engine-attested settlement off a funneled decision FOR the named call (the gate's exit is the
|
|
131
142
|
* one consumer): an attestation bound to a different call is a replayed object and answers absence.
|
|
132
143
|
* Exported for the gate module only — deliberately NOT re-exported from `src/index.ts` (an internal seam
|
|
@@ -215,7 +226,7 @@ export type PermissionResult = {
|
|
|
215
226
|
message?: string;
|
|
216
227
|
decisionReason?: DecisionReason;
|
|
217
228
|
requiresRealApproval?: boolean;
|
|
218
|
-
/**
|
|
229
|
+
/** This ask is the classifier DENIAL-LIMIT fallback — the block that reached a
|
|
219
230
|
* bound (CC 2.1.250 `FO`, count-then-judge) handed to a person instead of being denied.
|
|
220
231
|
* ENGINE-STAMPED beside `requiresRealApproval: true` and `decisionReason: "classifier"` at the
|
|
221
232
|
* classifier block sites (the gate's own and the inherited-lane arms); carries the COUNTS ONLY —
|
|
@@ -249,7 +260,7 @@ export type PermissionResult = {
|
|
|
249
260
|
* understands (see {@link import("./checkpoint-store.js").ProbeCause}). Engine-stamped and
|
|
250
261
|
* validated at the irreversibility tighten; same display-only posture as the prose sibling. */
|
|
251
262
|
probeCause?: import("./checkpoint-store.js").ProbeCause;
|
|
252
|
-
/**
|
|
263
|
+
/** The reversibility probe declared this demotion STRUCTURAL — see
|
|
253
264
|
* {@link import("./types.js").ReversibilityVerdict.mandated}. Unlike its two `probe*` neighbours
|
|
254
265
|
* this is NOT display metadata: it joins the #144 mandate family, so the persisted-rule lane
|
|
255
266
|
* discloses a matching allow rule as shadowed instead of clearing the ask, and the card's
|
|
@@ -474,7 +485,7 @@ export interface ToolPolicyProjection {
|
|
|
474
485
|
* `session-rule-policy.ts`. Not part of the public API (`src/index.ts` re-exports by name and does not
|
|
475
486
|
* list these two): every publisher of {@link ToolPolicyNameSets} must resolve a covering entry the same
|
|
476
487
|
* way, because the prepare-time audit's exemption for these spellings speaks for ALL published name sets
|
|
477
|
-
* at once — the four in-engine lanes do so by sharing this module's matcher.
|
|
488
|
+
* at once — the four in-engine lanes do so by sharing this module's matcher. That premise is NOT
|
|
478
489
|
* structural for an OUT-OF-ENGINE publisher (a host compiling its own settings into an exact-match ask
|
|
479
490
|
* closure is fail-open on these spellings while the audit stays silent) — which is why the underlying
|
|
480
491
|
* judgment predicates (`isNamespacedCoveringRuleName` / `namespacedRuleNameCovers`) ARE exported from
|
|
@@ -517,7 +528,7 @@ export type ConstraintChainEntryMeta = {
|
|
|
517
528
|
/** True iff the layer carried a frozen auto-mode classifier (`autoMode`). */
|
|
518
529
|
autoModeArmed?: true;
|
|
519
530
|
/**
|
|
520
|
-
*
|
|
531
|
+
* The layer's serializable auto-mode ARMING RECIPE: the criteria half of the frozen classifier
|
|
521
532
|
* (assembly inputs + knobs + the deployment's settings epoch), recorded so a CROSS-PROCESS redemption
|
|
522
533
|
* can rebuild an equivalent decider over its own fresh model leg
|
|
523
534
|
* ({@link import("./auto-mode-arming.js").rebuildAutoModeDecider}) instead of answering `unavailable`
|
|
@@ -753,7 +764,7 @@ export declare function combinePolicies(...policies: ToolPolicy[]): ToolPolicy;
|
|
|
753
764
|
/**
|
|
754
765
|
* The shell tools whose `{ command }` arg a coarse command-name policy parses. Other tools are out of scope.
|
|
755
766
|
*
|
|
756
|
-
*
|
|
767
|
+
* `Monitor` belongs here. It takes a `command` and runs it through the
|
|
757
768
|
* SAME `env.spawnBackground` seam as Bash, and prepare-task's own note says so in as many words — "Monitor
|
|
758
769
|
* runs an arbitrary shell `command` through the SAME env seam — it must sit behind the SAME shellGate
|
|
759
770
|
* tighten (else it becomes a policy side-door around a gated Bash)". The shellGate half was implemented;
|
|
@@ -763,7 +774,7 @@ export declare function combinePolicies(...policies: ToolPolicy[]): ToolPolicy;
|
|
|
763
774
|
* gate at all; the same substitution makes `rm -rf ~/.ai-agent/sessions` a way to erase the audit trail.
|
|
764
775
|
*/
|
|
765
776
|
/**
|
|
766
|
-
*
|
|
777
|
+
* EXPORTED. A downstream governance layer keeps its own copy of this list so its
|
|
767
778
|
* per-command ask-list gates the same tools core does, and it had no way to read the real one — its guard
|
|
768
779
|
* had to probe a hand-written candidate list of names, which stays green for any name nobody thought to
|
|
769
780
|
* put in it. The list itself is the fact; publishing it removes the guess.
|
|
@@ -805,13 +816,11 @@ export declare const COARSE_SHELL_TOOLS: string[];
|
|
|
805
816
|
* you MUST compose explicitly: `combinePolicies(deploymentBaseline, createCoarseCommandNamePolicy(…))`
|
|
806
817
|
* (deny-wins — both policies' denies still fire). {@link tightenTaskSpec} does this for you.
|
|
807
818
|
*
|
|
808
|
-
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
* command
|
|
812
|
-
*
|
|
813
|
-
* give you a budgetable normal-ask on `bash`; it gives a hard human-approval suspend. Choose `shellGate` and a
|
|
814
|
-
* `defaultAction:"ask"` deliberately.
|
|
819
|
+
* Under `TaskSpec.shellGate: "classify"` a plain `ask` from this policy stays a plain ask: the shell seat's
|
|
820
|
+
* `"maybe"` tier is the doctrine's probe instrument, not a risk label, so the park is the budgetable kind
|
|
821
|
+
* (`human` under `durableApproval`) unless the probe mandated the call (an out-of-root read) or could not
|
|
822
|
+
* answer. A command the doctrine's OWN tighten refuses (`rm -rf …` with no policy asking first) still parks
|
|
823
|
+
* non-budgetable — the safety axis is judged per call by `safetyAxisOf`.
|
|
815
824
|
*/
|
|
816
825
|
export declare function createCoarseCommandNamePolicy(opts: {
|
|
817
826
|
/** Command names (argv[0]) explicitly allowed. If provided, a name NOT listed falls to `defaultAction`. */
|
|
@@ -832,7 +841,7 @@ export declare function findUnverifiableRecursiveDelete(command: string, safeVar
|
|
|
832
841
|
* message carries the CC-sanctioned remediation (re-run with the resolved LITERAL path written into the
|
|
833
842
|
* command, or assign the variable in the same command) — it doubles as the `askMessage` a classifier sees.
|
|
834
843
|
*
|
|
835
|
-
*
|
|
844
|
+
* This used to be an unconditional `deny`, on the theory that the CC rule text forbids
|
|
836
845
|
* auto-allow («must be explicitly approved … cannot be auto-allowed by a permission rule»).
|
|
837
846
|
*
|
|
838
847
|
* RB-341 (2026-07-29) re-checked that citation against the 220 corpus and corrected it in BOTH directions.
|
|
@@ -883,7 +892,7 @@ export declare function findUnverifiableRecursiveDelete(command: string, safeVar
|
|
|
883
892
|
* (already denied). Core wires this policy ALWAYS-ON in the runner's gate composition (prepare-task); it is
|
|
884
893
|
* exported so deployments can also compose/test it directly.
|
|
885
894
|
*
|
|
886
|
-
*
|
|
895
|
+
* `requiresRealApproval` also turns out to be the correct sema analog of the one thing
|
|
887
896
|
* `classifierApprovable: false` still buys in 220 that a `circuitBreaker` does NOT take back — 220's
|
|
888
897
|
* bypassPermissions arm refuses to auto-allow an ask carrying `circuitBreaker === "dangerousRemoval"`
|
|
889
898
|
* (603856-603869), i.e. a blanket MODE setting cannot clear it, only judgment can. That is exactly the
|
|
@@ -942,21 +951,21 @@ export interface AskDelegationProvenance {
|
|
|
942
951
|
* (see {@link OnAsk} for the full detached-settlement contract). */
|
|
943
952
|
export interface AskRequest {
|
|
944
953
|
toolName: string;
|
|
945
|
-
/**
|
|
954
|
+
/** A persisted allow rule MATCHED this call but could not clear the ask (mandated — see
|
|
946
955
|
* {@link PermissionResult}'s ask arm). The matched rule text — or, when a covering SET admitted the
|
|
947
956
|
* command segment-wise (the conjunction arm), a comma-joined display list of up to five sanitized
|
|
948
957
|
* rule texts with an "and N more" tail — so the approval card renders "your rule is alive, just
|
|
949
958
|
* outranked" instead of leaving the person to regex the message prose. A DISPLAY value, not an
|
|
950
959
|
* identity channel: per-rule identity travels on {@link AskRuleEvidence.personalRuleDots}. */
|
|
951
960
|
persistedRuleShadowed?: string;
|
|
952
|
-
/**
|
|
961
|
+
/** WHY the reversibility probe did not clear this call — the account of the tighten the
|
|
953
962
|
* card was showing WITHOUT until now (the gate knew the cause and dropped it at this seam, leaving the
|
|
954
963
|
* approver the action but not the reason it is being asked about). Present only for a `"maybe"`-tier
|
|
955
964
|
* tighten whose probe supplied a cause; the durable park route carries the same string as
|
|
956
965
|
* `RiskDescriptor.probeReason`. Neutralized + length-capped by the gate. UNTRUSTED-for-display,
|
|
957
966
|
* never adjudication input. */
|
|
958
967
|
readonly probeReason?: string;
|
|
959
|
-
/**
|
|
968
|
+
/** The STRUCTURED cause behind the tighten — a machine-readable code plus the operand
|
|
960
969
|
* families as arrays with honest totals, so this surface renders its OWN sentence rather than one the
|
|
961
970
|
* engine had to write before the check's edge cases were known. See
|
|
962
971
|
* {@link import("./checkpoint-store.js").ProbeCause}, whose contract is that the ARRAY is the
|
|
@@ -1149,12 +1158,12 @@ export interface AskRequest {
|
|
|
1149
1158
|
* - `isDelegatedChild` — REFUSAL POSTURE: "no user turn ever lands in this run's transcript";
|
|
1150
1159
|
* drives which deny text the model is told (stop-and-wait vs adapt-or-report), forks included. */
|
|
1151
1160
|
readonly isDelegatedChild?: true;
|
|
1152
|
-
/**
|
|
1161
|
+
/** Carried from the originating {@link PermissionResult}'s ask
|
|
1153
1162
|
* variant of the same name: `true` ⇒ {@link resolveAsk} must not let a blanket `onAsk: "allow"`
|
|
1154
1163
|
* clear this ask (see that field's doc). `readonly`, filled by the gate from the decision, never a
|
|
1155
1164
|
* caller/worker-settable field. */
|
|
1156
1165
|
readonly requiresRealApproval?: boolean;
|
|
1157
|
-
/**
|
|
1166
|
+
/** Present ⇔ this ask is the classifier DENIAL-LIMIT fallback (see the
|
|
1158
1167
|
* {@link PermissionResult} ask-arm member of the same name): the counts that tripped the bound and
|
|
1159
1168
|
* this ask's own auto-deny window. Two readers: a card renders it as a countdown; {@link resolveAsk}
|
|
1160
1169
|
* arms its deadline from `autoDenyAfterMs` (> 0 ⇒ an unanswered function approver auto-denies at
|
|
@@ -1304,7 +1313,7 @@ export type OnAsk = "deny" | "allow" | ((req: AskRequest, signal?: AbortSignal)
|
|
|
1304
1313
|
* (abort, throw, unavailable, out-of-contract value), each already stamped at its own arm, and a
|
|
1305
1314
|
* self-reported one would let a host relabel its refusal as an engine failure.
|
|
1306
1315
|
*
|
|
1307
|
-
*
|
|
1316
|
+
* The ONE ask on this leg the engine DOES time: a classifier denial-limit fallback (the ask
|
|
1308
1317
|
* carrying `denialLimitFallback` with a non-zero `autoDenyAfterMs`). Its window is core's, because
|
|
1309
1318
|
* the fallback exists to bound a classifier that would otherwise deny without end. When it elapses
|
|
1310
1319
|
* the approver's promise is DETACHED (design/384: the wait is released, not cancelled — an approver
|
|
@@ -1390,6 +1399,26 @@ export declare function askApproverIdentity(onAsk: unknown): unknown;
|
|
|
1390
1399
|
* fold and the wiring station) plus the orchestrator, and each reaches DOWN for the one definition.
|
|
1391
1400
|
*/
|
|
1392
1401
|
export declare function isLiveApproverSeat(onAsk: OnAsk | undefined): boolean;
|
|
1402
|
+
/** Where a durable-approval MANDATE on a leg comes from — the closed set of its two sources. */
|
|
1403
|
+
export declare const DURABLE_MANDATE_SOURCES: readonly ["force_durable_gate", "durable_approval"];
|
|
1404
|
+
export type DurableMandateSource = (typeof DURABLE_MANDATE_SOURCES)[number];
|
|
1405
|
+
/**
|
|
1406
|
+
* Is every interactive permission ask of this leg MANDATED to gate durably — and by which source?
|
|
1407
|
+
* `force_durable_gate`: the per-principal control-plane entitlement, in force regardless of any seat.
|
|
1408
|
+
* `durable_approval`: the task's own opt-in with NO live approver seat (a blanket string or nobody at all
|
|
1409
|
+
* cannot answer an ask, so the park is the only honest resolution). A live seat beside the opt-in is not a
|
|
1410
|
+
* mandate: the leg's asks — and its children's, at the same frozen seat — resolve there.
|
|
1411
|
+
*
|
|
1412
|
+
* ONE definition on purpose, like {@link isLiveApproverSeat} beside it: the chain a parent freezes for its
|
|
1413
|
+
* children and the loud "mandated but no store" disclosure at the wiring station used to derive the same
|
|
1414
|
+
* fact with two hand-written conditions, and the second one read only the entitlement — a task that opted
|
|
1415
|
+
* in and had no store degraded to the live chain in silence.
|
|
1416
|
+
*/
|
|
1417
|
+
export declare function durableMandateSourceOf(args: {
|
|
1418
|
+
forceDurableGate: boolean;
|
|
1419
|
+
durableApprovalDeclared: boolean;
|
|
1420
|
+
onAsk: OnAsk | undefined;
|
|
1421
|
+
}): DurableMandateSource | undefined;
|
|
1393
1422
|
/** EXACT structural clone for the approval boundary (alias isolation) — fail-closed, never lossy,
|
|
1394
1423
|
* never identity: a JSON round-trip would silently DROP unclonable members (presented ≠ executing =
|
|
1395
1424
|
* consent misrepresentation) and an identity fallback would hand the approver the live executing
|