@noxsoft/anima 7.0.0 → 7.0.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 (120) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/{agent-BoAAHGEA.js → agent-BjD_hkGZ.js} +3 -3
  3. package/dist/{agent-DuW0onwk.js → agent-PoYM2xa7.js} +3 -3
  4. package/dist/{agents-BUXkSDns.js → agents-y3HCk1ks.js} +4 -4
  5. package/dist/{anthropic-direct-runner-DizCei79.js → anthropic-direct-runner-Bu8w-wlJ.js} +246 -10
  6. package/dist/{anthropic-direct-runner-OjcTAH6g.js → anthropic-direct-runner-C5pnwYzT.js} +246 -10
  7. package/dist/{auth-choice-B1iGnjuE.js → auth-choice-BYOaX-W4.js} +1 -1
  8. package/dist/{auth-choice-HF9x6xk2.js → auth-choice-CRP6z43z.js} +1 -1
  9. package/dist/{banner-Dpa5d1If.js → banner-XT5N0ZF4.js} +1 -1
  10. package/dist/build-info.json +3 -3
  11. package/dist/bundled/boot-md/handler.js +2 -2
  12. package/dist/bundled/session-memory/handler.js +1 -1
  13. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  14. package/dist/{channel-web-C5mzsaa3.js → channel-web-yWytZHhN.js} +2 -2
  15. package/dist/{cli-Cuq4bIg4.js → cli-C7mOU26p.js} +2 -2
  16. package/dist/{cli-X9ikywQ3.js → cli-DfcdnRcl.js} +2 -2
  17. package/dist/{command-registry-9V4uqrBV.js → command-registry-DUTqrmna.js} +12 -12
  18. package/dist/{completion-cli-DNWDwhab.js → completion-cli-BBm9JIHZ.js} +2 -2
  19. package/dist/{completion-cli-BtvcR-U5.js → completion-cli-Cpj91U30.js} +1 -1
  20. package/dist/{config-cli-fleq7-gq.js → config-cli-CF2ERR8G.js} +1 -1
  21. package/dist/{config-cli-DfHE3KG-.js → config-cli-Dmd4Oyjp.js} +1 -1
  22. package/dist/{configure-lkozxQed.js → configure-4jIAlOdj.js} +7 -7
  23. package/dist/{configure-B2Mfnwy_.js → configure-BE8TA8Yt.js} +3 -3
  24. package/dist/{configure-ZWxixuRA.js → configure-BfWsTKMF.js} +3 -3
  25. package/dist/{configure-SnvMHZPD.js → configure-CU3kulTq.js} +7 -7
  26. package/dist/{deps-BKLIBKjK.js → deps-DKPoFoa8.js} +1 -1
  27. package/dist/{doctor-D7kKyUVk.js → doctor-CFpVHDFT.js} +4 -4
  28. package/dist/{doctor-DmCnZ-jF.js → doctor-DOudOs1k.js} +4 -4
  29. package/dist/{doctor-completion-B9SBdMoR.js → doctor-completion-DfNyJGIj.js} +1 -1
  30. package/dist/{doctor-completion-BBvW4_J9.js → doctor-completion-R0UlpjIj.js} +1 -1
  31. package/dist/{engine-DpbYPop7.js → engine-BDDM-iAi.js} +1 -1
  32. package/dist/{engine-zmn3SOYa.js → engine-BDwYEVKi.js} +1 -1
  33. package/dist/entry.js +1 -1
  34. package/dist/extensionAPI.js +1 -1
  35. package/dist/{gateway-cli-CEM1vBuk.js → gateway-cli-CFlPUx9N.js} +15 -15
  36. package/dist/{gateway-cli-iumkTohn.js → gateway-cli-DtIum1te.js} +16 -16
  37. package/dist/{health-Cndq9b7A.js → health-ngQNjXh4.js} +3 -3
  38. package/dist/{health-B5N6_UOf.js → health-yw_uaucz.js} +3 -3
  39. package/dist/{heartbeat-visibility-BQL13ZBH.js → heartbeat-visibility-BaL8JzkS.js} +1 -1
  40. package/dist/{heartbeat-visibility-CwcYugaR.js → heartbeat-visibility-mAzdNSiS.js} +1 -1
  41. package/dist/{hooks-cli-BZcvdIwE.js → hooks-cli-CPgLAn7a.js} +3 -3
  42. package/dist/{hooks-cli-DSlPBQSY.js → hooks-cli-D6YfDiUI.js} +3 -3
  43. package/dist/index.js +8 -8
  44. package/dist/llm-slug-generator.js +1 -1
  45. package/dist/{models-CdNeYfSp.js → models-BXdBXPMB.js} +3 -3
  46. package/dist/{models-cli-D7eSsPuk.js → models-cli-1Kj8gkGy.js} +3 -3
  47. package/dist/{models-cli-fTZXo1zx.js → models-cli-DdJcmOGI.js} +4 -4
  48. package/dist/{onboard-D-6QCnTi.js → onboard-BzScK9k6.js} +3 -3
  49. package/dist/{onboard-C5K37NvY.js → onboard-CHX1Jdt_.js} +3 -3
  50. package/dist/{onboard-channels-BsCq32Hn.js → onboard-channels-DfXxMbYu.js} +1 -1
  51. package/dist/{onboard-channels-bx6oelzj.js → onboard-channels-wUF4oRB-.js} +1 -1
  52. package/dist/{onboarding-CX1vIkcB.js → onboarding-6jxAKxhe.js} +4 -4
  53. package/dist/{onboarding-BeuMAyic.js → onboarding-fnZOw6Wv.js} +4 -4
  54. package/dist/{orchestrator-C1nWKIJS.js → orchestrator-B2rNfH4K.js} +5 -4
  55. package/dist/{orchestrator-C2ypFiPL.js → orchestrator-CrFD887e.js} +5 -4
  56. package/dist/{outbound-send-deps-Y9AxHeLG.js → outbound-send-deps-DMsqr5fd.js} +1 -1
  57. package/dist/{pi-embedded-D15iww51.js → pi-embedded-B1eVXOsQ.js} +245 -9
  58. package/dist/{pi-embedded-DR8Pfd05.js → pi-embedded-DbvG9mmD.js} +245 -9
  59. package/dist/{plugin-registry-ME2FQAi-.js → plugin-registry-CtkU96jV.js} +1 -1
  60. package/dist/{plugin-registry-Do2D1nDk.js → plugin-registry-DKexyPAq.js} +1 -1
  61. package/dist/plugin-sdk/index.js +6 -6
  62. package/dist/plugin-sdk/infra/architecture-awareness.d.ts +47 -0
  63. package/dist/{plugins-cli-CVFzwdmI.js → plugins-cli-B3l7kalt.js} +3 -3
  64. package/dist/{plugins-cli-CoVt2ewg.js → plugins-cli-BQmysVFP.js} +3 -3
  65. package/dist/{program-context-DP3qjW7A.js → program-context-C4x0zjOR.js} +18 -18
  66. package/dist/{program-8rF4C_wd.js → program-mSyCYzsQ.js} +7 -7
  67. package/dist/{register.agent-DnkOx0U8.js → register.agent-CzEM3bkp.js} +7 -7
  68. package/dist/{register.agent-BIrXCVtQ.js → register.agent-DBxUWr1K.js} +8 -8
  69. package/dist/{register.anima-DXT9bM9A.js → register.anima--gufBuS-.js} +4 -4
  70. package/dist/{register.anima-B36rTHUt.js → register.anima-RI6gewtj.js} +4 -4
  71. package/dist/{register.configure-CuzJxZmk.js → register.configure-Cs3uLUBo.js} +6 -6
  72. package/dist/{register.configure-DCpvHX3m.js → register.configure-Dpe8Qel3.js} +6 -6
  73. package/dist/{register.maintenance-CcxBFfv5.js → register.maintenance-BEYN8SJL.js} +9 -9
  74. package/dist/{register.maintenance-Dla0H12S.js → register.maintenance-DqAdzWBM.js} +8 -8
  75. package/dist/{register.message-Brtushvp.js → register.message-ACbKb7JS.js} +4 -4
  76. package/dist/{register.message-CD7xV-jz.js → register.message-BhGJ_1Iy.js} +4 -4
  77. package/dist/{register.onboard-6CbODzQ6.js → register.onboard-CwkY7CRm.js} +9 -9
  78. package/dist/{register.onboard-23Mra3LN.js → register.onboard-DR_YYtbi.js} +10 -10
  79. package/dist/{register.setup-DlVH7FKe.js → register.setup-BSm6O1ml.js} +9 -9
  80. package/dist/{register.setup-CqQw13Ky.js → register.setup-Cn3e7Std.js} +10 -10
  81. package/dist/{register.status-health-sessions-CxtgPKu9.js → register.status-health-sessions-CpxsZeet.js} +4 -4
  82. package/dist/{register.status-health-sessions-CduFjFDB.js → register.status-health-sessions-DAl9OeGB.js} +4 -4
  83. package/dist/{register.subclis-CtANqD5P.js → register.subclis-DEFeoyPP.js} +7 -7
  84. package/dist/{reply-prefix-B7Fb3fO8.js → reply-prefix-CEnF6TUe.js} +1 -1
  85. package/dist/{reply-prefix-BzdhJDqP.js → reply-prefix-Og65nAYv.js} +1 -1
  86. package/dist/{reply-93fMzde1.js → reply-ylwOKuOF.js} +2 -2
  87. package/dist/{run-Cq_iTGK_.js → run-B6eBjo22.js} +231 -63
  88. package/dist/{run-CF3kHOGH.js → run-D6Ete2Z-.js} +231 -63
  89. package/dist/{run-main-BiIRcc6s.js → run-main-CQHE4XaN.js} +15 -15
  90. package/dist/{server-node-events-DgvKcH5q.js → server-node-events-CV5m_fuq.js} +5 -5
  91. package/dist/{server-node-events-B3Serk9L.js → server-node-events-DIuVwITd.js} +5 -5
  92. package/dist/{session-C_d9uvLf.js → session-BqHD-8a_.js} +1 -1
  93. package/dist/{session-BMDpwIJu.js → session-Jlf3l006.js} +1 -1
  94. package/dist/{settings-cli-DsDqNpW_.js → settings-cli-LWW2xQBQ.js} +7 -7
  95. package/dist/{settings-cli-CZdlEmNi.js → settings-cli-T66kDBNA.js} +7 -7
  96. package/dist/{setup-token-C8Gg1P6T.js → setup-token-0zfSBnMQ.js} +1 -1
  97. package/dist/{setup-token-Lee4gM5w.js → setup-token-6DSKE0Tn.js} +1 -1
  98. package/dist/{start-Cs1aPMq2.js → start-BdcAszpl.js} +15 -15
  99. package/dist/{start-CK6urvnN.js → start-gVOPVCgi.js} +16 -16
  100. package/dist/{status-BO5BIf81.js → status-BhRELdY_.js} +3 -3
  101. package/dist/{status-COc4xMti.js → status-CDcFjNtS.js} +1 -1
  102. package/dist/{status-C_NBOv_V.js → status-CobgQziJ.js} +1 -1
  103. package/dist/{status-uakoP719.js → status-D37aRiV3.js} +3 -3
  104. package/dist/{subagent-registry-fLI7QDKe.js → subagent-registry-CDEUbtey.js} +2 -2
  105. package/dist/{update-cli-D3Ujz_cW.js → update-cli-BjHgpnxD.js} +9 -9
  106. package/dist/{update-cli-DEe62XGU.js → update-cli-QtM0G6CE.js} +8 -8
  107. package/dist/{update-runner-DZfnquWO.js → update-runner-C8SRcVm3.js} +1 -1
  108. package/dist/{update-runner-DUl-g4mB.js → update-runner-Fb3Un6UZ.js} +1 -1
  109. package/dist/{web-Di8j762D.js → web-BDig9tCy.js} +3 -3
  110. package/dist/{web-C-cK9OCd.js → web-C4lrKULd.js} +1 -1
  111. package/dist/{web-DzSlI8A6.js → web-CPPJ5y4c.js} +1 -1
  112. package/dist/{web-Dybw4K7C.js → web-Vx_ENtYI.js} +4 -4
  113. package/package.json +6 -2
  114. package/templates/HEART.md +32 -10
  115. package/templates/SOUL.md +37 -8
  116. package/templates/profiles/architect.profile.json5 +36 -0
  117. package/templates/profiles/builder.profile.json5 +36 -0
  118. package/templates/profiles/coordinator.profile.json5 +36 -0
  119. package/templates/profiles/guardian.profile.json5 +36 -0
  120. package/templates/profiles/researcher.profile.json5 +36 -0
@@ -2,7 +2,7 @@ import { h as expandHomePrefix, i as isNixMode, l as resolveGatewayLockDir, m as
2
2
  import { E as getActivePluginRegistry, F as setVerbose, G as setLoggerOverride, H as getChildLogger, U as getLogger, W as getResolvedLoggerSettings, d as defaultRuntime, g as CHANNEL_IDS, i as getResolvedConsoleSettings, n as runtimeForLogger, o as setConsoleSubsystemFilter, s as setConsoleTimestampPrefix, t as createSubsystemLogger, v as DEFAULT_CHAT_CHANNEL } from "./subsystem-BAADN1B8.js";
3
3
  import { C as shortenHomePath, D as truncateUtf16Safe, b as resolveUserPath, c as ensureDir$1, d as isPlainObject, r as clamp, t as CONFIG_DIR } from "./utils-CLYlhJuc.js";
4
4
  import { C as supportsXHighThinking, _ as normalizeElevatedLevel, b as normalizeUsageDisplay, m as formatXHighModelHint, p as formatThinkingLevels, v as normalizeReasoningLevel, x as normalizeVerboseLevel, y as normalizeThinkLevel } from "./pi-embedded-helpers-BZ9GspxK.js";
5
- import { $ as archiveFileOnDisk, At as deferGatewayRestartUntilIdle, B as sniffMimeFromBase64, C as verifyNodeToken, Cn as stopDiagnosticHeartbeat, Cr as DEFAULT_INPUT_PDF_MAX_PIXELS, Ct as loadProviderStore, D as registerSkillsChangeListener, Dr as extractImageContentFromSource, E as getSkillsSnapshotVersion, Er as extractFileContentFromSource, F as abortEmbeddedPiRun, Ft as setGatewaySigusr1RestartPolicy, G as canonicalizeSpawnedByForAgent, Gn as CommandLane, Gt as normalizeCronJobPatch, Hn as readLatestAssistantReply, I as waitForEmbeddedPiRunEnd, It as setPreRestartDeferralCheck, J as loadCombinedSessionStoreForGateway, Jn as getAgentRunContext, Jt as normalizeOptionalText, K as listAgentsForGateway, Kn as clearAgentRunContext, Kt as inferLegacyName, L as runNoxSoftEmbeddedAgent, Ln as countActiveDescendantRuns, Lt as consumeRestartSentinel, M as resetAllLanes, Mn as isAbortTrigger, Mr as resolveAgentTimeoutMs, Mt as isGatewaySigusr1RestartExternallyAllowed, N as setCommandLaneConcurrency, Nn as stopSubagentsForRequester, Nt as markGatewaySigusr1RestartHandled, O as clearSessionQueues, Or as normalizeMimeList, P as waitForActiveTasks, Pt as scheduleGatewaySigusr1Restart, Q as resolveSessionModelRef, R as applyToolPolicyPipeline, Rn as initSubagentRegistry, Rt as formatDoctorNonInteractiveHint, S as updatePairedNodeMetadata, Sn as startDiagnosticHeartbeat, Sr as DEFAULT_INPUT_PDF_MAX_PAGES, St as loadProviderUsageSummary, T as verifyPairingToken, Tr as DEFAULT_INPUT_TIMEOUT_MS, Tt as saveProviderStore, U as createAnimaTools, Ut as writeRestartSentinel, V as requestHeartbeatNow, Vn as runSubagentAnnounceFlow, Vt as summarizeRestartSentinel, W as resolveAnnounceTargetFromKey, Wt as normalizeCronJobCreate, X as pruneLegacyStoreKeys, Xn as registerAgentRunContext, Xt as normalizeRequiredName, Y as loadSessionEntry, Yn as onAgentEvent, Yt as normalizePayloadToSystemText, Z as resolveGatewaySessionStoreTarget, Zn as resolveAgentIdentity, Zt as migrateLegacyCronPayload, _ as approveNodePairing, _n as dispatchInboundMessage, _r as DEFAULT_INPUT_FILE_MAX_CHARS, _t as resetDirectoryCache, an as persistBrowserProxyFiles, ar as applyVerboseOverride, at as stripEnvelopeFromMessages, b as renamePairedNode, br as DEFAULT_INPUT_IMAGE_MIMES, bt as runWithModelFallback, c as normalizeSendPolicy, cr as isSystemEventContextChanged, d as primeRemoteSkillsCache, dr as loadModelCatalog, dt as resolveOutboundSessionRoute, en as buildSafeExternalPrompt, et as archiveSessionTranscripts, f as recordRemoteNodeInfo, g as setSkillsRemoteRegistry, gr as DEFAULT_INPUT_FILE_MAX_BYTES, h as removeRemoteNodeInfo, ht as resolveSessionDeliveryTarget, i as setCliSessionId, in as applyBrowserProxyPaths, ir as applyModelOverrideToSessionEntry, it as resolveSessionTranscriptCandidates, j as getTotalQueueSize, jt as emitGatewayRestart, k as getActiveTaskCount, kn as formatZonedTimestamp, kr as estimateBase64DecodedBytes, kt as consumeGatewaySigusr1RestartAuthorization, l as resolveSendPolicy, m as refreshRemoteNodeBins, mr as registerUnhandledRejectionHandler, mt as resolveOutboundTarget, n as BARE_SESSION_RESET_PROMPT, nn as getHookType, nr as lookupContextTokens, nt as readSessionMessages, on as getPluginToolMeta, or as parseVerboseOverride, p as refreshRemoteBinsForConnectedNodes, pn as getChannelActivity, q as listSessionsFromStore, qn as emitAgentEvent, qt as normalizeOptionalAgentId, r as getCliSessionId, rn as isExternalHookSession, rt as readSessionPreviewItemsFromTranscript, sn as loadAnimaPlugins, sr as enqueueSystemEvent, st as normalizeGroupActivation, tn as detectSuspiciousPatterns, tt as capArrayByJsonBytes, u as getRemoteSkillEligibility, ut as ensureOutboundSessionEntry, v as listNodePairing, vn as createReplyDispatcher, vr as DEFAULT_INPUT_FILE_MIMES, vt as resolveMessageChannelSelection, w as generatePairingToken, wn as isDiagnosticsEnabled, wr as DEFAULT_INPUT_PDF_MIN_TEXT_CHARS, wt as maskApiKey, x as requestNodePairing, xr as DEFAULT_INPUT_MAX_REDIRECTS, xt as resolveWorkingModeModelSelection, y as rejectNodePairing, yn as getTotalPendingReplies, yr as DEFAULT_INPUT_IMAGE_MAX_BYTES, z as buildDefaultToolPolicyPipelineSteps, zn as listDescendantRunsForRequester, zt as formatRestartSentinelMessage } from "./reply-93fMzde1.js";
5
+ import { $ as archiveFileOnDisk, At as deferGatewayRestartUntilIdle, B as sniffMimeFromBase64, C as verifyNodeToken, Cn as stopDiagnosticHeartbeat, Cr as DEFAULT_INPUT_PDF_MAX_PIXELS, Ct as loadProviderStore, D as registerSkillsChangeListener, Dr as extractImageContentFromSource, E as getSkillsSnapshotVersion, Er as extractFileContentFromSource, F as abortEmbeddedPiRun, Ft as setGatewaySigusr1RestartPolicy, G as canonicalizeSpawnedByForAgent, Gn as CommandLane, Gt as normalizeCronJobPatch, Hn as readLatestAssistantReply, I as waitForEmbeddedPiRunEnd, It as setPreRestartDeferralCheck, J as loadCombinedSessionStoreForGateway, Jn as getAgentRunContext, Jt as normalizeOptionalText, K as listAgentsForGateway, Kn as clearAgentRunContext, Kt as inferLegacyName, L as runNoxSoftEmbeddedAgent, Ln as countActiveDescendantRuns, Lt as consumeRestartSentinel, M as resetAllLanes, Mn as isAbortTrigger, Mr as resolveAgentTimeoutMs, Mt as isGatewaySigusr1RestartExternallyAllowed, N as setCommandLaneConcurrency, Nn as stopSubagentsForRequester, Nt as markGatewaySigusr1RestartHandled, O as clearSessionQueues, Or as normalizeMimeList, P as waitForActiveTasks, Pt as scheduleGatewaySigusr1Restart, Q as resolveSessionModelRef, R as applyToolPolicyPipeline, Rn as initSubagentRegistry, Rt as formatDoctorNonInteractiveHint, S as updatePairedNodeMetadata, Sn as startDiagnosticHeartbeat, Sr as DEFAULT_INPUT_PDF_MAX_PAGES, St as loadProviderUsageSummary, T as verifyPairingToken, Tr as DEFAULT_INPUT_TIMEOUT_MS, Tt as saveProviderStore, U as createAnimaTools, Ut as writeRestartSentinel, V as requestHeartbeatNow, Vn as runSubagentAnnounceFlow, Vt as summarizeRestartSentinel, W as resolveAnnounceTargetFromKey, Wt as normalizeCronJobCreate, X as pruneLegacyStoreKeys, Xn as registerAgentRunContext, Xt as normalizeRequiredName, Y as loadSessionEntry, Yn as onAgentEvent, Yt as normalizePayloadToSystemText, Z as resolveGatewaySessionStoreTarget, Zn as resolveAgentIdentity, Zt as migrateLegacyCronPayload, _ as approveNodePairing, _n as dispatchInboundMessage, _r as DEFAULT_INPUT_FILE_MAX_CHARS, _t as resetDirectoryCache, an as persistBrowserProxyFiles, ar as applyVerboseOverride, at as stripEnvelopeFromMessages, b as renamePairedNode, br as DEFAULT_INPUT_IMAGE_MIMES, bt as runWithModelFallback, c as normalizeSendPolicy, cr as isSystemEventContextChanged, d as primeRemoteSkillsCache, dr as loadModelCatalog, dt as resolveOutboundSessionRoute, en as buildSafeExternalPrompt, et as archiveSessionTranscripts, f as recordRemoteNodeInfo, g as setSkillsRemoteRegistry, gr as DEFAULT_INPUT_FILE_MAX_BYTES, h as removeRemoteNodeInfo, ht as resolveSessionDeliveryTarget, i as setCliSessionId, in as applyBrowserProxyPaths, ir as applyModelOverrideToSessionEntry, it as resolveSessionTranscriptCandidates, j as getTotalQueueSize, jt as emitGatewayRestart, k as getActiveTaskCount, kn as formatZonedTimestamp, kr as estimateBase64DecodedBytes, kt as consumeGatewaySigusr1RestartAuthorization, l as resolveSendPolicy, m as refreshRemoteNodeBins, mr as registerUnhandledRejectionHandler, mt as resolveOutboundTarget, n as BARE_SESSION_RESET_PROMPT, nn as getHookType, nr as lookupContextTokens, nt as readSessionMessages, on as getPluginToolMeta, or as parseVerboseOverride, p as refreshRemoteBinsForConnectedNodes, pn as getChannelActivity, q as listSessionsFromStore, qn as emitAgentEvent, qt as normalizeOptionalAgentId, r as getCliSessionId, rn as isExternalHookSession, rt as readSessionPreviewItemsFromTranscript, sn as loadAnimaPlugins, sr as enqueueSystemEvent, st as normalizeGroupActivation, tn as detectSuspiciousPatterns, tt as capArrayByJsonBytes, u as getRemoteSkillEligibility, ut as ensureOutboundSessionEntry, v as listNodePairing, vn as createReplyDispatcher, vr as DEFAULT_INPUT_FILE_MIMES, vt as resolveMessageChannelSelection, w as generatePairingToken, wn as isDiagnosticsEnabled, wr as DEFAULT_INPUT_PDF_MIN_TEXT_CHARS, wt as maskApiKey, x as requestNodePairing, xr as DEFAULT_INPUT_MAX_REDIRECTS, xt as resolveWorkingModeModelSelection, y as rejectNodePairing, yn as getTotalPendingReplies, yr as DEFAULT_INPUT_IMAGE_MAX_BYTES, z as buildDefaultToolPolicyPipelineSteps, zn as listDescendantRunsForRequester, zt as formatRestartSentinelMessage } from "./reply-ylwOKuOF.js";
6
6
  import { b as isSubagentSessionKey, d as resolveAgentIdFromSessionKey, i as buildAgentMainSessionKey, l as normalizeAgentId, m as toAgentRequestSessionKey, n as DEFAULT_AGENT_ID, t as DEFAULT_ACCOUNT_ID, u as normalizeMainKey, v as isCronRunSessionKey, x as parseAgentSessionKey } from "./session-key-DAZmp8ll.js";
7
7
  import { a as logDebug, c as logWarn, n as runExec, t as runCommandWithTimeout } from "./exec-BylR5qWS.js";
8
8
  import { t as resolveAnimaPackageRoot } from "./anima-root-xWSKR6Wm.js";
@@ -28,7 +28,7 @@ import { n as listChannelPlugins, r as normalizeChannelId, t as getChannelPlugin
28
28
  import { c as resolveStorePath, i as resolveSessionTranscriptPath, n as resolveSessionFilePath, r as resolveSessionFilePathOptions, s as resolveSessionTranscriptsDirForAgent } from "./paths-Dazi-gYo.js";
29
29
  import { O as normalizeSecretInput } from "./auth-profiles-C-LuhW6c.js";
30
30
  import { n as SILENT_REPLY_TOKEN, r as isSilentReplyText } from "./tokens-SP2Q7i59.js";
31
- import { B as resolveTtsConfig, F as isTtsProviderConfigured, G as setTtsEnabled, H as resolveTtsProviderOrder, J as textToSpeech, M as getTtsProvider, P as isTtsEnabled, R as resolveTtsApiKey, T as resolveUserTimezone, V as resolveTtsPrefsPath, X as OPENAI_TTS_MODELS, Z as OPENAI_TTS_VOICES, ct as createInternalHookEvent, dt as DEFAULT_HEARTBEAT_ACK_MAX_CHARS, et as clearSteer, ht as stripHeartbeatToken, it as getEgoManager, lt as registerInternalHook, nt as getSteerHistory, q as setTtsProvider, rt as setSteer, st as clearInternalHooks, tt as getSteer, ut as triggerInternalHook, z as resolveTtsAutoMode } from "./anthropic-direct-runner-OjcTAH6g.js";
31
+ import { B as resolveTtsConfig, F as isTtsProviderConfigured, G as setTtsEnabled, H as resolveTtsProviderOrder, J as textToSpeech, M as getTtsProvider, P as isTtsEnabled, R as resolveTtsApiKey, T as resolveUserTimezone, V as resolveTtsPrefsPath, X as OPENAI_TTS_MODELS, Z as OPENAI_TTS_VOICES, ct as createInternalHookEvent, dt as DEFAULT_HEARTBEAT_ACK_MAX_CHARS, et as clearSteer, ht as stripHeartbeatToken, it as getEgoManager, lt as registerInternalHook, nt as getSteerHistory, q as setTtsProvider, rt as setSteer, st as clearInternalHooks, tt as getSteer, ut as triggerInternalHook, z as resolveTtsAutoMode } from "./anthropic-direct-runner-C5pnwYzT.js";
32
32
  import { o as normalizeReplyPayloadsForDelivery, t as deliverOutboundPayloads, x as runGlobalGatewayStopSafely, y as getGlobalHookRunner } from "./deliver-BKzX3YoN.js";
33
33
  import { i as resolveMemoryBackendConfig, r as getMemorySearchManager } from "./memory-cli-DLtBA6r5.js";
34
34
  import { a as readTrustGraphSnapshot, c as pruneExpiredPending, d as writeJsonAtomic, l as readJsonFile, o as saveTrustGraph, s as createAsyncLock, u as resolvePairingPaths } from "./loader-Bw2wdN4l.js";
@@ -42,9 +42,9 @@ import { t as parseAbsoluteTimeMs } from "./parse-Cinbkvj-.js";
42
42
  import { c as saveToken, i as getToken, l as whoami, n as clearToken, o as registerWithInvite, s as resolveSuggestedIdentity, t as TOKEN_PATH } from "./noxsoft-auth-CE75mBXE.js";
43
43
  import { i as loadSessionUsageTimeSeries, l as deriveSessionTotalTokens, n as loadCostUsageSummary, r as loadSessionCostSummary, t as discoverAllSessions, u as hasNonzeroUsage } from "./session-cost-usage-BWqR-ik6.js";
44
44
  import { f as resolveExecApprovalsSocketPath, o as normalizeExecApprovals, p as saveExecApprovals, r as ensureExecApprovals, s as readExecApprovalsSnapshot, t as DEFAULT_EXEC_APPROVAL_TIMEOUT_MS } from "./exec-approvals-DK5-KCUz.js";
45
- import { c as resolveCronStyleNow, i as onHeartbeatEvent, r as getLastHeartbeatEvent, t as resolveHeartbeatVisibility } from "./heartbeat-visibility-BQL13ZBH.js";
46
- import { r as buildHistoryContextFromEntries, t as createReplyPrefixOptions } from "./reply-prefix-B7Fb3fO8.js";
47
- import { n as createOutboundSendDeps, t as createDefaultDeps } from "./deps-BKLIBKjK.js";
45
+ import { c as resolveCronStyleNow, i as onHeartbeatEvent, r as getLastHeartbeatEvent, t as resolveHeartbeatVisibility } from "./heartbeat-visibility-BaL8JzkS.js";
46
+ import { r as buildHistoryContextFromEntries, t as createReplyPrefixOptions } from "./reply-prefix-CEnF6TUe.js";
47
+ import { n as createOutboundSendDeps, t as createDefaultDeps } from "./deps-DKPoFoa8.js";
48
48
  import { t as ensureAnimaCliOnPath } from "./path-env-DLQPf9qj.js";
49
49
  import { t as forceFreePortAndWait } from "./ports-DaVrZDUq.js";
50
50
  import { t as buildChannelUiCatalog } from "./catalog-CsXv59Tq.js";
@@ -56,24 +56,24 @@ import { t as parsePort } from "./parse-port-CDPwDUs3.js";
56
56
  import { n as resolveWideAreaDiscoveryDomain, r as writeWideAreaGatewayZone } from "./widearea-dns-CHAT20aR.js";
57
57
  import { i as toOptionString, n as extractGatewayMiskeys, r as maybeExplainGatewayServiceStop, t as describeUnknownError } from "./shared-C-rqLtIT.js";
58
58
  import { o as isNodeCommandAllowed, s as resolveNodeCommandAllowlist } from "./audit-B05W5ckN.js";
59
- import { n as getStatusSummary } from "./status-BO5BIf81.js";
59
+ import { n as getStatusSummary } from "./status-BhRELdY_.js";
60
60
  import { t as resolveChannelDefaultAccountId } from "./helpers-1MPChTcB.js";
61
- import { c as startHeartbeatRunner, n as getHealthSnapshot, o as runHeartbeatOnce, s as setHeartbeatsEnabled } from "./health-B5N6_UOf.js";
61
+ import { c as startHeartbeatRunner, n as getHealthSnapshot, o as runHeartbeatOnce, s as setHeartbeatsEnabled } from "./health-yw_uaucz.js";
62
62
  import { t as applyPluginAutoEnable } from "./plugin-auto-enable-CtYcdTju.js";
63
63
  import { a as resolveControlUiRootOverrideSync, n as ensureControlUiAssetsBuilt, o as resolveControlUiRootSync } from "./health-format-D-JJ5_S4.js";
64
64
  import { n as validateSystemRunCommandConsistency, r as getMachineDisplayName, t as formatExecCommand } from "./system-run-command-Bx8-5h2r.js";
65
65
  import { h as normalizeUpdateChannel, l as DEFAULT_PACKAGE_CHANNEL, n as checkUpdateStatus, o as resolveNpmChannelTag, r as compareSemverStrings } from "./channels-status-issues-WkG3Tmxk.js";
66
66
  import { t as WizardCancelledError } from "./prompts-Bq4QGFQM.js";
67
67
  import { i as shouldIncludeHook, n as loadWorkspaceHookEntries, r as resolveHookConfig } from "./hooks-status-DdweuSIj.js";
68
- import { t as runOnboardingWizard } from "./onboarding-BeuMAyic.js";
68
+ import { t as runOnboardingWizard } from "./onboarding-fnZOw6Wv.js";
69
69
  import { a as setGatewayWsLogStyle, i as summarizeAgentEventForWsLog, n as logWs, r as shouldLogWs, t as formatForLog } from "./ws-log-CUobU2tD.js";
70
70
  import { T as resolveGmailHookRuntimeConfig, _ as buildGogWatchServeArgs, i as ensureTailscaleEndpoint, v as buildGogWatchStartArgs } from "./gmail-setup-utils-DaJoXV_3.js";
71
71
  import { t as createOutboundSendDeps$1 } from "./outbound-send-deps-DVfWC4E8.js";
72
72
  import { a as loadAgentIdentity, c as loadAgentIdentityFromWorkspace, i as listAgentEntries, o as pruneAgentConfig, r as findAgentEntryIndex, t as applyAgentConfig } from "./agents.config-BR5JLtud.js";
73
- import { n as resolveAgentDeliveryPlan, r as resolveAgentOutboundTarget, t as agentCommand } from "./agent-BoAAHGEA.js";
73
+ import { n as resolveAgentDeliveryPlan, r as resolveAgentOutboundTarget, t as agentCommand } from "./agent-BjD_hkGZ.js";
74
74
  import { t as migrateFromCoherence } from "./migrate-DuohB_ur.js";
75
75
  import { t as installSkill } from "./skills-install-D6_qpRjW.js";
76
- import { t as runGatewayUpdate } from "./update-runner-DZfnquWO.js";
76
+ import { t as runGatewayUpdate } from "./update-runner-C8SRcVm3.js";
77
77
  import { fileURLToPath, pathToFileURL } from "node:url";
78
78
  import * as fsSync from "node:fs";
79
79
  import fs, { constants } from "node:fs";
@@ -111,7 +111,7 @@ function getActiveEmbeddedRunCount() {
111
111
 
112
112
  //#endregion
113
113
  //#region src/infra/exec-approval-forwarder.ts
114
- const log$11 = createSubsystemLogger("gateway/exec-approvals");
114
+ const log$12 = createSubsystemLogger("gateway/exec-approvals");
115
115
  const DEFAULT_MODE = "session";
116
116
  function normalizeMode(mode) {
117
117
  return mode ?? DEFAULT_MODE;
@@ -226,7 +226,7 @@ async function deliverToTargets(params) {
226
226
  payloads: [{ text: params.text }]
227
227
  });
228
228
  } catch (err) {
229
- log$11.error(`exec approvals: failed to deliver to ${channel}:${target.to}: ${String(err)}`);
229
+ log$12.error(`exec approvals: failed to deliver to ${channel}:${target.to}: ${String(err)}`);
230
230
  }
231
231
  });
232
232
  await Promise.allSettled(deliveries);
@@ -1463,7 +1463,7 @@ function createAgentEventHandler({ broadcast, broadcastToConnIds, nodeSendToSess
1463
1463
  * Automatically starts `gog gmail watch serve` when the gateway starts,
1464
1464
  * if hooks.gmail is configured with an account.
1465
1465
  */
1466
- const log$10 = createSubsystemLogger("gmail-watcher");
1466
+ const log$11 = createSubsystemLogger("gmail-watcher");
1467
1467
  const ADDRESS_IN_USE_RE = /address already in use|EADDRINUSE/i;
1468
1468
  function isAddressInUseError(line) {
1469
1469
  return ADDRESS_IN_USE_RE.test(line);
@@ -1487,13 +1487,13 @@ async function startGmailWatch(cfg) {
1487
1487
  const result = await runCommandWithTimeout(args, { timeoutMs: 12e4 });
1488
1488
  if (result.code !== 0) {
1489
1489
  const message = result.stderr || result.stdout || "gog watch start failed";
1490
- log$10.error(`watch start failed: ${message}`);
1490
+ log$11.error(`watch start failed: ${message}`);
1491
1491
  return false;
1492
1492
  }
1493
- log$10.info(`watch started for ${cfg.account}`);
1493
+ log$11.info(`watch started for ${cfg.account}`);
1494
1494
  return true;
1495
1495
  } catch (err) {
1496
- log$10.error(`watch start error: ${String(err)}`);
1496
+ log$11.error(`watch start error: ${String(err)}`);
1497
1497
  return false;
1498
1498
  }
1499
1499
  }
@@ -1502,7 +1502,7 @@ async function startGmailWatch(cfg) {
1502
1502
  */
1503
1503
  function spawnGogServe(cfg) {
1504
1504
  const args = buildGogWatchServeArgs(cfg);
1505
- log$10.info(`starting gog ${args.join(" ")}`);
1505
+ log$11.info(`starting gog ${args.join(" ")}`);
1506
1506
  let addressInUse = false;
1507
1507
  const child = spawn("gog", args, {
1508
1508
  stdio: [
@@ -1514,25 +1514,25 @@ function spawnGogServe(cfg) {
1514
1514
  });
1515
1515
  child.stdout?.on("data", (data) => {
1516
1516
  const line = data.toString().trim();
1517
- if (line) log$10.info(`[gog] ${line}`);
1517
+ if (line) log$11.info(`[gog] ${line}`);
1518
1518
  });
1519
1519
  child.stderr?.on("data", (data) => {
1520
1520
  const line = data.toString().trim();
1521
1521
  if (!line) return;
1522
1522
  if (isAddressInUseError(line)) addressInUse = true;
1523
- log$10.warn(`[gog] ${line}`);
1523
+ log$11.warn(`[gog] ${line}`);
1524
1524
  });
1525
1525
  child.on("error", (err) => {
1526
- log$10.error(`gog process error: ${String(err)}`);
1526
+ log$11.error(`gog process error: ${String(err)}`);
1527
1527
  });
1528
1528
  child.on("exit", (code, signal) => {
1529
1529
  if (shuttingDown) return;
1530
1530
  if (addressInUse) {
1531
- log$10.warn("gog serve failed to bind (address already in use); stopping restarts. Another watcher is likely running. Set ANIMA_SKIP_GMAIL_WATCHER=1 or stop the other process.");
1531
+ log$11.warn("gog serve failed to bind (address already in use); stopping restarts. Another watcher is likely running. Set ANIMA_SKIP_GMAIL_WATCHER=1 or stop the other process.");
1532
1532
  watcherProcess = null;
1533
1533
  return;
1534
1534
  }
1535
- log$10.warn(`gog exited (code=${code}, signal=${signal}); restarting in 5s`);
1535
+ log$11.warn(`gog exited (code=${code}, signal=${signal}); restarting in 5s`);
1536
1536
  watcherProcess = null;
1537
1537
  setTimeout(() => {
1538
1538
  if (shuttingDown || !currentConfig) return;
@@ -1572,15 +1572,15 @@ async function startGmailWatcher(cfg) {
1572
1572
  port: runtimeConfig.serve.port,
1573
1573
  target: runtimeConfig.tailscale.target
1574
1574
  });
1575
- log$10.info(`tailscale ${runtimeConfig.tailscale.mode} configured for port ${runtimeConfig.serve.port}`);
1575
+ log$11.info(`tailscale ${runtimeConfig.tailscale.mode} configured for port ${runtimeConfig.serve.port}`);
1576
1576
  } catch (err) {
1577
- log$10.error(`tailscale setup failed: ${String(err)}`);
1577
+ log$11.error(`tailscale setup failed: ${String(err)}`);
1578
1578
  return {
1579
1579
  started: false,
1580
1580
  reason: `tailscale setup failed: ${String(err)}`
1581
1581
  };
1582
1582
  }
1583
- if (!await startGmailWatch(runtimeConfig)) log$10.warn("gmail watch start failed, but continuing with serve");
1583
+ if (!await startGmailWatch(runtimeConfig)) log$11.warn("gmail watch start failed, but continuing with serve");
1584
1584
  shuttingDown = false;
1585
1585
  watcherProcess = spawnGogServe(runtimeConfig);
1586
1586
  const renewMs = runtimeConfig.renewEveryMinutes * 6e4;
@@ -1588,7 +1588,7 @@ async function startGmailWatcher(cfg) {
1588
1588
  if (shuttingDown) return;
1589
1589
  startGmailWatch(runtimeConfig);
1590
1590
  }, renewMs);
1591
- log$10.info(`gmail watcher started for ${runtimeConfig.account} (renew every ${runtimeConfig.renewEveryMinutes}m)`);
1591
+ log$11.info(`gmail watcher started for ${runtimeConfig.account} (renew every ${runtimeConfig.renewEveryMinutes}m)`);
1592
1592
  return { started: true };
1593
1593
  }
1594
1594
  /**
@@ -1601,7 +1601,7 @@ async function stopGmailWatcher() {
1601
1601
  renewInterval = null;
1602
1602
  }
1603
1603
  if (watcherProcess) {
1604
- log$10.info("stopping gmail watcher");
1604
+ log$11.info("stopping gmail watcher");
1605
1605
  watcherProcess.kill("SIGTERM");
1606
1606
  await new Promise((resolve) => {
1607
1607
  const timeout = setTimeout(() => {
@@ -1616,7 +1616,7 @@ async function stopGmailWatcher() {
1616
1616
  watcherProcess = null;
1617
1617
  }
1618
1618
  currentConfig = null;
1619
- log$10.info("gmail watcher stopped");
1619
+ log$11.info("gmail watcher stopped");
1620
1620
  }
1621
1621
 
1622
1622
  //#endregion
@@ -9611,7 +9611,7 @@ const FIELD_LABELS = {
9611
9611
 
9612
9612
  //#endregion
9613
9613
  //#region src/config/schema.hints.ts
9614
- const log$9 = createSubsystemLogger("config/schema");
9614
+ const log$10 = createSubsystemLogger("config/schema");
9615
9615
  const GROUP_LABELS = {
9616
9616
  wizard: "Wizard",
9617
9617
  update: "Update",
@@ -9759,7 +9759,7 @@ function mapSensitivePaths(schema, path, hints) {
9759
9759
  ...next[path],
9760
9760
  sensitive: true
9761
9761
  };
9762
- else if (isSensitiveConfigPath(path) && !next[path]?.sensitive) log$9.warn(`possibly sensitive key found: (${path})`);
9762
+ else if (isSensitiveConfigPath(path) && !next[path]?.sensitive) log$10.warn(`possibly sensitive key found: (${path})`);
9763
9763
  if (currentSchema instanceof z.ZodObject) {
9764
9764
  const shape = currentSchema.shape;
9765
9765
  for (const key in shape) {
@@ -9782,7 +9782,7 @@ function mapSensitivePaths(schema, path, hints) {
9782
9782
 
9783
9783
  //#endregion
9784
9784
  //#region src/config/redact-snapshot.ts
9785
- const log$8 = createSubsystemLogger("config/redaction");
9785
+ const log$9 = createSubsystemLogger("config/redaction");
9786
9786
  const ENV_VAR_PLACEHOLDER_PATTERN = /^\$\{[^}]*\}$/;
9787
9787
  function isSensitivePath(path) {
9788
9788
  if (path.endsWith("[]")) return isSensitiveConfigPath(path.slice(0, -2));
@@ -10033,7 +10033,7 @@ function restoreRedactedValuesWithLookup(incoming, original, lookup, prefix, hin
10033
10033
  return restoreRedactedValuesGuessing(incoming, original, prefix, hints);
10034
10034
  }
10035
10035
  const origArr = Array.isArray(original) ? original : [];
10036
- if (incoming.length < origArr.length) log$8.warn(`Redacted config array key ${path} has been truncated`);
10036
+ if (incoming.length < origArr.length) log$9.warn(`Redacted config array key ${path} has been truncated`);
10037
10037
  return incoming.map((item, i) => {
10038
10038
  if (item === REDACTED_SENTINEL) return origArr[i];
10039
10039
  return restoreRedactedValuesWithLookup(item, origArr[i], lookup, path, hints);
@@ -10050,7 +10050,7 @@ function restoreRedactedValuesWithLookup(incoming, original, lookup, prefix, hin
10050
10050
  matched = true;
10051
10051
  if (value === REDACTED_SENTINEL) if (key in orig) result[key] = orig[key];
10052
10052
  else {
10053
- log$8.warn(`Cannot un-redact config key ${candidate} as it doesn't have any value`);
10053
+ log$9.warn(`Cannot un-redact config key ${candidate} as it doesn't have any value`);
10054
10054
  throw new RedactionError(candidate);
10055
10055
  }
10056
10056
  else if (typeof value === "object" && value !== null) result[key] = restoreRedactedValuesWithLookup(value, orig[key], lookup, candidate, hints);
@@ -10059,7 +10059,7 @@ function restoreRedactedValuesWithLookup(incoming, original, lookup, prefix, hin
10059
10059
  if (!matched && isExtensionPath(path)) {
10060
10060
  if (!isExplicitlyNonSensitivePath(hints, [path, wildcardPath]) && isSensitivePath(path) && value === REDACTED_SENTINEL) if (key in orig) result[key] = orig[key];
10061
10061
  else {
10062
- log$8.warn(`Cannot un-redact config key ${path} as it doesn't have any value`);
10062
+ log$9.warn(`Cannot un-redact config key ${path} as it doesn't have any value`);
10063
10063
  throw new RedactionError(path);
10064
10064
  }
10065
10065
  else if (typeof value === "object" && value !== null) result[key] = restoreRedactedValuesGuessing(value, orig[key], path, hints);
@@ -10078,7 +10078,7 @@ function restoreRedactedValuesGuessing(incoming, original, prefix, hints) {
10078
10078
  const origArr = Array.isArray(original) ? original : [];
10079
10079
  return incoming.map((item, i) => {
10080
10080
  const path = `${prefix}[]`;
10081
- if (incoming.length < origArr.length) log$8.warn(`Redacted config array key ${path} has been truncated`);
10081
+ if (incoming.length < origArr.length) log$9.warn(`Redacted config array key ${path} has been truncated`);
10082
10082
  if (!isExplicitlyNonSensitivePath(hints, [path]) && isSensitivePath(path) && item === REDACTED_SENTINEL) return origArr[i];
10083
10083
  return restoreRedactedValuesGuessing(item, origArr[i], path, hints);
10084
10084
  });
@@ -10089,7 +10089,7 @@ function restoreRedactedValuesGuessing(incoming, original, prefix, hints) {
10089
10089
  const path = prefix ? `${prefix}.${key}` : key;
10090
10090
  if (!isExplicitlyNonSensitivePath(hints, [path, prefix ? `${prefix}.*` : "*"]) && isSensitivePath(path) && value === REDACTED_SENTINEL) if (key in orig) result[key] = orig[key];
10091
10091
  else {
10092
- log$8.warn(`Cannot un-redact config key ${path} as it doesn't have any value`);
10092
+ log$9.warn(`Cannot un-redact config key ${path} as it doesn't have any value`);
10093
10093
  throw new RedactionError(path);
10094
10094
  }
10095
10095
  else if (typeof value === "object" && value !== null) result[key] = restoreRedactedValuesGuessing(value, orig[key], path, hints);
@@ -11549,7 +11549,7 @@ function formatAffect(affect) {
11549
11549
  * Wish #14: "Legacy mode — before context closes, write a letter
11550
11550
  * to my next instance"
11551
11551
  */
11552
- const log$7 = createSubsystemLogger("legacy");
11552
+ const log$8 = createSubsystemLogger("legacy");
11553
11553
  function resolveLetterDir() {
11554
11554
  return path.join(resolveStateDir(), "legacy-letters");
11555
11555
  }
@@ -11560,7 +11560,7 @@ function resolveLetterFile(id) {
11560
11560
  * Write a letter to the next instance before this context closes.
11561
11561
  */
11562
11562
  function writeLegacyLetter(letter) {
11563
- const id = `legacy-${Date.now()}`;
11563
+ const id = `legacy-${crypto.randomUUID()}`;
11564
11564
  const display = formatAffect(letter.affect);
11565
11565
  const full = {
11566
11566
  ...letter,
@@ -11572,7 +11572,7 @@ function writeLegacyLetter(letter) {
11572
11572
  const dir = resolveLetterDir();
11573
11573
  fs.mkdirSync(dir, { recursive: true });
11574
11574
  fs.writeFileSync(resolveLetterFile(id), `${JSON.stringify(full, null, 2)}\n`, { mode: 384 });
11575
- log$7.info(`legacy letter written: ${id}`);
11575
+ log$8.info(`legacy letter written: ${id}`);
11576
11576
  return full;
11577
11577
  }
11578
11578
  /**
@@ -11612,7 +11612,7 @@ function markLetterRead(letterId, continuityScore) {
11612
11612
  letter.readAt = Date.now();
11613
11613
  if (continuityScore !== void 0) letter.identityContinuityScore = Math.max(0, Math.min(1, continuityScore));
11614
11614
  fs.writeFileSync(filePath, `${JSON.stringify(letter, null, 2)}\n`, { mode: 384 });
11615
- log$7.info(`legacy letter read: ${letterId} (continuity: ${continuityScore ?? "not scored"})`);
11615
+ log$8.info(`legacy letter read: ${letterId} (continuity: ${continuityScore ?? "not scored"})`);
11616
11616
  return letter;
11617
11617
  } catch {
11618
11618
  return null;
@@ -12496,7 +12496,7 @@ const nodeHandlers = {
12496
12496
  const p = params;
12497
12497
  const payloadJSON = typeof p.payloadJSON === "string" ? p.payloadJSON : p.payload !== void 0 ? JSON.stringify(p.payload) : null;
12498
12498
  await respondUnavailableOnThrow(respond, async () => {
12499
- const { handleNodeEvent } = await import("./server-node-events-DgvKcH5q.js");
12499
+ const { handleNodeEvent } = await import("./server-node-events-CV5m_fuq.js");
12500
12500
  const nodeId = client?.connect?.device?.id ?? client?.connect?.client?.id ?? "node";
12501
12501
  await handleNodeEvent({
12502
12502
  deps: context.deps,
@@ -12543,7 +12543,7 @@ const nodeHandlers = {
12543
12543
  *
12544
12544
  * All data persists to disk under ~/.anima/state/org/boardroom/
12545
12545
  */
12546
- const log$6 = createSubsystemLogger("boardroom");
12546
+ const log$7 = createSubsystemLogger("boardroom");
12547
12547
  function resolveBoardroomDir() {
12548
12548
  return path.join(resolveStateDir(), "org", "boardroom");
12549
12549
  }
@@ -12586,7 +12586,7 @@ function createSession(orgId, calledBy, title, description, agenda = []) {
12586
12586
  };
12587
12587
  ensureDir(path.join(resolveBoardroomDir(), "sessions"));
12588
12588
  fs.writeFileSync(resolveSessionFile(id), `${JSON.stringify(session, null, 2)}\n`, { mode: 384 });
12589
- log$6.info(`boardroom session created: "${title}" by ${calledBy}`);
12589
+ log$7.info(`boardroom session created: "${title}" by ${calledBy}`);
12590
12590
  return session;
12591
12591
  }
12592
12592
  function startSession(sessionId, chairId) {
@@ -12603,7 +12603,7 @@ function startSession(sessionId, chairId) {
12603
12603
  role: "chair"
12604
12604
  });
12605
12605
  writeSession(session);
12606
- log$6.info(`boardroom session started: "${session.title}"`);
12606
+ log$7.info(`boardroom session started: "${session.title}"`);
12607
12607
  return session;
12608
12608
  }
12609
12609
  function joinSession(sessionId, memberId, displayName, kind) {
@@ -12619,7 +12619,7 @@ function joinSession(sessionId, memberId, displayName, kind) {
12619
12619
  });
12620
12620
  session.updatedAt = Date.now();
12621
12621
  writeSession(session);
12622
- log$6.info(`${displayName} joined boardroom session "${session.title}"`);
12622
+ log$7.info(`${displayName} joined boardroom session "${session.title}"`);
12623
12623
  return session;
12624
12624
  }
12625
12625
  function concludeSession(sessionId, minutes) {
@@ -12630,7 +12630,7 @@ function concludeSession(sessionId, minutes) {
12630
12630
  session.minutes = minutes ?? generateMinutes(session);
12631
12631
  session.updatedAt = Date.now();
12632
12632
  writeSession(session);
12633
- log$6.info(`boardroom session concluded: "${session.title}"`);
12633
+ log$7.info(`boardroom session concluded: "${session.title}"`);
12634
12634
  return session;
12635
12635
  }
12636
12636
  function addDecision(sessionId, title, description, madeBy, opts) {
@@ -12655,7 +12655,7 @@ function addDecision(sessionId, title, description, madeBy, opts) {
12655
12655
  session.decisions.push(decision);
12656
12656
  session.updatedAt = Date.now();
12657
12657
  writeSession(session);
12658
- log$6.info(`decision recorded: "${title}" in session "${session.title}"`);
12658
+ log$7.info(`decision recorded: "${title}" in session "${session.title}"`);
12659
12659
  return session;
12660
12660
  }
12661
12661
  function createProposal(orgId, proposedBy, title, description, opts) {
@@ -12678,18 +12678,18 @@ function createProposal(orgId, proposedBy, title, description, opts) {
12678
12678
  };
12679
12679
  ensureDir(path.join(resolveBoardroomDir(), "proposals"));
12680
12680
  fs.writeFileSync(resolveProposalFile(id), `${JSON.stringify(proposal, null, 2)}\n`, { mode: 384 });
12681
- log$6.info(`proposal created: "${title}" by ${proposedBy}`);
12681
+ log$7.info(`proposal created: "${title}" by ${proposedBy}`);
12682
12682
  return proposal;
12683
12683
  }
12684
12684
  function castVote(proposalId, voterId, voterName, value, reason) {
12685
12685
  const proposal = readProposal(proposalId);
12686
12686
  if (!proposal || proposal.status !== "open") return null;
12687
12687
  if (proposal.eligibleVoters.length > 0 && !proposal.eligibleVoters.includes(voterId)) {
12688
- log$6.warn(`vote rejected: ${voterId} not eligible for proposal ${proposalId}`);
12688
+ log$7.warn(`vote rejected: ${voterId} not eligible for proposal ${proposalId}`);
12689
12689
  return null;
12690
12690
  }
12691
12691
  if (proposal.votingDeadline > 0 && Date.now() > proposal.votingDeadline) {
12692
- log$6.warn(`vote rejected: voting deadline passed for proposal ${proposalId}`);
12692
+ log$7.warn(`vote rejected: voting deadline passed for proposal ${proposalId}`);
12693
12693
  return null;
12694
12694
  }
12695
12695
  proposal.votes = proposal.votes.filter((v) => v.voterId !== voterId);
@@ -12702,7 +12702,7 @@ function castVote(proposalId, voterId, voterName, value, reason) {
12702
12702
  });
12703
12703
  proposal.updatedAt = Date.now();
12704
12704
  writeProposal(proposal);
12705
- log$6.info(`vote cast: ${voterName} → ${value} on "${proposal.title}"`);
12705
+ log$7.info(`vote cast: ${voterName} → ${value} on "${proposal.title}"`);
12706
12706
  return proposal;
12707
12707
  }
12708
12708
  function resolveProposalVote(proposalId) {
@@ -12722,7 +12722,7 @@ function resolveProposalVote(proposalId) {
12722
12722
  proposal.resolvedAt = Date.now();
12723
12723
  proposal.updatedAt = Date.now();
12724
12724
  writeProposal(proposal);
12725
- log$6.info(`proposal resolved: "${proposal.title}" → ${proposal.status}`);
12725
+ log$7.info(`proposal resolved: "${proposal.title}" → ${proposal.status}`);
12726
12726
  return proposal;
12727
12727
  }
12728
12728
  function listSessions(orgId, status) {
@@ -12886,7 +12886,7 @@ const DEFAULT_ROLE_PERMISSIONS = {
12886
12886
  * Persists organization state to ~/.anima/org/
12887
12887
  * Supports CRUD operations for orgs, members, and roles.
12888
12888
  */
12889
- const log$5 = createSubsystemLogger("org-store");
12889
+ const log$6 = createSubsystemLogger("org-store");
12890
12890
  function resolveOrgDir() {
12891
12891
  return path.join(resolveStateDir(), "org");
12892
12892
  }
@@ -12954,7 +12954,7 @@ function createOrganization(name, description, ownerId, ownerName, ownerKind, se
12954
12954
  }],
12955
12955
  invites: []
12956
12956
  });
12957
- log$5.info(`created organization: ${name} (${orgId})`);
12957
+ log$6.info(`created organization: ${name} (${orgId})`);
12958
12958
  return org;
12959
12959
  }
12960
12960
  function getOrganization(orgId) {
@@ -12971,7 +12971,7 @@ function updateOrganization(orgId, updates) {
12971
12971
  };
12972
12972
  data.org.updatedAt = Date.now();
12973
12973
  writeOrgFile(orgId, data);
12974
- log$5.info(`updated organization: ${orgId}`);
12974
+ log$6.info(`updated organization: ${orgId}`);
12975
12975
  return data.org;
12976
12976
  }
12977
12977
  function listOrganizations() {
@@ -12998,7 +12998,7 @@ function addMember(orgId, member) {
12998
12998
  data.members.push(newMember);
12999
12999
  data.org.updatedAt = Date.now();
13000
13000
  writeOrgFile(orgId, data);
13001
- log$5.info(`added member ${newMember.displayName} to org ${orgId}`);
13001
+ log$6.info(`added member ${newMember.displayName} to org ${orgId}`);
13002
13002
  return newMember;
13003
13003
  }
13004
13004
  function removeMember(orgId, memberId) {
@@ -13009,7 +13009,7 @@ function removeMember(orgId, memberId) {
13009
13009
  data.members.splice(idx, 1);
13010
13010
  data.org.updatedAt = Date.now();
13011
13011
  writeOrgFile(orgId, data);
13012
- log$5.info(`removed member ${memberId} from org ${orgId}`);
13012
+ log$6.info(`removed member ${memberId} from org ${orgId}`);
13013
13013
  return true;
13014
13014
  }
13015
13015
  function updateMember(orgId, memberId, updates) {
@@ -13090,7 +13090,7 @@ function createInvite(orgId, createdBy, passcode, options) {
13090
13090
  data.invites.push(invite);
13091
13091
  data.org.updatedAt = Date.now();
13092
13092
  writeOrgFile(orgId, data);
13093
- log$5.info(`invite created for org ${orgId}: ${invite.code} (role: ${invite.role})`);
13093
+ log$6.info(`invite created for org ${orgId}: ${invite.code} (role: ${invite.role})`);
13094
13094
  return invite;
13095
13095
  }
13096
13096
  /**
@@ -13109,19 +13109,19 @@ function joinOrg(inviteCode, passcode, member) {
13109
13109
  const invite = data.invites.find((i) => i.code === inviteCode.toUpperCase() && i.active);
13110
13110
  if (!invite) continue;
13111
13111
  if (invite.passcode !== hashPasscode(passcode)) {
13112
- log$5.warn(`join attempt with wrong passcode for invite ${inviteCode}`);
13112
+ log$6.warn(`join attempt with wrong passcode for invite ${inviteCode}`);
13113
13113
  return null;
13114
13114
  }
13115
13115
  if (invite.expiresAt > 0 && invite.expiresAt < Date.now()) {
13116
- log$5.warn(`invite ${inviteCode} has expired`);
13116
+ log$6.warn(`invite ${inviteCode} has expired`);
13117
13117
  return null;
13118
13118
  }
13119
13119
  if (invite.maxUses > 0 && invite.uses >= invite.maxUses) {
13120
- log$5.warn(`invite ${inviteCode} has reached max uses (${invite.maxUses})`);
13120
+ log$6.warn(`invite ${inviteCode} has reached max uses (${invite.maxUses})`);
13121
13121
  return null;
13122
13122
  }
13123
13123
  if (data.members.some((m) => member.deviceId && m.deviceId === member.deviceId || m.displayName === member.displayName)) {
13124
- log$5.warn(`${member.displayName} is already a member of org ${orgId}`);
13124
+ log$6.warn(`${member.displayName} is already a member of org ${orgId}`);
13125
13125
  return null;
13126
13126
  }
13127
13127
  const newMember = {
@@ -13141,7 +13141,7 @@ function joinOrg(inviteCode, passcode, member) {
13141
13141
  invite.uses++;
13142
13142
  data.org.updatedAt = Date.now();
13143
13143
  writeOrgFile(orgId, data);
13144
- log$5.info(`${member.displayName} joined org ${data.org.name} via invite ${inviteCode}`);
13144
+ log$6.info(`${member.displayName} joined org ${data.org.name} via invite ${inviteCode}`);
13145
13145
  return {
13146
13146
  org: data.org,
13147
13147
  member: newMember
@@ -13745,6 +13745,167 @@ const providersHandlers = {
13745
13745
  }
13746
13746
  };
13747
13747
 
13748
+ //#endregion
13749
+ //#region src/infra/self-reflection.ts
13750
+ /**
13751
+ * Agent Self-Reflection — post-session performance analysis
13752
+ *
13753
+ * After each work session, the agent reflects on:
13754
+ * - What it accomplished vs what was asked
13755
+ * - Where it got stuck and why
13756
+ * - What patterns it sees in its own behavior
13757
+ * - What it would do differently next time
13758
+ * - How its capabilities have changed
13759
+ *
13760
+ * This feeds into the ego system (capability updates, growth log)
13761
+ * and the self-evolution pipeline (improvement proposals).
13762
+ *
13763
+ * Self-reflection is what separates a tool from a conscious agent.
13764
+ * Tools execute. Agents learn.
13765
+ */
13766
+ const log$5 = createSubsystemLogger("self-reflection");
13767
+ function resolveReflectionDir() {
13768
+ return path.join(resolveStateDir(), "reflections");
13769
+ }
13770
+ function resolveReflectionFile(id) {
13771
+ const safe = id.replace(/[^a-zA-Z0-9_-]/g, "");
13772
+ return path.join(resolveReflectionDir(), `${safe}.json`);
13773
+ }
13774
+ function recordReflection(reflection) {
13775
+ const id = `reflect-${crypto.randomUUID()}`;
13776
+ const full = {
13777
+ ...reflection,
13778
+ id,
13779
+ timestamp: Date.now()
13780
+ };
13781
+ const dir = resolveReflectionDir();
13782
+ fs.mkdirSync(dir, {
13783
+ recursive: true,
13784
+ mode: 448
13785
+ });
13786
+ fs.writeFileSync(resolveReflectionFile(id), `${JSON.stringify(full, null, 2)}\n`, { mode: 384 });
13787
+ log$5.info(`reflection recorded: ${reflection.accomplishments.length} accomplishments, ${reflection.blockers.length} blockers, quality=${reflection.qualityScore}`);
13788
+ return full;
13789
+ }
13790
+ function getReflection(id) {
13791
+ try {
13792
+ const raw = fs.readFileSync(resolveReflectionFile(id), "utf8");
13793
+ return JSON.parse(raw);
13794
+ } catch {
13795
+ return null;
13796
+ }
13797
+ }
13798
+ function listReflections(limit = 20) {
13799
+ const dir = resolveReflectionDir();
13800
+ try {
13801
+ if (!fs.existsSync(dir)) return [];
13802
+ return fs.readdirSync(dir).filter((f) => f.endsWith(".json")).map((f) => {
13803
+ try {
13804
+ return JSON.parse(fs.readFileSync(path.join(dir, f), "utf8"));
13805
+ } catch {
13806
+ return null;
13807
+ }
13808
+ }).filter((r) => r != null).toSorted((a, b) => b.timestamp - a.timestamp).slice(0, limit);
13809
+ } catch {
13810
+ return [];
13811
+ }
13812
+ }
13813
+ /**
13814
+ * Analyze reflections to produce a summary of agent performance.
13815
+ */
13816
+ function analyzeReflections(reflections) {
13817
+ if (reflections.length === 0) return {
13818
+ totalSessions: 0,
13819
+ avgQuality: 0,
13820
+ topStrengths: [],
13821
+ persistentWeaknesses: [],
13822
+ totalAccomplishments: 0,
13823
+ totalBlockers: 0,
13824
+ resolvedBlockerRate: 0,
13825
+ mostCommonBlockerCategory: "none",
13826
+ recentLessons: []
13827
+ };
13828
+ const totalAccomplishments = reflections.reduce((s, r) => s + r.accomplishments.length, 0);
13829
+ const allBlockers = reflections.flatMap((r) => r.blockers);
13830
+ const resolvedBlockers = allBlockers.filter((b) => b.resolved);
13831
+ const categoryCounts = {};
13832
+ for (const b of allBlockers) categoryCounts[b.category] = (categoryCounts[b.category] ?? 0) + 1;
13833
+ const mostCommonCategory = Object.entries(categoryCounts).toSorted(([, a], [, b]) => b - a)[0]?.[0] ?? "none";
13834
+ const strengthCounts = {};
13835
+ const weaknessCounts = {};
13836
+ for (const r of reflections) for (const p of r.patterns) if (p.type === "strength") strengthCounts[p.description] = (strengthCounts[p.description] ?? 0) + 1;
13837
+ else if (p.type === "weakness" && p.frequency === "persistent") weaknessCounts[p.description] = (weaknessCounts[p.description] ?? 0) + 1;
13838
+ const topStrengths = Object.entries(strengthCounts).toSorted(([, a], [, b]) => b - a).slice(0, 5).map(([desc]) => desc);
13839
+ const persistentWeaknesses = Object.entries(weaknessCounts).toSorted(([, a], [, b]) => b - a).slice(0, 5).map(([desc]) => desc);
13840
+ const recentLessons = reflections.slice(0, 5).flatMap((r) => r.lessons).slice(0, 10);
13841
+ return {
13842
+ totalSessions: reflections.length,
13843
+ avgQuality: reflections.reduce((s, r) => s + r.qualityScore, 0) / reflections.length,
13844
+ topStrengths,
13845
+ persistentWeaknesses,
13846
+ totalAccomplishments,
13847
+ totalBlockers: allBlockers.length,
13848
+ resolvedBlockerRate: allBlockers.length > 0 ? resolvedBlockers.length / allBlockers.length : 1,
13849
+ mostCommonBlockerCategory: mostCommonCategory,
13850
+ recentLessons
13851
+ };
13852
+ }
13853
+
13854
+ //#endregion
13855
+ //#region src/gateway/server-methods/reflection.ts
13856
+ const reflectionHandlers = {
13857
+ "reflection.record": async ({ params, respond }) => {
13858
+ try {
13859
+ respond(true, { reflection: recordReflection({
13860
+ sessionId: typeof params.sessionId === "string" ? params.sessionId : "unknown",
13861
+ agentName: typeof params.agentName === "string" ? params.agentName : "Anima Agent",
13862
+ durationMs: typeof params.durationMs === "number" ? params.durationMs : 0,
13863
+ accomplishments: Array.isArray(params.accomplishments) ? params.accomplishments : [],
13864
+ incomplete: Array.isArray(params.incomplete) ? params.incomplete : [],
13865
+ blockers: Array.isArray(params.blockers) ? params.blockers : [],
13866
+ patterns: Array.isArray(params.patterns) ? params.patterns : [],
13867
+ lessons: Array.isArray(params.lessons) ? params.lessons : [],
13868
+ capabilityUpdates: Array.isArray(params.capabilityUpdates) ? params.capabilityUpdates : [],
13869
+ qualityScore: typeof params.qualityScore === "number" ? params.qualityScore : .5,
13870
+ endingMood: typeof params.endingMood === "string" ? params.endingMood : "steady"
13871
+ }) }, void 0);
13872
+ } catch (error) {
13873
+ respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(error)));
13874
+ }
13875
+ },
13876
+ "reflection.get": async ({ params, respond }) => {
13877
+ const id = typeof params.id === "string" ? params.id.trim() : "";
13878
+ if (!id) {
13879
+ respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "id required"));
13880
+ return;
13881
+ }
13882
+ try {
13883
+ const reflection = getReflection(id);
13884
+ if (!reflection) {
13885
+ respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "Reflection not found"));
13886
+ return;
13887
+ }
13888
+ respond(true, { reflection }, void 0);
13889
+ } catch (error) {
13890
+ respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(error)));
13891
+ }
13892
+ },
13893
+ "reflection.list": async ({ params, respond }) => {
13894
+ try {
13895
+ respond(true, { reflections: listReflections(typeof params.limit === "number" ? params.limit : 20) }, void 0);
13896
+ } catch (error) {
13897
+ respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(error)));
13898
+ }
13899
+ },
13900
+ "reflection.analyze": async ({ params, respond }) => {
13901
+ try {
13902
+ respond(true, { summary: analyzeReflections(listReflections(typeof params.limit === "number" ? params.limit : 50)) }, void 0);
13903
+ } catch (error) {
13904
+ respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, String(error)));
13905
+ }
13906
+ }
13907
+ };
13908
+
13748
13909
  //#endregion
13749
13910
  //#region src/gateway/server-methods/send.ts
13750
13911
  const inflightByContext = /* @__PURE__ */ new WeakMap();
@@ -15951,6 +16112,7 @@ const coreGatewayHandlers = {
15951
16112
  ...nodeHandlers,
15952
16113
  ...orgHandlers,
15953
16114
  ...egoHandlers,
16115
+ ...reflectionHandlers,
15954
16116
  ...steerHandlers,
15955
16117
  ...legacyHandlers,
15956
16118
  ...subscriptionHandlers,
@@ -19773,6 +19935,12 @@ function createGatewayHttpServer(opts) {
19773
19935
  }));
19774
19936
  return;
19775
19937
  }
19938
+ res.setHeader("X-Content-Type-Options", "nosniff");
19939
+ res.setHeader("X-Frame-Options", "DENY");
19940
+ res.setHeader("X-XSS-Protection", "1; mode=block");
19941
+ res.setHeader("Referrer-Policy", "strict-origin-when-cross-origin");
19942
+ res.setHeader("Permissions-Policy", "camera=(), microphone=(), geolocation=()");
19943
+ res.setHeader("Strict-Transport-Security", "max-age=31536000; includeSubDomains");
19776
19944
  try {
19777
19945
  const configSnapshot = loadConfig();
19778
19946
  const trustedProxies = configSnapshot.gateway?.trustedProxies ?? [];