@askexenow/exe-os 0.9.199 → 0.9.201

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 (232) hide show
  1. package/dist/{active-agent-PWI2YWBG.js → active-agent-3MLX4YOU.js} +2 -2
  2. package/dist/{active-agent-O433V5SV.js → active-agent-MTJPQ57G.js} +2 -2
  3. package/dist/{agentic-ontology-64X76FKF.js → agentic-ontology-HPFKQFA2.js} +1 -1
  4. package/dist/{backfill-metadata-RL7T4XGY.js → backfill-metadata-5INYRXJX.js} +3 -3
  5. package/dist/{behaviors-ZW4BWUGD.js → behaviors-TIOFWD4T.js} +2 -2
  6. package/dist/bin/agentic-ontology-backfill.js +4 -4
  7. package/dist/bin/agentic-reflection-backfill.js +5 -5
  8. package/dist/bin/agentic-semantic-label.js +4 -4
  9. package/dist/bin/backfill-conversations.js +4 -4
  10. package/dist/bin/backfill-responses.js +4 -4
  11. package/dist/bin/backfill-vectors.js +5 -5
  12. package/dist/bin/bulk-sync-postgres.js +5 -5
  13. package/dist/bin/cleanup-stale-review-tasks.js +7 -6
  14. package/dist/bin/cli.js +13 -13
  15. package/dist/bin/deferred-daemon-restart.js +1 -1
  16. package/dist/bin/exe-agent-config.js +1 -1
  17. package/dist/bin/exe-agent.js +4 -4
  18. package/dist/bin/exe-assign.js +6 -6
  19. package/dist/bin/exe-boot.js +14 -13
  20. package/dist/bin/exe-call.js +3 -3
  21. package/dist/bin/exe-cloud.js +3 -3
  22. package/dist/bin/exe-dispatch.js +7 -6
  23. package/dist/bin/exe-doctor.js +1 -1
  24. package/dist/bin/exe-export-behaviors.js +6 -6
  25. package/dist/bin/exe-forget.js +5 -5
  26. package/dist/bin/exe-gateway.js +5 -5
  27. package/dist/bin/exe-heartbeat.js +7 -6
  28. package/dist/bin/exe-kill.js +10 -9
  29. package/dist/bin/exe-launch-agent.js +9 -9
  30. package/dist/bin/exe-new-employee.js +5 -5
  31. package/dist/bin/exe-pending-messages.js +8 -7
  32. package/dist/bin/exe-pending-notifications.js +7 -6
  33. package/dist/bin/exe-pending-reviews.js +7 -6
  34. package/dist/bin/exe-rename.js +3 -3
  35. package/dist/bin/exe-review.js +9 -8
  36. package/dist/bin/exe-search.js +4 -4
  37. package/dist/bin/exe-session-cleanup.js +11 -10
  38. package/dist/bin/exe-settings.js +3 -3
  39. package/dist/bin/exe-start-codex.js +10 -10
  40. package/dist/bin/exe-start-opencode.js +7 -7
  41. package/dist/bin/exe-status.js +8 -7
  42. package/dist/bin/exe-team.js +2 -2
  43. package/dist/bin/git-sweep.js +7 -6
  44. package/dist/bin/graph-backfill.js +3 -3
  45. package/dist/bin/graph-export.js +4 -4
  46. package/dist/bin/import-history.js +4 -4
  47. package/dist/bin/install.js +6 -6
  48. package/dist/bin/intercom-check.js +4 -4
  49. package/dist/bin/orchestration-metrics.js +47 -0
  50. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  51. package/dist/bin/postgres-agentic-semantic-backfill.js +4 -4
  52. package/dist/bin/scan-tasks.js +7 -6
  53. package/dist/bin/setup.js +1 -1
  54. package/dist/bin/shard-migrate.js +4 -4
  55. package/dist/bin/stack-update.js +1 -1
  56. package/dist/bin/vps-health-gate.js +1 -1
  57. package/dist/{capacity-monitor-2TRPP3AX.js → capacity-monitor-4VPGKKQH.js} +8 -7
  58. package/dist/{catchup-brief-74ORL525.js → catchup-brief-K2A2NCMS.js} +9 -8
  59. package/dist/{chunk-YZIUQ77U.js → chunk-3V7D5SCM.js} +3 -3
  60. package/dist/{chunk-PHIQW2IU.js → chunk-4WQIB264.js} +6 -6
  61. package/dist/{chunk-FXVTLBBA.js → chunk-66LJM3KL.js} +3 -3
  62. package/dist/{chunk-WATDOTGK.js → chunk-6NLHVC6U.js} +1 -1
  63. package/dist/{chunk-M7NGABPF.js → chunk-7BNZUXFJ.js} +1 -1
  64. package/dist/{chunk-ZAF4GJTD.js → chunk-7LC5HGA3.js} +9 -9
  65. package/dist/{chunk-V5U3FYDZ.js → chunk-7VU6CZCK.js} +2 -2
  66. package/dist/chunk-7ZIRLFIF.js +221 -0
  67. package/dist/{chunk-JPZQM7VW.js → chunk-A4NG62X6.js} +1 -1
  68. package/dist/{chunk-JDGCEOT4.js → chunk-AIOJFN5D.js} +2 -2
  69. package/dist/{chunk-OF6TXNOC.js → chunk-AJN3W6XB.js} +1 -1
  70. package/dist/{chunk-OO5EWGC6.js → chunk-AVHQPIJS.js} +1 -1
  71. package/dist/{chunk-CWY3M4SR.js → chunk-B4K4EJH7.js} +1 -1
  72. package/dist/{chunk-ZLP5TNRU.js → chunk-B5N4DMXM.js} +3 -3
  73. package/dist/{chunk-OGQX7HLN.js → chunk-BCTU72UR.js} +1 -1
  74. package/dist/{chunk-JSMOQRIV.js → chunk-C2YR6BZY.js} +1 -1
  75. package/dist/{chunk-KTJ57PVS.js → chunk-CBAW3YFB.js} +1 -1
  76. package/dist/{chunk-ZHINF5CG.js → chunk-CCYOB56Q.js} +1 -1
  77. package/dist/{chunk-L7ZYZCJ5.js → chunk-D42R5MZU.js} +1 -1
  78. package/dist/{chunk-SKXHR35T.js → chunk-DFQY6G4L.js} +3 -3
  79. package/dist/{chunk-UWMFQKOB.js → chunk-DXFNVS44.js} +1 -1
  80. package/dist/{chunk-JRLSQFIE.js → chunk-EDFYSZ4U.js} +68 -68
  81. package/dist/{chunk-JQLWMZZJ.js → chunk-EJM2YUF4.js} +1 -1
  82. package/dist/{chunk-BO3ZQIWF.js → chunk-GKKMANTG.js} +1 -1
  83. package/dist/{chunk-5YVGHP2B.js → chunk-GSV24ZVZ.js} +8 -8
  84. package/dist/{chunk-DNEOEKWA.js → chunk-HF7Y4UZO.js} +2 -2
  85. package/dist/{chunk-MWGAC2ER.js → chunk-I5IWVRZY.js} +2 -2
  86. package/dist/{chunk-RUKOGGQG.js → chunk-IAPOGI6M.js} +2 -2
  87. package/dist/{chunk-MABQMUCQ.js → chunk-J2TSYNVM.js} +230 -18
  88. package/dist/{chunk-6BJ5GZD4.js → chunk-J6CSL7AY.js} +6 -6
  89. package/dist/{chunk-XPOMXVWI.js → chunk-K7XLE7UI.js} +3 -1
  90. package/dist/{chunk-XNXTN5XZ.js → chunk-KGSFR6V3.js} +1 -1
  91. package/dist/{chunk-YT67TJQZ.js → chunk-LPPCJZVI.js} +1 -1
  92. package/dist/{chunk-WRCETUYE.js → chunk-LT26OOIB.js} +1 -1
  93. package/dist/{chunk-CGAYSKQF.js → chunk-M6S7HVFP.js} +5 -5
  94. package/dist/{chunk-IFFVONU6.js → chunk-MBFVJSSH.js} +1 -1
  95. package/dist/{chunk-JW3MATT5.js → chunk-MLQFGVFJ.js} +1 -1
  96. package/dist/{chunk-2DWKMJPE.js → chunk-MSUJ3UBS.js} +2 -2
  97. package/dist/{chunk-4X7CMJDN.js → chunk-MXLB2M2O.js} +45 -10
  98. package/dist/{chunk-KRYEHI4V.js → chunk-MYVI6V7L.js} +3 -3
  99. package/dist/{chunk-2HEXCZGP.js → chunk-NC3NOZHH.js} +1 -1
  100. package/dist/{chunk-FDD7KX7Q.js → chunk-OOTPPSOX.js} +7 -7
  101. package/dist/{chunk-FBTIOBF6.js → chunk-P7QVZZBS.js} +3 -3
  102. package/dist/{chunk-6FBYGI2H.js → chunk-POS4PUM7.js} +1 -1
  103. package/dist/{chunk-BDYUENC7.js → chunk-Q3FTA4GX.js} +1 -1
  104. package/dist/{chunk-K6K55GMZ.js → chunk-QR7CQJVJ.js} +1 -1
  105. package/dist/{chunk-ACOQS4ZL.js → chunk-RC35BWOO.js} +2 -2
  106. package/dist/{chunk-WSYFZZCP.js → chunk-SXTHSDJQ.js} +4 -4
  107. package/dist/{chunk-5XAGTHF2.js → chunk-T4EQ5SKI.js} +1 -1
  108. package/dist/{chunk-OYU7TCBG.js → chunk-TRQJQYG5.js} +1 -1
  109. package/dist/{chunk-QPSUK5HA.js → chunk-UCDMLKE5.js} +1 -1
  110. package/dist/{chunk-GIIRWR35.js → chunk-VBKEAVEU.js} +2 -2
  111. package/dist/{chunk-JDHB6I4O.js → chunk-WI6BQ4T3.js} +2 -2
  112. package/dist/{chunk-65K2BQTG.js → chunk-XASY3SCH.js} +1 -1
  113. package/dist/{chunk-2GJWENBT.js → chunk-Y35YW6EL.js} +1 -1
  114. package/dist/{chunk-TGOJR5SS.js → chunk-YCEJCFU5.js} +58 -2
  115. package/dist/{chunk-7WUBXLK2.js → chunk-ZE36U2GK.js} +2 -2
  116. package/dist/{co-occurrence-OVDIX3OS.js → co-occurrence-J5WOOCWD.js} +1 -1
  117. package/dist/{code-context-index-TBCTP47N.js → code-context-index-JPQDRTTX.js} +2 -2
  118. package/dist/{crdt-sync-L42FZQ7O.js → crdt-sync-NGSP5WQE.js} +1 -1
  119. package/dist/{crm-webhook-OFWPEK33.js → crm-webhook-ZQUDBLHY.js} +2 -2
  120. package/dist/{cto-delegation-gate-7PGS5IN4.js → cto-delegation-gate-A77BCIAB.js} +6 -5
  121. package/dist/{daemon-orchestration-MP3PPX7Q.js → daemon-orchestration-AVB5PPC5.js} +9 -8
  122. package/dist/{exe-drift-BUFQKOM5.js → exe-drift-BUVZV7DK.js} +2 -2
  123. package/dist/{exe-export-QMGWH3PL.js → exe-export-QJEIYCKB.js} +4 -4
  124. package/dist/{exe-import-7NNKSCKI.js → exe-import-SGSX3QML.js} +4 -4
  125. package/dist/{exe-key-QZ5GWV6D.js → exe-key-Y7DAEMSK.js} +1 -1
  126. package/dist/{fast-db-init-DAZZ7ZUP.js → fast-db-init-UTA7SHEE.js} +1 -1
  127. package/dist/gateway/index.js +9 -9
  128. package/dist/{git-staleness-JY7PJT6F.js → git-staleness-WTDE4H4D.js} +1 -1
  129. package/dist/{git-task-sweep-SLANXCSW.js → git-task-sweep-SHTK3F7G.js} +7 -6
  130. package/dist/{global-procedures-GKQGLYXQ.js → global-procedures-K3B3GTHA.js} +2 -2
  131. package/dist/{graph-auto-extract-5OYWXUKD.js → graph-auto-extract-ZCVUFK6M.js} +1 -1
  132. package/dist/hooks/bug-report-worker.js +8 -7
  133. package/dist/hooks/codex-stop-task-finalizer.js +8 -7
  134. package/dist/hooks/commit-complete.js +9 -8
  135. package/dist/hooks/error-recall.js +5 -5
  136. package/dist/hooks/exe-heartbeat-hook.js +2 -2
  137. package/dist/hooks/ingest-worker.js +2 -2
  138. package/dist/hooks/ingest.js +5 -5
  139. package/dist/hooks/instructions-loaded.js +3 -3
  140. package/dist/hooks/manifest.json +20 -20
  141. package/dist/hooks/notification.js +3 -3
  142. package/dist/hooks/post-compact.js +8 -7
  143. package/dist/hooks/post-tool-combined.js +5 -5
  144. package/dist/hooks/pre-compact.js +11 -10
  145. package/dist/hooks/pre-tool-use.js +12 -11
  146. package/dist/hooks/prompt-submit.js +18 -17
  147. package/dist/hooks/session-end.js +14 -13
  148. package/dist/hooks/session-start.js +7 -7
  149. package/dist/hooks/stop.js +15 -14
  150. package/dist/hooks/subagent-stop.js +8 -7
  151. package/dist/hooks/summary-worker.js +14 -13
  152. package/dist/index.js +15 -14
  153. package/dist/{installer-GSA2KOSE.js → installer-D47RNEJB.js} +4 -4
  154. package/dist/{installer-CWKEI7SE.js → installer-WVQDUS7O.js} +4 -4
  155. package/dist/{installer-DWVZFKAH.js → installer-YBYJZLUT.js} +4 -4
  156. package/dist/lib/cloud-sync.js +3 -3
  157. package/dist/lib/consolidation.js +4 -4
  158. package/dist/lib/database.js +1 -1
  159. package/dist/lib/db-daemon-client.js +1 -1
  160. package/dist/lib/db.js +1 -1
  161. package/dist/lib/embedder.js +2 -2
  162. package/dist/lib/employee-templates.js +3 -3
  163. package/dist/lib/employees.js +1 -1
  164. package/dist/lib/exe-daemon-client.js +1 -1
  165. package/dist/lib/exe-daemon.js +48 -24
  166. package/dist/lib/hybrid-search.js +4 -4
  167. package/dist/lib/identity.js +1 -1
  168. package/dist/lib/messaging.js +7 -6
  169. package/dist/lib/reminders.js +2 -2
  170. package/dist/lib/schedules.js +4 -4
  171. package/dist/lib/skill-learning.js +3 -3
  172. package/dist/lib/store.js +3 -3
  173. package/dist/lib/task-router.js +2 -2
  174. package/dist/lib/tasks.js +7 -6
  175. package/dist/lib/tmux-routing.js +6 -5
  176. package/dist/lib/token-spend.js +2 -2
  177. package/dist/mcp/register-tools.js +49 -48
  178. package/dist/mcp/server.js +50 -49
  179. package/dist/mcp/tools/complete-reminder.js +3 -3
  180. package/dist/mcp/tools/create-reminder.js +3 -3
  181. package/dist/mcp/tools/create-task.js +9 -8
  182. package/dist/mcp/tools/deactivate-behavior.js +4 -4
  183. package/dist/mcp/tools/list-reminders.js +3 -3
  184. package/dist/mcp/tools/list-tasks.js +9 -8
  185. package/dist/mcp/tools/send-message.js +9 -8
  186. package/dist/mcp/tools/update-task.js +8 -7
  187. package/dist/{mcp-http-config-YOB4QWYP.js → mcp-http-config-DWN2POKM.js} +2 -2
  188. package/dist/{memory-cards-UPFWA3YQ.js → memory-cards-VIKEUPGO.js} +1 -1
  189. package/dist/{memory-graph-extractor-XTH3U6QS.js → memory-graph-extractor-OP2BSF43.js} +2 -2
  190. package/dist/{memory-poisoning-defense-WDSEUEBW.js → memory-poisoning-defense-EKMAAXMH.js} +1 -1
  191. package/dist/{memory-queue-client-FJOLJYUK.js → memory-queue-client-XCBQIT3T.js} +2 -2
  192. package/dist/{memory-reflection-A2PLKX7A.js → memory-reflection-AAST2U2M.js} +1 -1
  193. package/dist/{notifications-WYNI5OG6.js → notifications-SWILJ3AV.js} +6 -5
  194. package/dist/{orchestrator-FRFCMLW3.js → orchestrator-L6OFTLK5.js} +8 -7
  195. package/dist/{plan-limits-FKTRN25T.js → plan-limits-J2BJEBN6.js} +2 -2
  196. package/dist/{projection-worker-R2JOVCXX.js → projection-worker-QPE2JIKS.js} +1 -1
  197. package/dist/{reranker-2ZWUZRUF.js → reranker-342RISOC.js} +1 -1
  198. package/dist/{review-polling-ADP5YFHW.js → review-polling-TKQXLTIA.js} +7 -6
  199. package/dist/runtime/index.js +13 -12
  200. package/dist/{session-events-JA3MCMZK.js → session-events-OPOXDEPH.js} +7 -6
  201. package/dist/{session-kill-telemetry-GV7LE56P.js → session-kill-telemetry-GBNUQABY.js} +2 -2
  202. package/dist/{session-scope-LXQKQDIS.js → session-scope-J2ODEL37.js} +6 -5
  203. package/dist/{setup-wizard-GRR4F4TX.js → setup-wizard-FQBIZQWP.js} +1 -1
  204. package/dist/{shard-manager-KXLEDDBB.js → shard-manager-GWMFNY2I.js} +1 -1
  205. package/dist/{skill-refinement-3UVLBCZD.js → skill-refinement-GYK7FZCH.js} +1 -1
  206. package/dist/{stack-update-C4BAPLXJ.js → stack-update-Q2WQOJTS.js} +1 -1
  207. package/dist/{task-enforcement-KSLBFILH.js → task-enforcement-IPXSAJA5.js} +25 -5
  208. package/dist/{task-scope-AI62AIPT.js → task-scope-JREB33TH.js} +6 -5
  209. package/dist/{tasks-crud-IEOK55IV.js → tasks-crud-V3IQ5GLV.js} +6 -5
  210. package/dist/{tasks-review-ID7V6RSR.js → tasks-review-PEEMO6RY.js} +6 -5
  211. package/dist/{token-budget-Z4ONSQLC.js → token-budget-ES3IEZPJ.js} +1 -1
  212. package/dist/{tool-capability-index-2MHWYQH5.js → tool-capability-index-6ICPKH5O.js} +1 -1
  213. package/dist/{tool-telemetry-Z46QEUD5.js → tool-telemetry-JVQX5FJV.js} +1 -1
  214. package/dist/tui/App.js +14 -13
  215. package/dist/{tui-data-HIFVW2PE.js → tui-data-NJUK2RNW.js} +6 -5
  216. package/dist/{worker-gate-F3L7XDMJ.js → worker-gate-4KF5ZRWT.js} +1 -1
  217. package/dist/{workflow-engine-H5KTDDJG.js → workflow-engine-DHMTGUAO.js} +2 -2
  218. package/package.json +2 -1
  219. package/release-notes.json +135 -138
  220. /package/dist/{chunk-KBZM7HRB.js → chunk-5QVJ5TBF.js} +0 -0
  221. /package/dist/{chunk-OO5CPMT3.js → chunk-HGU4YCR3.js} +0 -0
  222. /package/dist/{chunk-AFJWUI3Y.js → chunk-HIECEYMN.js} +0 -0
  223. /package/dist/{chunk-54MZI4PK.js → chunk-MYESASW3.js} +0 -0
  224. /package/dist/{chunk-G5GFP5J6.js → chunk-TFV7MDCX.js} +0 -0
  225. /package/dist/{chunk-GHCVD7WV.js → chunk-XJTHRKML.js} +0 -0
  226. /package/dist/{chunk-MNNWWEVJ.js → chunk-XZCSY5ID.js} +0 -0
  227. /package/dist/{chunk-MQLMIY6U.js → chunk-YLBBPZO3.js} +0 -0
  228. /package/dist/{chunk-NF4AEKQK.js → chunk-ZOX6DPP3.js} +0 -0
  229. /package/dist/{core-memory-VQKCHGFX.js → core-memory-B7VPSYUP.js} +0 -0
  230. /package/dist/{entity-boost-WEQDV6P6.js → entity-boost-QXR3LCYV.js} +0 -0
  231. /package/dist/{message-queue-client-BR7DXK7J.js → message-queue-client-CUCAQME6.js} +0 -0
  232. /package/dist/{wiki-acl-DDF2QQOD.js → wiki-acl-UOSBRX3O.js} +0 -0
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  storeBehavior
3
- } from "./chunk-OGQX7HLN.js";
3
+ } from "./chunk-BCTU72UR.js";
4
4
  import {
5
5
  getClient
6
- } from "./chunk-TGOJR5SS.js";
6
+ } from "./chunk-YCEJCFU5.js";
7
7
  import {
8
8
  loadConfig
9
9
  } from "./chunk-4GXRETYL.js";
@@ -0,0 +1,221 @@
1
+ import {
2
+ getClient
3
+ } from "./chunk-YCEJCFU5.js";
4
+
5
+ // src/lib/orchestration-events.ts
6
+ import crypto from "crypto";
7
+ var SENSITIVE_PAYLOAD_KEY = /(context|prompt|secret|token|password|passphrase|recovery|raw|key)/i;
8
+ async function ensureOrchestrationEventsSchema(client = getClient()) {
9
+ await client.execute({
10
+ sql: `CREATE TABLE IF NOT EXISTS orchestration_events (
11
+ id TEXT PRIMARY KEY,
12
+ ts TEXT NOT NULL,
13
+ event_type TEXT NOT NULL,
14
+ source TEXT NOT NULL,
15
+ severity TEXT NOT NULL DEFAULT 'info',
16
+ task_id TEXT,
17
+ agent_id TEXT,
18
+ reviewer TEXT,
19
+ session_scope TEXT,
20
+ project_name TEXT,
21
+ instance_id TEXT,
22
+ tmux_session TEXT,
23
+ runtime TEXT,
24
+ correlation_id TEXT,
25
+ attempt INTEGER,
26
+ duration_ms INTEGER,
27
+ result TEXT,
28
+ error_code TEXT,
29
+ payload_json TEXT,
30
+ created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
31
+ )`,
32
+ args: []
33
+ });
34
+ await client.execute({ sql: "CREATE INDEX IF NOT EXISTS idx_orch_events_ts ON orchestration_events(ts)", args: [] });
35
+ await client.execute({ sql: "CREATE INDEX IF NOT EXISTS idx_orch_events_task ON orchestration_events(task_id, ts)", args: [] });
36
+ await client.execute({ sql: "CREATE INDEX IF NOT EXISTS idx_orch_events_agent ON orchestration_events(agent_id, session_scope, ts)", args: [] });
37
+ await client.execute({ sql: "CREATE INDEX IF NOT EXISTS idx_orch_events_type ON orchestration_events(event_type, ts)", args: [] });
38
+ }
39
+ async function recordOrchestrationEvent(input) {
40
+ try {
41
+ const client = getClient();
42
+ await ensureOrchestrationEventsSchema(client);
43
+ const payloadJson = sanitizePayload(input.payload);
44
+ await client.execute({
45
+ sql: `INSERT INTO orchestration_events (
46
+ id, ts, event_type, source, severity,
47
+ task_id, agent_id, reviewer, session_scope, project_name,
48
+ instance_id, tmux_session, runtime, correlation_id, attempt,
49
+ duration_ms, result, error_code, payload_json
50
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
51
+ args: [
52
+ crypto.randomUUID(),
53
+ input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
54
+ input.eventType,
55
+ input.source,
56
+ input.severity ?? "info",
57
+ input.taskId ?? null,
58
+ input.agentId ?? null,
59
+ input.reviewer ?? null,
60
+ input.sessionScope ?? null,
61
+ input.projectName ?? null,
62
+ input.instanceId ?? null,
63
+ input.tmuxSession ?? null,
64
+ input.runtime ?? null,
65
+ input.correlationId ?? null,
66
+ input.attempt ?? null,
67
+ input.durationMs ?? null,
68
+ input.result ?? null,
69
+ input.errorCode ?? null,
70
+ payloadJson
71
+ ]
72
+ });
73
+ return true;
74
+ } catch (err) {
75
+ if (process.env.EXE_DEBUG === "1") {
76
+ process.stderr.write(
77
+ `[orchestration-events] write skipped: ${err instanceof Error ? err.message : String(err)}
78
+ `
79
+ );
80
+ }
81
+ return false;
82
+ }
83
+ }
84
+ function recordOrchestrationEventBestEffort(input) {
85
+ void recordOrchestrationEvent(input);
86
+ }
87
+ async function getOrchestrationMetrics(input = {}) {
88
+ const client = getClient();
89
+ await ensureOrchestrationEventsSchema(client);
90
+ const sinceIso = input.sinceIso ?? null;
91
+ const result = sinceIso ? await client.execute({
92
+ sql: `SELECT event_type, ts, task_id, duration_ms
93
+ FROM orchestration_events
94
+ WHERE ts >= ?
95
+ ORDER BY ts ASC`,
96
+ args: [sinceIso]
97
+ }) : await client.execute({
98
+ sql: `SELECT event_type, ts, task_id, duration_ms
99
+ FROM orchestration_events
100
+ ORDER BY ts ASC`,
101
+ args: []
102
+ });
103
+ const rows = result.rows;
104
+ const taskEvents = /* @__PURE__ */ new Map();
105
+ const daemonTickDurations = [];
106
+ const counts = {
107
+ duplicateNudges: 0,
108
+ missedReviews: 0,
109
+ tmuxCommandTimeouts: 0,
110
+ claimCollisions: 0,
111
+ crossSessionBlocks: 0,
112
+ dispatchUnclaimed: 0
113
+ };
114
+ for (const row of rows) {
115
+ const type = String(row.event_type ?? "");
116
+ const taskId = row.task_id == null ? "" : String(row.task_id);
117
+ const ts = Date.parse(String(row.ts ?? ""));
118
+ if (type === "nudge.duplicate") counts.duplicateNudges++;
119
+ if (type === "review.missed") counts.missedReviews++;
120
+ if (type === "tmux.command.timeout") counts.tmuxCommandTimeouts++;
121
+ if (type === "claim.collision") counts.claimCollisions++;
122
+ if (type === "session.scope_violation") counts.crossSessionBlocks++;
123
+ if (type === "dispatch.unclaimed") counts.dispatchUnclaimed++;
124
+ if (type === "daemon.tick.completed") {
125
+ const duration = Number(row.duration_ms ?? NaN);
126
+ if (Number.isFinite(duration)) daemonTickDurations.push(duration);
127
+ }
128
+ if (!taskId || !Number.isFinite(ts)) continue;
129
+ const bucket = taskEvents.get(taskId) ?? {};
130
+ if (type === "task.created" && bucket.created === void 0) bucket.created = ts;
131
+ if (type === "task.claimed" && bucket.claimed === void 0) bucket.claimed = ts;
132
+ if (type === "task.done" && bucket.done === void 0) bucket.done = ts;
133
+ if (type === "review.ready" && bucket.reviewReady === void 0) bucket.reviewReady = ts;
134
+ taskEvents.set(taskId, bucket);
135
+ }
136
+ const createToClaim = [];
137
+ const doneToReview = [];
138
+ for (const eventSet of taskEvents.values()) {
139
+ if (eventSet.created !== void 0 && eventSet.claimed !== void 0 && eventSet.claimed >= eventSet.created) {
140
+ createToClaim.push(eventSet.claimed - eventSet.created);
141
+ }
142
+ if (eventSet.done !== void 0 && eventSet.reviewReady !== void 0 && eventSet.reviewReady >= eventSet.done) {
143
+ doneToReview.push(eventSet.reviewReady - eventSet.done);
144
+ }
145
+ }
146
+ return {
147
+ sinceIso,
148
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
149
+ totalEvents: rows.length,
150
+ counts,
151
+ createToClaimMs: percentileMetric(createToClaim),
152
+ doneToReviewMs: percentileMetric(doneToReview),
153
+ daemonTickMs: percentileMetric(daemonTickDurations)
154
+ };
155
+ }
156
+ function formatOrchestrationMetrics(metrics) {
157
+ const lines = [
158
+ "# Orchestration Metrics",
159
+ "",
160
+ `Generated: ${metrics.generatedAt}`,
161
+ `Since: ${metrics.sinceIso ?? "beginning"}`,
162
+ `Total events: ${metrics.totalEvents}`,
163
+ "",
164
+ "## Latency",
165
+ `- create\u2192claim: ${formatMetric(metrics.createToClaimMs)}`,
166
+ `- done\u2192review.ready: ${formatMetric(metrics.doneToReviewMs)}`,
167
+ `- daemon tick: ${formatMetric(metrics.daemonTickMs)}`,
168
+ "",
169
+ "## Counts",
170
+ `- duplicate nudges: ${metrics.counts.duplicateNudges}`,
171
+ `- missed reviews: ${metrics.counts.missedReviews}`,
172
+ `- tmux command timeouts: ${metrics.counts.tmuxCommandTimeouts}`,
173
+ `- claim collisions: ${metrics.counts.claimCollisions}`,
174
+ `- cross-session blocks: ${metrics.counts.crossSessionBlocks}`,
175
+ `- dispatch unclaimed: ${metrics.counts.dispatchUnclaimed}`
176
+ ];
177
+ return lines.join("\n");
178
+ }
179
+ function sanitizePayload(payload) {
180
+ if (!payload) return null;
181
+ const safe = {};
182
+ for (const [key, value] of Object.entries(payload)) {
183
+ if (SENSITIVE_PAYLOAD_KEY.test(key)) continue;
184
+ if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
185
+ safe[key] = value;
186
+ } else if (Array.isArray(value)) {
187
+ safe[key] = value.filter((item) => ["string", "number", "boolean"].includes(typeof item)).slice(0, 20);
188
+ }
189
+ }
190
+ return Object.keys(safe).length > 0 ? JSON.stringify(safe) : null;
191
+ }
192
+ function percentileMetric(values) {
193
+ if (values.length === 0) return { count: 0, p50: null, p95: null, p99: null };
194
+ const sorted = [...values].sort((a, b) => a - b);
195
+ return {
196
+ count: sorted.length,
197
+ p50: percentile(sorted, 50),
198
+ p95: percentile(sorted, 95),
199
+ p99: percentile(sorted, 99)
200
+ };
201
+ }
202
+ function percentile(sorted, percentileValue) {
203
+ if (sorted.length === 0) return 0;
204
+ const rank = Math.ceil(percentileValue / 100 * sorted.length) - 1;
205
+ return sorted[Math.min(sorted.length - 1, Math.max(0, rank))] ?? 0;
206
+ }
207
+ function formatMetric(metric) {
208
+ if (metric.count === 0) return "n=0";
209
+ return `n=${metric.count}, p50=${formatMs(metric.p50)}, p95=${formatMs(metric.p95)}, p99=${formatMs(metric.p99)}`;
210
+ }
211
+ function formatMs(value) {
212
+ if (value == null) return "n/a";
213
+ if (value < 1e3) return `${value}ms`;
214
+ return `${Math.round(value / 1e3 * 10) / 10}s`;
215
+ }
216
+
217
+ export {
218
+ recordOrchestrationEventBestEffort,
219
+ getOrchestrationMetrics,
220
+ formatOrchestrationMetrics
221
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getIdentity,
3
3
  loadEmployeesSync
4
- } from "./chunk-TGOJR5SS.js";
4
+ } from "./chunk-YCEJCFU5.js";
5
5
 
6
6
  // src/lib/drift-probes.ts
7
7
  var DRIFT_THRESHOLD = 80;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getActiveAgent
3
- } from "./chunk-BDYUENC7.js";
3
+ } from "./chunk-Q3FTA4GX.js";
4
4
  import {
5
5
  listTasks
6
- } from "./chunk-MABQMUCQ.js";
6
+ } from "./chunk-J2TSYNVM.js";
7
7
 
8
8
  // src/mcp/tools/list-tasks.ts
9
9
  import { z } from "zod";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeAction,
3
3
  substituteTemplate
4
- } from "./chunk-54MZI4PK.js";
4
+ } from "./chunk-MYESASW3.js";
5
5
 
6
6
  // src/automation/workflow-engine.ts
7
7
  import { randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getClient
3
- } from "./chunk-TGOJR5SS.js";
3
+ } from "./chunk-YCEJCFU5.js";
4
4
 
5
5
  // src/lib/token-spend.ts
6
6
  import { readdir } from "fs/promises";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isCoordinatorRole
3
- } from "./chunk-TGOJR5SS.js";
3
+ } from "./chunk-YCEJCFU5.js";
4
4
 
5
5
  // src/lib/task-router.ts
6
6
  import { randomUUID } from "crypto";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  recordSessionKill
3
- } from "./chunk-WRCETUYE.js";
3
+ } from "./chunk-LT26OOIB.js";
4
4
  import {
5
5
  sessionScopeFilter,
6
6
  verifyPaneAtCapacity,
7
7
  writeNotification
8
- } from "./chunk-MABQMUCQ.js";
8
+ } from "./chunk-J2TSYNVM.js";
9
9
  import {
10
10
  listSessions
11
11
  } from "./chunk-64WZEXXA.js";
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  getClient,
17
17
  isCoordinatorName
18
- } from "./chunk-TGOJR5SS.js";
18
+ } from "./chunk-YCEJCFU5.js";
19
19
 
20
20
  // src/lib/capacity-monitor.ts
21
21
  var CAPACITY_PATTERNS = [
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getClient
3
- } from "./chunk-TGOJR5SS.js";
3
+ } from "./chunk-YCEJCFU5.js";
4
4
 
5
5
  // src/lib/behaviors.ts
6
6
  import crypto from "crypto";
@@ -6,7 +6,7 @@ import {
6
6
  getIdentity,
7
7
  listIdentities,
8
8
  updateIdentity
9
- } from "./chunk-TGOJR5SS.js";
9
+ } from "./chunk-YCEJCFU5.js";
10
10
  import {
11
11
  atomicWriteJsonSync
12
12
  } from "./chunk-LYH5HE24.js";
@@ -2,7 +2,7 @@ import {
2
2
  connectEmbedDaemon,
3
3
  disconnectClient,
4
4
  embedViaClient
5
- } from "./chunk-2GJWENBT.js";
5
+ } from "./chunk-Y35YW6EL.js";
6
6
  import {
7
7
  EMBEDDING_DIM
8
8
  } from "./chunk-FXU7JOXK.js";
@@ -3,7 +3,7 @@ import {
3
3
  getClient,
4
4
  isInitialized,
5
5
  loadEmployees
6
- } from "./chunk-TGOJR5SS.js";
6
+ } from "./chunk-YCEJCFU5.js";
7
7
  import {
8
8
  PLAN_LIMITS,
9
9
  checkLicense,
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  isClientConnected,
6
6
  sendDaemonRequest
7
- } from "./chunk-2GJWENBT.js";
7
+ } from "./chunk-Y35YW6EL.js";
8
8
 
9
9
  // src/lib/memory-queue-client.ts
10
10
  async function writeMemoryViaDaemon(entry) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isCrdtSyncEnabled
3
- } from "./chunk-KBZM7HRB.js";
3
+ } from "./chunk-5QVJ5TBF.js";
4
4
  import {
5
5
  decryptSyncBlob,
6
6
  encryptSyncBlob,
@@ -12,7 +12,7 @@ import {
12
12
  loadEmployees,
13
13
  registerBinSymlinks,
14
14
  saveEmployees
15
- } from "./chunk-TGOJR5SS.js";
15
+ } from "./chunk-YCEJCFU5.js";
16
16
  import {
17
17
  loadDeviceId
18
18
  } from "./chunk-MVMMULOJ.js";
@@ -489,7 +489,7 @@ async function cloudSync(config) {
489
489
  let pulled = 0;
490
490
  if (pullResult.records.length > 0) {
491
491
  if (isCrdtSyncEnabled()) {
492
- const { initCrdtDoc, importExistingMemories, readAllMemories } = await import("./crdt-sync-L42FZQ7O.js");
492
+ const { initCrdtDoc, importExistingMemories, readAllMemories } = await import("./crdt-sync-NGSP5WQE.js");
493
493
  initCrdtDoc();
494
494
  importExistingMemories(
495
495
  pullResult.records.map((rec) => ({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getClient
3
- } from "./chunk-TGOJR5SS.js";
3
+ } from "./chunk-YCEJCFU5.js";
4
4
 
5
5
  // src/lib/reminders.ts
6
6
  import crypto from "crypto";