@odla-ai/harness 0.11.17 → 0.11.19
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-T2IW7MYQ.js → chunk-4TG55ATB.js} +2 -2
- package/dist/{chunk-RDCU4PIP.js → chunk-7NP3YOMY.js} +37 -9
- package/dist/chunk-7NP3YOMY.js.map +1 -0
- package/dist/{chunk-3ON6UAOV.js → chunk-A5B3CEK2.js} +3 -3
- package/dist/{chunk-EXSEQEZ6.js → chunk-M6BNH25Z.js} +4 -4
- package/dist/{chunk-ONYW2VSB.js → chunk-O4QLHUGO.js} +1 -1
- package/dist/chunk-O4QLHUGO.js.map +1 -0
- package/dist/{chunk-6T26HEWI.js → chunk-SMN2FWQE.js} +17 -3
- package/dist/{chunk-6T26HEWI.js.map → chunk-SMN2FWQE.js.map} +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +4 -4
- package/dist/code-runtime-cli.cjs +46 -7
- package/dist/code-runtime-cli.cjs.map +1 -1
- package/dist/code-runtime-cli.js +5 -5
- package/dist/code-session-event-data-C6mQB76s.d.cts +134 -0
- package/dist/code-session-event-data-wCQc2py3.d.ts +134 -0
- package/dist/index.cjs +19 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +46 -7
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +23 -7
- package/dist/node.d.ts +23 -7
- package/dist/node.js +6 -6
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/{types-D-Kv1svf.d.ts → types-DM-UgoBN.d.cts} +2 -118
- package/dist/{types-D-Kv1svf.d.cts → types-DM-UgoBN.d.ts} +2 -118
- package/package.json +1 -1
- package/dist/chunk-ONYW2VSB.js.map +0 -1
- package/dist/chunk-RDCU4PIP.js.map +0 -1
- /package/dist/{chunk-T2IW7MYQ.js.map → chunk-4TG55ATB.js.map} +0 -0
- /package/dist/{chunk-3ON6UAOV.js.map → chunk-A5B3CEK2.js.map} +0 -0
- /package/dist/{chunk-EXSEQEZ6.js.map → chunk-M6BNH25Z.js.map} +0 -0
package/dist/node.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as HarnessTaskSpec, j as HarnessAgentOutput, i as HarnessAgentInput, H as HarnessControlPlane, g as HarnessToolBroker, a as HarnessLease, d as HarnessInferenceRequest, e as HarnessInferenceResponse, f as HarnessToolName, w as HarnessToolRequest } from './types-DM-UgoBN.cjs';
|
|
2
2
|
import { CodePortableCheckpoint, CodeSourceFile, CodeVerificationReceipt, CodeCheckpointState } from '@odla-ai/camel/code';
|
|
3
3
|
import { TaintLabel, ToolOutput, Skill, Inference, AgentRunBudget, AgentRun, CompactionPolicy } from '@odla-ai/ai';
|
|
4
|
+
import { C as CodeSessionEventData } from './code-session-event-data-C6mQB76s.cjs';
|
|
4
5
|
import { PolicyOutcome } from '@odla-ai/camel/policy';
|
|
5
6
|
import { Graph, PartitionVerdict } from '@odla-ai/graph';
|
|
6
7
|
|
|
@@ -181,8 +182,17 @@ declare class CodeRuntimeReconciler {
|
|
|
181
182
|
private notify;
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
/** Version of the outbound Code host heartbeat contract.
|
|
185
|
-
|
|
185
|
+
/** Version of the outbound Code host heartbeat contract.
|
|
186
|
+
*
|
|
187
|
+
* 2 understood read-only coding sessions, 3 materializes selected sources on
|
|
188
|
+
* the host, 4 runs `planning` sessions: read-only like a review, inferring on
|
|
189
|
+
* the planning role's model, with a coding session's collaboration tools. */
|
|
190
|
+
declare const CODE_RUNTIME_PROTOCOL_VERSION: 4;
|
|
191
|
+
/** What a Code session is for, which decides its model, its tools, and whether it may write.
|
|
192
|
+
*
|
|
193
|
+
* `coding` implements; `review` judges a candidate and is always read-only; `planning`
|
|
194
|
+
* coordinates (reads the repository, works the PM board) and is always read-only. */
|
|
195
|
+
type CodeSessionRole = "coding" | "review" | "planning";
|
|
186
196
|
/** Frozen, secret-filtered view of the checkout from which a terminal connected. */
|
|
187
197
|
interface CodeLocalSourceDescriptor {
|
|
188
198
|
kind: "local_checkout";
|
|
@@ -853,7 +863,7 @@ declare function verifyCodeCandidate(input: VerifyCodeCandidateInput): Promise<C
|
|
|
853
863
|
/** Trusted session state, verification policy, and review callback used to stop at a portable checkpoint. */
|
|
854
864
|
interface PrepareRuntimeCheckpointInput {
|
|
855
865
|
sessionId: string;
|
|
856
|
-
role:
|
|
866
|
+
role: CodeSessionRole;
|
|
857
867
|
workspace: StagedWorkspace;
|
|
858
868
|
baseCommitSha: string;
|
|
859
869
|
trustedBaseDigest: `sha256:${string}`;
|
|
@@ -888,7 +898,7 @@ interface RuntimeCheckpointSession {
|
|
|
888
898
|
trustedBaseDigest: `sha256:${string}`;
|
|
889
899
|
planningInputDigest: `sha256:${string}`;
|
|
890
900
|
conversationRefs: string[];
|
|
891
|
-
role:
|
|
901
|
+
role: CodeSessionRole;
|
|
892
902
|
/** The session's own recipe list and its digest; the manager's release list stands in when absent. */
|
|
893
903
|
recipes?: readonly CodeBuildRecipe[];
|
|
894
904
|
buildPolicyDigest?: `sha256:${string}`;
|
|
@@ -909,11 +919,17 @@ declare class CodeRuntimeCheckpointManager {
|
|
|
909
919
|
acknowledged(command: CodeRuntimeCommand, result: CodeRuntimeCommandResult): Promise<boolean>;
|
|
910
920
|
}
|
|
911
921
|
|
|
922
|
+
/** How much of the agent's work the session stream carries. `standard` is the
|
|
923
|
+
* content-minimized contract every watcher has always read; `verbose` adds the
|
|
924
|
+
* reasoning, interim prose, tool inputs, and tool outputs, bounded, for a
|
|
925
|
+
* watcher that renders the work as it happens. */
|
|
926
|
+
type CodeEventDetail = "standard" | "verbose";
|
|
912
927
|
interface CodeCommandMetadata {
|
|
913
|
-
role:
|
|
928
|
+
role: CodeSessionRole;
|
|
914
929
|
readOnly: boolean;
|
|
915
930
|
title: string;
|
|
916
931
|
prompt: string;
|
|
932
|
+
eventDetail: CodeEventDetail;
|
|
917
933
|
/** The card's executable proof, argv per command; null when the session carries none. */
|
|
918
934
|
proof: readonly (readonly string[])[] | null;
|
|
919
935
|
maxTokensPerInteraction: number;
|
|
@@ -1719,4 +1735,4 @@ declare function extractTapFailingTests(output: string, limit?: number): string[
|
|
|
1719
1735
|
/** One line naming the failing tests, or `null` when the output names none. */
|
|
1720
1736
|
declare function describeTapFailures(output: string): string | null;
|
|
1721
1737
|
|
|
1722
|
-
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, type LentDependencies, type LentDirectory, MAX_MEMORY_BODY, MAX_TAP_FAILURES, 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, assertLentPath, assertPinnedImage, assertReservedMount, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, cloneTree, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeRuntimeSessionSkillLoader, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, dependencyCacheKey, dependencyInstallArgs, describeCodeRecipes, describeGateFailure, describePatchFailure, describeTapFailures, digestStagedWorkspace, extractTapFailingTests, feedbackIsActionable, hasContextFreeHunk, hazardFromAttempt, hostBuildProducts, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, lendBuildProducts, lendDependencies, lentDirectories, materializeCodeRuntimeArchive, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, npmFailureSummary, outcomeCloses, outcomeMemory, parseRepositoryRecipes, patchPaths, pinnedNpmVersion, planReachCollisions, prepareContainerDependencies, prepareRuntimeCheckpoint, racedAttempt, readOnlyNotice, readRepositoryRecipes, recallAbout, recipeOutput, 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, workspaceDirs };
|
|
1738
|
+
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 CodeSessionRole, 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, type LentDependencies, type LentDirectory, MAX_MEMORY_BODY, MAX_TAP_FAILURES, 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, assertLentPath, assertPinnedImage, assertReservedMount, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, cloneTree, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeRuntimeSessionSkillLoader, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, dependencyCacheKey, dependencyInstallArgs, describeCodeRecipes, describeGateFailure, describePatchFailure, describeTapFailures, digestStagedWorkspace, extractTapFailingTests, feedbackIsActionable, hasContextFreeHunk, hazardFromAttempt, hostBuildProducts, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, lendBuildProducts, lendDependencies, lentDirectories, materializeCodeRuntimeArchive, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, npmFailureSummary, outcomeCloses, outcomeMemory, parseRepositoryRecipes, patchPaths, pinnedNpmVersion, planReachCollisions, prepareContainerDependencies, prepareRuntimeCheckpoint, racedAttempt, readOnlyNotice, readRepositoryRecipes, recallAbout, recipeOutput, 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, workspaceDirs };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as HarnessTaskSpec, j as HarnessAgentOutput, i as HarnessAgentInput, H as HarnessControlPlane, g as HarnessToolBroker, a as HarnessLease, d as HarnessInferenceRequest, e as HarnessInferenceResponse, f as HarnessToolName, w as HarnessToolRequest } from './types-DM-UgoBN.js';
|
|
2
2
|
import { CodePortableCheckpoint, CodeSourceFile, CodeVerificationReceipt, CodeCheckpointState } from '@odla-ai/camel/code';
|
|
3
3
|
import { TaintLabel, ToolOutput, Skill, Inference, AgentRunBudget, AgentRun, CompactionPolicy } from '@odla-ai/ai';
|
|
4
|
+
import { C as CodeSessionEventData } from './code-session-event-data-wCQc2py3.js';
|
|
4
5
|
import { PolicyOutcome } from '@odla-ai/camel/policy';
|
|
5
6
|
import { Graph, PartitionVerdict } from '@odla-ai/graph';
|
|
6
7
|
|
|
@@ -181,8 +182,17 @@ declare class CodeRuntimeReconciler {
|
|
|
181
182
|
private notify;
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
/** Version of the outbound Code host heartbeat contract.
|
|
185
|
-
|
|
185
|
+
/** Version of the outbound Code host heartbeat contract.
|
|
186
|
+
*
|
|
187
|
+
* 2 understood read-only coding sessions, 3 materializes selected sources on
|
|
188
|
+
* the host, 4 runs `planning` sessions: read-only like a review, inferring on
|
|
189
|
+
* the planning role's model, with a coding session's collaboration tools. */
|
|
190
|
+
declare const CODE_RUNTIME_PROTOCOL_VERSION: 4;
|
|
191
|
+
/** What a Code session is for, which decides its model, its tools, and whether it may write.
|
|
192
|
+
*
|
|
193
|
+
* `coding` implements; `review` judges a candidate and is always read-only; `planning`
|
|
194
|
+
* coordinates (reads the repository, works the PM board) and is always read-only. */
|
|
195
|
+
type CodeSessionRole = "coding" | "review" | "planning";
|
|
186
196
|
/** Frozen, secret-filtered view of the checkout from which a terminal connected. */
|
|
187
197
|
interface CodeLocalSourceDescriptor {
|
|
188
198
|
kind: "local_checkout";
|
|
@@ -853,7 +863,7 @@ declare function verifyCodeCandidate(input: VerifyCodeCandidateInput): Promise<C
|
|
|
853
863
|
/** Trusted session state, verification policy, and review callback used to stop at a portable checkpoint. */
|
|
854
864
|
interface PrepareRuntimeCheckpointInput {
|
|
855
865
|
sessionId: string;
|
|
856
|
-
role:
|
|
866
|
+
role: CodeSessionRole;
|
|
857
867
|
workspace: StagedWorkspace;
|
|
858
868
|
baseCommitSha: string;
|
|
859
869
|
trustedBaseDigest: `sha256:${string}`;
|
|
@@ -888,7 +898,7 @@ interface RuntimeCheckpointSession {
|
|
|
888
898
|
trustedBaseDigest: `sha256:${string}`;
|
|
889
899
|
planningInputDigest: `sha256:${string}`;
|
|
890
900
|
conversationRefs: string[];
|
|
891
|
-
role:
|
|
901
|
+
role: CodeSessionRole;
|
|
892
902
|
/** The session's own recipe list and its digest; the manager's release list stands in when absent. */
|
|
893
903
|
recipes?: readonly CodeBuildRecipe[];
|
|
894
904
|
buildPolicyDigest?: `sha256:${string}`;
|
|
@@ -909,11 +919,17 @@ declare class CodeRuntimeCheckpointManager {
|
|
|
909
919
|
acknowledged(command: CodeRuntimeCommand, result: CodeRuntimeCommandResult): Promise<boolean>;
|
|
910
920
|
}
|
|
911
921
|
|
|
922
|
+
/** How much of the agent's work the session stream carries. `standard` is the
|
|
923
|
+
* content-minimized contract every watcher has always read; `verbose` adds the
|
|
924
|
+
* reasoning, interim prose, tool inputs, and tool outputs, bounded, for a
|
|
925
|
+
* watcher that renders the work as it happens. */
|
|
926
|
+
type CodeEventDetail = "standard" | "verbose";
|
|
912
927
|
interface CodeCommandMetadata {
|
|
913
|
-
role:
|
|
928
|
+
role: CodeSessionRole;
|
|
914
929
|
readOnly: boolean;
|
|
915
930
|
title: string;
|
|
916
931
|
prompt: string;
|
|
932
|
+
eventDetail: CodeEventDetail;
|
|
917
933
|
/** The card's executable proof, argv per command; null when the session carries none. */
|
|
918
934
|
proof: readonly (readonly string[])[] | null;
|
|
919
935
|
maxTokensPerInteraction: number;
|
|
@@ -1719,4 +1735,4 @@ declare function extractTapFailingTests(output: string, limit?: number): string[
|
|
|
1719
1735
|
/** One line naming the failing tests, or `null` when the output names none. */
|
|
1720
1736
|
declare function describeTapFailures(output: string): string | null;
|
|
1721
1737
|
|
|
1722
|
-
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, type LentDependencies, type LentDirectory, MAX_MEMORY_BODY, MAX_TAP_FAILURES, 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, assertLentPath, assertPinnedImage, assertReservedMount, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, cloneTree, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeRuntimeSessionSkillLoader, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, dependencyCacheKey, dependencyInstallArgs, describeCodeRecipes, describeGateFailure, describePatchFailure, describeTapFailures, digestStagedWorkspace, extractTapFailingTests, feedbackIsActionable, hasContextFreeHunk, hazardFromAttempt, hostBuildProducts, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, lendBuildProducts, lendDependencies, lentDirectories, materializeCodeRuntimeArchive, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, npmFailureSummary, outcomeCloses, outcomeMemory, parseRepositoryRecipes, patchPaths, pinnedNpmVersion, planReachCollisions, prepareContainerDependencies, prepareRuntimeCheckpoint, racedAttempt, readOnlyNotice, readRepositoryRecipes, recallAbout, recipeOutput, 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, workspaceDirs };
|
|
1738
|
+
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 CodeSessionRole, 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, type LentDependencies, type LentDirectory, MAX_MEMORY_BODY, MAX_TAP_FAILURES, 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, assertLentPath, assertPinnedImage, assertReservedMount, attachCodeRuntimeReferences, buildContainerRunArgs, buildRecipeContainerArgs, chooseStrategy, cloneTree, codeSkill, createCodeRuntimeControlClient, createCodeRuntimeInference, createCodeRuntimeSessionSkillLoader, createCodeToolBroker, createCodeWorkspaceCheckpoint, createContainerRecipeExecutor, dependencyCacheKey, dependencyInstallArgs, describeCodeRecipes, describeGateFailure, describePatchFailure, describeTapFailures, digestStagedWorkspace, extractTapFailingTests, feedbackIsActionable, hasContextFreeHunk, hazardFromAttempt, hostBuildProducts, installedDependencies, integrateSubGoals, isCheckpointEffectCompleted, lendBuildProducts, lendDependencies, lentDirectories, materializeCodeRuntimeArchive, materializeCodeRuntimeSource, materializeCommandWorkspace, materializeGitTree, npmFailureSummary, outcomeCloses, outcomeMemory, parseRepositoryRecipes, patchPaths, pinnedNpmVersion, planReachCollisions, prepareContainerDependencies, prepareRuntimeCheckpoint, racedAttempt, readOnlyNotice, readRepositoryRecipes, recallAbout, recipeOutput, 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, workspaceDirs };
|
package/dist/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runHarnessRunner,
|
|
3
3
|
runLeasedAttempt
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-M6BNH25Z.js";
|
|
5
5
|
import {
|
|
6
6
|
CODE_PATCH_PATH,
|
|
7
7
|
CODE_RUNTIME_PROTOCOL_VERSION,
|
|
@@ -73,8 +73,8 @@ import {
|
|
|
73
73
|
verifyCodeCandidate,
|
|
74
74
|
withProofRecipes,
|
|
75
75
|
withRecipeDependencies
|
|
76
|
-
} from "./chunk-
|
|
77
|
-
import "./chunk-
|
|
76
|
+
} from "./chunk-7NP3YOMY.js";
|
|
77
|
+
import "./chunk-SMN2FWQE.js";
|
|
78
78
|
import {
|
|
79
79
|
allowedWorkspacePath,
|
|
80
80
|
assertPinnedImage,
|
|
@@ -86,9 +86,9 @@ import {
|
|
|
86
86
|
stageWorkspace,
|
|
87
87
|
stageWorkspacePair,
|
|
88
88
|
verifyContainerEngineBoundary
|
|
89
|
-
} from "./chunk-
|
|
90
|
-
import "./chunk-
|
|
91
|
-
import "./chunk-
|
|
89
|
+
} from "./chunk-A5B3CEK2.js";
|
|
90
|
+
import "./chunk-4TG55ATB.js";
|
|
91
|
+
import "./chunk-O4QLHUGO.js";
|
|
92
92
|
|
|
93
93
|
// src/code-runtime-memory.ts
|
|
94
94
|
async function mutationId(memory) {
|
package/dist/testing.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/testing.ts","../src/types.ts"],"sourcesContent":["import type { OracleResponse } from \"@odla-ai/ai\";\nimport {\n HARNESS_PROTOCOL_VERSION,\n type HarnessCompletion,\n type HarnessControlPlane,\n type HarnessEventInput,\n type HarnessInferenceRequest,\n type HarnessInferenceResponse,\n type HarnessLease,\n} from \"./types\";\n\n/** Create a deterministic, valid lease for harness unit and integration tests. */\nexport function fixtureLease(overrides: Partial<HarnessLease> = {}): HarnessLease {\n return {\n protocolVersion: HARNESS_PROTOCOL_VERSION,\n leaseId: \"lease_fixture\",\n generation: 1,\n expiresAt: Date.now() + 60_000,\n task: {\n taskId: \"task_fixture\",\n attemptId: \"attempt_fixture\",\n title: \"Fixture task\",\n prompt: \"Create HARNESS_RESULT.md\",\n workspace: \"fixture\",\n aiRoute: \"coding\",\n policy: {\n network: \"none\",\n timeoutMs: 30_000,\n maxOutputBytes: 1_000_000,\n maxPatchBytes: 1_000_000,\n },\n },\n ...overrides,\n };\n}\n\n/** In-memory control plane that records runner interactions without network access. */\nexport class FakeHarnessControlPlane implements HarnessControlPlane {\n readonly leases: HarnessLease[] = [];\n readonly events: HarnessEventInput[] = [];\n readonly completions: HarnessCompletion[] = [];\n readonly inferenceRequests: HarnessInferenceRequest[] = [];\n cancelRequested = false;\n response: OracleResponse = {\n id: \"oracle_fixture\",\n model: \"fixture-model\",\n provider: \"openai\",\n role: \"assistant\",\n content: [{ type: \"text\", text: \"deterministic fixture response\" }],\n stopReason: \"end_turn\",\n usage: { inputTokens: 5, outputTokens: 4 },\n };\n\n constructor(...leases: HarnessLease[]) { this.leases.push(...leases); }\n\n async lease(workspaces: string[]): Promise<HarnessLease | null> {\n const index = this.leases.findIndex((candidate) => workspaces.includes(candidate.task.workspace));\n return index < 0 ? null : this.leases.splice(index, 1)[0]!;\n }\n async heartbeat(): Promise<{ cancelRequested: boolean; expiresAt: number }> {\n return { cancelRequested: this.cancelRequested, expiresAt: Date.now() + 60_000 };\n }\n async appendEvents(_attemptId: string, _leaseId: string, events: HarnessEventInput[]): Promise<void> {\n this.events.push(...events);\n }\n async infer(_attemptId: string, _leaseId: string, request: HarnessInferenceRequest): Promise<HarnessInferenceResponse> {\n this.inferenceRequests.push(request);\n return {\n requestId: request.requestId,\n response: this.response,\n receipt: {\n provider: this.response.provider,\n model: this.response.model,\n policyVersion: 1,\n inputTokens: this.response.usage.inputTokens ?? 0,\n outputTokens: this.response.usage.outputTokens ?? 0,\n },\n };\n }\n async complete(_attemptId: string, _leaseId: string, completion: HarnessCompletion): Promise<void> {\n this.completions.push(completion);\n }\n}\n","import type { ChatInput, OracleResponse } from \"@odla-ai/ai\";\nimport type { CodeToolPresentation } from \"./code-session-event-types\";\nexport type { CodeToolLocationPreview, CodeToolPresentation } from \"./code-session-event-types\";\n\n/** Current JSONL protocol version exchanged between a runner and an agent container. */\nexport const HARNESS_PROTOCOL_VERSION = 1 as const;\n\n/** Default control-plane route used for model inference requested by coding agents. */\nexport const DEFAULT_AI_ROUTE = \"coding\" as const;\n\n/** Lifecycle state reported for a harness task and its active attempt. */\nexport type HarnessTaskStatus =\n | \"queued\"\n | \"running\"\n | \"cancel_requested\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\";\n\n/** Lifecycle state of one execution attempt for a task. */\nexport type HarnessAttemptStatus = HarnessTaskStatus;\n\n/** Trusted or untrusted participant that emitted a harness event. */\nexport type HarnessActor = \"operator\" | \"runner\" | \"agent\" | \"model\" | \"system\";\n\n/** Resource and isolation limits enforced while an untrusted task executes. */\nexport interface HarnessPolicy {\n network: \"none\";\n timeoutMs: number;\n maxOutputBytes: number;\n maxPatchBytes: number;\n}\n\n/** Immutable task instructions and execution policy delivered with a lease. */\nexport interface HarnessTaskSpec {\n taskId: string;\n attemptId: string;\n title: string;\n prompt: string;\n workspace: string;\n aiRoute: string;\n policy: HarnessPolicy;\n parentAttemptId?: string | null;\n checkpointSeq?: number | null;\n}\n\n/** Time-bound assignment authorizing a runner to execute one task attempt. */\nexport interface HarnessLease {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n leaseId: string;\n generation: number;\n expiresAt: number;\n task: HarnessTaskSpec;\n}\n\n/** Runner-supplied event before the control plane assigns sequence and task metadata. */\nexport interface HarnessEventInput {\n eventId: string;\n kind: string;\n actor: HarnessActor;\n payload: unknown;\n createdAt: number;\n}\n\n/** Persisted, ordered event associated with a specific task attempt. */\nexport interface HarnessEvent extends HarnessEventInput {\n seq: number;\n taskId: string;\n attemptId: string;\n}\n\n/** List-view metadata for a task and its current attempt. */\nexport interface HarnessTaskSummary {\n taskId: string;\n attemptId: string;\n appId: string;\n env: string;\n title: string;\n prompt: string;\n workspace: string;\n aiRoute: string;\n status: HarnessTaskStatus;\n parentAttemptId: string | null;\n checkpointSeq: number | null;\n runnerId: string | null;\n generation: number;\n createdAt: number;\n updatedAt: number;\n}\n\n/** List-view metadata for one attempt, including retry ancestry and runner ownership. */\nexport interface HarnessAttemptSummary {\n attemptId: string;\n taskId: string;\n parentAttemptId: string | null;\n checkpointSeq: number | null;\n status: HarnessAttemptStatus;\n runnerId: string | null;\n generation: number;\n createdAt: number;\n updatedAt: number;\n}\n\n/** Complete task view including attempts, events, result, and generated patch. */\nexport interface HarnessTaskDetail extends HarnessTaskSummary {\n attempts: HarnessAttemptSummary[];\n events: HarnessEvent[];\n patch: string | null;\n result: unknown;\n}\n\n/** Public control-plane view of a registered harness runner. */\nexport interface HarnessRunnerView {\n runnerId: string;\n appId: string;\n env: string;\n name: string;\n createdAt: number;\n lastSeenAt: number | null;\n revokedAt: number | null;\n}\n\n/** Credential-free normalized model request sent from an agent through the runner. */\nexport interface HarnessInferenceRequest {\n requestId: string;\n /** Exact initial, follow-up, or resume command whose budget this call consumes. */\n interactionId?: string;\n call: ChatInput;\n}\n\n/** Normalized model response plus auditable provider, policy, and token metadata. */\nexport interface HarnessInferenceResponse {\n requestId: string;\n response: OracleResponse;\n receipt: {\n provider: string;\n model: string;\n policyVersion: number;\n inputTokens: number;\n outputTokens: number;\n /**\n * USD charged for this call, priced against the model the control plane\n * actually resolved.\n *\n * ABSENT when the live catalog has no price for that model — never zero.\n * An unpriced call is unknown spend, and reporting it as free is what let\n * a goal's `maxUsd` look enforced while nothing enforced it. The runtime\n * cannot compute this itself: it asks for `brokered` and only the control\n * plane knows which model answered.\n */\n costUsd?: number;\n };\n}\n\n/** Bounded, content-minimized session activity emitted by a Code runtime.\n * Message bodies are projected separately into the app's owner-private\n * odla-db chat. `interactionId` is optional so stored v1 events remain valid. */\nexport type CodeSessionEventData = (\n | { type: \"message\"; actor: \"agent\" | \"system\"; body: string }\n | { type: \"diagnostic\"; level: \"error\"; message: string }\n | { type: \"thinking\"; available: true; durationMs: number }\n | {\n type: \"tool\";\n phase: \"started\";\n tool: HarnessToolName;\n operationId?: string;\n presentation?: CodeToolPresentation;\n }\n | {\n type: \"tool\";\n phase: \"completed\";\n tool: HarnessToolName;\n ok: boolean;\n durationMs: number;\n operationId?: string;\n /** Why the call failed, bounded. Absent when `ok`. Without this a watcher\n * saw that a tool failed and never why, which is what made an 84%\n * apply_patch failure rate impossible to diagnose (PM bug 515655ec). */\n failureReason?: string;\n presentation?: CodeToolPresentation;\n }\n | {\n type: \"collaboration\";\n phase: \"started\";\n skill: string;\n tool: string;\n operationId: string;\n }\n | {\n type: \"collaboration\";\n phase: \"completed\";\n skill: string;\n tool: string;\n ok: boolean;\n durationMs: number;\n operationId: string;\n }\n | {\n type: \"usage\"; provider: string; model: string;\n inputTokens: number; outputTokens: number; durationMs: number;\n interactionTokens?: number; interactionMaxTokens?: number;\n /** USD for this call; absent when the model is unpriced, never zero. */\n costUsd?: number;\n /** Cumulative USD for this owner interaction, when every call in it was\n * priced. Absent the moment one was not, so a partial total can never be\n * mistaken for the whole. */\n interactionCostUsd?: number;\n }\n | {\n type: \"status\"; status: \"running\" | \"idle\" | \"failed\" | \"checkpointed\";\n durationMs?: number;\n }\n) & { interactionId?: string };\n\n/** Registry-assigned cursor and timestamp for an owner-visible Code event. */\nexport type CodeSessionEvent = CodeSessionEventData & {\n eventId: string; sequence: number; createdAt: number;\n};\n\n/** Closed set of effects an agent container may request from its trusted broker. */\nexport type HarnessToolName =\n | \"sandbox.read\"\n | \"sandbox.list\"\n | \"sandbox.search\"\n | \"sandbox.overview\"\n | \"sandbox.where_is\"\n | \"sandbox.who_imports\"\n | \"sandbox.who_touches\"\n | \"sandbox.apply_patch\"\n | \"sandbox.edit\"\n | \"sandbox.write\"\n | \"sandbox.run_recipe\";\n/** Correlated, structured tool request emitted by an untrusted agent container. */\nexport interface HarnessToolRequest {\n requestId: string;\n tool: HarnessToolName;\n input: Record<string, unknown>;\n}\n/** Bounded tool result returned to an agent after trusted policy evaluation. */\nexport interface HarnessToolResponse {\n requestId: string;\n ok: boolean;\n content: string;\n details?: Record<string, unknown>;\n}\n\n/** Validated JSONL message emitted by an untrusted agent container. */\nexport type HarnessAgentOutput =\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"event\";\n kind: string;\n payload?: unknown;\n }\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"inference.request\";\n requestId: string;\n call: ChatInput;\n }\n | ({ protocolVersion: typeof HARNESS_PROTOCOL_VERSION; type: \"tool.request\" } & HarnessToolRequest)\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"attempt.complete\";\n status: \"completed\" | \"failed\" | \"cancelled\";\n result?: unknown;\n };\n\n/** JSONL command or inference result written by the trusted runner to an agent. */\nexport type HarnessAgentInput =\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"task.start\";\n task: HarnessTaskSpec;\n }\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"inference.response\";\n requestId: string;\n response: OracleResponse;\n }\n | ({ protocolVersion: typeof HARNESS_PROTOCOL_VERSION; type: \"tool.response\" } & HarnessToolResponse)\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"attempt.cancel\";\n reason: string;\n };\n\n/** Terminal attempt report submitted by a runner to the control plane. */\nexport interface HarnessCompletion {\n status: \"completed\" | \"failed\" | \"cancelled\";\n result?: unknown;\n patch?: string;\n error?: string;\n}\n\n/** Operations a credentialed runner may perform against the harness control plane. */\nexport interface HarnessControlPlane {\n lease(workspaces: string[]): Promise<HarnessLease | null>;\n heartbeat(attemptId: string, leaseId: string): Promise<{ cancelRequested: boolean; expiresAt: number }>;\n appendEvents(attemptId: string, leaseId: string, events: HarnessEventInput[]): Promise<void>;\n infer(attemptId: string, leaseId: string, request: HarnessInferenceRequest): Promise<HarnessInferenceResponse>;\n complete(attemptId: string, leaseId: string, completion: HarnessCompletion): Promise<void>;\n}\n\n/** Trusted inference bridge used to keep model credentials outside agent containers. */\nexport interface HarnessAiConnection {\n infer(request: HarnessInferenceRequest): Promise<HarnessInferenceResponse>;\n}\n\n/** Trusted tool boundary. Implementations must evaluate CaMeL policy before effects. */\nexport interface HarnessToolBroker {\n execute(\n context: { lease: HarnessLease; workspaceDir: string; signal?: AbortSignal },\n request: HarnessToolRequest,\n ): Promise<HarnessToolResponse>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,2BAA2B;;;ADOjC,SAAS,aAAa,YAAmC,CAAC,GAAiB;AAChF,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,KAAK,IAAI,IAAI;AAAA,IACxB,MAAM;AAAA,MACJ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,SAAS;AAAA,MACT,QAAQ;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL;AACF;AAGO,IAAM,0BAAN,MAA6D;AAAA,EACzD,SAAyB,CAAC;AAAA,EAC1B,SAA8B,CAAC;AAAA,EAC/B,cAAmC,CAAC;AAAA,EACpC,oBAA+C,CAAC;AAAA,EACzD,kBAAkB;AAAA,EAClB,WAA2B;AAAA,IACzB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,iCAAiC,CAAC;AAAA,IAClE,YAAY;AAAA,IACZ,OAAO,EAAE,aAAa,GAAG,cAAc,EAAE;AAAA,EAC3C;AAAA,EAEA,eAAe,QAAwB;AAAE,SAAK,OAAO,KAAK,GAAG,MAAM;AAAA,EAAG;AAAA,EAEtE,MAAM,MAAM,YAAoD;AAC9D,UAAM,QAAQ,KAAK,OAAO,UAAU,CAAC,cAAc,WAAW,SAAS,UAAU,KAAK,SAAS,CAAC;AAChG,WAAO,QAAQ,IAAI,OAAO,KAAK,OAAO,OAAO,OAAO,CAAC,EAAE,CAAC;AAAA,EAC1D;AAAA,EACA,MAAM,YAAsE;AAC1E,WAAO,EAAE,iBAAiB,KAAK,iBAAiB,WAAW,KAAK,IAAI,IAAI,IAAO;AAAA,EACjF;AAAA,EACA,MAAM,aAAa,YAAoB,UAAkB,QAA4C;AACnG,SAAK,OAAO,KAAK,GAAG,MAAM;AAAA,EAC5B;AAAA,EACA,MAAM,MAAM,YAAoB,UAAkB,SAAqE;AACrH,SAAK,kBAAkB,KAAK,OAAO;AACnC,WAAO;AAAA,MACL,WAAW,QAAQ;AAAA,MACnB,UAAU,KAAK;AAAA,MACf,SAAS;AAAA,QACP,UAAU,KAAK,SAAS;AAAA,QACxB,OAAO,KAAK,SAAS;AAAA,QACrB,eAAe;AAAA,QACf,aAAa,KAAK,SAAS,MAAM,eAAe;AAAA,QAChD,cAAc,KAAK,SAAS,MAAM,gBAAgB;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM,SAAS,YAAoB,UAAkB,YAA8C;AACjG,SAAK,YAAY,KAAK,UAAU;AAAA,EAClC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/testing.ts","../src/types.ts"],"sourcesContent":["import type { OracleResponse } from \"@odla-ai/ai\";\nimport {\n HARNESS_PROTOCOL_VERSION,\n type HarnessCompletion,\n type HarnessControlPlane,\n type HarnessEventInput,\n type HarnessInferenceRequest,\n type HarnessInferenceResponse,\n type HarnessLease,\n} from \"./types\";\n\n/** Create a deterministic, valid lease for harness unit and integration tests. */\nexport function fixtureLease(overrides: Partial<HarnessLease> = {}): HarnessLease {\n return {\n protocolVersion: HARNESS_PROTOCOL_VERSION,\n leaseId: \"lease_fixture\",\n generation: 1,\n expiresAt: Date.now() + 60_000,\n task: {\n taskId: \"task_fixture\",\n attemptId: \"attempt_fixture\",\n title: \"Fixture task\",\n prompt: \"Create HARNESS_RESULT.md\",\n workspace: \"fixture\",\n aiRoute: \"coding\",\n policy: {\n network: \"none\",\n timeoutMs: 30_000,\n maxOutputBytes: 1_000_000,\n maxPatchBytes: 1_000_000,\n },\n },\n ...overrides,\n };\n}\n\n/** In-memory control plane that records runner interactions without network access. */\nexport class FakeHarnessControlPlane implements HarnessControlPlane {\n readonly leases: HarnessLease[] = [];\n readonly events: HarnessEventInput[] = [];\n readonly completions: HarnessCompletion[] = [];\n readonly inferenceRequests: HarnessInferenceRequest[] = [];\n cancelRequested = false;\n response: OracleResponse = {\n id: \"oracle_fixture\",\n model: \"fixture-model\",\n provider: \"openai\",\n role: \"assistant\",\n content: [{ type: \"text\", text: \"deterministic fixture response\" }],\n stopReason: \"end_turn\",\n usage: { inputTokens: 5, outputTokens: 4 },\n };\n\n constructor(...leases: HarnessLease[]) { this.leases.push(...leases); }\n\n async lease(workspaces: string[]): Promise<HarnessLease | null> {\n const index = this.leases.findIndex((candidate) => workspaces.includes(candidate.task.workspace));\n return index < 0 ? null : this.leases.splice(index, 1)[0]!;\n }\n async heartbeat(): Promise<{ cancelRequested: boolean; expiresAt: number }> {\n return { cancelRequested: this.cancelRequested, expiresAt: Date.now() + 60_000 };\n }\n async appendEvents(_attemptId: string, _leaseId: string, events: HarnessEventInput[]): Promise<void> {\n this.events.push(...events);\n }\n async infer(_attemptId: string, _leaseId: string, request: HarnessInferenceRequest): Promise<HarnessInferenceResponse> {\n this.inferenceRequests.push(request);\n return {\n requestId: request.requestId,\n response: this.response,\n receipt: {\n provider: this.response.provider,\n model: this.response.model,\n policyVersion: 1,\n inputTokens: this.response.usage.inputTokens ?? 0,\n outputTokens: this.response.usage.outputTokens ?? 0,\n },\n };\n }\n async complete(_attemptId: string, _leaseId: string, completion: HarnessCompletion): Promise<void> {\n this.completions.push(completion);\n }\n}\n","import type { ChatInput, OracleResponse } from \"@odla-ai/ai\";\nimport type { CodeToolPresentation } from \"./code-session-event-types\";\nexport type { CodeToolLocationPreview, CodeToolPresentation } from \"./code-session-event-types\";\n\n/** Current JSONL protocol version exchanged between a runner and an agent container. */\nexport const HARNESS_PROTOCOL_VERSION = 1 as const;\n\n/** Default control-plane route used for model inference requested by coding agents. */\nexport const DEFAULT_AI_ROUTE = \"coding\" as const;\n\n/** Lifecycle state reported for a harness task and its active attempt. */\nexport type HarnessTaskStatus =\n | \"queued\"\n | \"running\"\n | \"cancel_requested\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\";\n\n/** Lifecycle state of one execution attempt for a task. */\nexport type HarnessAttemptStatus = HarnessTaskStatus;\n\n/** Trusted or untrusted participant that emitted a harness event. */\nexport type HarnessActor = \"operator\" | \"runner\" | \"agent\" | \"model\" | \"system\";\n\n/** Resource and isolation limits enforced while an untrusted task executes. */\nexport interface HarnessPolicy {\n network: \"none\";\n timeoutMs: number;\n maxOutputBytes: number;\n maxPatchBytes: number;\n}\n\n/** Immutable task instructions and execution policy delivered with a lease. */\nexport interface HarnessTaskSpec {\n taskId: string;\n attemptId: string;\n title: string;\n prompt: string;\n workspace: string;\n aiRoute: string;\n policy: HarnessPolicy;\n parentAttemptId?: string | null;\n checkpointSeq?: number | null;\n}\n\n/** Time-bound assignment authorizing a runner to execute one task attempt. */\nexport interface HarnessLease {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n leaseId: string;\n generation: number;\n expiresAt: number;\n task: HarnessTaskSpec;\n}\n\n/** Runner-supplied event before the control plane assigns sequence and task metadata. */\nexport interface HarnessEventInput {\n eventId: string;\n kind: string;\n actor: HarnessActor;\n payload: unknown;\n createdAt: number;\n}\n\n/** Persisted, ordered event associated with a specific task attempt. */\nexport interface HarnessEvent extends HarnessEventInput {\n seq: number;\n taskId: string;\n attemptId: string;\n}\n\n/** List-view metadata for a task and its current attempt. */\nexport interface HarnessTaskSummary {\n taskId: string;\n attemptId: string;\n appId: string;\n env: string;\n title: string;\n prompt: string;\n workspace: string;\n aiRoute: string;\n status: HarnessTaskStatus;\n parentAttemptId: string | null;\n checkpointSeq: number | null;\n runnerId: string | null;\n generation: number;\n createdAt: number;\n updatedAt: number;\n}\n\n/** List-view metadata for one attempt, including retry ancestry and runner ownership. */\nexport interface HarnessAttemptSummary {\n attemptId: string;\n taskId: string;\n parentAttemptId: string | null;\n checkpointSeq: number | null;\n status: HarnessAttemptStatus;\n runnerId: string | null;\n generation: number;\n createdAt: number;\n updatedAt: number;\n}\n\n/** Complete task view including attempts, events, result, and generated patch. */\nexport interface HarnessTaskDetail extends HarnessTaskSummary {\n attempts: HarnessAttemptSummary[];\n events: HarnessEvent[];\n patch: string | null;\n result: unknown;\n}\n\n/** Public control-plane view of a registered harness runner. */\nexport interface HarnessRunnerView {\n runnerId: string;\n appId: string;\n env: string;\n name: string;\n createdAt: number;\n lastSeenAt: number | null;\n revokedAt: number | null;\n}\n\n/** Credential-free normalized model request sent from an agent through the runner. */\nexport interface HarnessInferenceRequest {\n requestId: string;\n /** Exact initial, follow-up, or resume command whose budget this call consumes. */\n interactionId?: string;\n call: ChatInput;\n}\n\n/** Normalized model response plus auditable provider, policy, and token metadata. */\nexport interface HarnessInferenceResponse {\n requestId: string;\n response: OracleResponse;\n receipt: {\n provider: string;\n model: string;\n policyVersion: number;\n inputTokens: number;\n outputTokens: number;\n /**\n * USD charged for this call, priced against the model the control plane\n * actually resolved.\n *\n * ABSENT when the live catalog has no price for that model — never zero.\n * An unpriced call is unknown spend, and reporting it as free is what let\n * a goal's `maxUsd` look enforced while nothing enforced it. The runtime\n * cannot compute this itself: it asks for `brokered` and only the control\n * plane knows which model answered.\n */\n costUsd?: number;\n };\n}\n\nexport type { CodeSessionEvent, CodeSessionEventData } from \"./code-session-event-data\";\n\n/** Closed set of effects an agent container may request from its trusted broker. */\nexport type HarnessToolName =\n | \"sandbox.read\"\n | \"sandbox.list\"\n | \"sandbox.search\"\n | \"sandbox.overview\"\n | \"sandbox.where_is\"\n | \"sandbox.who_imports\"\n | \"sandbox.who_touches\"\n | \"sandbox.apply_patch\"\n | \"sandbox.edit\"\n | \"sandbox.write\"\n | \"sandbox.run_recipe\";\n/** Correlated, structured tool request emitted by an untrusted agent container. */\nexport interface HarnessToolRequest {\n requestId: string;\n tool: HarnessToolName;\n input: Record<string, unknown>;\n}\n/** Bounded tool result returned to an agent after trusted policy evaluation. */\nexport interface HarnessToolResponse {\n requestId: string;\n ok: boolean;\n content: string;\n details?: Record<string, unknown>;\n}\n\n/** Validated JSONL message emitted by an untrusted agent container. */\nexport type HarnessAgentOutput =\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"event\";\n kind: string;\n payload?: unknown;\n }\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"inference.request\";\n requestId: string;\n call: ChatInput;\n }\n | ({ protocolVersion: typeof HARNESS_PROTOCOL_VERSION; type: \"tool.request\" } & HarnessToolRequest)\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"attempt.complete\";\n status: \"completed\" | \"failed\" | \"cancelled\";\n result?: unknown;\n };\n\n/** JSONL command or inference result written by the trusted runner to an agent. */\nexport type HarnessAgentInput =\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"task.start\";\n task: HarnessTaskSpec;\n }\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"inference.response\";\n requestId: string;\n response: OracleResponse;\n }\n | ({ protocolVersion: typeof HARNESS_PROTOCOL_VERSION; type: \"tool.response\" } & HarnessToolResponse)\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"attempt.cancel\";\n reason: string;\n };\n\n/** Terminal attempt report submitted by a runner to the control plane. */\nexport interface HarnessCompletion {\n status: \"completed\" | \"failed\" | \"cancelled\";\n result?: unknown;\n patch?: string;\n error?: string;\n}\n\n/** Operations a credentialed runner may perform against the harness control plane. */\nexport interface HarnessControlPlane {\n lease(workspaces: string[]): Promise<HarnessLease | null>;\n heartbeat(attemptId: string, leaseId: string): Promise<{ cancelRequested: boolean; expiresAt: number }>;\n appendEvents(attemptId: string, leaseId: string, events: HarnessEventInput[]): Promise<void>;\n infer(attemptId: string, leaseId: string, request: HarnessInferenceRequest): Promise<HarnessInferenceResponse>;\n complete(attemptId: string, leaseId: string, completion: HarnessCompletion): Promise<void>;\n}\n\n/** Trusted inference bridge used to keep model credentials outside agent containers. */\nexport interface HarnessAiConnection {\n infer(request: HarnessInferenceRequest): Promise<HarnessInferenceResponse>;\n}\n\n/** Trusted tool boundary. Implementations must evaluate CaMeL policy before effects. */\nexport interface HarnessToolBroker {\n execute(\n context: { lease: HarnessLease; workspaceDir: string; signal?: AbortSignal },\n request: HarnessToolRequest,\n ): Promise<HarnessToolResponse>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,2BAA2B;;;ADOjC,SAAS,aAAa,YAAmC,CAAC,GAAiB;AAChF,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,WAAW,KAAK,IAAI,IAAI;AAAA,IACxB,MAAM;AAAA,MACJ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,SAAS;AAAA,MACT,QAAQ;AAAA,QACN,SAAS;AAAA,QACT,WAAW;AAAA,QACX,gBAAgB;AAAA,QAChB,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL;AACF;AAGO,IAAM,0BAAN,MAA6D;AAAA,EACzD,SAAyB,CAAC;AAAA,EAC1B,SAA8B,CAAC;AAAA,EAC/B,cAAmC,CAAC;AAAA,EACpC,oBAA+C,CAAC;AAAA,EACzD,kBAAkB;AAAA,EAClB,WAA2B;AAAA,IACzB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,iCAAiC,CAAC;AAAA,IAClE,YAAY;AAAA,IACZ,OAAO,EAAE,aAAa,GAAG,cAAc,EAAE;AAAA,EAC3C;AAAA,EAEA,eAAe,QAAwB;AAAE,SAAK,OAAO,KAAK,GAAG,MAAM;AAAA,EAAG;AAAA,EAEtE,MAAM,MAAM,YAAoD;AAC9D,UAAM,QAAQ,KAAK,OAAO,UAAU,CAAC,cAAc,WAAW,SAAS,UAAU,KAAK,SAAS,CAAC;AAChG,WAAO,QAAQ,IAAI,OAAO,KAAK,OAAO,OAAO,OAAO,CAAC,EAAE,CAAC;AAAA,EAC1D;AAAA,EACA,MAAM,YAAsE;AAC1E,WAAO,EAAE,iBAAiB,KAAK,iBAAiB,WAAW,KAAK,IAAI,IAAI,IAAO;AAAA,EACjF;AAAA,EACA,MAAM,aAAa,YAAoB,UAAkB,QAA4C;AACnG,SAAK,OAAO,KAAK,GAAG,MAAM;AAAA,EAC5B;AAAA,EACA,MAAM,MAAM,YAAoB,UAAkB,SAAqE;AACrH,SAAK,kBAAkB,KAAK,OAAO;AACnC,WAAO;AAAA,MACL,WAAW,QAAQ;AAAA,MACnB,UAAU,KAAK;AAAA,MACf,SAAS;AAAA,QACP,UAAU,KAAK,SAAS;AAAA,QACxB,OAAO,KAAK,SAAS;AAAA,QACrB,eAAe;AAAA,QACf,aAAa,KAAK,SAAS,MAAM,eAAe;AAAA,QAChD,cAAc,KAAK,SAAS,MAAM,gBAAgB;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM,SAAS,YAAoB,UAAkB,YAA8C;AACjG,SAAK,YAAY,KAAK,UAAU;AAAA,EAClC;AACF;","names":[]}
|
package/dist/testing.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OracleResponse } from '@odla-ai/ai';
|
|
2
|
-
import { H as HarnessControlPlane, a as HarnessLease, b as HarnessEventInput, c as HarnessCompletion, d as HarnessInferenceRequest, e as HarnessInferenceResponse } from './types-
|
|
2
|
+
import { H as HarnessControlPlane, a as HarnessLease, b as HarnessEventInput, c as HarnessCompletion, d as HarnessInferenceRequest, e as HarnessInferenceResponse } from './types-DM-UgoBN.cjs';
|
|
3
3
|
|
|
4
4
|
/** Create a deterministic, valid lease for harness unit and integration tests. */
|
|
5
5
|
declare function fixtureLease(overrides?: Partial<HarnessLease>): HarnessLease;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OracleResponse } from '@odla-ai/ai';
|
|
2
|
-
import { H as HarnessControlPlane, a as HarnessLease, b as HarnessEventInput, c as HarnessCompletion, d as HarnessInferenceRequest, e as HarnessInferenceResponse } from './types-
|
|
2
|
+
import { H as HarnessControlPlane, a as HarnessLease, b as HarnessEventInput, c as HarnessCompletion, d as HarnessInferenceRequest, e as HarnessInferenceResponse } from './types-DM-UgoBN.js';
|
|
3
3
|
|
|
4
4
|
/** Create a deterministic, valid lease for harness unit and integration tests. */
|
|
5
5
|
declare function fixtureLease(overrides?: Partial<HarnessLease>): HarnessLease;
|
package/dist/testing.js
CHANGED
|
@@ -1,47 +1,5 @@
|
|
|
1
1
|
import { OracleResponse, ChatInput } from '@odla-ai/ai';
|
|
2
2
|
|
|
3
|
-
/** One bounded result location that an owner may inspect without loading the
|
|
4
|
-
* complete broker result into the activity stream. */
|
|
5
|
-
interface CodeToolLocationPreview {
|
|
6
|
-
path: string;
|
|
7
|
-
line?: number;
|
|
8
|
-
text?: string;
|
|
9
|
-
}
|
|
10
|
-
/** Deliberately small, tool-specific owner presentation. These projections are
|
|
11
|
-
* built after the trusted broker has bounded the corresponding request/result;
|
|
12
|
-
* they are not arbitrary model narration or complete tool output. */
|
|
13
|
-
type CodeToolPresentation = {
|
|
14
|
-
kind: "query";
|
|
15
|
-
query?: string;
|
|
16
|
-
scope?: string;
|
|
17
|
-
count?: number;
|
|
18
|
-
results?: CodeToolLocationPreview[];
|
|
19
|
-
excerpt?: string;
|
|
20
|
-
} | {
|
|
21
|
-
kind: "read";
|
|
22
|
-
path: string;
|
|
23
|
-
startLine?: number;
|
|
24
|
-
endLine?: number;
|
|
25
|
-
excerpt?: string;
|
|
26
|
-
} | {
|
|
27
|
-
kind: "list";
|
|
28
|
-
scope?: string;
|
|
29
|
-
count?: number;
|
|
30
|
-
paths?: string[];
|
|
31
|
-
} | {
|
|
32
|
-
kind: "patch";
|
|
33
|
-
paths?: string[];
|
|
34
|
-
additions?: number;
|
|
35
|
-
deletions?: number;
|
|
36
|
-
} | {
|
|
37
|
-
kind: "recipe";
|
|
38
|
-
recipeId: string;
|
|
39
|
-
exitCode?: number;
|
|
40
|
-
timedOut?: boolean;
|
|
41
|
-
outputLimitExceeded?: boolean;
|
|
42
|
-
excerpt?: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
3
|
/** Current JSONL protocol version exchanged between a runner and an agent container. */
|
|
46
4
|
declare const HARNESS_PROTOCOL_VERSION: 1;
|
|
47
5
|
/** Default control-plane route used for model inference requested by coding agents. */
|
|
@@ -170,81 +128,7 @@ interface HarnessInferenceResponse {
|
|
|
170
128
|
costUsd?: number;
|
|
171
129
|
};
|
|
172
130
|
}
|
|
173
|
-
|
|
174
|
-
* Message bodies are projected separately into the app's owner-private
|
|
175
|
-
* odla-db chat. `interactionId` is optional so stored v1 events remain valid. */
|
|
176
|
-
type CodeSessionEventData = ({
|
|
177
|
-
type: "message";
|
|
178
|
-
actor: "agent" | "system";
|
|
179
|
-
body: string;
|
|
180
|
-
} | {
|
|
181
|
-
type: "diagnostic";
|
|
182
|
-
level: "error";
|
|
183
|
-
message: string;
|
|
184
|
-
} | {
|
|
185
|
-
type: "thinking";
|
|
186
|
-
available: true;
|
|
187
|
-
durationMs: number;
|
|
188
|
-
} | {
|
|
189
|
-
type: "tool";
|
|
190
|
-
phase: "started";
|
|
191
|
-
tool: HarnessToolName;
|
|
192
|
-
operationId?: string;
|
|
193
|
-
presentation?: CodeToolPresentation;
|
|
194
|
-
} | {
|
|
195
|
-
type: "tool";
|
|
196
|
-
phase: "completed";
|
|
197
|
-
tool: HarnessToolName;
|
|
198
|
-
ok: boolean;
|
|
199
|
-
durationMs: number;
|
|
200
|
-
operationId?: string;
|
|
201
|
-
/** Why the call failed, bounded. Absent when `ok`. Without this a watcher
|
|
202
|
-
* saw that a tool failed and never why, which is what made an 84%
|
|
203
|
-
* apply_patch failure rate impossible to diagnose (PM bug 515655ec). */
|
|
204
|
-
failureReason?: string;
|
|
205
|
-
presentation?: CodeToolPresentation;
|
|
206
|
-
} | {
|
|
207
|
-
type: "collaboration";
|
|
208
|
-
phase: "started";
|
|
209
|
-
skill: string;
|
|
210
|
-
tool: string;
|
|
211
|
-
operationId: string;
|
|
212
|
-
} | {
|
|
213
|
-
type: "collaboration";
|
|
214
|
-
phase: "completed";
|
|
215
|
-
skill: string;
|
|
216
|
-
tool: string;
|
|
217
|
-
ok: boolean;
|
|
218
|
-
durationMs: number;
|
|
219
|
-
operationId: string;
|
|
220
|
-
} | {
|
|
221
|
-
type: "usage";
|
|
222
|
-
provider: string;
|
|
223
|
-
model: string;
|
|
224
|
-
inputTokens: number;
|
|
225
|
-
outputTokens: number;
|
|
226
|
-
durationMs: number;
|
|
227
|
-
interactionTokens?: number;
|
|
228
|
-
interactionMaxTokens?: number;
|
|
229
|
-
/** USD for this call; absent when the model is unpriced, never zero. */
|
|
230
|
-
costUsd?: number;
|
|
231
|
-
/** Cumulative USD for this owner interaction, when every call in it was
|
|
232
|
-
* priced. Absent the moment one was not, so a partial total can never be
|
|
233
|
-
* mistaken for the whole. */
|
|
234
|
-
interactionCostUsd?: number;
|
|
235
|
-
} | {
|
|
236
|
-
type: "status";
|
|
237
|
-
status: "running" | "idle" | "failed" | "checkpointed";
|
|
238
|
-
durationMs?: number;
|
|
239
|
-
}) & {
|
|
240
|
-
interactionId?: string;
|
|
241
|
-
};
|
|
242
|
-
/** Registry-assigned cursor and timestamp for an owner-visible Code event. */
|
|
243
|
-
type CodeSessionEvent = CodeSessionEventData & {
|
|
244
|
-
eventId: string;
|
|
245
|
-
sequence: number;
|
|
246
|
-
createdAt: number;
|
|
247
|
-
};
|
|
131
|
+
|
|
248
132
|
/** Closed set of effects an agent container may request from its trusted broker. */
|
|
249
133
|
type HarnessToolName = "sandbox.read" | "sandbox.list" | "sandbox.search" | "sandbox.overview" | "sandbox.where_is" | "sandbox.who_imports" | "sandbox.who_touches" | "sandbox.apply_patch" | "sandbox.edit" | "sandbox.write" | "sandbox.run_recipe";
|
|
250
134
|
/** Correlated, structured tool request emitted by an untrusted agent container. */
|
|
@@ -329,4 +213,4 @@ interface HarnessToolBroker {
|
|
|
329
213
|
}, request: HarnessToolRequest): Promise<HarnessToolResponse>;
|
|
330
214
|
}
|
|
331
215
|
|
|
332
|
-
export {
|
|
216
|
+
export { DEFAULT_AI_ROUTE as D, type HarnessControlPlane as H, type HarnessLease as a, type HarnessEventInput as b, type HarnessCompletion as c, type HarnessInferenceRequest as d, type HarnessInferenceResponse as e, type HarnessToolName as f, type HarnessToolBroker as g, type HarnessToolResponse as h, type HarnessAgentInput as i, type HarnessAgentOutput as j, type HarnessAiConnection as k, HARNESS_PROTOCOL_VERSION as l, type HarnessActor as m, type HarnessAttemptStatus as n, type HarnessAttemptSummary as o, type HarnessEvent as p, type HarnessPolicy as q, type HarnessRunnerView as r, type HarnessTaskDetail as s, type HarnessTaskSpec as t, type HarnessTaskStatus as u, type HarnessTaskSummary as v, type HarnessToolRequest as w };
|
|
@@ -1,47 +1,5 @@
|
|
|
1
1
|
import { OracleResponse, ChatInput } from '@odla-ai/ai';
|
|
2
2
|
|
|
3
|
-
/** One bounded result location that an owner may inspect without loading the
|
|
4
|
-
* complete broker result into the activity stream. */
|
|
5
|
-
interface CodeToolLocationPreview {
|
|
6
|
-
path: string;
|
|
7
|
-
line?: number;
|
|
8
|
-
text?: string;
|
|
9
|
-
}
|
|
10
|
-
/** Deliberately small, tool-specific owner presentation. These projections are
|
|
11
|
-
* built after the trusted broker has bounded the corresponding request/result;
|
|
12
|
-
* they are not arbitrary model narration or complete tool output. */
|
|
13
|
-
type CodeToolPresentation = {
|
|
14
|
-
kind: "query";
|
|
15
|
-
query?: string;
|
|
16
|
-
scope?: string;
|
|
17
|
-
count?: number;
|
|
18
|
-
results?: CodeToolLocationPreview[];
|
|
19
|
-
excerpt?: string;
|
|
20
|
-
} | {
|
|
21
|
-
kind: "read";
|
|
22
|
-
path: string;
|
|
23
|
-
startLine?: number;
|
|
24
|
-
endLine?: number;
|
|
25
|
-
excerpt?: string;
|
|
26
|
-
} | {
|
|
27
|
-
kind: "list";
|
|
28
|
-
scope?: string;
|
|
29
|
-
count?: number;
|
|
30
|
-
paths?: string[];
|
|
31
|
-
} | {
|
|
32
|
-
kind: "patch";
|
|
33
|
-
paths?: string[];
|
|
34
|
-
additions?: number;
|
|
35
|
-
deletions?: number;
|
|
36
|
-
} | {
|
|
37
|
-
kind: "recipe";
|
|
38
|
-
recipeId: string;
|
|
39
|
-
exitCode?: number;
|
|
40
|
-
timedOut?: boolean;
|
|
41
|
-
outputLimitExceeded?: boolean;
|
|
42
|
-
excerpt?: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
3
|
/** Current JSONL protocol version exchanged between a runner and an agent container. */
|
|
46
4
|
declare const HARNESS_PROTOCOL_VERSION: 1;
|
|
47
5
|
/** Default control-plane route used for model inference requested by coding agents. */
|
|
@@ -170,81 +128,7 @@ interface HarnessInferenceResponse {
|
|
|
170
128
|
costUsd?: number;
|
|
171
129
|
};
|
|
172
130
|
}
|
|
173
|
-
|
|
174
|
-
* Message bodies are projected separately into the app's owner-private
|
|
175
|
-
* odla-db chat. `interactionId` is optional so stored v1 events remain valid. */
|
|
176
|
-
type CodeSessionEventData = ({
|
|
177
|
-
type: "message";
|
|
178
|
-
actor: "agent" | "system";
|
|
179
|
-
body: string;
|
|
180
|
-
} | {
|
|
181
|
-
type: "diagnostic";
|
|
182
|
-
level: "error";
|
|
183
|
-
message: string;
|
|
184
|
-
} | {
|
|
185
|
-
type: "thinking";
|
|
186
|
-
available: true;
|
|
187
|
-
durationMs: number;
|
|
188
|
-
} | {
|
|
189
|
-
type: "tool";
|
|
190
|
-
phase: "started";
|
|
191
|
-
tool: HarnessToolName;
|
|
192
|
-
operationId?: string;
|
|
193
|
-
presentation?: CodeToolPresentation;
|
|
194
|
-
} | {
|
|
195
|
-
type: "tool";
|
|
196
|
-
phase: "completed";
|
|
197
|
-
tool: HarnessToolName;
|
|
198
|
-
ok: boolean;
|
|
199
|
-
durationMs: number;
|
|
200
|
-
operationId?: string;
|
|
201
|
-
/** Why the call failed, bounded. Absent when `ok`. Without this a watcher
|
|
202
|
-
* saw that a tool failed and never why, which is what made an 84%
|
|
203
|
-
* apply_patch failure rate impossible to diagnose (PM bug 515655ec). */
|
|
204
|
-
failureReason?: string;
|
|
205
|
-
presentation?: CodeToolPresentation;
|
|
206
|
-
} | {
|
|
207
|
-
type: "collaboration";
|
|
208
|
-
phase: "started";
|
|
209
|
-
skill: string;
|
|
210
|
-
tool: string;
|
|
211
|
-
operationId: string;
|
|
212
|
-
} | {
|
|
213
|
-
type: "collaboration";
|
|
214
|
-
phase: "completed";
|
|
215
|
-
skill: string;
|
|
216
|
-
tool: string;
|
|
217
|
-
ok: boolean;
|
|
218
|
-
durationMs: number;
|
|
219
|
-
operationId: string;
|
|
220
|
-
} | {
|
|
221
|
-
type: "usage";
|
|
222
|
-
provider: string;
|
|
223
|
-
model: string;
|
|
224
|
-
inputTokens: number;
|
|
225
|
-
outputTokens: number;
|
|
226
|
-
durationMs: number;
|
|
227
|
-
interactionTokens?: number;
|
|
228
|
-
interactionMaxTokens?: number;
|
|
229
|
-
/** USD for this call; absent when the model is unpriced, never zero. */
|
|
230
|
-
costUsd?: number;
|
|
231
|
-
/** Cumulative USD for this owner interaction, when every call in it was
|
|
232
|
-
* priced. Absent the moment one was not, so a partial total can never be
|
|
233
|
-
* mistaken for the whole. */
|
|
234
|
-
interactionCostUsd?: number;
|
|
235
|
-
} | {
|
|
236
|
-
type: "status";
|
|
237
|
-
status: "running" | "idle" | "failed" | "checkpointed";
|
|
238
|
-
durationMs?: number;
|
|
239
|
-
}) & {
|
|
240
|
-
interactionId?: string;
|
|
241
|
-
};
|
|
242
|
-
/** Registry-assigned cursor and timestamp for an owner-visible Code event. */
|
|
243
|
-
type CodeSessionEvent = CodeSessionEventData & {
|
|
244
|
-
eventId: string;
|
|
245
|
-
sequence: number;
|
|
246
|
-
createdAt: number;
|
|
247
|
-
};
|
|
131
|
+
|
|
248
132
|
/** Closed set of effects an agent container may request from its trusted broker. */
|
|
249
133
|
type HarnessToolName = "sandbox.read" | "sandbox.list" | "sandbox.search" | "sandbox.overview" | "sandbox.where_is" | "sandbox.who_imports" | "sandbox.who_touches" | "sandbox.apply_patch" | "sandbox.edit" | "sandbox.write" | "sandbox.run_recipe";
|
|
250
134
|
/** Correlated, structured tool request emitted by an untrusted agent container. */
|
|
@@ -329,4 +213,4 @@ interface HarnessToolBroker {
|
|
|
329
213
|
}, request: HarnessToolRequest): Promise<HarnessToolResponse>;
|
|
330
214
|
}
|
|
331
215
|
|
|
332
|
-
export {
|
|
216
|
+
export { DEFAULT_AI_ROUTE as D, type HarnessControlPlane as H, type HarnessLease as a, type HarnessEventInput as b, type HarnessCompletion as c, type HarnessInferenceRequest as d, type HarnessInferenceResponse as e, type HarnessToolName as f, type HarnessToolBroker as g, type HarnessToolResponse as h, type HarnessAgentInput as i, type HarnessAgentOutput as j, type HarnessAiConnection as k, HARNESS_PROTOCOL_VERSION as l, type HarnessActor as m, type HarnessAttemptStatus as n, type HarnessAttemptSummary as o, type HarnessEvent as p, type HarnessPolicy as q, type HarnessRunnerView as r, type HarnessTaskDetail as s, type HarnessTaskSpec as t, type HarnessTaskStatus as u, type HarnessTaskSummary as v, type HarnessToolRequest as w };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { ChatInput, OracleResponse } from \"@odla-ai/ai\";\nimport type { CodeToolPresentation } from \"./code-session-event-types\";\nexport type { CodeToolLocationPreview, CodeToolPresentation } from \"./code-session-event-types\";\n\n/** Current JSONL protocol version exchanged between a runner and an agent container. */\nexport const HARNESS_PROTOCOL_VERSION = 1 as const;\n\n/** Default control-plane route used for model inference requested by coding agents. */\nexport const DEFAULT_AI_ROUTE = \"coding\" as const;\n\n/** Lifecycle state reported for a harness task and its active attempt. */\nexport type HarnessTaskStatus =\n | \"queued\"\n | \"running\"\n | \"cancel_requested\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\";\n\n/** Lifecycle state of one execution attempt for a task. */\nexport type HarnessAttemptStatus = HarnessTaskStatus;\n\n/** Trusted or untrusted participant that emitted a harness event. */\nexport type HarnessActor = \"operator\" | \"runner\" | \"agent\" | \"model\" | \"system\";\n\n/** Resource and isolation limits enforced while an untrusted task executes. */\nexport interface HarnessPolicy {\n network: \"none\";\n timeoutMs: number;\n maxOutputBytes: number;\n maxPatchBytes: number;\n}\n\n/** Immutable task instructions and execution policy delivered with a lease. */\nexport interface HarnessTaskSpec {\n taskId: string;\n attemptId: string;\n title: string;\n prompt: string;\n workspace: string;\n aiRoute: string;\n policy: HarnessPolicy;\n parentAttemptId?: string | null;\n checkpointSeq?: number | null;\n}\n\n/** Time-bound assignment authorizing a runner to execute one task attempt. */\nexport interface HarnessLease {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n leaseId: string;\n generation: number;\n expiresAt: number;\n task: HarnessTaskSpec;\n}\n\n/** Runner-supplied event before the control plane assigns sequence and task metadata. */\nexport interface HarnessEventInput {\n eventId: string;\n kind: string;\n actor: HarnessActor;\n payload: unknown;\n createdAt: number;\n}\n\n/** Persisted, ordered event associated with a specific task attempt. */\nexport interface HarnessEvent extends HarnessEventInput {\n seq: number;\n taskId: string;\n attemptId: string;\n}\n\n/** List-view metadata for a task and its current attempt. */\nexport interface HarnessTaskSummary {\n taskId: string;\n attemptId: string;\n appId: string;\n env: string;\n title: string;\n prompt: string;\n workspace: string;\n aiRoute: string;\n status: HarnessTaskStatus;\n parentAttemptId: string | null;\n checkpointSeq: number | null;\n runnerId: string | null;\n generation: number;\n createdAt: number;\n updatedAt: number;\n}\n\n/** List-view metadata for one attempt, including retry ancestry and runner ownership. */\nexport interface HarnessAttemptSummary {\n attemptId: string;\n taskId: string;\n parentAttemptId: string | null;\n checkpointSeq: number | null;\n status: HarnessAttemptStatus;\n runnerId: string | null;\n generation: number;\n createdAt: number;\n updatedAt: number;\n}\n\n/** Complete task view including attempts, events, result, and generated patch. */\nexport interface HarnessTaskDetail extends HarnessTaskSummary {\n attempts: HarnessAttemptSummary[];\n events: HarnessEvent[];\n patch: string | null;\n result: unknown;\n}\n\n/** Public control-plane view of a registered harness runner. */\nexport interface HarnessRunnerView {\n runnerId: string;\n appId: string;\n env: string;\n name: string;\n createdAt: number;\n lastSeenAt: number | null;\n revokedAt: number | null;\n}\n\n/** Credential-free normalized model request sent from an agent through the runner. */\nexport interface HarnessInferenceRequest {\n requestId: string;\n /** Exact initial, follow-up, or resume command whose budget this call consumes. */\n interactionId?: string;\n call: ChatInput;\n}\n\n/** Normalized model response plus auditable provider, policy, and token metadata. */\nexport interface HarnessInferenceResponse {\n requestId: string;\n response: OracleResponse;\n receipt: {\n provider: string;\n model: string;\n policyVersion: number;\n inputTokens: number;\n outputTokens: number;\n /**\n * USD charged for this call, priced against the model the control plane\n * actually resolved.\n *\n * ABSENT when the live catalog has no price for that model — never zero.\n * An unpriced call is unknown spend, and reporting it as free is what let\n * a goal's `maxUsd` look enforced while nothing enforced it. The runtime\n * cannot compute this itself: it asks for `brokered` and only the control\n * plane knows which model answered.\n */\n costUsd?: number;\n };\n}\n\n/** Bounded, content-minimized session activity emitted by a Code runtime.\n * Message bodies are projected separately into the app's owner-private\n * odla-db chat. `interactionId` is optional so stored v1 events remain valid. */\nexport type CodeSessionEventData = (\n | { type: \"message\"; actor: \"agent\" | \"system\"; body: string }\n | { type: \"diagnostic\"; level: \"error\"; message: string }\n | { type: \"thinking\"; available: true; durationMs: number }\n | {\n type: \"tool\";\n phase: \"started\";\n tool: HarnessToolName;\n operationId?: string;\n presentation?: CodeToolPresentation;\n }\n | {\n type: \"tool\";\n phase: \"completed\";\n tool: HarnessToolName;\n ok: boolean;\n durationMs: number;\n operationId?: string;\n /** Why the call failed, bounded. Absent when `ok`. Without this a watcher\n * saw that a tool failed and never why, which is what made an 84%\n * apply_patch failure rate impossible to diagnose (PM bug 515655ec). */\n failureReason?: string;\n presentation?: CodeToolPresentation;\n }\n | {\n type: \"collaboration\";\n phase: \"started\";\n skill: string;\n tool: string;\n operationId: string;\n }\n | {\n type: \"collaboration\";\n phase: \"completed\";\n skill: string;\n tool: string;\n ok: boolean;\n durationMs: number;\n operationId: string;\n }\n | {\n type: \"usage\"; provider: string; model: string;\n inputTokens: number; outputTokens: number; durationMs: number;\n interactionTokens?: number; interactionMaxTokens?: number;\n /** USD for this call; absent when the model is unpriced, never zero. */\n costUsd?: number;\n /** Cumulative USD for this owner interaction, when every call in it was\n * priced. Absent the moment one was not, so a partial total can never be\n * mistaken for the whole. */\n interactionCostUsd?: number;\n }\n | {\n type: \"status\"; status: \"running\" | \"idle\" | \"failed\" | \"checkpointed\";\n durationMs?: number;\n }\n) & { interactionId?: string };\n\n/** Registry-assigned cursor and timestamp for an owner-visible Code event. */\nexport type CodeSessionEvent = CodeSessionEventData & {\n eventId: string; sequence: number; createdAt: number;\n};\n\n/** Closed set of effects an agent container may request from its trusted broker. */\nexport type HarnessToolName =\n | \"sandbox.read\"\n | \"sandbox.list\"\n | \"sandbox.search\"\n | \"sandbox.overview\"\n | \"sandbox.where_is\"\n | \"sandbox.who_imports\"\n | \"sandbox.who_touches\"\n | \"sandbox.apply_patch\"\n | \"sandbox.edit\"\n | \"sandbox.write\"\n | \"sandbox.run_recipe\";\n/** Correlated, structured tool request emitted by an untrusted agent container. */\nexport interface HarnessToolRequest {\n requestId: string;\n tool: HarnessToolName;\n input: Record<string, unknown>;\n}\n/** Bounded tool result returned to an agent after trusted policy evaluation. */\nexport interface HarnessToolResponse {\n requestId: string;\n ok: boolean;\n content: string;\n details?: Record<string, unknown>;\n}\n\n/** Validated JSONL message emitted by an untrusted agent container. */\nexport type HarnessAgentOutput =\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"event\";\n kind: string;\n payload?: unknown;\n }\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"inference.request\";\n requestId: string;\n call: ChatInput;\n }\n | ({ protocolVersion: typeof HARNESS_PROTOCOL_VERSION; type: \"tool.request\" } & HarnessToolRequest)\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"attempt.complete\";\n status: \"completed\" | \"failed\" | \"cancelled\";\n result?: unknown;\n };\n\n/** JSONL command or inference result written by the trusted runner to an agent. */\nexport type HarnessAgentInput =\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"task.start\";\n task: HarnessTaskSpec;\n }\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"inference.response\";\n requestId: string;\n response: OracleResponse;\n }\n | ({ protocolVersion: typeof HARNESS_PROTOCOL_VERSION; type: \"tool.response\" } & HarnessToolResponse)\n | {\n protocolVersion: typeof HARNESS_PROTOCOL_VERSION;\n type: \"attempt.cancel\";\n reason: string;\n };\n\n/** Terminal attempt report submitted by a runner to the control plane. */\nexport interface HarnessCompletion {\n status: \"completed\" | \"failed\" | \"cancelled\";\n result?: unknown;\n patch?: string;\n error?: string;\n}\n\n/** Operations a credentialed runner may perform against the harness control plane. */\nexport interface HarnessControlPlane {\n lease(workspaces: string[]): Promise<HarnessLease | null>;\n heartbeat(attemptId: string, leaseId: string): Promise<{ cancelRequested: boolean; expiresAt: number }>;\n appendEvents(attemptId: string, leaseId: string, events: HarnessEventInput[]): Promise<void>;\n infer(attemptId: string, leaseId: string, request: HarnessInferenceRequest): Promise<HarnessInferenceResponse>;\n complete(attemptId: string, leaseId: string, completion: HarnessCompletion): Promise<void>;\n}\n\n/** Trusted inference bridge used to keep model credentials outside agent containers. */\nexport interface HarnessAiConnection {\n infer(request: HarnessInferenceRequest): Promise<HarnessInferenceResponse>;\n}\n\n/** Trusted tool boundary. Implementations must evaluate CaMeL policy before effects. */\nexport interface HarnessToolBroker {\n execute(\n context: { lease: HarnessLease; workspaceDir: string; signal?: AbortSignal },\n request: HarnessToolRequest,\n ): Promise<HarnessToolResponse>;\n}\n"],"mappings":";AAKO,IAAM,2BAA2B;AAGjC,IAAM,mBAAmB;","names":[]}
|