@odla-ai/cli 0.46.10 → 0.46.12

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-QI2UJSSB.js";
4
+ } from "./chunk-Q4BGAUEH.js";
5
5
  import {
6
6
  exitCodeFor
7
7
  } from "./chunk-5MEO3BVF.js";
@@ -9,4 +9,4 @@ export {
9
9
  exitCodeFor,
10
10
  runCli
11
11
  };
12
- //# sourceMappingURL=cli-URBPUBP5.js.map
12
+ //# sourceMappingURL=cli-5CDFI4AY.js.map
package/dist/index.cjs CHANGED
@@ -6119,10 +6119,10 @@ var import_node_fs16 = require("fs");
6119
6119
  var import_node_os5 = require("os");
6120
6120
  var import_node_path16 = require("path");
6121
6121
 
6122
- // ../harness/dist/chunk-RXNHCGWE.js
6122
+ // ../harness/dist/chunk-I43KTCJ2.js
6123
6123
  var HARNESS_PROTOCOL_VERSION = 1;
6124
6124
 
6125
- // ../harness/dist/chunk-CR6RE3A2.js
6125
+ // ../harness/dist/chunk-HDIR4MM5.js
6126
6126
  var import_child_process = require("child_process");
6127
6127
  var import_fs = require("fs");
6128
6128
  var import_promises2 = require("fs/promises");
@@ -6495,7 +6495,7 @@ async function stageWorkspacePair(baselineSource, workspaceSource, options = {})
6495
6495
  }
6496
6496
  }
6497
6497
 
6498
- // ../harness/dist/chunk-NG7AYYH3.js
6498
+ // ../harness/dist/chunk-4EPJJMFG.js
6499
6499
  var import_crypto = require("crypto");
6500
6500
  var import_promises5 = require("fs/promises");
6501
6501
  var import_path5 = require("path");
@@ -6832,7 +6832,7 @@ function validateSnapshot(snapshot, limits) {
6832
6832
  }
6833
6833
  }
6834
6834
 
6835
- // ../harness/dist/chunk-NG7AYYH3.js
6835
+ // ../harness/dist/chunk-4EPJJMFG.js
6836
6836
  var import_child_process4 = require("child_process");
6837
6837
  var import_promises6 = require("fs/promises");
6838
6838
  var import_path6 = require("path");
@@ -7136,7 +7136,7 @@ function looksLikeDestination(value2) {
7136
7136
  return /^(?:[a-z][a-z0-9+.-]*:\/\/|\/|\\\\)/i.test(text4) || /^[\w.-]+\.[a-z]{2,}(?:[/:]|$)/i.test(text4);
7137
7137
  }
7138
7138
 
7139
- // ../harness/dist/chunk-NG7AYYH3.js
7139
+ // ../harness/dist/chunk-4EPJJMFG.js
7140
7140
  var import_promises10 = require("fs/promises");
7141
7141
  var import_promises11 = require("fs/promises");
7142
7142
  var import_path10 = require("path");
@@ -7404,7 +7404,7 @@ async function buildCodeGraph(input) {
7404
7404
  return builder.build();
7405
7405
  }
7406
7406
 
7407
- // ../harness/dist/chunk-NG7AYYH3.js
7407
+ // ../harness/dist/chunk-4EPJJMFG.js
7408
7408
  var import_crypto4 = require("crypto");
7409
7409
  async function digestStagedWorkspace(root, limits) {
7410
7410
  const files = [];
@@ -7572,12 +7572,14 @@ async function runCodeRuntimeHeartbeatLoop(options) {
7572
7572
  } while (!options.signal?.aborted);
7573
7573
  }
7574
7574
  var CodeRuntimeReconciler = class {
7575
- constructor(control, engine) {
7575
+ constructor(control, engine, onDiagnostic) {
7576
7576
  this.control = control;
7577
7577
  this.engine = engine;
7578
+ this.onDiagnostic = onDiagnostic;
7578
7579
  }
7579
7580
  control;
7580
7581
  engine;
7582
+ onDiagnostic;
7581
7583
  results = /* @__PURE__ */ new Map();
7582
7584
  async reconcile(snapshot) {
7583
7585
  for (const command of snapshot.commands) {
@@ -7595,7 +7597,13 @@ var CodeRuntimeReconciler = class {
7595
7597
  }
7596
7598
  await this.control.acknowledge(command.commandId, completed.result);
7597
7599
  if (!completed.notified) {
7598
- await this.engine.acknowledged?.(command, completed.result);
7600
+ try {
7601
+ await this.engine.acknowledged?.(command, completed.result);
7602
+ } catch (error) {
7603
+ this.onDiagnostic?.(
7604
+ `command ${command.commandId} acknowledged handling failed \xB7 ${error instanceof Error ? error.message : String(error)}`
7605
+ );
7606
+ }
7599
7607
  completed.notified = true;
7600
7608
  }
7601
7609
  }
@@ -10039,6 +10047,55 @@ function codeRuntimeAcknowledgementGate(signal) {
10039
10047
  else signal.addEventListener("abort", onAbort, { once: true });
10040
10048
  return { ready, release };
10041
10049
  }
10050
+ function observeCodeRuntimeSessionSkills(command, skills, emit4) {
10051
+ return skills.map((skill) => ({
10052
+ ...skill,
10053
+ tools: skill.tools.map((tool) => {
10054
+ if (!tool.handler) return tool;
10055
+ const handler = tool.handler;
10056
+ return {
10057
+ ...tool,
10058
+ handler: async (input, context) => {
10059
+ const startedAt = Date.now();
10060
+ const operationId = digestRuntimeValue(
10061
+ `${command.commandId}:${skill.name}:${tool.name}:${context.toolCallId ?? "missing"}`
10062
+ );
10063
+ await emit4({
10064
+ type: "collaboration",
10065
+ phase: "started",
10066
+ skill: skill.name,
10067
+ tool: tool.name,
10068
+ operationId
10069
+ }).catch(() => void 0);
10070
+ try {
10071
+ const output = await handler(input, context);
10072
+ await emit4({
10073
+ type: "collaboration",
10074
+ phase: "completed",
10075
+ skill: skill.name,
10076
+ tool: tool.name,
10077
+ operationId,
10078
+ ok: output.isError !== true,
10079
+ durationMs: Date.now() - startedAt
10080
+ }).catch(() => void 0);
10081
+ return output;
10082
+ } catch (cause) {
10083
+ await emit4({
10084
+ type: "collaboration",
10085
+ phase: "completed",
10086
+ skill: skill.name,
10087
+ tool: tool.name,
10088
+ operationId,
10089
+ ok: false,
10090
+ durationMs: Date.now() - startedAt
10091
+ }).catch(() => void 0);
10092
+ throw cause;
10093
+ }
10094
+ }
10095
+ };
10096
+ })
10097
+ }));
10098
+ }
10042
10099
  var TheseusRuntimeEngine = class {
10043
10100
  constructor(options) {
10044
10101
  this.options = options;
@@ -10235,7 +10292,7 @@ var TheseusRuntimeEngine = class {
10235
10292
  event: (event) => this.#event(command, event, active.conversationRefs)
10236
10293
  });
10237
10294
  await this.#event(command, { type: "status", status: "running" }, active.conversationRefs);
10238
- const extraSkills = await sessionSkillsFor(this.options, command);
10295
+ const extraSkills = observeCodeRuntimeSessionSkills(command, await sessionSkillsFor(this.options, command), (event) => this.#event(command, event, active.conversationRefs));
10239
10296
  const result = await this.#attempt({
10240
10297
  inference,
10241
10298
  broker,
@@ -10759,7 +10816,11 @@ async function runCodeRuntime(input) {
10759
10816
  localSource: input.localSource,
10760
10817
  onDiagnostic: (message2) => input.stdout.error(`Theseus runtime failed \xB7 ${message2}`)
10761
10818
  });
10762
- const reconciler = new CodeRuntimeReconciler(control, commandEngine);
10819
+ const reconciler = new CodeRuntimeReconciler(
10820
+ control,
10821
+ commandEngine,
10822
+ (message2) => input.stdout.error(`Theseus runtime \xB7 ${message2}`)
10823
+ );
10763
10824
  try {
10764
10825
  await runCodeRuntimeHeartbeatLoop({
10765
10826
  control,
@@ -12607,13 +12668,15 @@ async function pmNext(ctx, parsed) {
12607
12668
  const ready = tasks.filter((record11) => record11.column === READY_COLUMN);
12608
12669
  const doing = tasks.filter((record11) => record11.column === "doing");
12609
12670
  const guidance = !goals.length ? "discuss alignment with the user before creating or claiming project work" : !ready.length ? 'refine a linked Backlog task and mark it Ready with "pm task ready <id>"' : `claim the top Ready task in one call: odla-ai pm start --app ${appId}`;
12671
+ const monitor = `odla-ai pm watch --app ${appId} --jsonl`;
12610
12672
  const result = {
12611
12673
  appId,
12612
12674
  projectId,
12613
12675
  openGoals: leanRecords("goal", goals, verbose),
12614
12676
  doing: leanRecords("task", doing, verbose),
12615
12677
  ready: leanRecords("task", ready, verbose),
12616
- next: guidance
12678
+ next: guidance,
12679
+ monitor
12617
12680
  };
12618
12681
  emit2(ctx, result, () => {
12619
12682
  ctx.out.log(`${appId}: goal-aligned work intake (read only)`);
@@ -12627,6 +12690,7 @@ async function pmNext(ctx, parsed) {
12627
12690
  else for (const record11 of records) printRecord(ctx, entity, record11);
12628
12691
  }
12629
12692
  ctx.out.log(`next: ${guidance}`);
12693
+ ctx.out.log(`monitor: ${monitor}`);
12630
12694
  });
12631
12695
  }
12632
12696
  async function pmHandoff(ctx, parsed) {
@@ -12638,17 +12702,20 @@ async function pmHandoff(ctx, parsed) {
12638
12702
  listFiltered(ctx, "bug", appId, projectId, { status: OPEN_BUG_STATUSES })
12639
12703
  ]);
12640
12704
  const clean4 = !goals.length && !tasks.length && !bugs.length;
12705
+ const monitor = `odla-ai pm watch --app ${appId} --jsonl`;
12641
12706
  const result = {
12642
12707
  appId,
12643
12708
  projectId,
12644
12709
  unmetGoals: leanRecords("goal", goals, verbose),
12645
12710
  activeTasks: leanRecords("task", tasks, verbose),
12646
12711
  openBugs: leanRecords("bug", bugs, verbose),
12647
- clean: clean4
12712
+ clean: clean4,
12713
+ monitor
12648
12714
  };
12649
12715
  emit2(ctx, result, () => {
12650
12716
  if (clean4) {
12651
12717
  ctx.out.log(`${appId}: no unresolved PM work`);
12718
+ ctx.out.log(`monitor: ${monitor}`);
12652
12719
  return;
12653
12720
  }
12654
12721
  ctx.out.log(`${appId}: authoritative PM handoff`);
@@ -12661,6 +12728,7 @@ async function pmHandoff(ctx, parsed) {
12661
12728
  if (!records.length) ctx.out.log("- (none)");
12662
12729
  else for (const record11 of records) printRecord(ctx, entity, record11);
12663
12730
  }
12731
+ ctx.out.log(`monitor: ${monitor}`);
12664
12732
  });
12665
12733
  }
12666
12734