@odla-ai/harness 0.9.3 → 0.9.4

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.
@@ -1759,7 +1759,8 @@ function codeSkill(opts) {
1759
1759
  true
1760
1760
  )
1761
1761
  ];
1762
- const tools = opts.surface === "v3" ? [...orientation, searchFiles, read2, applyPatch, runRecipe] : opts.surface === "v2" ? [listFiles, searchFiles, read2, applyPatch, runRecipe] : [read2, applyPatch, runRecipe];
1762
+ const effects = opts.readOnly ? [] : [applyPatch, runRecipe];
1763
+ const tools = opts.surface === "v3" ? [...orientation, searchFiles, read2, ...effects] : opts.surface === "v2" ? [listFiles, searchFiles, read2, ...effects] : [read2, ...effects];
1763
1764
  return { name: "code", tools };
1764
1765
  }
1765
1766
 
@@ -1772,6 +1773,7 @@ async function runCodeAgent(options) {
1772
1773
  lease: options.lease,
1773
1774
  workspaceDir: options.workspaceDir,
1774
1775
  surface,
1776
+ ...options.readOnly === void 0 ? {} : { readOnly: options.readOnly },
1775
1777
  ...options.recipeIds ? { recipeIds: options.recipeIds } : {},
1776
1778
  onToolCall: (call) => {
1777
1779
  toolCalls.push(call);
@@ -1784,7 +1786,7 @@ async function runCodeAgent(options) {
1784
1786
  {
1785
1787
  name: "odla-code",
1786
1788
  model: options.model,
1787
- system: options.system ?? SYSTEM_PROMPT_FOR[surface],
1789
+ system: options.system ?? `${SYSTEM_PROMPT_FOR[surface]}${options.readOnly ? "\n\nThis session is read-only. Inspect and report; repository mutation and recipe execution are intentionally unavailable." : ""}`,
1788
1790
  skills: [skill, ...options.extraSkills ?? []],
1789
1791
  maxSteps: options.maxSteps ?? 24,
1790
1792
  maxTokens: options.maxTokens ?? 16384
@@ -1814,6 +1816,7 @@ async function runCodeAgentAttempt(options) {
1814
1816
  // id only labels the request the control plane is about to rewrite.
1815
1817
  model: "brokered",
1816
1818
  surface,
1819
+ ...options.readOnly === void 0 ? {} : { readOnly: options.readOnly },
1817
1820
  ...options.recipeIds ? { recipeIds: options.recipeIds } : {},
1818
1821
  ...options.extraSkills ? { extraSkills: options.extraSkills } : {},
1819
1822
  ...options.maxSteps === void 0 ? {} : { maxSteps: options.maxSteps },
@@ -2831,7 +2834,16 @@ function createCodeRuntimeToolBroker(input, lease, role) {
2831
2834
  readerId: `code-session:${lease.task.taskId}`,
2832
2835
  readOnlyPrefixes: [".odla-references"]
2833
2836
  });
2834
- return role === "coding" ? broker : { execute: (context, request) => request.tool === "sandbox.read" ? broker.execute(context, request) : Promise.resolve({ requestId: request.requestId, ok: false, content: "review sessions are read-only" }) };
2837
+ const reviewReads = /* @__PURE__ */ new Set([
2838
+ "sandbox.read",
2839
+ "sandbox.list",
2840
+ "sandbox.search",
2841
+ "sandbox.overview",
2842
+ "sandbox.where_is",
2843
+ "sandbox.who_imports",
2844
+ "sandbox.who_touches"
2845
+ ]);
2846
+ return role === "coding" ? broker : { execute: (context, request) => reviewReads.has(request.tool) ? broker.execute(context, request) : Promise.resolve({ requestId: request.requestId, ok: false, content: "review sessions are read-only" }) };
2835
2847
  }
2836
2848
 
2837
2849
  // src/code-memory.ts
@@ -3409,6 +3421,7 @@ var TheseusRuntimeEngine = class {
3409
3421
  workspaceDir: active.workspace.workspaceDir,
3410
3422
  prompt: metadata.prompt,
3411
3423
  signal: active.abort.signal,
3424
+ readOnly: metadata.role === "review",
3412
3425
  recipeIds: this.options.recipes.map((recipe2) => recipe2.id),
3413
3426
  ...extraSkills.length ? { extraSkills } : {}
3414
3427
  });