@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/dist/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  exitCodeFor,
4
4
  runCli
5
- } from "./chunk-FRDIQURT.js";
5
+ } from "./chunk-PQX6SKYJ.js";
6
6
 
7
7
  // src/bin.ts
8
8
  runCli().catch((err) => {
@@ -1800,10 +1800,10 @@ import { existsSync as existsSync4 } from "fs";
1800
1800
  import { cpus, hostname, totalmem } from "os";
1801
1801
  import { resolve as resolve5 } from "path";
1802
1802
 
1803
- // ../harness/dist/chunk-UG5XHNFB.js
1803
+ // ../harness/dist/chunk-7SN5SG4N.js
1804
1804
  var HARNESS_PROTOCOL_VERSION = 1;
1805
1805
 
1806
- // ../harness/dist/chunk-QALIIZRJ.js
1806
+ // ../harness/dist/chunk-HX4QYGWE.js
1807
1807
  var CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
1808
1808
  var HarnessProtocolError = class extends Error {
1809
1809
  name = "HarnessProtocolError";
@@ -1881,7 +1881,7 @@ function encodeAgentInput(message2) {
1881
1881
  `;
1882
1882
  }
1883
1883
 
1884
- // ../harness/dist/chunk-TA2FKK27.js
1884
+ // ../harness/dist/chunk-QWWRL7M4.js
1885
1885
  import { execFile as execFile2, spawn as spawn2 } from "child_process";
1886
1886
  import { constants } from "fs";
1887
1887
  import { access } from "fs/promises";
@@ -2398,7 +2398,7 @@ async function stageWorkspacePair(baselineSource, workspaceSource, options = {})
2398
2398
  }
2399
2399
  }
2400
2400
 
2401
- // ../harness/dist/chunk-5E2R3LHE.js
2401
+ // ../harness/dist/chunk-T2RD6ZAW.js
2402
2402
  import { createHash } from "crypto";
2403
2403
  import { readFile, readdir as readdir2 } from "fs/promises";
2404
2404
  import { relative as relative3, resolve as resolve4 } from "path";
@@ -2735,7 +2735,7 @@ function validateSnapshot(snapshot, limits) {
2735
2735
  }
2736
2736
  }
2737
2737
 
2738
- // ../harness/dist/chunk-5E2R3LHE.js
2738
+ // ../harness/dist/chunk-T2RD6ZAW.js
2739
2739
  import { spawn as spawn4 } from "child_process";
2740
2740
  import { lstat as lstat2 } from "fs/promises";
2741
2741
  import { resolve as resolve23, sep as sep3 } from "path";
@@ -3028,7 +3028,7 @@ function looksLikeDestination(value) {
3028
3028
  return /^(?:[a-z][a-z0-9+.-]*:\/\/|\/|\\\\)/i.test(text) || /^[\w.-]+\.[a-z]{2,}(?:[/:]|$)/i.test(text);
3029
3029
  }
3030
3030
 
3031
- // ../harness/dist/chunk-5E2R3LHE.js
3031
+ // ../harness/dist/chunk-T2RD6ZAW.js
3032
3032
  import { createHash as createHash3 } from "crypto";
3033
3033
  async function digestStagedWorkspace(root, limits) {
3034
3034
  const files = [];
@@ -4327,7 +4327,13 @@ var safeRuntimeJson = (value) => {
4327
4327
  };
4328
4328
  function runtimeResultText(value) {
4329
4329
  const record32 = runtimeRecord(value);
4330
- return record32 && typeof record32.text === "string" ? record32.text.slice(0, 2e4) : null;
4330
+ if (record32 && typeof record32.text === "string") return record32.text.slice(0, 2e4);
4331
+ if (record32 && typeof record32.error === "string") return `Pi failed: ${record32.error.slice(0, 19989)}`;
4332
+ return null;
4333
+ }
4334
+ function runtimeResultError(value) {
4335
+ const record32 = runtimeRecord(value);
4336
+ return record32 && typeof record32.error === "string" && record32.error.trim() ? record32.error.trim().slice(0, 2e3) : null;
4331
4337
  }
4332
4338
  var CodePiRuntimeEngine = class {
4333
4339
  constructor(options) {
@@ -4435,9 +4441,11 @@ var CodePiRuntimeEngine = class {
4435
4441
  }, conversationRefs);
4436
4442
  }
4437
4443
  active.done = this.#runAttempt(command, metadata2, active).catch(async (cause) => {
4438
- await this.#event(command, { type: "message", actor: "system", body: `Pi failed: ${runtimeErrorMessage(cause)}` }, conversationRefs).catch(() => void 0);
4444
+ const detail = runtimeErrorMessage(cause);
4445
+ await this.#event(command, { type: "message", actor: "system", body: `Pi failed: ${detail}` }, conversationRefs).catch(() => void 0);
4446
+ await this.#diagnostic(command, active, detail);
4439
4447
  await this.#event(command, { type: "status", status: "failed" }, conversationRefs).catch(() => void 0);
4440
- await this.#failure(command, active, runtimeErrorMessage(cause));
4448
+ await this.#failure(command, active, detail);
4441
4449
  return null;
4442
4450
  });
4443
4451
  return { status: "running", message: resume ? "Pi resumed from a portable checkpoint" : "Pi started" };
@@ -4462,13 +4470,15 @@ var CodePiRuntimeEngine = class {
4462
4470
  baseCommitSha: active.baseCommitSha,
4463
4471
  sourceTreeDigest: active.sourceTreeDigest
4464
4472
  }, active).catch(async (cause) => {
4473
+ const detail = runtimeErrorMessage(cause);
4465
4474
  await this.#event(
4466
4475
  command,
4467
- { type: "message", actor: "system", body: `Pi failed: ${runtimeErrorMessage(cause)}` },
4476
+ { type: "message", actor: "system", body: `Pi failed: ${detail}` },
4468
4477
  active.conversationRefs
4469
4478
  ).catch(() => void 0);
4479
+ await this.#diagnostic(command, active, detail);
4470
4480
  await this.#event(command, { type: "status", status: "failed" }, active.conversationRefs).catch(() => void 0);
4471
- await this.#failure(command, active, runtimeErrorMessage(cause));
4481
+ await this.#failure(command, active, detail);
4472
4482
  return null;
4473
4483
  });
4474
4484
  return { status: "running", message: "Pi accepted the owner prompt" };
@@ -4580,7 +4590,9 @@ var CodePiRuntimeEngine = class {
4580
4590
  durationMs: Date.now() - startedAt
4581
4591
  }, active.conversationRefs).catch(() => void 0);
4582
4592
  if (result.status === "failed") {
4583
- await this.#failure(command, active, result.stderr || "Pi container failed");
4593
+ const detail = (runtimeResultError(result.result) ?? result.stderr.trim()) || "Pi container failed";
4594
+ await this.#diagnostic(command, active, detail);
4595
+ await this.#failure(command, active, detail);
4584
4596
  }
4585
4597
  return result;
4586
4598
  }
@@ -4597,6 +4609,15 @@ var CodePiRuntimeEngine = class {
4597
4609
  await this.options.control.reportSessionFailure(command.sessionId, active.failure).catch(() => void 0);
4598
4610
  }
4599
4611
  }
4612
+ async #diagnostic(command, active, value) {
4613
+ const detail = value.trim().slice(0, 2e3) || "Pi runtime failed";
4614
+ this.options.onDiagnostic?.(detail);
4615
+ await this.#event(
4616
+ command,
4617
+ { type: "diagnostic", level: "error", message: detail },
4618
+ active.conversationRefs
4619
+ ).catch(() => void 0);
4620
+ }
4600
4621
  async #event(command, event, refs) {
4601
4622
  await appendCodeRuntimeEvent(this.options.control, command, event, refs);
4602
4623
  }
@@ -4914,7 +4935,8 @@ async function runCodeRuntime(input) {
4914
4935
  image: CODE_PI_IMAGE,
4915
4936
  recipes: CODE_BUILD_RECIPES,
4916
4937
  recipeAuthorization: "registered_recipe",
4917
- localSource: input.localSource
4938
+ localSource: input.localSource,
4939
+ onDiagnostic: (message2) => input.stdout.error(`Pi runtime failed \xB7 ${message2}`)
4918
4940
  });
4919
4941
  const reconciler = new CodeRuntimeReconciler(control, commandEngine);
4920
4942
  try {
@@ -7754,4 +7776,4 @@ export {
7754
7776
  exitCodeFor,
7755
7777
  runCli
7756
7778
  };
7757
- //# sourceMappingURL=chunk-FRDIQURT.js.map
7779
+ //# sourceMappingURL=chunk-PQX6SKYJ.js.map