@odla-ai/harness 0.2.0 → 0.4.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/dist/{chunk-5FFR7U4L.js → chunk-ANNX7VGK.js} +87 -1
- package/dist/chunk-ANNX7VGK.js.map +1 -0
- package/dist/code-runtime-cli.cjs +58 -0
- package/dist/code-runtime-cli.cjs.map +1 -1
- package/dist/code-runtime-cli.js +1 -1
- package/dist/node.cjs +151 -2
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +195 -2
- package/dist/node.d.ts +195 -2
- package/dist/node.js +65 -1
- package/dist/node.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5FFR7U4L.js.map +0 -1
package/dist/node.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { r as HarnessTaskSpec, g as HarnessAgentOutput, f as HarnessAgentInput,
|
|
|
2
2
|
import { CodePortableCheckpoint, CodeSourceFile, CodeVerificationReceipt, CodeCheckpointState } from '@odla-ai/camel/code';
|
|
3
3
|
import { Skill, Inference, AgentRunBudget, AgentRun, CompactionPolicy } from '@odla-ai/ai';
|
|
4
4
|
import { PolicyOutcome } from '@odla-ai/camel/policy';
|
|
5
|
-
import { PartitionVerdict } from '@odla-ai/graph';
|
|
5
|
+
import { Graph, PartitionVerdict } from '@odla-ai/graph';
|
|
6
6
|
|
|
7
7
|
/** Supported command-line container engines for isolated harness attempts. */
|
|
8
8
|
type ContainerEngine = "container" | "podman" | "docker";
|
|
@@ -243,9 +243,44 @@ interface CodeRuntimeAgentControlPlane extends CodeRuntimeControlPlane {
|
|
|
243
243
|
infer(sessionId: string, request: HarnessInferenceRequest): Promise<HarnessInferenceResponse>;
|
|
244
244
|
review(sessionId: string, request: CodeRuntimeReviewRequest): Promise<CodeRuntimeReviewResponse>;
|
|
245
245
|
submitCandidate(sessionId: string, checkpointId: string, verification: CodeVerificationReceipt): Promise<CodeRuntimeCandidateResponse>;
|
|
246
|
+
/**
|
|
247
|
+
* Agent memory, brokered like inference is.
|
|
248
|
+
*
|
|
249
|
+
* Optional so an older control plane still satisfies the interface — a Code
|
|
250
|
+
* host talking to a registry that predates memory should lose the feature,
|
|
251
|
+
* not the session.
|
|
252
|
+
*/
|
|
253
|
+
recallMemories?(sessionId: string, subjects: readonly string[], limit: number): Promise<CodeRuntimeMemory[]>;
|
|
254
|
+
rememberMemory?(sessionId: string, memory: CodeRuntimeNewMemory): Promise<void>;
|
|
246
255
|
appendSessionEvent(sessionId: string, eventId: string, event: CodeSessionEventData): Promise<void>;
|
|
247
256
|
reportSessionFailure(sessionId: string, message: string): Promise<void>;
|
|
248
257
|
}
|
|
258
|
+
/** One memory as the control plane returns it. */
|
|
259
|
+
interface CodeRuntimeMemory {
|
|
260
|
+
id: string;
|
|
261
|
+
subject: string;
|
|
262
|
+
kind: string;
|
|
263
|
+
body: string;
|
|
264
|
+
evidence?: {
|
|
265
|
+
kind: string;
|
|
266
|
+
ref: string;
|
|
267
|
+
};
|
|
268
|
+
authorId: string;
|
|
269
|
+
createdAt: number;
|
|
270
|
+
supersededBy?: string;
|
|
271
|
+
}
|
|
272
|
+
/** A memory a run wants recorded. The author is set by the control plane. */
|
|
273
|
+
interface CodeRuntimeNewMemory {
|
|
274
|
+
subject: string;
|
|
275
|
+
kind: string;
|
|
276
|
+
body: string;
|
|
277
|
+
evidence?: {
|
|
278
|
+
kind: string;
|
|
279
|
+
ref: string;
|
|
280
|
+
};
|
|
281
|
+
/** Idempotency key, so a retried write records once. */
|
|
282
|
+
mutationId: string;
|
|
283
|
+
}
|
|
249
284
|
/** Untrusted candidate material available only to the independent review route. */
|
|
250
285
|
interface CodeRuntimeReviewRequest {
|
|
251
286
|
patch: string;
|
|
@@ -687,6 +722,164 @@ interface CodeRuntimeInferenceOptions {
|
|
|
687
722
|
*/
|
|
688
723
|
declare function createCodeRuntimeInference(options: CodeRuntimeInferenceOptions): Inference;
|
|
689
724
|
|
|
725
|
+
/** What kind of thing was learned. */
|
|
726
|
+
type CodeMemoryKind =
|
|
727
|
+
/** An approach that failed, and what the gate said about it. */
|
|
728
|
+
"hazard"
|
|
729
|
+
/** Something true of this codebase that reading it does not reveal. */
|
|
730
|
+
| "invariant"
|
|
731
|
+
/** What a goal actually achieved, judged by a verifier rather than claimed. */
|
|
732
|
+
| "outcome"
|
|
733
|
+
/** Everything else worth carrying forward. */
|
|
734
|
+
| "note";
|
|
735
|
+
/**
|
|
736
|
+
* What produced a memory.
|
|
737
|
+
*
|
|
738
|
+
* This field is what stops a shared store becoming a rumour mill. An agent that
|
|
739
|
+
* can write unfalsifiable claims into memory poisons every run that follows, so
|
|
740
|
+
* a finding carries the thing that produced it and a bare assertion is visibly
|
|
741
|
+
* a lesser class of claim.
|
|
742
|
+
*/
|
|
743
|
+
interface CodeMemoryEvidence {
|
|
744
|
+
kind: "gate" | "receipt" | "human";
|
|
745
|
+
/** A verification id, a receipt digest, or a person. */
|
|
746
|
+
ref: string;
|
|
747
|
+
}
|
|
748
|
+
/** One thing the agent learned about this codebase. */
|
|
749
|
+
interface CodeMemory {
|
|
750
|
+
id: string;
|
|
751
|
+
/** A graph node id — `file:src/a.ts`, `table:orders`, `symbol:runAgent`. */
|
|
752
|
+
subject: string;
|
|
753
|
+
kind: CodeMemoryKind;
|
|
754
|
+
body: string;
|
|
755
|
+
evidence?: CodeMemoryEvidence;
|
|
756
|
+
/** Principal that recorded it. Attributed, never authenticated — see PM. */
|
|
757
|
+
authorId: string;
|
|
758
|
+
createdAt: number;
|
|
759
|
+
/** Set when a later memory contradicts this one. */
|
|
760
|
+
supersededBy?: string;
|
|
761
|
+
}
|
|
762
|
+
/** A memory before it has an id or a timestamp. */
|
|
763
|
+
type NewCodeMemory = Omit<CodeMemory, "id" | "createdAt">;
|
|
764
|
+
/**
|
|
765
|
+
* Where memories live.
|
|
766
|
+
*
|
|
767
|
+
* An interface rather than a database, because a Code host holds no tenant
|
|
768
|
+
* credential — the same reason inference is brokered. The control plane
|
|
769
|
+
* supplies the implementation; the agent only ever sees this.
|
|
770
|
+
*/
|
|
771
|
+
interface CodeMemoryStore {
|
|
772
|
+
/** Memories about any of these subjects, newest first. */
|
|
773
|
+
recall(subjects: readonly string[], limit: number): Promise<CodeMemory[]>;
|
|
774
|
+
remember(memory: NewCodeMemory): Promise<CodeMemory>;
|
|
775
|
+
}
|
|
776
|
+
/** Longest body worth storing. A memory is a lesson, not a transcript. */
|
|
777
|
+
declare const MAX_MEMORY_BODY = 4000;
|
|
778
|
+
/** Reject a memory that would be useless or unbounded before it is stored. */
|
|
779
|
+
declare function validateMemory(memory: NewCodeMemory): void;
|
|
780
|
+
/** How wide to cast when gathering what is known about some subjects. */
|
|
781
|
+
interface RecallOptions {
|
|
782
|
+
/**
|
|
783
|
+
* Also recall memories about what the subjects reach.
|
|
784
|
+
*
|
|
785
|
+
* A hazard recorded against a module matters to everything that imports it,
|
|
786
|
+
* and the whole reason subjects are graph ids is that this is one traversal.
|
|
787
|
+
* Off by default: the neighbourhood of a hub is most of the repository.
|
|
788
|
+
*/
|
|
789
|
+
graph?: Graph;
|
|
790
|
+
/** Edge kinds to spread across when `graph` is given. */
|
|
791
|
+
kinds?: readonly string[];
|
|
792
|
+
/** How far to spread. Default 1 — direct neighbours only. */
|
|
793
|
+
depth?: number;
|
|
794
|
+
/** Cap on returned memories. Default 20. */
|
|
795
|
+
limit?: number;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Gather what is known about some subjects, optionally including their
|
|
799
|
+
* neighbourhood.
|
|
800
|
+
*
|
|
801
|
+
* Superseded memories are dropped. Keeping them would mean the agent reads a
|
|
802
|
+
* correction and its own contradiction in the same breath, and has to guess
|
|
803
|
+
* which is current — which is worse than not remembering at all.
|
|
804
|
+
*/
|
|
805
|
+
declare function recallAbout(store: CodeMemoryStore, subjects: readonly string[], options?: RecallOptions): Promise<CodeMemory[]>;
|
|
806
|
+
/** Render memories for a prompt — the cheapest form that still says enough. */
|
|
807
|
+
declare function renderMemories(memories: readonly CodeMemory[]): string;
|
|
808
|
+
/**
|
|
809
|
+
* Turn a failed attempt into something the next run does not have to pay for.
|
|
810
|
+
*
|
|
811
|
+
* This is the write that justifies the store. The gate's verdict is the most
|
|
812
|
+
* expensive knowledge a run produces — it cost a whole attempt — and until now
|
|
813
|
+
* it was dropped the moment the next prompt was built.
|
|
814
|
+
*
|
|
815
|
+
* Recorded against the files the attempt actually touched, so it surfaces to
|
|
816
|
+
* whoever works on them next rather than being filed under the goal, which
|
|
817
|
+
* nobody will ever search for.
|
|
818
|
+
*/
|
|
819
|
+
declare function hazardFromAttempt(input: {
|
|
820
|
+
goal: string;
|
|
821
|
+
attempt: number;
|
|
822
|
+
feedback: string;
|
|
823
|
+
touched: readonly string[];
|
|
824
|
+
verificationId: string;
|
|
825
|
+
authorId: string;
|
|
826
|
+
}): NewCodeMemory[];
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Present a session's brokered memory as a store, or null when the control
|
|
830
|
+
* plane does not offer one.
|
|
831
|
+
*
|
|
832
|
+
* Null rather than a throwing stub: a Code host talking to a registry that
|
|
833
|
+
* predates memory should quietly lose the feature, not fail every goal that
|
|
834
|
+
* would have recorded something.
|
|
835
|
+
*/
|
|
836
|
+
declare function runtimeMemoryStore(control: CodeRuntimeAgentControlPlane, sessionId: string): CodeMemoryStore | null;
|
|
837
|
+
|
|
838
|
+
/** What a run actually did, judged rather than claimed. */
|
|
839
|
+
interface GoalOutcome {
|
|
840
|
+
/** The PM entity this goal came from, when it came from one. */
|
|
841
|
+
pmEntityId?: string;
|
|
842
|
+
goal: string;
|
|
843
|
+
/** How the goal said it would be judged. */
|
|
844
|
+
proof: string;
|
|
845
|
+
/** Whether the clean verifier agreed. */
|
|
846
|
+
met: boolean;
|
|
847
|
+
/** Why it stopped — `proof_passed`, or the budget that ran out. */
|
|
848
|
+
stoppedReason: string;
|
|
849
|
+
attempts: number;
|
|
850
|
+
tokens: number;
|
|
851
|
+
costUsd?: number;
|
|
852
|
+
/** The receipt that backs a met verdict. Absent means nothing backs it. */
|
|
853
|
+
evidence?: CodeMemoryEvidence;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Whether an outcome may move a PM item to done.
|
|
857
|
+
*
|
|
858
|
+
* Two conditions, and the second is the one that matters: the verifier agreed,
|
|
859
|
+
* AND it left a receipt. A `met` with no evidence is an agent's assertion
|
|
860
|
+
* wearing a verdict's clothes, and admitting it would make the whole audit
|
|
861
|
+
* trail decorative.
|
|
862
|
+
*/
|
|
863
|
+
declare function outcomeCloses(outcome: GoalOutcome): boolean;
|
|
864
|
+
/**
|
|
865
|
+
* Say plainly what happened, for the PM comment that records it.
|
|
866
|
+
*
|
|
867
|
+
* Written for a human deciding whether to trust the result, so the numbers that
|
|
868
|
+
* bound the claim — attempts, tokens, cost — are in the sentence rather than in
|
|
869
|
+
* a linked artifact nobody opens. Unknown cost is said as unknown; reporting
|
|
870
|
+
* $0.00 for a run whose pricing was unavailable would be a lie in the direction
|
|
871
|
+
* that flatters the agent.
|
|
872
|
+
*/
|
|
873
|
+
declare function renderOutcome(outcome: GoalOutcome): string;
|
|
874
|
+
/**
|
|
875
|
+
* Record the outcome as a memory, so the next run knows what this one settled.
|
|
876
|
+
*
|
|
877
|
+
* Filed against the goal's subject rather than a file: an outcome is about an
|
|
878
|
+
* intention, and the useful question later is "has anyone tried this before",
|
|
879
|
+
* not "what happened to line 40".
|
|
880
|
+
*/
|
|
881
|
+
declare function outcomeMemory(outcome: GoalOutcome, subject: string, authorId: string): NewCodeMemory;
|
|
882
|
+
|
|
690
883
|
/** Everything the runner learns from one attempt. */
|
|
691
884
|
interface GoalAttemptOutcome {
|
|
692
885
|
/** Did the goal's proof pass on the resulting tree? */
|
|
@@ -1122,4 +1315,4 @@ interface CodeVerificationEvidence {
|
|
|
1122
1315
|
/** Rebuild a candidate from an exact trusted base and emit a prose-free clean-verifier receipt. */
|
|
1123
1316
|
declare function verifyCodeCandidate(input: VerifyCodeCandidateInput): Promise<CodeVerificationEvidence>;
|
|
1124
1317
|
|
|
1125
|
-
export { CODE_RUNTIME_PROTOCOL_VERSION, type CodeAgentAttemptOptions, type CodeAgentAttemptResult, type CodeAgentRun, 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 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 GoalRun, type GoalRunSpec, type GoalStoppedReason, type GoalStrategy, type HarnessRunnerOptions, type IntegrateOptions, type IntegrationStep, MEASURED_PREMIUM, type MaterializedCodeSource, type MaterializedGitTree, type PrepareRuntimeCheckpointInput, type PreparedRuntimeCheckpoint, type RacedAttemptOptions, type RacedOutcome, 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, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, patchPaths, planReachCollisions, prepareRuntimeCheckpoint, racedAttempt, registeredFiles, resolveCodePath, restoreCodeWorkspaceCheckpoint, runCodeAgent, runCodeAgentAttempt, runCodeRuntimeHeartbeatLoop, runContainerAttempt, runGoal, runHarnessRunner, runLeasedAttempt, safeWorkspaceLabel, selectContainerEngine, selectWinner, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withRecipeDependencies };
|
|
1318
|
+
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, type CodeRuntimeMemory, type CodeRuntimeNewMemory, 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, runtimeMemoryStore, safeWorkspaceLabel, selectContainerEngine, selectWinner, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateMemory, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withRecipeDependencies };
|
package/dist/node.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { r as HarnessTaskSpec, g as HarnessAgentOutput, f as HarnessAgentInput,
|
|
|
2
2
|
import { CodePortableCheckpoint, CodeSourceFile, CodeVerificationReceipt, CodeCheckpointState } from '@odla-ai/camel/code';
|
|
3
3
|
import { Skill, Inference, AgentRunBudget, AgentRun, CompactionPolicy } from '@odla-ai/ai';
|
|
4
4
|
import { PolicyOutcome } from '@odla-ai/camel/policy';
|
|
5
|
-
import { PartitionVerdict } from '@odla-ai/graph';
|
|
5
|
+
import { Graph, PartitionVerdict } from '@odla-ai/graph';
|
|
6
6
|
|
|
7
7
|
/** Supported command-line container engines for isolated harness attempts. */
|
|
8
8
|
type ContainerEngine = "container" | "podman" | "docker";
|
|
@@ -243,9 +243,44 @@ interface CodeRuntimeAgentControlPlane extends CodeRuntimeControlPlane {
|
|
|
243
243
|
infer(sessionId: string, request: HarnessInferenceRequest): Promise<HarnessInferenceResponse>;
|
|
244
244
|
review(sessionId: string, request: CodeRuntimeReviewRequest): Promise<CodeRuntimeReviewResponse>;
|
|
245
245
|
submitCandidate(sessionId: string, checkpointId: string, verification: CodeVerificationReceipt): Promise<CodeRuntimeCandidateResponse>;
|
|
246
|
+
/**
|
|
247
|
+
* Agent memory, brokered like inference is.
|
|
248
|
+
*
|
|
249
|
+
* Optional so an older control plane still satisfies the interface — a Code
|
|
250
|
+
* host talking to a registry that predates memory should lose the feature,
|
|
251
|
+
* not the session.
|
|
252
|
+
*/
|
|
253
|
+
recallMemories?(sessionId: string, subjects: readonly string[], limit: number): Promise<CodeRuntimeMemory[]>;
|
|
254
|
+
rememberMemory?(sessionId: string, memory: CodeRuntimeNewMemory): Promise<void>;
|
|
246
255
|
appendSessionEvent(sessionId: string, eventId: string, event: CodeSessionEventData): Promise<void>;
|
|
247
256
|
reportSessionFailure(sessionId: string, message: string): Promise<void>;
|
|
248
257
|
}
|
|
258
|
+
/** One memory as the control plane returns it. */
|
|
259
|
+
interface CodeRuntimeMemory {
|
|
260
|
+
id: string;
|
|
261
|
+
subject: string;
|
|
262
|
+
kind: string;
|
|
263
|
+
body: string;
|
|
264
|
+
evidence?: {
|
|
265
|
+
kind: string;
|
|
266
|
+
ref: string;
|
|
267
|
+
};
|
|
268
|
+
authorId: string;
|
|
269
|
+
createdAt: number;
|
|
270
|
+
supersededBy?: string;
|
|
271
|
+
}
|
|
272
|
+
/** A memory a run wants recorded. The author is set by the control plane. */
|
|
273
|
+
interface CodeRuntimeNewMemory {
|
|
274
|
+
subject: string;
|
|
275
|
+
kind: string;
|
|
276
|
+
body: string;
|
|
277
|
+
evidence?: {
|
|
278
|
+
kind: string;
|
|
279
|
+
ref: string;
|
|
280
|
+
};
|
|
281
|
+
/** Idempotency key, so a retried write records once. */
|
|
282
|
+
mutationId: string;
|
|
283
|
+
}
|
|
249
284
|
/** Untrusted candidate material available only to the independent review route. */
|
|
250
285
|
interface CodeRuntimeReviewRequest {
|
|
251
286
|
patch: string;
|
|
@@ -687,6 +722,164 @@ interface CodeRuntimeInferenceOptions {
|
|
|
687
722
|
*/
|
|
688
723
|
declare function createCodeRuntimeInference(options: CodeRuntimeInferenceOptions): Inference;
|
|
689
724
|
|
|
725
|
+
/** What kind of thing was learned. */
|
|
726
|
+
type CodeMemoryKind =
|
|
727
|
+
/** An approach that failed, and what the gate said about it. */
|
|
728
|
+
"hazard"
|
|
729
|
+
/** Something true of this codebase that reading it does not reveal. */
|
|
730
|
+
| "invariant"
|
|
731
|
+
/** What a goal actually achieved, judged by a verifier rather than claimed. */
|
|
732
|
+
| "outcome"
|
|
733
|
+
/** Everything else worth carrying forward. */
|
|
734
|
+
| "note";
|
|
735
|
+
/**
|
|
736
|
+
* What produced a memory.
|
|
737
|
+
*
|
|
738
|
+
* This field is what stops a shared store becoming a rumour mill. An agent that
|
|
739
|
+
* can write unfalsifiable claims into memory poisons every run that follows, so
|
|
740
|
+
* a finding carries the thing that produced it and a bare assertion is visibly
|
|
741
|
+
* a lesser class of claim.
|
|
742
|
+
*/
|
|
743
|
+
interface CodeMemoryEvidence {
|
|
744
|
+
kind: "gate" | "receipt" | "human";
|
|
745
|
+
/** A verification id, a receipt digest, or a person. */
|
|
746
|
+
ref: string;
|
|
747
|
+
}
|
|
748
|
+
/** One thing the agent learned about this codebase. */
|
|
749
|
+
interface CodeMemory {
|
|
750
|
+
id: string;
|
|
751
|
+
/** A graph node id — `file:src/a.ts`, `table:orders`, `symbol:runAgent`. */
|
|
752
|
+
subject: string;
|
|
753
|
+
kind: CodeMemoryKind;
|
|
754
|
+
body: string;
|
|
755
|
+
evidence?: CodeMemoryEvidence;
|
|
756
|
+
/** Principal that recorded it. Attributed, never authenticated — see PM. */
|
|
757
|
+
authorId: string;
|
|
758
|
+
createdAt: number;
|
|
759
|
+
/** Set when a later memory contradicts this one. */
|
|
760
|
+
supersededBy?: string;
|
|
761
|
+
}
|
|
762
|
+
/** A memory before it has an id or a timestamp. */
|
|
763
|
+
type NewCodeMemory = Omit<CodeMemory, "id" | "createdAt">;
|
|
764
|
+
/**
|
|
765
|
+
* Where memories live.
|
|
766
|
+
*
|
|
767
|
+
* An interface rather than a database, because a Code host holds no tenant
|
|
768
|
+
* credential — the same reason inference is brokered. The control plane
|
|
769
|
+
* supplies the implementation; the agent only ever sees this.
|
|
770
|
+
*/
|
|
771
|
+
interface CodeMemoryStore {
|
|
772
|
+
/** Memories about any of these subjects, newest first. */
|
|
773
|
+
recall(subjects: readonly string[], limit: number): Promise<CodeMemory[]>;
|
|
774
|
+
remember(memory: NewCodeMemory): Promise<CodeMemory>;
|
|
775
|
+
}
|
|
776
|
+
/** Longest body worth storing. A memory is a lesson, not a transcript. */
|
|
777
|
+
declare const MAX_MEMORY_BODY = 4000;
|
|
778
|
+
/** Reject a memory that would be useless or unbounded before it is stored. */
|
|
779
|
+
declare function validateMemory(memory: NewCodeMemory): void;
|
|
780
|
+
/** How wide to cast when gathering what is known about some subjects. */
|
|
781
|
+
interface RecallOptions {
|
|
782
|
+
/**
|
|
783
|
+
* Also recall memories about what the subjects reach.
|
|
784
|
+
*
|
|
785
|
+
* A hazard recorded against a module matters to everything that imports it,
|
|
786
|
+
* and the whole reason subjects are graph ids is that this is one traversal.
|
|
787
|
+
* Off by default: the neighbourhood of a hub is most of the repository.
|
|
788
|
+
*/
|
|
789
|
+
graph?: Graph;
|
|
790
|
+
/** Edge kinds to spread across when `graph` is given. */
|
|
791
|
+
kinds?: readonly string[];
|
|
792
|
+
/** How far to spread. Default 1 — direct neighbours only. */
|
|
793
|
+
depth?: number;
|
|
794
|
+
/** Cap on returned memories. Default 20. */
|
|
795
|
+
limit?: number;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Gather what is known about some subjects, optionally including their
|
|
799
|
+
* neighbourhood.
|
|
800
|
+
*
|
|
801
|
+
* Superseded memories are dropped. Keeping them would mean the agent reads a
|
|
802
|
+
* correction and its own contradiction in the same breath, and has to guess
|
|
803
|
+
* which is current — which is worse than not remembering at all.
|
|
804
|
+
*/
|
|
805
|
+
declare function recallAbout(store: CodeMemoryStore, subjects: readonly string[], options?: RecallOptions): Promise<CodeMemory[]>;
|
|
806
|
+
/** Render memories for a prompt — the cheapest form that still says enough. */
|
|
807
|
+
declare function renderMemories(memories: readonly CodeMemory[]): string;
|
|
808
|
+
/**
|
|
809
|
+
* Turn a failed attempt into something the next run does not have to pay for.
|
|
810
|
+
*
|
|
811
|
+
* This is the write that justifies the store. The gate's verdict is the most
|
|
812
|
+
* expensive knowledge a run produces — it cost a whole attempt — and until now
|
|
813
|
+
* it was dropped the moment the next prompt was built.
|
|
814
|
+
*
|
|
815
|
+
* Recorded against the files the attempt actually touched, so it surfaces to
|
|
816
|
+
* whoever works on them next rather than being filed under the goal, which
|
|
817
|
+
* nobody will ever search for.
|
|
818
|
+
*/
|
|
819
|
+
declare function hazardFromAttempt(input: {
|
|
820
|
+
goal: string;
|
|
821
|
+
attempt: number;
|
|
822
|
+
feedback: string;
|
|
823
|
+
touched: readonly string[];
|
|
824
|
+
verificationId: string;
|
|
825
|
+
authorId: string;
|
|
826
|
+
}): NewCodeMemory[];
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Present a session's brokered memory as a store, or null when the control
|
|
830
|
+
* plane does not offer one.
|
|
831
|
+
*
|
|
832
|
+
* Null rather than a throwing stub: a Code host talking to a registry that
|
|
833
|
+
* predates memory should quietly lose the feature, not fail every goal that
|
|
834
|
+
* would have recorded something.
|
|
835
|
+
*/
|
|
836
|
+
declare function runtimeMemoryStore(control: CodeRuntimeAgentControlPlane, sessionId: string): CodeMemoryStore | null;
|
|
837
|
+
|
|
838
|
+
/** What a run actually did, judged rather than claimed. */
|
|
839
|
+
interface GoalOutcome {
|
|
840
|
+
/** The PM entity this goal came from, when it came from one. */
|
|
841
|
+
pmEntityId?: string;
|
|
842
|
+
goal: string;
|
|
843
|
+
/** How the goal said it would be judged. */
|
|
844
|
+
proof: string;
|
|
845
|
+
/** Whether the clean verifier agreed. */
|
|
846
|
+
met: boolean;
|
|
847
|
+
/** Why it stopped — `proof_passed`, or the budget that ran out. */
|
|
848
|
+
stoppedReason: string;
|
|
849
|
+
attempts: number;
|
|
850
|
+
tokens: number;
|
|
851
|
+
costUsd?: number;
|
|
852
|
+
/** The receipt that backs a met verdict. Absent means nothing backs it. */
|
|
853
|
+
evidence?: CodeMemoryEvidence;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Whether an outcome may move a PM item to done.
|
|
857
|
+
*
|
|
858
|
+
* Two conditions, and the second is the one that matters: the verifier agreed,
|
|
859
|
+
* AND it left a receipt. A `met` with no evidence is an agent's assertion
|
|
860
|
+
* wearing a verdict's clothes, and admitting it would make the whole audit
|
|
861
|
+
* trail decorative.
|
|
862
|
+
*/
|
|
863
|
+
declare function outcomeCloses(outcome: GoalOutcome): boolean;
|
|
864
|
+
/**
|
|
865
|
+
* Say plainly what happened, for the PM comment that records it.
|
|
866
|
+
*
|
|
867
|
+
* Written for a human deciding whether to trust the result, so the numbers that
|
|
868
|
+
* bound the claim — attempts, tokens, cost — are in the sentence rather than in
|
|
869
|
+
* a linked artifact nobody opens. Unknown cost is said as unknown; reporting
|
|
870
|
+
* $0.00 for a run whose pricing was unavailable would be a lie in the direction
|
|
871
|
+
* that flatters the agent.
|
|
872
|
+
*/
|
|
873
|
+
declare function renderOutcome(outcome: GoalOutcome): string;
|
|
874
|
+
/**
|
|
875
|
+
* Record the outcome as a memory, so the next run knows what this one settled.
|
|
876
|
+
*
|
|
877
|
+
* Filed against the goal's subject rather than a file: an outcome is about an
|
|
878
|
+
* intention, and the useful question later is "has anyone tried this before",
|
|
879
|
+
* not "what happened to line 40".
|
|
880
|
+
*/
|
|
881
|
+
declare function outcomeMemory(outcome: GoalOutcome, subject: string, authorId: string): NewCodeMemory;
|
|
882
|
+
|
|
690
883
|
/** Everything the runner learns from one attempt. */
|
|
691
884
|
interface GoalAttemptOutcome {
|
|
692
885
|
/** Did the goal's proof pass on the resulting tree? */
|
|
@@ -1122,4 +1315,4 @@ interface CodeVerificationEvidence {
|
|
|
1122
1315
|
/** Rebuild a candidate from an exact trusted base and emit a prose-free clean-verifier receipt. */
|
|
1123
1316
|
declare function verifyCodeCandidate(input: VerifyCodeCandidateInput): Promise<CodeVerificationEvidence>;
|
|
1124
1317
|
|
|
1125
|
-
export { CODE_RUNTIME_PROTOCOL_VERSION, type CodeAgentAttemptOptions, type CodeAgentAttemptResult, type CodeAgentRun, 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 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 GoalRun, type GoalRunSpec, type GoalStoppedReason, type GoalStrategy, type HarnessRunnerOptions, type IntegrateOptions, type IntegrationStep, MEASURED_PREMIUM, type MaterializedCodeSource, type MaterializedGitTree, type PrepareRuntimeCheckpointInput, type PreparedRuntimeCheckpoint, type RacedAttemptOptions, type RacedOutcome, 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, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, patchPaths, planReachCollisions, prepareRuntimeCheckpoint, racedAttempt, registeredFiles, resolveCodePath, restoreCodeWorkspaceCheckpoint, runCodeAgent, runCodeAgentAttempt, runCodeRuntimeHeartbeatLoop, runContainerAttempt, runGoal, runHarnessRunner, runLeasedAttempt, safeWorkspaceLabel, selectContainerEngine, selectWinner, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withRecipeDependencies };
|
|
1318
|
+
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, type CodeRuntimeMemory, type CodeRuntimeNewMemory, 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, runtimeMemoryStore, safeWorkspaceLabel, selectContainerEngine, selectWinner, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateMemory, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withRecipeDependencies };
|
package/dist/node.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
CodeRuntimeCheckpointManager,
|
|
9
9
|
CodeRuntimeControlError,
|
|
10
10
|
CodeRuntimeReconciler,
|
|
11
|
+
MAX_MEMORY_BODY,
|
|
11
12
|
SYSTEM_PROMPT_FOR,
|
|
12
13
|
V1_SYSTEM_PROMPT,
|
|
13
14
|
V2_SYSTEM_PROMPT,
|
|
@@ -24,11 +25,14 @@ import {
|
|
|
24
25
|
createContainerRecipeExecutor,
|
|
25
26
|
describePatchFailure,
|
|
26
27
|
digestStagedWorkspace,
|
|
28
|
+
hazardFromAttempt,
|
|
27
29
|
isCheckpointEffectCompleted,
|
|
28
30
|
materializeCodeRuntimeSource,
|
|
29
31
|
materializeCommandWorkspace,
|
|
30
32
|
prepareRuntimeCheckpoint,
|
|
33
|
+
recallAbout,
|
|
31
34
|
registeredFiles,
|
|
35
|
+
renderMemories,
|
|
32
36
|
resolveCodePath,
|
|
33
37
|
restoreCodeWorkspaceCheckpoint,
|
|
34
38
|
runCodeAgent,
|
|
@@ -37,9 +41,10 @@ import {
|
|
|
37
41
|
runGoal,
|
|
38
42
|
stripPatchEnvelope,
|
|
39
43
|
validateCodePatch,
|
|
44
|
+
validateMemory,
|
|
40
45
|
validateRelativePath,
|
|
41
46
|
verifyCodeCandidate
|
|
42
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-ANNX7VGK.js";
|
|
43
48
|
import {
|
|
44
49
|
assertPinnedImage,
|
|
45
50
|
buildContainerRunArgs,
|
|
@@ -54,6 +59,56 @@ import {
|
|
|
54
59
|
import "./chunk-C5VQI2IF.js";
|
|
55
60
|
import "./chunk-3QP4VDQS.js";
|
|
56
61
|
|
|
62
|
+
// src/code-runtime-memory.ts
|
|
63
|
+
async function mutationId(memory) {
|
|
64
|
+
const source = `${memory.subject} ${memory.kind} ${memory.body}`;
|
|
65
|
+
const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(source));
|
|
66
|
+
return Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 40);
|
|
67
|
+
}
|
|
68
|
+
function runtimeMemoryStore(control, sessionId) {
|
|
69
|
+
const recall = control.recallMemories;
|
|
70
|
+
const remember = control.rememberMemory;
|
|
71
|
+
if (!recall || !remember) return null;
|
|
72
|
+
return {
|
|
73
|
+
recall: async (subjects, limit) => await recall.call(control, sessionId, subjects, limit),
|
|
74
|
+
remember: async (memory) => {
|
|
75
|
+
await remember.call(control, sessionId, {
|
|
76
|
+
subject: memory.subject,
|
|
77
|
+
kind: memory.kind,
|
|
78
|
+
body: memory.body,
|
|
79
|
+
...memory.evidence ? { evidence: memory.evidence } : {},
|
|
80
|
+
mutationId: await mutationId(memory)
|
|
81
|
+
});
|
|
82
|
+
return { ...memory, id: "", createdAt: Date.now() };
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/code-goal-outcome.ts
|
|
88
|
+
function outcomeCloses(outcome) {
|
|
89
|
+
return outcome.met && outcome.evidence !== void 0;
|
|
90
|
+
}
|
|
91
|
+
function renderOutcome(outcome) {
|
|
92
|
+
const spend = outcome.costUsd === void 0 ? "cost unknown" : `$${outcome.costUsd.toFixed(4)}`;
|
|
93
|
+
const scale = `${outcome.attempts} attempt(s), ${outcome.tokens.toLocaleString()} tokens, ${spend}`;
|
|
94
|
+
if (!outcome.met) {
|
|
95
|
+
return `Goal not met (${outcome.stoppedReason}) after ${scale}. Proof: ${outcome.proof}`;
|
|
96
|
+
}
|
|
97
|
+
if (!outcome.evidence) {
|
|
98
|
+
return `Goal reported met after ${scale}, but no verification receipt was produced. Treat as unverified. Proof: ${outcome.proof}`;
|
|
99
|
+
}
|
|
100
|
+
return `Goal met after ${scale}. Verified by ${outcome.evidence.kind}:${outcome.evidence.ref}. Proof: ${outcome.proof}`;
|
|
101
|
+
}
|
|
102
|
+
function outcomeMemory(outcome, subject, authorId) {
|
|
103
|
+
return {
|
|
104
|
+
subject,
|
|
105
|
+
kind: "outcome",
|
|
106
|
+
body: renderOutcome(outcome),
|
|
107
|
+
...outcome.evidence ? { evidence: outcome.evidence } : {},
|
|
108
|
+
authorId
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
57
112
|
// src/code-goal-race.ts
|
|
58
113
|
function selectWinner(outcomes) {
|
|
59
114
|
const ranked = [...outcomes].sort((left, right) => {
|
|
@@ -311,6 +366,7 @@ export {
|
|
|
311
366
|
CodeRuntimeControlError,
|
|
312
367
|
CodeRuntimeReconciler,
|
|
313
368
|
DecompositionError,
|
|
369
|
+
MAX_MEMORY_BODY,
|
|
314
370
|
MEASURED_PREMIUM,
|
|
315
371
|
SYSTEM_PROMPT_FOR,
|
|
316
372
|
V1_SYSTEM_PROMPT,
|
|
@@ -333,17 +389,23 @@ export {
|
|
|
333
389
|
describePatchFailure,
|
|
334
390
|
digestStagedWorkspace,
|
|
335
391
|
feedbackIsActionable,
|
|
392
|
+
hazardFromAttempt,
|
|
336
393
|
installedDependencies,
|
|
337
394
|
integrateSubGoals,
|
|
338
395
|
isCheckpointEffectCompleted,
|
|
339
396
|
materializeCodeRuntimeSource,
|
|
340
397
|
materializeCommandWorkspace,
|
|
341
398
|
materializeGitTree,
|
|
399
|
+
outcomeCloses,
|
|
400
|
+
outcomeMemory,
|
|
342
401
|
patchPaths,
|
|
343
402
|
planReachCollisions,
|
|
344
403
|
prepareRuntimeCheckpoint,
|
|
345
404
|
racedAttempt,
|
|
405
|
+
recallAbout,
|
|
346
406
|
registeredFiles,
|
|
407
|
+
renderMemories,
|
|
408
|
+
renderOutcome,
|
|
347
409
|
resolveCodePath,
|
|
348
410
|
restoreCodeWorkspaceCheckpoint,
|
|
349
411
|
runCodeAgent,
|
|
@@ -353,6 +415,7 @@ export {
|
|
|
353
415
|
runGoal,
|
|
354
416
|
runHarnessRunner,
|
|
355
417
|
runLeasedAttempt,
|
|
418
|
+
runtimeMemoryStore,
|
|
356
419
|
safeWorkspaceLabel,
|
|
357
420
|
selectContainerEngine,
|
|
358
421
|
selectWinner,
|
|
@@ -361,6 +424,7 @@ export {
|
|
|
361
424
|
straySubGoalFiles,
|
|
362
425
|
stripPatchEnvelope,
|
|
363
426
|
validateCodePatch,
|
|
427
|
+
validateMemory,
|
|
364
428
|
validateRelativePath,
|
|
365
429
|
verifyCodeCandidate,
|
|
366
430
|
verifyContainerEngineBoundary,
|