@odla-ai/harness 0.11.13 → 0.11.14
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-OXWLPB7P.js → chunk-6T26HEWI.js} +3 -2
- package/dist/chunk-6T26HEWI.js.map +1 -0
- package/dist/{chunk-B2PQAORN.js → chunk-ZXUN2STV.js} +30 -28
- package/dist/chunk-ZXUN2STV.js.map +1 -0
- package/dist/code-runtime-cli.cjs +42 -39
- package/dist/code-runtime-cli.cjs.map +1 -1
- package/dist/code-runtime-cli.js +2 -2
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/node.cjs +42 -39
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-B2PQAORN.js.map +0 -1
- package/dist/chunk-OXWLPB7P.js.map +0 -1
|
@@ -2803,7 +2803,8 @@ function codeToolRequestPresentation(request) {
|
|
|
2803
2803
|
}
|
|
2804
2804
|
function codeToolResultPresentation(request, response2) {
|
|
2805
2805
|
const started = codeToolRequestPresentation(request);
|
|
2806
|
-
if (!started
|
|
2806
|
+
if (!started) return void 0;
|
|
2807
|
+
if (!response2.ok && started.kind !== "recipe") return started;
|
|
2807
2808
|
const details = record3(response2.details);
|
|
2808
2809
|
if (started.kind === "read") {
|
|
2809
2810
|
return {
|
|
@@ -3748,7 +3749,7 @@ function validateOptions(options) {
|
|
|
3748
3749
|
function createCodeRuntimeToolBroker(input, lease, role) {
|
|
3749
3750
|
const broker = createCodeToolBroker({
|
|
3750
3751
|
recipes: input.recipes,
|
|
3751
|
-
recipeExecutor: createContainerRecipeExecutor(input.engine),
|
|
3752
|
+
recipeExecutor: input.recipeExecutor ?? createContainerRecipeExecutor(input.engine),
|
|
3752
3753
|
recipeAuthorization: input.recipeAuthorization ?? "registered_recipe",
|
|
3753
3754
|
readerId: `code-session:${lease.task.taskId}`,
|
|
3754
3755
|
readOnlyPrefixes: [".odla-references"]
|
|
@@ -3766,6 +3767,31 @@ function createCodeRuntimeToolBroker(input, lease, role) {
|
|
|
3766
3767
|
return role === "coding" ? broker : { execute: (context, request) => reviewTools.has(request.tool) ? broker.execute(context, request) : Promise.resolve({ requestId: request.requestId, ok: false, content: "review sessions are read-only" }) };
|
|
3767
3768
|
}
|
|
3768
3769
|
|
|
3770
|
+
// src/code-runtime-events.ts
|
|
3771
|
+
var import_node_crypto4 = require("crypto");
|
|
3772
|
+
async function appendCodeRuntimeEvent(control, command, event, refs) {
|
|
3773
|
+
const eventId = `${command.commandId.slice(0, 45)}:${refs.length + 1}`;
|
|
3774
|
+
refs.push(eventId);
|
|
3775
|
+
const attributed = { ...event, interactionId: command.commandId };
|
|
3776
|
+
const bounded = attributed.type === "message" ? { ...attributed, body: attributed.body.trim().slice(0, 2e4) || `${attributed.actor} event` } : attributed;
|
|
3777
|
+
await control.appendSessionEvent(command.sessionId, eventId, bounded);
|
|
3778
|
+
}
|
|
3779
|
+
var digestRuntimeValue = (value) => `sha256:${(0, import_node_crypto4.createHash)("sha256").update(value).digest("hex")}`;
|
|
3780
|
+
var runtimeErrorMessage = (value) => value instanceof Error ? value.message : String(value);
|
|
3781
|
+
|
|
3782
|
+
// src/code-runtime-engine-report.ts
|
|
3783
|
+
async function recordSessionFailure(options, command, active, value) {
|
|
3784
|
+
active.failure = value.slice(0, 2e3);
|
|
3785
|
+
if (active.acknowledged) {
|
|
3786
|
+
await options.control.reportSessionFailure(command.sessionId, active.failure).catch(() => void 0);
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
async function recordDiagnostic(options, command, active, value) {
|
|
3790
|
+
const detail = value.trim().slice(0, 2e3) || "Theseus runtime failed";
|
|
3791
|
+
options.onDiagnostic?.(detail);
|
|
3792
|
+
await appendCodeRuntimeEvent(options.control, command, { type: "diagnostic", level: "error", message: detail }, active.conversationRefs).catch(() => void 0);
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3769
3795
|
// src/code-memory.ts
|
|
3770
3796
|
var import_graph2 = require("@odla-ai/graph");
|
|
3771
3797
|
var MAX_MEMORY_BODY = 4e3;
|
|
@@ -4054,18 +4080,6 @@ async function startGoalPursuit(input) {
|
|
|
4054
4080
|
return { status: run.met ? "completed" : "failed", finalText: "" };
|
|
4055
4081
|
}
|
|
4056
4082
|
|
|
4057
|
-
// src/code-runtime-events.ts
|
|
4058
|
-
var import_node_crypto4 = require("crypto");
|
|
4059
|
-
async function appendCodeRuntimeEvent(control, command, event, refs) {
|
|
4060
|
-
const eventId = `${command.commandId.slice(0, 45)}:${refs.length + 1}`;
|
|
4061
|
-
refs.push(eventId);
|
|
4062
|
-
const attributed = { ...event, interactionId: command.commandId };
|
|
4063
|
-
const bounded = attributed.type === "message" ? { ...attributed, body: attributed.body.trim().slice(0, 2e4) || `${attributed.actor} event` } : attributed;
|
|
4064
|
-
await control.appendSessionEvent(command.sessionId, eventId, bounded);
|
|
4065
|
-
}
|
|
4066
|
-
var digestRuntimeValue = (value) => `sha256:${(0, import_node_crypto4.createHash)("sha256").update(value).digest("hex")}`;
|
|
4067
|
-
var runtimeErrorMessage = (value) => value instanceof Error ? value.message : String(value);
|
|
4068
|
-
|
|
4069
4083
|
// src/code-runtime-acknowledgement-gate.ts
|
|
4070
4084
|
function codeRuntimeAcknowledgementGate(signal) {
|
|
4071
4085
|
let settle;
|
|
@@ -4253,10 +4267,11 @@ var TheseusRuntimeEngine = class {
|
|
|
4253
4267
|
this.options = options;
|
|
4254
4268
|
this.#attempt = options.runAgentAttempt ?? runCodeAgentAttempt;
|
|
4255
4269
|
this.#buildPolicyDigest = digestRuntimeValue(JSON.stringify(options.recipes));
|
|
4270
|
+
this.#recipeExecutor = options.recipeExecutor ?? createContainerRecipeExecutor(options.engine, { dependencies: options.recipeDependencies ?? null });
|
|
4256
4271
|
this.#checkpoints = new CodeRuntimeCheckpointManager({
|
|
4257
4272
|
control: options.control,
|
|
4258
4273
|
recipes: options.recipes,
|
|
4259
|
-
recipeExecutor:
|
|
4274
|
+
recipeExecutor: this.#recipeExecutor,
|
|
4260
4275
|
fallbackPolicyDigest: this.#buildPolicyDigest,
|
|
4261
4276
|
event: (command, event, refs) => this.#event(command, event, refs)
|
|
4262
4277
|
});
|
|
@@ -4266,6 +4281,8 @@ var TheseusRuntimeEngine = class {
|
|
|
4266
4281
|
#attempt;
|
|
4267
4282
|
#buildPolicyDigest;
|
|
4268
4283
|
#checkpoints;
|
|
4284
|
+
/** One executor for the session broker, the verifier and goal pursuit, built with the host's dependency tree. */
|
|
4285
|
+
#recipeExecutor;
|
|
4269
4286
|
execute(command) {
|
|
4270
4287
|
if (command.kind === "checkpoint_stop") return this.#checkpoint(command);
|
|
4271
4288
|
if (command.kind === "pursue") return this.#pursue(command);
|
|
@@ -4338,9 +4355,9 @@ var TheseusRuntimeEngine = class {
|
|
|
4338
4355
|
active.done = startGate.ready.then((run) => run ? this.#runAttempt(command, metadata, active) : null).catch(async (cause) => {
|
|
4339
4356
|
const detail = runtimeErrorMessage(cause);
|
|
4340
4357
|
await this.#event(command, { type: "message", actor: "system", body: detail }, conversationRefs).catch(() => void 0);
|
|
4341
|
-
await this
|
|
4358
|
+
await recordDiagnostic(this.options, command, active, detail);
|
|
4342
4359
|
await this.#event(command, { type: "status", status: "failed" }, conversationRefs).catch(() => void 0);
|
|
4343
|
-
await this
|
|
4360
|
+
await recordSessionFailure(this.options, command, active, detail);
|
|
4344
4361
|
return null;
|
|
4345
4362
|
});
|
|
4346
4363
|
return {
|
|
@@ -4364,7 +4381,7 @@ var TheseusRuntimeEngine = class {
|
|
|
4364
4381
|
active.done = startGoalPursuit({
|
|
4365
4382
|
spec,
|
|
4366
4383
|
recipes: active.recipes,
|
|
4367
|
-
recipeExecutor: this
|
|
4384
|
+
recipeExecutor: this.#recipeExecutor,
|
|
4368
4385
|
workspace: active.workspace,
|
|
4369
4386
|
baseCommitSha: active.baseCommitSha,
|
|
4370
4387
|
trustedBaseDigest: active.trustedBaseDigest,
|
|
@@ -4386,8 +4403,8 @@ var TheseusRuntimeEngine = class {
|
|
|
4386
4403
|
}, active)
|
|
4387
4404
|
}).catch(async (cause) => {
|
|
4388
4405
|
const detail = runtimeErrorMessage(cause);
|
|
4389
|
-
await this
|
|
4390
|
-
await this
|
|
4406
|
+
await recordDiagnostic(this.options, command, active, detail);
|
|
4407
|
+
await recordSessionFailure(this.options, command, active, detail);
|
|
4391
4408
|
return { status: "failed", finalText: "", error: detail };
|
|
4392
4409
|
});
|
|
4393
4410
|
return { status: "running", message: `Pursuing the goal, up to ${spec.budget.maxAttempts} attempt(s)` };
|
|
@@ -4434,9 +4451,9 @@ var TheseusRuntimeEngine = class {
|
|
|
4434
4451
|
{ type: "message", actor: "system", body: detail },
|
|
4435
4452
|
active.conversationRefs
|
|
4436
4453
|
).catch(() => void 0);
|
|
4437
|
-
await this
|
|
4454
|
+
await recordDiagnostic(this.options, command, active, detail);
|
|
4438
4455
|
await this.#event(command, { type: "status", status: "failed" }, active.conversationRefs).catch(() => void 0);
|
|
4439
|
-
await this
|
|
4456
|
+
await recordSessionFailure(this.options, command, active, detail);
|
|
4440
4457
|
return null;
|
|
4441
4458
|
});
|
|
4442
4459
|
return { status: "running", message: "Theseus accepted the owner prompt" };
|
|
@@ -4446,6 +4463,7 @@ var TheseusRuntimeEngine = class {
|
|
|
4446
4463
|
const broker = this.#observed(command, active, createCodeRuntimeToolBroker({
|
|
4447
4464
|
recipes: active.recipes,
|
|
4448
4465
|
engine: this.options.engine,
|
|
4466
|
+
recipeExecutor: this.#recipeExecutor,
|
|
4449
4467
|
recipeAuthorization: this.options.recipeAuthorization
|
|
4450
4468
|
}, lease, metadata.role));
|
|
4451
4469
|
const startedAt = Date.now();
|
|
@@ -4488,8 +4506,8 @@ var TheseusRuntimeEngine = class {
|
|
|
4488
4506
|
durationMs: Date.now() - startedAt
|
|
4489
4507
|
}, active.conversationRefs).catch(() => void 0);
|
|
4490
4508
|
if (!completed) {
|
|
4491
|
-
await this
|
|
4492
|
-
await this
|
|
4509
|
+
await recordDiagnostic(this.options, command, active, detail);
|
|
4510
|
+
await recordSessionFailure(this.options, command, active, detail);
|
|
4493
4511
|
}
|
|
4494
4512
|
return {
|
|
4495
4513
|
...result,
|
|
@@ -4514,21 +4532,6 @@ var TheseusRuntimeEngine = class {
|
|
|
4514
4532
|
this.#active.delete(command.sessionId);
|
|
4515
4533
|
return result;
|
|
4516
4534
|
}
|
|
4517
|
-
async #failure(command, active, value) {
|
|
4518
|
-
active.failure = value.slice(0, 2e3);
|
|
4519
|
-
if (active.acknowledged) {
|
|
4520
|
-
await this.options.control.reportSessionFailure(command.sessionId, active.failure).catch(() => void 0);
|
|
4521
|
-
}
|
|
4522
|
-
}
|
|
4523
|
-
async #diagnostic(command, active, value) {
|
|
4524
|
-
const detail = value.trim().slice(0, 2e3) || "Theseus runtime failed";
|
|
4525
|
-
this.options.onDiagnostic?.(detail);
|
|
4526
|
-
await this.#event(
|
|
4527
|
-
command,
|
|
4528
|
-
{ type: "diagnostic", level: "error", message: detail },
|
|
4529
|
-
active.conversationRefs
|
|
4530
|
-
).catch(() => void 0);
|
|
4531
|
-
}
|
|
4532
4535
|
async #event(command, event, refs) {
|
|
4533
4536
|
await appendCodeRuntimeEvent(this.options.control, command, event, refs);
|
|
4534
4537
|
}
|