@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/dist/opencode.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  daemonCommand,
5
5
  daemonEnvironment,
6
6
  spawnLocalDaemon
7
- } from "./chunk-SKEBKW2L.js";
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
- if (delivered.length > 0 && this.daemon) {
87
- await this.daemon.request("monitor.ack", {
88
- target: { kind: "opencode-session", id: delivered[0].target.id },
89
- eventIDs: delivered.map((queued) => queued.id)
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-SKEBKW2L.js";
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, target, client);
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, target, daemon) {
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() {
@@ -13,6 +13,7 @@ export declare class OpenCodeBridge {
13
13
  close(): Promise<void>;
14
14
  private ensureDaemon;
15
15
  private routeEvents;
16
+ private currentModel;
16
17
  private target;
17
18
  }
18
19
  export declare function setOpenCodeBridge(bridge: OpenCodeBridge): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fdcn/sourcefed",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Live Jira, GitHub, and Slack monitoring for agent hosts: CLI, daemon, MCP server, and host plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",