@odla-ai/harness 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1149,7 +1149,7 @@ var CodeRuntimeCheckpointManager = class {
1149
1149
  await this.options.event(command, { type: "message", actor: "system", body: prepared.note }, active.conversationRefs).catch(() => void 0);
1150
1150
  await active.workspace.cleanup();
1151
1151
  await this.options.event(command, { type: "status", status: "checkpointed" }, active.conversationRefs).catch(() => void 0);
1152
- return { status: "checkpointed", checkpoint: prepared.checkpoint, message: "Pi stopped at a portable checkpoint" };
1152
+ return { status: "checkpointed", checkpoint: prepared.checkpoint, message: "Theseus stopped at a portable checkpoint" };
1153
1153
  }
1154
1154
  async acknowledged(command, result) {
1155
1155
  if (command.kind !== "checkpoint_stop" || result.status !== "checkpointed") return false;
@@ -1391,7 +1391,7 @@ var import_ai2 = require("@odla-ai/ai");
1391
1391
  var import_ai = require("@odla-ai/ai");
1392
1392
 
1393
1393
  // src/code-agent-skill.ts
1394
- var V1_SYSTEM_PROMPT = `You are Pi, the coding agent inside an odla Code harness.
1394
+ var V1_SYSTEM_PROMPT = `You are Theseus, the coding agent inside an odla Code harness.
1395
1395
  Use only the odla_read, odla_apply_git_diff, and odla_run_recipe tools.
1396
1396
  For mutations, call odla_apply_git_diff with raw git diff text. It must start
1397
1397
  with "diff --git a/<path> b/<path>", include matching "---" and "+++" file
@@ -1438,7 +1438,12 @@ function codeSkill(opts) {
1438
1438
  { lease: opts.lease, workspaceDir: opts.workspaceDir, signal },
1439
1439
  { requestId: `bench-${tool}-${++seq}`, tool, input }
1440
1440
  );
1441
- opts.onToolCall?.({ tool, ok: response2.ok, durationMs: Date.now() - startedAt });
1441
+ opts.onToolCall?.({
1442
+ tool,
1443
+ ok: response2.ok,
1444
+ durationMs: Date.now() - startedAt,
1445
+ ...response2.ok ? {} : { error: String(response2.content).slice(0, 300) }
1446
+ });
1442
1447
  return { content: response2.content, isError: !response2.ok };
1443
1448
  };
1444
1449
  const read2 = {
@@ -1469,11 +1474,17 @@ function codeSkill(opts) {
1469
1474
  };
1470
1475
  const runRecipe = {
1471
1476
  name: "odla_run_recipe",
1472
- description: "Run one app-registered build or test recipe through CaMeL policy.",
1477
+ description: `Run one app-registered build or test recipe through CaMeL policy.${opts.recipeIds?.length ? ` Available recipes: ${opts.recipeIds.join(", ")}.` : ""}`,
1473
1478
  inputSchema: {
1474
1479
  type: "object",
1475
1480
  required: ["recipeId"],
1476
- properties: { recipeId: { type: "string", minLength: 1, maxLength: 120, pattern: "^[a-zA-Z0-9._:-]+$" } },
1481
+ properties: { recipeId: {
1482
+ type: "string",
1483
+ minLength: 1,
1484
+ maxLength: 120,
1485
+ pattern: "^[a-zA-Z0-9._:-]+$",
1486
+ ...opts.recipeIds?.length ? { enum: [...opts.recipeIds] } : {}
1487
+ } },
1477
1488
  additionalProperties: false
1478
1489
  },
1479
1490
  handler: (input, ctx) => call("sandbox.run_recipe", input, ctx.signal)
@@ -1557,6 +1568,7 @@ async function runCodeAgent(options) {
1557
1568
  lease: options.lease,
1558
1569
  workspaceDir: options.workspaceDir,
1559
1570
  surface,
1571
+ ...options.recipeIds ? { recipeIds: options.recipeIds } : {},
1560
1572
  onToolCall: (call) => {
1561
1573
  toolCalls.push(call);
1562
1574
  options.onToolCall?.(call);
@@ -1587,7 +1599,7 @@ async function runCodeAgent(options) {
1587
1599
  // src/code-runtime-attempt.ts
1588
1600
  async function runCodeAgentAttempt(options) {
1589
1601
  try {
1590
- const surface = options.surface ?? "v2";
1602
+ const surface = options.surface ?? "v3";
1591
1603
  const { run } = await runCodeAgent({
1592
1604
  inference: options.inference,
1593
1605
  broker: options.broker,
@@ -1598,6 +1610,7 @@ async function runCodeAgentAttempt(options) {
1598
1610
  // id only labels the request the control plane is about to rewrite.
1599
1611
  model: "brokered",
1600
1612
  surface,
1613
+ ...options.recipeIds ? { recipeIds: options.recipeIds } : {},
1601
1614
  ...options.maxSteps === void 0 ? {} : { maxSteps: options.maxSteps },
1602
1615
  ...options.budget ? { budget: options.budget } : {},
1603
1616
  ...options.signal ? { signal: options.signal } : {},
@@ -2574,7 +2587,7 @@ var digestRuntimeValue = (value) => `sha256:${(0, import_node_crypto4.createHash
2574
2587
  var runtimeErrorMessage = (value) => value instanceof Error ? value.message : String(value);
2575
2588
 
2576
2589
  // src/code-runtime-engine.ts
2577
- var CodePiRuntimeEngine = class {
2590
+ var TheseusRuntimeEngine = class {
2578
2591
  constructor(options) {
2579
2592
  this.options = options;
2580
2593
  this.#attempt = options.runAgentAttempt ?? runCodeAgentAttempt;
@@ -2660,7 +2673,7 @@ var CodePiRuntimeEngine = class {
2660
2673
  await this.#failure(command, active, detail);
2661
2674
  return null;
2662
2675
  });
2663
- return { status: "running", message: resume ? "Pi resumed from a portable checkpoint" : "Pi started" };
2676
+ return { status: "running", message: resume ? "Theseus resumed from a portable checkpoint" : "Theseus started" };
2664
2677
  }
2665
2678
  /**
2666
2679
  * Pursue a goal: attempt, judge with the clean verifier, re-prompt from what
@@ -2748,7 +2761,7 @@ var CodePiRuntimeEngine = class {
2748
2761
  await this.#failure(command, active, detail);
2749
2762
  return null;
2750
2763
  });
2751
- return { status: "running", message: "Pi accepted the owner prompt" };
2764
+ return { status: "running", message: "Theseus accepted the owner prompt" };
2752
2765
  }
2753
2766
  async #runAttempt(command, metadata, active) {
2754
2767
  const lease = fakeCodeLease(command, metadata);
@@ -2773,7 +2786,8 @@ var CodePiRuntimeEngine = class {
2773
2786
  lease,
2774
2787
  workspaceDir: active.workspace.workspaceDir,
2775
2788
  prompt: metadata.prompt,
2776
- signal: active.abort.signal
2789
+ signal: active.abort.signal,
2790
+ recipeIds: this.options.recipes.map((recipe2) => recipe2.id)
2777
2791
  });
2778
2792
  const closing = result.finalText.trim();
2779
2793
  const completed = result.status === "completed" && Boolean(closing);
@@ -2837,7 +2851,7 @@ var CodePiRuntimeEngine = class {
2837
2851
  }
2838
2852
  }
2839
2853
  async #diagnostic(command, active, value) {
2840
- const detail = value.trim().slice(0, 2e3) || "Pi runtime failed";
2854
+ const detail = value.trim().slice(0, 2e3) || "Theseus runtime failed";
2841
2855
  this.options.onDiagnostic?.(detail);
2842
2856
  await this.#event(
2843
2857
  command,
@@ -2919,8 +2933,8 @@ async function main() {
2919
2933
  };
2920
2934
  const controller = new AbortController();
2921
2935
  for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => controller.abort(signal));
2922
- const control = createCodeRuntimeControlClient({ endpoint: options.endpoint, token, signal: controller.signal });
2923
- const commandEngine = new CodePiRuntimeEngine({
2936
+ const control = createCodeRuntimeControlClient({ endpoint: options.endpoint, token });
2937
+ const commandEngine = new TheseusRuntimeEngine({
2924
2938
  control,
2925
2939
  engine,
2926
2940
  recipes: policy.recipes,