@dougbots/avenor-opencode 0.10.0 → 0.10.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.
Files changed (2) hide show
  1. package/dist/index.js +140 -11
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { tool } from "@opencode-ai/plugin";
2
2
  import * as crypto from "node:crypto";
3
- import { Supervisor, answerPermissionTool, createRunSnapshot, dial, eventsTool, extractEventText, followUpTool, inspectTool, observeRun, resultTool, shutdownTool, spawnTool, statusTool, validateSpawnSelection } from "@dougbots/avenor-core";
3
+ import { Supervisor, THINKING_LEVELS, answerPermissionTool, createRunSnapshot, dial, eventsTool, extractEventText, followUpTool, inspectTool, observeRun, resultTool, shutdownTool, spawnTool, statusTool, validateSpawnSelection, workflowCompleteTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowStatusTool, workflowWaitTool } from "@dougbots/avenor-core";
4
4
  //#region src/render.ts
5
5
  const FINAL_OUTPUT_CHARS$1 = 1500;
6
6
  const SCALAR_CHARS = 240;
@@ -867,7 +867,7 @@ const AvenorPlugin = async (ctx) => {
867
867
  },
868
868
  tool: {
869
869
  avenor_spawn: tool({
870
- description: "Dispatch an agent run via avenor. Optional thinking accepts off, minimal, low, medium, high, xhigh, or max; unsupported backends reject explicit values. Blocks by default, showing live progress as an updating tool call. Set wait=false for fire-and-forget — you will be re-prompted automatically on completion.",
870
+ description: `Dispatch an agent run via avenor. Optional thinking accepts ${[...THINKING_LEVELS].slice(0, -1).join(", ")}, or ${THINKING_LEVELS[THINKING_LEVELS.length - 1]}; unsupported backends reject explicit values. Blocks by default, showing live progress as an updating tool call. Set wait=false for fire-and-forget — you will be re-prompted automatically on completion.`,
871
871
  args: {
872
872
  agent: tool.schema.string().optional().describe("Optional agent name; omission uses the supplied model or runtime defaults"),
873
873
  prompt: tool.schema.string().optional().describe("Prompt text"),
@@ -876,15 +876,7 @@ const AvenorPlugin = async (ctx) => {
876
876
  label: tool.schema.string().optional().describe("Human-readable label for the run"),
877
877
  timeout: tool.schema.string().optional().describe("Timeout duration (e.g. 3600s)"),
878
878
  model: tool.schema.string().optional().describe("Model override"),
879
- thinking: tool.schema.enum([
880
- "off",
881
- "minimal",
882
- "low",
883
- "medium",
884
- "high",
885
- "xhigh",
886
- "max"
887
- ]).optional().describe("Thinking level; omission uses the backend default"),
879
+ thinking: tool.schema.enum([...THINKING_LEVELS]).optional().describe("Thinking level; omission uses the backend default"),
888
880
  backend: tool.schema.string().optional().describe("Backend override"),
889
881
  roster_file: tool.schema.string().optional().describe("Path to the roster map"),
890
882
  roster_entry: tool.schema.string().optional().describe("Roster entry to select"),
@@ -1139,6 +1131,143 @@ const AvenorPlugin = async (ctx) => {
1139
1131
  force: args.force
1140
1132
  }));
1141
1133
  }
1134
+ }),
1135
+ avenor_workflow_status: tool({
1136
+ description: "Get lightweight status for a workflow instance",
1137
+ args: {
1138
+ workflow_id: tool.schema.string().describe("Workflow ID"),
1139
+ supervisor_id: tool.schema.string().optional().describe("Supervisor ID for multi-supervisor mode")
1140
+ },
1141
+ async execute(args, _context) {
1142
+ const result = await workflowStatusTool({
1143
+ workflowId: args.workflow_id,
1144
+ supervisorId: args.supervisor_id
1145
+ });
1146
+ return {
1147
+ title: "workflow",
1148
+ output: JSON.stringify(result, null, 2)
1149
+ };
1150
+ }
1151
+ }),
1152
+ avenor_workflow_wait: tool({
1153
+ description: "Wait for a workflow to reach a terminal state or until timeout",
1154
+ args: {
1155
+ workflow_id: tool.schema.string().describe("Workflow ID"),
1156
+ timeout: tool.schema.string().optional().describe("Timeout (e.g. 30s, 5m)"),
1157
+ supervisor_id: tool.schema.string().optional().describe("Supervisor ID for multi-supervisor mode")
1158
+ },
1159
+ async execute(args, _context) {
1160
+ const result = await workflowWaitTool({
1161
+ workflowId: args.workflow_id,
1162
+ timeout: args.timeout,
1163
+ supervisorId: args.supervisor_id
1164
+ });
1165
+ return {
1166
+ title: "workflow",
1167
+ output: JSON.stringify(result, null, 2)
1168
+ };
1169
+ }
1170
+ }),
1171
+ avenor_workflow_inspect: tool({
1172
+ description: "Return the full instance detail for a workflow",
1173
+ args: {
1174
+ workflow_id: tool.schema.string().describe("Workflow ID"),
1175
+ supervisor_id: tool.schema.string().optional().describe("Supervisor ID for multi-supervisor mode")
1176
+ },
1177
+ async execute(args, _context) {
1178
+ const result = await workflowInspectTool({
1179
+ workflowId: args.workflow_id,
1180
+ supervisorId: args.supervisor_id
1181
+ });
1182
+ return {
1183
+ title: "workflow",
1184
+ output: JSON.stringify(result, null, 2)
1185
+ };
1186
+ }
1187
+ }),
1188
+ avenor_workflow_events: tool({
1189
+ description: "Read log events from a workflow instance's event log",
1190
+ args: {
1191
+ workflow_id: tool.schema.string().describe("Workflow ID"),
1192
+ after_seq: tool.schema.number().optional().describe("Only include events after this sequence number"),
1193
+ limit: tool.schema.number().optional().describe("Max events to return (default 50)"),
1194
+ supervisor_id: tool.schema.string().optional().describe("Supervisor ID for multi-supervisor mode")
1195
+ },
1196
+ async execute(args, _context) {
1197
+ const result = await workflowEventsTool({
1198
+ workflowId: args.workflow_id,
1199
+ afterSeq: args.after_seq,
1200
+ limit: args.limit,
1201
+ supervisorId: args.supervisor_id
1202
+ });
1203
+ return {
1204
+ title: "workflow",
1205
+ output: JSON.stringify(result, null, 2)
1206
+ };
1207
+ }
1208
+ }),
1209
+ avenor_workflow_complete: tool({
1210
+ description: "Atomically complete a machine/external handoff activation",
1211
+ args: {
1212
+ workflow_id: tool.schema.string().describe("Workflow ID"),
1213
+ node_id: tool.schema.string().describe("Node ID"),
1214
+ activation_id: tool.schema.string().describe("Activation ID"),
1215
+ attempt_id: tool.schema.string().describe("Attempt ID"),
1216
+ lease_id: tool.schema.string().describe("Lease ID"),
1217
+ owner_token: tool.schema.string().describe("Owner token"),
1218
+ outcome: tool.schema.string().describe("Outcome"),
1219
+ outputs: tool.schema.unknown().optional().describe("Outputs"),
1220
+ artifacts: tool.schema.unknown().optional().describe("Artifacts"),
1221
+ supervisor_id: tool.schema.string().optional().describe("Supervisor ID for multi-supervisor mode")
1222
+ },
1223
+ async execute(args, _context) {
1224
+ const { supervisor_id, ...rest } = args;
1225
+ const result = await workflowCompleteTool({
1226
+ ...rest,
1227
+ supervisorId: supervisor_id
1228
+ });
1229
+ return {
1230
+ title: "workflow",
1231
+ output: JSON.stringify(result, null, 2)
1232
+ };
1233
+ }
1234
+ }),
1235
+ avenor_workflow_gate: tool({
1236
+ description: "Record a gate decision on a parked awaiting_gate activation",
1237
+ args: {
1238
+ workflow_id: tool.schema.string().describe("Workflow ID"),
1239
+ node_id: tool.schema.string().describe("Node ID"),
1240
+ gate_id: tool.schema.string().describe("Gate ID"),
1241
+ activation_id: tool.schema.string().describe("Activation ID"),
1242
+ operation: tool.schema.enum([
1243
+ "satisfy",
1244
+ "reject",
1245
+ "waive",
1246
+ "external_result"
1247
+ ]).describe("Gate operation"),
1248
+ actor: tool.schema.string().optional().describe("Actor"),
1249
+ reason: tool.schema.string().optional().describe("Reason"),
1250
+ outcome: tool.schema.string().optional().describe("Outcome"),
1251
+ subject: tool.schema.unknown().optional().describe("Subject"),
1252
+ poll_id: tool.schema.string().optional().describe("Poll ID"),
1253
+ source: tool.schema.string().optional().describe("Source"),
1254
+ result: tool.schema.string().optional().describe("Result"),
1255
+ response_hash: tool.schema.string().optional().describe("Response hash"),
1256
+ observed_at: tool.schema.string().optional().describe("Observed at"),
1257
+ evidence_ids: tool.schema.array(tool.schema.string()).optional().describe("Evidence IDs"),
1258
+ supervisor_id: tool.schema.string().optional().describe("Supervisor ID for multi-supervisor mode")
1259
+ },
1260
+ async execute(args, _context) {
1261
+ const { supervisor_id, ...rest } = args;
1262
+ const result = await workflowGateTool({
1263
+ ...rest,
1264
+ supervisorId: supervisor_id
1265
+ });
1266
+ return {
1267
+ title: "workflow",
1268
+ output: JSON.stringify(result, null, 2)
1269
+ };
1270
+ }
1142
1271
  })
1143
1272
  }
1144
1273
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dougbots/avenor-opencode",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
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.10.0"
30
+ "@dougbots/avenor-core": "^0.10.1"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@opencode-ai/plugin": "1.15.3"