@symerian/symi 2.6.1 → 2.6.2

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 (103) hide show
  1. package/dist/{agents-DQIz-_on.js → agents-qLMWAYwU.js} +4 -4
  2. package/dist/{agents.config-D8WPDf-m.js → agents.config-BfjAwFCr.js} +1 -1
  3. package/dist/{agents.config-CIJRaVWl.js → agents.config-BmdFH4J5.js} +1 -1
  4. package/dist/{auth-choice-DTDyJL1r.js → auth-choice-D1u_GPfQ.js} +1 -1
  5. package/dist/{auth-choice-BqFbNDuP.js → auth-choice-zFq3WRQ0.js} +1 -1
  6. package/dist/{banner-DYDCxnDL.js → banner-DpH44qlJ.js} +1 -1
  7. package/dist/build-info.json +3 -3
  8. package/dist/bundled/boot-md/handler.js +1 -1
  9. package/dist/bundled/session-memory/handler.js +1 -1
  10. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  11. package/dist/{channel-options-vBCJhJB7.js → channel-options-0iOfzVR3.js} +1 -1
  12. package/dist/{channel-options-CvHSm_Kx.js → channel-options-C8tKm8re.js} +1 -1
  13. package/dist/{channel-web-CM2LyWZW.js → channel-web-DYinYBz4.js} +1 -1
  14. package/dist/{channels-cli-DzOjNNFn.js → channels-cli-93tLT17t.js} +4 -4
  15. package/dist/{channels-cli-D5H3Wcho.js → channels-cli-C8HgSMTH.js} +4 -4
  16. package/dist/{cli-8hqssnRJ.js → cli-BYJyRW2M.js} +1 -1
  17. package/dist/{cli-DNZwCDRe.js → cli-DapZXGSB.js} +1 -1
  18. package/dist/{command-registry-CHtN2HeK.js → command-registry-9EhYc6da.js} +9 -9
  19. package/dist/{completion-cli-Cov6N3BO.js → completion-cli-BFZv3K5D.js} +2 -2
  20. package/dist/{completion-cli-C8y_J5KC.js → completion-cli-CCeQlMlC.js} +1 -1
  21. package/dist/{config-cli-B2REEd2l.js → config-cli-DbWMIBUz.js} +1 -1
  22. package/dist/{config-cli-BwO0xAbV.js → config-cli-Dv2mtIeM.js} +1 -1
  23. package/dist/{configure-BWSYSi2-.js → configure-B8zV6Hxj.js} +3 -3
  24. package/dist/{configure-C6yNe33U.js → configure-CVQf2UJE.js} +3 -3
  25. package/dist/{doctor-completion-BKKzstt6.js → doctor-completion-BunqvoqZ.js} +1 -1
  26. package/dist/{doctor-completion-D7CDLFLg.js → doctor-completion-CLeX1kaN.js} +1 -1
  27. package/dist/entry.js +1 -1
  28. package/dist/extensionAPI.js +1 -1
  29. package/dist/{gateway-cli-Datohp3m.js → gateway-cli-Co-tp-WC.js} +9 -9
  30. package/dist/{gateway-cli-BhFM4Bkm.js → gateway-cli-DMey_29a.js} +9 -9
  31. package/dist/{glass-ui-ws-D9yvYULL.js → glass-ui-ws-C4O227UO.js} +7 -7
  32. package/dist/{glass-ui-ws-BzqfD_wX.js → glass-ui-ws-CKb1jTZR.js} +7 -7
  33. package/dist/{health-BjwDRAdd.js → health-CDGOsNeD.js} +1 -1
  34. package/dist/{health-C5XJPwpt.js → health-CM1asUG8.js} +1 -1
  35. package/dist/{hooks-cli-U12oVyLH.js → hooks-cli-DFKB3Z6X.js} +2 -2
  36. package/dist/{hooks-cli-CafMq9Vr.js → hooks-cli-Tx0TzSju.js} +2 -2
  37. package/dist/index.js +6 -6
  38. package/dist/llm-slug-generator.js +1 -1
  39. package/dist/{models-Bo4iHJy-.js → models-CiqHYwje.js} +2 -2
  40. package/dist/{models-cli-6aNi3eN9.js → models-cli-B-b-gBKG.js} +2 -2
  41. package/dist/{models-cli-B5vh-XK8.js → models-cli-B4ATSsNS.js} +3 -3
  42. package/dist/{onboard-f-GJ26Ix.js → onboard-B_ECX48L.js} +2 -2
  43. package/dist/{onboard-Bm-pmstf.js → onboard-DcnGZKZX.js} +2 -2
  44. package/dist/{onboard-channels-CUl5U8kV.js → onboard-channels-FFQPpuEN.js} +1 -1
  45. package/dist/{onboard-channels-BRd1cXye.js → onboard-channels-pfSGhg_C.js} +1 -1
  46. package/dist/{onboarding-DIVKvosg.js → onboarding-BU14cspo.js} +3 -3
  47. package/dist/{onboarding-CvBDWlBJ.js → onboarding-jhZxQcZ3.js} +3 -3
  48. package/dist/{onboarding.finalize-DJX6mSLa.js → onboarding.finalize-B8oOMfHc.js} +6 -6
  49. package/dist/{onboarding.finalize-WSac-JKd.js → onboarding.finalize-ByZT4dF5.js} +5 -5
  50. package/dist/{pi-embedded-BmbbC1Sb.js → pi-embedded-BY9AnmoP.js} +83 -13
  51. package/dist/{plugin-registry-2zUJMasm.js → plugin-registry-CNf1_8hj.js} +1 -1
  52. package/dist/{plugin-registry-5yf-hu_W.js → plugin-registry-DXWJkJX6.js} +1 -1
  53. package/dist/plugin-sdk/agents/pi-tools.validate-wrapper.d.ts +6 -6
  54. package/dist/plugin-sdk/{channel-web-DPyyTvFo.js → channel-web-DZQQ0mzN.js} +1 -1
  55. package/dist/plugin-sdk/index.js +2 -2
  56. package/dist/plugin-sdk/{reply-QAcAd9ev.js → reply-DvZeyOVA.js} +83 -13
  57. package/dist/plugin-sdk/{web-DaTTL9M0.js → web-BCsJFuQu.js} +2 -2
  58. package/dist/{plugins-cli-D4eRESV2.js → plugins-cli-BiedlZMy.js} +2 -2
  59. package/dist/{plugins-cli-DksVl33N.js → plugins-cli-C9TYM40P.js} +2 -2
  60. package/dist/{program-BjORH7Cc.js → program-bnWda72r.js} +7 -7
  61. package/dist/{program-context-DaNGrTOm.js → program-context-CY1jWc5A.js} +17 -17
  62. package/dist/{prompt-select-styled-YOj4xigd.js → prompt-select-styled-BEnZY8wI.js} +4 -4
  63. package/dist/{prompt-select-styled-QaS2zul_.js → prompt-select-styled-B_lFTtqp.js} +4 -4
  64. package/dist/{provider-auth-helpers-DCEbm2hz.js → provider-auth-helpers-DApJuzBd.js} +1 -1
  65. package/dist/{provider-auth-helpers-BAGT_RXV.js → provider-auth-helpers-DcNKxc7D.js} +1 -1
  66. package/dist/{push-apns-Bek3ANJa.js → push-apns-CKKHlj6j.js} +1 -1
  67. package/dist/{push-apns-BECodU1i.js → push-apns-DA7UMNQH.js} +1 -1
  68. package/dist/{register.agent-B34lxx7F.js → register.agent-8lxVlmzQ.js} +5 -5
  69. package/dist/{register.agent-DJHQo-Iq.js → register.agent-ulu0VmOg.js} +6 -6
  70. package/dist/{register.configure-BdhhIzb0.js → register.configure-45--Sly1.js} +6 -6
  71. package/dist/{register.configure-DC_-t5kj.js → register.configure-rq0h5r3X.js} +6 -6
  72. package/dist/{register.maintenance-CITur3O_.js → register.maintenance-CXbxRtWI.js} +8 -8
  73. package/dist/{register.maintenance-cs-A4kHF.js → register.maintenance-DyEJx7NY.js} +7 -7
  74. package/dist/{register.message--RhtnEYn.js → register.message-C7Yh1uky.js} +2 -2
  75. package/dist/{register.message-PIaHm2pZ.js → register.message-CiN_pt6K.js} +2 -2
  76. package/dist/{register.onboard-CTJQoDcK.js → register.onboard-BWaRkbei.js} +4 -4
  77. package/dist/{register.onboard-DucZgrF7.js → register.onboard-e_2hc2Rm.js} +4 -4
  78. package/dist/{register.setup-2ZiUN7ui.js → register.setup-BIIFHtF7.js} +4 -4
  79. package/dist/{register.setup-DD4Rgkt9.js → register.setup-zwh90Vn-.js} +4 -4
  80. package/dist/{register.status-health-sessions-BqD7L8XL.js → register.status-health-sessions-D6t5maEr.js} +3 -3
  81. package/dist/{register.status-health-sessions-sLgA92t7.js → register.status-health-sessions-O-sVAFHE.js} +3 -3
  82. package/dist/{register.subclis-B2dGWFur.js → register.subclis-DOiZocR6.js} +9 -9
  83. package/dist/{reply-DYnTEYoa.js → reply-05js8eGB.js} +83 -13
  84. package/dist/{run-main-DWmu2b6D.js → run-main-u-Eyc8Wm.js} +14 -14
  85. package/dist/{server-methods-C8EWZt2g.js → server-methods-Bvl1xubo.js} +7 -7
  86. package/dist/{server-methods-vDGoM3xL.js → server-methods-Dds-iEoY.js} +7 -7
  87. package/dist/{server-node-events-CKi12bol.js → server-node-events-Qp-gJMET.js} +2 -2
  88. package/dist/{server-node-events-DFwGbkcO.js → server-node-events-qGqpsPxm.js} +2 -2
  89. package/dist/{status--iNVOTMO.js → status-BATOXGRi.js} +2 -2
  90. package/dist/{status-B1_iHrOg.js → status-BRSo-LY3.js} +2 -2
  91. package/dist/{status-DiX0DAtH.js → status-BqQ9mm64.js} +1 -1
  92. package/dist/{status-BQcdARV4.js → status-CfYa1Q9K.js} +1 -1
  93. package/dist/{subagent-registry-CXrOOgPW.js → subagent-registry-lbDgDwLy.js} +83 -13
  94. package/dist/{unified-runner-CulJZMxc.js → unified-runner-B4ICXRlg.js} +83 -13
  95. package/dist/{update-cli-D1pLX3eo.js → update-cli-BOaP4XyQ.js} +8 -8
  96. package/dist/{update-cli-560gprSp.js → update-cli-R8-SSkbS.js} +7 -7
  97. package/dist/{update-runner-BQxFFCGc.js → update-runner-B8UmqtLI.js} +1 -1
  98. package/dist/{update-runner-CLKHrONW.js → update-runner-CWJ4pC1b.js} +1 -1
  99. package/dist/{web-Dr5cOn-1.js → web-BWybtnEa.js} +2 -2
  100. package/dist/{web-hHX9a9YO.js → web-CQH9fSkH.js} +1 -1
  101. package/dist/{web-Bqrgp43v.js → web-CSrDbJJ7.js} +1 -1
  102. package/dist/{web-D4qJ9XKP.js → web-DBFW0ejP.js} +1 -1
  103. package/package.json +1 -1
@@ -12,7 +12,7 @@ import { f as GATEWAY_CLIENT_CAPS, g as hasGatewayClientCap, i as isGatewayMessa
12
12
  import { c as writeJsonAtomic, o as createAsyncLock, s as readJsonFile } from "./pairing-token-Byh6drgn.js";
13
13
  import { s as pickPrimaryLanIPv4 } from "./net-DZ5Ayk-W.js";
14
14
  import { i as normalizeInputProvenance } from "./input-provenance-D0lNkCf6.js";
15
- import { $n as resolveTtsAutoMode, B as dispatchInboundMessage, C as resolveAgentDeliveryPlan, Cn as enqueueSystemEvent, Cr as onAgentEvent, D as createOutboundSendDeps, Dt as normalizeCronJobPatch, Et as normalizeCronJobCreate, G as BARE_SESSION_RESET_PROMPT, Gn as stopSubagentsForRequester, Gt as persistBrowserProxyFiles, In as resolveAgentTimeoutMs, Jn as resolveUserTimezone, Qn as resolveTtsApiKey, Sn as parseVerboseOverride, V as createReplyDispatcher, Vn as formatZonedTimestamp, Wn as isAbortTrigger, Wt as applyBrowserProxyPaths, Xn as isTtsEnabled, Y as abortEmbeddedPiRun, Yn as getTtsProvider, Z as waitForEmbeddedPiRunEnd, Zn as isTtsProviderConfigured, Zt as scheduleGatewaySigusr1Restart, a as listSubagentRunsForRequester, ar as textToSpeech, bn as applyModelOverrideToSessionEntry, c as clearSessionQueues, ct as resolveOutboundSessionRoute, dt as resolveOutboundTarget, en as unbindThreadBindingsBySessionKey, er as resolveTtsConfig, hn as resolveSendPolicy, i as listDescendantRunsForRequester, ir as setTtsProvider, m as loadSymiPlugins, mn as normalizeSendPolicy, nr as resolveTtsProviderOrder, or as OPENAI_TTS_MODELS, rn as loadProviderUsageSummary, rr as setTtsEnabled, sr as OPENAI_TTS_VOICES, st as ensureOutboundSessionEntry, tn as normalizeGroupActivation, tr as resolveTtsPrefsPath, w as resolveAgentOutboundTarget, wn as isSystemEventContextChanged, wr as registerAgentRunContext, wt as writeRestartSentinel, x as agentCommand, xn as applyVerboseOverride, yt as formatDoctorNonInteractiveHint } from "./subagent-registry-CXrOOgPW.js";
15
+ import { $n as resolveTtsAutoMode, B as dispatchInboundMessage, C as resolveAgentDeliveryPlan, Cn as enqueueSystemEvent, Cr as onAgentEvent, D as createOutboundSendDeps, Dt as normalizeCronJobPatch, Et as normalizeCronJobCreate, G as BARE_SESSION_RESET_PROMPT, Gn as stopSubagentsForRequester, Gt as persistBrowserProxyFiles, In as resolveAgentTimeoutMs, Jn as resolveUserTimezone, Qn as resolveTtsApiKey, Sn as parseVerboseOverride, V as createReplyDispatcher, Vn as formatZonedTimestamp, Wn as isAbortTrigger, Wt as applyBrowserProxyPaths, Xn as isTtsEnabled, Y as abortEmbeddedPiRun, Yn as getTtsProvider, Z as waitForEmbeddedPiRunEnd, Zn as isTtsProviderConfigured, Zt as scheduleGatewaySigusr1Restart, a as listSubagentRunsForRequester, ar as textToSpeech, bn as applyModelOverrideToSessionEntry, c as clearSessionQueues, ct as resolveOutboundSessionRoute, dt as resolveOutboundTarget, en as unbindThreadBindingsBySessionKey, er as resolveTtsConfig, hn as resolveSendPolicy, i as listDescendantRunsForRequester, ir as setTtsProvider, m as loadSymiPlugins, mn as normalizeSendPolicy, nr as resolveTtsProviderOrder, or as OPENAI_TTS_MODELS, rn as loadProviderUsageSummary, rr as setTtsEnabled, sr as OPENAI_TTS_VOICES, st as ensureOutboundSessionEntry, tn as normalizeGroupActivation, tr as resolveTtsPrefsPath, w as resolveAgentOutboundTarget, wn as isSystemEventContextChanged, wr as registerAgentRunContext, wt as writeRestartSentinel, x as agentCommand, xn as applyVerboseOverride, yt as formatDoctorNonInteractiveHint } from "./subagent-registry-lbDgDwLy.js";
16
16
  import { F as resolveMainSessionKey, I as resolveMainSessionKeyFromConfig, J as normalizeSessionDeliveryFields, N as resolveAgentMainSessionKey, P as resolveExplicitAgentSessionKey, R as snapshotSessionOrigin, S as stripEnvelopeFromMessages, _ as capArrayByJsonBytes, d as updateSessionStore, g as archiveSessionTranscripts, h as archiveFileOnDisk, o as loadSessionStore, t as extractDeliveryInfo, v as readSessionMessages, x as resolveSessionTranscriptCandidates, y as readSessionPreviewItemsFromTranscript } from "./sessions-CJXnZVjR.js";
17
17
  import { n as listChannelPlugins, r as normalizeChannelId, t as getChannelPlugin } from "./plugins-CwSlLxM8.js";
18
18
  import { n as createBrowserRouteDispatcher } from "./with-timeout-Di0nddLY.js";
@@ -37,14 +37,14 @@ import { t as WizardCancelledError } from "./prompts-m1IJwIAx.js";
37
37
  import { t as resolveChannelDefaultAccountId } from "./helpers-cLP5YLeQ.js";
38
38
  import { t as buildChannelAccountSnapshot } from "./status-BUedPCLb.js";
39
39
  import { o as isNodeCommandAllowed, s as resolveNodeCommandAllowlist } from "./audit-Byo5jCLN.js";
40
- import { r as getStatusSummary } from "./status-B1_iHrOg.js";
41
- import { c as setHeartbeatsEnabled } from "./health-C5XJPwpt.js";
40
+ import { r as getStatusSummary } from "./status-BRSo-LY3.js";
41
+ import { c as setHeartbeatsEnabled } from "./health-CM1asUG8.js";
42
42
  import { m as normalizeUpdateChannel } from "./update-check-ZdimP1aU.js";
43
- import { a as sendApnsAlert, c as parseMessageWithAttachments, i as resolveApnsAuthConfigFromEnv, l as formatForLog, n as normalizeApnsEnvironment, o as sendApnsBackgroundWake, s as normalizeRpcAttachmentsToChatAttachments, t as loadApnsRegistration } from "./push-apns-Bek3ANJa.js";
44
- import { a as pruneAgentConfig, i as loadAgentIdentity, r as findAgentEntryIndex, t as applyAgentConfig } from "./agents.config-D8WPDf-m.js";
43
+ import { a as sendApnsAlert, c as parseMessageWithAttachments, i as resolveApnsAuthConfigFromEnv, l as formatForLog, n as normalizeApnsEnvironment, o as sendApnsBackgroundWake, s as normalizeRpcAttachmentsToChatAttachments, t as loadApnsRegistration } from "./push-apns-CKKHlj6j.js";
44
+ import { a as pruneAgentConfig, i as loadAgentIdentity, r as findAgentEntryIndex, t as applyAgentConfig } from "./agents.config-BfjAwFCr.js";
45
45
  import { t as resolveSystemRunCommand } from "./system-run-command-ByVa3txU.js";
46
46
  import { t as installSkill } from "./skills-install-1ZdwGTnh.js";
47
- import { t as runGatewayUpdate } from "./update-runner-BQxFFCGc.js";
47
+ import { t as runGatewayUpdate } from "./update-runner-B8UmqtLI.js";
48
48
  import { spawnSync } from "node:child_process";
49
49
  import * as os$1 from "node:os";
50
50
  import os from "node:os";
@@ -6851,7 +6851,7 @@ const nodeHandlers = {
6851
6851
  const p = params;
6852
6852
  const payloadJSON = typeof p.payloadJSON === "string" ? p.payloadJSON : p.payload !== void 0 ? JSON.stringify(p.payload) : null;
6853
6853
  await respondUnavailableOnThrow(respond, async () => {
6854
- const { handleNodeEvent } = await import("./server-node-events-CKi12bol.js");
6854
+ const { handleNodeEvent } = await import("./server-node-events-Qp-gJMET.js");
6855
6855
  const nodeId = client?.connect?.device?.id ?? client?.connect?.client?.id ?? "node";
6856
6856
  await handleNodeEvent({
6857
6857
  deps: context.deps,
@@ -1,7 +1,7 @@
1
1
  import { g as resolveStateDir, t as CONFIG_PATH } from "./paths-Cqn-zk3M.js";
2
2
  import { D as isPlainObject, U as getResolvedLoggerSettings, r as clamp, y as resolveUserPath } from "./utils-B-0b9bGM.js";
3
3
  import { a as normalizeElevatedLevel, c as normalizeUsageDisplay, d as supportsXHighThinking, n as formatXHighModelHint, o as normalizeReasoningLevel, s as normalizeThinkLevel, t as formatThinkingLevels } from "./thinking-EAliFiVK.js";
4
- import { $n as OPENAI_TTS_MODELS, Bn as registerAgentRunContext, Bt as abortEmbeddedPiRun, C as ensureOutboundSessionEntry, Et as agentCommand, Ft as normalizeSendPolicy, G as normalizeCronJobPatch, Gn as resolveTtsApiKey, H as writeRestartSentinel, Hn as getTtsProvider, Ht as waitForEmbeddedPiRunEnd, It as resolveSendPolicy, Jn as resolveTtsPrefsPath, Kn as resolveTtsAutoMode, L as formatDoctorNonInteractiveHint, Mn as listSubagentRunsForRequester, Mt as resolveOutboundTarget, N as scheduleGatewaySigusr1Restart, Ot as resolveAgentDeliveryPlan, Pr as resolveAgentTimeoutMs, Qn as textToSpeech, Rt as createOutboundSendDeps, Sr as isSystemEventContextChanged, Tn as stopSubagentsForRequester, Un as isTtsEnabled, Vn as resolveUserTimezone, W as normalizeCronJobCreate, Wn as isTtsProviderConfigured, Xn as setTtsEnabled, Yn as resolveTtsProviderOrder, Zn as setTtsProvider, _ as loadCombinedSessionStoreForGateway, at as persistBrowserProxyFiles, b as resolveGatewaySessionStoreTarget, br as parseVerboseOverride, c as clearSessionQueues, er as OPENAI_TTS_VOICES, ft as loadSymiPlugins, g as listSessionsFromStore, gt as loadProviderUsageSummary, h as listAgentsForGateway, in as unbindThreadBindingsBySessionKey, it as applyBrowserProxyPaths, jn as listDescendantRunsForRequester, kt as resolveAgentOutboundTarget, mn as createReplyDispatcher, mt as normalizeGroupActivation, n as BARE_SESSION_RESET_PROMPT, p as canonicalizeSpawnedByForAgent, pn as dispatchInboundMessage, qn as resolveTtsConfig, v as loadSessionEntry, vr as applyModelOverrideToSessionEntry, w as resolveOutboundSessionRoute, wn as isAbortTrigger, x as resolveSessionModelRef, xn as formatZonedTimestamp, xr as enqueueSystemEvent, y as pruneLegacyStoreKeys, yr as applyVerboseOverride, zn as onAgentEvent } from "./reply-DYnTEYoa.js";
4
+ import { $n as OPENAI_TTS_MODELS, Bn as registerAgentRunContext, Bt as abortEmbeddedPiRun, C as ensureOutboundSessionEntry, Et as agentCommand, Ft as normalizeSendPolicy, G as normalizeCronJobPatch, Gn as resolveTtsApiKey, H as writeRestartSentinel, Hn as getTtsProvider, Ht as waitForEmbeddedPiRunEnd, It as resolveSendPolicy, Jn as resolveTtsPrefsPath, Kn as resolveTtsAutoMode, L as formatDoctorNonInteractiveHint, Mn as listSubagentRunsForRequester, Mt as resolveOutboundTarget, N as scheduleGatewaySigusr1Restart, Ot as resolveAgentDeliveryPlan, Pr as resolveAgentTimeoutMs, Qn as textToSpeech, Rt as createOutboundSendDeps, Sr as isSystemEventContextChanged, Tn as stopSubagentsForRequester, Un as isTtsEnabled, Vn as resolveUserTimezone, W as normalizeCronJobCreate, Wn as isTtsProviderConfigured, Xn as setTtsEnabled, Yn as resolveTtsProviderOrder, Zn as setTtsProvider, _ as loadCombinedSessionStoreForGateway, at as persistBrowserProxyFiles, b as resolveGatewaySessionStoreTarget, br as parseVerboseOverride, c as clearSessionQueues, er as OPENAI_TTS_VOICES, ft as loadSymiPlugins, g as listSessionsFromStore, gt as loadProviderUsageSummary, h as listAgentsForGateway, in as unbindThreadBindingsBySessionKey, it as applyBrowserProxyPaths, jn as listDescendantRunsForRequester, kt as resolveAgentOutboundTarget, mn as createReplyDispatcher, mt as normalizeGroupActivation, n as BARE_SESSION_RESET_PROMPT, p as canonicalizeSpawnedByForAgent, pn as dispatchInboundMessage, qn as resolveTtsConfig, v as loadSessionEntry, vr as applyModelOverrideToSessionEntry, w as resolveOutboundSessionRoute, wn as isAbortTrigger, x as resolveSessionModelRef, xn as formatZonedTimestamp, xr as enqueueSystemEvent, y as pruneLegacyStoreKeys, yr as applyVerboseOverride, zn as onAgentEvent } from "./reply-05js8eGB.js";
5
5
  import { S as parseAgentSessionKey, l as resolveAgentIdFromSessionKey, m as DEFAULT_ACCOUNT_ID, o as classifySessionKeyShape, s as normalizeAgentId, t as DEFAULT_AGENT_ID, x as isSubagentSessionKey } from "./session-key-DCt45XZa.js";
6
6
  import { t as resolveSymiPackageRoot } from "./symi-root-CrGJbkzf.js";
7
7
  import { C as createInternalHookEvent, T as triggerInternalHook, d as getActivePluginRegistry, r as DEFAULT_CHAT_CHANNEL, t as CHANNEL_IDS } from "./registry-Cja8eT7G.js";
@@ -39,14 +39,14 @@ import { t as WizardCancelledError } from "./prompts-Xu2Sveka.js";
39
39
  import { t as resolveChannelDefaultAccountId } from "./helpers-BcGbMZD1.js";
40
40
  import { t as buildChannelAccountSnapshot } from "./status-BrV-afZE.js";
41
41
  import { o as isNodeCommandAllowed, s as resolveNodeCommandAllowlist } from "./audit-CrITRV6w.js";
42
- import { n as getStatusSummary } from "./status--iNVOTMO.js";
43
- import { s as setHeartbeatsEnabled } from "./health-BjwDRAdd.js";
42
+ import { n as getStatusSummary } from "./status-BATOXGRi.js";
43
+ import { s as setHeartbeatsEnabled } from "./health-CDGOsNeD.js";
44
44
  import { m as normalizeUpdateChannel } from "./update-check-CtckACbb.js";
45
- import { a as sendApnsAlert, c as parseMessageWithAttachments, i as resolveApnsAuthConfigFromEnv, l as formatForLog, n as normalizeApnsEnvironment, o as sendApnsBackgroundWake, s as normalizeRpcAttachmentsToChatAttachments, t as loadApnsRegistration } from "./push-apns-BECodU1i.js";
46
- import { a as pruneAgentConfig, i as loadAgentIdentity, r as findAgentEntryIndex, t as applyAgentConfig } from "./agents.config-CIJRaVWl.js";
45
+ import { a as sendApnsAlert, c as parseMessageWithAttachments, i as resolveApnsAuthConfigFromEnv, l as formatForLog, n as normalizeApnsEnvironment, o as sendApnsBackgroundWake, s as normalizeRpcAttachmentsToChatAttachments, t as loadApnsRegistration } from "./push-apns-DA7UMNQH.js";
46
+ import { a as pruneAgentConfig, i as loadAgentIdentity, r as findAgentEntryIndex, t as applyAgentConfig } from "./agents.config-BmdFH4J5.js";
47
47
  import { t as resolveSystemRunCommand } from "./system-run-command-ByVa3txU.js";
48
48
  import { t as installSkill } from "./skills-install-D67isO1L.js";
49
- import { t as runGatewayUpdate } from "./update-runner-CLKHrONW.js";
49
+ import { t as runGatewayUpdate } from "./update-runner-CWJ4pC1b.js";
50
50
  import * as fs$2 from "node:fs";
51
51
  import fs from "node:fs";
52
52
  import * as os$1 from "node:os";
@@ -6853,7 +6853,7 @@ const nodeHandlers = {
6853
6853
  const p = params;
6854
6854
  const payloadJSON = typeof p.payloadJSON === "string" ? p.payloadJSON : p.payload !== void 0 ? JSON.stringify(p.payload) : null;
6855
6855
  await respondUnavailableOnThrow(respond, async () => {
6856
- const { handleNodeEvent } = await import("./server-node-events-DFwGbkcO.js");
6856
+ const { handleNodeEvent } = await import("./server-node-events-qGqpsPxm.js");
6857
6857
  const nodeId = client?.connect?.device?.id ?? client?.connect?.client?.id ?? "node";
6858
6858
  await handleNodeEvent({
6859
6859
  deps: context.deps,
@@ -14,7 +14,7 @@ import "./client-DMBZpU6X.js";
14
14
  import "./call-BcE47FtD.js";
15
15
  import "./message-channel-C9dERklz.js";
16
16
  import "./pairing-token-Byh6drgn.js";
17
- import { Cn as enqueueSystemEvent, T as createOutboundSendDeps, dn as requestHeartbeatNow, dt as resolveOutboundTarget, x as agentCommand } from "./subagent-registry-CXrOOgPW.js";
17
+ import { Cn as enqueueSystemEvent, T as createOutboundSendDeps, dn as requestHeartbeatNow, dt as resolveOutboundTarget, x as agentCommand } from "./subagent-registry-lbDgDwLy.js";
18
18
  import { d as updateSessionStore } from "./sessions-CJXnZVjR.js";
19
19
  import "./tokens-Csntmwwn.js";
20
20
  import { r as normalizeChannelId } from "./plugins-CwSlLxM8.js";
@@ -98,7 +98,7 @@ import "./onboard-helpers-_pit1NZW.js";
98
98
  import "./prompt-style-DwCXob2h.js";
99
99
  import "./pairing-labels-D1HDboV2.js";
100
100
  import "./pi-tools.policy-De00gPXt.js";
101
- import { c as parseMessageWithAttachments, l as formatForLog, r as registerApnsToken, s as normalizeRpcAttachmentsToChatAttachments } from "./push-apns-Bek3ANJa.js";
101
+ import { c as parseMessageWithAttachments, l as formatForLog, r as registerApnsToken, s as normalizeRpcAttachmentsToChatAttachments } from "./push-apns-CKKHlj6j.js";
102
102
  import { randomUUID } from "node:crypto";
103
103
 
104
104
  //#region src/gateway/server-node-events.ts
@@ -1,7 +1,7 @@
1
1
  import "./paths-Cqn-zk3M.js";
2
2
  import "./utils-B-0b9bGM.js";
3
3
  import "./thinking-EAliFiVK.js";
4
- import { Et as agentCommand, Mt as resolveOutboundTarget, Pt as createOutboundSendDeps, b as resolveGatewaySessionStoreTarget, st as requestHeartbeatNow, v as loadSessionEntry, xr as enqueueSystemEvent, y as pruneLegacyStoreKeys } from "./reply-DYnTEYoa.js";
4
+ import { Et as agentCommand, Mt as resolveOutboundTarget, Pt as createOutboundSendDeps, b as resolveGatewaySessionStoreTarget, st as requestHeartbeatNow, v as loadSessionEntry, xr as enqueueSystemEvent, y as pruneLegacyStoreKeys } from "./reply-05js8eGB.js";
5
5
  import { c as normalizeMainKey } from "./session-key-DCt45XZa.js";
6
6
  import "./registry-Cja8eT7G.js";
7
7
  import { f as defaultRuntime } from "./subsystem-D9vIQve0.js";
@@ -102,7 +102,7 @@ import "./pi-tools.policy-CIDBbw6x.js";
102
102
  import "./control-service-Bz7rxLWq.js";
103
103
  import "./stagger-BUClb97_.js";
104
104
  import "./channel-selection-DuWs0Aak.js";
105
- import { c as parseMessageWithAttachments, l as formatForLog, r as registerApnsToken, s as normalizeRpcAttachmentsToChatAttachments } from "./push-apns-BECodU1i.js";
105
+ import { c as parseMessageWithAttachments, l as formatForLog, r as registerApnsToken, s as normalizeRpcAttachmentsToChatAttachments } from "./push-apns-DA7UMNQH.js";
106
106
  import { randomUUID } from "node:crypto";
107
107
 
108
108
  //#region src/gateway/server-node-events.ts
@@ -1,6 +1,6 @@
1
1
  import { u as resolveGatewayPort } from "./paths-Cqn-zk3M.js";
2
2
  import { B as theme, k as info, z as isRich } from "./utils-B-0b9bGM.js";
3
- import { B as summarizeRestartSentinel, Jt as sha256HexPrefix, _t as formatUsageReportLines, a as buildChannelSummary, gt as loadProviderUsageSummary, h as listAgentsForGateway, m as classifySessionKey, o as buildChannelAccountSnapshot, pr as lookupContextTokens, s as formatChannelAllowFrom, wr as peekSystemEvents, x as resolveSessionModelRef, z as readRestartSentinel } from "./reply-DYnTEYoa.js";
3
+ import { B as summarizeRestartSentinel, Jt as sha256HexPrefix, _t as formatUsageReportLines, a as buildChannelSummary, gt as loadProviderUsageSummary, h as listAgentsForGateway, m as classifySessionKey, o as buildChannelAccountSnapshot, pr as lookupContextTokens, s as formatChannelAllowFrom, wr as peekSystemEvents, x as resolveSessionModelRef, z as readRestartSentinel } from "./reply-05js8eGB.js";
4
4
  import { S as parseAgentSessionKey } from "./session-key-DCt45XZa.js";
5
5
  import { t as resolveSymiPackageRoot } from "./symi-root-CrGJbkzf.js";
6
6
  import { n as runExec } from "./exec-CWkblSrI.js";
@@ -28,7 +28,7 @@ import { t as formatRuntimeStatusWithDetails } from "./runtime-status-CR9445g5.j
28
28
  import { t as readLastGatewayErrorLine } from "./diagnostics-BAMlsVVX.js";
29
29
  import { t as renderTable } from "./table-BTgkRafz.js";
30
30
  import { a as resolveGatewayProbeAuth$1, c as probeGateway, t as runSecurityAudit } from "./audit-CrITRV6w.js";
31
- import { a as resolveHeartbeatSummaryForAgent, t as formatHealthChannelLines } from "./health-BjwDRAdd.js";
31
+ import { a as resolveHeartbeatSummaryForAgent, t as formatHealthChannelLines } from "./health-CDGOsNeD.js";
32
32
  import { g as resolveUpdateChannelDisplay, i as formatGitInstallLabel, m as normalizeUpdateChannel, t as checkUpdateStatus } from "./update-check-CtckACbb.js";
33
33
  import { t as resolveNodeService } from "./node-service-Cxz4e-Qd.js";
34
34
  import { n as redactSecrets, t as formatGatewayAuthUsed } from "./format-yQZNwAF2.js";
@@ -9,7 +9,7 @@ import { c as resolveAgentWorkspaceDir } from "./agent-scope-D-jRCY0d.js";
9
9
  import { t as buildWorkspaceSkillStatus } from "./skills-status-DKXJ-tbi.js";
10
10
  import { H as VERSION, i as loadConfig, o as readConfigFileSnapshot } from "./config-DHBLS1Hl.js";
11
11
  import { n as callGateway, t as buildGatewayConnectionDetails } from "./call-BcE47FtD.js";
12
- import { En as peekSystemEvents, St as summarizeRestartSentinel, cn as buildChannelAccountSnapshot, in as formatUsageReportLines, ln as formatChannelAllowFrom, nt as sha256HexPrefix, rn as loadProviderUsageSummary, sn as buildChannelSummary, xt as readRestartSentinel } from "./subagent-registry-CXrOOgPW.js";
12
+ import { En as peekSystemEvents, St as summarizeRestartSentinel, cn as buildChannelAccountSnapshot, in as formatUsageReportLines, ln as formatChannelAllowFrom, nt as sha256HexPrefix, rn as loadProviderUsageSummary, sn as buildChannelSummary, xt as readRestartSentinel } from "./subagent-registry-lbDgDwLy.js";
13
13
  import { F as resolveMainSessionKey, j as resolveFreshSessionTotalTokens, o as loadSessionStore } from "./sessions-CJXnZVjR.js";
14
14
  import { n as listChannelPlugins } from "./plugins-CwSlLxM8.js";
15
15
  import { o as getTailnetHostname, s as readTailscaleStatusJson } from "./tailscale-CbbvYNVw.js";
@@ -29,7 +29,7 @@ import { t as formatRuntimeStatusWithDetails } from "./runtime-status-hFVEC3wO.j
29
29
  import { t as readLastGatewayErrorLine } from "./diagnostics-CS1ov_hH.js";
30
30
  import { t as renderTable } from "./table-D01d2GuY.js";
31
31
  import { a as resolveGatewayProbeAuth$1, c as probeGateway, t as runSecurityAudit } from "./audit-Byo5jCLN.js";
32
- import { o as resolveHeartbeatSummaryForAgent, t as formatHealthChannelLines } from "./health-C5XJPwpt.js";
32
+ import { o as resolveHeartbeatSummaryForAgent, t as formatHealthChannelLines } from "./health-CM1asUG8.js";
33
33
  import { g as resolveUpdateChannelDisplay, i as formatGitInstallLabel, m as normalizeUpdateChannel, t as checkUpdateStatus } from "./update-check-ZdimP1aU.js";
34
34
  import { t as resolveNodeService } from "./node-service-fcZExd22.js";
35
35
  import { n as redactSecrets, t as formatGatewayAuthUsed } from "./format-DVLB9DNB.js";
@@ -1,4 +1,4 @@
1
- import { dt as createPluginLoaderLogger, ft as loadSymiPlugins } from "./reply-DYnTEYoa.js";
1
+ import { dt as createPluginLoaderLogger, ft as loadSymiPlugins } from "./reply-05js8eGB.js";
2
2
  import { t as createSubsystemLogger } from "./subsystem-D9vIQve0.js";
3
3
  import { D as resolveDefaultAgentWorkspaceDir, c as resolveAgentWorkspaceDir, l as resolveDefaultAgentId } from "./agent-scope-CgUHAtCo.js";
4
4
  import { i as loadConfig } from "./config-CHwyw6l5.js";
@@ -1,7 +1,7 @@
1
1
  import { o as createSubsystemLogger } from "./entry.js";
2
2
  import { D as resolveDefaultAgentWorkspaceDir, c as resolveAgentWorkspaceDir, l as resolveDefaultAgentId } from "./agent-scope-D-jRCY0d.js";
3
3
  import { i as loadConfig } from "./config-DHBLS1Hl.js";
4
- import { m as loadSymiPlugins, p as createPluginLoaderLogger } from "./subagent-registry-CXrOOgPW.js";
4
+ import { m as loadSymiPlugins, p as createPluginLoaderLogger } from "./subagent-registry-lbDgDwLy.js";
5
5
 
6
6
  //#region src/plugins/status.ts
7
7
  const log = createSubsystemLogger("plugins");
@@ -35608,9 +35608,25 @@ function validateShellCommand(command) {
35608
35608
  //#endregion
35609
35609
  //#region src/agents/pi-tools.validate-wrapper.ts
35610
35610
  const EXEC_TOOL_NAMES = new Set(["exec", "bash"]);
35611
+ const FILE_TOOL_NAMES = new Set([
35612
+ "write",
35613
+ "read",
35614
+ "edit",
35615
+ "patch",
35616
+ "file_write",
35617
+ "file_edit",
35618
+ "write_file",
35619
+ "edit_file",
35620
+ "create_file"
35621
+ ]);
35622
+ const FILE_PATH_KEYS = [
35623
+ "file_path",
35624
+ "path",
35625
+ "filePath"
35626
+ ];
35611
35627
  /**
35612
- * Wrap tools with argument validation. Only exec/bash tools are validated.
35613
- * Other tools pass through unchanged.
35628
+ * Wrap tools with argument validation. Exec/bash commands and file paths
35629
+ * are validated. Other tools pass through unchanged.
35614
35630
  *
35615
35631
  * Call this AFTER tools are created and the model profile is resolved.
35616
35632
  */
@@ -35619,24 +35635,55 @@ function wrapToolsWithArgValidation(tools, profile) {
35619
35635
  return tools.map((tool) => wrapToolWithArgValidation(tool));
35620
35636
  }
35621
35637
  /**
35622
- * Wrap a single tool with argument validation for exec/bash commands.
35638
+ * Clean a file path by stripping control token fragments.
35639
+ * Returns null if the path is irreparably corrupted (empty after cleanup).
35640
+ */
35641
+ function cleanFilePath(filePath) {
35642
+ let cleaned = filePath.replace(/<\|[^|>]*(?:\|>)?/g, "");
35643
+ cleaned = cleanResidualTokenFragments(cleaned);
35644
+ cleaned = cleaned.trim();
35645
+ if (!cleaned || !/[a-zA-Z0-9/._~-]/.test(cleaned)) return {
35646
+ valid: false,
35647
+ cleaned
35648
+ };
35649
+ return {
35650
+ valid: true,
35651
+ cleaned
35652
+ };
35653
+ }
35654
+ /**
35655
+ * Wrap a single tool with argument validation.
35623
35656
  */
35624
35657
  function wrapToolWithArgValidation(tool) {
35625
35658
  const toolName = (tool.name ?? "").toLowerCase().trim();
35626
- if (!EXEC_TOOL_NAMES.has(toolName)) return tool;
35659
+ const isExecTool = EXEC_TOOL_NAMES.has(toolName);
35660
+ const isFileTool = FILE_TOOL_NAMES.has(toolName);
35661
+ if (!isExecTool && !isFileTool) return tool;
35627
35662
  const originalExecute = tool.execute;
35628
35663
  return {
35629
35664
  ...tool,
35630
35665
  execute(toolCallId, params, ...rest) {
35631
- const command = params.command ?? params.cmd;
35632
- if (typeof command !== "string") return originalExecute.call(tool, toolCallId, params, ...rest);
35633
- const result = validateShellCommand(command);
35634
- if (!result.valid) return Promise.resolve({ output: `Error: ${result.reason}. The command appears to contain model control tokens. Please provide a clean shell command without any <|, |>, or XML-like tags. Only valid shell syntax is accepted.` });
35635
- if (result.cleaned !== command) return originalExecute.call(tool, toolCallId, {
35666
+ if (isExecTool) {
35667
+ const command = params.command ?? params.cmd;
35668
+ if (typeof command !== "string") return originalExecute.call(tool, toolCallId, params, ...rest);
35669
+ const result = validateShellCommand(command);
35670
+ if (!result.valid) return Promise.resolve({ output: `Error: ${result.reason}. The command appears to contain model control tokens. Please provide a clean shell command without any <|, |>, or XML-like tags. Only valid shell syntax is accepted.` });
35671
+ if (result.cleaned !== command) return originalExecute.call(tool, toolCallId, {
35672
+ ...params,
35673
+ command: result.cleaned
35674
+ }, ...rest);
35675
+ return originalExecute.call(tool, toolCallId, params, ...rest);
35676
+ }
35677
+ const pathKey = FILE_PATH_KEYS.find((k) => typeof params[k] === "string");
35678
+ if (!pathKey) return originalExecute.call(tool, toolCallId, params, ...rest);
35679
+ const rawPath = params[pathKey];
35680
+ if (!rawPath.includes("<|") && !rawPath.includes("|>") && !/^[<"|]/.test(rawPath)) return originalExecute.call(tool, toolCallId, params, ...rest);
35681
+ const pathResult = cleanFilePath(rawPath);
35682
+ if (!pathResult.valid) return Promise.resolve({ output: `Error: file path "${rawPath}" contains model control tokens and could not be cleaned. Please provide a clean file path without any <|, |>, or XML-like tags.` });
35683
+ return originalExecute.call(tool, toolCallId, {
35636
35684
  ...params,
35637
- command: result.cleaned
35685
+ [pathKey]: pathResult.cleaned
35638
35686
  }, ...rest);
35639
- return originalExecute.call(tool, toolCallId, params, ...rest);
35640
35687
  }
35641
35688
  };
35642
35689
  }
@@ -39806,6 +39853,10 @@ async function runEmbeddedAttempt(params) {
39806
39853
  });
39807
39854
  };
39808
39855
  const streamMonitor = createStreamMonitor(modelProfile);
39856
+ const TOOL_ERROR_ABORT_THRESHOLD = 5;
39857
+ const TOOL_ERROR_WARN_THRESHOLD = 3;
39858
+ let consecutiveToolErrors = 0;
39859
+ let lastErrorToolName = "";
39809
39860
  const subscription = subscribeEmbeddedPiSession({
39810
39861
  session: activeSession,
39811
39862
  runId: params.runId,
@@ -39827,6 +39878,25 @@ async function runEmbeddedAttempt(params) {
39827
39878
  onAgentEvent: (evt) => {
39828
39879
  armSymipulseTimer();
39829
39880
  params.onAgentEvent?.(evt);
39881
+ if (evt.stream === "tool" && !aborted) {
39882
+ const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
39883
+ const toolName = typeof evt.data?.name === "string" ? evt.data.name : "";
39884
+ const isError = evt.data?.isError === true;
39885
+ if (phase === "result" && toolName) {
39886
+ if (isError && toolName === lastErrorToolName) consecutiveToolErrors++;
39887
+ else if (isError) {
39888
+ consecutiveToolErrors = 1;
39889
+ lastErrorToolName = toolName;
39890
+ } else {
39891
+ consecutiveToolErrors = 0;
39892
+ lastErrorToolName = "";
39893
+ }
39894
+ if (consecutiveToolErrors >= TOOL_ERROR_ABORT_THRESHOLD) {
39895
+ log$4.error(`Agent-loop circuit breaker: ${toolName} failed ${consecutiveToolErrors} consecutive times. Aborting run ${params.runId}.`);
39896
+ abortRun(false, /* @__PURE__ */ new Error(`Tool ${toolName} failed ${consecutiveToolErrors} consecutive times. The model may be generating corrupted tool arguments. Run aborted to prevent infinite loop.`));
39897
+ } else if (consecutiveToolErrors === TOOL_ERROR_WARN_THRESHOLD) log$4.warn(`Agent-loop tool error warning: ${toolName} failed ${consecutiveToolErrors} times consecutively. runId=${params.runId}`);
39898
+ }
39899
+ }
39830
39900
  if (evt.stream === "assistant" && typeof evt.data?.text === "string" && !aborted) {
39831
39901
  streamMonitor.onChunk(evt.data.text);
39832
39902
  if (streamMonitor.shouldStop()) log$4.debug(`stream monitor detection (log-only, no abort): runId=${params.runId} reason=${streamMonitor.getStopReason()}`);
@@ -52942,7 +53012,7 @@ function isVoiceChannelType(type) {
52942
53012
  function createDefaultDeps() {
52943
53013
  return {
52944
53014
  sendMessageWhatsApp: async (...args) => {
52945
- const { sendMessageWhatsApp } = await import("./web-Bqrgp43v.js");
53015
+ const { sendMessageWhatsApp } = await import("./web-CSrDbJJ7.js");
52946
53016
  return await sendMessageWhatsApp(...args);
52947
53017
  },
52948
53018
  sendMessageTelegram: async (...args) => {
@@ -68256,7 +68326,7 @@ function loadWebLoginQr() {
68256
68326
  return webLoginQrPromise;
68257
68327
  }
68258
68328
  function loadWebChannel() {
68259
- webChannelPromise ??= import("./web-Bqrgp43v.js");
68329
+ webChannelPromise ??= import("./web-CSrDbJJ7.js");
68260
68330
  return webChannelPromise;
68261
68331
  }
68262
68332
  function loadWhatsAppActions() {
@@ -53674,7 +53674,7 @@ function isVoiceChannelType(type) {
53674
53674
  function createDefaultDeps() {
53675
53675
  return {
53676
53676
  sendMessageWhatsApp: async (...args) => {
53677
- const { sendMessageWhatsApp } = await import("./web-hHX9a9YO.js");
53677
+ const { sendMessageWhatsApp } = await import("./web-CQH9fSkH.js");
53678
53678
  return await sendMessageWhatsApp(...args);
53679
53679
  },
53680
53680
  sendMessageTelegram: async (...args) => {
@@ -68954,7 +68954,7 @@ function loadWebLoginQr() {
68954
68954
  return webLoginQrPromise;
68955
68955
  }
68956
68956
  function loadWebChannel() {
68957
- webChannelPromise ??= import("./web-hHX9a9YO.js");
68957
+ webChannelPromise ??= import("./web-CQH9fSkH.js");
68958
68958
  return webChannelPromise;
68959
68959
  }
68960
68960
  function loadWhatsAppActions() {
@@ -75526,9 +75526,25 @@ function validateShellCommand(command) {
75526
75526
  //#endregion
75527
75527
  //#region src/agents/pi-tools.validate-wrapper.ts
75528
75528
  const EXEC_TOOL_NAMES = new Set(["exec", "bash"]);
75529
+ const FILE_TOOL_NAMES = new Set([
75530
+ "write",
75531
+ "read",
75532
+ "edit",
75533
+ "patch",
75534
+ "file_write",
75535
+ "file_edit",
75536
+ "write_file",
75537
+ "edit_file",
75538
+ "create_file"
75539
+ ]);
75540
+ const FILE_PATH_KEYS = [
75541
+ "file_path",
75542
+ "path",
75543
+ "filePath"
75544
+ ];
75529
75545
  /**
75530
- * Wrap tools with argument validation. Only exec/bash tools are validated.
75531
- * Other tools pass through unchanged.
75546
+ * Wrap tools with argument validation. Exec/bash commands and file paths
75547
+ * are validated. Other tools pass through unchanged.
75532
75548
  *
75533
75549
  * Call this AFTER tools are created and the model profile is resolved.
75534
75550
  */
@@ -75537,24 +75553,55 @@ function wrapToolsWithArgValidation(tools, profile) {
75537
75553
  return tools.map((tool) => wrapToolWithArgValidation(tool));
75538
75554
  }
75539
75555
  /**
75540
- * Wrap a single tool with argument validation for exec/bash commands.
75556
+ * Clean a file path by stripping control token fragments.
75557
+ * Returns null if the path is irreparably corrupted (empty after cleanup).
75558
+ */
75559
+ function cleanFilePath(filePath) {
75560
+ let cleaned = filePath.replace(/<\|[^|>]*(?:\|>)?/g, "");
75561
+ cleaned = cleanResidualTokenFragments(cleaned);
75562
+ cleaned = cleaned.trim();
75563
+ if (!cleaned || !/[a-zA-Z0-9/._~-]/.test(cleaned)) return {
75564
+ valid: false,
75565
+ cleaned
75566
+ };
75567
+ return {
75568
+ valid: true,
75569
+ cleaned
75570
+ };
75571
+ }
75572
+ /**
75573
+ * Wrap a single tool with argument validation.
75541
75574
  */
75542
75575
  function wrapToolWithArgValidation(tool) {
75543
75576
  const toolName = (tool.name ?? "").toLowerCase().trim();
75544
- if (!EXEC_TOOL_NAMES.has(toolName)) return tool;
75577
+ const isExecTool = EXEC_TOOL_NAMES.has(toolName);
75578
+ const isFileTool = FILE_TOOL_NAMES.has(toolName);
75579
+ if (!isExecTool && !isFileTool) return tool;
75545
75580
  const originalExecute = tool.execute;
75546
75581
  return {
75547
75582
  ...tool,
75548
75583
  execute(toolCallId, params, ...rest) {
75549
- const command = params.command ?? params.cmd;
75550
- if (typeof command !== "string") return originalExecute.call(tool, toolCallId, params, ...rest);
75551
- const result = validateShellCommand(command);
75552
- if (!result.valid) return Promise.resolve({ output: `Error: ${result.reason}. The command appears to contain model control tokens. Please provide a clean shell command without any <|, |>, or XML-like tags. Only valid shell syntax is accepted.` });
75553
- if (result.cleaned !== command) return originalExecute.call(tool, toolCallId, {
75584
+ if (isExecTool) {
75585
+ const command = params.command ?? params.cmd;
75586
+ if (typeof command !== "string") return originalExecute.call(tool, toolCallId, params, ...rest);
75587
+ const result = validateShellCommand(command);
75588
+ if (!result.valid) return Promise.resolve({ output: `Error: ${result.reason}. The command appears to contain model control tokens. Please provide a clean shell command without any <|, |>, or XML-like tags. Only valid shell syntax is accepted.` });
75589
+ if (result.cleaned !== command) return originalExecute.call(tool, toolCallId, {
75590
+ ...params,
75591
+ command: result.cleaned
75592
+ }, ...rest);
75593
+ return originalExecute.call(tool, toolCallId, params, ...rest);
75594
+ }
75595
+ const pathKey = FILE_PATH_KEYS.find((k) => typeof params[k] === "string");
75596
+ if (!pathKey) return originalExecute.call(tool, toolCallId, params, ...rest);
75597
+ const rawPath = params[pathKey];
75598
+ if (!rawPath.includes("<|") && !rawPath.includes("|>") && !/^[<"|]/.test(rawPath)) return originalExecute.call(tool, toolCallId, params, ...rest);
75599
+ const pathResult = cleanFilePath(rawPath);
75600
+ if (!pathResult.valid) return Promise.resolve({ output: `Error: file path "${rawPath}" contains model control tokens and could not be cleaned. Please provide a clean file path without any <|, |>, or XML-like tags.` });
75601
+ return originalExecute.call(tool, toolCallId, {
75554
75602
  ...params,
75555
- command: result.cleaned
75603
+ [pathKey]: pathResult.cleaned
75556
75604
  }, ...rest);
75557
- return originalExecute.call(tool, toolCallId, params, ...rest);
75558
75605
  }
75559
75606
  };
75560
75607
  }
@@ -77006,6 +77053,10 @@ async function runEmbeddedAttempt(params) {
77006
77053
  });
77007
77054
  };
77008
77055
  const streamMonitor = createStreamMonitor(modelProfile);
77056
+ const TOOL_ERROR_ABORT_THRESHOLD = 5;
77057
+ const TOOL_ERROR_WARN_THRESHOLD = 3;
77058
+ let consecutiveToolErrors = 0;
77059
+ let lastErrorToolName = "";
77009
77060
  const subscription = subscribeEmbeddedPiSession({
77010
77061
  session: activeSession,
77011
77062
  runId: params.runId,
@@ -77027,6 +77078,25 @@ async function runEmbeddedAttempt(params) {
77027
77078
  onAgentEvent: (evt) => {
77028
77079
  armSymipulseTimer();
77029
77080
  params.onAgentEvent?.(evt);
77081
+ if (evt.stream === "tool" && !aborted) {
77082
+ const phase = typeof evt.data?.phase === "string" ? evt.data.phase : "";
77083
+ const toolName = typeof evt.data?.name === "string" ? evt.data.name : "";
77084
+ const isError = evt.data?.isError === true;
77085
+ if (phase === "result" && toolName) {
77086
+ if (isError && toolName === lastErrorToolName) consecutiveToolErrors++;
77087
+ else if (isError) {
77088
+ consecutiveToolErrors = 1;
77089
+ lastErrorToolName = toolName;
77090
+ } else {
77091
+ consecutiveToolErrors = 0;
77092
+ lastErrorToolName = "";
77093
+ }
77094
+ if (consecutiveToolErrors >= TOOL_ERROR_ABORT_THRESHOLD) {
77095
+ log$8.error(`Agent-loop circuit breaker: ${toolName} failed ${consecutiveToolErrors} consecutive times. Aborting run ${params.runId}.`);
77096
+ abortRun(false, /* @__PURE__ */ new Error(`Tool ${toolName} failed ${consecutiveToolErrors} consecutive times. The model may be generating corrupted tool arguments. Run aborted to prevent infinite loop.`));
77097
+ } else if (consecutiveToolErrors === TOOL_ERROR_WARN_THRESHOLD) log$8.warn(`Agent-loop tool error warning: ${toolName} failed ${consecutiveToolErrors} times consecutively. runId=${params.runId}`);
77098
+ }
77099
+ }
77030
77100
  if (evt.stream === "assistant" && typeof evt.data?.text === "string" && !aborted) {
77031
77101
  streamMonitor.onChunk(evt.data.text);
77032
77102
  if (streamMonitor.shouldStop()) log$8.debug(`stream monitor detection (log-only, no abort): runId=${params.runId} reason=${streamMonitor.getStopReason()}`);
@@ -16,7 +16,7 @@ import "./client-DMBZpU6X.js";
16
16
  import "./call-BcE47FtD.js";
17
17
  import "./message-channel-C9dERklz.js";
18
18
  import "./pairing-token-Byh6drgn.js";
19
- import { Ct as trimLogTail } from "./subagent-registry-CXrOOgPW.js";
19
+ import { Ct as trimLogTail } from "./subagent-registry-lbDgDwLy.js";
20
20
  import "./sessions-CJXnZVjR.js";
21
21
  import "./tokens-Csntmwwn.js";
22
22
  import "./plugins-CwSlLxM8.js";
@@ -111,10 +111,10 @@ import "./npm-registry-spec-DkaZNHAW.js";
111
111
  import "./skill-scanner-BGWOBqLY.js";
112
112
  import "./installs-CgQpVncj.js";
113
113
  import "./channels-status-issues-c7qZbYG5.js";
114
- import "./register.subclis-B2dGWFur.js";
115
- import "./command-registry-CHtN2HeK.js";
114
+ import "./register.subclis-DOiZocR6.js";
115
+ import "./command-registry-9EhYc6da.js";
116
116
  import "./program-context-CqzR_m-7.js";
117
- import { r as installCompletion } from "./completion-cli-Cov6N3BO.js";
117
+ import { r as installCompletion } from "./completion-cli-BFZv3K5D.js";
118
118
  import "./daemon-runtime-CfRwa6qh.js";
119
119
  import { r as parseSemver } from "./runtime-guard-D7waq_Ho.js";
120
120
  import "./systemd-DlMdyFDY.js";
@@ -124,19 +124,19 @@ import "./systemd-hints-sQipWGd1.js";
124
124
  import { i as runDaemonInstall, r as runDaemonRestart } from "./daemon-cli-wWnBIQtk.js";
125
125
  import "./diagnostics-CS1ov_hH.js";
126
126
  import { t as renderTable } from "./table-D01d2GuY.js";
127
- import "./health-C5XJPwpt.js";
127
+ import "./health-CM1asUG8.js";
128
128
  import "./control-ui-assets-BseSWee1.js";
129
129
  import { a as resolveNpmChannelTag, c as DEFAULT_PACKAGE_CHANNEL, d as formatUpdateChannelLabel, g as resolveUpdateChannelDisplay, h as resolveEffectiveUpdateChannel, m as normalizeUpdateChannel, n as compareSemverStrings, r as fetchNpmTagVersion, s as DEFAULT_GIT_CHANNEL, t as checkUpdateStatus, u as channelToNpmTag } from "./update-check-ZdimP1aU.js";
130
130
  import "./dm-policy-shared-DJ-61hCT.js";
131
131
  import { i as resolveUpdateAvailability, n as formatUpdateOneLiner, t as formatUpdateAvailableHint } from "./status.update-DbmZz0Aq.js";
132
- import { a as globalInstallArgs, c as readPackageVersion, i as detectGlobalInstallManagerForRoot, n as cleanupGlobalRenameDirs, o as resolveGlobalPackageRoot, r as detectGlobalInstallManagerByPresence, s as readPackageName, t as runGatewayUpdate } from "./update-runner-BQxFFCGc.js";
132
+ import { a as globalInstallArgs, c as readPackageVersion, i as detectGlobalInstallManagerForRoot, n as cleanupGlobalRenameDirs, o as resolveGlobalPackageRoot, r as detectGlobalInstallManagerByPresence, s as readPackageName, t as runGatewayUpdate } from "./update-runner-B8UmqtLI.js";
133
133
  import "./logging-BGewRZy0.js";
134
134
  import { n as updateNpmInstalledPlugins, t as syncPluginsForUpdateChannel } from "./update-DEMKx4eC.js";
135
135
  import "./doctor-config-flow-CA3eiKhd.js";
136
136
  import "./systemd-linger-DA_LW52P.js";
137
137
  import "./health-format-CzgUHmmX.js";
138
- import { n as doctorCommand, t as selectStyled } from "./prompt-select-styled-QaS2zul_.js";
139
- import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-BKKzstt6.js";
138
+ import { n as doctorCommand, t as selectStyled } from "./prompt-select-styled-B_lFTtqp.js";
139
+ import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-BunqvoqZ.js";
140
140
  import { spawn, spawnSync } from "node:child_process";
141
141
  import os from "node:os";
142
142
  import path from "node:path";
@@ -1,7 +1,7 @@
1
1
  import { g as resolveStateDir } from "./paths-Cqn-zk3M.js";
2
2
  import { B as theme, h as pathExists } from "./utils-B-0b9bGM.js";
3
3
  import "./thinking-EAliFiVK.js";
4
- import { V as trimLogTail } from "./reply-DYnTEYoa.js";
4
+ import { V as trimLogTail } from "./reply-05js8eGB.js";
5
5
  import { t as resolveSymiPackageRoot } from "./symi-root-CrGJbkzf.js";
6
6
  import "./registry-Cja8eT7G.js";
7
7
  import { f as defaultRuntime } from "./subsystem-D9vIQve0.js";
@@ -106,7 +106,7 @@ import "./stagger-BUClb97_.js";
106
106
  import { c as resolveGatewayLaunchAgentLabel, d as resolveGatewaySystemdServiceName, f as resolveGatewayWindowsTaskName } from "./constants-C8_BLnaW.js";
107
107
  import "./channel-selection-DuWs0Aak.js";
108
108
  import { r as parseSemver } from "./runtime-guard-B37eizu-.js";
109
- import "./program-context-DaNGrTOm.js";
109
+ import "./program-context-CY1jWc5A.js";
110
110
  import "./catalog-RiADx7MA.js";
111
111
  import "./skills-status-CURJKnyY.js";
112
112
  import { n as inheritOptionFromParent } from "./command-options-BtDai3oC.js";
@@ -117,7 +117,7 @@ import "./npm-registry-spec-C2JDdSZS.js";
117
117
  import "./skill-scanner-CLs8u6vQ.js";
118
118
  import "./installs-C1Cebk97.js";
119
119
  import "./channels-status-issues-B_kBkl_u.js";
120
- import { r as installCompletion } from "./completion-cli-C8y_J5KC.js";
120
+ import { r as installCompletion } from "./completion-cli-CCeQlMlC.js";
121
121
  import "./daemon-runtime-2mwX-jqj.js";
122
122
  import "./systemd-riq8uNJQ.js";
123
123
  import { t as resolveGatewayService } from "./service-Cl74hx8J.js";
@@ -126,19 +126,19 @@ import "./systemd-hints-BR6gChwm.js";
126
126
  import { i as runDaemonInstall, r as runDaemonRestart } from "./daemon-cli-DscwlsKW.js";
127
127
  import "./diagnostics-BAMlsVVX.js";
128
128
  import { t as renderTable } from "./table-BTgkRafz.js";
129
- import "./health-BjwDRAdd.js";
129
+ import "./health-CDGOsNeD.js";
130
130
  import "./control-ui-assets-Z947tKLt.js";
131
131
  import { a as resolveNpmChannelTag, c as DEFAULT_PACKAGE_CHANNEL, d as formatUpdateChannelLabel, g as resolveUpdateChannelDisplay, h as resolveEffectiveUpdateChannel, m as normalizeUpdateChannel, n as compareSemverStrings, r as fetchNpmTagVersion, s as DEFAULT_GIT_CHANNEL, t as checkUpdateStatus, u as channelToNpmTag } from "./update-check-CtckACbb.js";
132
132
  import "./dm-policy-shared-Bh3TbexU.js";
133
133
  import { i as resolveUpdateAvailability, n as formatUpdateOneLiner, t as formatUpdateAvailableHint } from "./status.update-DtwCUTf-.js";
134
- import { a as globalInstallArgs, c as readPackageVersion, i as detectGlobalInstallManagerForRoot, n as cleanupGlobalRenameDirs, o as resolveGlobalPackageRoot, r as detectGlobalInstallManagerByPresence, s as readPackageName, t as runGatewayUpdate } from "./update-runner-CLKHrONW.js";
134
+ import { a as globalInstallArgs, c as readPackageVersion, i as detectGlobalInstallManagerForRoot, n as cleanupGlobalRenameDirs, o as resolveGlobalPackageRoot, r as detectGlobalInstallManagerByPresence, s as readPackageName, t as runGatewayUpdate } from "./update-runner-CWJ4pC1b.js";
135
135
  import "./logging-BzzwiKjv.js";
136
136
  import { n as updateNpmInstalledPlugins, t as syncPluginsForUpdateChannel } from "./update-rw7wJwHd.js";
137
137
  import "./doctor-config-flow-QnaBd8kL.js";
138
138
  import "./systemd-linger-aQ75ZlXY.js";
139
139
  import "./health-format-DSwnXZPU.js";
140
- import { n as doctorCommand, t as selectStyled } from "./prompt-select-styled-YOj4xigd.js";
141
- import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-D7CDLFLg.js";
140
+ import { n as doctorCommand, t as selectStyled } from "./prompt-select-styled-BEnZY8wI.js";
141
+ import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-CLeX1kaN.js";
142
142
  import os from "node:os";
143
143
  import path from "node:path";
144
144
  import fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { nt as pathExists } from "./entry.js";
2
2
  import { t as runCommandWithTimeout } from "./exec-CBKBIMpA.js";
3
- import { Ct as trimLogTail } from "./subagent-registry-CXrOOgPW.js";
3
+ import { Ct as trimLogTail } from "./subagent-registry-lbDgDwLy.js";
4
4
  import { n as resolveControlUiDistIndexHealth, r as resolveControlUiDistIndexPathForRoot } from "./control-ui-assets-BseSWee1.js";
5
5
  import { c as DEFAULT_PACKAGE_CHANNEL, f as isBetaTag, l as DEV_BRANCH, n as compareSemverStrings, o as detectPackageManager$1, p as isStableTag, u as channelToNpmTag } from "./update-check-ZdimP1aU.js";
6
6
  import os from "node:os";
@@ -1,5 +1,5 @@
1
1
  import { h as pathExists } from "./utils-B-0b9bGM.js";
2
- import { V as trimLogTail } from "./reply-DYnTEYoa.js";
2
+ import { V as trimLogTail } from "./reply-05js8eGB.js";
3
3
  import { t as runCommandWithTimeout } from "./exec-CWkblSrI.js";
4
4
  import { n as resolveControlUiDistIndexHealth, r as resolveControlUiDistIndexPathForRoot } from "./control-ui-assets-Z947tKLt.js";
5
5
  import { c as DEFAULT_PACKAGE_CHANNEL, f as isBetaTag, l as DEV_BRANCH, n as compareSemverStrings, o as detectPackageManager$1, p as isStableTag, u as channelToNpmTag } from "./update-check-CtckACbb.js";
@@ -1,7 +1,7 @@
1
1
  import "./paths-Cqn-zk3M.js";
2
2
  import "./utils-B-0b9bGM.js";
3
3
  import "./thinking-EAliFiVK.js";
4
- import "./reply-DYnTEYoa.js";
4
+ import "./reply-05js8eGB.js";
5
5
  import "./registry-Cja8eT7G.js";
6
6
  import "./subsystem-D9vIQve0.js";
7
7
  import "./exec-CWkblSrI.js";
@@ -101,7 +101,7 @@ import "./pi-tools.policy-CIDBbw6x.js";
101
101
  import "./control-service-Bz7rxLWq.js";
102
102
  import "./stagger-BUClb97_.js";
103
103
  import "./channel-selection-DuWs0Aak.js";
104
- import { n as monitorWebInbox, t as monitorWebChannel } from "./channel-web-CM2LyWZW.js";
104
+ import { n as monitorWebInbox, t as monitorWebChannel } from "./channel-web-DYinYBz4.js";
105
105
  import { n as sendMessageWhatsApp } from "./outbound-DB5Zus0-.js";
106
106
  import { i as waitForWaConnection, t as createWaSocket } from "./session-DIBTkyvE.js";
107
107
  import { t as loginWeb } from "./login-dIlDkG4X.js";