@odla-ai/harness 0.10.2 → 0.10.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.
@@ -2237,12 +2237,17 @@ function codeSkill(opts) {
2237
2237
  true
2238
2238
  )
2239
2239
  ];
2240
- const effects = opts.readOnly ? [] : [applyPatch, runRecipe];
2240
+ const runsRecipes = opts.recipes ?? !opts.readOnly;
2241
+ const effects = [...opts.readOnly ? [] : [applyPatch], ...runsRecipes ? [runRecipe] : []];
2241
2242
  const tools = opts.surface === "v3" ? [...orientation, searchFiles, read2, ...opts.readOnly ? [] : [editFile], ...effects] : opts.surface === "v2" ? [listFiles, searchFiles, read2, ...effects] : [read2, ...effects];
2242
2243
  return { name: "code", tools };
2243
2244
  }
2244
2245
 
2245
2246
  // src/code-agent.ts
2247
+ function readOnlyNotice(readOnly, recipes) {
2248
+ if (!readOnly) return "";
2249
+ return recipes ? "\n\nThis session is read-only: inspect and report; repository mutation is intentionally unavailable. The registered proof recipes are available through odla_run_recipe and must be run before any verdict." : "\n\nThis session is read-only. Inspect and report; repository mutation and recipe execution are intentionally unavailable.";
2250
+ }
2246
2251
  async function runCodeAgent(options) {
2247
2252
  const toolCalls = [];
2248
2253
  const surface = options.surface ?? "v1";
@@ -2252,6 +2257,7 @@ async function runCodeAgent(options) {
2252
2257
  workspaceDir: options.workspaceDir,
2253
2258
  surface,
2254
2259
  ...options.readOnly === void 0 ? {} : { readOnly: options.readOnly },
2260
+ ...options.recipes === void 0 ? {} : { recipes: options.recipes },
2255
2261
  ...options.recipeIds ? { recipeIds: options.recipeIds } : {},
2256
2262
  onToolCall: (call) => {
2257
2263
  toolCalls.push(call);
@@ -2264,7 +2270,7 @@ async function runCodeAgent(options) {
2264
2270
  {
2265
2271
  name: "odla-code",
2266
2272
  model: options.model,
2267
- 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." : ""}`,
2273
+ system: options.system ?? `${SYSTEM_PROMPT_FOR[surface]}${readOnlyNotice(options.readOnly, options.recipes)}`,
2268
2274
  skills: [skill, ...options.extraSkills ?? []],
2269
2275
  maxSteps: options.maxSteps ?? 24,
2270
2276
  maxTokens: options.maxTokens ?? 16384
@@ -2295,6 +2301,7 @@ async function runCodeAgentAttempt(options) {
2295
2301
  model: "brokered",
2296
2302
  surface,
2297
2303
  ...options.readOnly === void 0 ? {} : { readOnly: options.readOnly },
2304
+ ...options.recipes === void 0 ? {} : { recipes: options.recipes },
2298
2305
  ...options.recipeIds ? { recipeIds: options.recipeIds } : {},
2299
2306
  ...options.extraSkills ? { extraSkills: options.extraSkills } : {},
2300
2307
  ...options.maxSteps === void 0 ? {} : { maxSteps: options.maxSteps },
@@ -3416,16 +3423,17 @@ function createCodeRuntimeToolBroker(input, lease, role) {
3416
3423
  readerId: `code-session:${lease.task.taskId}`,
3417
3424
  readOnlyPrefixes: [".odla-references"]
3418
3425
  });
3419
- const reviewReads = /* @__PURE__ */ new Set([
3426
+ const reviewTools = /* @__PURE__ */ new Set([
3420
3427
  "sandbox.read",
3421
3428
  "sandbox.list",
3422
3429
  "sandbox.search",
3423
3430
  "sandbox.overview",
3424
3431
  "sandbox.where_is",
3425
3432
  "sandbox.who_imports",
3426
- "sandbox.who_touches"
3433
+ "sandbox.who_touches",
3434
+ "sandbox.run_recipe"
3427
3435
  ]);
3428
- 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" }) };
3436
+ 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" }) };
3429
3437
  }
3430
3438
 
3431
3439
  // src/code-memory.ts
@@ -4011,6 +4019,9 @@ var TheseusRuntimeEngine = class {
4011
4019
  prompt: metadata.prompt,
4012
4020
  signal: active.abort.signal,
4013
4021
  readOnly: metadata.readOnly,
4022
+ // A review-role session is read-only and still runs the proof; a planner
4023
+ // marked read-only by its payload runs nothing.
4024
+ recipes: metadata.role === "review" || !metadata.readOnly,
4014
4025
  recipeIds: this.options.recipes.map((recipe2) => recipe2.id),
4015
4026
  ...extraSkills.length ? { extraSkills } : {}
4016
4027
  });