opencode-swarm 1.0.12 → 1.0.13

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.
@@ -27,8 +27,10 @@ interface MessageWithParts {
27
27
  * Only injects for the architect agent.
28
28
  */
29
29
  export declare function createPipelineTrackerHook(config: PluginConfig): {
30
+ 'experimental.chat.messages.transform'?: undefined;
31
+ } | {
30
32
  'experimental.chat.messages.transform': (_input: Record<string, never>, output: {
31
- messages: MessageWithParts[];
33
+ messages?: MessageWithParts[];
32
34
  }) => Promise<void>;
33
35
  };
34
36
  export {};
package/dist/index.js CHANGED
@@ -14616,36 +14616,41 @@ DELEGATION RULES:
14616
14616
  - Always wait for response before next delegation
14617
14617
  </swarm_reminder>`;
14618
14618
  function createPipelineTrackerHook(config2) {
14619
- const enabled = config2.inject_phase_reminders !== false;
14619
+ const enabled = config2.inject_phase_reminders === true;
14620
+ if (!enabled) {
14621
+ return {};
14622
+ }
14620
14623
  return {
14621
14624
  "experimental.chat.messages.transform": async (_input, output) => {
14622
- if (!enabled)
14623
- return;
14624
- const { messages } = output;
14625
- if (messages.length === 0)
14626
- return;
14627
- let lastUserMessageIndex = -1;
14628
- for (let i = messages.length - 1;i >= 0; i--) {
14629
- if (messages[i].info.role === "user") {
14630
- lastUserMessageIndex = i;
14631
- break;
14625
+ try {
14626
+ const messages = output?.messages;
14627
+ if (!messages || messages.length === 0)
14628
+ return;
14629
+ let lastUserMessageIndex = -1;
14630
+ for (let i = messages.length - 1;i >= 0; i--) {
14631
+ if (messages[i]?.info?.role === "user") {
14632
+ lastUserMessageIndex = i;
14633
+ break;
14634
+ }
14632
14635
  }
14633
- }
14634
- if (lastUserMessageIndex === -1)
14635
- return;
14636
- const lastUserMessage = messages[lastUserMessageIndex];
14637
- const agent = lastUserMessage.info.agent;
14638
- if (agent && agent !== "architect")
14639
- return;
14640
- const textPartIndex = lastUserMessage.parts.findIndex((p) => p.type === "text" && p.text !== undefined);
14641
- if (textPartIndex === -1)
14642
- return;
14643
- const originalText = lastUserMessage.parts[textPartIndex].text ?? "";
14644
- lastUserMessage.parts[textPartIndex].text = `${PHASE_REMINDER}
14636
+ if (lastUserMessageIndex === -1)
14637
+ return;
14638
+ const lastUserMessage = messages[lastUserMessageIndex];
14639
+ if (!lastUserMessage?.parts)
14640
+ return;
14641
+ const agent = lastUserMessage.info?.agent;
14642
+ if (agent && agent !== "architect")
14643
+ return;
14644
+ const textPartIndex = lastUserMessage.parts.findIndex((p) => p?.type === "text" && p.text !== undefined);
14645
+ if (textPartIndex === -1)
14646
+ return;
14647
+ const originalText = lastUserMessage.parts[textPartIndex].text ?? "";
14648
+ lastUserMessage.parts[textPartIndex].text = `${PHASE_REMINDER}
14645
14649
 
14646
14650
  ---
14647
14651
 
14648
14652
  ${originalText}`;
14653
+ } catch {}
14649
14654
  }
14650
14655
  };
14651
14656
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",