@heretek-ai/epistemic-swarm 1.0.3 → 1.0.5

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/tui.js CHANGED
@@ -409,13 +409,22 @@ var PANELS = Object.entries(PANEL_COMPONENTS).map(([name, Panel]) => ({
409
409
  })
410
410
  }));
411
411
  function registerPanels(context, call, subscribe) {
412
- const disposers = PANELS.map((panel) => context.slot({
413
- append: "session.panel",
414
- render: (input) => input.name === panel.name ? panel.render({
412
+ const slotFn = typeof context.slot === "function" ? context.slot : context.ui?.slot;
413
+ if (typeof slotFn !== "function")
414
+ return () => {};
415
+ const disposers = [];
416
+ for (const panel of PANELS) {
417
+ const render = (input) => input.name === panel.name ? panel.render({
415
418
  call,
416
419
  subscribe
417
- }) : null
418
- }));
420
+ }) : null;
421
+ const dispose = slotFn.length <= 1 ? slotFn({
422
+ append: "session.panel",
423
+ render
424
+ }) : slotFn("session.panel", render);
425
+ if (typeof dispose === "function")
426
+ disposers.push(dispose);
427
+ }
419
428
  return () => {
420
429
  for (const dispose of disposers)
421
430
  dispose();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heretek-ai/epistemic-swarm",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Epistemic Swarm: an AI build factory for OpenCode v2 — grill, research, spec, build, QA and release, gated mechanically.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -41,7 +41,7 @@
41
41
  "test": "bun test"
42
42
  },
43
43
  "dependencies": {
44
- "@heretek-ai/es-core": "1.0.3",
44
+ "@heretek-ai/es-core": "1.0.5",
45
45
  "@opencode/plugin": "2.0.24"
46
46
  },
47
47
  "devDependencies": {
package/src/panels.tsx CHANGED
@@ -206,12 +206,18 @@ const PANELS = Object.entries(PANEL_COMPONENTS).map(([name, Panel]) => ({
206
206
 
207
207
  /** Claim the session.panel slot once per panel; each claim filters by name. */
208
208
  export function registerPanels(context: any, call: PanelCall, subscribe: PanelSubscribe): () => void {
209
- const disposers = PANELS.map((panel) =>
210
- context.slot({
211
- append: "session.panel",
212
- render: (input: { name: string }) => (input.name === panel.name ? panel.render({ call, subscribe }) : null),
213
- }),
214
- )
209
+ // Slot entry point moved across host releases: opencode 2.0.x exposes it
210
+ // as context.ui.slot (arity 1 object form or arity 2 name/render form),
211
+ // later hosts as bare context.slot. Without either, panels stay
212
+ // unregistered but setup must not throw (commands keep working).
213
+ const slotFn = typeof context.slot === "function" ? context.slot : context.ui?.slot
214
+ if (typeof slotFn !== "function") return () => {}
215
+ const disposers: Array<() => void> = []
216
+ for (const panel of PANELS) {
217
+ const render = (input: { name: string }) => (input.name === panel.name ? panel.render({ call, subscribe }) : null)
218
+ const dispose = slotFn.length <= 1 ? slotFn({ append: "session.panel", render }) : slotFn("session.panel", render)
219
+ if (typeof dispose === "function") disposers.push(dispose)
220
+ }
215
221
  return () => {
216
222
  for (const dispose of disposers) dispose()
217
223
  }
package/src/server.ts CHANGED
@@ -170,8 +170,15 @@ export default Plugin.define({
170
170
  name: "factory",
171
171
  description: "Drive the build factory from its current stage (Epistemic Swarm)",
172
172
  execute: async ({ sessionID, prompt, delivery }) => {
173
- await ctx.session.switchAgent({ sessionID, agent: "factory" } as any)
174
173
  const state = await runtime.factory.read()
174
+ if (!state) {
175
+ await ctx.session.synthetic({
176
+ sessionID,
177
+ text: "No factory run here yet — run /grill first.",
178
+ } as any)
179
+ return
180
+ }
181
+ await ctx.session.switchAgent({ sessionID, agent: "factory" } as any)
175
182
  await ctx.session.prompt({
176
183
  ...prompt,
177
184
  sessionID,