@odla-ai/harness 0.9.0 → 0.9.1

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.
@@ -4,10 +4,10 @@ import {
4
4
  stageWorkspace,
5
5
  stageWorkspacePair,
6
6
  verifyContainerEngineBoundary
7
- } from "./chunk-CR6RE3A2.js";
7
+ } from "./chunk-HDIR4MM5.js";
8
8
  import {
9
9
  HARNESS_PROTOCOL_VERSION
10
- } from "./chunk-RXNHCGWE.js";
10
+ } from "./chunk-I43KTCJ2.js";
11
11
 
12
12
  // src/workspace-digest.ts
13
13
  import { createHash } from "crypto";
@@ -186,12 +186,14 @@ async function runCodeRuntimeHeartbeatLoop(options) {
186
186
  } while (!options.signal?.aborted);
187
187
  }
188
188
  var CodeRuntimeReconciler = class {
189
- constructor(control, engine) {
189
+ constructor(control, engine, onDiagnostic) {
190
190
  this.control = control;
191
191
  this.engine = engine;
192
+ this.onDiagnostic = onDiagnostic;
192
193
  }
193
194
  control;
194
195
  engine;
196
+ onDiagnostic;
195
197
  results = /* @__PURE__ */ new Map();
196
198
  async reconcile(snapshot) {
197
199
  for (const command of snapshot.commands) {
@@ -209,7 +211,13 @@ var CodeRuntimeReconciler = class {
209
211
  }
210
212
  await this.control.acknowledge(command.commandId, completed.result);
211
213
  if (!completed.notified) {
212
- await this.engine.acknowledged?.(command, completed.result);
214
+ try {
215
+ await this.engine.acknowledged?.(command, completed.result);
216
+ } catch (error) {
217
+ this.onDiagnostic?.(
218
+ `command ${command.commandId} acknowledged handling failed \xB7 ${error instanceof Error ? error.message : String(error)}`
219
+ );
220
+ }
213
221
  completed.notified = true;
214
222
  }
215
223
  }
@@ -2795,6 +2803,57 @@ function codeRuntimeAcknowledgementGate(signal) {
2795
2803
  return { ready, release };
2796
2804
  }
2797
2805
 
2806
+ // src/code-runtime-session-activity.ts
2807
+ function observeCodeRuntimeSessionSkills(command, skills, emit) {
2808
+ return skills.map((skill) => ({
2809
+ ...skill,
2810
+ tools: skill.tools.map((tool) => {
2811
+ if (!tool.handler) return tool;
2812
+ const handler = tool.handler;
2813
+ return {
2814
+ ...tool,
2815
+ handler: async (input, context) => {
2816
+ const startedAt = Date.now();
2817
+ const operationId = digestRuntimeValue(
2818
+ `${command.commandId}:${skill.name}:${tool.name}:${context.toolCallId ?? "missing"}`
2819
+ );
2820
+ await emit({
2821
+ type: "collaboration",
2822
+ phase: "started",
2823
+ skill: skill.name,
2824
+ tool: tool.name,
2825
+ operationId
2826
+ }).catch(() => void 0);
2827
+ try {
2828
+ const output = await handler(input, context);
2829
+ await emit({
2830
+ type: "collaboration",
2831
+ phase: "completed",
2832
+ skill: skill.name,
2833
+ tool: tool.name,
2834
+ operationId,
2835
+ ok: output.isError !== true,
2836
+ durationMs: Date.now() - startedAt
2837
+ }).catch(() => void 0);
2838
+ return output;
2839
+ } catch (cause) {
2840
+ await emit({
2841
+ type: "collaboration",
2842
+ phase: "completed",
2843
+ skill: skill.name,
2844
+ tool: tool.name,
2845
+ operationId,
2846
+ ok: false,
2847
+ durationMs: Date.now() - startedAt
2848
+ }).catch(() => void 0);
2849
+ throw cause;
2850
+ }
2851
+ }
2852
+ };
2853
+ })
2854
+ }));
2855
+ }
2856
+
2798
2857
  // src/code-runtime-engine.ts
2799
2858
  var TheseusRuntimeEngine = class {
2800
2859
  constructor(options) {
@@ -2992,7 +3051,7 @@ var TheseusRuntimeEngine = class {
2992
3051
  event: (event) => this.#event(command, event, active.conversationRefs)
2993
3052
  });
2994
3053
  await this.#event(command, { type: "status", status: "running" }, active.conversationRefs);
2995
- const extraSkills = await sessionSkillsFor(this.options, command);
3054
+ const extraSkills = observeCodeRuntimeSessionSkills(command, await sessionSkillsFor(this.options, command), (event) => this.#event(command, event, active.conversationRefs));
2996
3055
  const result = await this.#attempt({
2997
3056
  inference,
2998
3057
  broker,
@@ -3134,4 +3193,4 @@ export {
3134
3193
  runGoal,
3135
3194
  TheseusRuntimeEngine
3136
3195
  };
3137
- //# sourceMappingURL=chunk-NG7AYYH3.js.map
3196
+ //# sourceMappingURL=chunk-4EPJJMFG.js.map