@odla-ai/harness 0.11.8 → 0.11.10
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-NUDKRYL4.js → chunk-4IGSN53G.js} +22 -6
- package/dist/chunk-4IGSN53G.js.map +1 -0
- package/dist/code-runtime-cli.cjs +20 -5
- package/dist/code-runtime-cli.cjs.map +1 -1
- package/dist/code-runtime-cli.js +1 -1
- package/dist/node.cjs +125 -9
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +65 -30
- package/dist/node.d.ts +65 -30
- package/dist/node.js +97 -1
- package/dist/node.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-NUDKRYL4.js.map +0 -1
package/dist/node.d.cts
CHANGED
|
@@ -596,6 +596,34 @@ interface CodeToolBrokerOptions {
|
|
|
596
596
|
onDecision?(decision: CodeToolDecision): Promise<void> | void;
|
|
597
597
|
}
|
|
598
598
|
|
|
599
|
+
/**
|
|
600
|
+
* An installed dependency tree lent to a recipe for the length of one run.
|
|
601
|
+
*
|
|
602
|
+
* Mounted under a reserved name and removed in a finally, so the agent can run
|
|
603
|
+
* a real build without the tree ever being addressable by a patch.
|
|
604
|
+
*/
|
|
605
|
+
interface RecipeDependencies {
|
|
606
|
+
/** Absolute path to an installed dependency tree on the host. */
|
|
607
|
+
source: string;
|
|
608
|
+
/** Where it appears inside the workspace. Must be a reserved name, so the
|
|
609
|
+
* agent still cannot address it. */
|
|
610
|
+
mountAs?: string;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Wrap an executor so `dependencies.source` is present during each recipe run.
|
|
614
|
+
*
|
|
615
|
+
* It is linked, not copied. A link costs nothing per run, and dependencies are
|
|
616
|
+
* identical across every attempt, racer and verification — copying them would
|
|
617
|
+
* multiply the largest thing in the tree by the number of stages.
|
|
618
|
+
*
|
|
619
|
+
* The link is removed in a `finally`, so a recipe that times out or throws
|
|
620
|
+
* cannot leave it behind for `workspace.patch()` to diff or
|
|
621
|
+
* `digestStagedWorkspace` to hash.
|
|
622
|
+
*/
|
|
623
|
+
declare function withRecipeDependencies(executor: CodeRecipeExecutor, dependencies: RecipeDependencies): CodeRecipeExecutor;
|
|
624
|
+
/** Resolve the dependency tree for a repository root, when it has one. */
|
|
625
|
+
declare function installedDependencies(repoRoot: string): Promise<RecipeDependencies | null>;
|
|
626
|
+
|
|
599
627
|
/** The file at a repository's root that declares its verification recipes. */
|
|
600
628
|
declare const REPOSITORY_RECIPES_FILE = "odla.recipes.json";
|
|
601
629
|
/** The release-owned execution envelope every repository-declared recipe runs in.
|
|
@@ -682,6 +710,9 @@ interface TheseusRuntimeEngineOptions {
|
|
|
682
710
|
/** Injectable agent attempt. Defaults to runAgent over the brokered surface. */
|
|
683
711
|
runAgentAttempt?: (options: CodeAgentAttemptOptions) => Promise<CodeAgentAttemptResult>;
|
|
684
712
|
recipeExecutor?: CodeRecipeExecutor;
|
|
713
|
+
/** The host's installed dependency tree, lent read-only to every recipe
|
|
714
|
+
* container so a real test runner can be a proof in an offline sandbox. */
|
|
715
|
+
recipeDependencies?: RecipeDependencies | null;
|
|
685
716
|
/** Owner-visible and terminal-visible bounded runtime failures. */
|
|
686
717
|
onDiagnostic?: (message: string) => void;
|
|
687
718
|
/** Skills the host adds for a session, beyond the sandbox surface.
|
|
@@ -1580,42 +1611,46 @@ declare function describePatchFailure(patch: string, detail: string): string;
|
|
|
1580
1611
|
/** Apply a previously validated patch without invoking a shell or repository hooks. */
|
|
1581
1612
|
declare function applyCodePatch(workspaceDir: string, rawPatch: string, paths: readonly string[]): Promise<void>;
|
|
1582
1613
|
|
|
1583
|
-
/**
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
*/
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
declare function withRecipeDependencies(executor: CodeRecipeExecutor, dependencies: RecipeDependencies): CodeRecipeExecutor;
|
|
1608
|
-
/** Resolve the dependency tree for a repository root, when it has one. */
|
|
1609
|
-
declare function installedDependencies(repoRoot: string): Promise<RecipeDependencies | null>;
|
|
1614
|
+
/** How long one npm ci may take before the cache gives up on it. */
|
|
1615
|
+
declare const DEPENDENCY_INSTALL_TIMEOUT_MS: number;
|
|
1616
|
+
/** What preparing a tree needs: the engine and pinned image, the repository, and the cache root; `run` is injectable for tests. */
|
|
1617
|
+
interface DependencyCacheInput {
|
|
1618
|
+
engine: ContainerEngine;
|
|
1619
|
+
/** The pinned recipe image; its node and npm install the tree. */
|
|
1620
|
+
image: string;
|
|
1621
|
+
repoRoot: string;
|
|
1622
|
+
/** Where trees live: `<cacheRoot>/<key>/node_modules`. */
|
|
1623
|
+
cacheRoot: string;
|
|
1624
|
+
run?: (engine: ContainerEngine, args: string[], name: string, limits: {
|
|
1625
|
+
timeoutMs: number;
|
|
1626
|
+
maxOutputBytes: number;
|
|
1627
|
+
}) => Promise<CodeRecipeResult>;
|
|
1628
|
+
log?: (line: string) => void;
|
|
1629
|
+
}
|
|
1630
|
+
/** The cache key: the lockfile's bytes, the image, and the architecture the container runs. Null without a lockfile. */
|
|
1631
|
+
declare function dependencyCacheKey(repoRoot: string, image: string, arch?: NodeJS.Architecture): Promise<string | null>;
|
|
1632
|
+
/** Copy only what npm ci needs: the root manifests and every workspace's package.json. Returns what was staged. */
|
|
1633
|
+
declare function stageManifests(repoRoot: string, stageDir: string): Promise<string[]>;
|
|
1634
|
+
/** The helper's command: networked, writable stage, scripts disabled, nothing else of the host mounted. */
|
|
1635
|
+
declare function dependencyInstallArgs(engine: ContainerEngine, image: string, stageDir: string, name: string): string[];
|
|
1636
|
+
/** The tree for this repository's lockfile, from the cache or freshly installed; null when there is no lockfile or the install failed. */
|
|
1637
|
+
declare function prepareContainerDependencies(input: DependencyCacheInput): Promise<RecipeDependencies | null>;
|
|
1610
1638
|
|
|
1611
1639
|
/** Every ordinary, policy-legal source path under `root`, sorted. */
|
|
1612
1640
|
declare function registeredFiles(root: string, limit?: number): Promise<string[]>;
|
|
1613
1641
|
|
|
1614
1642
|
/** Build a trusted, fixed command for an isolated and networkless recipe container. */
|
|
1615
|
-
declare function buildRecipeContainerArgs(engine: ContainerEngine, workspaceDir: string, recipe: CodeBuildRecipe, name?: string): string[];
|
|
1643
|
+
declare function buildRecipeContainerArgs(engine: ContainerEngine, workspaceDir: string, recipe: CodeBuildRecipe, name?: string, dependencies?: RecipeDependencies | null): string[];
|
|
1616
1644
|
/** Create a recipe executor that never invokes a shell and never mounts credentials. */
|
|
1617
|
-
declare function createContainerRecipeExecutor(engine: ContainerEngine
|
|
1645
|
+
declare function createContainerRecipeExecutor(engine: ContainerEngine, options?: {
|
|
1646
|
+
dependencies?: RecipeDependencies | null;
|
|
1647
|
+
}): CodeRecipeExecutor;
|
|
1618
1648
|
/** Validate immutable recipe identity, digest image, command, and resource bounds. */
|
|
1619
1649
|
declare function assertCodeBuildRecipe(recipe: CodeBuildRecipe): void;
|
|
1650
|
+
/** Run one container command to completion under an output cap and a timeout, never through a shell. */
|
|
1651
|
+
declare function runContainerCommand(engine: ContainerEngine, args: string[], name: string, recipe: {
|
|
1652
|
+
timeoutMs: number;
|
|
1653
|
+
maxOutputBytes: number;
|
|
1654
|
+
}, signal?: AbortSignal): Promise<CodeRecipeResult>;
|
|
1620
1655
|
|
|
1621
|
-
export { CODE_PATCH_PATH, CODE_RUNTIME_PROTOCOL_VERSION, type CodeAgentAttemptOptions, type CodeAgentAttemptResult, type CodeAgentRun, type CodeBuildRecipe, type CodeExpectedArtifact, type CodeLocalSourceDescriptor, type CodeMemory, type CodeMemoryEvidence, type CodeMemoryKind, type CodeMemoryStore, type CodeRecipeExecutor, type CodeRecipeResult, type CodeRuntimeAgentControlPlane, type CodeRuntimeBinding, type CodeRuntimeCandidateResponse, type CodeRuntimeCapabilities, CodeRuntimeCheckpointManager, type CodeRuntimeClientOptions, type CodeRuntimeCollaborationSkillManifest, type CodeRuntimeCollaborationToolManifest, type CodeRuntimeCollaborationToolRequest, 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 CodeRuntimeSourceArchive, 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, PROOF_RECIPE_PREFIX, type PrepareRuntimeCheckpointInput, type PreparedRuntimeCheckpoint, REPOSITORY_RECIPES_FILE, type RacedAttemptOptions, type RacedOutcome, type RecallOptions, type RecipeDependencies, type RepositoryRecipeEnvelope, type ResolvedCodeRecipes, type RestoreCodeWorkspaceCheckpointInput, type RestoredCodeWorkspaceCheckpoint, type RunCodeAgentOptions, type RuntimeCheckpointSession, SYSTEM_PROMPT_FOR, type StageWorkspaceOptions, type StagedWorkspace, type StrategyChoice, type StrategySignals, type SubGoal, type SubGoalResult, TheseusRuntimeEngine, type TheseusRuntimeEngineOptions, V1_SYSTEM_PROMPT, V2_SYSTEM_PROMPT, V3_SYSTEM_PROMPT, type VerifyCodeCandidateInput, applyCodePatch, applyPatchDialectToDiff, assertCodeBuildRecipe, assertDisjointPlan, assertPinnedImage, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeRuntimeSessionSkillLoader, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, describeCodeRecipes, describeGateFailure, describePatchFailure, digestStagedWorkspace, feedbackIsActionable, hasContextFreeHunk, hazardFromAttempt, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, materializeCodeRuntimeArchive, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, outcomeCloses, outcomeMemory, parseRepositoryRecipes, patchPaths, planReachCollisions, prepareRuntimeCheckpoint, racedAttempt, readOnlyNotice, readRepositoryRecipes, recallAbout, registeredFiles, renderMemories, renderOutcome, resolveCodePath, resolveCodeRecipes, restoreCodeWorkspaceCheckpoint, runCodeAgent, runCodeAgentAttempt, runCodeRuntimeHeartbeatLoop, runContainerAttempt, runGoal, runHarnessRunner, runLeasedAttempt, runtimeMemoryStore, safeWorkspaceLabel, selectContainerEngine, selectWinner, sessionRecipesFor, sessionSkillsFor, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateMemory, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withProofRecipes, withRecipeDependencies };
|
|
1656
|
+
export { CODE_PATCH_PATH, CODE_RUNTIME_PROTOCOL_VERSION, type CodeAgentAttemptOptions, type CodeAgentAttemptResult, type CodeAgentRun, type CodeBuildRecipe, type CodeExpectedArtifact, type CodeLocalSourceDescriptor, type CodeMemory, type CodeMemoryEvidence, type CodeMemoryKind, type CodeMemoryStore, type CodeRecipeExecutor, type CodeRecipeResult, type CodeRuntimeAgentControlPlane, type CodeRuntimeBinding, type CodeRuntimeCandidateResponse, type CodeRuntimeCapabilities, CodeRuntimeCheckpointManager, type CodeRuntimeClientOptions, type CodeRuntimeCollaborationSkillManifest, type CodeRuntimeCollaborationToolManifest, type CodeRuntimeCollaborationToolRequest, 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 CodeRuntimeSourceArchive, 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, DEPENDENCY_INSTALL_TIMEOUT_MS, type DecomposedRun, DecompositionError, type DependencyCacheInput, 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, PROOF_RECIPE_PREFIX, type PrepareRuntimeCheckpointInput, type PreparedRuntimeCheckpoint, REPOSITORY_RECIPES_FILE, type RacedAttemptOptions, type RacedOutcome, type RecallOptions, type RecipeDependencies, type RepositoryRecipeEnvelope, type ResolvedCodeRecipes, type RestoreCodeWorkspaceCheckpointInput, type RestoredCodeWorkspaceCheckpoint, type RunCodeAgentOptions, type RuntimeCheckpointSession, SYSTEM_PROMPT_FOR, type StageWorkspaceOptions, type StagedWorkspace, type StrategyChoice, type StrategySignals, type SubGoal, type SubGoalResult, TheseusRuntimeEngine, type TheseusRuntimeEngineOptions, V1_SYSTEM_PROMPT, V2_SYSTEM_PROMPT, V3_SYSTEM_PROMPT, type VerifyCodeCandidateInput, applyCodePatch, applyPatchDialectToDiff, assertCodeBuildRecipe, assertDisjointPlan, assertPinnedImage, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeRuntimeSessionSkillLoader, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, dependencyCacheKey, dependencyInstallArgs, describeCodeRecipes, describeGateFailure, describePatchFailure, digestStagedWorkspace, feedbackIsActionable, hasContextFreeHunk, hazardFromAttempt, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, materializeCodeRuntimeArchive, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, outcomeCloses, outcomeMemory, parseRepositoryRecipes, patchPaths, planReachCollisions, prepareContainerDependencies, prepareRuntimeCheckpoint, racedAttempt, readOnlyNotice, readRepositoryRecipes, recallAbout, registeredFiles, renderMemories, renderOutcome, resolveCodePath, resolveCodeRecipes, restoreCodeWorkspaceCheckpoint, runCodeAgent, runCodeAgentAttempt, runCodeRuntimeHeartbeatLoop, runContainerAttempt, runContainerCommand, runGoal, runHarnessRunner, runLeasedAttempt, runtimeMemoryStore, safeWorkspaceLabel, selectContainerEngine, selectWinner, sessionRecipesFor, sessionSkillsFor, stageManifests, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateMemory, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withProofRecipes, withRecipeDependencies };
|
package/dist/node.d.ts
CHANGED
|
@@ -596,6 +596,34 @@ interface CodeToolBrokerOptions {
|
|
|
596
596
|
onDecision?(decision: CodeToolDecision): Promise<void> | void;
|
|
597
597
|
}
|
|
598
598
|
|
|
599
|
+
/**
|
|
600
|
+
* An installed dependency tree lent to a recipe for the length of one run.
|
|
601
|
+
*
|
|
602
|
+
* Mounted under a reserved name and removed in a finally, so the agent can run
|
|
603
|
+
* a real build without the tree ever being addressable by a patch.
|
|
604
|
+
*/
|
|
605
|
+
interface RecipeDependencies {
|
|
606
|
+
/** Absolute path to an installed dependency tree on the host. */
|
|
607
|
+
source: string;
|
|
608
|
+
/** Where it appears inside the workspace. Must be a reserved name, so the
|
|
609
|
+
* agent still cannot address it. */
|
|
610
|
+
mountAs?: string;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Wrap an executor so `dependencies.source` is present during each recipe run.
|
|
614
|
+
*
|
|
615
|
+
* It is linked, not copied. A link costs nothing per run, and dependencies are
|
|
616
|
+
* identical across every attempt, racer and verification — copying them would
|
|
617
|
+
* multiply the largest thing in the tree by the number of stages.
|
|
618
|
+
*
|
|
619
|
+
* The link is removed in a `finally`, so a recipe that times out or throws
|
|
620
|
+
* cannot leave it behind for `workspace.patch()` to diff or
|
|
621
|
+
* `digestStagedWorkspace` to hash.
|
|
622
|
+
*/
|
|
623
|
+
declare function withRecipeDependencies(executor: CodeRecipeExecutor, dependencies: RecipeDependencies): CodeRecipeExecutor;
|
|
624
|
+
/** Resolve the dependency tree for a repository root, when it has one. */
|
|
625
|
+
declare function installedDependencies(repoRoot: string): Promise<RecipeDependencies | null>;
|
|
626
|
+
|
|
599
627
|
/** The file at a repository's root that declares its verification recipes. */
|
|
600
628
|
declare const REPOSITORY_RECIPES_FILE = "odla.recipes.json";
|
|
601
629
|
/** The release-owned execution envelope every repository-declared recipe runs in.
|
|
@@ -682,6 +710,9 @@ interface TheseusRuntimeEngineOptions {
|
|
|
682
710
|
/** Injectable agent attempt. Defaults to runAgent over the brokered surface. */
|
|
683
711
|
runAgentAttempt?: (options: CodeAgentAttemptOptions) => Promise<CodeAgentAttemptResult>;
|
|
684
712
|
recipeExecutor?: CodeRecipeExecutor;
|
|
713
|
+
/** The host's installed dependency tree, lent read-only to every recipe
|
|
714
|
+
* container so a real test runner can be a proof in an offline sandbox. */
|
|
715
|
+
recipeDependencies?: RecipeDependencies | null;
|
|
685
716
|
/** Owner-visible and terminal-visible bounded runtime failures. */
|
|
686
717
|
onDiagnostic?: (message: string) => void;
|
|
687
718
|
/** Skills the host adds for a session, beyond the sandbox surface.
|
|
@@ -1580,42 +1611,46 @@ declare function describePatchFailure(patch: string, detail: string): string;
|
|
|
1580
1611
|
/** Apply a previously validated patch without invoking a shell or repository hooks. */
|
|
1581
1612
|
declare function applyCodePatch(workspaceDir: string, rawPatch: string, paths: readonly string[]): Promise<void>;
|
|
1582
1613
|
|
|
1583
|
-
/**
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
*/
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
declare function withRecipeDependencies(executor: CodeRecipeExecutor, dependencies: RecipeDependencies): CodeRecipeExecutor;
|
|
1608
|
-
/** Resolve the dependency tree for a repository root, when it has one. */
|
|
1609
|
-
declare function installedDependencies(repoRoot: string): Promise<RecipeDependencies | null>;
|
|
1614
|
+
/** How long one npm ci may take before the cache gives up on it. */
|
|
1615
|
+
declare const DEPENDENCY_INSTALL_TIMEOUT_MS: number;
|
|
1616
|
+
/** What preparing a tree needs: the engine and pinned image, the repository, and the cache root; `run` is injectable for tests. */
|
|
1617
|
+
interface DependencyCacheInput {
|
|
1618
|
+
engine: ContainerEngine;
|
|
1619
|
+
/** The pinned recipe image; its node and npm install the tree. */
|
|
1620
|
+
image: string;
|
|
1621
|
+
repoRoot: string;
|
|
1622
|
+
/** Where trees live: `<cacheRoot>/<key>/node_modules`. */
|
|
1623
|
+
cacheRoot: string;
|
|
1624
|
+
run?: (engine: ContainerEngine, args: string[], name: string, limits: {
|
|
1625
|
+
timeoutMs: number;
|
|
1626
|
+
maxOutputBytes: number;
|
|
1627
|
+
}) => Promise<CodeRecipeResult>;
|
|
1628
|
+
log?: (line: string) => void;
|
|
1629
|
+
}
|
|
1630
|
+
/** The cache key: the lockfile's bytes, the image, and the architecture the container runs. Null without a lockfile. */
|
|
1631
|
+
declare function dependencyCacheKey(repoRoot: string, image: string, arch?: NodeJS.Architecture): Promise<string | null>;
|
|
1632
|
+
/** Copy only what npm ci needs: the root manifests and every workspace's package.json. Returns what was staged. */
|
|
1633
|
+
declare function stageManifests(repoRoot: string, stageDir: string): Promise<string[]>;
|
|
1634
|
+
/** The helper's command: networked, writable stage, scripts disabled, nothing else of the host mounted. */
|
|
1635
|
+
declare function dependencyInstallArgs(engine: ContainerEngine, image: string, stageDir: string, name: string): string[];
|
|
1636
|
+
/** The tree for this repository's lockfile, from the cache or freshly installed; null when there is no lockfile or the install failed. */
|
|
1637
|
+
declare function prepareContainerDependencies(input: DependencyCacheInput): Promise<RecipeDependencies | null>;
|
|
1610
1638
|
|
|
1611
1639
|
/** Every ordinary, policy-legal source path under `root`, sorted. */
|
|
1612
1640
|
declare function registeredFiles(root: string, limit?: number): Promise<string[]>;
|
|
1613
1641
|
|
|
1614
1642
|
/** Build a trusted, fixed command for an isolated and networkless recipe container. */
|
|
1615
|
-
declare function buildRecipeContainerArgs(engine: ContainerEngine, workspaceDir: string, recipe: CodeBuildRecipe, name?: string): string[];
|
|
1643
|
+
declare function buildRecipeContainerArgs(engine: ContainerEngine, workspaceDir: string, recipe: CodeBuildRecipe, name?: string, dependencies?: RecipeDependencies | null): string[];
|
|
1616
1644
|
/** Create a recipe executor that never invokes a shell and never mounts credentials. */
|
|
1617
|
-
declare function createContainerRecipeExecutor(engine: ContainerEngine
|
|
1645
|
+
declare function createContainerRecipeExecutor(engine: ContainerEngine, options?: {
|
|
1646
|
+
dependencies?: RecipeDependencies | null;
|
|
1647
|
+
}): CodeRecipeExecutor;
|
|
1618
1648
|
/** Validate immutable recipe identity, digest image, command, and resource bounds. */
|
|
1619
1649
|
declare function assertCodeBuildRecipe(recipe: CodeBuildRecipe): void;
|
|
1650
|
+
/** Run one container command to completion under an output cap and a timeout, never through a shell. */
|
|
1651
|
+
declare function runContainerCommand(engine: ContainerEngine, args: string[], name: string, recipe: {
|
|
1652
|
+
timeoutMs: number;
|
|
1653
|
+
maxOutputBytes: number;
|
|
1654
|
+
}, signal?: AbortSignal): Promise<CodeRecipeResult>;
|
|
1620
1655
|
|
|
1621
|
-
export { CODE_PATCH_PATH, CODE_RUNTIME_PROTOCOL_VERSION, type CodeAgentAttemptOptions, type CodeAgentAttemptResult, type CodeAgentRun, type CodeBuildRecipe, type CodeExpectedArtifact, type CodeLocalSourceDescriptor, type CodeMemory, type CodeMemoryEvidence, type CodeMemoryKind, type CodeMemoryStore, type CodeRecipeExecutor, type CodeRecipeResult, type CodeRuntimeAgentControlPlane, type CodeRuntimeBinding, type CodeRuntimeCandidateResponse, type CodeRuntimeCapabilities, CodeRuntimeCheckpointManager, type CodeRuntimeClientOptions, type CodeRuntimeCollaborationSkillManifest, type CodeRuntimeCollaborationToolManifest, type CodeRuntimeCollaborationToolRequest, 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 CodeRuntimeSourceArchive, 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, PROOF_RECIPE_PREFIX, type PrepareRuntimeCheckpointInput, type PreparedRuntimeCheckpoint, REPOSITORY_RECIPES_FILE, type RacedAttemptOptions, type RacedOutcome, type RecallOptions, type RecipeDependencies, type RepositoryRecipeEnvelope, type ResolvedCodeRecipes, type RestoreCodeWorkspaceCheckpointInput, type RestoredCodeWorkspaceCheckpoint, type RunCodeAgentOptions, type RuntimeCheckpointSession, SYSTEM_PROMPT_FOR, type StageWorkspaceOptions, type StagedWorkspace, type StrategyChoice, type StrategySignals, type SubGoal, type SubGoalResult, TheseusRuntimeEngine, type TheseusRuntimeEngineOptions, V1_SYSTEM_PROMPT, V2_SYSTEM_PROMPT, V3_SYSTEM_PROMPT, type VerifyCodeCandidateInput, applyCodePatch, applyPatchDialectToDiff, assertCodeBuildRecipe, assertDisjointPlan, assertPinnedImage, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeRuntimeSessionSkillLoader, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, describeCodeRecipes, describeGateFailure, describePatchFailure, digestStagedWorkspace, feedbackIsActionable, hasContextFreeHunk, hazardFromAttempt, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, materializeCodeRuntimeArchive, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, outcomeCloses, outcomeMemory, parseRepositoryRecipes, patchPaths, planReachCollisions, prepareRuntimeCheckpoint, racedAttempt, readOnlyNotice, readRepositoryRecipes, recallAbout, registeredFiles, renderMemories, renderOutcome, resolveCodePath, resolveCodeRecipes, restoreCodeWorkspaceCheckpoint, runCodeAgent, runCodeAgentAttempt, runCodeRuntimeHeartbeatLoop, runContainerAttempt, runGoal, runHarnessRunner, runLeasedAttempt, runtimeMemoryStore, safeWorkspaceLabel, selectContainerEngine, selectWinner, sessionRecipesFor, sessionSkillsFor, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateMemory, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withProofRecipes, withRecipeDependencies };
|
|
1656
|
+
export { CODE_PATCH_PATH, CODE_RUNTIME_PROTOCOL_VERSION, type CodeAgentAttemptOptions, type CodeAgentAttemptResult, type CodeAgentRun, type CodeBuildRecipe, type CodeExpectedArtifact, type CodeLocalSourceDescriptor, type CodeMemory, type CodeMemoryEvidence, type CodeMemoryKind, type CodeMemoryStore, type CodeRecipeExecutor, type CodeRecipeResult, type CodeRuntimeAgentControlPlane, type CodeRuntimeBinding, type CodeRuntimeCandidateResponse, type CodeRuntimeCapabilities, CodeRuntimeCheckpointManager, type CodeRuntimeClientOptions, type CodeRuntimeCollaborationSkillManifest, type CodeRuntimeCollaborationToolManifest, type CodeRuntimeCollaborationToolRequest, 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 CodeRuntimeSourceArchive, 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, DEPENDENCY_INSTALL_TIMEOUT_MS, type DecomposedRun, DecompositionError, type DependencyCacheInput, 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, PROOF_RECIPE_PREFIX, type PrepareRuntimeCheckpointInput, type PreparedRuntimeCheckpoint, REPOSITORY_RECIPES_FILE, type RacedAttemptOptions, type RacedOutcome, type RecallOptions, type RecipeDependencies, type RepositoryRecipeEnvelope, type ResolvedCodeRecipes, type RestoreCodeWorkspaceCheckpointInput, type RestoredCodeWorkspaceCheckpoint, type RunCodeAgentOptions, type RuntimeCheckpointSession, SYSTEM_PROMPT_FOR, type StageWorkspaceOptions, type StagedWorkspace, type StrategyChoice, type StrategySignals, type SubGoal, type SubGoalResult, TheseusRuntimeEngine, type TheseusRuntimeEngineOptions, V1_SYSTEM_PROMPT, V2_SYSTEM_PROMPT, V3_SYSTEM_PROMPT, type VerifyCodeCandidateInput, applyCodePatch, applyPatchDialectToDiff, assertCodeBuildRecipe, assertDisjointPlan, assertPinnedImage, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeRuntimeSessionSkillLoader, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, dependencyCacheKey, dependencyInstallArgs, describeCodeRecipes, describeGateFailure, describePatchFailure, digestStagedWorkspace, feedbackIsActionable, hasContextFreeHunk, hazardFromAttempt, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, materializeCodeRuntimeArchive, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, outcomeCloses, outcomeMemory, parseRepositoryRecipes, patchPaths, planReachCollisions, prepareContainerDependencies, prepareRuntimeCheckpoint, racedAttempt, readOnlyNotice, readRepositoryRecipes, recallAbout, registeredFiles, renderMemories, renderOutcome, resolveCodePath, resolveCodeRecipes, restoreCodeWorkspaceCheckpoint, runCodeAgent, runCodeAgentAttempt, runCodeRuntimeHeartbeatLoop, runContainerAttempt, runContainerCommand, runGoal, runHarnessRunner, runLeasedAttempt, runtimeMemoryStore, safeWorkspaceLabel, selectContainerEngine, selectWinner, sessionRecipesFor, sessionSkillsFor, stageManifests, stageWorkspace, stageWorkspacePair, straySubGoalFiles, stripPatchEnvelope, validateCodePatch, validateMemory, validateRelativePath, verifyCodeCandidate, verifyContainerEngineBoundary, withProofRecipes, withRecipeDependencies };
|
package/dist/node.js
CHANGED
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
runCodeAgent,
|
|
52
52
|
runCodeAgentAttempt,
|
|
53
53
|
runCodeRuntimeHeartbeatLoop,
|
|
54
|
+
runContainerCommand,
|
|
54
55
|
runGoal,
|
|
55
56
|
sessionRecipesFor,
|
|
56
57
|
sessionSkillsFor,
|
|
@@ -60,7 +61,7 @@ import {
|
|
|
60
61
|
validateRelativePath,
|
|
61
62
|
verifyCodeCandidate,
|
|
62
63
|
withProofRecipes
|
|
63
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-4IGSN53G.js";
|
|
64
65
|
import "./chunk-INL642J5.js";
|
|
65
66
|
import {
|
|
66
67
|
assertPinnedImage,
|
|
@@ -376,12 +377,102 @@ async function installedDependencies(repoRoot) {
|
|
|
376
377
|
const info = await lstat(source).catch(() => null);
|
|
377
378
|
return info?.isDirectory() ? { source } : null;
|
|
378
379
|
}
|
|
380
|
+
|
|
381
|
+
// src/code-recipe-dependency-cache.ts
|
|
382
|
+
import { createHash } from "crypto";
|
|
383
|
+
import { copyFile, mkdir, readFile, readdir, rename, rm as rm2, stat, writeFile } from "fs/promises";
|
|
384
|
+
import { getgid, getuid } from "process";
|
|
385
|
+
import { join as join2 } from "path";
|
|
386
|
+
var DEPENDENCY_INSTALL_TIMEOUT_MS = 20 * 6e4;
|
|
387
|
+
var OUTPUT_CAP = 4 * 1024 * 1024;
|
|
388
|
+
var exists = async (path) => Boolean(await stat(path).catch(() => null));
|
|
389
|
+
async function dependencyCacheKey(repoRoot, image, arch = process.arch) {
|
|
390
|
+
const lock = await readFile(join2(repoRoot, "package-lock.json")).catch(() => null);
|
|
391
|
+
if (!lock) return null;
|
|
392
|
+
return createHash("sha256").update(lock).update("\n").update(image).update("\n").update(arch).digest("hex").slice(0, 32);
|
|
393
|
+
}
|
|
394
|
+
async function stageManifests(repoRoot, stageDir) {
|
|
395
|
+
await mkdir(stageDir, { recursive: true });
|
|
396
|
+
const staged = [];
|
|
397
|
+
for (const name of ["package.json", "package-lock.json", ".npmrc"]) {
|
|
398
|
+
if (!await exists(join2(repoRoot, name))) continue;
|
|
399
|
+
await copyFile(join2(repoRoot, name), join2(stageDir, name));
|
|
400
|
+
staged.push(name);
|
|
401
|
+
}
|
|
402
|
+
const root = JSON.parse(await readFile(join2(repoRoot, "package.json"), "utf8"));
|
|
403
|
+
const globs = Array.isArray(root.workspaces) ? root.workspaces : root.workspaces?.packages ?? [];
|
|
404
|
+
for (const glob of globs) {
|
|
405
|
+
const dirs = glob.endsWith("/*") ? (await readdir(join2(repoRoot, glob.slice(0, -2)), { withFileTypes: true }).catch(() => [])).filter((entry) => entry.isDirectory()).map((entry) => `${glob.slice(0, -2)}/${entry.name}`) : [glob];
|
|
406
|
+
for (const dir of dirs) {
|
|
407
|
+
const manifest = join2(repoRoot, dir, "package.json");
|
|
408
|
+
if (!await exists(manifest)) continue;
|
|
409
|
+
await mkdir(join2(stageDir, dir), { recursive: true });
|
|
410
|
+
await copyFile(manifest, join2(stageDir, dir, "package.json"));
|
|
411
|
+
staged.push(`${dir}/package.json`);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return staged;
|
|
415
|
+
}
|
|
416
|
+
function dependencyInstallArgs(engine, image, stageDir, name) {
|
|
417
|
+
if (/[,\r\n]/.test(stageDir)) throw new TypeError("stage path contains unsupported mount characters");
|
|
418
|
+
const uid = typeof getuid === "function" ? getuid() : 1e3;
|
|
419
|
+
const gid = typeof getgid === "function" ? getgid() : 1e3;
|
|
420
|
+
const mount = engine === "container" ? `--mount=type=bind,source=${stageDir},target=/workspace` : `--mount=type=bind,src=${stageDir},dst=/workspace`;
|
|
421
|
+
const npm = ["npm", "ci", "--no-audit", "--no-fund", "--ignore-scripts"];
|
|
422
|
+
return [
|
|
423
|
+
"run",
|
|
424
|
+
"--rm",
|
|
425
|
+
`--name=${name}`,
|
|
426
|
+
"--cap-drop=ALL",
|
|
427
|
+
"--memory=2g",
|
|
428
|
+
"--cpus=2",
|
|
429
|
+
`--user=${uid}:${gid}`,
|
|
430
|
+
"--tmpfs=/tmp",
|
|
431
|
+
mount,
|
|
432
|
+
"--workdir=/workspace",
|
|
433
|
+
"--env=CI=1",
|
|
434
|
+
"--env=npm_config_cache=/tmp/npm-cache",
|
|
435
|
+
"--env=HOME=/tmp",
|
|
436
|
+
image,
|
|
437
|
+
...npm
|
|
438
|
+
];
|
|
439
|
+
}
|
|
440
|
+
async function prepareContainerDependencies(input) {
|
|
441
|
+
const key = await dependencyCacheKey(input.repoRoot, input.image);
|
|
442
|
+
if (!key) return null;
|
|
443
|
+
const dir = join2(input.cacheRoot, key);
|
|
444
|
+
const tree = join2(dir, "node_modules");
|
|
445
|
+
const stage = join2(dir, "stage");
|
|
446
|
+
if (await exists(tree)) return { source: tree };
|
|
447
|
+
const run = input.run ?? runContainerCommand;
|
|
448
|
+
await rm2(stage, { recursive: true, force: true });
|
|
449
|
+
const staged = await stageManifests(input.repoRoot, stage);
|
|
450
|
+
input.log?.(`installing ${key.slice(0, 12)}: ${staged.length} manifests, npm ci in ${input.image}`);
|
|
451
|
+
const name = `odla-deps-${key.slice(0, 12)}`;
|
|
452
|
+
const result = await run(
|
|
453
|
+
input.engine,
|
|
454
|
+
dependencyInstallArgs(input.engine, input.image, stage, name),
|
|
455
|
+
name,
|
|
456
|
+
{ timeoutMs: DEPENDENCY_INSTALL_TIMEOUT_MS, maxOutputBytes: OUTPUT_CAP }
|
|
457
|
+
);
|
|
458
|
+
if (result.exitCode !== 0 || result.timedOut || !await exists(join2(stage, "node_modules"))) {
|
|
459
|
+
input.log?.(`install failed (exit ${result.exitCode}${result.timedOut ? ", timed out" : ""}): ${result.stderr.trim().split("\n").slice(-3).join(" | ").slice(0, 400)}`);
|
|
460
|
+
await rm2(stage, { recursive: true, force: true });
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
await rename(join2(stage, "node_modules"), tree);
|
|
464
|
+
await rm2(stage, { recursive: true, force: true });
|
|
465
|
+
await writeFile(join2(dir, "manifest.json"), JSON.stringify({ image: input.image, key, createdAt: Date.now() }, null, 2));
|
|
466
|
+
input.log?.(`installed ${key.slice(0, 12)} in ${Math.round(result.durationMs / 1e3)}s`);
|
|
467
|
+
return { source: tree };
|
|
468
|
+
}
|
|
379
469
|
export {
|
|
380
470
|
CODE_PATCH_PATH,
|
|
381
471
|
CODE_RUNTIME_PROTOCOL_VERSION,
|
|
382
472
|
CodeRuntimeCheckpointManager,
|
|
383
473
|
CodeRuntimeControlError,
|
|
384
474
|
CodeRuntimeReconciler,
|
|
475
|
+
DEPENDENCY_INSTALL_TIMEOUT_MS,
|
|
385
476
|
DecompositionError,
|
|
386
477
|
MAX_MEMORY_BODY,
|
|
387
478
|
MEASURED_PREMIUM,
|
|
@@ -408,6 +499,8 @@ export {
|
|
|
408
499
|
createCodeToolBroker,
|
|
409
500
|
createCodeWorkspaceCheckpoint,
|
|
410
501
|
createContainerRecipeExecutor,
|
|
502
|
+
dependencyCacheKey,
|
|
503
|
+
dependencyInstallArgs,
|
|
411
504
|
describeCodeRecipes,
|
|
412
505
|
describeGateFailure,
|
|
413
506
|
describePatchFailure,
|
|
@@ -427,6 +520,7 @@ export {
|
|
|
427
520
|
parseRepositoryRecipes,
|
|
428
521
|
patchPaths,
|
|
429
522
|
planReachCollisions,
|
|
523
|
+
prepareContainerDependencies,
|
|
430
524
|
prepareRuntimeCheckpoint,
|
|
431
525
|
racedAttempt,
|
|
432
526
|
readOnlyNotice,
|
|
@@ -442,6 +536,7 @@ export {
|
|
|
442
536
|
runCodeAgentAttempt,
|
|
443
537
|
runCodeRuntimeHeartbeatLoop,
|
|
444
538
|
runContainerAttempt,
|
|
539
|
+
runContainerCommand,
|
|
445
540
|
runGoal,
|
|
446
541
|
runHarnessRunner,
|
|
447
542
|
runLeasedAttempt,
|
|
@@ -451,6 +546,7 @@ export {
|
|
|
451
546
|
selectWinner,
|
|
452
547
|
sessionRecipesFor,
|
|
453
548
|
sessionSkillsFor,
|
|
549
|
+
stageManifests,
|
|
454
550
|
stageWorkspace,
|
|
455
551
|
stageWorkspacePair,
|
|
456
552
|
straySubGoalFiles,
|