@dougbots/avenor-opencode 0.3.2 → 0.3.3

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 (2) hide show
  1. package/dist/index.js +34 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -87,6 +87,21 @@ const AvenorPlugin = async (ctx) => {
87
87
  }).catch(() => {});
88
88
  return;
89
89
  }
90
+ if (result.status === "waiting") {
91
+ const perm = result.pending_permission;
92
+ const lines = [`Sub-agent "${run.label}" is waiting for input.`];
93
+ if (perm) lines.push(`Permission request: ${perm.description}`, `To answer: call \`avenor_answer_permission\` with run_id "${run.runId}", option_id "allow_once" | "allow_always" | "deny"`);
94
+ else if (result.phase_label) lines.push(`Question: ${result.phase_label}`);
95
+ lines.push(`Use \`avenor_follow_up\` with run_id "${run.runId}" to respond, or \`avenor_status\` to re-check.`);
96
+ await ctx.client.session.promptAsync({
97
+ path: { id: run.orchestratorSessionId },
98
+ body: { parts: [{
99
+ type: "text",
100
+ text: lines.join("\n")
101
+ }] }
102
+ }).catch(() => {});
103
+ return;
104
+ }
90
105
  }
91
106
  }
92
107
  async function pollChannelMessages(sessionId) {
@@ -297,6 +312,25 @@ const AvenorPlugin = async (ctx) => {
297
312
  }
298
313
  };
299
314
  }
315
+ if (status.status === "waiting") {
316
+ const perm = status.pending_permission;
317
+ const lines = [`Sub-agent "${result.label}" is waiting for input.`];
318
+ if (perm) lines.push(`Permission request: ${perm.description}`, `To answer: call \`avenor_answer_permission\` with run_id "${result.run_id}", option_id "allow_once" | "allow_always" | "deny"`);
319
+ else if (status.phase_label) lines.push(`Question: ${status.phase_label}`);
320
+ lines.push(`Use \`avenor_follow_up\` with run_id "${result.run_id}" to respond, or \`avenor_status\` to re-check.`);
321
+ const tracked = trackedRuns.get(result.run_id);
322
+ if (tracked) tracked.monitoring = false;
323
+ return {
324
+ title: `${result.label} — waiting`,
325
+ output: lines.join("\n"),
326
+ metadata: {
327
+ status: "waiting",
328
+ run_id: result.run_id,
329
+ session_id: status.session_id,
330
+ ...perm && { pending_permission: perm }
331
+ }
332
+ };
333
+ }
300
334
  }
301
335
  trackedRuns.delete(result.run_id);
302
336
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dougbots/avenor-opencode",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,7 +27,7 @@
27
27
  "dev": "tsdown --watch"
28
28
  },
29
29
  "dependencies": {
30
- "@dougbots/avenor-core": "^0.3.2"
30
+ "@dougbots/avenor-core": "^0.3.3"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@opencode-ai/plugin": "1.15.3"