@symerian/symi 2.4.0 → 2.4.1

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.
Files changed (169) hide show
  1. package/dist/{accounts-tNElYrCH.js → accounts-CI6zQTJj.js} +14 -14
  2. package/dist/{accounts-qtxJ-6em.js → accounts-CJR8j_Kq.js} +1 -1
  3. package/dist/{accounts-CWktKM8a.js → accounts-ChTFYj8Q.js} +1 -1
  4. package/dist/{active-listener-C9r8ZB9m.js → active-listener-D6sXIjAg.js} +1 -1
  5. package/dist/{agent-scope-BxoUQqgM.js → agent-scope-Bw1Ed8W9.js} +3 -3
  6. package/dist/{agents-CI3xxYc_.js → agents-BrpbYYTb.js} +4 -4
  7. package/dist/{agents.config-DCE3RGr9.js → agents.config-Bf8u_0ts.js} +1 -1
  8. package/dist/{agents.config-DTUAM1AG.js → agents.config-j4SWyB6K.js} +1 -1
  9. package/dist/{audio-preflight-O3ASWbaG.js → audio-preflight-BkIfnmpi.js} +29 -29
  10. package/dist/{auth-choice-IiIysHGO.js → auth-choice-BYB9fJiu.js} +1 -1
  11. package/dist/{auth-choice-DuQwRfJc.js → auth-choice-DlrjQI-v.js} +1 -1
  12. package/dist/{banner-xhDZu_ZJ.js → banner-DRJJmkv1.js} +1 -1
  13. package/dist/{bindings-B7Ke6LJi.js → bindings-BU2hsBd9.js} +2 -2
  14. package/dist/build-info.json +3 -3
  15. package/dist/bundled/boot-md/handler.js +53 -53
  16. package/dist/bundled/bootstrap-extra-files/handler.js +5 -5
  17. package/dist/bundled/command-logger/handler.js +1 -1
  18. package/dist/bundled/session-memory/handler.js +53 -53
  19. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  20. package/dist/{channel-activity-CsM_hJ_s.js → channel-activity-C9-gaquj.js} +1 -1
  21. package/dist/{channel-options-D3gGVwBd.js → channel-options-BQz0F4El.js} +1 -1
  22. package/dist/{channel-options-Dvxd7eJY.js → channel-options-CxSIp3x-.js} +1 -1
  23. package/dist/{channel-web-a5tX1YI3.js → channel-web-BY4lhNxW.js} +1 -1
  24. package/dist/{channels-cli-C9wBYmDe.js → channels-cli--rkhLJvR.js} +4 -4
  25. package/dist/{channels-cli-BLUkl5Li.js → channels-cli-B5Nj_nHr.js} +4 -4
  26. package/dist/{chrome-BFekevcE.js → chrome-CxSAp8x3.js} +20 -20
  27. package/dist/{chunk-BW5f05BR.js → chunk-ClbN9Pqy.js} +1 -1
  28. package/dist/{cli-Cw45F0yJ.js → cli-CATf6JAq.js} +1 -1
  29. package/dist/{cli-CaEE46xi.js → cli-Ds6poYQ6.js} +1 -1
  30. package/dist/{command-format-BaxDnULz.js → command-format-UKHV-j0K.js} +1 -1
  31. package/dist/{command-registry-ea9SD1eA.js → command-registry-DXt0PsFy.js} +9 -9
  32. package/dist/{commands-registry-D7CTCQPm.js → commands-registry-VSmULp-g.js} +4 -4
  33. package/dist/{completion-cli-CMJmUQbI.js → completion-cli-BsSDzZNA.js} +1 -1
  34. package/dist/{completion-cli-DVkiEAEA.js → completion-cli-CPMOXTf2.js} +2 -2
  35. package/dist/{config-cli-B2d28_hb.js → config-cli-B_KCvdli.js} +1 -1
  36. package/dist/{config-cli-VIg0PSyq.js → config-cli-C_GarUko.js} +1 -1
  37. package/dist/{config-DRbjHIwD.js → config-eEaJddXj.js} +12 -12
  38. package/dist/{configure-C_TVBt76.js → configure-CM-z8YCS.js} +3 -3
  39. package/dist/{configure-D-3FiJbK.js → configure-vfmJApU8.js} +3 -3
  40. package/dist/{deliver-CvCK5Mm9.js → deliver-BA7ZN3iM.js} +20 -20
  41. package/dist/{diagnostic-CI0kRQkt.js → diagnostic-C3nsWaw3.js} +1 -1
  42. package/dist/{doctor-completion-CJHJYIwQ.js → doctor-completion-8qbLmeX0.js} +1 -1
  43. package/dist/{doctor-completion-DeRX6gkI.js → doctor-completion-Dnxn_-ov.js} +1 -1
  44. package/dist/entry.js +1 -1
  45. package/dist/extensionAPI.js +1 -1
  46. package/dist/{frontmatter-C_bv_0P8.js → frontmatter-DPlG6yha.js} +2 -2
  47. package/dist/{gateway-cli-DiDJ6Z2d.js → gateway-cli-DKDpOBp-.js} +9 -9
  48. package/dist/{gateway-cli-BDDHBfYP.js → gateway-cli-XIsXoJZ3.js} +9 -9
  49. package/dist/{gemini-auth-CdSPHuLl.js → gemini-auth-CF48hUR9.js} +1 -1
  50. package/dist/{github-copilot-token-C_qUP7p5.js → github-copilot-token-DJqsJ2-r.js} +7 -7
  51. package/dist/{glass-ui-ws-Bj1IuJXt.js → glass-ui-ws-Be_AOhp7.js} +7 -7
  52. package/dist/{glass-ui-ws-rGIAkViC.js → glass-ui-ws-Z_wtGa_A.js} +7 -7
  53. package/dist/{health-CypF_2ZD.js → health-BBGgp_dC.js} +1 -1
  54. package/dist/{health-Bst5HnLF.js → health-BmaWws9G.js} +1 -1
  55. package/dist/{hooks-cli-CfsqqxPX.js → hooks-cli-C5eV9sxP.js} +2 -2
  56. package/dist/{hooks-cli-CDMcqTy4.js → hooks-cli-W_aoP9nb.js} +2 -2
  57. package/dist/{image-B0wGflxA.js → image-BGmVDkkw.js} +4 -4
  58. package/dist/{image-ops-CvJzsyvE.js → image-ops-S8-8dAhx.js} +1 -1
  59. package/dist/index.js +6 -6
  60. package/dist/{ir-DccrnjsE.js → ir-CbFUkv_T.js} +4 -4
  61. package/dist/llm-slug-generator.js +53 -53
  62. package/dist/{local-roots-DMwIh5cS.js → local-roots-C7OCYACU.js} +5 -5
  63. package/dist/{login-CwCoxapk.js → login-B8uiUAnV.js} +7 -7
  64. package/dist/{login-qr-Batf3PT5.js → login-qr-CIZk8uKX.js} +12 -12
  65. package/dist/{manager-D_LwXbc6.js → manager-BoLr3xR_.js} +13 -13
  66. package/dist/{manifest-registry-D0IQ3WuX.js → manifest-registry-CneMHk0N.js} +19 -19
  67. package/dist/{markdown-tables-iMQQZu4Q.js → markdown-tables-DSHvnTLx.js} +1 -1
  68. package/dist/{message-channel-Dz5lr5b0.js → message-channel-DbsRltF2.js} +1 -1
  69. package/dist/{model-auth-DK43VicI.js → model-auth-CwOuTuXl.js} +9 -9
  70. package/dist/{models-ZEOGlFx7.js → models-COaQWNz5.js} +2 -2
  71. package/dist/{models-cli-BM1QyeXr.js → models-cli-DH17yK8M.js} +3 -3
  72. package/dist/{models-cli-BwOQhZ_c.js → models-cli-DeG1qheS.js} +2 -2
  73. package/dist/{onboard-CU-pntZD.js → onboard-CXOUIg28.js} +2 -2
  74. package/dist/{onboard-DQ34giB5.js → onboard-DBeHwdks.js} +2 -2
  75. package/dist/{onboard-channels-g5cvwJpx.js → onboard-channels-BCUkNB26.js} +1 -1
  76. package/dist/{onboard-channels-BOBxxhHX.js → onboard-channels-D93AAHMd.js} +1 -1
  77. package/dist/{onboarding-CXWUjdM5.js → onboarding-C58wjONa.js} +3 -3
  78. package/dist/{onboarding-DWs6tHZ9.js → onboarding-Dfjn2-9q.js} +3 -3
  79. package/dist/{onboarding.finalize-CAYf88mf.js → onboarding.finalize-7r1HYXWd.js} +6 -6
  80. package/dist/{onboarding.finalize-vupGASMK.js → onboarding.finalize-DGD56sXW.js} +5 -5
  81. package/dist/{outbound-attachment-DjNDa3zn.js → outbound-attachment-Co2diKdP.js} +2 -2
  82. package/dist/{outbound-D4fN_ZlE.js → outbound-opDNxv-l.js} +7 -7
  83. package/dist/{paths-DLyHUt31.js → paths-Cb87-LzP.js} +1 -1
  84. package/dist/{paths-Cce4PUkG.js → paths-CySxpNhH.js} +5 -5
  85. package/dist/{pi-auth-json-0SYBFZTt.js → pi-auth-json-DPWPoruO.js} +8 -8
  86. package/dist/{pi-embedded-CJsSOG2j.js → pi-embedded-B6uRrG1f.js} +254 -162
  87. package/dist/{pi-embedded-DwbQz0MC.js → pi-embedded-CAJ6egA1.js} +94 -2
  88. package/dist/{pi-embedded-helpers-DLFjnVBb.js → pi-embedded-helpers-DEEaCvEp.js} +52 -52
  89. package/dist/{plugin-registry-CZeHSx_c.js → plugin-registry-C0iHnZ7j.js} +1 -1
  90. package/dist/{plugin-registry-BDpdOTei.js → plugin-registry-D_BAH1V5.js} +1 -1
  91. package/dist/plugin-sdk/agents/pi-embedded-runner/extra-params.d.ts +6 -0
  92. package/dist/plugin-sdk/agents/stream-monitor.d.ts +62 -0
  93. package/dist/plugin-sdk/{channel-web-uUypcT9Q.js → channel-web-ilY3YUmF.js} +1 -1
  94. package/dist/plugin-sdk/index.js +2 -2
  95. package/dist/plugin-sdk/{reply-DTKTuCrn.js → reply-CSgeVqcV.js} +94 -2
  96. package/dist/plugin-sdk/{web-Dh6Youzv.js → web-BVg5EjiY.js} +2 -2
  97. package/dist/{plugins-DQYI3Fr-.js → plugins-C4C9637U.js} +9 -9
  98. package/dist/{plugins-cli-CCQ3skeQ.js → plugins-cli-BhOXY_Ay.js} +2 -2
  99. package/dist/{plugins-cli-D_RzeRoE.js → plugins-cli-LqQNHF1I.js} +2 -2
  100. package/dist/{program-Cl9i8ubQ.js → program-CutjuJj0.js} +7 -7
  101. package/dist/{program-context-BbmYGW-V.js → program-context-qVc_lsLV.js} +17 -17
  102. package/dist/{prompt-select-styled-BN0T6GxF.js → prompt-select-styled-BCHe7Fks.js} +4 -4
  103. package/dist/{prompt-select-styled-BfuyvChh.js → prompt-select-styled-C0yn8YjW.js} +4 -4
  104. package/dist/{provider-auth-helpers-CkmLFHXL.js → provider-auth-helpers-BzczCfh8.js} +1 -1
  105. package/dist/{provider-auth-helpers-CuT5EHza.js → provider-auth-helpers-Ds_HwlgY.js} +1 -1
  106. package/dist/{push-apns-DeJt9kAO.js → push-apns-CT8-VcK5.js} +1 -1
  107. package/dist/{push-apns-CFkFVwEz.js → push-apns-DvcqkHld.js} +1 -1
  108. package/dist/{pw-ai-BnAKvSuw.js → pw-ai-DhwRiS06.js} +11 -11
  109. package/dist/{qmd-manager-QHUP-_em.js → qmd-manager-DdZh9PHs.js} +7 -7
  110. package/dist/{register.agent-BQm4YmZp.js → register.agent-DMvHFw16.js} +6 -6
  111. package/dist/{register.agent-BygseJ7t.js → register.agent-yoXoJ_5O.js} +5 -5
  112. package/dist/{register.configure-Cj95vB2U.js → register.configure-B8UDTEcS.js} +6 -6
  113. package/dist/{register.configure-C2fhjZze.js → register.configure-BqrNBkwZ.js} +6 -6
  114. package/dist/{register.maintenance-K1x3E7OS.js → register.maintenance-D1MuIUlv.js} +7 -7
  115. package/dist/{register.maintenance-CClfXq5e.js → register.maintenance-DMLPFSKI.js} +8 -8
  116. package/dist/{register.message-BSr-kUvJ.js → register.message-BnLBwUw9.js} +2 -2
  117. package/dist/{register.message-CSRzBl-c.js → register.message-CgtrjEFw.js} +2 -2
  118. package/dist/{register.onboard-Bd6wPydW.js → register.onboard-CXHhSH4B.js} +4 -4
  119. package/dist/{register.onboard-TsU21RR7.js → register.onboard-D1X2dUGZ.js} +4 -4
  120. package/dist/{register.setup-C9gu0W5l.js → register.setup-DFDb5BDi.js} +4 -4
  121. package/dist/{register.setup-DK-zsne2.js → register.setup-Q58lN0TV.js} +4 -4
  122. package/dist/{register.status-health-sessions-DN5Ui3V0.js → register.status-health-sessions-CP7JWQHw.js} +3 -3
  123. package/dist/{register.status-health-sessions-rZsuoqtr.js → register.status-health-sessions-DhTfQ530.js} +3 -3
  124. package/dist/{register.subclis-DnzHFtLz.js → register.subclis-CrTXa8cj.js} +9 -9
  125. package/dist/{registry-CK4e9hn8.js → registry-DP24za6g.js} +17 -17
  126. package/dist/{replies-BIX_isV7.js → replies-DpPvWiGF.js} +3 -3
  127. package/dist/{reply-Ca3slrA3.js → reply-DkwaBRX-.js} +94 -2
  128. package/dist/{reply-prefix-XlyuyChD.js → reply-prefix-CtL0omgM.js} +1 -1
  129. package/dist/{resolve-route-CZ-1eqw0.js → resolve-route-BVikmvWO.js} +4 -4
  130. package/dist/{retry-Cly39XZB.js → retry-dGG-MbxL.js} +1 -1
  131. package/dist/{run-main-DlHh5iOO.js → run-main-BLKPL_vM.js} +14 -14
  132. package/dist/{runner-odEv83vv.js → runner-B_KP4voe.js} +9 -9
  133. package/dist/{send-DeFniOjh.js → send-CHEOWVc8.js} +6 -6
  134. package/dist/{send-WyRqb4WD.js → send-DbcLJb0P.js} +7 -7
  135. package/dist/{send-B1u-LrcS.js → send-DeEosX8F.js} +18 -18
  136. package/dist/{send-CiTGOvEc.js → send-DwKJK3sM.js} +10 -10
  137. package/dist/{send-DW96zgDL.js → send-zSarozV2.js} +6 -6
  138. package/dist/{server-methods-BYOkyf-q.js → server-methods-CbeCo-6O.js} +7 -7
  139. package/dist/{server-methods-b_Qod4tt.js → server-methods-EQ0JkHOg.js} +7 -7
  140. package/dist/{server-node-events-60nWpTh1.js → server-node-events-C1FDqJb9.js} +2 -2
  141. package/dist/{server-node-events-oU4Amei7.js → server-node-events-CBHpc_25.js} +2 -2
  142. package/dist/{session-SM36BTsl.js → session-DV1MNlbV.js} +8 -8
  143. package/dist/{skill-commands-BJMb_psG.js → skill-commands-D610IKhm.js} +9 -9
  144. package/dist/{skills-BFekKL7i.js → skills-o5WVqM4V.js} +21 -21
  145. package/dist/{sqlite-DRbx2dhW.js → sqlite-6H6Zw1cs.js} +4 -4
  146. package/dist/{status-BXW5l4sd.js → status-B1r3Wp0-.js} +2 -2
  147. package/dist/{status-D3-lP2_9.js → status-Cksz7z4T.js} +1 -1
  148. package/dist/{status-BxbbINLV.js → status-CnogoaI_.js} +2 -2
  149. package/dist/{status-kdz9P3tw.js → status-jVJSC_Ga.js} +1 -1
  150. package/dist/{store-C0wvOkae.js → store-vVE6N2mH.js} +2 -2
  151. package/dist/{subagent-registry-CbTbJKLs.js → subagent-registry-Jwg44JMf.js} +94 -2
  152. package/dist/{subsystem-Bs9YvKLa.js → subsystem-DgpxyDQ_.js} +1 -1
  153. package/dist/{tables-DuZspiBu.js → tables-BIWsCKXJ.js} +1 -1
  154. package/dist/{target-errors-Be1SwYlW.js → target-errors-DyItGyW9.js} +2 -2
  155. package/dist/{thinking-CdlENGRW.js → thinking-Ni0HF-w6.js} +5 -5
  156. package/dist/{tokens-H1H1LiSQ.js → tokens-c_SLAkVb.js} +1 -1
  157. package/dist/{tool-images-DXB7tqWi.js → tool-images-DBCfXdli.js} +2 -2
  158. package/dist/{tool-loop-detection-Cs8_HCsx.js → tool-loop-detection-Bbc9OPFR.js} +3 -3
  159. package/dist/{update-cli-Cy0gdWRf.js → update-cli-BkU6ori8.js} +8 -8
  160. package/dist/{update-cli-B5TI650v.js → update-cli-D18nWvzY.js} +7 -7
  161. package/dist/{update-runner-Bacq0oLK.js → update-runner-BQg__DB5.js} +1 -1
  162. package/dist/{update-runner-B0NdgPvD.js → update-runner-le1Hcqx4.js} +1 -1
  163. package/dist/{web-DmED3zDP.js → web-BSs2eYJa.js} +2 -2
  164. package/dist/{web-QVwKg99Q.js → web-BsjZ2RTT.js} +57 -57
  165. package/dist/{web-D-oCzJTU.js → web-DajtZMaX.js} +1 -1
  166. package/dist/{web-DWNtg4iV.js → web-KYh3LgI0.js} +1 -1
  167. package/dist/{whatsapp-actions-D1RsnX7P.js → whatsapp-actions-oRQjcdQe.js} +23 -23
  168. package/dist/{workspace-wAaHI8-5.js → workspace-CbvamIU6.js} +6 -6
  169. package/package.json +1 -1
@@ -51787,7 +51787,7 @@ function isVoiceChannelType(type) {
51787
51787
  function createDefaultDeps() {
51788
51788
  return {
51789
51789
  sendMessageWhatsApp: async (...args) => {
51790
- const { sendMessageWhatsApp } = await import("./web-DWNtg4iV.js");
51790
+ const { sendMessageWhatsApp } = await import("./web-KYh3LgI0.js");
51791
51791
  return await sendMessageWhatsApp(...args);
51792
51792
  },
51793
51793
  sendMessageTelegram: async (...args) => {
@@ -67069,7 +67069,7 @@ function loadWebLoginQr() {
67069
67069
  return webLoginQrPromise;
67070
67070
  }
67071
67071
  function loadWebChannel() {
67072
- webChannelPromise ??= import("./web-DWNtg4iV.js");
67072
+ webChannelPromise ??= import("./web-KYh3LgI0.js");
67073
67073
  return webChannelPromise;
67074
67074
  }
67075
67075
  function loadWhatsAppActions() {
@@ -75282,6 +75282,89 @@ Use the message tool with buttons:
75282
75282
  [{"label": "✅ Proceed", "data": "/plan-proceed"}, {"label": "✏️ Modify", "data": "/plan-modify"}, {"label": "❌ Cancel", "data": "/plan-cancel"}]
75283
75283
  </plan_mode>`;
75284
75284
 
75285
+ //#endregion
75286
+ //#region src/agents/stream-monitor.ts
75287
+ /**
75288
+ * Create a stream monitor configured for the given model profile.
75289
+ *
75290
+ * - Claude (hasStructuredThinking: true): repetition detection only
75291
+ * - Gemma/vLLM (hasStructuredThinking: false): tool JSON + repetition detection
75292
+ */
75293
+ function createStreamMonitor(profile, overrides) {
75294
+ const detectToolJson = overrides?.detectToolJson ?? !profile.filters.hasStructuredThinking;
75295
+ const detectRepetition = overrides?.detectRepetition ?? true;
75296
+ const minBlockSize = overrides?.repetitionMinBlockSize ?? 150;
75297
+ let accumulated = "";
75298
+ let stopSignaled = false;
75299
+ let stopReason;
75300
+ return {
75301
+ onChunk(delta) {
75302
+ if (stopSignaled) return;
75303
+ accumulated += delta;
75304
+ if (detectToolJson && hasCompleteToolJson(accumulated)) {
75305
+ stopSignaled = true;
75306
+ stopReason = "complete-tool-json";
75307
+ return;
75308
+ }
75309
+ if (detectRepetition && hasRepetition(accumulated, minBlockSize)) {
75310
+ stopSignaled = true;
75311
+ stopReason = "repetition-detected";
75312
+ return;
75313
+ }
75314
+ },
75315
+ shouldStop: () => stopSignaled,
75316
+ getAccumulated: () => accumulated,
75317
+ getStopReason: () => stopReason,
75318
+ reset() {
75319
+ accumulated = "";
75320
+ stopSignaled = false;
75321
+ stopReason = void 0;
75322
+ }
75323
+ };
75324
+ }
75325
+ /**
75326
+ * Detect if the accumulated text contains a syntactically complete JSON
75327
+ * object with tool_name and tool_args. Used for models that output tool
75328
+ * calls as plain text JSON (not native structured tool calls).
75329
+ */
75330
+ function hasCompleteToolJson(text) {
75331
+ const hasToolKey = text.includes("tool_name") || text.includes("\"tool\"");
75332
+ const hasArgsKey = text.includes("tool_args") || text.includes("\"args\"");
75333
+ if (!hasToolKey || !hasArgsKey) return false;
75334
+ const lastBrace = text.lastIndexOf("}");
75335
+ if (lastBrace < 0) return false;
75336
+ let depth = 0;
75337
+ let start = -1;
75338
+ for (let i = lastBrace; i >= 0; i--) {
75339
+ if (text[i] === "}") depth++;
75340
+ if (text[i] === "{") depth--;
75341
+ if (depth === 0) {
75342
+ start = i;
75343
+ break;
75344
+ }
75345
+ }
75346
+ if (start < 0) return false;
75347
+ const candidate = text.slice(start, lastBrace + 1);
75348
+ try {
75349
+ const parsed = JSON.parse(candidate);
75350
+ return typeof parsed === "object" && parsed !== null && (typeof parsed.tool_name === "string" || typeof parsed.tool === "string") && (typeof parsed.tool_args === "object" || typeof parsed.args === "object");
75351
+ } catch {
75352
+ return false;
75353
+ }
75354
+ }
75355
+ /**
75356
+ * Detect if the accumulated text contains a repeated block, indicating
75357
+ * a looping cascade. Returns true if a block of `minBlockSize` chars
75358
+ * from the first half appears again in the second half.
75359
+ */
75360
+ function hasRepetition(text, minBlockSize) {
75361
+ if (text.length < minBlockSize * 2.5) return false;
75362
+ const sampleStart = Math.floor(text.length * .25);
75363
+ const sample = text.slice(sampleStart, sampleStart + minBlockSize);
75364
+ const searchStart = sampleStart + minBlockSize;
75365
+ return text.indexOf(sample, searchStart) >= 0;
75366
+ }
75367
+
75285
75368
  //#endregion
75286
75369
  //#region src/agents/symipulse-timeout.ts
75287
75370
  /**
@@ -76496,6 +76579,7 @@ async function runEmbeddedAttempt(params) {
76496
76579
  return fn(...args);
76497
76580
  });
76498
76581
  };
76582
+ const streamMonitor = createStreamMonitor(modelProfile);
76499
76583
  const subscription = subscribeEmbeddedPiSession({
76500
76584
  session: activeSession,
76501
76585
  runId: params.runId,
@@ -76517,6 +76601,14 @@ async function runEmbeddedAttempt(params) {
76517
76601
  onAgentEvent: (evt) => {
76518
76602
  armSymipulseTimer();
76519
76603
  params.onAgentEvent?.(evt);
76604
+ if (evt.stream === "assistant" && typeof evt.data?.text === "string" && !aborted) {
76605
+ streamMonitor.onChunk(evt.data.text);
76606
+ if (streamMonitor.shouldStop()) {
76607
+ const reason = streamMonitor.getStopReason();
76608
+ log$2.warn(`stream monitor triggered abort: runId=${params.runId} reason=${reason}`);
76609
+ abortRun(false, /* @__PURE__ */ new Error(`stream-monitor:${reason}`));
76610
+ }
76611
+ }
76520
76612
  },
76521
76613
  enforceFinalTag: params.enforceFinalTag,
76522
76614
  config: params.config,
@@ -1,31 +1,31 @@
1
- import { i as resolveGatewayPort, t as STATE_DIR, u as resolveRequiredHomeDir } from "./paths-Cce4PUkG.js";
1
+ import { i as resolveGatewayPort, t as STATE_DIR, u as resolveRequiredHomeDir } from "./paths-CySxpNhH.js";
2
2
  import { c as normalizeMainKey, l as resolveAgentIdFromSessionKey, m as normalizeOptionalAccountId, r as buildAgentMainSessionKey, s as normalizeAgentId, t as DEFAULT_AGENT_ID } from "./session-key-BCzIW1Y2.js";
3
- import { I as resolveUserPath, M as normalizeE164, U as truncateUtf16Safe, dt as resolvePreferredSymiTmpDir, t as CHANNEL_IDS } from "./registry-CK4e9hn8.js";
4
- import { n as resolveAgentConfig, u as resolveSessionAgentId } from "./agent-scope-BxoUQqgM.js";
5
- import { r as defaultRuntime, t as createSubsystemLogger } from "./subsystem-Bs9YvKLa.js";
6
- import { _ as runExec, a as DEFAULT_SYMICORE_FILENAME, c as DEFAULT_USER_FILENAME, i as DEFAULT_IDENTITY_FILENAME, l as ensureAgentWorkspace, n as DEFAULT_AGENT_WORKSPACE_DIR, o as DEFAULT_SYMIPULSE_FILENAME, r as DEFAULT_BOOTSTRAP_FILENAME, s as DEFAULT_TOOLS_FILENAME, t as DEFAULT_AGENTS_FILENAME } from "./workspace-wAaHI8-5.js";
7
- import { r as normalizeChannelId } from "./plugins-DQYI3Fr-.js";
3
+ import { I as resolveUserPath, M as normalizeE164, U as truncateUtf16Safe, dt as resolvePreferredSymiTmpDir, t as CHANNEL_IDS } from "./registry-DP24za6g.js";
4
+ import { n as resolveAgentConfig, u as resolveSessionAgentId } from "./agent-scope-Bw1Ed8W9.js";
5
+ import { r as defaultRuntime, t as createSubsystemLogger } from "./subsystem-DgpxyDQ_.js";
6
+ import { _ as runExec, a as DEFAULT_SYMICORE_FILENAME, c as DEFAULT_USER_FILENAME, i as DEFAULT_IDENTITY_FILENAME, l as ensureAgentWorkspace, n as DEFAULT_AGENT_WORKSPACE_DIR, o as DEFAULT_SYMIPULSE_FILENAME, r as DEFAULT_BOOTSTRAP_FILENAME, s as DEFAULT_TOOLS_FILENAME, t as DEFAULT_AGENTS_FILENAME } from "./workspace-CbvamIU6.js";
7
+ import { r as normalizeChannelId } from "./plugins-C4C9637U.js";
8
8
  import { t as normalizeChatType } from "./chat-type-C_KiWNAH.js";
9
9
  import { t as parseBooleanValue } from "./boolean-B8-BqKGQ.js";
10
- import { t as formatCliCommand } from "./command-format-BaxDnULz.js";
11
- import { c as SafeOpenError, i as getImageMetadata, l as openFileWithinRoot, n as buildImageResizeSideGrid, s as resizeToJpeg, t as IMAGE_REDUCE_QUALITY_STEPS } from "./image-ops-CvJzsyvE.js";
12
- import { S as isPidAlive, x as resolveProcessScopedMap } from "./model-auth-DK43VicI.js";
13
- import { o as listDeliverableMessageChannels, s as normalizeMessageChannel } from "./message-channel-Dz5lr5b0.js";
14
- import { _ as parseDurationMs, a as writeConfigFile, n as loadConfig, s as parseByteSize, t as createConfigIO } from "./config-DRbjHIwD.js";
15
- import { A as DEFAULT_BROWSER_EVALUATE_ENABLED, D as DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS, E as DEFAULT_AI_SNAPSHOT_EFFICIENT_DEPTH, M as DEFAULT_SYMI_BROWSER_ENABLED, N as DEFAULT_SYMI_BROWSER_PROFILE_NAME, O as DEFAULT_AI_SNAPSHOT_MAX_CHARS, S as stopChromeExtensionRelayServer, _ as fetchJson, a as resolveSymiUserDataDir, c as captureScreenshot, d as normalizeCdpWsUrl, f as snapshotAria, g as appendCdpPath, h as withBrowserNavigationPolicy, i as launchSymiChrome, j as DEFAULT_SYMI_BROWSER_COLOR, k as DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, l as createTargetViaCdp, m as assertBrowserNavigationAllowed, n as isChromeCdpReady, o as stopSymiChrome, p as InvalidBrowserNavigationUrlError, r as isChromeReachable, s as resolveBrowserExecutableForPlatform, v as fetchOk, w as isLoopbackHost, x as ensureChromeExtensionRelayServer } from "./chrome-BFekevcE.js";
16
- import { a as syncSkillsToWorkspace, l as resolveSandboxInputPath, m as sanitizeEnvVars, u as resolveSandboxPath } from "./skills-BFekKL7i.js";
10
+ import { t as formatCliCommand } from "./command-format-UKHV-j0K.js";
11
+ import { c as SafeOpenError, i as getImageMetadata, l as openFileWithinRoot, n as buildImageResizeSideGrid, s as resizeToJpeg, t as IMAGE_REDUCE_QUALITY_STEPS } from "./image-ops-S8-8dAhx.js";
12
+ import { S as isPidAlive, x as resolveProcessScopedMap } from "./model-auth-CwOuTuXl.js";
13
+ import { o as listDeliverableMessageChannels, s as normalizeMessageChannel } from "./message-channel-DbsRltF2.js";
14
+ import { _ as parseDurationMs, a as writeConfigFile, n as loadConfig, s as parseByteSize, t as createConfigIO } from "./config-eEaJddXj.js";
15
+ import { A as DEFAULT_BROWSER_EVALUATE_ENABLED, D as DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS, E as DEFAULT_AI_SNAPSHOT_EFFICIENT_DEPTH, M as DEFAULT_SYMI_BROWSER_ENABLED, N as DEFAULT_SYMI_BROWSER_PROFILE_NAME, O as DEFAULT_AI_SNAPSHOT_MAX_CHARS, S as stopChromeExtensionRelayServer, _ as fetchJson, a as resolveSymiUserDataDir, c as captureScreenshot, d as normalizeCdpWsUrl, f as snapshotAria, g as appendCdpPath, h as withBrowserNavigationPolicy, i as launchSymiChrome, j as DEFAULT_SYMI_BROWSER_COLOR, k as DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, l as createTargetViaCdp, m as assertBrowserNavigationAllowed, n as isChromeCdpReady, o as stopSymiChrome, p as InvalidBrowserNavigationUrlError, r as isChromeReachable, s as resolveBrowserExecutableForPlatform, v as fetchOk, w as isLoopbackHost, x as ensureChromeExtensionRelayServer } from "./chrome-CxSAp8x3.js";
16
+ import { a as syncSkillsToWorkspace, l as resolveSandboxInputPath, m as sanitizeEnvVars, u as resolveSandboxPath } from "./skills-o5WVqM4V.js";
17
17
  import { n as formatErrorMessage, t as extractErrorCode } from "./errors-BoQgnc8X.js";
18
18
  import { t as SsrFBlockedError } from "./ssrf-BTMDZjHT.js";
19
- import { r as saveMediaBuffer, t as ensureMediaDir } from "./store-C0wvOkae.js";
20
- import { d as getChannelDock, o as normalizeThinkLevel, v as normalizeHyphenSlug } from "./thinking-CdlENGRW.js";
19
+ import { r as saveMediaBuffer, t as ensureMediaDir } from "./store-vVE6N2mH.js";
20
+ import { d as getChannelDock, o as normalizeThinkLevel, v as normalizeHyphenSlug } from "./thinking-Ni0HF-w6.js";
21
21
  import { n as resolveConversationLabel } from "./conversation-label-DXUkoKcB.js";
22
- import { a as resolveSessionTranscriptPathInDir, i as resolveSessionTranscriptPath, n as resolveSessionFilePath, s as resolveStorePath, t as resolveDefaultSessionStorePath } from "./paths-DLyHUt31.js";
22
+ import { a as resolveSessionTranscriptPathInDir, i as resolveSessionTranscriptPath, n as resolveSessionFilePath, s as resolveStorePath, t as resolveDefaultSessionStorePath } from "./paths-Cb87-LzP.js";
23
23
  import { t as emitSessionTranscriptUpdate } from "./transcript-events-DDYvbmRV.js";
24
- import { t as sanitizeContentBlocksImages } from "./tool-images-DXB7tqWi.js";
24
+ import { t as sanitizeContentBlocksImages } from "./tool-images-DBCfXdli.js";
25
25
  import fs from "node:fs/promises";
26
26
  import os from "node:os";
27
27
  import path, { posix } from "node:path";
28
- import fs$1, { existsSync, realpathSync } from "node:fs";
28
+ import fsSync, { existsSync, realpathSync } from "node:fs";
29
29
  import { spawn } from "node:child_process";
30
30
  import { CURRENT_SESSION_VERSION, SessionManager } from "@mariozechner/pi-coding-agent";
31
31
  import crypto, { createHash, timingSafeEqual } from "node:crypto";
@@ -933,7 +933,7 @@ function isModuleNotFoundError(err) {
933
933
  }
934
934
  async function loadPwAiModule(mode) {
935
935
  try {
936
- return await import("./pw-ai-BnAKvSuw.js");
936
+ return await import("./pw-ai-DhwRiS06.js");
937
937
  } catch (err) {
938
938
  if (mode === "soft") return null;
939
939
  if (isModuleNotFoundError(err)) return null;
@@ -2689,11 +2689,11 @@ async function movePathToTrash(targetPath) {
2689
2689
  return targetPath;
2690
2690
  } catch {
2691
2691
  const trashDir = path.join(os.homedir(), ".Trash");
2692
- fs$1.mkdirSync(trashDir, { recursive: true });
2692
+ fsSync.mkdirSync(trashDir, { recursive: true });
2693
2693
  const base = path.basename(targetPath);
2694
2694
  let dest = path.join(trashDir, `${base}-${Date.now()}`);
2695
- if (fs$1.existsSync(dest)) dest = path.join(trashDir, `${base}-${Date.now()}-${Math.random()}`);
2696
- fs$1.renameSync(targetPath, dest);
2695
+ if (fsSync.existsSync(dest)) dest = path.join(trashDir, `${base}-${Date.now()}-${Math.random()}`);
2696
+ fsSync.renameSync(targetPath, dest);
2697
2697
  return dest;
2698
2698
  }
2699
2699
  }
@@ -2771,7 +2771,7 @@ function createBrowserProfilesService(ctx) {
2771
2771
  } catch {}
2772
2772
  const userDataDir = resolveSymiUserDataDir(name);
2773
2773
  const profileDir = path.dirname(userDataDir);
2774
- if (fs$1.existsSync(profileDir)) {
2774
+ if (fsSync.existsSync(profileDir)) {
2775
2775
  await movePathToTrash(profileDir);
2776
2776
  deleted = true;
2777
2777
  }
@@ -3473,13 +3473,13 @@ function createProfileContext(opts, profile) {
3473
3473
  const userDataDir = resolveSymiUserDataDir(profile.name);
3474
3474
  const profileState = getProfileState();
3475
3475
  if (await isHttpReachable(300) && !profileState.running) try {
3476
- await (await import("./pw-ai-BnAKvSuw.js")).closePlaywrightBrowserConnection();
3476
+ await (await import("./pw-ai-DhwRiS06.js")).closePlaywrightBrowserConnection();
3477
3477
  } catch {}
3478
3478
  if (profileState.running) await stopRunningBrowser();
3479
3479
  try {
3480
- await (await import("./pw-ai-BnAKvSuw.js")).closePlaywrightBrowserConnection();
3480
+ await (await import("./pw-ai-DhwRiS06.js")).closePlaywrightBrowserConnection();
3481
3481
  } catch {}
3482
- if (!fs$1.existsSync(userDataDir)) return {
3482
+ if (!fsSync.existsSync(userDataDir)) return {
3483
3483
  moved: false,
3484
3484
  from: userDataDir
3485
3485
  };
@@ -3898,7 +3898,7 @@ function releaseAllLocksSync() {
3898
3898
  if (typeof held.handle.close === "function") held.handle.close().catch(() => {});
3899
3899
  } catch {}
3900
3900
  try {
3901
- fs$1.rmSync(held.lockPath, { force: true });
3901
+ fsSync.rmSync(held.lockPath, { force: true });
3902
3902
  } catch {}
3903
3903
  HELD_LOCKS.delete(sessionFile);
3904
3904
  }
@@ -5699,7 +5699,7 @@ function resolveSessionTranscriptCandidates(sessionId, storePath, sessionFile, a
5699
5699
  }
5700
5700
  function archiveFileOnDisk(filePath, reason) {
5701
5701
  const archived = `${filePath}.${reason}.${(/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-")}`;
5702
- fs$1.renameSync(filePath, archived);
5702
+ fsSync.renameSync(filePath, archived);
5703
5703
  return archived;
5704
5704
  }
5705
5705
  /**
@@ -5709,7 +5709,7 @@ function archiveFileOnDisk(filePath, reason) {
5709
5709
  function archiveSessionTranscripts(opts) {
5710
5710
  const archived = [];
5711
5711
  for (const candidate of resolveSessionTranscriptCandidates(opts.sessionId, opts.storePath, opts.sessionFile, opts.agentId)) {
5712
- if (!fs$1.existsSync(candidate)) continue;
5712
+ if (!fsSync.existsSync(candidate)) continue;
5713
5713
  try {
5714
5714
  archived.push(archiveFileOnDisk(candidate, opts.reason));
5715
5715
  } catch {}
@@ -5741,15 +5741,15 @@ async function cleanupArchivedSessionTranscripts(opts) {
5741
5741
  let removed = 0;
5742
5742
  let scanned = 0;
5743
5743
  for (const dir of directories) {
5744
- const entries = await fs$1.promises.readdir(dir).catch(() => []);
5744
+ const entries = await fsSync.promises.readdir(dir).catch(() => []);
5745
5745
  for (const entry of entries) {
5746
5746
  const timestamp = parseArchivedTimestamp(entry, reason);
5747
5747
  if (timestamp == null) continue;
5748
5748
  scanned += 1;
5749
5749
  if (now - timestamp <= opts.olderThanMs) continue;
5750
5750
  const fullPath = path.join(dir, entry);
5751
- if (!(await fs$1.promises.stat(fullPath).catch(() => null))?.isFile()) continue;
5752
- await fs$1.promises.rm(fullPath).catch(() => void 0);
5751
+ if (!(await fsSync.promises.stat(fullPath).catch(() => null))?.isFile()) continue;
5752
+ await fsSync.promises.rm(fullPath).catch(() => void 0);
5753
5753
  removed += 1;
5754
5754
  }
5755
5755
  }
@@ -5885,7 +5885,7 @@ function isCacheEnabled(ttlMs) {
5885
5885
  }
5886
5886
  function getFileMtimeMs(filePath) {
5887
5887
  try {
5888
- return fs$1.statSync(filePath).mtimeMs;
5888
+ return fsSync.statSync(filePath).mtimeMs;
5889
5889
  } catch {
5890
5890
  return;
5891
5891
  }
@@ -5964,7 +5964,7 @@ function loadSessionStore(storePath, opts = {}) {
5964
5964
  const maxReadAttempts = process.platform === "win32" ? 3 : 1;
5965
5965
  const retryBuf = maxReadAttempts > 1 ? new Int32Array(new SharedArrayBuffer(4)) : void 0;
5966
5966
  for (let attempt = 0; attempt < maxReadAttempts; attempt++) try {
5967
- const raw = fs$1.readFileSync(storePath, "utf-8");
5967
+ const raw = fsSync.readFileSync(storePath, "utf-8");
5968
5968
  if (raw.length === 0 && attempt < maxReadAttempts - 1) {
5969
5969
  Atomics.wait(retryBuf, 0, 0, 50);
5970
5970
  continue;
@@ -6116,7 +6116,7 @@ function capEntryCount(store, overrideMax, opts = {}) {
6116
6116
  }
6117
6117
  async function getSessionFileSize(storePath) {
6118
6118
  try {
6119
- return (await fs$1.promises.stat(storePath)).size;
6119
+ return (await fsSync.promises.stat(storePath)).size;
6120
6120
  } catch {
6121
6121
  return null;
6122
6122
  }
@@ -6133,7 +6133,7 @@ async function rotateSessionFile(storePath, overrideBytes) {
6133
6133
  if (fileSize <= maxBytes) return false;
6134
6134
  const backupPath = `${storePath}.bak.${Date.now()}`;
6135
6135
  try {
6136
- await fs$1.promises.rename(storePath, backupPath);
6136
+ await fsSync.promises.rename(storePath, backupPath);
6137
6137
  log.info("rotated session store file", {
6138
6138
  backupPath: path.basename(backupPath),
6139
6139
  sizeBytes: fileSize
@@ -6144,11 +6144,11 @@ async function rotateSessionFile(storePath, overrideBytes) {
6144
6144
  try {
6145
6145
  const dir = path.dirname(storePath);
6146
6146
  const baseName = path.basename(storePath);
6147
- const backups = (await fs$1.promises.readdir(dir)).filter((f) => f.startsWith(`${baseName}.bak.`)).toSorted().toReversed();
6147
+ const backups = (await fsSync.promises.readdir(dir)).filter((f) => f.startsWith(`${baseName}.bak.`)).toSorted().toReversed();
6148
6148
  const maxBackups = 3;
6149
6149
  if (backups.length > maxBackups) {
6150
6150
  const toDelete = backups.slice(maxBackups);
6151
- for (const old of toDelete) await fs$1.promises.unlink(path.join(dir, old)).catch(() => void 0);
6151
+ for (const old of toDelete) await fsSync.promises.unlink(path.join(dir, old)).catch(() => void 0);
6152
6152
  log.info("cleaned up old session store backups", { deleted: toDelete.length });
6153
6153
  }
6154
6154
  } catch {}
@@ -6203,14 +6203,14 @@ async function saveSessionStoreUnlocked(storePath, store, opts) {
6203
6203
  await rotateSessionFile(storePath, maintenance.rotateBytes);
6204
6204
  }
6205
6205
  }
6206
- await fs$1.promises.mkdir(path.dirname(storePath), { recursive: true });
6206
+ await fsSync.promises.mkdir(path.dirname(storePath), { recursive: true });
6207
6207
  const json = JSON.stringify(store, null, 2);
6208
6208
  if (process.platform === "win32") {
6209
6209
  const tmp = `${storePath}.${process.pid}.${crypto.randomUUID()}.tmp`;
6210
6210
  try {
6211
- await fs$1.promises.writeFile(tmp, json, "utf-8");
6211
+ await fsSync.promises.writeFile(tmp, json, "utf-8");
6212
6212
  for (let i = 0; i < 5; i++) try {
6213
- await fs$1.promises.rename(tmp, storePath);
6213
+ await fsSync.promises.rename(tmp, storePath);
6214
6214
  break;
6215
6215
  } catch {
6216
6216
  if (i < 4) await new Promise((r) => setTimeout(r, 50 * (i + 1)));
@@ -6220,27 +6220,27 @@ async function saveSessionStoreUnlocked(storePath, store, opts) {
6220
6220
  if ((err && typeof err === "object" && "code" in err ? String(err.code) : null) === "ENOENT") return;
6221
6221
  throw err;
6222
6222
  } finally {
6223
- await fs$1.promises.rm(tmp, { force: true }).catch(() => void 0);
6223
+ await fsSync.promises.rm(tmp, { force: true }).catch(() => void 0);
6224
6224
  }
6225
6225
  return;
6226
6226
  }
6227
6227
  const tmp = `${storePath}.${process.pid}.${crypto.randomUUID()}.tmp`;
6228
6228
  try {
6229
- await fs$1.promises.writeFile(tmp, json, {
6229
+ await fsSync.promises.writeFile(tmp, json, {
6230
6230
  mode: 384,
6231
6231
  encoding: "utf-8"
6232
6232
  });
6233
- await fs$1.promises.rename(tmp, storePath);
6234
- await fs$1.promises.chmod(storePath, 384);
6233
+ await fsSync.promises.rename(tmp, storePath);
6234
+ await fsSync.promises.chmod(storePath, 384);
6235
6235
  } catch (err) {
6236
6236
  if ((err && typeof err === "object" && "code" in err ? String(err.code) : null) === "ENOENT") {
6237
6237
  try {
6238
- await fs$1.promises.mkdir(path.dirname(storePath), { recursive: true });
6239
- await fs$1.promises.writeFile(storePath, json, {
6238
+ await fsSync.promises.mkdir(path.dirname(storePath), { recursive: true });
6239
+ await fsSync.promises.writeFile(storePath, json, {
6240
6240
  mode: 384,
6241
6241
  encoding: "utf-8"
6242
6242
  });
6243
- await fs$1.promises.chmod(storePath, 384);
6243
+ await fsSync.promises.chmod(storePath, 384);
6244
6244
  } catch (err2) {
6245
6245
  if ((err2 && typeof err2 === "object" && "code" in err2 ? String(err2.code) : null) === "ENOENT") return;
6246
6246
  throw err2;
@@ -6249,7 +6249,7 @@ async function saveSessionStoreUnlocked(storePath, store, opts) {
6249
6249
  }
6250
6250
  throw err;
6251
6251
  } finally {
6252
- await fs$1.promises.rm(tmp, { force: true });
6252
+ await fsSync.promises.rm(tmp, { force: true });
6253
6253
  }
6254
6254
  }
6255
6255
  async function updateSessionStore(storePath, mutator, opts) {
@@ -6494,8 +6494,8 @@ function resolveMirroredTranscriptText(params) {
6494
6494
  return trimmed ? trimmed : null;
6495
6495
  }
6496
6496
  async function ensureSessionHeader(params) {
6497
- if (fs$1.existsSync(params.sessionFile)) return;
6498
- await fs$1.promises.mkdir(path.dirname(params.sessionFile), { recursive: true });
6497
+ if (fsSync.existsSync(params.sessionFile)) return;
6498
+ await fsSync.promises.mkdir(path.dirname(params.sessionFile), { recursive: true });
6499
6499
  const header = {
6500
6500
  type: "session",
6501
6501
  version: CURRENT_SESSION_VERSION,
@@ -6503,7 +6503,7 @@ async function ensureSessionHeader(params) {
6503
6503
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6504
6504
  cwd: process.cwd()
6505
6505
  };
6506
- await fs$1.promises.writeFile(params.sessionFile, `${JSON.stringify(header)}\n`, {
6506
+ await fsSync.promises.writeFile(params.sessionFile, `${JSON.stringify(header)}\n`, {
6507
6507
  encoding: "utf-8",
6508
6508
  mode: 384
6509
6509
  });
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
2
- import { vt as loadSymiPlugins } from "./reply-Ca3slrA3.js";
2
+ import { vt as loadSymiPlugins } from "./reply-DkwaBRX-.js";
3
3
  import { d as getActivePluginRegistry } from "./registry-Cja8eT7G.js";
4
4
  import { t as createSubsystemLogger } from "./subsystem-D9vIQve0.js";
5
5
  import { c as resolveAgentWorkspaceDir, l as resolveDefaultAgentId } from "./agent-scope-CgUHAtCo.js";
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
2
2
  import { M as getActivePluginRegistry, o as createSubsystemLogger } from "./entry.js";
3
3
  import { c as resolveAgentWorkspaceDir, l as resolveDefaultAgentId } from "./agent-scope-D-jRCY0d.js";
4
4
  import { i as loadConfig } from "./config-DHBLS1Hl.js";
5
- import { b as loadSymiPlugins } from "./subagent-registry-CbTbJKLs.js";
5
+ import { b as loadSymiPlugins } from "./subagent-registry-Jwg44JMf.js";
6
6
 
7
7
  //#region src/cli/plugin-registry.ts
8
8
  var plugin_registry_exports = /* @__PURE__ */ __exportAll({ ensurePluginRegistryLoaded: () => ensurePluginRegistryLoaded });
@@ -28,6 +28,12 @@ export declare function createZaiToolStreamWrapper(baseStreamFn: StreamFn | unde
28
28
  * Apply extra params (like temperature) to an agent's streamFn.
29
29
  * Also adds OpenRouter app attribution headers when using the OpenRouter provider.
30
30
  *
31
+ * @deprecated The 6-wrapper chain in this function has been superseded by
32
+ * `createModelAwareStreamFn` in `model-aware-stream.ts`. `attempt.ts`
33
+ * now calls `createModelAwareStreamFn` directly and uses the individual
34
+ * exported wrappers (Anthropic betas, Z.AI, OpenAI store) separately.
35
+ * This function is preserved for backward compatibility with existing tests.
36
+ *
31
37
  * @internal Exported for testing
32
38
  */
33
39
  export declare function applyExtraParamsToAgent(agent: {
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Stream Monitor — callback-based early exit and repetition detection.
3
+ *
4
+ * Adapted from agent-zero's streaming callback pattern. Instead of
5
+ * relying solely on model stop tokens (which may be ignored or lost),
6
+ * the monitor watches the streaming output in real-time and signals
7
+ * when to stop.
8
+ *
9
+ * Two detection modes:
10
+ * 1. Tool JSON detection — stops when a complete tool call JSON block
11
+ * is found in the accumulated stream (for models without native
12
+ * structured tool calls, like Gemma).
13
+ * 2. Repetition detection — stops when the same block of text appears
14
+ * twice, indicating a looping cascade.
15
+ *
16
+ * @module
17
+ */
18
+ import type { ModelProfile } from "../config/model-profiles.js";
19
+ export interface StreamMonitor {
20
+ /** Process a new text delta. Call on each streaming chunk. */
21
+ onChunk(delta: string): void;
22
+ /** Returns true if the monitor thinks generation should stop. */
23
+ shouldStop(): boolean;
24
+ /** Get the accumulated text so far. */
25
+ getAccumulated(): string;
26
+ /** Get the reason for stop signal (for logging). */
27
+ getStopReason(): string | undefined;
28
+ /** Reset state for a new generation turn. */
29
+ reset(): void;
30
+ }
31
+ export interface StreamMonitorOptions {
32
+ /** Enable tool JSON detection (for models without structured tool calls). */
33
+ detectToolJson?: boolean;
34
+ /** Enable repetition cascade detection. */
35
+ detectRepetition?: boolean;
36
+ /** Minimum block size (chars) for repetition detection. Default: 150. */
37
+ repetitionMinBlockSize?: number;
38
+ }
39
+ /**
40
+ * Create a stream monitor configured for the given model profile.
41
+ *
42
+ * - Claude (hasStructuredThinking: true): repetition detection only
43
+ * - Gemma/vLLM (hasStructuredThinking: false): tool JSON + repetition detection
44
+ */
45
+ export declare function createStreamMonitor(profile: ModelProfile, overrides?: StreamMonitorOptions): StreamMonitor;
46
+ /**
47
+ * Detect if the accumulated text contains a syntactically complete JSON
48
+ * object with tool_name and tool_args. Used for models that output tool
49
+ * calls as plain text JSON (not native structured tool calls).
50
+ */
51
+ declare function hasCompleteToolJson(text: string): boolean;
52
+ /**
53
+ * Detect if the accumulated text contains a repeated block, indicating
54
+ * a looping cascade. Returns true if a block of `minBlockSize` chars
55
+ * from the first half appears again in the second half.
56
+ */
57
+ declare function hasRepetition(text: string, minBlockSize: number): boolean;
58
+ export declare const __testing: {
59
+ hasCompleteToolJson: typeof hasCompleteToolJson;
60
+ hasRepetition: typeof hasRepetition;
61
+ };
62
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { a as buildGroupHistoryKey, n as DEFAULT_MAIN_KEY, r as buildAgentMainSessionKey, s as normalizeAgentId } from "./session-key-C_0eELjb.js";
2
2
  import { f as readWebSelfId, o as getWebAuthAgeMs, r as resolveWhatsAppAccount } from "./accounts-D9zGZU5t.js";
3
- import { E as enqueueSystemEvent, G as resolveMentionGating, W as shouldAckReactionForWhatsApp, X as buildHistoryContextFromEntries, Y as DEFAULT_GROUP_HISTORY_LIMIT, _ as resolveEnvelopeFormatOptions, c as computeBackoff, d as formatDurationPrecise, f as dispatchReplyWithBufferedBlockDispatcher, g as formatInboundEnvelope, h as resolveInboundDebounceMs, ht as createDedupeCache, l as sleepWithAbort, m as createInboundDebouncer, n as normalizeGroupActivation, nt as buildMentionRegexes, r as parseActivationCommand, rt as normalizeMentionText, t as getReplyFromConfig, tt as recordPendingHistoryEntryIfEnabled, u as buildPairingReply, v as hasControlCommand, y as shouldComputeCommandAuthorized } from "./reply-DTKTuCrn.js";
3
+ import { E as enqueueSystemEvent, G as resolveMentionGating, W as shouldAckReactionForWhatsApp, X as buildHistoryContextFromEntries, Y as DEFAULT_GROUP_HISTORY_LIMIT, _ as resolveEnvelopeFormatOptions, c as computeBackoff, d as formatDurationPrecise, f as dispatchReplyWithBufferedBlockDispatcher, g as formatInboundEnvelope, h as resolveInboundDebounceMs, ht as createDedupeCache, l as sleepWithAbort, m as createInboundDebouncer, n as normalizeGroupActivation, nt as buildMentionRegexes, r as parseActivationCommand, rt as normalizeMentionText, t as getReplyFromConfig, tt as recordPendingHistoryEntryIfEnabled, u as buildPairingReply, v as hasControlCommand, y as shouldComputeCommandAuthorized } from "./reply-CSgeVqcV.js";
4
4
  import { A as normalizeE164, B as toWhatsappJid, K as logVerbose, N as resolveJidToE164, O as isSelfChatMode, R as sleep, Y as shouldLogVerbose, k as jidToE164, s as normalizeChatChannelId, tt as getChildLogger, x as clamp } from "./registry--_pGht6S.js";
5
5
  import { n as loadConfig } from "./config-DDkdiUOR.js";
6
6
  import { i as defaultRuntime, t as createSubsystemLogger } from "./subsystem-Coz2AgU8.js";
@@ -1,6 +1,6 @@
1
1
  import { f as DEFAULT_ACCOUNT_ID, p as normalizeAccountId } from "./session-key-C_0eELjb.js";
2
2
  import { _ as createAccountListHelpers, i as resolveWhatsAppAuthDir, n as resolveDefaultWhatsAppAccountId, r as resolveWhatsAppAccount, t as listWhatsAppAccountIds } from "./accounts-D9zGZU5t.js";
3
- import { $ as clearHistoryEntriesIfEnabled, A as resolveDiscordUserAllowlist, B as logTypingFailure, C as stripMarkdown, Ct as unbindThreadBindingsBySessionKey, D as resolveSlackUserAllowlist, Dt as BLUEBUBBLES_ACTION_NAMES, Et as BLUEBUBBLES_ACTIONS, F as stringEnum, G as resolveMentionGating, H as removeAckReactionAfterReply, I as recordInboundSession, J as summarizeMapping, K as resolveMentionGatingWithBypass, L as resolveControlCommandGate, M as collectDiscordAuditChannelIds, N as formatDocsLink, O as resolveSlackChannelAllowlist, Ot as BLUEBUBBLES_GROUP_ACTIONS, P as optionalStringEnum, Q as clearHistoryEntries, R as logAckFailure, S as processLineMessage, St as listThreadBindingsBySessionKey, T as attachFooterText, Tt as resolveAllowlistMatchSimple, U as shouldAckReaction, V as createTypingCallbacks, W as shouldAckReactionForWhatsApp, Y as DEFAULT_GROUP_HISTORY_LIMIT, Z as buildPendingHistoryContextFromMap, _t as listDevicePairing, a as normalizeAccountId$1, at as isWSLEnv, bt as registerPluginHttpRoute, ct as DEFAULT_WEBHOOK_MAX_BODY_BYTES, dt as isRequestBodyLimitError, et as recordPendingHistoryEntry, ft as readJsonBodyWithLimit, gt as approveDevicePairing, ht as createDedupeCache, i as listLineAccountIds, it as isWSL2Sync, j as resolveDiscordChannelAllowlist, k as detectBinary, kt as CHANNEL_MESSAGE_ACTION_NAMES, lt as RequestBodyLimitError, mt as requestBodyErrorToText, o as resolveDefaultLineAccountId, ot as isWSLSync, pt as readRequestBodyWithLimit, q as mergeAllowlist, s as resolveLineAccount, st as DEFAULT_WEBHOOK_BODY_TIMEOUT_MS, tt as recordPendingHistoryEntryIfEnabled, ut as installRequestBodyLimitGuard, vt as rejectDevicePairing, w as createReceiptCard, wt as formatAllowlistMatchMeta, x as hasMarkdownToConvert, xt as autoBindSpawnedDiscordSubagent, yt as extractToolSend, z as logInboundDrop } from "./reply-DTKTuCrn.js";
3
+ import { $ as clearHistoryEntriesIfEnabled, A as resolveDiscordUserAllowlist, B as logTypingFailure, C as stripMarkdown, Ct as unbindThreadBindingsBySessionKey, D as resolveSlackUserAllowlist, Dt as BLUEBUBBLES_ACTION_NAMES, Et as BLUEBUBBLES_ACTIONS, F as stringEnum, G as resolveMentionGating, H as removeAckReactionAfterReply, I as recordInboundSession, J as summarizeMapping, K as resolveMentionGatingWithBypass, L as resolveControlCommandGate, M as collectDiscordAuditChannelIds, N as formatDocsLink, O as resolveSlackChannelAllowlist, Ot as BLUEBUBBLES_GROUP_ACTIONS, P as optionalStringEnum, Q as clearHistoryEntries, R as logAckFailure, S as processLineMessage, St as listThreadBindingsBySessionKey, T as attachFooterText, Tt as resolveAllowlistMatchSimple, U as shouldAckReaction, V as createTypingCallbacks, W as shouldAckReactionForWhatsApp, Y as DEFAULT_GROUP_HISTORY_LIMIT, Z as buildPendingHistoryContextFromMap, _t as listDevicePairing, a as normalizeAccountId$1, at as isWSLEnv, bt as registerPluginHttpRoute, ct as DEFAULT_WEBHOOK_MAX_BODY_BYTES, dt as isRequestBodyLimitError, et as recordPendingHistoryEntry, ft as readJsonBodyWithLimit, gt as approveDevicePairing, ht as createDedupeCache, i as listLineAccountIds, it as isWSL2Sync, j as resolveDiscordChannelAllowlist, k as detectBinary, kt as CHANNEL_MESSAGE_ACTION_NAMES, lt as RequestBodyLimitError, mt as requestBodyErrorToText, o as resolveDefaultLineAccountId, ot as isWSLSync, pt as readRequestBodyWithLimit, q as mergeAllowlist, s as resolveLineAccount, st as DEFAULT_WEBHOOK_BODY_TIMEOUT_MS, tt as recordPendingHistoryEntryIfEnabled, ut as installRequestBodyLimitGuard, vt as rejectDevicePairing, w as createReceiptCard, wt as formatAllowlistMatchMeta, x as hasMarkdownToConvert, xt as autoBindSpawnedDiscordSubagent, yt as extractToolSend, z as logInboundDrop } from "./reply-CSgeVqcV.js";
4
4
  import "./paths-DR2yt_mP.js";
5
5
  import "./github-copilot-token-D9X2phUj.js";
6
6
  import { D as resolveSlackAccount, E as resolveDefaultSlackAccountId, F as resolveDiscordAccount, M as listDiscordAccountIds, O as resolveSlackReplyToMode, P as resolveDefaultDiscordAccountId, S as resolveTelegramAccount, T as listSlackAccountIds, _ as normalizeWhatsAppTarget, a as listDiscordDirectoryPeersFromConfig, b as listTelegramAccountIds, c as listTelegramDirectoryGroupsFromConfig, d as listWhatsAppDirectoryPeersFromConfig, f as looksLikeSlackTargetId, g as isWhatsAppGroupJid, i as listDiscordDirectoryGroupsFromConfig, l as listTelegramDirectoryPeersFromConfig, o as listSlackDirectoryGroupsFromConfig, p as normalizeSlackMessagingTarget, s as listSlackDirectoryPeersFromConfig, u as listWhatsAppDirectoryGroupsFromConfig, w as listEnabledSlackAccounts, x as resolveDefaultTelegramAccountId } from "./plugins-BbAvhC25.js";
@@ -47,7 +47,7 @@ import "./paths-A0xdf3yk.js";
47
47
  import { h as onDiagnosticEvent, m as isDiagnosticsEnabled, p as emitDiagnosticEvent } from "./diagnostic-mFf4i4G9.js";
48
48
  import { n as extractOriginalFilename } from "./store-Do3t33-c.js";
49
49
  import { t as resolveWhatsAppOutboundTarget } from "./resolve-outbound-target-BkCUbYGV.js";
50
- import { r as resolveWhatsAppHeartbeatRecipients } from "./channel-web-uUypcT9Q.js";
50
+ import { r as resolveWhatsAppHeartbeatRecipients } from "./channel-web-ilY3YUmF.js";
51
51
  import "./image-BOYy0Ump.js";
52
52
  import "./pi-model-discovery-LbcEa65a.js";
53
53
  import "./api-key-rotation-CVBMpnPc.js";