@deepstrike/sdk 0.2.50 → 0.2.52

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.
Files changed (39) hide show
  1. package/README.md +83 -60
  2. package/dist/index.d.ts +5 -7
  3. package/dist/index.js +3 -3
  4. package/dist/kernel.d.ts +61 -31
  5. package/dist/runtime/canonical-kernel-step.d.ts +152 -0
  6. package/dist/runtime/canonical-kernel-step.js +1483 -0
  7. package/dist/runtime/execution-plane.d.ts +0 -3
  8. package/dist/runtime/execution-plane.js +0 -24
  9. package/dist/runtime/facade.js +3 -0
  10. package/dist/runtime/kernel-event-log.js +7 -13
  11. package/dist/runtime/kernel-journal.d.ts +264 -0
  12. package/dist/runtime/kernel-journal.js +741 -0
  13. package/dist/runtime/kernel-primitives-dashboard.d.ts +0 -2
  14. package/dist/runtime/kernel-primitives-dashboard.js +1 -8
  15. package/dist/runtime/kernel-step.d.ts +29 -109
  16. package/dist/runtime/kernel-step.js +47 -317
  17. package/dist/runtime/os-snapshot.d.ts +2 -2
  18. package/dist/runtime/os-snapshot.js +2 -6
  19. package/dist/runtime/payload-store.d.ts +16 -0
  20. package/dist/runtime/payload-store.js +80 -0
  21. package/dist/runtime/runner.d.ts +31 -114
  22. package/dist/runtime/runner.js +689 -774
  23. package/dist/runtime/session-log.d.ts +34 -32
  24. package/dist/runtime/session-log.js +21 -131
  25. package/dist/runtime/session-repair.d.ts +2 -36
  26. package/dist/runtime/session-repair.js +2 -47
  27. package/dist/runtime/sub-agent-orchestrator.d.ts +1 -1
  28. package/dist/runtime/sub-agent-orchestrator.js +42 -40
  29. package/dist/types/agent.d.ts +22 -19
  30. package/dist/types/agent.js +26 -42
  31. package/dist/workflow/public.d.ts +1 -1
  32. package/dist/workflow/public.js +1 -1
  33. package/package.json +2 -2
  34. package/dist/runtime/kernel-rebuild.d.ts +0 -13
  35. package/dist/runtime/kernel-rebuild.js +0 -75
  36. package/dist/runtime/kernel-transaction-log.d.ts +0 -61
  37. package/dist/runtime/kernel-transaction-log.js +0 -149
  38. package/dist/runtime/large-result-spool.d.ts +0 -93
  39. package/dist/runtime/large-result-spool.js +0 -214
@@ -2,7 +2,6 @@ const KERNEL_KINDS = new Set([
2
2
  "compressed",
3
3
  "page_out",
4
4
  "page_in",
5
- "large_result_spooled",
6
5
  "capability_changed",
7
6
  "context_renewed",
8
7
  "suspended",
@@ -30,7 +29,6 @@ export function rebuildOsSnapshotFromSessionEvents(events) {
30
29
  signals: [],
31
30
  pageOutCount: 0,
32
31
  pageInCount: 0,
33
- spoolCount: 0,
34
32
  toolGatedCount: 0,
35
33
  memoryWrittenCount: 0,
36
34
  memoryQueriedCount: 0,
@@ -64,7 +62,8 @@ export function rebuildOsSnapshotFromSessionEvents(events) {
64
62
  const record = {
65
63
  turn: event.turn,
66
64
  agent_id: event.agent_id,
67
- parent_session_id: event.parent_session_id,
65
+ ...(event.parent_task_id ? { parent_task_id: event.parent_task_id } : {}),
66
+ ...(event.parent_session_id ? { parent_session_id: event.parent_session_id } : {}),
68
67
  state: event.state ?? "running",
69
68
  };
70
69
  const idx = index.get(event.agent_id);
@@ -119,9 +118,6 @@ export function rebuildOsSnapshotFromSessionEvents(events) {
119
118
  case "page_in":
120
119
  snap.pageInCount += 1;
121
120
  break;
122
- case "large_result_spooled":
123
- snap.spoolCount += 1;
124
- break;
125
121
  case "memory_written":
126
122
  snap.memoryWrittenCount += 1;
127
123
  break;
@@ -0,0 +1,16 @@
1
+ export interface PayloadStoreConfig {
2
+ storageDir?: string;
3
+ maxAgeMs?: number;
4
+ }
5
+ /** File-backed storage for canonical opaque payload locators. */
6
+ export declare class PayloadStore {
7
+ private readonly storageDir;
8
+ private readonly maxAgeMs?;
9
+ private readonly activeWrites;
10
+ constructor(config?: PayloadStoreConfig);
11
+ private payloadPath;
12
+ persistPayload(sessionId: string, payloadRef: string, content: string): Promise<void>;
13
+ loadPayload(sessionId: string, payloadRef: string): Promise<string | undefined>;
14
+ cleanup(maxAgeMs?: number): Promise<number>;
15
+ private atomicWrite;
16
+ }
@@ -0,0 +1,80 @@
1
+ import * as crypto from "node:crypto";
2
+ import * as fs from "node:fs/promises";
3
+ import * as path from "node:path";
4
+ /** File-backed storage for canonical opaque payload locators. */
5
+ export class PayloadStore {
6
+ storageDir;
7
+ maxAgeMs;
8
+ activeWrites = new Map();
9
+ constructor(config = {}) {
10
+ this.storageDir = config.storageDir ?? ".payloads";
11
+ this.maxAgeMs = config.maxAgeMs;
12
+ }
13
+ payloadPath(sessionId, payloadRef) {
14
+ const key = crypto
15
+ .createHash("sha256")
16
+ .update(`${sessionId}\u0000${payloadRef}`)
17
+ .digest("hex");
18
+ return path.join(this.storageDir, `${key}.payload`);
19
+ }
20
+ async persistPayload(sessionId, payloadRef, content) {
21
+ const target = this.payloadPath(sessionId, payloadRef);
22
+ let write = this.activeWrites.get(target);
23
+ if (!write) {
24
+ write = this.atomicWrite(target, content).finally(() => {
25
+ this.activeWrites.delete(target);
26
+ });
27
+ this.activeWrites.set(target, write);
28
+ }
29
+ await write;
30
+ }
31
+ async loadPayload(sessionId, payloadRef) {
32
+ try {
33
+ return await fs.readFile(this.payloadPath(sessionId, payloadRef), "utf8");
34
+ }
35
+ catch (error) {
36
+ if (error.code === "ENOENT")
37
+ return undefined;
38
+ throw error;
39
+ }
40
+ }
41
+ async cleanup(maxAgeMs = this.maxAgeMs ?? 7 * 24 * 60 * 60 * 1000) {
42
+ let files;
43
+ try {
44
+ files = await fs.readdir(this.storageDir);
45
+ }
46
+ catch (error) {
47
+ if (error.code === "ENOENT")
48
+ return 0;
49
+ throw error;
50
+ }
51
+ const now = Date.now();
52
+ let removed = 0;
53
+ for (const file of files) {
54
+ const target = path.join(this.storageDir, file);
55
+ const stat = await fs.stat(target);
56
+ if (now - stat.mtimeMs > maxAgeMs) {
57
+ await fs.unlink(target);
58
+ removed += 1;
59
+ }
60
+ }
61
+ return removed;
62
+ }
63
+ async atomicWrite(target, content) {
64
+ await fs.mkdir(this.storageDir, { recursive: true });
65
+ const temporary = `${target}.${process.pid}.${crypto.randomUUID()}.tmp`;
66
+ let handle;
67
+ try {
68
+ handle = await fs.open(temporary, "wx");
69
+ await handle.writeFile(content, "utf8");
70
+ await handle.sync();
71
+ await handle.close();
72
+ handle = undefined;
73
+ await fs.rename(temporary, target);
74
+ }
75
+ finally {
76
+ await handle?.close().catch(() => undefined);
77
+ await fs.unlink(temporary).catch(() => undefined);
78
+ }
79
+ }
80
+ }
@@ -3,17 +3,17 @@ import type { DreamStore, MemoryRecord, MemoryRecall, MemoryScope, MemoryQuery }
3
3
  import type { KnowledgeSource } from "../knowledge/source.js";
4
4
  import type { RuntimeSignalUrgency, SignalSource } from "../signals/types.js";
5
5
  import type { SessionLog, SessionEvent } from "./session-log.js";
6
+ import type { KernelJournal } from "./kernel-journal.js";
6
7
  import type { ArchiveStore } from "./archive.js";
7
8
  import type { ExecutionPlane } from "./execution-plane.js";
8
9
  import type { RunGroup } from "./run-group.js";
9
10
  import { type MemoryPolicy, type ResourceQuota } from "../kernel.js";
10
- import { type RecoveredNodeOutcome } from "./session-repair.js";
11
11
  import type { AgentRunSpec, MilestoneCheckResult, MilestoneContract, MilestonePolicy, WorkflowSpec, WorkflowOutcome } from "../types/agent.js";
12
12
  import { type SubAgentOrchestrator } from "./sub-agent-orchestrator.js";
13
13
  import { type ReducerRegistry } from "./reducers.js";
14
14
  import { type GovernancePolicy } from "../governance.js";
15
15
  import { type NativeOsProfile, type OsProfileId, type SignalPolicy } from "./os-profile.js";
16
- import { LargeResultSpool } from "./large-result-spool.js";
16
+ import { PayloadStore } from "./payload-store.js";
17
17
  import type { BackgroundTaskErrorHandler } from "./reliability.js";
18
18
  import { type ContextPolicyOverridesV1 } from "./context-policy.js";
19
19
  import { type InstructionProfile } from "../harness/manifest.js";
@@ -80,26 +80,12 @@ export interface ToolResultHookDecision {
80
80
  }
81
81
  /** Bounded kernel reliability policy. Omitted fields retain kernel defaults. */
82
82
  export interface KernelReliabilityOptions {
83
- /** Deduplicated input-event replay window, 1..65536. */
84
- eventReplayCapacity?: number;
85
- /** Completed effect-result replay window, 1..65536. */
86
- completedEffectReplayCapacity?: number;
87
83
  /** Provider overflow recovery retries, 0..16. */
88
84
  providerRecoveryAttempts?: number;
89
85
  /** Truncated-output recovery retries, 0..16. */
90
86
  outputRecoveryAttempts?: number;
91
- /** Host durability-effect retries, 0..16. */
92
- hostEffectRetryAttempts?: number;
93
- /** Tool-result spool threshold in bytes; must be positive. */
94
- spoolThresholdBytes?: number;
95
- /** Inline spool preview bytes; positive and no larger than the threshold. */
96
- spoolPreviewBytes?: number;
97
- /** Max accepted ABI transactions retained for a portable KernelSnapshot rebuild. */
98
- snapshotInputLimit?: number;
99
87
  /** Max canonical JSON bytes accepted for one kernel input, 256..64MiB. */
100
88
  maxInputBytes?: number;
101
- /** Max canonical JSON bytes retained by the snapshot journal, 256..1GiB. */
102
- snapshotJournalBytesLimit?: number;
103
89
  }
104
90
  export type OperationCancellationReason = "user" | "deadline" | "lease_lost" | "host_shutdown";
105
91
  export interface RuntimeOptions {
@@ -118,6 +104,8 @@ export interface RuntimeOptions {
118
104
  * Undefined ⇒ worktree nodes fall back to the inherited plane (no isolation). */
119
105
  worktreeManager?: import("./worktree-plane.js").WorktreeManager;
120
106
  sessionLog: SessionLog;
107
+ /** ABI v3 transaction capability. Default session logs expose one; custom logs pass it explicitly. */
108
+ kernelJournal?: KernelJournal;
121
109
  executionPlane: ExecutionPlane;
122
110
  /** Receives failures from run-owned best-effort tasks after their semantic owner has committed. */
123
111
  onBackgroundTaskError?: BackgroundTaskErrorHandler;
@@ -194,7 +182,7 @@ export interface RuntimeOptions {
194
182
  * and memory-write syscalls are admitted unconditionally (pre-M2 behavior).
195
183
  */
196
184
  resourceQuota?: ResourceQuota;
197
- /** Host-selectable bounded replay/recovery/durability policy. */
185
+ /** Canonical provider/output recovery and input-bound policy. */
198
186
  kernelReliability?: KernelReliabilityOptions;
199
187
  /** Attempts allowed for a workflow node to satisfy its output schema, 1..16. Default: 2. */
200
188
  workflowSchemaValidationAttempts?: number;
@@ -273,6 +261,8 @@ export interface RuntimeOptions {
273
261
  * concurrency stays vehicle-scoped (spec §2.5).
274
262
  */
275
263
  runGroup?: RunGroup;
264
+ /** Host-only retries for settling the run-group ledger; never enters the canonical ABI. */
265
+ groupBudgetSettlementRetries?: number;
276
266
  /**
277
267
  * Set by the SubAgentOrchestrator for host-derived child runs: the child still joins the
278
268
  * `runGroup` (lineage) and settles its actual terminal usage into the group ledger, but reserves
@@ -281,18 +271,14 @@ export interface RuntimeOptions {
281
271
  */
282
272
  nestedGroupVehicle?: boolean;
283
273
  /**
284
- * Optional long-term memory policy (`set_memory_policy`). Tunes the kernel's memory subsystem
285
- * (retrieval top-k, stale-warning age, write validation, memory path). Unset leaves the kernel
286
- * defaults. Enabling memory still requires `dreamStore` + `agentId`.
274
+ * Optional canonical long-term memory policy. Enabling memory still requires `dreamStore` +
275
+ * `agentId`; storage location is configured on that host store, not in the kernel contract.
287
276
  */
288
277
  memoryPolicy?: MemoryPolicy;
289
278
  tokenizer?: string;
290
279
  enablePlanTool?: boolean;
291
- /**
292
- * Persist full tool outputs when the kernel emits `large_result_spooled`.
293
- * Defaults to `.spool/` under the process cwd.
294
- */
295
- resultSpool?: LargeResultSpool;
280
+ /** Storage for canonical opaque external payload locators. */
281
+ payloadStore?: PayloadStore;
296
282
  compressionStore?: ArchiveStore;
297
283
  onToolSuspend?: (event: ToolSuspendEvent) => Promise<unknown> | unknown;
298
284
  onPermissionRequest?: (event: PermissionRequestEvent) => Promise<PermissionResponse | boolean> | PermissionResponse | boolean;
@@ -304,7 +290,7 @@ export interface RuntimeOptions {
304
290
  criteria: string[];
305
291
  requiredEvidence: string[];
306
292
  }) => Promise<MilestoneCheckResult> | MilestoneCheckResult;
307
- /** Passed to kernel start_run for role/isolation metadata. */
293
+ /** Passed to the canonical agent root for role/isolation metadata. */
308
294
  runSpec?: AgentRunSpec;
309
295
  /**
310
296
  * The run's **exposure ceiling** — the outer bound on what this run may EVER advertise to the
@@ -342,7 +328,7 @@ export interface RuntimeOptions {
342
328
  * `undefined` ⇒ legacy behavior, byte-identical (ceiling + errs-open skill narrowing). `[]` is a
343
329
  * legitimate, distinct value: the minimal surface (meta-tools + `stableCoreToolIds` only) — the
344
330
  * `allowedToolIds` "empty means no gating" trap does NOT recur here. Entries outside the ceiling
345
- * silently intersect away (no start_run error), the same fold every id-list surface uses.
331
+ * silently intersect away (no root-start error), the same fold every id-list surface uses.
346
332
  */
347
333
  baselineToolIds?: string[];
348
334
  /**
@@ -368,13 +354,6 @@ export interface RuntimeOptions {
368
354
  milestoneContract?: MilestoneContract;
369
355
  /** Custom sub-agent host driver; defaults to SubAgentOrchestrator. */
370
356
  subAgentOrchestrator?: SubAgentOrchestrator;
371
- /** M5 v2.1: marks this runner as executing AS a workflow node (a child spawned by the workflow
372
- * driver). A workflow node's `start_workflow` FLATTENS to the parent kernel (emits
373
- * `workflow_nodes_submitted` for `runWorkflow` to append). A top-level run (this flag unset)
374
- * instead AUTO-PIVOTS: it bootstraps + drives the authored workflow in its own kernel and resumes
375
- * the reason loop with the outcome. The orchestrator sets this on workflow-node children so a
376
- * nested `start_workflow` flattens rather than recursing. */
377
- isWorkflowNode?: boolean;
378
357
  /**
379
358
  * When set, sub-agents run through AttemptLoop with a RuntimeAttemptBody and LLM judge.
380
359
  * The eval provider evaluates the sub-agent's output against the criteria
@@ -416,6 +395,7 @@ export declare class RuntimeRunner {
416
395
  private activeGroupBudgetScope;
417
396
  private pendingObservations;
418
397
  private currentSessionId;
398
+ private fallbackPayloadStore;
419
399
  /** O2 (system-reminder channel): host-pushed notes awaiting the next turn-boundary drain. */
420
400
  private injectedSignals;
421
401
  /** Skill names whose content has already been pushed into the durable `knowledge` slot this
@@ -427,9 +407,6 @@ export declare class RuntimeRunner {
427
407
  private activePageOutArchive;
428
408
  /** K4: the active run's goal, kept for the renewal-boundary memory re-query. */
429
409
  private currentGoal;
430
- /** M5 v2.1: sub-workflow specs a top-level agent authored via `start_workflow`, awaiting auto-drive
431
- * at the next safe point (after the tool turn resolves, kernel back in Reason — not suspended). */
432
- private pendingAuthoredWorkflows;
433
410
  private workflowContinuation;
434
411
  private dashboard;
435
412
  /** Most recent kernel entropy sample of the active/last run (see `latestEntropy`). */
@@ -446,25 +423,16 @@ export declare class RuntimeRunner {
446
423
  private commitKernelApply;
447
424
  private commitKernelMaybeAction;
448
425
  private commitKernelAction;
426
+ private startKernelAgent;
427
+ private payloadStore;
449
428
  private persistMemoryToStore;
450
429
  private retrieveMemoryFromStore;
451
430
  /**
452
- * T5: run one memory query through the kernel's `query_memory memory_query_result`
453
- * effect lifecycle on the given runtime. The kernel injects each routed hit into history
454
- * itself and derives the recall lifecycle (`memory_recalled`, edge-triggered
455
- * `promotion_suggested`) from the routed hits — the store stays a pure query.
456
- *
457
- * `seenRecordIds` is one dedupe horizon: a record hit by several queries of the same
458
- * prefetch is routed (recalled, injected) once. The kernel derives counts statelessly from
459
- * each hit's payload, so host-side pre-filtering is the only place duplicates can be stopped.
460
- *
461
- * The recall lifecycle is consumed immediately rather than via the per-turn drain: the store
462
- * must be up to date before any same-turn re-query, and a renewal prefetch fires inside the
463
- * drain loop where queued observations would not be consumed until the next boundary.
464
- * Non-memory observations are forwarded to `leftovers` (the run's pending queue) when given,
465
- * and discarded for detached syscall runtimes (their kernel is throwaway).
431
+ * Route a host-originated renewal prefetch into canonical knowledge commands. This is not an
432
+ * agent syscall: the host selects records from its store, then the kernel owns the only mutation
433
+ * of live semantic context. `seenRecordIds` is the prefetch's dedupe horizon.
466
434
  */
467
- private queryMemoryThroughKernel;
435
+ private prefetchMemoryIntoKnowledge;
468
436
  writeMemory(memory: MemoryRecord, opts?: {
469
437
  sessionId?: string;
470
438
  agentId?: string;
@@ -473,29 +441,28 @@ export declare class RuntimeRunner {
473
441
  sessionId?: string;
474
442
  agentId?: string;
475
443
  }): Promise<MemoryRecall[]>;
444
+ private applyHostMemoryRecallLifecycle;
476
445
  private logMemoryRetrievalResult;
477
- private createSyscallRuntime;
446
+ private createCanonicalRuntime;
447
+ private resolveKernelJournal;
478
448
  private groupBudgetRequest;
479
449
  private settleGroupBudget;
480
450
  /**
481
451
  * Lower the declarative governance / attention / scheduler-budget / resource-quota policies into a
482
- * freshly-created kernel. Shared by `execute()` (full agent run) and `bootstrapWorkflowKernel()`
452
+ * freshly-created kernel. Shared by `execute()` (full agent run) and `initializeWorkflowKernel()`
483
453
  * (standalone host-driven workflow) so a workflow's DAG-node spawns are gated, queued, and quota'd
484
- * exactly as a mid-run spawn would be. Must run BEFORE `start_run` so the in-kernel gate enforces
454
+ * exactly as a mid-run spawn would be. Must run before the canonical root start so the gate enforces
485
455
  * every policy from the first spawn. No config ⇒ the native-profile defaults (铁律: defaults only).
486
456
  */
487
457
  private applyKernelPolicies;
488
458
  /**
489
- * Mirror one kernel memory-lifecycle observation into the durable store / host callbacks.
490
- * Shared by the main run drain, the prefetch path, and the host memory syscalls so every
491
- * query route has identical recall + promotion semantics (T5).
459
+ * Mirror one agent-syscall memory-lifecycle observation into the durable store / host callbacks.
492
460
  *
493
461
  * M3: `memory_recalled` carries the kernel-derived count — the runner never computes
494
462
  * `recall_count + 1` itself. M4: `promotion_suggested` is advisory and already
495
463
  * edge-triggered by the kernel; the runner surfaces it and never auto-pins.
496
464
  */
497
465
  private mirrorMemoryLifecycle;
498
- private consumeMemoryLifecycleObservations;
499
466
  /** Mount a tool capability on the currently-running kernel runtime. No-op if not running. */
500
467
  mountTool(schema: ToolSchema): Promise<void>;
501
468
  /** Mount a skill capability on the currently-running kernel runtime. No-op if not running. */
@@ -520,11 +487,6 @@ export declare class RuntimeRunner {
520
487
  * drops at the next compaction/renewal boundary. A later `skill(name)` call re-activates and
521
488
  * re-pins fresh content. Errs-open: not-active is a kernel-side no-op. */
522
489
  deactivateSkill(name: string): Promise<void>;
523
- /**
524
- * Spawn an isolated sub-agent via the kernel, run it on the host, and feed the result back.
525
- * Requires an active parent run (`run()` / `wake()` in progress or paused at milestone).
526
- */
527
- spawnSubAgent(spec: AgentRunSpec): AsyncIterable<StreamEvent>;
528
490
  /**
529
491
  * G3: run one workflow node, enforcing its `output_schema` (if any). Without a schema this is a
530
492
  * plain `orchestrator.run`. With one, the node's agent is instructed to emit conforming JSON, its
@@ -548,44 +510,17 @@ export declare class RuntimeRunner {
548
510
  * Returns one typed terminal outcome for every node in the DAG.
549
511
  */
550
512
  runWorkflow(spec: WorkflowSpec, opts?: {
551
- /** Typed recovered terminal outcomes, including control signals and output. */
552
- resumedOutcomes?: RecoveredNodeOutcome[];
553
- resumedSubmissions?: Record<string, unknown>[][];
554
- /** R3-1: original base index per submission batch (parallel to resumedSubmissions). */
555
- resumedSubmissionBases?: number[];
556
513
  /** Standalone session id when bootstrapping (no active parent run). Defaults to a fresh uuid. */
557
514
  sessionId?: string;
558
515
  }): Promise<WorkflowOutcome>;
559
516
  /**
560
517
  * Bootstrap a standalone kernel for a host-driven workflow with NO active parent run — the path a
561
518
  * stateless request handler takes when it calls `runWorkflow(spec)` directly. Mirrors `execute()`'s
562
- * pre-run kernel setup (governance / attention / quota via `applyKernelPolicies`, then `start_run`)
519
+ * pre-run kernel setup (governance / attention / quota via `applyKernelPolicies`, then root start)
563
520
  * after `runWorkflow` has durably recorded `run_started`. Sets `activeKernel` / `currentSessionId`;
564
521
  * `runWorkflow` is responsible for tearing them down.
565
522
  */
566
- private bootstrapWorkflowKernel;
567
- /**
568
- * M5/G1: bootstrap an **agent-authored** workflow ("the model writes its own harness"). Unlike
569
- * `runWorkflow` (the host fires the privileged `load_workflow`), this routes the spec through the
570
- * agent-reachable `Syscall::LoadWorkflow` (the `submit_workflow` event): with no workflow active the
571
- * kernel **bootstraps** the DAG; if one is already active it **flattens** the spec's nodes onto it
572
- * (bootstrap-or-flatten — one kernel, one quota, never a workflow stack). Gated by the same
573
- * `max_workflow_nodes` backstop as runtime submission, so an authored harness can't overgrow the run.
574
- * The resulting batches are driven by the same shared driver as `runWorkflow`.
575
- */
576
- bootstrapWorkflow(spec: WorkflowSpec, opts?: {
577
- submitterAgentId?: string;
578
- }): Promise<WorkflowOutcome>;
579
- /**
580
- * M5 v2.1: drive the sub-workflow(s) a top-level agent authored via `start_workflow`. Called at the
581
- * verified-safe point (right after the tool turn resolved to `call_provider` — kernel in Reason, not
582
- * suspended). For each authored spec: `bootstrapWorkflow` runs it in THIS kernel (the kernel resumes
583
- * the agent reason loop on `workflow_completed` — `finish_workflow` sets phase=Reason), then the
584
- * outcome is injected as a user message so the agent's next turn sees the result. Returns a fresh
585
- * `call_provider` synthesized from the updated context (the workflow drive consumed its own kernel
586
- * actions, so we re-render — the same pattern as the reactive-compact retry path).
587
- */
588
- private driveAuthoredWorkflows;
523
+ private initializeWorkflowKernel;
589
524
  /**
590
525
  * #2-B-ii: while a workflow batch is in flight, poll the signal source. A Critical `InterruptNow`
591
526
  * routes through the kernel (which, with the root suspended in `SubAgentAwait`, preempts — marks the
@@ -596,21 +531,10 @@ export declare class RuntimeRunner {
596
531
  */
597
532
  private monitorWorkflowPreemption;
598
533
  /**
599
- * Shared workflow driver for `runWorkflow` (host `load_workflow`) and `bootstrapWorkflow` (agent
600
- * `submit_workflow`): given the observations from the initial load/bootstrap, run each kernel-emitted
601
- * batch in parallel, feed completions back (appending any agent-submitted nodes first), and loop
602
- * until the kernel reports the workflow complete. Returns typed terminal node outcomes.
534
+ * Drive a canonical root or provider-authored workflow from kernel effects only: run each
535
+ * emitted batch, resolve its launch/completion/preemption effects, and stop at the kernel terminal.
603
536
  */
604
537
  private driveWorkflow;
605
- /**
606
- * Resume a workflow from the parent session's completed nodes.
607
- * Reads the session log, extracts completed workflow node records (with their W-1 control
608
- * signals + outputs), and calls runWorkflow so the kernel skips those nodes, replays control
609
- * flow (classify prune / loop stop), and the driver re-seeds its outputs map.
610
- */
611
- resumeWorkflow(spec: WorkflowSpec, opts?: {
612
- sessionId?: string;
613
- }): Promise<WorkflowOutcome>;
614
538
  interrupt(reason?: OperationCancellationReason): void;
615
539
  /** Push a contextual note into the run's signal stream (the system-reminder channel): it drains at
616
540
  * the next turn boundary, routes through the kernel attention policy, and renders once as a
@@ -643,14 +567,6 @@ export declare class RuntimeRunner {
643
567
  wake(sessionId: string, extensions?: Record<string, unknown>): AsyncIterable<StreamEvent>;
644
568
  /** Execute a kernel-owned approval effect and return the correlated decision lists. */
645
569
  private resolveApprovalRequests;
646
- /**
647
- * O7: resolve a `read_result` meta-tool call to the full text of a previously-evicted tool
648
- * output. Resolution order: (a) the on-disk result spool committed by the explicit
649
- * `spool_large_result` host effect, then (b) a session-log scan for the original
650
- * `tool_completed` event carrying that `call_id`. Slices the
651
- * resolved text by `[offset, offset + maxBytes)` (plain string slice — "bytes-ish").
652
- */
653
- private resolveReadResult;
654
570
  private execute;
655
571
  /** I4 + K4: fetch long-term memory hits for the current goal and land them in `history` as an
656
572
  * ordinary user turn — single-use retrieval content that decays with the compression pyramid,
@@ -658,6 +574,7 @@ export declare class RuntimeRunner {
658
574
  * after each sprint renewal (`phase: "renewal"`): renewal drops the old history INCLUDING the
659
575
  * earlier memory hits, so the new sprint gets a fresh recall pass. Errs-open throughout. */
660
576
  private prefetchMemoryIntoHistory;
577
+ private prefetchMemoryIntoInitialContext;
661
578
  private appendObservations;
662
579
  private archiveSemanticPageOut;
663
580
  private upgradeCompressedSummary;