@odla-ai/harness 0.11.17 → 0.11.19

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.
Files changed (39) hide show
  1. package/dist/{chunk-T2IW7MYQ.js → chunk-4TG55ATB.js} +2 -2
  2. package/dist/{chunk-RDCU4PIP.js → chunk-7NP3YOMY.js} +37 -9
  3. package/dist/chunk-7NP3YOMY.js.map +1 -0
  4. package/dist/{chunk-3ON6UAOV.js → chunk-A5B3CEK2.js} +3 -3
  5. package/dist/{chunk-EXSEQEZ6.js → chunk-M6BNH25Z.js} +4 -4
  6. package/dist/{chunk-ONYW2VSB.js → chunk-O4QLHUGO.js} +1 -1
  7. package/dist/chunk-O4QLHUGO.js.map +1 -0
  8. package/dist/{chunk-6T26HEWI.js → chunk-SMN2FWQE.js} +17 -3
  9. package/dist/{chunk-6T26HEWI.js.map → chunk-SMN2FWQE.js.map} +1 -1
  10. package/dist/cli.cjs.map +1 -1
  11. package/dist/cli.js +4 -4
  12. package/dist/code-runtime-cli.cjs +46 -7
  13. package/dist/code-runtime-cli.cjs.map +1 -1
  14. package/dist/code-runtime-cli.js +5 -5
  15. package/dist/code-session-event-data-C6mQB76s.d.cts +134 -0
  16. package/dist/code-session-event-data-wCQc2py3.d.ts +134 -0
  17. package/dist/index.cjs +19 -2
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +15 -4
  20. package/dist/index.d.ts +15 -4
  21. package/dist/index.js +9 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/node.cjs +46 -7
  24. package/dist/node.cjs.map +1 -1
  25. package/dist/node.d.cts +23 -7
  26. package/dist/node.d.ts +23 -7
  27. package/dist/node.js +6 -6
  28. package/dist/testing.cjs.map +1 -1
  29. package/dist/testing.d.cts +1 -1
  30. package/dist/testing.d.ts +1 -1
  31. package/dist/testing.js +1 -1
  32. package/dist/{types-D-Kv1svf.d.ts → types-DM-UgoBN.d.cts} +2 -118
  33. package/dist/{types-D-Kv1svf.d.cts → types-DM-UgoBN.d.ts} +2 -118
  34. package/package.json +1 -1
  35. package/dist/chunk-ONYW2VSB.js.map +0 -1
  36. package/dist/chunk-RDCU4PIP.js.map +0 -1
  37. /package/dist/{chunk-T2IW7MYQ.js.map → chunk-4TG55ATB.js.map} +0 -0
  38. /package/dist/{chunk-3ON6UAOV.js.map → chunk-A5B3CEK2.js.map} +0 -0
  39. /package/dist/{chunk-EXSEQEZ6.js.map → chunk-M6BNH25Z.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-PTXZVYD4.js";
5
5
  import {
6
6
  runHarnessRunner
7
- } from "./chunk-EXSEQEZ6.js";
7
+ } from "./chunk-M6BNH25Z.js";
8
8
  import {
9
9
  selectContainerEngine
10
- } from "./chunk-3ON6UAOV.js";
11
- import "./chunk-T2IW7MYQ.js";
12
- import "./chunk-ONYW2VSB.js";
10
+ } from "./chunk-A5B3CEK2.js";
11
+ import "./chunk-4TG55ATB.js";
12
+ import "./chunk-O4QLHUGO.js";
13
13
 
14
14
  // src/cli.ts
15
15
  import { resolve } from "path";
@@ -523,7 +523,7 @@ var CodeRuntimeReconciler = class {
523
523
  };
524
524
 
525
525
  // src/code-runtime.ts
526
- var CODE_RUNTIME_PROTOCOL_VERSION = 3;
526
+ var CODE_RUNTIME_PROTOCOL_VERSION = 4;
527
527
  async function runCodeRuntimeHeartbeatLoop(options) {
528
528
  const heartbeatMs = options.heartbeatMs ?? 15e3;
529
529
  if (!Number.isSafeInteger(heartbeatMs) || heartbeatMs < 1e3 || heartbeatMs > 3e5) {
@@ -1685,13 +1685,13 @@ function codeCommandMetadata(payload, resume) {
1685
1685
  const title = payload.title;
1686
1686
  const prompt = payload.prompt;
1687
1687
  const maxTokensPerInteraction = payload.maxTokensPerInteraction ?? 32e3;
1688
- if (role !== "coding" && role !== "review" || typeof title !== "string" || typeof prompt !== "string") {
1688
+ if (role !== "coding" && role !== "review" && role !== "planning" || typeof title !== "string" || typeof prompt !== "string") {
1689
1689
  throw new TypeError(`invalid Code ${resume ? "resume" : "start"} metadata`);
1690
1690
  }
1691
1691
  if (payload.readOnly !== void 0 && typeof payload.readOnly !== "boolean") {
1692
1692
  throw new TypeError(`invalid Code ${resume ? "resume" : "start"} read-only capability`);
1693
1693
  }
1694
- const readOnly = role === "review" || payload.readOnly === true;
1694
+ const readOnly = role !== "coding" || payload.readOnly === true;
1695
1695
  const planning = trusted?.planningInputDigest;
1696
1696
  const attestation = trusted?.attestationDigest;
1697
1697
  const repository = trusted?.repository;
@@ -1704,11 +1704,16 @@ function codeCommandMetadata(payload, resume) {
1704
1704
  if (!Number.isSafeInteger(maxTokensPerInteraction) || Number(maxTokensPerInteraction) < 4e3 || Number(maxTokensPerInteraction) > 2e5) {
1705
1705
  throw new TypeError(`invalid Code ${resume ? "resume" : "start"} interaction token limit`);
1706
1706
  }
1707
+ const eventDetail = payload.eventDetail ?? "standard";
1708
+ if (eventDetail !== "standard" && eventDetail !== "verbose") {
1709
+ throw new TypeError(`invalid Code ${resume ? "resume" : "start"} event detail`);
1710
+ }
1707
1711
  return {
1708
1712
  role,
1709
1713
  readOnly,
1710
1714
  title,
1711
1715
  prompt,
1716
+ eventDetail,
1712
1717
  proof: codeCommandProof(payload.proof, resume),
1713
1718
  maxTokensPerInteraction: Number(maxTokensPerInteraction),
1714
1719
  planningInputDigest: typeof planning === "string" && /^sha256:[0-9a-f]{64}$/.test(planning) ? planning : null,
@@ -2657,6 +2662,20 @@ async function sessionSkillsFor(options, command) {
2657
2662
 
2658
2663
  // src/code-runtime-inference.ts
2659
2664
  var inferWithBackoff = (infer, wait2, onRetry) => withOverloadRetry(infer, wait2, (cause, delayMs) => onRetry(cause, delayMs), transientControlFailure);
2665
+ var MAX_VERBOSE_TEXT = 4e3;
2666
+ var clip = (text2) => text2.length <= MAX_VERBOSE_TEXT ? text2 : `${text2.slice(0, MAX_VERBOSE_TEXT - 1)}\u2026`;
2667
+ function verboseTurnEvents(response2, durationMs) {
2668
+ const events = [];
2669
+ const interim = response2.response.stopReason === "tool_use";
2670
+ for (const block of response2.response.content) {
2671
+ if (block.type === "thinking" && block.thinking.trim()) {
2672
+ events.push({ type: "thinking", available: true, durationMs, text: clip(block.thinking.trim()) });
2673
+ } else if (block.type === "text" && interim && block.text.trim()) {
2674
+ events.push({ type: "text", text: clip(block.text.trim()) });
2675
+ }
2676
+ }
2677
+ return events;
2678
+ }
2660
2679
  async function handleCodeRuntimeInference(input) {
2661
2680
  const { command, request, state } = input;
2662
2681
  const startedAt = Date.now();
@@ -2674,6 +2693,11 @@ async function handleCodeRuntimeInference(input) {
2674
2693
  message: `Code control plane overloaded (${cause.code}); retrying the model call in ${delayMs / 1e3}s`
2675
2694
  }).catch(() => void 0)
2676
2695
  );
2696
+ if (input.metadata.eventDetail === "verbose") {
2697
+ for (const event of verboseTurnEvents(response2, Date.now() - startedAt)) {
2698
+ await input.event(event).catch(() => void 0);
2699
+ }
2700
+ }
2677
2701
  state.tokens += response2.receipt.inputTokens + response2.receipt.outputTokens;
2678
2702
  const { costUsd } = response2.receipt;
2679
2703
  if (costUsd === void 0) state.costKnown = false;
@@ -2868,8 +2892,17 @@ var DEFAULT_FAILURE_REASON = {
2868
2892
  "tool denied by CaMeL policy": "tool denied by CaMeL policy",
2869
2893
  "review sessions are read-only": "review session is read-only; workspace changes are not permitted"
2870
2894
  };
2895
+ var MAX_VERBOSE_TOOL_BYTES = 4096;
2896
+ function boundedToolInput(value) {
2897
+ const serialized = JSON.stringify(value);
2898
+ return serialized.length <= MAX_VERBOSE_TOOL_BYTES ? value : { truncated: true, bytes: serialized.length, keys: Object.keys(value).slice(0, 20) };
2899
+ }
2900
+ function boundedToolOutput(content) {
2901
+ return content.length <= MAX_VERBOSE_TOOL_BYTES ? content : `${content.slice(0, MAX_VERBOSE_TOOL_BYTES - 1)}\u2026`;
2902
+ }
2871
2903
  function observedBroker(input) {
2872
2904
  const now = input.now ?? Date.now;
2905
+ const verbose = input.detail === "verbose";
2873
2906
  return {
2874
2907
  execute: async (context, request) => {
2875
2908
  const startedAt = now();
@@ -2880,7 +2913,8 @@ function observedBroker(input) {
2880
2913
  phase: "started",
2881
2914
  tool: request.tool,
2882
2915
  operationId,
2883
- ...startedPresentation ? { presentation: startedPresentation } : {}
2916
+ ...startedPresentation ? { presentation: startedPresentation } : {},
2917
+ ...verbose ? { input: boundedToolInput(request.input) } : {}
2884
2918
  });
2885
2919
  const response2 = await input.broker.execute(context, request);
2886
2920
  const completedPresentation = codeToolResultPresentation(request, response2);
@@ -2893,7 +2927,8 @@ function observedBroker(input) {
2893
2927
  durationMs: now() - startedAt,
2894
2928
  operationId,
2895
2929
  ...failureReason ? { failureReason } : {},
2896
- ...completedPresentation ? { presentation: completedPresentation } : {}
2930
+ ...completedPresentation ? { presentation: completedPresentation } : {},
2931
+ ...verbose ? { output: boundedToolOutput(response2.content) } : {}
2897
2932
  });
2898
2933
  return response2;
2899
2934
  }
@@ -3786,7 +3821,7 @@ function createCodeRuntimeToolBroker(input, lease, role) {
3786
3821
  "sandbox.who_touches",
3787
3822
  "sandbox.run_recipe"
3788
3823
  ]);
3789
- return role === "coding" ? broker : { execute: (context, request) => reviewTools.has(request.tool) ? broker.execute(context, request) : Promise.resolve({ requestId: request.requestId, ok: false, content: "review sessions are read-only" }) };
3824
+ return role !== "review" ? broker : { execute: (context, request) => reviewTools.has(request.tool) ? broker.execute(context, request) : Promise.resolve({ requestId: request.requestId, ok: false, content: "review sessions are read-only" }) };
3790
3825
  }
3791
3826
 
3792
3827
  // src/code-runtime-events.ts
@@ -4350,6 +4385,7 @@ var TheseusRuntimeEngine = class {
4350
4385
  buildPolicyDigest: resolvedRecipes.buildPolicyDigest,
4351
4386
  role: metadata.role,
4352
4387
  readOnly: metadata.readOnly,
4388
+ eventDetail: metadata.eventDetail,
4353
4389
  title: metadata.title,
4354
4390
  proof: metadata.proof,
4355
4391
  maxTokensPerInteraction: metadata.maxTokensPerInteraction,
@@ -4417,6 +4453,7 @@ var TheseusRuntimeEngine = class {
4417
4453
  prompt,
4418
4454
  proof: active.proof,
4419
4455
  maxTokensPerInteraction: active.maxTokensPerInteraction,
4456
+ eventDetail: active.eventDetail,
4420
4457
  planningInputDigest: active.planningInputDigest,
4421
4458
  attestationDigest: "pursue",
4422
4459
  repository: active.repository,
@@ -4461,6 +4498,7 @@ var TheseusRuntimeEngine = class {
4461
4498
  prompt,
4462
4499
  proof: active.proof,
4463
4500
  maxTokensPerInteraction: active.maxTokensPerInteraction,
4501
+ eventDetail: active.eventDetail,
4464
4502
  planningInputDigest: active.planningInputDigest,
4465
4503
  attestationDigest: "follow-up",
4466
4504
  repository: active.repository,
@@ -4544,7 +4582,8 @@ var TheseusRuntimeEngine = class {
4544
4582
  return observedBroker({
4545
4583
  broker,
4546
4584
  operationIdFor: (requestId) => digestRuntimeValue(`${command.commandId}:${requestId}`),
4547
- emit: (event) => this.#event(command, event, active.conversationRefs).catch(() => void 0)
4585
+ emit: (event) => this.#event(command, event, active.conversationRefs).catch(() => void 0),
4586
+ detail: active.eventDetail
4548
4587
  });
4549
4588
  }
4550
4589
  async #checkpoint(command) {