@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.
@@ -351,12 +351,14 @@ async function runCodeRuntimeHeartbeatLoop(options) {
351
351
  } while (!options.signal?.aborted);
352
352
  }
353
353
  var CodeRuntimeReconciler = class {
354
- constructor(control, engine) {
354
+ constructor(control, engine, onDiagnostic) {
355
355
  this.control = control;
356
356
  this.engine = engine;
357
+ this.onDiagnostic = onDiagnostic;
357
358
  }
358
359
  control;
359
360
  engine;
361
+ onDiagnostic;
360
362
  results = /* @__PURE__ */ new Map();
361
363
  async reconcile(snapshot) {
362
364
  for (const command of snapshot.commands) {
@@ -374,7 +376,13 @@ var CodeRuntimeReconciler = class {
374
376
  }
375
377
  await this.control.acknowledge(command.commandId, completed.result);
376
378
  if (!completed.notified) {
377
- await this.engine.acknowledged?.(command, completed.result);
379
+ try {
380
+ await this.engine.acknowledged?.(command, completed.result);
381
+ } catch (error) {
382
+ this.onDiagnostic?.(
383
+ `command ${command.commandId} acknowledged handling failed \xB7 ${error instanceof Error ? error.message : String(error)}`
384
+ );
385
+ }
378
386
  completed.notified = true;
379
387
  }
380
388
  }
@@ -3025,6 +3033,57 @@ function codeRuntimeAcknowledgementGate(signal) {
3025
3033
  return { ready, release };
3026
3034
  }
3027
3035
 
3036
+ // src/code-runtime-session-activity.ts
3037
+ function observeCodeRuntimeSessionSkills(command, skills, emit) {
3038
+ return skills.map((skill) => ({
3039
+ ...skill,
3040
+ tools: skill.tools.map((tool) => {
3041
+ if (!tool.handler) return tool;
3042
+ const handler = tool.handler;
3043
+ return {
3044
+ ...tool,
3045
+ handler: async (input, context) => {
3046
+ const startedAt = Date.now();
3047
+ const operationId = digestRuntimeValue(
3048
+ `${command.commandId}:${skill.name}:${tool.name}:${context.toolCallId ?? "missing"}`
3049
+ );
3050
+ await emit({
3051
+ type: "collaboration",
3052
+ phase: "started",
3053
+ skill: skill.name,
3054
+ tool: tool.name,
3055
+ operationId
3056
+ }).catch(() => void 0);
3057
+ try {
3058
+ const output = await handler(input, context);
3059
+ await emit({
3060
+ type: "collaboration",
3061
+ phase: "completed",
3062
+ skill: skill.name,
3063
+ tool: tool.name,
3064
+ operationId,
3065
+ ok: output.isError !== true,
3066
+ durationMs: Date.now() - startedAt
3067
+ }).catch(() => void 0);
3068
+ return output;
3069
+ } catch (cause) {
3070
+ await emit({
3071
+ type: "collaboration",
3072
+ phase: "completed",
3073
+ skill: skill.name,
3074
+ tool: tool.name,
3075
+ operationId,
3076
+ ok: false,
3077
+ durationMs: Date.now() - startedAt
3078
+ }).catch(() => void 0);
3079
+ throw cause;
3080
+ }
3081
+ }
3082
+ };
3083
+ })
3084
+ }));
3085
+ }
3086
+
3028
3087
  // src/code-runtime-engine.ts
3029
3088
  var TheseusRuntimeEngine = class {
3030
3089
  constructor(options) {
@@ -3222,7 +3281,7 @@ var TheseusRuntimeEngine = class {
3222
3281
  event: (event) => this.#event(command, event, active.conversationRefs)
3223
3282
  });
3224
3283
  await this.#event(command, { type: "status", status: "running" }, active.conversationRefs);
3225
- const extraSkills = await sessionSkillsFor(this.options, command);
3284
+ const extraSkills = observeCodeRuntimeSessionSkills(command, await sessionSkillsFor(this.options, command), (event) => this.#event(command, event, active.conversationRefs));
3226
3285
  const result = await this.#attempt({
3227
3286
  inference,
3228
3287
  broker,
@@ -3398,7 +3457,12 @@ async function main() {
3398
3457
  onDiagnostic: (message2) => process.stderr.write(`[odla-code-runtime] agent failed \xB7 ${message2}
3399
3458
  `)
3400
3459
  });
3401
- const reconciler = new CodeRuntimeReconciler(control, commandEngine);
3460
+ const reconciler = new CodeRuntimeReconciler(
3461
+ control,
3462
+ commandEngine,
3463
+ (message2) => process.stderr.write(`[odla-code-runtime] ${message2}
3464
+ `)
3465
+ );
3402
3466
  try {
3403
3467
  await runCodeRuntimeHeartbeatLoop({
3404
3468
  control,