@sema-agent/core 7.16.0 → 7.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +209 -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 +2 -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/engine.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +18 -6
- package/dist/core/memory-engine/layout.js +40 -21
- 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/physical-path.d.ts +37 -0
- package/dist/core/physical-path.js +30 -0
- 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/active-skill-scope.js +3 -3
- package/dist/core/runner/assemble-result.d.ts +15 -13
- package/dist/core/runner/assemble-result.js +5 -4
- package/dist/core/runner/compaction-call-options.d.ts +25 -89
- package/dist/core/runner/contracts.d.ts +11 -10
- package/dist/core/runner/gate-exit.js +15 -1
- package/dist/core/runner/halt-attribution.d.ts +35 -0
- package/dist/core/runner/halt-attribution.js +16 -0
- package/dist/core/runner/memory-consolidation.d.ts +0 -2
- package/dist/core/runner/memory-consolidation.js +0 -1
- package/dist/core/runner/prepare-artifact.d.ts +52 -0
- package/dist/core/runner/prepare-artifact.js +63 -0
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -3
- package/dist/core/runner/prepare-config-doors.d.ts +3 -3
- package/dist/core/runner/prepare-config-doors.js +5 -2
- package/dist/core/runner/prepare-context-lane.d.ts +2 -2
- package/dist/core/runner/prepare-context-lane.js +2 -13
- package/dist/core/runner/prepare-file-history.d.ts +1 -1
- package/dist/core/runner/prepare-file-history.js +3 -52
- package/dist/core/runner/prepare-hands-readface.d.ts +4 -7
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -2
- package/dist/core/runner/prepare-inherited-gate.js +7 -8
- package/dist/core/runner/prepare-memory.d.ts +4 -6
- package/dist/core/runner/prepare-memory.js +4 -2
- package/dist/core/runner/prepare-policy-chain.d.ts +3 -3
- 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-question-face.js +2 -1
- package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
- package/dist/core/runner/prepare-suspend-saga.js +0 -2
- package/dist/core/runner/prepare-task.js +12 -11
- package/dist/core/runner/prepare-wiring-manifest.js +9 -7
- package/dist/core/runner/resume-admission.js +2 -1
- package/dist/core/runner/resume-internals-and-config.js +4 -0
- 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-harness-handlers.js +5 -3
- package/dist/core/runner/run-settle-and-teardown.d.ts +1 -1
- package/dist/core/runner/run-settle-and-teardown.js +3 -1
- package/dist/core/runner/session-file-state-replay.js +3 -3
- package/dist/core/runner/session-rule-policy.js +3 -4
- package/dist/core/runner/stream-halt-verbs.js +1 -1
- package/dist/core/runner/stream-steer-verb.js +1 -4
- 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 +11 -12
- 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/skills-directory.js +4 -3
- package/dist/core/spec-contract.js +5 -4
- 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 +32 -28
- package/dist/core/task-registry-shared.js +4 -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 +6 -1
- 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 +66 -22
- package/dist/core/tool-policy.js +31 -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 +8 -5
- package/dist/engine/harness/agent-harness.d.ts +47 -4
- package/dist/engine/harness/agent-harness.js +52 -9
- package/dist/engine/loop/agent-loop.js +15 -8
- package/dist/engine/loop/types.d.ts +5 -0
- package/dist/index.d.ts +20 -14
- package/dist/index.js +16 -10
- 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-script-store.js +9 -25
- 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 +237 -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/cc/task-list-store.js +2 -10
- package/dist/stores/file/checkpoint-store.js +1 -5
- package/dist/stores/file/file-history-store.js +2 -2
- package/dist/stores/file/fs-atomic.d.ts +15 -18
- package/dist/stores/file/fs-atomic.js +4 -14
- package/dist/stores/file/mailbox-store.d.ts +7 -11
- package/dist/stores/file/mailbox-store.js +4 -11
- 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 +297 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +90 -8
- package/dist/tools/fs/bash-readonly-classifier.js +294 -70
- package/dist/tools/fs/fs-bash.d.ts +14 -10
- package/dist/tools/fs/fs-bash.js +50 -33
- package/dist/tools/fs/fs-search-tools.js +5 -2
- package/dist/tools/fs/fs-shared.d.ts +2 -0
- package/dist/tools/fs/fs-shared.js +3 -11
- package/dist/tools/fs/index.d.ts +4 -0
- package/dist/tools/fs/index.js +4 -1
- package/dist/tools/fs/safety.d.ts +117 -1
- package/dist/tools/fs/safety.js +131 -31
- package/dist/tools/fs/search.js +8 -6
- package/package.json +2 -1
- package/test/export-surface.snapshot.json +119 -39
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TaskNotificationPayload } from "./task-notification.js";
|
|
2
2
|
import { type RegistryCore, type RegisterMonitorInput, type MonitorTaskHandle, type UnifiedTaskResult } from "./task-registry-shared.js";
|
|
3
3
|
export declare function registerMonitorLane(core: RegistryCore, input: RegisterMonitorInput): string;
|
|
4
|
-
/**
|
|
4
|
+
/** ONE absorption arithmetic for a monitor poll — env-side-loss accounting
|
|
5
5
|
* (RB-238), the spool roll (registry memory bound) and the completed-line split — shared by the
|
|
6
6
|
* watcher tick and the stop-time final drain. A hand-copied twin in stopMonitor is how half-fixes
|
|
7
7
|
* happen: any change to the roll/line rules must reach both consumers through this method. Returns
|
|
@@ -12,7 +12,7 @@ export declare function absorbMonitorPollLane(handle: MonitorTaskHandle, v: {
|
|
|
12
12
|
truncated?: boolean;
|
|
13
13
|
bytesDroppedBeforeCursor?: number;
|
|
14
14
|
}): string[];
|
|
15
|
-
/**
|
|
15
|
+
/** The swallow-guarded event sink, shared by the watcher's emits and the stop-time drain. */
|
|
16
16
|
export declare function emitMonitorEventLane(handle: MonitorTaskHandle, n: TaskNotificationPayload): void;
|
|
17
17
|
/** The monitor watcher tick loop. Same zombie-proofing discipline as {@link startBashWatcher}
|
|
18
18
|
* (re-entrancy guard / stop on eviction / stop on vanished shell / stop on a throwing adapter),
|
|
@@ -22,7 +22,7 @@ export type SemaTaskStatus = "pending" | "running" | "parked" | "completed" | "f
|
|
|
22
22
|
export type TaskRetrievalStatus = "success" | "not_ready" | "timeout";
|
|
23
23
|
export interface UnifiedTaskOutput {
|
|
24
24
|
task_id: string;
|
|
25
|
-
/**
|
|
25
|
+
/** `"unknown"` is a DECLARED member here, not a stray literal. A
|
|
26
26
|
* not-found lookup has no task kind to report, and the TaskStop envelope's `task_type` is required by
|
|
27
27
|
* the client schema — so the wrapper was already emitting `"unknown"` while the type said it could
|
|
28
28
|
* only be a `SemaTaskType`. Declaring it keeps the two honest with each other, and keeps `SemaTaskType`
|
|
@@ -40,7 +40,11 @@ export interface UnifiedTaskOutput {
|
|
|
40
40
|
code?: string;
|
|
41
41
|
/** RB-386② — machine-readable failure code on a FAILED background_agent row's poll
|
|
42
42
|
* details (the child's TaskResult.errorCode taxonomy — brain codes / `limit.*` / `budget.*` …).
|
|
43
|
-
* Additive; absent on non-failed rows, on rows whose failure carried no code, and on other lanes.
|
|
43
|
+
* Additive; absent on non-failed rows, on rows whose failure carried no code, and on other lanes.
|
|
44
|
+
* The same key also carries a failed WORKFLOW run's `WorkflowRun.errorCode` (
|
|
45
|
+
* `workflow.*` for the orchestration's own refusals / a failed child's terminal code), populated
|
|
46
|
+
* by `formatWorkflowRun`: one field name for "why this poll answer is a failure", whichever lane
|
|
47
|
+
* minted the failure. */
|
|
44
48
|
errorCode?: string;
|
|
45
49
|
/** RB-386② — retryability verdict for a FAILED background_agent row, derived at settle time by the
|
|
46
50
|
* same classifier the sync sub-agent report's `error_kind (retryable: …)` line uses. Additive. */
|
|
@@ -146,7 +150,7 @@ export interface BackgroundBashTaskHandle extends SemaTaskHandle {
|
|
|
146
150
|
* `mirrorFailed` records that at least one append to the advertised output FILE failed — the terminal
|
|
147
151
|
* frame then discloses the file as incomplete instead of letting the launch receipt's "full output is
|
|
148
152
|
* appended there" promise stand over a silently partial file. */
|
|
149
|
-
/**
|
|
153
|
+
/** `droppedBytes`/`dropUnknown` account ENV-SIDE tail-buffer eviction disclosed by
|
|
150
154
|
* the poll (`bytesDroppedBeforeCursor`/`truncated`) — a loss upstream of (and distinct from) the
|
|
151
155
|
* registry's own `rolledChars` memory bound. Bytes counted here never reached the spool at all. */
|
|
152
156
|
spool?: {
|
|
@@ -182,7 +186,7 @@ export interface WorkflowTaskHandle extends SemaTaskHandle {
|
|
|
182
186
|
store?: WorkflowRunStore;
|
|
183
187
|
/** B-1 (live leg) — see {@link RegisterWorkflowInput.originatingSessionId}. */
|
|
184
188
|
originatingSessionId?: string;
|
|
185
|
-
/**
|
|
189
|
+
/** Design/129 session-lifetime discipline, extended to workflow — the
|
|
186
190
|
* ONE background kind that never had it (`background_bash`/`monitor`/`background_agent` all do).
|
|
187
191
|
* Unlike those three (task-scoped BY DEFAULT, `sessionScoped` an explicit opt-in via
|
|
188
192
|
* `TaskSpec.backgroundScope`), a workflow is unconditionally session-anchored — `originatingSessionId`
|
|
@@ -198,7 +202,7 @@ export interface WorkflowTaskHandle extends SemaTaskHandle {
|
|
|
198
202
|
sessionScoped?: true;
|
|
199
203
|
/** See {@link RegisterWorkflowInput.onServedTerminal}. Cleared after the single fire. */
|
|
200
204
|
onServedTerminal?: () => void;
|
|
201
|
-
/**
|
|
205
|
+
/** The bounded return value, captured on the done-hook so the STORE-LESS in-memory lane's
|
|
202
206
|
* terminal poll can hand it over too (the launch note promises it; without a store there was no result). */
|
|
203
207
|
result?: string;
|
|
204
208
|
/** T2A-8: the failure reason (bounded + redacted), captured on the done-hook's rejection so a store-less
|
|
@@ -232,7 +236,7 @@ export interface BackgroundAgentTaskHandle extends SemaTaskHandle {
|
|
|
232
236
|
type: "background_agent";
|
|
233
237
|
/** design/115 P3: aborting this cancels the child run (TaskStop / parent teardown). */
|
|
234
238
|
abort: AbortController;
|
|
235
|
-
/**
|
|
239
|
+
/** Lineage axes, declared (registration always spread them into the handle; readers used
|
|
236
240
|
* to cast). `rootSessionId` feeds {@link canAccess}'s root-session arm; the other two stay
|
|
237
241
|
* read-only lineage metadata on the live face (no parentSessionId access arm — see the arm's
|
|
238
242
|
* comment for why). The register side clamps `parentTaskId`. */
|
|
@@ -313,7 +317,7 @@ export interface BackgroundAgentTaskHandle extends SemaTaskHandle {
|
|
|
313
317
|
/** Terminal snapshot (bounded, {@link BG_AGENT_RESULT_MAX} in subagent.ts) — served by TaskOutput
|
|
314
318
|
* once the child finishes. */
|
|
315
319
|
result?: string;
|
|
316
|
-
/**
|
|
320
|
+
/** The FULL result (bounded only by the defensive {@link BG_AGENT_RESULT_FULL_MAX} ceiling
|
|
317
321
|
* in subagent.ts), set ONLY when it differs from `result` — same shape as {@link WorkflowRun.resultFull}
|
|
318
322
|
* (workflow.ts NH-1). Before this field existed, the settle call sites pre-sliced `child.result` to
|
|
319
323
|
* ~2-4K chars with no disclosure — clipTaskOutput's own file-pointer/offload-friendly design at the
|
|
@@ -350,7 +354,7 @@ export interface BackgroundAgentTaskHandle extends SemaTaskHandle {
|
|
|
350
354
|
* overloaded/timeout/network ⇒ true, logic ⇒ false). Stored rather than re-derived so the core
|
|
351
355
|
* poll lane never has to import the agents-domain classifier (no new domain cycle). */
|
|
352
356
|
errorRetryable?: boolean;
|
|
353
|
-
/**
|
|
357
|
+
/** The coarse classification KIND beside `errorRetryable`
|
|
354
358
|
* (classifySubagentError's error_kind ∈ rate_limit/overloaded/timeout/network/logic), threaded
|
|
355
359
|
* from the same settle mint point and stored for the same no-domain-cycle reason as its sibling.
|
|
356
360
|
* Rendered on the FAILED row's poll TEXT face as the `(error_kind: …, retryable: …)` clause —
|
|
@@ -421,7 +425,7 @@ export interface MonitorTaskHandle extends SemaTaskHandle {
|
|
|
421
425
|
lineBuf: string;
|
|
422
426
|
/** Per-batch monotonic counter → unique notification dedup keys (see task-notification.ts). */
|
|
423
427
|
seq: number;
|
|
424
|
-
/**
|
|
428
|
+
/** The TWO-LEVEL event-storm control's state.
|
|
425
429
|
* Level 1 = a token bucket (`stormTokens` out of `stormBurst`, refilled one per
|
|
426
430
|
* `stormRefillIntervalMs`): a batch that cannot consume a token is SUPPRESSED (its lines stay in the
|
|
427
431
|
* re-readable spool) and counted in `suppressedBatches`; the next batch that DOES consume one first
|
|
@@ -452,7 +456,7 @@ export interface MonitorTaskHandle extends SemaTaskHandle {
|
|
|
452
456
|
deadlineAt?: number;
|
|
453
457
|
timeoutMs?: number;
|
|
454
458
|
watcher?: unknown;
|
|
455
|
-
/**
|
|
459
|
+
/** A watcher tick is suspended on its pollBackground await RIGHT NOW. The stop-time
|
|
456
460
|
* final drain must skip its own poll then (that in-flight tick already consumed the env cursor — and a
|
|
457
461
|
* never-resolving adapter must not pin TaskStop). Set/cleared in lockstep with the tick's re-entrancy
|
|
458
462
|
* guard. */
|
|
@@ -486,7 +490,7 @@ export interface MonitorTaskHandle extends SemaTaskHandle {
|
|
|
486
490
|
/** design/158 S2 — cumulative chars (UTF-16 code units, `string.length`) handed to `store.put`
|
|
487
491
|
* across every segment this handle has spilled so far (both streams combined) — the per-handle
|
|
488
492
|
* disk-cap accounting ({@link import("./task-registry-monitor.js")} reads `MONITOR_SPILL_CAP_CHARS`
|
|
489
|
-
* against this).
|
|
493
|
+
* against this). The field used to be named `spillBytesUsed` while the ledger counted
|
|
490
494
|
* chars — renamed to the axis it really measures (see the constant's own doc for why chars). */
|
|
491
495
|
spillCharsUsed?: number;
|
|
492
496
|
/** design/158 S2 — the per-handle spill cap (`MONITOR_SPILL_CAP_CHARS`) was reached; further
|
|
@@ -518,10 +522,10 @@ export interface RegisterMonitorInput extends TaskAccess {
|
|
|
518
522
|
timers?: MonitorTimers;
|
|
519
523
|
/** Batch window (ms, default 200): lines arriving within one tick coalesce into one notification. */
|
|
520
524
|
batchWindowMs?: number;
|
|
521
|
-
/**
|
|
525
|
+
/** The SUSTAINED batch rate the storm bucket refills at (default 50/min). Exceeding it is
|
|
522
526
|
* suppression, not death — see `stormBurst` and MONITOR_STORM_KILL_AFTER_MS. */
|
|
523
527
|
maxBatchesPerMinute?: number;
|
|
524
|
-
/**
|
|
528
|
+
/** Burst capacity of the storm bucket (default MONITOR_STORM_BURST = CC's 10). */
|
|
525
529
|
stormBurst?: number;
|
|
526
530
|
now?: number;
|
|
527
531
|
/** design/158 S2 (RB-364 半) — the offload store a rolled-off spool middle spills to (see
|
|
@@ -563,23 +567,23 @@ export declare const MONITOR_BATCH_WINDOW_MS = 200;
|
|
|
563
567
|
export declare const MONITOR_DEFAULT_TIMEOUT_MS = 300000;
|
|
564
568
|
export declare const MONITOR_MAX_TIMEOUT_MS = 3600000;
|
|
565
569
|
export declare const MONITOR_MAX_BATCHES_PER_MINUTE = 50;
|
|
566
|
-
/**
|
|
570
|
+
/** Burst capacity of the storm token bucket — how many batches may fire
|
|
567
571
|
* back-to-back before the SUPPRESSION level engages. CC value, adopted verbatim. */
|
|
568
572
|
export declare const MONITOR_STORM_BURST = 10;
|
|
569
|
-
/**
|
|
573
|
+
/** How long a monitor must stay CONTINUOUSLY over budget before the
|
|
570
574
|
* second level (kill) fires. CC value, adopted verbatim. */
|
|
571
575
|
export declare const MONITOR_STORM_KILL_AFTER_MS = 30000;
|
|
572
|
-
/**
|
|
576
|
+
/** The partial-line accumulator bound. sema's `lineBuf` had NO bound —
|
|
573
577
|
* a monitored process emitting megabytes without a single newline grew it without limit (the spool's
|
|
574
578
|
* own roll never covered it). Keep the TAIL (the newest bytes are the ones a watch is about). */
|
|
575
579
|
export declare const MONITOR_LINE_BUF_CAP = 1048576;
|
|
576
|
-
/**
|
|
580
|
+
/** The monitor event-result clip, shared by the watcher's batch/terminal emits and
|
|
577
581
|
* the stop-time drain emit (one clip, one truncation wording). */
|
|
578
582
|
export declare function clipMonitorEvent(s: string): string;
|
|
579
|
-
/**
|
|
583
|
+
/** Per-line clip applied to the `lines[]` a batch carries. Spool untouched. */
|
|
580
584
|
export declare function clipMonitorLine(s: string): string;
|
|
581
585
|
/**
|
|
582
|
-
*
|
|
586
|
+
* The ONE terminal-notification summary
|
|
583
587
|
* HEAD for a background command / monitor watch. Every terminal frame in the bash and monitor lanes
|
|
584
588
|
* composes its summary as `terminalTaskSummary(...)` plus this lane's own honest detail clause — the
|
|
585
589
|
* pre-RB-335 code had six hand-written phrasings whose comment claimed "no CC sample for those faces"
|
|
@@ -619,14 +623,14 @@ export declare function rollSpoolText(spool: {
|
|
|
619
623
|
* matching the pre-S2 loss shape for whatever is dropped PAST the cap. Exported so the boundary is a
|
|
620
624
|
* testable contract, not a buried literal.
|
|
621
625
|
*
|
|
622
|
-
*
|
|
626
|
+
* The constant used to be named
|
|
623
627
|
* `..._BYTES` while the ledger added `dropped.length` — chars, up to ~3× fewer than UTF-8 bytes on
|
|
624
628
|
* multibyte content. CHARS is the axis kept (name changed, arithmetic untouched) because it is the
|
|
625
629
|
* offload store family's own coordinate (`InMemoryToolResultStore.maxTotalChars` evicts by
|
|
626
630
|
* `content.length`; `ToolResultSlice.totalChars`) and the spool's `rolledChars` axis — one unit
|
|
627
631
|
* end-to-end; a `Buffer.byteLength` ledger here would sit crosswise to the store's own cap. */
|
|
628
632
|
export declare const MONITOR_SPILL_CAP_CHARS: number;
|
|
629
|
-
/**
|
|
633
|
+
/** Fold one poll's env-side-loss disclosure into the spool's account. The env's
|
|
630
634
|
* tail buffer evicts its HEAD under pressure (node-execution-env 8MB bound) — those bytes are gone
|
|
631
635
|
* before any watcher ever saw them, which is a different loss than the registry-side `rolledChars`
|
|
632
636
|
* middle-drop. `bytesDroppedBeforeCursor` only counts bytes dropped before an unconsumed cursor, so
|
|
@@ -645,7 +649,7 @@ export declare function accountDroppedBytes(spool: {
|
|
|
645
649
|
truncated?: boolean;
|
|
646
650
|
bytesDroppedBeforeCursor?: number;
|
|
647
651
|
}): void;
|
|
648
|
-
/**
|
|
652
|
+
/** The POLL-FACE wording for env-side loss (the terminal/event-frame wording is
|
|
649
653
|
* {@link droppedGapNote}'s; the two faces differ by design and always have). One function so the two
|
|
650
654
|
* quantified/unquantified branches cannot drift between the three legs that render it: the monitor
|
|
651
655
|
* re-readable spool, the bash re-readable spool, and the bash blocked wait. Trailing newline included
|
|
@@ -686,7 +690,7 @@ export interface SpoolBodyOptions {
|
|
|
686
690
|
/** A full banner line (own trailing newline) rendered after the drop note, or "". */
|
|
687
691
|
drainNote: string;
|
|
688
692
|
}
|
|
689
|
-
/**
|
|
693
|
+
/** The ONE renderer for a re-readable spool's TaskOutput body,
|
|
690
694
|
* shared by the monitor lane (pollMonitorLane) and the bash spool lane (pollBackgroundBash).
|
|
691
695
|
*
|
|
692
696
|
* Both faces were hand-copied twins carrying three real disclosure bugs' worth of wording (env-side
|
|
@@ -700,19 +704,19 @@ export interface SpoolBodyOptions {
|
|
|
700
704
|
* wording ("accumulated char(s) dropped from the middle during the blocked wait"), an intentional
|
|
701
705
|
* divergence — it shares {@link accountDroppedBytes} + {@link spoolDropNote}, not this. */
|
|
702
706
|
export declare function renderSpoolBody(spool: RenderableSpool, opts: SpoolBodyOptions): string;
|
|
703
|
-
/**
|
|
707
|
+
/** The honesty suffix for frames over a spool with env-side loss. Empty when nothing dropped. */
|
|
704
708
|
export declare function droppedGapNote(spool: {
|
|
705
709
|
droppedBytes?: number;
|
|
706
710
|
dropUnknown?: true;
|
|
707
711
|
}): string;
|
|
708
|
-
/**
|
|
712
|
+
/** The event-stream disclosure rides the FIRST batch after a loss is observed (once-latch —
|
|
709
713
|
* a chatty watch must not repeat the note on every batch; terminal frames disclose unconditionally). */
|
|
710
714
|
export declare function firstDropNote(spool: {
|
|
711
715
|
droppedBytes?: number;
|
|
712
716
|
dropUnknown?: true;
|
|
713
717
|
dropNotified?: true;
|
|
714
718
|
}): string;
|
|
715
|
-
/**
|
|
719
|
+
/** ONE wording for "you stopped nothing" across every already-terminal stop face —
|
|
716
720
|
* the in-process bash/monitor/agent arms and the durable-row fallback previously split: the durable
|
|
717
721
|
* arm answered honestly while the in-process arms claimed `Terminated <id>.` over work that finished
|
|
718
722
|
* (or was killed) on its own. CC 220 refuses the call outright (`Task X is not running (status: …)`,
|
|
@@ -781,7 +785,7 @@ export declare function editDistance(a: string, b: string): number;
|
|
|
781
785
|
/** CC `htr` shape (206:519814-519827): candidates within Levenshtein ≤2 (length-diff ≤2 pre-filter),
|
|
782
786
|
* best-first; the single best is the "Did you mean" suggestion (`htr(e, keys, 1)[0]`, 206:575196). */
|
|
783
787
|
export declare function closestName(query: string, candidates: Iterable<string>): string | undefined;
|
|
784
|
-
/**
|
|
788
|
+
/** DEFAULT-DENY on BOTH axes — the old predicate skipped
|
|
785
789
|
* a missing axis (owner-less handle = readable by everyone in scope; scope-less handle = readable
|
|
786
790
|
* across scopes), splitting polarity with `canAccessAgentRecord` and re-opening the session-axis
|
|
787
791
|
* class cli/server just swept. Registration now REQUIRES both axes ({@link assertOwnership}), so a
|
|
@@ -822,7 +826,7 @@ export interface ParkedClaimTicket {
|
|
|
822
826
|
reservedRev: number;
|
|
823
827
|
row: import("./background-agent-store.js").BackgroundAgentRecord;
|
|
824
828
|
}
|
|
825
|
-
/**
|
|
829
|
+
/** Sibling of {@link mintCompletionId} for a caller that must compute the
|
|
826
830
|
* value BEFORE it is safe to commit (a CAS not yet known to win): fill-once with an EXTERNALLY-chosen
|
|
827
831
|
* value instead of generating a fresh one. Exists because `rollbackParkedClaim`'s original fix minted
|
|
828
832
|
* directly onto the live handle before its durable CAS was confirmed — a losing CAS then left a
|
|
@@ -2,8 +2,8 @@ import { uuidv7 } from "../internal/harness.js";
|
|
|
2
2
|
import { summarizeWorkflowRun } from "./workflow-run-store.js";
|
|
3
3
|
import { delimitUntrusted } from "./untrusted-text.js";
|
|
4
4
|
import { boundedRedactedSummary } from "./untrusted-egress.js";
|
|
5
|
-
import { clipWithFilePointer } from "./tool-errors.js";
|
|
6
|
-
import {
|
|
5
|
+
import { clipWithFilePointer, OUTPUT_BUDGET_MIN_CHARS } from "./tool-errors.js";
|
|
6
|
+
import { resolveEnvBudget } from "./env-budget.js";
|
|
7
7
|
export function mintCompletionId(target) {
|
|
8
8
|
if (target.completionId === undefined)
|
|
9
9
|
target.completionId = uuidv7();
|
|
@@ -60,18 +60,8 @@ export function terminalTaskSummary(kind, label, status, exitCode) {
|
|
|
60
60
|
}
|
|
61
61
|
const TASK_OUTPUT_DEFAULT_CHARS = 32_000;
|
|
62
62
|
export const TASK_OUTPUT_MAX_CHARS = 160_000;
|
|
63
|
-
const TASK_OUTPUT_MIN_CHARS = 512;
|
|
64
63
|
function taskMaxOutputChars() {
|
|
65
|
-
|
|
66
|
-
if (rawEnv === undefined || rawEnv.trim() === "")
|
|
67
|
-
return TASK_OUTPUT_DEFAULT_CHARS;
|
|
68
|
-
const raw = rawEnv.trim();
|
|
69
|
-
const n = /^\d+$/.test(raw) ? parseInt(raw, 10) : Number.NaN;
|
|
70
|
-
if (!Number.isFinite(n) || n <= 0) {
|
|
71
|
-
announceEnvKnob(`TASK_MAX_OUTPUT_LENGTH=${rawEnv} was ignored — it is not a positive whole number of characters. Using ${TASK_OUTPUT_DEFAULT_CHARS} instead.`);
|
|
72
|
-
return TASK_OUTPUT_DEFAULT_CHARS;
|
|
73
|
-
}
|
|
74
|
-
return Math.min(Math.max(n, TASK_OUTPUT_MIN_CHARS), TASK_OUTPUT_MAX_CHARS);
|
|
64
|
+
return resolveEnvBudget(process.env.TASK_MAX_OUTPUT_LENGTH, { name: "TASK_MAX_OUTPUT_LENGTH", unit: "characters", default: TASK_OUTPUT_DEFAULT_CHARS, min: OUTPUT_BUDGET_MIN_CHARS, max: TASK_OUTPUT_MAX_CHARS });
|
|
75
65
|
}
|
|
76
66
|
export function clipTaskOutput(s, fullOutputPath) {
|
|
77
67
|
return clipWithFilePointer(s, taskMaxOutputChars(), fullOutputPath);
|
|
@@ -269,6 +259,7 @@ export function formatWorkflowRun(run) {
|
|
|
269
259
|
status: run.status,
|
|
270
260
|
retrieval_status: "success",
|
|
271
261
|
...(run.completionId !== undefined ? { completionId: run.completionId } : {}),
|
|
262
|
+
...(run.errorCode !== undefined ? { errorCode: run.errorCode } : {}),
|
|
272
263
|
details: summary,
|
|
273
264
|
},
|
|
274
265
|
};
|
|
@@ -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.
|