@sema-agent/core 5.57.0 → 5.58.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 +48 -0
- package/dist/agents/cascade.d.ts +1 -1
- package/dist/agents/cumulative-stats.d.ts +1 -1
- package/dist/agents/observer.d.ts +2 -2
- package/dist/agents/peer-admission.d.ts +1 -1
- package/dist/agents/retain-ledger.d.ts +2 -2
- package/dist/agents/roster-store.d.ts +8 -8
- package/dist/agents/send-message-tool.d.ts +2 -2
- package/dist/agents/subagent-steps.d.ts +1 -1
- package/dist/agents/subagent.d.ts +13 -13
- package/dist/agents/team.d.ts +5 -5
- package/dist/agents/tool-filter.d.ts +2 -2
- package/dist/agents/verify.d.ts +1 -1
- package/dist/bench/metrics.d.ts +35 -35
- package/dist/brain/degrading.d.ts +1 -1
- package/dist/brain/errors.d.ts +3 -3
- package/dist/brain/reasoning.d.ts +2 -2
- package/dist/brain/repetition.d.ts +1 -1
- package/dist/brain/status-sink.d.ts +2 -2
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/config/catalog.d.ts +5 -5
- package/dist/core/arg-summary.d.ts +4 -4
- package/dist/core/ask-class.d.ts +2 -2
- package/dist/core/ask-question.d.ts +1 -1
- package/dist/core/auto-compaction.d.ts +15 -15
- package/dist/core/auto-mode.d.ts +5 -5
- package/dist/core/background-agent-store.d.ts +20 -20
- package/dist/core/background-shell.d.ts +4 -4
- package/dist/core/checkpoint-store.d.ts +35 -27
- package/dist/core/context-edit.d.ts +1 -1
- package/dist/core/context-guard.d.ts +1 -1
- package/dist/core/exec-output-tail.d.ts +6 -6
- package/dist/core/file-snapshot-store.d.ts +8 -8
- package/dist/core/git-worktree-env.d.ts +3 -3
- package/dist/core/governance-codes.js +2 -0
- package/dist/core/hooks.d.ts +73 -33
- package/dist/core/hooks.js +87 -25
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/locked-config.d.ts +1 -1
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mailbox-store.d.ts +1 -1
- package/dist/core/mcp.d.ts +3 -3
- package/dist/core/memory-engine/consolidation-driver.d.ts +207 -0
- package/dist/core/memory-engine/consolidation-driver.js +378 -0
- package/dist/core/memory-engine/consolidation.d.ts +46 -2
- package/dist/core/memory-engine/consolidation.js +1 -0
- package/dist/core/memory-engine/data-plane.d.ts +1 -1
- package/dist/core/memory-engine/distiller.d.ts +550 -0
- package/dist/core/memory-engine/distiller.js +598 -0
- package/dist/core/memory-engine/dual-root.d.ts +1 -1
- package/dist/core/memory-engine/engine.d.ts +47 -3
- package/dist/core/memory-engine/engine.js +37 -3
- package/dist/core/memory-engine/file-backend.d.ts +1 -1
- package/dist/core/memory-engine/index.d.ts +4 -2
- package/dist/core/memory-engine/index.js +4 -2
- package/dist/core/memory-engine/origin-clearance.d.ts +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +4 -4
- package/dist/core/memory-engine/sync-client.d.ts +16 -16
- package/dist/core/memory-engine/sync.d.ts +4 -4
- package/dist/core/memory-recall.d.ts +1 -1
- package/dist/core/memory.d.ts +2 -2
- package/dist/core/permission-rule-consent.d.ts +185 -36
- package/dist/core/permission-rule-consent.js +219 -44
- package/dist/core/permission-rule-model.d.ts +194 -31
- package/dist/core/permission-rule-model.js +93 -35
- package/dist/core/permission-rules.d.ts +9 -9
- package/dist/core/remote-env.d.ts +8 -8
- package/dist/core/roles.d.ts +3 -3
- package/dist/core/roles.js +1 -0
- package/dist/core/runner/assemble-result.d.ts +2 -2
- package/dist/core/runner/compaction-call-options.d.ts +3 -3
- package/dist/core/runner/memory-consolidation-driver.d.ts +49 -0
- package/dist/core/runner/memory-consolidation-driver.js +60 -0
- package/dist/core/runner/memory-consolidation.d.ts +1 -1
- package/dist/core/runner/prepare-config-doors.d.ts +3 -3
- package/dist/core/runner/prepare-task.d.ts +21 -21
- package/dist/core/runner/prepare-task.js +21 -14
- package/dist/core/runner/prepare-workspace-restore.d.ts +2 -2
- package/dist/core/runner/runtask.d.ts +11 -11
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/teardown-bounded.d.ts +1 -1
- package/dist/core/runner/tool-disclosure.d.ts +2 -2
- package/dist/core/runner/turn-attachments.d.ts +11 -11
- package/dist/core/scheduler.d.ts +5 -5
- package/dist/core/secret-env.d.ts +1 -1
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/session-policy-store.d.ts +2 -2
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +3 -3
- package/dist/core/session.d.ts +1 -1
- package/dist/core/shutdown-debug.d.ts +2 -2
- package/dist/core/side-query.d.ts +2 -2
- package/dist/core/spec-contract.d.ts +1 -1
- package/dist/core/store-contracts/contract-harness.d.ts +2 -2
- package/dist/core/store-contracts/contract-kit-version.d.ts +2 -2
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +1 -1
- package/dist/core/task-notification.d.ts +5 -5
- package/dist/core/task-registry-agent.d.ts +12 -12
- package/dist/core/task-registry-monitor.d.ts +1 -1
- package/dist/core/task-registry-shared.d.ts +41 -41
- package/dist/core/task-registry.d.ts +12 -12
- package/dist/core/tool-detach.d.ts +2 -2
- package/dist/core/tool-errors.d.ts +3 -3
- package/dist/core/tool-policy.d.ts +55 -28
- package/dist/core/tool-result-budget.d.ts +1 -1
- package/dist/core/tool-result-store.d.ts +2 -2
- package/dist/core/tools.d.ts +1 -1
- package/dist/core/trace.d.ts +26 -23
- package/dist/core/types.d.ts +123 -70
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +7 -7
- package/dist/core/wiring-manifest.d.ts +5 -5
- package/dist/core/workflow-journal-store.d.ts +14 -14
- package/dist/core/workflow-run-store-contract.d.ts +1 -1
- package/dist/core/workflow-run-store-contract.js +1 -1
- package/dist/core/workflow-run-store.d.ts +4 -4
- package/dist/engine/compaction/compaction.d.ts +3 -3
- package/dist/engine/compaction/utils.d.ts +2 -2
- package/dist/engine/execution-env/kill-tree.d.ts +1 -1
- package/dist/engine/execution-env/node-execution-env.d.ts +8 -8
- package/dist/engine/harness/agent-harness.d.ts +6 -6
- package/dist/engine/harness/messages.d.ts +1 -1
- package/dist/engine/harness/types.d.ts +10 -10
- package/dist/engine/llm/types.d.ts +14 -14
- package/dist/engine/loop/agent-loop.d.ts +3 -3
- package/dist/engine/loop/types.d.ts +4 -4
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/import-validate.d.ts +1 -1
- package/dist/engine/session/log-digest.d.ts +1 -1
- package/dist/engine/session/memory-repo.d.ts +2 -2
- package/dist/engine/session/session.d.ts +4 -4
- package/dist/fixtures/index.d.ts +4 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -2
- package/dist/orchestration/goal.d.ts +1 -1
- package/dist/orchestration/run-spec.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +12 -12
- package/dist/orchestration/workflow-governance.d.ts +4 -4
- package/dist/orchestration/workflow-observe.d.ts +1 -1
- package/dist/orchestration/workflow-script-runner.d.ts +1 -1
- package/dist/orchestration/workflow-script-store.d.ts +9 -9
- package/dist/orchestration/workflow-size-guideline.d.ts +1 -1
- package/dist/orchestration/workflow-types.d.ts +5 -5
- package/dist/orchestration/workflow.d.ts +10 -10
- package/dist/prompt-assembly/artifact-store.d.ts +1 -1
- package/dist/prompt-assembly/artifact.d.ts +1 -1
- package/dist/prompt-assembly/assemble.d.ts +1 -1
- package/dist/prompt-assembly/composer.d.ts +2 -2
- package/dist/prompt-assembly/epoch.d.ts +2 -2
- package/dist/prompt-assembly/event-registry.d.ts +1 -1
- package/dist/prompt-assembly/explain.d.ts +3 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -4
- package/dist/prompt-assembly/types.d.ts +12 -12
- package/dist/prompts/coordinator.d.ts +1 -1
- package/dist/prompts/default.d.ts +8 -8
- package/dist/prompts/simple-sections.d.ts +3 -3
- package/dist/prompts/supervisor.d.ts +2 -2
- package/dist/scenarios/full-body.d.ts +3 -3
- package/dist/scenarios/scenario-registry.d.ts +1 -1
- package/dist/stores/cc/sidecar-transcript.d.ts +3 -3
- package/dist/stores/file/fs-atomic.d.ts +2 -2
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/session-store.d.ts +2 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -4
- package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
- package/dist/tools/fs/encoding.d.ts +4 -4
- package/dist/tools/fs/fs-bash.d.ts +3 -3
- package/dist/tools/fs/fs-pdf.d.ts +1 -1
- package/dist/tools/fs/fs-shared.d.ts +6 -6
- package/dist/tools/fs/index.d.ts +2 -2
- package/dist/tools/fs/notebook.d.ts +1 -1
- package/dist/tools/fs/pdf.d.ts +1 -1
- package/dist/tools/fs/read-deny.d.ts +1 -1
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +2 -2
- package/dist/tools/monitor.d.ts +3 -3
- package/dist/tools/task-list.d.ts +2 -2
- package/dist/tools/web.d.ts +4 -4
- package/dist/tools/worktree.d.ts +5 -5
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +56 -3
package/dist/core/types.d.ts
CHANGED
|
@@ -29,8 +29,18 @@ export interface StaleToolResultOffloadOptions {
|
|
|
29
29
|
* - `advisor` — the strong "teacher" a cheap student escalates to (`runWithTeacher`).
|
|
30
30
|
* - `classifier` — the auto-mode permission classifier (a roster-cheap tier; falls back
|
|
31
31
|
* `summarize → default`, tier default `flash` on tier-expanded catalogs).
|
|
32
|
+
* - `consolidate` — the memory-consolidation distillation driver (design/376). Falls back to
|
|
33
|
+
* `summarize` and then REFUSES LOUDLY — deliberately never to `default`: one consolidation run
|
|
34
|
+
* is a whole-library read (~10⁵ prompt tokens), so silently escalating to the most expensive
|
|
35
|
+
* main-task model is the bad-value-silence family, not a convenience. The divergence from the
|
|
36
|
+
* classifier family's `→ default` tail is calibrated on call volume: a classifier resolves one
|
|
37
|
+
* short classification, this role resolves a full-library batch. An explicit
|
|
38
|
+
* `roles.consolidate = <main model>` is a legal deployment choice; the summarize hop is kept
|
|
39
|
+
* because a deployment that declared a cheap summarize tier has already made the cost choice
|
|
40
|
+
* this role wants (note the summarize DEFAULT rationale — prompt-cache forking — does not
|
|
41
|
+
* apply here: consolidation is an offline independent request with no shared prefix).
|
|
32
42
|
*/
|
|
33
|
-
export type ModelRole = "default" | "summarize" | "subagent" | "team" | "synthesize" | "advisor" | "verifier" | "classifier";
|
|
43
|
+
export type ModelRole = "default" | "summarize" | "subagent" | "team" | "synthesize" | "advisor" | "verifier" | "classifier" | "consolidate";
|
|
34
44
|
/**
|
|
35
45
|
* A role's model: a `ModelRef`, or a config object that pins a `model`, **selects** one by
|
|
36
46
|
* capability/price (`select`, design/11 Layer 2), and/or sets a default `thinking` level.
|
|
@@ -146,7 +156,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
146
156
|
aliases?: string[];
|
|
147
157
|
description: string;
|
|
148
158
|
/**
|
|
149
|
-
* R2 双形轴(
|
|
159
|
+
* R2 双形轴(2026-07-18 裁):the CLASSIC-profile variant of {@link description}. CC 2.1.212
|
|
150
160
|
* keys its tool descriptions on `LT(model_id)` (simple short form vs classic long form); sema's
|
|
151
161
|
* counterpart is {@link TaskSpec.promptProfile} — default "simple" (what CC serves every BYOM
|
|
152
162
|
* model id). When the run resolves to "classic" and this field is present, it REPLACES
|
|
@@ -207,7 +217,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
207
217
|
aliases?: readonly string[];
|
|
208
218
|
contentOrigin?: ToolContentOrigin;
|
|
209
219
|
}>;
|
|
210
|
-
/**
|
|
220
|
+
/** approval display projection (see AgentTool.approvalPreview): pure args→display value
|
|
211
221
|
* for human approval surfaces; clamped + throw-swallowed by the gate; never adjudication input. */
|
|
212
222
|
approvalPreview?: (args: unknown) => unknown;
|
|
213
223
|
/**
|
|
@@ -219,7 +229,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
219
229
|
*/
|
|
220
230
|
agentModels?: readonly string[];
|
|
221
231
|
/**
|
|
222
|
-
*
|
|
232
|
+
* core half — PER-TASK agent-roster rebuild seam, filled ONLY by `createSubagentTool`
|
|
223
233
|
* (deployment-authored tools leave it unset). The delegation tool's roster is a mount-time SNAPSHOT
|
|
224
234
|
* baked into its parameter enum/description (see the `SubagentToolOptions` snapshot note), so per-task
|
|
225
235
|
* additions ({@link TaskSpec.agents}) cannot mutate the mounted instance — `prepareTask` instead calls
|
|
@@ -423,7 +433,7 @@ export interface ToolSpec<TParams extends TSchema = TSchema> {
|
|
|
423
433
|
*/
|
|
424
434
|
modelGate?: string;
|
|
425
435
|
/**
|
|
426
|
-
* Tool contract identity (
|
|
436
|
+
* Tool contract identity (stage S2, prompt-assembly protocol §7): declares the EXECUTION
|
|
427
437
|
* CONTRACT this tool implements, independent of its presentation text. `defineTool` attaches it
|
|
428
438
|
* to the materialized tool via the catalog side-table (identity follows the OBJECT, never the
|
|
429
439
|
* wire name — a caller tool shadowing a built-in name never inherits the core contract). Omitted
|
|
@@ -453,7 +463,7 @@ export type ToolReturn = string | {
|
|
|
453
463
|
/** Hint the agent to stop after this tool batch. */
|
|
454
464
|
terminate?: boolean;
|
|
455
465
|
/**
|
|
456
|
-
* RB-211(
|
|
466
|
+
* RB-211 (root-cause widening): a `ToolSpec.execute` can RETURN a failure
|
|
457
467
|
* receipt instead of throwing (teaching errors that carry structured `details`, e.g. an
|
|
458
468
|
* unrecoverable-but-informative rejection). Before this field existed, `ToolReturn` had NO
|
|
459
469
|
* isError channel at all — `defineTool`'s wrapper builds a fresh `{content,details,terminate}`
|
|
@@ -463,7 +473,7 @@ export type ToolReturn = string | {
|
|
|
463
473
|
* produced `isError:false` on the model-facing `toolResult`, in BOTH the live per-turn path and
|
|
464
474
|
* the durable-resume path — a returned rejection was structurally unable to look like anything
|
|
465
475
|
* other than success. Omitted/false = success (matches `AgentToolResult.isError`'s own
|
|
466
|
-
*
|
|
476
|
+
* convention exactly — this is that SAME field, finally reachable from a `ToolSpec`).
|
|
467
477
|
*/
|
|
468
478
|
isError?: boolean;
|
|
469
479
|
};
|
|
@@ -501,7 +511,7 @@ export interface NestedUsageAccum {
|
|
|
501
511
|
turns: number;
|
|
502
512
|
tasks: number;
|
|
503
513
|
costMicroUsd: number;
|
|
504
|
-
/**
|
|
514
|
+
/** batch-4 F3 (RB-368 reaches the nested face): true once ANY delegated leg reported no cost —
|
|
505
515
|
* the summed `costMicroUsd` is then a priced-subtotal, not a total, and the publish site must go
|
|
506
516
|
* ABSENT instead of impersonating one. REQUIRED so every seeding/snapshot site is tsc-forced to
|
|
507
517
|
* carry knownness alongside the number it qualifies. */
|
|
@@ -525,13 +535,13 @@ export interface ToolExecuteContext {
|
|
|
525
535
|
/** Publish provenance companion of {@link centerArtifactDigest}. */
|
|
526
536
|
centerSourceRevision?: string;
|
|
527
537
|
/**
|
|
528
|
-
* design/147 S2a
|
|
538
|
+
* design/147 S2a — the SPAWNING run's sessionId (trusted internals chain, same seat as
|
|
529
539
|
* {@link parentTaskId}). Sibling resolution/delivery needs the parent's SESSION axis too: a
|
|
530
540
|
* session-scoped sibling registers with owner = the parent's sessionId, which the parent's taskId
|
|
531
541
|
* alone cannot satisfy when the two differ.
|
|
532
542
|
*/
|
|
533
543
|
parentSessionId?: string;
|
|
534
|
-
/**
|
|
544
|
+
/** A-3 — the ROOT host session of the delegation tree (see RunInternals.rootSessionId:
|
|
535
545
|
* fixed point `ctx.rootSessionId ?? ctx.sessionId` at every spawn). Absent for a top-level run
|
|
536
546
|
* (its OWN sessionId is the root). */
|
|
537
547
|
rootSessionId?: string;
|
|
@@ -561,7 +571,7 @@ export interface ToolExecuteContext {
|
|
|
561
571
|
ticket: import("./task-registry.js").ParkedClaimTicket;
|
|
562
572
|
outcome: import("./checkpoint-store.js").ResumeOutcome;
|
|
563
573
|
/**
|
|
564
|
-
*
|
|
574
|
+
* the CROSS-PROCESS re-supply seat for the checkpoint's opaque parent constraints.
|
|
565
575
|
* A checkpoint minted under inherited parent-policy constraints records only
|
|
566
576
|
* `requiresParentConstraint` (live ToolPolicy/onAsk closures cannot persist); the same-process
|
|
567
577
|
* drive is re-supplied automatically from the Runner's in-memory `parentConstraintRegistry`,
|
|
@@ -572,7 +582,7 @@ export interface ToolExecuteContext {
|
|
|
572
582
|
* config-driven) passes it here; the drive threads it into `resumeStream(..., internals)`,
|
|
573
583
|
* where the recorded-count shape check still applies verbatim (a partial/mismatched re-supply
|
|
574
584
|
* is rejected — this seat never widens, it only reopens the documented re-supply channel to
|
|
575
|
-
* the parked-decide lane). Absent ⇒ exactly the
|
|
585
|
+
* the parked-decide lane). Absent ⇒ exactly the previous behavior.
|
|
576
586
|
*
|
|
577
587
|
* One entry kind is NOT a policy the deployment authored: a hook-wired parent contributes a
|
|
578
588
|
* PreToolUse SCREENING entry (issue #33), whose policy the engine mints. Rebuild it with the
|
|
@@ -622,21 +632,21 @@ export interface ToolExecuteContext {
|
|
|
622
632
|
*/
|
|
623
633
|
roster?: import("../agents/roster-store.js").RosterStore;
|
|
624
634
|
/**
|
|
625
|
-
*
|
|
635
|
+
* fork source-store fix — the HOST Runner's session-fork face, Runner-filled read-only.
|
|
626
636
|
* The fork arm's source session lives in the store of the Runner RUNNING this task; `opts.runner`
|
|
627
637
|
* is the CHILD-EXECUTION runner, which a deployment may deliberately split (server's subRunner) —
|
|
628
638
|
* forking through it queried an empty store and every fork missed ("source session not found").
|
|
629
639
|
* The fork arm prefers this face and falls back to `opts.runner.sessions.fork` (single-runner
|
|
630
640
|
* deployments unchanged).
|
|
631
641
|
*
|
|
632
|
-
* ZERO-ARG by design
|
|
642
|
+
* ZERO-ARG by design: the source session id AND principal are bound in the Runner's
|
|
633
643
|
* closure at injection — a mounted third-party tool holding this context can only branch THIS task's
|
|
634
644
|
* own session under THIS task's principal, never copy a foreign session by supplying its id. The
|
|
635
645
|
* returned handle's `release` is scoped to the just-created branch through the same closure, so
|
|
636
646
|
* failure cleanup releases through the store that OWNS the branch (`opts.runner.sessions.release`
|
|
637
647
|
* may be a different store entirely).
|
|
638
648
|
*
|
|
639
|
-
* Store contract
|
|
649
|
+
* Store contract: the branch is created in the HOST store, but the fork child still
|
|
640
650
|
* executes on `opts.runner` with `requireExistingSession: true` — if the two runners do not share
|
|
641
651
|
* session backing, the child run fails LOUD ("refusing a silent fresh run") instead of silently
|
|
642
652
|
* running an empty session under the forked id. Split-runner deployments must share session backing
|
|
@@ -814,7 +824,7 @@ export interface ToolExecuteContext {
|
|
|
814
824
|
* user. Runner-filled (NOT a tool argument). Undefined when the task carries no clientContext.
|
|
815
825
|
*/
|
|
816
826
|
clientContext?: TaskSpec["clientContext"];
|
|
817
|
-
/**
|
|
827
|
+
/** — the parent's tool-face controls ({@link TaskSpec.excludeTools} /
|
|
818
828
|
* {@link TaskSpec.deferTools}), inherited down the delegation tree like `principal` (Runner-filled,
|
|
819
829
|
* read-only): a scenario-wide roster must not be escapable by delegating to a child that remounts
|
|
820
830
|
* the excluded tool. Children merge these with their own spec values (union — tighten-only). */
|
|
@@ -838,7 +848,7 @@ export interface ToolExecuteContext {
|
|
|
838
848
|
* tool-face controls (Runner-filled): a classic-profile parent's children speak classic too
|
|
839
849
|
* unless the child spec says otherwise (child spec wins — profile is presentation, not policy). */
|
|
840
850
|
promptProfile?: "simple" | "classic";
|
|
841
|
-
/**
|
|
851
|
+
/** the parent's declared extra file-tool roots ({@link TaskSpec.additionalDirectories}),
|
|
842
852
|
* inherited down the delegation tree (Runner-filled, copy-at-spawn): a deployment that widened the
|
|
843
853
|
* fs fence (e.g. the scratchpad host lane) widened it for the TASK, and a delegated child doing the
|
|
844
854
|
* same work hit `path_not_in_root` on the very directory the parent could write. Same trust tier as
|
|
@@ -848,7 +858,7 @@ export interface ToolExecuteContext {
|
|
|
848
858
|
* the same rule (Runner-filled, copy-at-spawn): a child doing the parent's work needs the same
|
|
849
859
|
* read whitelist, and MUST NOT have it silently widened into a write grant in transit. */
|
|
850
860
|
additionalReadDirectories?: readonly string[];
|
|
851
|
-
/**
|
|
861
|
+
/** the parent's environment facts ({@link TaskSpec.envFacts}), inherited down the
|
|
852
862
|
* delegation tree (Runner-filled, copy-at-spawn): the sandbox binding (profile/egress/scratchpad)
|
|
853
863
|
* is a DEPLOYMENT property, not a per-task one — a child in the same sandbox needs the same facts
|
|
854
864
|
* (its env block renders the scratchpad section; its root fence admits the scratchpad dir). */
|
|
@@ -865,7 +875,7 @@ export interface ToolExecuteContext {
|
|
|
865
875
|
*/
|
|
866
876
|
memoryPersistenceCapable?: boolean;
|
|
867
877
|
/**
|
|
868
|
-
*
|
|
878
|
+
* the parent task's per-model auth hook ({@link TaskSpec.getApiKeyAndHeaders}), inherited
|
|
869
879
|
* verbatim down the delegation tree like `principal`/`clientContext` (Runner-filled, read-only, NEVER
|
|
870
880
|
* a model/tool argument). Without this seat a per-task agent pinned to a cross-provider model (its own
|
|
871
881
|
* apiKeyEnv) spawned a child whose run had NO auth hook — the brain silently fell back to the global
|
|
@@ -1686,15 +1696,15 @@ export interface TaskSpec {
|
|
|
1686
1696
|
*/
|
|
1687
1697
|
requireExistingSession?: boolean;
|
|
1688
1698
|
/**
|
|
1689
|
-
*
|
|
1699
|
+
* Per-request semantics — this SUBMISSION is one-shot:
|
|
1690
1700
|
* no later turn exists in which an async background notification could land (the archetypal case is a
|
|
1691
1701
|
* headless `sema -p` invocation, whose process exits once this turn ends). Per-request rather than
|
|
1692
1702
|
* per-connection/per-process on purpose: "does this particular submission expect to be steered/continued"
|
|
1693
1703
|
* is a property of the submission, not of the channel it arrived on — a persistent connection can still
|
|
1694
1704
|
* mix interactive and one-shot submissions, which a connection-level flag could not express.
|
|
1695
1705
|
*
|
|
1696
|
-
* Currently consumed by the `RunWorkflow` tool's guidance text only (RB-215 candidate
|
|
1697
|
-
*
|
|
1706
|
+
* Currently consumed by the `RunWorkflow` tool's guidance text only (RB-215 candidate ①):
|
|
1707
|
+
* a workflow started from a one-shot submission is told to actively block-wait via
|
|
1698
1708
|
* `TaskOutput({ block: true })` before ending its turn, instead of the default "end your turn, you will
|
|
1699
1709
|
* be notified" guidance — the latter is actively wrong here (BGB drilldown case 2, `../sema-test/bench-bg/
|
|
1700
1710
|
* intel/drilldown-C101-B401-20260727.md`: a model that followed that exact guidance lost background
|
|
@@ -1900,10 +1910,10 @@ export interface TaskSpec {
|
|
|
1900
1910
|
*/
|
|
1901
1911
|
tools?: ToolSpec[];
|
|
1902
1912
|
/**
|
|
1903
|
-
*
|
|
1913
|
+
* per-scenario tool ROSTER (true unmount, NOT a permission gate): wire names listed here
|
|
1904
1914
|
* are removed from the mounted tool set AFTER assembly — their schemas never reach `tools[]`
|
|
1905
1915
|
* (unlike a policy deny, which gates calls but still ships the schema bytes every request —
|
|
1906
|
-
* measured at zero token savings
|
|
1916
|
+
* measured at zero token savings). Exact wire-name match (aliases resolve to their
|
|
1907
1917
|
* canonical wire name at mount, so list the canonical name). Unknown names are ignored (a
|
|
1908
1918
|
* center-distributed roster may cover tools this deployment doesn't mount). The injected
|
|
1909
1919
|
* ToolSearch cannot be excluded (it mounts after this filter, only when deferred tools exist).
|
|
@@ -1912,7 +1922,7 @@ export interface TaskSpec {
|
|
|
1912
1922
|
*/
|
|
1913
1923
|
excludeTools?: string[];
|
|
1914
1924
|
/**
|
|
1915
|
-
*
|
|
1925
|
+
* Per-request DEFERRED disclosure for ALREADY-MOUNTED tools (built-ins
|
|
1916
1926
|
* included — `ToolSpec.defer` only covers caller specs): wire names listed here ship as
|
|
1917
1927
|
* lightweight placeholders (name + one-line hint, schema bytes OFF the cache prefix) and are
|
|
1918
1928
|
* activated on demand via the injected ToolSearch (design/36 materialization — prefix untouched).
|
|
@@ -1996,7 +2006,7 @@ export interface TaskSpec {
|
|
|
1996
2006
|
*/
|
|
1997
2007
|
deferSelfResolve?: boolean;
|
|
1998
2008
|
/**
|
|
1999
|
-
* R2 双形轴(
|
|
2009
|
+
* R2 双形轴(2026-07-18 裁): which prompt-profile face this task speaks — "simple" (default;
|
|
2000
2010
|
* CC 2.1.212's short-form tool descriptions + lean system sections, what CC serves every non-claude
|
|
2001
2011
|
* model id) or "classic" (the long-form face, ≈ CC 4.x-era wording — switchable per task/model,
|
|
2002
2012
|
* e.g. serving classic to a model that scores better on it; center distribution rides this field).
|
|
@@ -2005,13 +2015,13 @@ export interface TaskSpec {
|
|
|
2005
2015
|
*/
|
|
2006
2016
|
promptProfile?: "simple" | "classic";
|
|
2007
2017
|
/**
|
|
2008
|
-
*
|
|
2018
|
+
* core half — PER-TASK custom sub-agents. Same shape as the boot injection point
|
|
2009
2019
|
* ({@link RunnerDeps.agents} / `SubagentToolOptions.agents`): full {@link AgentDefinition} objects
|
|
2010
2020
|
* (the shell resolves agent files / frontmatter into this shape; `model` is the already-resolved
|
|
2011
2021
|
* real model ref passed through — core carries no model-word vocabulary). When set (non-empty),
|
|
2012
2022
|
* `prepareTask` REBUILDS the mounted delegation tool (via {@link ToolSpec.withAgents}) so its roster
|
|
2013
2023
|
* is the UNION of the boot roster and these definitions — a same-name per-task definition WINS over
|
|
2014
|
-
* the boot one. Validation contract (
|
|
2024
|
+
* the boot one. Validation contract (revision of the posture, dual-leg verified against
|
|
2015
2025
|
* upstream): an `allowTools` entry naming a tool that does not exist is ITEM-FILTERED at spawn (the
|
|
2016
2026
|
* agent stays listed and delegable; the only host disclosure is a prepare-time HEURISTIC advisory
|
|
2017
2027
|
* via `RunnerDeps.onError` phase `"config"` for entries unknown to the parent's assembled roster —
|
|
@@ -2041,7 +2051,7 @@ export interface TaskSpec {
|
|
|
2041
2051
|
/** How `ask` decisions resolve for this task (headless auto-deny by default). Overrides `RunnerDeps.onAsk`. */
|
|
2042
2052
|
onAsk?: import("./tool-policy.js").OnAsk;
|
|
2043
2053
|
/** Content-ask seam (design/64 §5): routes an AskUserQuestion tool call to a real human/UI. When set, the
|
|
2044
|
-
* AskUserQuestion tool is mounted (one of the delivery faces in the
|
|
2054
|
+
* AskUserQuestion tool is mounted (one of the delivery faces in the criterion — see
|
|
2045
2055
|
* {@link interactiveTools}). Overrides `RunnerDeps.onQuestion`. Distinct from `onAsk` (permission). */
|
|
2046
2056
|
onQuestion?: import("./ask-question.js").OnQuestion;
|
|
2047
2057
|
/** LSP code-intelligence seam (design/64 §13.1): when set, the `lsp` tool is mounted and routed to this
|
|
@@ -2320,7 +2330,7 @@ export interface TaskSpec {
|
|
|
2320
2330
|
*/
|
|
2321
2331
|
enablePlanMode?: boolean;
|
|
2322
2332
|
/**
|
|
2323
|
-
*
|
|
2333
|
+
* Interactive-tool mounting override (CC 2.1.207/209 parity: AskUserQuestion / ExitPlanMode /
|
|
2324
2334
|
* EnterPlanMode share one `isEnabled` gate — in non-interactive mode without an SDK permission-prompt
|
|
2325
2335
|
* tool the tool is NOT offered at all, so the model never asks into the void). sema's automatic
|
|
2326
2336
|
* criterion (this knob unset): a human-facing tool mounts only when the deployment has SOME face that
|
|
@@ -2427,7 +2437,7 @@ export interface TaskSpec {
|
|
|
2427
2437
|
* tasks trampling each other's temp files and project-dir pollution. Unset ⇒ no section rendered. */
|
|
2428
2438
|
scratchpadDir?: string;
|
|
2429
2439
|
/**
|
|
2430
|
-
*
|
|
2440
|
+
* B-half — PER-LANE resume-continuity facts, rendered ONLY on a durable-resume leg so
|
|
2431
2441
|
* the model reasons honestly about what survived the suspension. DEPLOYMENT-supplied per its own lane
|
|
2432
2442
|
* capability (a VM snapshot lane preserves processes; an ssh park-only workspace usually keeps /tmp;
|
|
2433
2443
|
* a rebuilt container loses both) — core hardcodes NO lane table and renders NOTHING when a field is
|
|
@@ -2457,7 +2467,7 @@ export interface TaskSpec {
|
|
|
2457
2467
|
*/
|
|
2458
2468
|
limits?: TaskLimits;
|
|
2459
2469
|
/**
|
|
2460
|
-
* Config-catalog override declarations (
|
|
2470
|
+
* Config-catalog override declarations (ruled 2026-07-19, anti-chaos contract): a HOST that
|
|
2461
2471
|
* overrides a recommended knob at its own layer (env cap, adapter flag, harness default) declares
|
|
2462
2472
|
* it here — key + value + REASON — so the override rides the `config.assembled` trace with
|
|
2463
2473
|
* provenance `host-declared` instead of being invisible to forensics. Advisory observability
|
|
@@ -2491,7 +2501,7 @@ export interface TaskSpec {
|
|
|
2491
2501
|
* released (throwaway semantics restored — a retained session never dangles to the store's 7-day TTL).
|
|
2492
2502
|
* `run_in_background` children are OUT OF SCOPE (no handle, no retain — r1-M3; the bg lane's resume needs
|
|
2493
2503
|
* durable support and is a separate item). Resume is reachable only while the parent run lives (the
|
|
2494
|
-
* ledger is run-scoped, not a durable registry
|
|
2504
|
+
* ledger is run-scoped, not a durable registry).
|
|
2495
2505
|
*/
|
|
2496
2506
|
retainSubagentSessions?: boolean | {
|
|
2497
2507
|
ttlMs?: number;
|
|
@@ -3283,7 +3293,7 @@ export interface TaskResult {
|
|
|
3283
3293
|
* accumulator rather than an alias. Optional BY DESIGN, like every usage field on this stats
|
|
3284
3294
|
* face: undefined means the gateway reported no usage (and pre-3.0.0 persisted rows never had
|
|
3285
3295
|
* it) — the event-face `turn_end.usage.totalInputTokens` is required because there the whole
|
|
3286
|
-
* `usage` object is already conditional (
|
|
3296
|
+
* `usage` object is already conditional (intentional asymmetry, not a gap). */
|
|
3287
3297
|
totalInputTokens?: number;
|
|
3288
3298
|
/** Completion (output) tokens summed over the task's turns. */
|
|
3289
3299
|
outputTokens?: number;
|
|
@@ -3292,7 +3302,7 @@ export interface TaskResult {
|
|
|
3292
3302
|
/** Authoritative (and only) cost figure: **integer micro-USD** (1e-6 USD), computed in core from
|
|
3293
3303
|
* injected pricing — integer to avoid float-accumulation error in billing. (design/157 B19: the
|
|
3294
3304
|
* float-USD twin was removed; divide by 1e6 at the display edge if you need USD.)
|
|
3295
|
-
* **ABSENT when any spend was unpriced** (RB-368
|
|
3305
|
+
* **ABSENT when any spend was unpriced** (RB-368): the serving model had neither a
|
|
3296
3306
|
* `RunnerDeps.pricing` entry nor a `Model.cost` declaration — an unpriced run reports NO cost
|
|
3297
3307
|
* rather than a fabricated 0, so "no price table" stays distinguishable from "declared free"
|
|
3298
3308
|
* (an explicit all-zero `Model.cost` still reports 0). `costBreakdown` is omitted with it. */
|
|
@@ -3431,7 +3441,7 @@ export interface TaskResult {
|
|
|
3431
3441
|
* LLM total: `llmRootMicroUsd + compactionMicroUsd === costMicroUsd` and the fully-reconciled
|
|
3432
3442
|
* spend is `costMicroUsd + nested.costMicroUsd` — `costMicroUsd` deliberately EXCLUDES nested
|
|
3433
3443
|
* subagent cost (it lands in `nested`, see assemble-result.ts), so `nestedSubagentMicroUsd` sits
|
|
3434
|
-
* OUTSIDE the costMicroUsd identity, not inside it (
|
|
3444
|
+
* OUTSIDE the costMicroUsd identity, not inside it (measured correction: the previous wording
|
|
3435
3445
|
* `llmRoot + nested + compaction === costMicroUsd` only held when nested was 0).
|
|
3436
3446
|
* (`memoryConsolidationMicroUsd` is a separate, budget-excluded line, permanently 0 since the
|
|
3437
3447
|
* runner-integrated consolidation pass was retired — design/157 B19 — and NOT part of any identity).
|
|
@@ -3441,7 +3451,7 @@ export interface TaskResult {
|
|
|
3441
3451
|
costBreakdown?: {
|
|
3442
3452
|
/** Root-agent LLM cost (micro-USD) = `costMicroUsd − compactionMicroUsd` (the sub-category folded into
|
|
3443
3453
|
* it). NOT minus nested — nested cost is never folded into `costMicroUsd` (it lands in `nested`).
|
|
3444
|
-
* ⚠️ APPROXIMATE on a multi-slice `resource_limit` RESUME (design/80 D-E-core
|
|
3454
|
+
* ⚠️ APPROXIMATE on a multi-slice `resource_limit` RESUME (design/80 D-E-core): the
|
|
3445
3455
|
* durable resource ledger persists only the AGGREGATE prior spend, not its compaction subtotal, so
|
|
3446
3456
|
* prior slices' compaction folds in HERE rather than into `compactionMicroUsd`. The TOTAL (`costMicroUsd`)
|
|
3447
3457
|
* stays exact; only this llmRoot-vs-compaction split is per-leg-approximate across resource slices. */
|
|
@@ -3480,7 +3490,7 @@ export interface TaskEventIdentity {
|
|
|
3480
3490
|
eventId?: string;
|
|
3481
3491
|
parentToolCallId?: string;
|
|
3482
3492
|
/**
|
|
3483
|
-
* design/122 S2 (
|
|
3493
|
+
* design/122 S2 (the `WorkflowRun.sourceTaskId` family, NOT a second `taskId` — that
|
|
3484
3494
|
* field already exists on `task_progress` and a duplicate would bite consumers) — the ORIGINATING task's
|
|
3485
3495
|
* canonical id (`spec.taskId ?? sessionId`), stamped ONLY on the content events of a task running AS A
|
|
3486
3496
|
* SUB-AGENT (same condition as {@link parentToolCallId}). A consumer of the C1 forward channel
|
|
@@ -3490,7 +3500,7 @@ export interface TaskEventIdentity {
|
|
|
3490
3500
|
*/
|
|
3491
3501
|
sourceTaskId?: string;
|
|
3492
3502
|
/**
|
|
3493
|
-
* design/151 S2 (MED-10 live-tail
|
|
3503
|
+
* design/151 S2 (MED-10 live-tail) — the BACKGROUND agent's `a*` registry
|
|
3494
3504
|
* handle, stamped on every event a background child's lane forwards up the host `onForwardEvent`
|
|
3495
3505
|
* channel (content deltas, tool events, progress). THE live-tail routing key: a serving layer
|
|
3496
3506
|
* pipes "what is agent aXX doing right now" straight off the host forward stream — no uuid→a*
|
|
@@ -3572,7 +3582,7 @@ export interface ToolActivity {
|
|
|
3572
3582
|
phase: "start" | "end";
|
|
3573
3583
|
toolCallId: string;
|
|
3574
3584
|
toolName: string;
|
|
3575
|
-
/**
|
|
3585
|
+
/** wall-clock stamp (epoch ms, `Date.now` read at the emitting Runner where the frame is
|
|
3576
3586
|
* minted). Carried on BOTH beats: the `start` beat stamps the moment the tool call began, the `end`
|
|
3577
3587
|
* beat the moment it settled — so a consumer derives per-call duration (`end.at − start.at`) and
|
|
3578
3588
|
* inter-call idle (an `end.at` → the NEXT `start.at`). Additive/optional: frames recorded by older
|
|
@@ -3582,7 +3592,7 @@ export interface ToolActivity {
|
|
|
3582
3592
|
* single most salient input ABBREVIATED (command→name, path→basename, url→origin+path) + SECRET-SCRUBBED +
|
|
3583
3593
|
* truncated (~80 code points). Set on `phase: "start"`. NOT the full args object, and NOT `redactHostLeaks`
|
|
3584
3594
|
* (that over-redacts the path the monitor needs); the abbreviation + scrub is the leak boundary since the value
|
|
3585
|
-
* is persisted + SSE-forwarded
|
|
3595
|
+
* is persisted + SSE-forwarded. See `primaryActivityArg`. */
|
|
3586
3596
|
arg?: string;
|
|
3587
3597
|
/** Set on `phase: "end"` — whether the tool call errored. */
|
|
3588
3598
|
isError?: boolean;
|
|
@@ -3799,7 +3809,7 @@ export type TaskEvent = ({
|
|
|
3799
3809
|
*/
|
|
3800
3810
|
truncated?: boolean;
|
|
3801
3811
|
/**
|
|
3802
|
-
* RB-210
|
|
3812
|
+
* RB-210 — present iff {@link truncated}: the TRUE original size (characters) of
|
|
3803
3813
|
* the content this event's {@link output} was degraded from — for a string result, the string's own
|
|
3804
3814
|
* length; for a non-string result (a blocks array), the SUM of each block's own true size (a text
|
|
3805
3815
|
* block's `.text.length`; an image/document block's `.data.length`, i.e. its base64 payload) — never
|
|
@@ -3819,7 +3829,7 @@ export type TaskEvent = ({
|
|
|
3819
3829
|
totalChars?: number;
|
|
3820
3830
|
} & TaskEventIdentity) | ({
|
|
3821
3831
|
/**
|
|
3822
|
-
* RB-126
|
|
3832
|
+
* RB-126 — context occupancy at a compaction boundary, emitted on EVERY
|
|
3823
3833
|
* boundary (not only when a compaction fires). The three numbers are the engine's own trigger
|
|
3824
3834
|
* inputs, verbatim: `usedTokens > compactAtTokens` IS the predicate `shouldCompact` evaluates, so a
|
|
3825
3835
|
* consumer's "context is N% full" indicator and the moment compaction actually fires can never
|
|
@@ -3880,7 +3890,7 @@ export type TaskEvent = ({
|
|
|
3880
3890
|
} & TaskEventIdentity) | ({
|
|
3881
3891
|
/** design/99 MF-18: a compaction boundary (or, since design/119 #1, mid-turn when the prompt-too-long recovery force-compacts between a failed request and its retry). `trigger` = what caused it: `"auto"` (the context-threshold
|
|
3882
3892
|
* auto-compaction), `"manual"` (the `TaskStream.compact` / `/compact` path), or `"forced"` (RB-398-b
|
|
3883
|
-
*
|
|
3893
|
+
* the prompt-too-long recovery and trim-pressure lanes — compaction was not optional; the
|
|
3884
3894
|
* hook layer's `PreCompactContext.trigger` always had this third state and the wire now carries the
|
|
3885
3895
|
* SAME value the hooks saw instead of flattening it to `"auto"`. Additive value space — a consumer
|
|
3886
3896
|
* switching on auto/manual keeps its exact old behavior). `tokensBefore` = the
|
|
@@ -3940,7 +3950,7 @@ export type TaskEvent = ({
|
|
|
3940
3950
|
phaseDurations?: import("./auto-compaction.js").CompactionPhaseDurations;
|
|
3941
3951
|
} & TaskEventIdentity) | ({
|
|
3942
3952
|
/**
|
|
3943
|
-
* RB-398-b
|
|
3953
|
+
* RB-398-b④: a compaction pass concluded WITHOUT landing — the non-landing outcomes
|
|
3944
3954
|
* used to exist only as `compaction.*` trace frames, so a stream-only consumer watched a
|
|
3945
3955
|
* context quietly stop being managed (breaker opens, rapid-refill disable, hook blocks —
|
|
3946
3956
|
* all invisible). One lightweight additive event, emitted at the same sites as the trace
|
|
@@ -4142,12 +4152,12 @@ export type TaskEvent = ({
|
|
|
4142
4152
|
* top-level run) has no generation concept, and absence must never be read as "cycle 1".
|
|
4143
4153
|
*/
|
|
4144
4154
|
seq?: number;
|
|
4145
|
-
/**
|
|
4155
|
+
/** Workflow-lane self-identification (field-proven: the SSE-forwarded tick of a
|
|
4146
4156
|
* WORKFLOW child previously carried a bare uuid with no workflow identity — indistinguishable
|
|
4147
4157
|
* from an unknown nested subagent; the fleet lane had `wa*`+workflowRunId but this lane had
|
|
4148
4158
|
* nothing). Present iff the tick bubbled out of a workflow-spawned agent. Additive. */
|
|
4149
4159
|
workflowRunId?: string;
|
|
4150
|
-
/**
|
|
4160
|
+
/** the workflow agent's display label (opts.label / auto `agent-N`), riding with
|
|
4151
4161
|
* {@link workflowRunId} for the same self-identification. Additive. */
|
|
4152
4162
|
workflowAgentLabel?: string;
|
|
4153
4163
|
/** design/99 (nested-subagent live tree): the spawning run's taskId — present on a DEEPER-than-1 subagent tick
|
|
@@ -4172,7 +4182,7 @@ export type TaskEvent = ({
|
|
|
4172
4182
|
toolUses: number;
|
|
4173
4183
|
durationMs: number;
|
|
4174
4184
|
};
|
|
4175
|
-
/** Per-turn ticks are `"running"`.
|
|
4185
|
+
/** Per-turn ticks are `"running"`. ONE final tick fires at the sub-run's settle with the
|
|
4176
4186
|
* terminal face (`"completed"` | `"failed"` — timeout/blocked fold to failed; a suspended durable
|
|
4177
4187
|
* pause emits no terminal tick), so a uuid-lane consumer sees the row finish instead of a bare
|
|
4178
4188
|
* removal after the last running beat. Additive value space — a consumer switching on "running"
|
|
@@ -4422,11 +4432,11 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
|
|
|
4422
4432
|
* design/98 §E.2 / §2.5 (S8b) — the deployment-trusted governance that EVERY sub-agent an LLM-authored
|
|
4423
4433
|
* workflow script spawns INHERITS (tighten-only). The child spec is BUILT from this baseline + a strict
|
|
4424
4434
|
* WHITELIST of safe work-fields the script may set — `{ ...base, ...pick(scriptSpec, WHITELIST_KEYS) }` then
|
|
4425
|
-
* `tightenTaskSpec(base, child)` (
|
|
4435
|
+
* `tightenTaskSpec(base, child)` (default-deny / complete-by-construction, NOT a blacklist
|
|
4426
4436
|
* strip — a missed control-plane field would otherwise leak). It is captured from `RunnerDeps` (trusted,
|
|
4427
4437
|
* never LLM-influenced), NEVER from the LLM-influenced initiating task spec.
|
|
4428
4438
|
*
|
|
4429
|
-
* Why an EXPLICIT field (
|
|
4439
|
+
* Why an EXPLICIT field (arbitration): `RunnerDeps` has no `tools`/`mcp`/`skills`/`principal`
|
|
4430
4440
|
* (those are TaskSpec-only), so the capability a workflow child gets cannot be auto-derived from deps —
|
|
4431
4441
|
* the deployment must DECLARE it here. Unset ⇒ self-orchestration is FAIL-CLOSED (the `run_workflow` tool is
|
|
4432
4442
|
* not mounted, same hard deploy gate as a missing sandbox): a script-spawned agent must never run without a
|
|
@@ -4467,7 +4477,7 @@ export interface WorkflowGovernanceBaseline {
|
|
|
4467
4477
|
*/
|
|
4468
4478
|
worktreeBase?: Partial<TaskSpec>;
|
|
4469
4479
|
/**
|
|
4470
|
-
* The allowed model NAMES an LLM-authored script may pick (design/98 §2.5
|
|
4480
|
+
* The allowed model NAMES an LLM-authored script may pick (design/98 §2.5 新洞2). A script gives a
|
|
4471
4481
|
* `modelName` string (never a `Model` object — that carries `baseUrl`/`headers` = exfil); the engine
|
|
4472
4482
|
* resolves it against this list to a deploy-configured `Model` (the script never sees the object).
|
|
4473
4483
|
* **FAIL-CLOSED**: `undefined`/empty ⇒ the script CANNOT pick a model (its `modelName` is rejected → the
|
|
@@ -4534,10 +4544,10 @@ export interface RuntimeCaps {
|
|
|
4534
4544
|
export interface BackgroundChildEvent {
|
|
4535
4545
|
kind: "spawn" | "tick" | "terminal";
|
|
4536
4546
|
/** Row key, stable across all three kinds. The prefix is the DOMAIN DISCRIMINATOR (load-bearing,
|
|
4537
|
-
* not opaque — design/149
|
|
4547
|
+
* not opaque — design/149): `a*` = registry handle (background subagent —
|
|
4538
4548
|
* TaskOutput/TaskStop addressable, fleet-footer display lane); `wa*` = synthetic workflow-agent
|
|
4539
4549
|
* row (NOT a registry row — per-agent read face is the workflow's `TaskOutput(w*)` agent_runs
|
|
4540
|
-
* projection + journal API). Display contract (
|
|
4550
|
+
* projection + journal API). Display contract (CC anchor): CC's footer renders ONLY the
|
|
4541
4551
|
* workflow AGGREGATE row — `wa*` rows are read-face/observability rows and SHOULD NOT be
|
|
4542
4552
|
* rendered in the footer fleet tree; shells filter on the prefix. */
|
|
4543
4553
|
taskId: string;
|
|
@@ -4549,33 +4559,33 @@ export interface BackgroundChildEvent {
|
|
|
4549
4559
|
scope?: string;
|
|
4550
4560
|
/** spawn: the child's short description (bounded, display-safe). */
|
|
4551
4561
|
description?: string;
|
|
4552
|
-
/** spawn + tick
|
|
4562
|
+
/** spawn + tick: the RESOLVED subagent type ("general-purpose" / "Explore" /
|
|
4553
4563
|
* a roster name / "fork") — the fleet row's TYPE column. Never the description. On ticks it is
|
|
4554
4564
|
* the ROW's type (this spawn), not the nested frame's origin — `progressTaskId` keys that. Rides
|
|
4555
4565
|
* every tick so a consumer that only forwards ticks (server K-7) still gets the type without
|
|
4556
4566
|
* waiting for spawn-frame forwarding; `name` stays the design/99 DISPLAY label (description-backed)
|
|
4557
4567
|
* and was never a type field. */
|
|
4558
4568
|
agentType?: string;
|
|
4559
|
-
/** spawn
|
|
4569
|
+
/** spawn: the HOST task's DECLARED task id (parent attribution). Omitted when the host
|
|
4560
4570
|
* run declared no task id (the `spec.taskId ?? sessionId` fallback would launder a session id into
|
|
4561
4571
|
* a task-id field — the orphan-pointer shape); {@link parentSessionId} is the always-on linkage. */
|
|
4562
4572
|
parentTaskId?: string;
|
|
4563
|
-
/** spawn
|
|
4573
|
+
/** spawn: the HOST run's session id (uuid domain) — the always-on parent
|
|
4564
4574
|
* linkage, present whether or not a task id was declared. */
|
|
4565
4575
|
parentSessionId?: string;
|
|
4566
|
-
/** spawn
|
|
4576
|
+
/** spawn: the ROOT host session of the delegation tree (uuid domain). For a depth-1
|
|
4567
4577
|
* child it equals {@link parentSessionId}; for a nested grandchild it is the TOP session while
|
|
4568
4578
|
* parentSessionId is the intermediate spawner — a recovery/enumeration consumer groups the whole
|
|
4569
4579
|
* tree under the root without walking intermediate (possibly dead) sessions. */
|
|
4570
4580
|
rootSessionId?: string;
|
|
4571
|
-
/** spawn
|
|
4581
|
+
/** spawn: epoch ms the child run was launched — the fleet row's time anchor
|
|
4572
4582
|
* (elapsed rendering without waiting for the first tick). */
|
|
4573
4583
|
startedAt?: number;
|
|
4574
|
-
/** All kinds, `wa*` rows only (design/149
|
|
4584
|
+
/** All kinds, `wa*` rows only (design/149 face 2): the owning workflow run's
|
|
4575
4585
|
* `w*` id. `parentTaskId` stays task-domain (the HOST task) so parent resolvers that only
|
|
4576
4586
|
* forward resolved task rows keep working; workflow grouping/nesting is THIS annotation's job. */
|
|
4577
4587
|
workflowRunId?: string;
|
|
4578
|
-
/** All kinds
|
|
4588
|
+
/** All kinds: the delegating Agent tool call's OWN `toolCallId` —
|
|
4579
4589
|
* the same identity {@link TaskEvent}'s `parentToolCallId` already carries on every forwarded child
|
|
4580
4590
|
* content event (via `RunInternals.parentToolCallId`), extended to this SEPARATE observer/fleet
|
|
4581
4591
|
* event family so a consumer does not have to reassemble parent attribution from spawn-frame
|
|
@@ -4596,7 +4606,7 @@ export interface BackgroundChildEvent {
|
|
|
4596
4606
|
*/
|
|
4597
4607
|
currentAction?: string;
|
|
4598
4608
|
/**
|
|
4599
|
-
* tick
|
|
4609
|
+
* tick (structured Progress-section source): the SAME `{tool, target}` pair
|
|
4600
4610
|
* {@link currentAction} concatenates into prose, exposed separately so a consumer can look `toolName`
|
|
4601
4611
|
* up in its own tool registry (CC `renderToolActivity` parity) instead of parsing the human line.
|
|
4602
4612
|
* `target` is UNTRUSTED free text (a file path / command / pattern the child chose) — same trust
|
|
@@ -4655,7 +4665,7 @@ export interface BackgroundChildEvent {
|
|
|
4655
4665
|
* knowable (the registry handle / retain ledger's `cycleSeq`, the durable row's `seq` on a tier-3
|
|
4656
4666
|
* revival / parked resume), absent when no carrier exists (forging a period would lie). */
|
|
4657
4667
|
seq?: number;
|
|
4658
|
-
/** terminal
|
|
4668
|
+
/** terminal: the cross-channel completion correlation id —
|
|
4659
4669
|
* MIRROR of the sibling task_notification's `TaskNotificationPayload.completionId` (same settle,
|
|
4660
4670
|
* same minted value; the fleet lane was explicitly one of the four channels the original ask named
|
|
4661
4671
|
* — "同一完成今天从四条通道扇出" — so it gets the same mirror treatment `seq`/`stoppedBy` already
|
|
@@ -4709,7 +4719,7 @@ export interface BackgroundChildEvent {
|
|
|
4709
4719
|
* would stamp delegation frames onto host-resumed root tasks. Rows minted WITH the axis resume
|
|
4710
4720
|
* with their spawn/terminal pair even deps-only; a resume that re-supplies trusted internals
|
|
4711
4721
|
* (every in-engine lane does) was never affected.
|
|
4712
|
-
* PAIRING (
|
|
4722
|
+
* PAIRING (closed the one hole): a spawn frame is always closed by a terminal frame —
|
|
4713
4723
|
* the ordinary path emits it where the `TaskResult` assembles, and a POST-SPAWN throw that the
|
|
4714
4724
|
* stream layer converts into a synthesized failed result (e.g. `resume.tool_unavailable` re-thrown
|
|
4715
4725
|
* past the run tail) emits the failed terminal from that backstop, gated on a carrier that is set
|
|
@@ -4805,7 +4815,7 @@ export interface ProjectMemoryLoad {
|
|
|
4805
4815
|
*/
|
|
4806
4816
|
instructionSources?: ReadonlyArray<{
|
|
4807
4817
|
path: string;
|
|
4808
|
-
/**
|
|
4818
|
+
/** (additive widening): `null` = the source is DECLARED but currently
|
|
4809
4819
|
* ABSENT from disk — the change probe then watches for its APPEARANCE (renders "absent → hash").
|
|
4810
4820
|
* Runtime already handled null (collectInstructionsChange's from===null arm); this widening
|
|
4811
4821
|
* only aligns the declared type with the shipped behavior. */
|
|
@@ -4979,6 +4989,16 @@ export interface EngineNotice {
|
|
|
4979
4989
|
* mark would have carried, neutralized/length-bounded (tool and agent-type names are
|
|
4980
4990
|
* host/model-controlled inputs).
|
|
4981
4991
|
*
|
|
4992
|
+
* - `"memory.consolidation_incomplete"` (design/376, LLM consolidation driver) — a driver run
|
|
4993
|
+
* settled without reaching the fixpoint: `detail` names the stop reason (the closed
|
|
4994
|
+
* `ConsolidationRunStopReason` set), cycles done, and the residue (write-failure or
|
|
4995
|
+
* fuse-refused groups by name). Advisory: committed cycles stand (add-only, never rolled
|
|
4996
|
+
* back); the recovery verb is re-running the host driver, which resumes the same pending run.
|
|
4997
|
+
* - `"memory.consolidation_driver_superseded"` (same family) — a concurrent driver invocation
|
|
4998
|
+
* took over this scope's run row (attempt fencing): the losing worker stops with this code
|
|
4999
|
+
* and MUST NOT retry into the winner's account. Coordination fact between two host calls,
|
|
5000
|
+
* not a principal ruling — listed in the non-governance disposition table.
|
|
5001
|
+
*
|
|
4982
5002
|
* - `"delegation.transcript_integrity"` (subagent transcript persistence) — a durable agent row
|
|
4983
5003
|
* with a BOUND transcript sessionId met a session store that attests `not_found` for it: the
|
|
4984
5004
|
* deployment's declared transcript durability is being contradicted by reality. Announced at
|
|
@@ -5081,7 +5101,7 @@ export interface RunnerDeps {
|
|
|
5081
5101
|
isRevoked(serverName: string): boolean;
|
|
5082
5102
|
};
|
|
5083
5103
|
/**
|
|
5084
|
-
* design/147 S1c (
|
|
5104
|
+
* design/147 S1c (ruled 2026-07-18) — the DURABLE name→agent roster behind explicit-name
|
|
5085
5105
|
* addressing, a storage-tier seam like the checkpoint store: core bundles `MemoryRosterStore`
|
|
5086
5106
|
* (default when omitted... none — omitted means NO durable roster; the in-memory task registry
|
|
5087
5107
|
* still resolves live/recent names exactly as before) and `FileRosterStore`; a server deployment
|
|
@@ -5247,6 +5267,39 @@ export interface RunnerDeps {
|
|
|
5247
5267
|
* {@link memoryProvenance}.
|
|
5248
5268
|
*/
|
|
5249
5269
|
memoryConsolidation?: import("../core/memory-engine/consolidation.js").MemoryConsolidationOptions;
|
|
5270
|
+
/**
|
|
5271
|
+
* design/376 片② — the memory-consolidation DRIVER seat (the LLM half), ORTHOGONAL to
|
|
5272
|
+
* {@link memoryConsolidation} on purpose: that key is the write PROTOCOL's parameters (fuse,
|
|
5273
|
+
* caps, cadence — engine-side), this key is who thinks (model seat + mint knobs — driver-side).
|
|
5274
|
+
* The ENGINE itself keeps zero model seats (design/339 §1.1: engine adjudicates, driver
|
|
5275
|
+
* proposes; an engine-held model would put distillation authority on the wrong side of the
|
|
5276
|
+
* trust boundary), so the seat lives here and is consumed by the host driver verb
|
|
5277
|
+
* (`runMemoryConsolidationDriver` + `resolveMemoryConsolidationDriver(deps)`).
|
|
5278
|
+
*
|
|
5279
|
+
* `chat` — the explicit model seat: an endpoint triple (screened loudly: explicit model id, no
|
|
5280
|
+
* alias spellings, key present) or any JSON-only completion function. ABSENT ⇒ the driver
|
|
5281
|
+
* resolves the `consolidate` role (`consolidate → summarize → coded refusal`; deliberately
|
|
5282
|
+
* never `default` — see the {@link ModelRole} doc). Every other knob mirrors the driver verb's
|
|
5283
|
+
* options and is screened there (#123: bad values refuse coded, never fold to defaults).
|
|
5284
|
+
* DEPLOYMENT seat ONLY, same law as {@link memoryConsolidation}: no TaskSpec twin — a task
|
|
5285
|
+
* author gets no channel to point the library's consolidation at a model of its choosing.
|
|
5286
|
+
* Absent alongside absent {@link memoryConsolidation} ⇒ nothing runs and nothing changes
|
|
5287
|
+
* (the v3 default posture).
|
|
5288
|
+
*/
|
|
5289
|
+
memoryConsolidationDriver?: {
|
|
5290
|
+
chat?: {
|
|
5291
|
+
baseUrl: string;
|
|
5292
|
+
apiKey: string;
|
|
5293
|
+
model: string;
|
|
5294
|
+
} | import("../core/memory-engine/distiller.js").DistillerChatFn;
|
|
5295
|
+
/** The audit model id — REQUIRED when `chat` is a bare function (a function carries no id and
|
|
5296
|
+
* the run/archive must not record a guess); derived from the endpoint triple or the resolved
|
|
5297
|
+
* role otherwise. */
|
|
5298
|
+
model?: string;
|
|
5299
|
+
contract?: import("../core/memory-engine/distiller.js").LlmDistillerContract;
|
|
5300
|
+
maxCycles?: number;
|
|
5301
|
+
mintRepairBudget?: number;
|
|
5302
|
+
};
|
|
5250
5303
|
/**
|
|
5251
5304
|
* design/199 件A — the DEPLOYMENT's read-face declaration
|
|
5252
5305
|
* ({@link import("../tools/fs/read-face.js").ReadFace}; see {@link TaskSpec.readFace} for the
|
|
@@ -5535,7 +5588,7 @@ export interface RunnerDeps {
|
|
|
5535
5588
|
* `SubagentToolOptions.background.agentStore` (spawn-side writer half) — the engine cannot
|
|
5536
5589
|
* verify the pairing (the Agent tool is deployment-composed), and a half-wired deployment is a
|
|
5537
5590
|
* SILENT degrade: reader-only ⇒ no rows ever exist; writer-only ⇒ the auto-mounted fallbacks
|
|
5538
|
-
* here never see them (
|
|
5591
|
+
* here never see them (RB-37). Third consumer: delegated
|
|
5539
5592
|
* CHILDREN's auto-mounted TaskOutput/TaskStop/AgentTranscript read THIS deps too (prepare-task
|
|
5540
5593
|
* wires them from the child's runner) — a sub-runner with different deps splits the read face. */
|
|
5541
5594
|
backgroundAgentStore?: import("./background-agent-store.js").BackgroundAgentStore;
|
|
@@ -5626,12 +5679,12 @@ export interface RunnerDeps {
|
|
|
5626
5679
|
* the handle — no host-context leak into the runner); the deployment registers it by `runId`+`label` to route a
|
|
5627
5680
|
* human/cross-replica steer to `handle.steer(...)`. Unset ⇒ agents run non-steerable (no overhead). Opt-in.
|
|
5628
5681
|
*
|
|
5629
|
-
* **Interaction with {@link workflowJournalStore}
|
|
5682
|
+
* **Interaction with {@link workflowJournalStore}**: a steerable agent runs via
|
|
5630
5683
|
* `agentStream`, whose results ARE RECORDED in the journal since 1.355 (complete read-face: the journal
|
|
5631
5684
|
* API / diagnostics coordinate show every agent) but are NEVER REPLAYED — `resumeFromRunId` on a
|
|
5632
5685
|
* steerable workflow still re-runs agents LIVE (steer input is not deterministic; a cache would replay
|
|
5633
5686
|
* a result the operator steered). Pre-1.355 the stream lane recorded NOTHING — with both deps set the
|
|
5634
|
-
* journal read empty on every workflow (the
|
|
5687
|
+
* journal read empty on every workflow (the zero-write case), silently.
|
|
5635
5688
|
*/
|
|
5636
5689
|
onWorkflowAgentSpawn?: (handle: import("../orchestration/workflow.js").WorkflowAgentHandle) => void;
|
|
5637
5690
|
/** design/72 §2.2 (B): deployment default for the suspend-loop cap (see `TaskSpec.maxSuspends`).
|
|
@@ -5658,7 +5711,7 @@ export interface RunnerDeps {
|
|
|
5658
5711
|
* When set AND `spec.memory.enabled`, the task runs the INJECTION-FIRST file-based memory lifecycle
|
|
5659
5712
|
* (materialize → session file ops → harvest with the full gate set), the CC-verbatim `# Memory`
|
|
5660
5713
|
* instruction + fenced derived index replace the legacy `<user_memory>` block, and NO remember/recall
|
|
5661
|
-
* tools are mounted (memory = the model's ordinary file skills). **S4
|
|
5714
|
+
* tools are mounted (memory = the model's ordinary file skills). **S4: unset ⇒
|
|
5662
5715
|
* the task runs MEMORY-LESS** — the legacy `memoryStore` runtime path was retired (one deprecation
|
|
5663
5716
|
* warning via `onError` phase `"config"`); this field is the ONLY live memory seam.
|
|
5664
5717
|
*/
|
|
@@ -5831,7 +5884,7 @@ export interface RunnerDeps {
|
|
|
5831
5884
|
onAsk?: import("./tool-policy.js").OnAsk;
|
|
5832
5885
|
/** Content-ask seam (design/64 §5): when set, every task mounts an AskUserQuestion tool that routes a
|
|
5833
5886
|
* model-issued question to this callback (a real human/UI). Distinct from `onAsk` (permission). A task's
|
|
5834
|
-
* own `onQuestion` overrides this. Unset ⇒ the tool mounts only if another
|
|
5887
|
+
* own `onQuestion` overrides this. Unset ⇒ the tool mounts only if another delivery face exists
|
|
5835
5888
|
* (durable park consumer / explicit `TaskSpec.interactiveTools` — see that knob's criterion table). */
|
|
5836
5889
|
onQuestion?: import("./ask-question.js").OnQuestion;
|
|
5837
5890
|
/**
|