@fdcn/sourcefed 0.2.4 → 0.2.6
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/README.md +2 -2
- package/dist/{chunk-SKEBKW2L.js → chunk-5NFCKXDQ.js} +51 -71
- package/dist/cli.js +51 -71
- package/dist/daemon.js +51 -71
- package/dist/mcp.js +1 -1
- package/dist/opencode.js +20 -8
- package/dist/pi.js +3 -11
- package/dist.dts/adapters/opencode/bridge.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunk-7KHZCWGQ.js +0 -5174
- package/dist/chunk-B7T6IZYS.js +0 -5155
- package/dist/chunk-EVSHVYPF.js +0 -5167
- package/dist/chunk-UOTCX4ME.js +0 -3963
- package/dist.dts/packages/cli/src/commands/monitor.d.ts +0 -1
package/dist/opencode.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
daemonCommand,
|
|
5
5
|
daemonEnvironment,
|
|
6
6
|
spawnLocalDaemon
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5NFCKXDQ.js";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
10
|
} from "./chunk-MLKGABMK.js";
|
|
@@ -74,21 +74,33 @@ var OpenCodeBridge = class {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
async routeEvents(events) {
|
|
77
|
-
const delivered = [];
|
|
78
77
|
for (const queued of events) {
|
|
78
|
+
const model = await this.currentModel(queued.target.id);
|
|
79
79
|
const body = {
|
|
80
80
|
...queued.event.actionable ? {} : { noReply: true },
|
|
81
|
+
...model ? { model } : {},
|
|
81
82
|
parts: [{ type: "text", text: eventText(queued.event) }]
|
|
82
83
|
};
|
|
83
84
|
await this.opencode.session.prompt({ path: { id: queued.target.id }, body });
|
|
84
|
-
delivered.push(queued);
|
|
85
85
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
}
|
|
87
|
+
// A prompt without an explicit model makes OpenCode fall back to the default
|
|
88
|
+
// model, silently switching the session off whatever it was using. Reuse the
|
|
89
|
+
// model from the session's last assistant turn so a notification never
|
|
90
|
+
// changes the active model.
|
|
91
|
+
async currentModel(sessionID) {
|
|
92
|
+
try {
|
|
93
|
+
const result = await this.opencode.session.messages({ path: { id: sessionID } });
|
|
94
|
+
const messages = result.data ?? [];
|
|
95
|
+
for (let i = messages.length - 1; i >= 0; i -= 1) {
|
|
96
|
+
const info = messages[i].info;
|
|
97
|
+
if (info.role === "assistant" && info.providerID && info.modelID) {
|
|
98
|
+
return { providerID: info.providerID, modelID: info.modelID };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
} catch {
|
|
91
102
|
}
|
|
103
|
+
return void 0;
|
|
92
104
|
}
|
|
93
105
|
target(sessionID) {
|
|
94
106
|
return { kind: "opencode-session", id: sessionID };
|
package/dist/pi.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
daemonCommand,
|
|
4
4
|
daemonEnvironment,
|
|
5
5
|
spawnLocalDaemon
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5NFCKXDQ.js";
|
|
7
7
|
import "./chunk-MLKGABMK.js";
|
|
8
8
|
|
|
9
9
|
// adapters/pi/src/index.ts
|
|
@@ -206,7 +206,7 @@ async function sourcefedExtension(pi) {
|
|
|
206
206
|
const target = { kind: "pi-session", id: ctx.sessionManager.getSessionId() };
|
|
207
207
|
if (client && !listeners.has(target.id)) {
|
|
208
208
|
const listener = await client.subscribe(target, async (events) => {
|
|
209
|
-
await routeEvents(pi, events
|
|
209
|
+
await routeEvents(pi, events);
|
|
210
210
|
});
|
|
211
211
|
listeners.set(target.id, listener);
|
|
212
212
|
}
|
|
@@ -235,8 +235,7 @@ async function sourcefedExtension(pi) {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
async function routeEvents(pi, events
|
|
239
|
-
const delivered = [];
|
|
238
|
+
async function routeEvents(pi, events) {
|
|
240
239
|
for (const queued of events) {
|
|
241
240
|
await pi.sendMessage({
|
|
242
241
|
customType: "sourcefed-monitor",
|
|
@@ -246,13 +245,6 @@ ${queued.event.body}` : ""}`,
|
|
|
246
245
|
display: true,
|
|
247
246
|
details: { actionable: queued.event.actionable, eventID: queued.id }
|
|
248
247
|
}, { triggerTurn: queued.event.actionable, deliverAs: "steer" });
|
|
249
|
-
delivered.push(queued);
|
|
250
|
-
}
|
|
251
|
-
if (delivered.length > 0) {
|
|
252
|
-
await daemon.request("monitor.ack", {
|
|
253
|
-
target,
|
|
254
|
-
eventIDs: delivered.map((queued) => queued.id)
|
|
255
|
-
});
|
|
256
248
|
}
|
|
257
249
|
}
|
|
258
250
|
function cliEntry() {
|