@odla-ai/cli 0.16.1 → 0.16.2

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/README.md CHANGED
@@ -29,8 +29,8 @@ For a project you keep working in, install it as a dev dependency so the
29
29
  shorter `npx odla-ai` form works and the version is pinned by your lockfile:
30
30
 
31
31
  ```bash
32
- npm view @odla-ai/cli@0.16.1 version
33
- npm i -D --save-exact @odla-ai/cli@0.16.1
32
+ npm view @odla-ai/cli@0.16.2 version
33
+ npm i -D --save-exact @odla-ai/cli@0.16.2
34
34
  ```
35
35
 
36
36
  ## Prerequisites
package/dist/bin.cjs CHANGED
@@ -1942,10 +1942,10 @@ var import_node_fs7 = require("fs");
1942
1942
  var import_node_os = require("os");
1943
1943
  var import_node_path4 = require("path");
1944
1944
 
1945
- // ../harness/dist/chunk-UG5XHNFB.js
1945
+ // ../harness/dist/chunk-7SN5SG4N.js
1946
1946
  var HARNESS_PROTOCOL_VERSION = 1;
1947
1947
 
1948
- // ../harness/dist/chunk-QALIIZRJ.js
1948
+ // ../harness/dist/chunk-HX4QYGWE.js
1949
1949
  var CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
1950
1950
  var HarnessProtocolError = class extends Error {
1951
1951
  name = "HarnessProtocolError";
@@ -2023,7 +2023,7 @@ function encodeAgentInput(message2) {
2023
2023
  `;
2024
2024
  }
2025
2025
 
2026
- // ../harness/dist/chunk-TA2FKK27.js
2026
+ // ../harness/dist/chunk-QWWRL7M4.js
2027
2027
  var import_child_process = require("child_process");
2028
2028
  var import_fs = require("fs");
2029
2029
  var import_promises2 = require("fs/promises");
@@ -2540,7 +2540,7 @@ async function stageWorkspacePair(baselineSource, workspaceSource, options = {})
2540
2540
  }
2541
2541
  }
2542
2542
 
2543
- // ../harness/dist/chunk-5E2R3LHE.js
2543
+ // ../harness/dist/chunk-T2RD6ZAW.js
2544
2544
  var import_crypto = require("crypto");
2545
2545
  var import_promises5 = require("fs/promises");
2546
2546
  var import_path5 = require("path");
@@ -2877,7 +2877,7 @@ function validateSnapshot(snapshot, limits) {
2877
2877
  }
2878
2878
  }
2879
2879
 
2880
- // ../harness/dist/chunk-5E2R3LHE.js
2880
+ // ../harness/dist/chunk-T2RD6ZAW.js
2881
2881
  var import_child_process4 = require("child_process");
2882
2882
  var import_promises6 = require("fs/promises");
2883
2883
  var import_path6 = require("path");
@@ -3170,7 +3170,7 @@ function looksLikeDestination(value) {
3170
3170
  return /^(?:[a-z][a-z0-9+.-]*:\/\/|\/|\\\\)/i.test(text) || /^[\w.-]+\.[a-z]{2,}(?:[/:]|$)/i.test(text);
3171
3171
  }
3172
3172
 
3173
- // ../harness/dist/chunk-5E2R3LHE.js
3173
+ // ../harness/dist/chunk-T2RD6ZAW.js
3174
3174
  var import_crypto4 = require("crypto");
3175
3175
  async function digestStagedWorkspace(root, limits) {
3176
3176
  const files = [];
@@ -4469,7 +4469,13 @@ var safeRuntimeJson = (value) => {
4469
4469
  };
4470
4470
  function runtimeResultText(value) {
4471
4471
  const record32 = runtimeRecord(value);
4472
- return record32 && typeof record32.text === "string" ? record32.text.slice(0, 2e4) : null;
4472
+ if (record32 && typeof record32.text === "string") return record32.text.slice(0, 2e4);
4473
+ if (record32 && typeof record32.error === "string") return `Pi failed: ${record32.error.slice(0, 19989)}`;
4474
+ return null;
4475
+ }
4476
+ function runtimeResultError(value) {
4477
+ const record32 = runtimeRecord(value);
4478
+ return record32 && typeof record32.error === "string" && record32.error.trim() ? record32.error.trim().slice(0, 2e3) : null;
4473
4479
  }
4474
4480
  var CodePiRuntimeEngine = class {
4475
4481
  constructor(options) {
@@ -4577,9 +4583,11 @@ var CodePiRuntimeEngine = class {
4577
4583
  }, conversationRefs);
4578
4584
  }
4579
4585
  active.done = this.#runAttempt(command, metadata2, active).catch(async (cause) => {
4580
- await this.#event(command, { type: "message", actor: "system", body: `Pi failed: ${runtimeErrorMessage(cause)}` }, conversationRefs).catch(() => void 0);
4586
+ const detail = runtimeErrorMessage(cause);
4587
+ await this.#event(command, { type: "message", actor: "system", body: `Pi failed: ${detail}` }, conversationRefs).catch(() => void 0);
4588
+ await this.#diagnostic(command, active, detail);
4581
4589
  await this.#event(command, { type: "status", status: "failed" }, conversationRefs).catch(() => void 0);
4582
- await this.#failure(command, active, runtimeErrorMessage(cause));
4590
+ await this.#failure(command, active, detail);
4583
4591
  return null;
4584
4592
  });
4585
4593
  return { status: "running", message: resume ? "Pi resumed from a portable checkpoint" : "Pi started" };
@@ -4604,13 +4612,15 @@ var CodePiRuntimeEngine = class {
4604
4612
  baseCommitSha: active.baseCommitSha,
4605
4613
  sourceTreeDigest: active.sourceTreeDigest
4606
4614
  }, active).catch(async (cause) => {
4615
+ const detail = runtimeErrorMessage(cause);
4607
4616
  await this.#event(
4608
4617
  command,
4609
- { type: "message", actor: "system", body: `Pi failed: ${runtimeErrorMessage(cause)}` },
4618
+ { type: "message", actor: "system", body: `Pi failed: ${detail}` },
4610
4619
  active.conversationRefs
4611
4620
  ).catch(() => void 0);
4621
+ await this.#diagnostic(command, active, detail);
4612
4622
  await this.#event(command, { type: "status", status: "failed" }, active.conversationRefs).catch(() => void 0);
4613
- await this.#failure(command, active, runtimeErrorMessage(cause));
4623
+ await this.#failure(command, active, detail);
4614
4624
  return null;
4615
4625
  });
4616
4626
  return { status: "running", message: "Pi accepted the owner prompt" };
@@ -4722,7 +4732,9 @@ var CodePiRuntimeEngine = class {
4722
4732
  durationMs: Date.now() - startedAt
4723
4733
  }, active.conversationRefs).catch(() => void 0);
4724
4734
  if (result.status === "failed") {
4725
- await this.#failure(command, active, result.stderr || "Pi container failed");
4735
+ const detail = (runtimeResultError(result.result) ?? result.stderr.trim()) || "Pi container failed";
4736
+ await this.#diagnostic(command, active, detail);
4737
+ await this.#failure(command, active, detail);
4726
4738
  }
4727
4739
  return result;
4728
4740
  }
@@ -4739,6 +4751,15 @@ var CodePiRuntimeEngine = class {
4739
4751
  await this.options.control.reportSessionFailure(command.sessionId, active.failure).catch(() => void 0);
4740
4752
  }
4741
4753
  }
4754
+ async #diagnostic(command, active, value) {
4755
+ const detail = value.trim().slice(0, 2e3) || "Pi runtime failed";
4756
+ this.options.onDiagnostic?.(detail);
4757
+ await this.#event(
4758
+ command,
4759
+ { type: "diagnostic", level: "error", message: detail },
4760
+ active.conversationRefs
4761
+ ).catch(() => void 0);
4762
+ }
4742
4763
  async #event(command, event, refs) {
4743
4764
  await appendCodeRuntimeEvent(this.options.control, command, event, refs);
4744
4765
  }
@@ -5291,7 +5312,8 @@ async function runCodeRuntime(input) {
5291
5312
  image: CODE_PI_IMAGE,
5292
5313
  recipes: CODE_BUILD_RECIPES,
5293
5314
  recipeAuthorization: "registered_recipe",
5294
- localSource: input.localSource
5315
+ localSource: input.localSource,
5316
+ onDiagnostic: (message2) => input.stdout.error(`Pi runtime failed \xB7 ${message2}`)
5295
5317
  });
5296
5318
  const reconciler = new CodeRuntimeReconciler(control, commandEngine);
5297
5319
  try {