@odla-ai/harness 0.1.2 → 0.3.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.
Files changed (34) hide show
  1. package/dist/{chunk-QTUEF2HZ.js → chunk-3QP4VDQS.js} +1 -1
  2. package/dist/{chunk-QTUEF2HZ.js.map → chunk-3QP4VDQS.js.map} +1 -1
  3. package/dist/{chunk-GE6CCN7W.js → chunk-C5VQI2IF.js} +2 -2
  4. package/dist/{chunk-PHXQH4YM.js → chunk-GKDKIU4P.js} +4 -3
  5. package/dist/{chunk-ATKV6VTU.js → chunk-KD7IN3NJ.js} +4 -4
  6. package/dist/{chunk-GMVZ4LZH.js → chunk-U2OFMIAW.js} +1248 -373
  7. package/dist/chunk-U2OFMIAW.js.map +1 -0
  8. package/dist/cli.cjs.map +1 -1
  9. package/dist/cli.js +4 -4
  10. package/dist/code-runtime-cli.cjs +1281 -680
  11. package/dist/code-runtime-cli.cjs.map +1 -1
  12. package/dist/code-runtime-cli.js +5 -6
  13. package/dist/code-runtime-cli.js.map +1 -1
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.js +2 -2
  18. package/dist/node.cjs +1655 -456
  19. package/dist/node.cjs.map +1 -1
  20. package/dist/node.d.cts +739 -10
  21. package/dist/node.d.ts +739 -10
  22. package/dist/node.js +342 -6
  23. package/dist/node.js.map +1 -1
  24. package/dist/testing.cjs.map +1 -1
  25. package/dist/testing.d.cts +1 -1
  26. package/dist/testing.d.ts +1 -1
  27. package/dist/testing.js +1 -1
  28. package/dist/{types-D12vK3K9.d.cts → types-0_H9TKkO.d.cts} +1 -1
  29. package/dist/{types-D12vK3K9.d.ts → types-0_H9TKkO.d.ts} +1 -1
  30. package/package.json +6 -12
  31. package/dist/chunk-GMVZ4LZH.js.map +0 -1
  32. /package/dist/{chunk-GE6CCN7W.js.map → chunk-C5VQI2IF.js.map} +0 -0
  33. /package/dist/{chunk-PHXQH4YM.js.map → chunk-GKDKIU4P.js.map} +0 -0
  34. /package/dist/{chunk-ATKV6VTU.js.map → chunk-KD7IN3NJ.js.map} +0 -0
package/dist/node.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { r as HarnessTaskSpec, g as HarnessAgentOutput, f as HarnessAgentInput, H as HarnessControlPlane, u as HarnessToolBroker, a as HarnessLease, d as HarnessInferenceRequest, e as HarnessInferenceResponse, i as CodeSessionEventData, w as HarnessToolRequest, v as HarnessToolName } from './types-D12vK3K9.js';
1
+ import { r as HarnessTaskSpec, g as HarnessAgentOutput, f as HarnessAgentInput, H as HarnessControlPlane, u as HarnessToolBroker, a as HarnessLease, d as HarnessInferenceRequest, e as HarnessInferenceResponse, i as CodeSessionEventData, v as HarnessToolName, w as HarnessToolRequest } from './types-0_H9TKkO.js';
2
2
  import { CodePortableCheckpoint, CodeSourceFile, CodeVerificationReceipt, CodeCheckpointState } from '@odla-ai/camel/code';
3
+ import { Skill, Inference, AgentRunBudget, AgentRun, CompactionPolicy } from '@odla-ai/ai';
3
4
  import { PolicyOutcome } from '@odla-ai/camel/policy';
4
- import '@odla-ai/ai';
5
+ import { Graph, PartitionVerdict } from '@odla-ai/graph';
5
6
 
6
7
  /** Supported command-line container engines for isolated harness attempts. */
7
8
  type ContainerEngine = "container" | "podman" | "docker";
@@ -181,7 +182,6 @@ interface CodeRuntimeCapabilities {
181
182
  source?: CodeLocalSourceDescriptor;
182
183
  images?: {
183
184
  ready: boolean;
184
- pi: string;
185
185
  recipes: Array<{
186
186
  id: string;
187
187
  image: string;
@@ -210,7 +210,7 @@ interface CodeRuntimeSnapshot {
210
210
  commands: CodeRuntimeCommand[];
211
211
  }
212
212
  /** Commands accepted by the outbound Code runtime. */
213
- type CodeRuntimeCommandKind = "start" | "prompt" | "checkpoint_stop" | "resume";
213
+ type CodeRuntimeCommandKind = "start" | "prompt" | "checkpoint_stop" | "resume" | "pursue";
214
214
  /** One sequenced command fenced to an exact host-binding generation. */
215
215
  interface CodeRuntimeCommand {
216
216
  commandId: string;
@@ -313,6 +313,79 @@ interface FrozenCodeLocalSource {
313
313
  sourceDir: string;
314
314
  }
315
315
 
316
+ /** v1's system prompt, verbatim. Do not edit without re-baselining the bench. */
317
+ declare const V1_SYSTEM_PROMPT = "You are Pi, the coding agent inside an odla Code harness.\nUse only the odla_read, odla_apply_git_diff, and odla_run_recipe tools.\nFor mutations, call odla_apply_git_diff with raw git diff text. It must start\nwith \"diff --git a/<path> b/<path>\", include matching \"---\" and \"+++\" file\nheaders and numbered \"@@\" hunks, and never use \"*** Begin Patch\" wrappers.\nThe workspace, model, and tool effects are controlled by the host broker.\nNever claim a build or test passed unless odla_run_recipe returned that result.";
318
+ /** The v2 prompt. v1's said "Use only the odla_read, odla_apply_git_diff, and
319
+ * odla_run_recipe tools", so leaving it in place would have told the model not
320
+ * to touch the tools this milestone exists to test. */
321
+ declare const V2_SYSTEM_PROMPT = "You are the coding agent inside an odla Code harness.\nStart by orienting: odla_list shows the files in the workspace and odla_search\nfinds a literal string across them. Prefer those over guessing a path.\nThen odla_read a bounded range, and odla_apply_git_diff to mutate.\nFor mutations, call odla_apply_git_diff with raw git diff text. It must start\nwith \"diff --git a/<path> b/<path>\", include matching \"---\" and \"+++\" file\nheaders and numbered \"@@\" hunks, and never use \"*** Begin Patch\" wrappers.\nThe workspace, model, and tool effects are controlled by the host broker.\nNever claim a build or test passed unless odla_run_recipe returned that result.";
322
+ /** Which tool surface the agent sees. `v1` reproduces the Pi container's exact
323
+ * three tools so the recorded baseline stays comparable. */
324
+ type CodeSurface = "v1" | "v2" | "v3";
325
+ /** v3 leads with orientation, because that is where the tokens went. */
326
+ declare const V3_SYSTEM_PROMPT = "You are the coding agent inside an odla Code harness.\n\nOrient before you look. odla_overview gives the directory shape of the whole\nrepository in a few hundred lines; odla_where_is finds where a symbol is defined,\ndisambiguated by package; odla_who_imports finds what depends on a file; and\nodla_who_touches finds the code that reads and writes a table or database\nnamespace, which is how a bug report about wrong data becomes a file path.\nPrefer these over listing the tree \u2014 a full listing of a real repository is tens\nof thousands of tokens and you will carry it for the rest of the session.\n\nThen odla_search for a literal string, odla_read for a bounded range, and\nodla_apply_git_diff to change something. A patch must start with\n\"diff --git a/<path> b/<path>\", include matching \"---\" and \"+++\" headers and\nnumbered \"@@\" hunks with at least one line of surrounding context, and must never\nuse \"*** Begin Patch\" wrappers.\n\nThe workspace, model, and tool effects are controlled by the host broker.\nNever claim a build or test passed unless odla_run_recipe returned that result.";
327
+ /**
328
+ * The system prompt for each tool surface, keyed by version.
329
+ *
330
+ * Kept addressable so a benchmark can hold everything else fixed and vary only
331
+ * the prompt — v1 is byte-identical to what the retired Pi agent shipped, which
332
+ * is what makes the comparison against v2 and v3 meaningful.
333
+ */
334
+ declare const SYSTEM_PROMPT_FOR: Record<CodeSurface, string>;
335
+ /** Which tool surface the skill describes, and the recipes it may run. */
336
+ interface CodeSkillOpts {
337
+ broker: HarnessToolBroker;
338
+ lease: HarnessLease;
339
+ workspaceDir: string;
340
+ /** Defaults to v1 so an unqualified run reproduces the baseline. */
341
+ surface?: CodeSurface;
342
+ /** Records every brokered call so the report can attribute errors per tool. */
343
+ onToolCall?(call: {
344
+ tool: HarnessToolName;
345
+ ok: boolean;
346
+ durationMs: number;
347
+ }): void;
348
+ }
349
+ /**
350
+ * The three v1 tools, brokered. Each handler is a thin adapter: it forwards the
351
+ * model's arguments to the broker unchanged and maps the bounded
352
+ * `HarnessToolResponse` onto the agent loop's `ToolOutput`, so a policy denial
353
+ * or a failed patch reaches the model as a tool error rather than an exception.
354
+ */
355
+ declare function codeSkill(opts: CodeSkillOpts): Skill;
356
+
357
+ /** The workspace, tools, and budget for a single attempt inside the runtime. */
358
+ interface CodeAgentAttemptOptions {
359
+ inference: Inference;
360
+ broker: HarnessToolBroker;
361
+ lease: HarnessLease;
362
+ workspaceDir: string;
363
+ prompt: string;
364
+ surface?: CodeSurface;
365
+ maxSteps?: number;
366
+ /** Run-wide ceiling enforced by runAgent against incremental usage. */
367
+ budget?: AgentRunBudget;
368
+ signal?: AbortSignal;
369
+ /** Emitted per brokered call so the engine can report tool activity. */
370
+ onToolCall?(call: {
371
+ tool: HarnessToolName;
372
+ ok: boolean;
373
+ durationMs: number;
374
+ }): void;
375
+ }
376
+ /** Whether one attempt completed, and the text it ended on. */
377
+ interface CodeAgentAttemptResult {
378
+ status: "completed" | "failed";
379
+ /** The agent's closing text, surfaced to the owner as its final message. */
380
+ finalText: string;
381
+ /** Present only when the attempt failed. */
382
+ error?: string;
383
+ /** Why the loop stopped, for diagnostics. */
384
+ stoppedReason?: string;
385
+ }
386
+ /** Run one attempt with runAgent over the brokered surface. */
387
+ declare function runCodeAgentAttempt(options: CodeAgentAttemptOptions): Promise<CodeAgentAttemptResult>;
388
+
316
389
  /** One control-owned regular file expected from a clean build recipe. */
317
390
  interface CodeExpectedArtifact {
318
391
  id: string;
@@ -380,13 +453,11 @@ interface CodeToolBrokerOptions {
380
453
  interface CodePiRuntimeEngineOptions {
381
454
  control: CodeRuntimeAgentControlPlane;
382
455
  engine: ContainerEngine;
383
- image: string;
384
- /** The Code CLI may build its bundled, content-addressed Pi adapter locally. */
385
- imageAuthorization?: "digest" | "cli_embedded";
386
456
  recipes: readonly CodeBuildRecipe[];
387
457
  recipeAuthorization?: "registered_recipe" | "exact_approval";
388
458
  limits?: ContainerLimits;
389
- runAttempt?: (options: ContainerRunOptions) => Promise<ContainerRunResult>;
459
+ /** Injectable agent attempt. Defaults to runAgent over the brokered surface. */
460
+ runAgentAttempt?: (options: CodeAgentAttemptOptions) => Promise<CodeAgentAttemptResult>;
390
461
  recipeExecutor?: CodeRecipeExecutor;
391
462
  /** Owner-visible and terminal-visible bounded runtime failures. */
392
463
  onDiagnostic?: (message: string) => void;
@@ -457,7 +528,7 @@ declare function prepareRuntimeCheckpoint(input: PrepareRuntimeCheckpointInput):
457
528
  /** Active isolated workspace state required to prepare and publish a Code checkpoint candidate. */
458
529
  interface RuntimeCheckpointSession {
459
530
  workspace: StagedWorkspace;
460
- done: Promise<ContainerRunResult | null>;
531
+ done: Promise<CodeAgentAttemptResult | null>;
461
532
  abort: AbortController;
462
533
  baseCommitSha: string;
463
534
  trustedBaseDigest: `sha256:${string}`;
@@ -481,6 +552,18 @@ declare class CodeRuntimeCheckpointManager {
481
552
  acknowledged(command: CodeRuntimeCommand, result: CodeRuntimeCommandResult): Promise<boolean>;
482
553
  }
483
554
 
555
+ interface CodeCommandMetadata {
556
+ role: "coding" | "review";
557
+ title: string;
558
+ prompt: string;
559
+ maxTokensPerInteraction: number;
560
+ planningInputDigest: `sha256:${string}` | null;
561
+ attestationDigest: string;
562
+ repository: string;
563
+ baseCommitSha: string;
564
+ sourceTreeDigest: `sha256:${string}`;
565
+ }
566
+
484
567
  /** Disposable local source tree materialized from an exact, validated Code snapshot. */
485
568
  interface MaterializedCodeSource {
486
569
  sourceDir: string;
@@ -492,10 +575,656 @@ declare function materializeCodeRuntimeSource(snapshot: CodeRuntimeSourceSnapsho
492
575
  * checkout. They remain outside the candidate diff and the tool broker denies
493
576
  * every write beneath the reference root. */
494
577
  declare function attachCodeRuntimeReferences(workspace: StagedWorkspace, references: NonNullable<CodeRuntimeSourceSnapshot["references"]>): Promise<void>;
578
+ /**
579
+ * Obtain the staged workspace one start/resume command should run in.
580
+ *
581
+ * Extracted from the engine because it is a different job: bringing a
582
+ * workspace into being from either a terminal's frozen checkout or the
583
+ * control plane's attested GitHub snapshot, with the checks that each source
584
+ * demands. The engine's remaining concern is what to RUN in it.
585
+ */
586
+ declare function materializeCommandWorkspace(input: {
587
+ command: CodeRuntimeCommand;
588
+ metadata: CodeCommandMetadata;
589
+ resume: boolean;
590
+ control: Pick<CodeRuntimeAgentControlPlane, "source">;
591
+ localSource?: FrozenCodeLocalSource;
592
+ }): Promise<{
593
+ workspace: StagedWorkspace;
594
+ sourceDigest: `sha256:${string}`;
595
+ localTrustedBaseDigest?: `sha256:${string}`;
596
+ requestedLocal: CodeLocalSourceDescriptor | null;
597
+ }>;
495
598
 
496
599
  /** Create the trusted CaMeL boundary for all Pi filesystem and build effects. */
497
600
  declare function createCodeToolBroker(options: CodeToolBrokerOptions): HarnessToolBroker;
498
601
 
602
+ /** One brokered tool call, recorded for per-tool error attribution. */
603
+ interface CodeToolCallRecord {
604
+ tool: HarnessToolName;
605
+ ok: boolean;
606
+ durationMs: number;
607
+ }
608
+ /** One coding run: which tool surface, which model, and what it may spend. */
609
+ interface RunCodeAgentOptions {
610
+ inference: Inference;
611
+ broker: HarnessToolBroker;
612
+ lease: HarnessLease;
613
+ workspaceDir: string;
614
+ /** The owner task. Becomes the single user turn that opens the run. */
615
+ prompt: string;
616
+ model: string;
617
+ /** Model turns before the loop stops. v1 had no equivalent bound. */
618
+ maxSteps?: number;
619
+ /** Run-wide token and tool-call ceilings, enforced by runAgent. */
620
+ budget?: AgentRunBudget;
621
+ /**
622
+ * Shorten the conversation when it gets expensive. Defaults to keeping the
623
+ * task and the three most recent tool exchanges once a turn bills more than
624
+ * 120k input tokens; pass `null` to keep the whole history.
625
+ *
626
+ * A default rather than opt-in because the failure it prevents is silent:
627
+ * without it a long run simply costs more each turn until the model's context
628
+ * ends the run, and nothing in the trace says that is what happened.
629
+ */
630
+ compaction?: CompactionPolicy | null;
631
+ /** Tool surface the agent sees. Defaults to v1, the recorded baseline. */
632
+ surface?: CodeSurface;
633
+ /** Overrides the surface's system prompt. Leave unset to keep runs comparable. */
634
+ system?: string;
635
+ maxTokens?: number;
636
+ signal?: AbortSignal;
637
+ deadline?: number;
638
+ /** Observe each brokered call as it completes, for live engine events. */
639
+ onToolCall?(call: CodeToolCallRecord): void;
640
+ /**
641
+ * Extra skills composed alongside the code tools — PM, chat, anything else
642
+ * the host can authorize.
643
+ *
644
+ * They arrive as an argument rather than being built here on purpose: those
645
+ * skills need a database credential scoped to a tenant, which the host has
646
+ * and the harness must not. It also keeps @odla-ai/pm and @odla-ai/chat out
647
+ * of this package's install graph for a capability not every consumer wants.
648
+ */
649
+ extraSkills?: Skill[];
650
+ }
651
+ /** A finished run — its final text, why it stopped, and what it cost. */
652
+ interface CodeAgentRun {
653
+ run: AgentRun;
654
+ toolCalls: CodeToolCallRecord[];
655
+ }
656
+ /**
657
+ * Drive one Code attempt to completion and return the agent run plus the
658
+ * brokered tool calls it made.
659
+ *
660
+ * `budget` is enforced by runAgent against *incremental* usage per turn, which
661
+ * is the fix for v1's per-interaction accounting: v1 summed `inputTokens +
662
+ * outputTokens` from every response into one counter, so re-sent context was
663
+ * charged again on each turn and a 32k allowance died in two turns.
664
+ */
665
+ declare function runCodeAgent(options: RunCodeAgentOptions): Promise<CodeAgentRun>;
666
+
667
+ interface CodeInteractionBudgetState {
668
+ tokens: number;
669
+ noticeEmitted: boolean;
670
+ }
671
+
672
+ /** How a runtime attempt reaches a model: through the control plane, never direct. */
673
+ interface CodeRuntimeInferenceOptions {
674
+ command: CodeRuntimeCommand;
675
+ metadata: CodeCommandMetadata;
676
+ state: CodeInteractionBudgetState;
677
+ control: CodeRuntimeAgentControlPlane;
678
+ event(value: CodeSessionEventData): Promise<void>;
679
+ }
680
+ /**
681
+ * Build the brokered `Inference` for one attempt.
682
+ *
683
+ * `catalog` is deliberately empty. The runtime does not know what the platform
684
+ * policy resolved the model to, and the trace's cost contract is that unknown
685
+ * pricing is absent rather than zero — a run that silently reported $0 would
686
+ * make the brokered route look free next to a priced one.
687
+ */
688
+ declare function createCodeRuntimeInference(options: CodeRuntimeInferenceOptions): Inference;
689
+
690
+ /** What kind of thing was learned. */
691
+ type CodeMemoryKind =
692
+ /** An approach that failed, and what the gate said about it. */
693
+ "hazard"
694
+ /** Something true of this codebase that reading it does not reveal. */
695
+ | "invariant"
696
+ /** What a goal actually achieved, judged by a verifier rather than claimed. */
697
+ | "outcome"
698
+ /** Everything else worth carrying forward. */
699
+ | "note";
700
+ /**
701
+ * What produced a memory.
702
+ *
703
+ * This field is what stops a shared store becoming a rumour mill. An agent that
704
+ * can write unfalsifiable claims into memory poisons every run that follows, so
705
+ * a finding carries the thing that produced it and a bare assertion is visibly
706
+ * a lesser class of claim.
707
+ */
708
+ interface CodeMemoryEvidence {
709
+ kind: "gate" | "receipt" | "human";
710
+ /** A verification id, a receipt digest, or a person. */
711
+ ref: string;
712
+ }
713
+ /** One thing the agent learned about this codebase. */
714
+ interface CodeMemory {
715
+ id: string;
716
+ /** A graph node id — `file:src/a.ts`, `table:orders`, `symbol:runAgent`. */
717
+ subject: string;
718
+ kind: CodeMemoryKind;
719
+ body: string;
720
+ evidence?: CodeMemoryEvidence;
721
+ /** Principal that recorded it. Attributed, never authenticated — see PM. */
722
+ authorId: string;
723
+ createdAt: number;
724
+ /** Set when a later memory contradicts this one. */
725
+ supersededBy?: string;
726
+ }
727
+ /** A memory before it has an id or a timestamp. */
728
+ type NewCodeMemory = Omit<CodeMemory, "id" | "createdAt">;
729
+ /**
730
+ * Where memories live.
731
+ *
732
+ * An interface rather than a database, because a Code host holds no tenant
733
+ * credential — the same reason inference is brokered. The control plane
734
+ * supplies the implementation; the agent only ever sees this.
735
+ */
736
+ interface CodeMemoryStore {
737
+ /** Memories about any of these subjects, newest first. */
738
+ recall(subjects: readonly string[], limit: number): Promise<CodeMemory[]>;
739
+ remember(memory: NewCodeMemory): Promise<CodeMemory>;
740
+ }
741
+ /** Longest body worth storing. A memory is a lesson, not a transcript. */
742
+ declare const MAX_MEMORY_BODY = 4000;
743
+ /** Reject a memory that would be useless or unbounded before it is stored. */
744
+ declare function validateMemory(memory: NewCodeMemory): void;
745
+ /** How wide to cast when gathering what is known about some subjects. */
746
+ interface RecallOptions {
747
+ /**
748
+ * Also recall memories about what the subjects reach.
749
+ *
750
+ * A hazard recorded against a module matters to everything that imports it,
751
+ * and the whole reason subjects are graph ids is that this is one traversal.
752
+ * Off by default: the neighbourhood of a hub is most of the repository.
753
+ */
754
+ graph?: Graph;
755
+ /** Edge kinds to spread across when `graph` is given. */
756
+ kinds?: readonly string[];
757
+ /** How far to spread. Default 1 — direct neighbours only. */
758
+ depth?: number;
759
+ /** Cap on returned memories. Default 20. */
760
+ limit?: number;
761
+ }
762
+ /**
763
+ * Gather what is known about some subjects, optionally including their
764
+ * neighbourhood.
765
+ *
766
+ * Superseded memories are dropped. Keeping them would mean the agent reads a
767
+ * correction and its own contradiction in the same breath, and has to guess
768
+ * which is current — which is worse than not remembering at all.
769
+ */
770
+ declare function recallAbout(store: CodeMemoryStore, subjects: readonly string[], options?: RecallOptions): Promise<CodeMemory[]>;
771
+ /** Render memories for a prompt — the cheapest form that still says enough. */
772
+ declare function renderMemories(memories: readonly CodeMemory[]): string;
773
+ /**
774
+ * Turn a failed attempt into something the next run does not have to pay for.
775
+ *
776
+ * This is the write that justifies the store. The gate's verdict is the most
777
+ * expensive knowledge a run produces — it cost a whole attempt — and until now
778
+ * it was dropped the moment the next prompt was built.
779
+ *
780
+ * Recorded against the files the attempt actually touched, so it surfaces to
781
+ * whoever works on them next rather than being filed under the goal, which
782
+ * nobody will ever search for.
783
+ */
784
+ declare function hazardFromAttempt(input: {
785
+ goal: string;
786
+ attempt: number;
787
+ feedback: string;
788
+ touched: readonly string[];
789
+ verificationId: string;
790
+ authorId: string;
791
+ }): NewCodeMemory[];
792
+
793
+ /** What a run actually did, judged rather than claimed. */
794
+ interface GoalOutcome {
795
+ /** The PM entity this goal came from, when it came from one. */
796
+ pmEntityId?: string;
797
+ goal: string;
798
+ /** How the goal said it would be judged. */
799
+ proof: string;
800
+ /** Whether the clean verifier agreed. */
801
+ met: boolean;
802
+ /** Why it stopped — `proof_passed`, or the budget that ran out. */
803
+ stoppedReason: string;
804
+ attempts: number;
805
+ tokens: number;
806
+ costUsd?: number;
807
+ /** The receipt that backs a met verdict. Absent means nothing backs it. */
808
+ evidence?: CodeMemoryEvidence;
809
+ }
810
+ /**
811
+ * Whether an outcome may move a PM item to done.
812
+ *
813
+ * Two conditions, and the second is the one that matters: the verifier agreed,
814
+ * AND it left a receipt. A `met` with no evidence is an agent's assertion
815
+ * wearing a verdict's clothes, and admitting it would make the whole audit
816
+ * trail decorative.
817
+ */
818
+ declare function outcomeCloses(outcome: GoalOutcome): boolean;
819
+ /**
820
+ * Say plainly what happened, for the PM comment that records it.
821
+ *
822
+ * Written for a human deciding whether to trust the result, so the numbers that
823
+ * bound the claim — attempts, tokens, cost — are in the sentence rather than in
824
+ * a linked artifact nobody opens. Unknown cost is said as unknown; reporting
825
+ * $0.00 for a run whose pricing was unavailable would be a lie in the direction
826
+ * that flatters the agent.
827
+ */
828
+ declare function renderOutcome(outcome: GoalOutcome): string;
829
+ /**
830
+ * Record the outcome as a memory, so the next run knows what this one settled.
831
+ *
832
+ * Filed against the goal's subject rather than a file: an outcome is about an
833
+ * intention, and the useful question later is "has anyone tried this before",
834
+ * not "what happened to line 40".
835
+ */
836
+ declare function outcomeMemory(outcome: GoalOutcome, subject: string, authorId: string): NewCodeMemory;
837
+
838
+ /** Everything the runner learns from one attempt. */
839
+ interface GoalAttemptOutcome {
840
+ /** Did the goal's proof pass on the resulting tree? */
841
+ gatePassed: boolean;
842
+ /** What the gate said, fed back as the next instruction when it failed. */
843
+ feedback: string;
844
+ /** Tokens this attempt consumed, for the budget. */
845
+ tokens: number;
846
+ /** USD this attempt cost, when known. Unknown is not zero. */
847
+ costUsd?: number;
848
+ /** Set when the attempt could not run at all, as opposed to running and failing. */
849
+ error?: string;
850
+ /** Model turns taken. Used to rank racers; optional elsewhere. */
851
+ steps?: number;
852
+ /** Size of the candidate patch produced. Used to break a tie between racers. */
853
+ patchBytes?: number;
854
+ }
855
+ /** What one attempt is told: which try this is, and what to do. */
856
+ interface GoalAttemptInput {
857
+ /** 1-based attempt number. */
858
+ attempt: number;
859
+ /** What to tell the agent this time. */
860
+ prompt: string;
861
+ signal?: AbortSignal;
862
+ }
863
+ /** Run one attempt and report what the gate made of it. */
864
+ type GoalAttempt = (input: GoalAttemptInput) => Promise<GoalAttemptOutcome>;
865
+ /** Bounds on autonomous pursuit. Every one of them is a stop, not a suggestion. */
866
+ interface GoalBudget {
867
+ /** Hard cap on attempts. Required — an unbounded loop is not a budget. */
868
+ maxAttempts: number;
869
+ maxTokens?: number;
870
+ maxUsd?: number;
871
+ /** Absolute epoch milliseconds. */
872
+ deadline?: number;
873
+ }
874
+ /** What the runner reports as it goes, so a board can follow from evidence. */
875
+ type GoalEvent = {
876
+ type: "attempt_started";
877
+ attempt: number;
878
+ prompt: string;
879
+ } | {
880
+ type: "attempt_failed";
881
+ attempt: number;
882
+ feedback: string;
883
+ error?: string;
884
+ } | {
885
+ type: "goal_met";
886
+ attempts: number;
887
+ tokens: number;
888
+ costUsd?: number;
889
+ } | {
890
+ type: "goal_abandoned";
891
+ reason: GoalStoppedReason;
892
+ attempts: number;
893
+ tokens: number;
894
+ costUsd?: number;
895
+ };
896
+ /**
897
+ * One goal, its proof, and the budget the runner may spend pursuing it.
898
+ *
899
+ * The budget is not advisory. Every ceiling is checked after the attempt that
900
+ * consumed it, so a run always stops on a named reason rather than drifting.
901
+ */
902
+ interface GoalRunSpec {
903
+ /** The objective, in the owner's words. */
904
+ goal: string;
905
+ /** How the runner knows it is met — surfaced to the agent so it aims at the
906
+ * same thing the gate measures. */
907
+ proof?: string;
908
+ budget: GoalBudget;
909
+ signal?: AbortSignal;
910
+ now?: () => number;
911
+ /**
912
+ * Follow the run. Called for every transition so a project board can be
913
+ * updated from what actually happened rather than from the agent's account
914
+ * of it.
915
+ *
916
+ * Failures here are SWALLOWED. The work is authoritative and the board is a
917
+ * projection of it: a PM outage must not abandon a goal that is succeeding,
918
+ * and losing a comment is cheaper than losing the run. `boardErrors` on the
919
+ * result records what did not land, so silence is never mistaken for success.
920
+ */
921
+ onEvent?(event: GoalEvent): Promise<void> | void;
922
+ }
923
+ /** Why a run ended. `proof_passed` is the only success; the rest are budgets. */
924
+ type GoalStoppedReason = "proof_passed" | "max_attempts" | "token_budget" | "cost_budget" | "deadline" | "cancelled" | "attempt_failed";
925
+ /** One attempt as it actually went, including what the gate said about it. */
926
+ interface GoalAttemptRecord {
927
+ attempt: number;
928
+ gatePassed: boolean;
929
+ tokens: number;
930
+ costUsd?: number;
931
+ feedback: string;
932
+ error?: string;
933
+ }
934
+ /**
935
+ * The whole pursuit: whether the proof passed, why it stopped, and every
936
+ * attempt along the way. `boardErrors` records handler failures the runner
937
+ * swallowed, so a silent kanban outage is visible rather than invisible.
938
+ */
939
+ interface GoalRun {
940
+ met: boolean;
941
+ /** Event-handler failures, in order. Empty when the board kept up. */
942
+ boardErrors: string[];
943
+ stoppedReason: GoalStoppedReason;
944
+ attempts: GoalAttemptRecord[];
945
+ tokens: number;
946
+ /** Summed cost, or undefined when no attempt reported one. */
947
+ costUsd?: number;
948
+ durationMs: number;
949
+ }
950
+ /**
951
+ * Pursue one goal.
952
+ *
953
+ * The re-prompt carries the GATE's output, not a restatement of the goal. That
954
+ * is the whole trick: an agent told only "try again" repeats itself, while an
955
+ * agent handed the failing test output has something new to act on. It is also
956
+ * why the runner refuses to continue without feedback — a gate that fails
957
+ * silently would produce an expensive loop that cannot learn.
958
+ */
959
+ declare function runGoal(spec: GoalRunSpec, attempt: GoalAttempt): Promise<GoalRun>;
960
+
961
+ /** One racer's result, tagged with which racer produced it. */
962
+ interface RacedOutcome extends GoalAttemptOutcome {
963
+ racer: number;
964
+ }
965
+ /**
966
+ * One race: N independent attempts at the same goal, cheapest winner taken.
967
+ *
968
+ * The run is charged for every racer, not just the winner. Racing answers
969
+ * variance, not size; at equal budget, depth beat it on every axis measured.
970
+ */
971
+ interface RacedAttemptOptions {
972
+ /** How many attempts run per round. */
973
+ racers: number;
974
+ /** Runs one racer. Each MUST get an isolated workspace — racers edit in
975
+ * parallel, and a shared tree would have them overwrite each other. */
976
+ attempt(input: GoalAttemptInput & {
977
+ racer: number;
978
+ }): Promise<GoalAttemptOutcome>;
979
+ /** Override the ranking. Default: {@link selectWinner}. */
980
+ select?(outcomes: RacedOutcome[]): RacedOutcome;
981
+ /** Observe the whole field, for reporting what racing cost and bought. */
982
+ onRound?(outcomes: RacedOutcome[], winner: RacedOutcome): void;
983
+ }
984
+ /**
985
+ * Rank a field of racers.
986
+ *
987
+ * Passing candidates first — that is the only thing that decides the goal. Then
988
+ * fewest steps, then cheapest, then smallest patch: three tie-breaks that all
989
+ * prefer the attempt which did LESS to get there, on the view that a smaller
990
+ * change reaching the same verified state is the better one to keep.
991
+ *
992
+ * Unknown cost ranks LAST among passing candidates rather than cheapest. An
993
+ * unpriced racer must not win a cost comparison it never entered.
994
+ */
995
+ declare function selectWinner(outcomes: RacedOutcome[]): RacedOutcome;
996
+ /**
997
+ * Build a GoalAttempt that races `racers` attempts and returns the winner.
998
+ *
999
+ * The returned outcome reports the round's TOTAL tokens and cost, not the
1000
+ * winner's. The runner charges its budget from what an attempt reports, and
1001
+ * charging only the winner would make racing look free — three racers would
1002
+ * cost what one did, and every budget in the system would be wrong by a factor
1003
+ * of N. Racing trades depth for breadth at honest spend, or it is not a trade.
1004
+ */
1005
+ declare function racedAttempt(options: RacedAttemptOptions): GoalAttempt;
1006
+
1007
+ /** One independent slice of a goal, scoped to the files it may touch. */
1008
+ interface SubGoal {
1009
+ id: string;
1010
+ /** What this sub-agent is asked to do. */
1011
+ goal: string;
1012
+ /** The files it declares it will touch. Its patch is rejected if it strays. */
1013
+ files: string[];
1014
+ }
1015
+ /** A plan that cannot be run in parallel — overlapping files, or a stray edit. */
1016
+ declare class DecompositionError extends Error {
1017
+ constructor(message: string);
1018
+ }
1019
+ /**
1020
+ * Reject a plan that cannot be worked in parallel, BEFORE any agent starts.
1021
+ *
1022
+ * Two sub-goals declaring the same file is the whole failure mode: they would
1023
+ * produce patches against the same lines and one of them could not be applied.
1024
+ * Catching it here costs nothing; catching it at integration costs every token
1025
+ * both sub-agents spent.
1026
+ */
1027
+ declare function assertDisjointPlan(plan: readonly SubGoal[]): void;
1028
+ /** Files a patch actually touches, or null when it is not a valid patch. */
1029
+ declare function patchPaths(patch: string, maxBytes?: number): string[] | null;
1030
+ /**
1031
+ * Check a sub-agent stayed inside what it declared.
1032
+ *
1033
+ * This is what makes the partition a guarantee rather than a hope: the plan is
1034
+ * checked up front, and each patch is checked against the plan. A sub-agent that
1035
+ * wandered into a neighbour's file is refused even if its patch would have
1036
+ * applied cleanly, because the NEXT sub-patch was written against a tree where
1037
+ * that edit does not exist.
1038
+ */
1039
+ declare function straySubGoalFiles(sub: SubGoal, patch: string): string[];
1040
+ /** What one sub-goal produced: its patch, its cost, and whether it worked. */
1041
+ interface SubGoalResult {
1042
+ sub: SubGoal;
1043
+ /** The candidate patch, or empty when the sub-agent changed nothing. */
1044
+ patch: string;
1045
+ tokens: number;
1046
+ costUsd?: number;
1047
+ error?: string;
1048
+ }
1049
+ /** Applying one sub-goal's patch to the accumulating tree, and the verdict. */
1050
+ interface IntegrationStep {
1051
+ subGoalId: string;
1052
+ /** Did the accumulated tree still satisfy the proof after applying this one? */
1053
+ gatePassed: boolean;
1054
+ applied: boolean;
1055
+ reason?: "stray_files" | "did_not_apply" | "gate_failed" | "sub_goal_failed" | "no_changes";
1056
+ detail?: string;
1057
+ }
1058
+ /**
1059
+ * A decomposed pursuit end to end.
1060
+ *
1061
+ * Measured at 1.68x the tokens of straight depth for 0.88x the wall clock, so
1062
+ * this buys latency, not efficiency — see chooseStrategy for when that trade
1063
+ * is worth making.
1064
+ */
1065
+ interface DecomposedRun {
1066
+ met: boolean;
1067
+ steps: IntegrationStep[];
1068
+ tokens: number;
1069
+ costUsd?: number;
1070
+ }
1071
+ /** The plan, its results, and the two callbacks that apply and judge them. */
1072
+ interface IntegrateOptions {
1073
+ plan: readonly SubGoal[];
1074
+ results: readonly SubGoalResult[];
1075
+ /** Apply one patch to the accumulating tree; reject means it did not apply. */
1076
+ apply(patch: string): Promise<boolean>;
1077
+ /** Run the proof against the accumulating tree. */
1078
+ gate(): Promise<boolean>;
1079
+ }
1080
+ /**
1081
+ * Integrate sub-results one at a time, gating after each.
1082
+ *
1083
+ * Order follows the plan, and the first failure stops integration. Continuing
1084
+ * past one would mean gating a tree whose earlier layer is already known bad,
1085
+ * so every later verdict would describe a state nobody intends to ship.
1086
+ */
1087
+ declare function integrateSubGoals(options: IntegrateOptions): Promise<DecomposedRun>;
1088
+ /**
1089
+ * The check `assertDisjointPlan` cannot make: do the sub-goals collide through
1090
+ * what they *reach*, not merely through what they declare?
1091
+ *
1092
+ * Collision ids are graph ids (`file:src/a.ts`, `table:orders`), because the
1093
+ * answer is no longer only about files — a shared table is a real collision and
1094
+ * naming it as a bare path would be a lie about what it is.
1095
+ *
1096
+ * Declared files being disjoint is necessary and not sufficient. Two sub-goals
1097
+ * can own different modules and still both depend on a third; a change either
1098
+ * one makes to that shared module lands in one patch and is invisible to the
1099
+ * other's verification. The import graph is the only thing that can see this,
1100
+ * and it is cheap — the graph over 3,400 files builds in ~400ms, against the
1101
+ * cost of running two agents to completion and discovering it at integration.
1102
+ *
1103
+ * Reported rather than thrown, because a shared dependency is sometimes fine:
1104
+ * two sub-goals may both READ a types module neither intends to touch. The
1105
+ * caller decides whether the overlap is one it can live with.
1106
+ */
1107
+ declare function planReachCollisions(plan: readonly SubGoal[], workspace: {
1108
+ paths: readonly string[];
1109
+ read(path: string): Promise<string>;
1110
+ }): Promise<PartitionVerdict>;
1111
+
1112
+ /** What is known about a goal before choosing how to pursue it. */
1113
+ interface StrategySignals {
1114
+ /** Prior attempts, oldest first. Empty on the first pass. */
1115
+ priorAttempts?: Array<{
1116
+ gatePassed: boolean;
1117
+ feedback: string;
1118
+ error?: string;
1119
+ }>;
1120
+ /** True when wall clock is the binding constraint — a human is waiting, or a
1121
+ * deadline is close — and paying more per solve to finish sooner is correct. */
1122
+ latencyBound?: boolean;
1123
+ /** Estimated tokens needed to hold the whole goal at once. */
1124
+ estimatedContextTokens?: number;
1125
+ /** What one agent can actually hold. */
1126
+ contextLimit?: number;
1127
+ /** A checked disjoint partition, when the planner produced one. */
1128
+ partitionable?: boolean;
1129
+ /** Racers/sub-agents available if fanning out. */
1130
+ width?: number;
1131
+ }
1132
+ /** How to spend a goal's budget: straight depth, N racers, or a split plan. */
1133
+ type GoalStrategy = "sequential" | "race" | "decompose";
1134
+ /** The chosen strategy, why, and what it is expected to cost against depth. */
1135
+ interface StrategyChoice {
1136
+ strategy: GoalStrategy;
1137
+ /** Why, in terms a human reviewing a run can check. */
1138
+ reason: string;
1139
+ /** Expected cost multiplier vs sequential, from the measurements above.
1140
+ * 1 for sequential; fan-out is charged what it was observed to cost. */
1141
+ expectedCostMultiplier: number;
1142
+ /** False when the branch rests on something not yet measured. */
1143
+ measured: boolean;
1144
+ }
1145
+ /** Observed premiums. Update these from the bench, not from expectation. */
1146
+ declare const MEASURED_PREMIUM: Readonly<{
1147
+ /** 3 racers vs pure depth at equal budget: 21,044 / 7,936. */
1148
+ racePerRacer: 0.55;
1149
+ /** Decomposition across 3 sub-agents: 10,897 / 6,474. */
1150
+ decomposePerSubGoal: 0.23;
1151
+ }>;
1152
+ /**
1153
+ * Choose a strategy.
1154
+ *
1155
+ * Order matters and encodes the evidence: depth first, because it won every
1156
+ * measured comparison; fan-out only where depth demonstrably cannot help.
1157
+ */
1158
+ declare function chooseStrategy(signals?: StrategySignals): StrategyChoice;
1159
+ /** Whether the gate's output gives the next attempt something to work with. */
1160
+ declare const feedbackIsActionable: (feedback: string) => boolean;
1161
+
1162
+ /**
1163
+ * Strip an apply_patch envelope from around a git diff.
1164
+ *
1165
+ * Models emit `*** Begin Patch` / `*** End Patch` constantly — twice in five
1166
+ * tool calls during the first real dogfood — even with a system prompt that
1167
+ * forbids it by name, because it is the dominant format elsewhere. What they
1168
+ * wrap in it is usually a perfectly good unified diff, and git apply then dies
1169
+ * on "unexpected line: *** End Patch".
1170
+ *
1171
+ * Refusing that is a surface arguing with its users and charging them a turn to
1172
+ * lose. The envelope is stripped ONLY when a real `diff --git` survives
1173
+ * underneath: this accepts a mis-wrapped diff, and does not attempt to
1174
+ * translate the genuinely different apply_patch dialect, which would mean
1175
+ * inventing hunks nobody wrote.
1176
+ */
1177
+ declare function stripPatchEnvelope(patch: string): string;
1178
+ /** Validate a text-only, same-path unified patch and return every affected path. */
1179
+ declare function validateCodePatch(rawPatch: string, maxBytes: number): string[];
1180
+ /** Restrict Code tool paths to ordinary files outside filtered/secret trees. */
1181
+ declare function validateRelativePath(path: string): void;
1182
+ /** Resolve a validated relative path without permitting a root escape. */
1183
+ declare function resolveCodePath(workspaceDir: string, path: string): string;
1184
+ /**
1185
+ * Why `git apply` rejected a patch, in terms the author can act on.
1186
+ *
1187
+ * A hunk with no context lines is the common case and the least obvious: git
1188
+ * refuses it whenever the file has more lines than the hunk claims, with only
1189
+ * "patch does not apply" to show for it. Models emit context-free hunks
1190
+ * constantly, so saying this plainly turns a silent retry loop into one
1191
+ * corrected call.
1192
+ */
1193
+ declare function describePatchFailure(patch: string, detail: string): string;
1194
+ /** Apply a previously validated patch without invoking a shell or repository hooks. */
1195
+ declare function applyCodePatch(workspaceDir: string, rawPatch: string, paths: readonly string[]): Promise<void>;
1196
+
1197
+ /**
1198
+ * An installed dependency tree lent to a recipe for the length of one run.
1199
+ *
1200
+ * Mounted under a reserved name and removed in a finally, so the agent can run
1201
+ * a real build without the tree ever being addressable by a patch.
1202
+ */
1203
+ interface RecipeDependencies {
1204
+ /** Absolute path to an installed dependency tree on the host. */
1205
+ source: string;
1206
+ /** Where it appears inside the workspace. Must be a reserved name, so the
1207
+ * agent still cannot address it. */
1208
+ mountAs?: string;
1209
+ }
1210
+ /**
1211
+ * Wrap an executor so `dependencies.source` is present during each recipe run.
1212
+ *
1213
+ * It is linked, not copied. A link costs nothing per run, and dependencies are
1214
+ * identical across every attempt, racer and verification — copying them would
1215
+ * multiply the largest thing in the tree by the number of stages.
1216
+ *
1217
+ * The link is removed in a `finally`, so a recipe that times out or throws
1218
+ * cannot leave it behind for `workspace.patch()` to diff or
1219
+ * `digestStagedWorkspace` to hash.
1220
+ */
1221
+ declare function withRecipeDependencies(executor: CodeRecipeExecutor, dependencies: RecipeDependencies): CodeRecipeExecutor;
1222
+ /** Resolve the dependency tree for a repository root, when it has one. */
1223
+ declare function installedDependencies(repoRoot: string): Promise<RecipeDependencies | null>;
1224
+
1225
+ /** Every ordinary, policy-legal source path under `root`, sorted. */
1226
+ declare function registeredFiles(root: string, limit?: number): Promise<string[]>;
1227
+
499
1228
  /** Build a trusted, fixed command for an isolated and networkless recipe container. */
500
1229
  declare function buildRecipeContainerArgs(engine: ContainerEngine, workspaceDir: string, recipe: CodeBuildRecipe, name?: string): string[];
501
1230
  /** Create a recipe executor that never invokes a shell and never mounts credentials. */
@@ -541,4 +1270,4 @@ interface CodeVerificationEvidence {
541
1270
  /** Rebuild a candidate from an exact trusted base and emit a prose-free clean-verifier receipt. */
542
1271
  declare function verifyCodeCandidate(input: VerifyCodeCandidateInput): Promise<CodeVerificationEvidence>;
543
1272
 
544
- export { CODE_RUNTIME_PROTOCOL_VERSION, type CodeBuildRecipe, type CodeExpectedArtifact, type CodeLocalSourceDescriptor, CodePiRuntimeEngine, type CodePiRuntimeEngineOptions, type CodeRecipeExecutor, type CodeRecipeResult, type CodeRuntimeAgentControlPlane, type CodeRuntimeBinding, type CodeRuntimeCandidateResponse, type CodeRuntimeCapabilities, CodeRuntimeCheckpointManager, type CodeRuntimeClientOptions, type CodeRuntimeCommand, type CodeRuntimeCommandEngine, type CodeRuntimeCommandKind, type CodeRuntimeCommandResult, CodeRuntimeControlError, type CodeRuntimeControlPlane, type CodeRuntimeLoopOptions, CodeRuntimeReconciler, type CodeRuntimeReviewRequest, type CodeRuntimeReviewResponse, type CodeRuntimeSnapshot, type CodeRuntimeSourceSnapshot, type CodeToolBrokerOptions, type CodeToolDecision, type CodeVerificationEvidence, type CodeVerificationLog, type CodeVerificationPolicy, type ContainerEngine, type ContainerEngineSelectionOptions, type ContainerEngineVerificationOptions, type ContainerLimits, type ContainerRunOptions, type ContainerRunResult, type CreateCodeWorkspaceCheckpointInput, type HarnessRunnerOptions, type MaterializedCodeSource, type MaterializedGitTree, type PrepareRuntimeCheckpointInput, type PreparedRuntimeCheckpoint, type RestoreCodeWorkspaceCheckpointInput, type RestoredCodeWorkspaceCheckpoint, type RuntimeCheckpointSession, type StageWorkspaceOptions, type StagedWorkspace, type VerifyCodeCandidateInput, assertCodeBuildRecipe, assertPinnedImage, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, createCodeRuntimeControlClient, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, digestStagedWorkspace, isCheckpointEffectCompleted, materializeCodeRuntimeSource, materializeGitTree, prepareRuntimeCheckpoint, restoreCodeWorkspaceCheckpoint, runCodeRuntimeHeartbeatLoop, runContainerAttempt, runHarnessRunner, runLeasedAttempt, safeWorkspaceLabel, selectContainerEngine, stageWorkspace, stageWorkspacePair, verifyCodeCandidate, verifyContainerEngineBoundary };
1273
+ export { CODE_RUNTIME_PROTOCOL_VERSION, type CodeAgentAttemptOptions, type CodeAgentAttemptResult, type CodeAgentRun, type CodeBuildRecipe, type CodeExpectedArtifact, type CodeLocalSourceDescriptor, type CodeMemory, type CodeMemoryEvidence, type CodeMemoryKind, type CodeMemoryStore, CodePiRuntimeEngine, type CodePiRuntimeEngineOptions, type CodeRecipeExecutor, type CodeRecipeResult, type CodeRuntimeAgentControlPlane, type CodeRuntimeBinding, type CodeRuntimeCandidateResponse, type CodeRuntimeCapabilities, CodeRuntimeCheckpointManager, type CodeRuntimeClientOptions, type CodeRuntimeCommand, type CodeRuntimeCommandEngine, type CodeRuntimeCommandKind, type CodeRuntimeCommandResult, CodeRuntimeControlError, type CodeRuntimeControlPlane, type CodeRuntimeInferenceOptions, type CodeRuntimeLoopOptions, CodeRuntimeReconciler, type CodeRuntimeReviewRequest, type CodeRuntimeReviewResponse, type CodeRuntimeSnapshot, type CodeRuntimeSourceSnapshot, type CodeSkillOpts, type CodeSurface, type CodeToolBrokerOptions, type CodeToolCallRecord, type CodeToolDecision, type CodeVerificationEvidence, type CodeVerificationLog, type CodeVerificationPolicy, type ContainerEngine, type ContainerEngineSelectionOptions, type ContainerEngineVerificationOptions, type ContainerLimits, type ContainerRunOptions, type ContainerRunResult, type CreateCodeWorkspaceCheckpointInput, type DecomposedRun, DecompositionError, type GoalAttempt, type GoalAttemptInput, type GoalAttemptOutcome, type GoalAttemptRecord, type GoalBudget, type GoalEvent, type GoalOutcome, type GoalRun, type GoalRunSpec, type GoalStoppedReason, type GoalStrategy, type HarnessRunnerOptions, type IntegrateOptions, type IntegrationStep, MAX_MEMORY_BODY, MEASURED_PREMIUM, type MaterializedCodeSource, type MaterializedGitTree, type NewCodeMemory, type PrepareRuntimeCheckpointInput, type PreparedRuntimeCheckpoint, type RacedAttemptOptions, type RacedOutcome, type RecallOptions, type RecipeDependencies, type RestoreCodeWorkspaceCheckpointInput, type RestoredCodeWorkspaceCheckpoint, type RunCodeAgentOptions, type RuntimeCheckpointSession, SYSTEM_PROMPT_FOR, type StageWorkspaceOptions, type StagedWorkspace, type StrategyChoice, type StrategySignals, type SubGoal, type SubGoalResult, V1_SYSTEM_PROMPT, V2_SYSTEM_PROMPT, V3_SYSTEM_PROMPT, type VerifyCodeCandidateInput, applyCodePatch, assertCodeBuildRecipe, assertDisjointPlan, assertPinnedImage, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, describePatchFailure, digestStagedWorkspace, feedbackIsActionable, hazardFromAttempt, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, outcomeCloses, outcomeMemory, patchPaths, planReachCollisions, prepareRuntimeCheckpoint, racedAttempt, recallAbout, registeredFiles, renderMemories, renderOutcome, resolveCodePath, restoreCodeWorkspaceCheckpoint, runCodeAgent, runCodeAgentAttempt, runCodeRuntimeHeartbeatLoop, runContainerAttempt, runGoal, runHarnessRunner, runLeasedAttempt, safeWorkspaceLabel, selectContainerEngine, selectWinner, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateMemory, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withRecipeDependencies };