@dougbots/avenor-opencode 0.12.1 → 0.13.0
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.
- package/dist/index.js +37 -1
- 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, THINKING_LEVELS, answerPermissionTool, createRunSnapshot, dial, eventsTool, extractEventText, followUpTool, inspectTool, observeRun, resultTool, shutdownTool, spawnTool, statusTool, validateSpawnSelection, workflowCompleteTool, workflowControllerStatusTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowReadyTool, workflowStatusTool, workflowWaitTool } from "@dougbots/avenor-core";
|
|
3
|
+
import { Supervisor, THINKING_LEVELS, answerPermissionTool, createRunSnapshot, dial, eventsTool, extractEventText, followUpTool, inspectTool, killTool, observeRun, resultTool, shutdownTool, spawnTool, statusTool, validateSpawnSelection, workflowCompleteTool, workflowControllerStatusTool, workflowEventsTool, workflowGateTool, workflowInspectTool, workflowReadyTool, 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;
|
|
@@ -408,6 +408,29 @@ function formatShutdownOutput(args, result) {
|
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
|
+
function formatKillOutput(args, result) {
|
|
412
|
+
return {
|
|
413
|
+
title: "Avenor — kill run",
|
|
414
|
+
output: output(killLines(result, args), "kill"),
|
|
415
|
+
metadata: {
|
|
416
|
+
...result,
|
|
417
|
+
supervisor_id: args.supervisor_id
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function killLines(details, args) {
|
|
422
|
+
const result = asRecord(details);
|
|
423
|
+
if (!result || typeof result.killed !== "boolean" || typeof result.run_id !== "string") return void 0;
|
|
424
|
+
const requested = stringValue(args.run_id) ? scalar(args.run_id) : scalar(result.run_id);
|
|
425
|
+
const runtimeId = stringValue(result.runtime_id) ? scalar(result.runtime_id) : "unresolved";
|
|
426
|
+
const supervisor = stringValue(args.supervisor_id) ? scalar(args.supervisor_id) : "singleton";
|
|
427
|
+
return [
|
|
428
|
+
`Kill: ${result.killed ? "terminated" : "failed"}.`,
|
|
429
|
+
`Run: ${requested} (runtime ${runtimeId})`,
|
|
430
|
+
`Supervisor: ${supervisor} — still running, other runs unaffected.`,
|
|
431
|
+
...!result.killed ? ["Warning: kill did not complete.", "Guidance: check avenor_status for the run state."] : []
|
|
432
|
+
];
|
|
433
|
+
}
|
|
411
434
|
function controllerLeaderLine(leader) {
|
|
412
435
|
if (!leader) return "Leader: none";
|
|
413
436
|
const owner = leader.is_this_process === true ? "this process" : `other owner (${scalar(leader.owner_id)})`;
|
|
@@ -1181,6 +1204,19 @@ const AvenorPlugin = async (ctx) => {
|
|
|
1181
1204
|
}));
|
|
1182
1205
|
}
|
|
1183
1206
|
}),
|
|
1207
|
+
avenor_kill: tool({
|
|
1208
|
+
description: "Terminate a run without shutting down the supervisor. Other runs and the supervisor itself keep running.",
|
|
1209
|
+
args: {
|
|
1210
|
+
run_id: tool.schema.string().min(1).describe("Run ID or label of the run to terminate"),
|
|
1211
|
+
supervisor_id: tool.schema.string().optional().describe("Supervisor ID for multi-supervisor mode")
|
|
1212
|
+
},
|
|
1213
|
+
async execute(args, _context) {
|
|
1214
|
+
return formatKillOutput(args, await killTool({
|
|
1215
|
+
runId: args.run_id,
|
|
1216
|
+
supervisorId: args.supervisor_id
|
|
1217
|
+
}));
|
|
1218
|
+
}
|
|
1219
|
+
}),
|
|
1184
1220
|
avenor_shutdown: tool({
|
|
1185
1221
|
description: "Shut down the avenor supervisor and clean up temp files.",
|
|
1186
1222
|
args: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dougbots/avenor-opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
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.
|
|
30
|
+
"@dougbots/avenor-core": "^0.13.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@opencode-ai/plugin": "1.15.3"
|