@dougbots/avenor-opencode 0.16.1 → 0.18.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.d.ts +5 -5
- package/dist/index.js +7 -6
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@opencode-ai/plugin";
|
|
2
|
-
import {
|
|
2
|
+
import { RunSnapshotView, StatusResult } from "@dougbots/avenor-core";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
type TrackedRun = {
|
|
@@ -19,15 +19,15 @@ type TrackedRun = {
|
|
|
19
19
|
supervisorId?: string;
|
|
20
20
|
monitoring: boolean;
|
|
21
21
|
latestSeq?: number;
|
|
22
|
-
lastSnapshot?:
|
|
22
|
+
lastSnapshot?: RunSnapshotView;
|
|
23
23
|
};
|
|
24
|
-
declare function terminalStatus(snapshot:
|
|
24
|
+
declare function terminalStatus(snapshot: RunSnapshotView, fallback?: StatusResult): string;
|
|
25
25
|
type HostIdentityMetadataInput = Pick<TrackedRun, 'agent' | 'model' | 'backend' | 'rosterFile' | 'rosterEntry' | 'effectiveAgent' | 'effectiveModel' | 'effectiveBackend'>;
|
|
26
26
|
type HostIdentityStatus = Pick<StatusResult, 'roster_file' | 'roster_entry' | 'agent' | 'model' | 'backend' | 'effective_agent' | 'effective_model' | 'effective_backend'>;
|
|
27
27
|
/** Project shared spawn identity into OpenCode metadata without resolving rosters here. */
|
|
28
28
|
declare function hostIdentityMetadata(run?: HostIdentityMetadataInput, status?: HostIdentityStatus): Record<string, unknown>;
|
|
29
|
-
declare function buildSnapshotMetadata(snapshot:
|
|
30
|
-
declare function buildWaitingText(run: TrackedRun, snapshot:
|
|
29
|
+
declare function buildSnapshotMetadata(snapshot: RunSnapshotView, run?: HostIdentityMetadataInput, status?: HostIdentityStatus): Record<string, unknown>;
|
|
30
|
+
declare function buildWaitingText(run: TrackedRun, snapshot: RunSnapshotView): string;
|
|
31
31
|
declare const AvenorPlugin: Plugin;
|
|
32
32
|
//#endregion
|
|
33
33
|
export { AvenorPlugin, buildSnapshotMetadata, buildWaitingText, hostIdentityMetadata, terminalStatus };
|
package/dist/index.js
CHANGED
|
@@ -337,7 +337,7 @@ function formatStatusOutput(args, result) {
|
|
|
337
337
|
count: statuses.length
|
|
338
338
|
}
|
|
339
339
|
};
|
|
340
|
-
const record = result;
|
|
340
|
+
const record = { ...result };
|
|
341
341
|
return {
|
|
342
342
|
title: `${selected(record, "label", void 0, selected(record, "run_id", args.run_id))} — ${selected(record, "status")}`,
|
|
343
343
|
output: output(statusLines(result, args), "status"),
|
|
@@ -345,7 +345,7 @@ function formatStatusOutput(args, result) {
|
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
347
|
function formatResultOutput(args, result) {
|
|
348
|
-
const record = result;
|
|
348
|
+
const record = { ...result };
|
|
349
349
|
return {
|
|
350
350
|
title: `${selected(record, "label", void 0, selected(record, "run_id", args.run_id))} — ${selected(record, "status")}${result.timed_out === true ? " (wait timed out)" : ""}`,
|
|
351
351
|
output: output(resultLines(result, args), "result"),
|
|
@@ -718,7 +718,7 @@ const AvenorPlugin = async (ctx) => {
|
|
|
718
718
|
run.monitoring = true;
|
|
719
719
|
const handle = { promise: Promise.resolve({
|
|
720
720
|
kind: "stopped",
|
|
721
|
-
snapshot: run.lastSnapshot
|
|
721
|
+
snapshot: run.lastSnapshot ?? createRunSnapshot()
|
|
722
722
|
}) };
|
|
723
723
|
handle.promise = (async () => {
|
|
724
724
|
let observer;
|
|
@@ -1039,7 +1039,8 @@ const AvenorPlugin = async (ctx) => {
|
|
|
1039
1039
|
const messageId = typeof info.id === "string" ? info.id : "";
|
|
1040
1040
|
if (messageId === "") return;
|
|
1041
1041
|
if (!binding.provider.recordLastTurn) return;
|
|
1042
|
-
const
|
|
1042
|
+
const recordLastTurn = binding.provider.recordLastTurn;
|
|
1043
|
+
const publish = publishChain.then(() => publishTurn(binding, recordLastTurn, info, created, messageId));
|
|
1043
1044
|
publishChain = publish.catch(() => {});
|
|
1044
1045
|
await publish;
|
|
1045
1046
|
}
|
|
@@ -1047,7 +1048,7 @@ const AvenorPlugin = async (ctx) => {
|
|
|
1047
1048
|
* One queued publish. The newest-turn gate is read here rather than before
|
|
1048
1049
|
* queueing, so it sees the turn the publish ahead of it claimed.
|
|
1049
1050
|
*/
|
|
1050
|
-
async function publishTurn(binding, info, created, messageId) {
|
|
1051
|
+
async function publishTurn(binding, recordLastTurn, info, created, messageId) {
|
|
1051
1052
|
if (!isNewerTurn(created, messageId)) return;
|
|
1052
1053
|
try {
|
|
1053
1054
|
const turn = extractTurnText([{
|
|
@@ -1055,7 +1056,7 @@ const AvenorPlugin = async (ctx) => {
|
|
|
1055
1056
|
stopReason: normalizeTurnStopReason(normalizeFinish(stopReasonOf(info)))
|
|
1056
1057
|
}]);
|
|
1057
1058
|
const bounded = boundFinalOutput(turn.text);
|
|
1058
|
-
await
|
|
1059
|
+
await recordLastTurn(bounded, turn.stopReason, turn.text.length > bounded.length);
|
|
1059
1060
|
publishedTurn = {
|
|
1060
1061
|
created,
|
|
1061
1062
|
id: messageId
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dougbots/avenor-opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsdown",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
26
27
|
"test": "bun test",
|
|
27
28
|
"dev": "tsdown --watch"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@dougbots/avenor-core": "^0.
|
|
31
|
+
"@dougbots/avenor-core": "^0.18.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
34
|
"@opencode-ai/plugin": "1.15.3"
|