@askexenow/exe-os 0.9.264 → 0.9.265

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 (143) hide show
  1. package/dist/backfill-metadata-WM46YQZL.js +597 -0
  2. package/dist/bin/agentic-ontology-backfill.js +1 -1
  3. package/dist/bin/agentic-reflection-backfill.js +1 -1
  4. package/dist/bin/agentic-semantic-label.js +1 -1
  5. package/dist/bin/backfill-conversations.js +1 -1
  6. package/dist/bin/backfill-responses.js +1 -1
  7. package/dist/bin/backfill-vectors.js +2 -2
  8. package/dist/bin/bulk-sync-postgres.js +1 -1
  9. package/dist/bin/cleanup-stale-review-tasks.js +2 -2
  10. package/dist/bin/cli.js +5 -5
  11. package/dist/bin/exe-assign.js +1 -1
  12. package/dist/bin/exe-boot.js +3 -3
  13. package/dist/bin/exe-dispatch.js +2 -2
  14. package/dist/bin/exe-doctor.js +1 -1
  15. package/dist/bin/exe-export-behaviors.js +2 -2
  16. package/dist/bin/exe-forget.js +3 -3
  17. package/dist/bin/exe-gateway.js +5 -5
  18. package/dist/bin/exe-heartbeat.js +3 -3
  19. package/dist/bin/exe-kill.js +3 -3
  20. package/dist/bin/exe-launch-agent.js +3 -3
  21. package/dist/bin/exe-pending-messages.js +3 -3
  22. package/dist/bin/exe-pending-notifications.js +2 -2
  23. package/dist/bin/exe-pending-reviews.js +6 -4
  24. package/dist/bin/exe-review.js +3 -3
  25. package/dist/bin/exe-search.js +2 -2
  26. package/dist/bin/exe-session-cleanup.js +5 -5
  27. package/dist/bin/exe-start-codex.js +1 -1
  28. package/dist/bin/exe-start-opencode.js +1 -1
  29. package/dist/bin/exe-status.js +3 -3
  30. package/dist/bin/exe-team.js +1 -1
  31. package/dist/bin/git-sweep.js +2 -2
  32. package/dist/bin/graph-backfill.js +1 -1
  33. package/dist/bin/graph-export.js +2 -2
  34. package/dist/bin/import-history.js +2 -2
  35. package/dist/bin/intercom-check.js +5 -4
  36. package/dist/bin/mcp-sessions.js +2 -2
  37. package/dist/bin/orchestration-metrics.js +1 -1
  38. package/dist/bin/scan-tasks.js +2 -2
  39. package/dist/bin/shard-migrate.js +1 -1
  40. package/dist/capacity-monitor-FZORNXTA.js +49 -0
  41. package/dist/catchup-brief-PRKHIRWW.js +151 -0
  42. package/dist/chunk-2GU3NYMB.js +813 -0
  43. package/dist/chunk-2VT7Z2E2.js +197 -0
  44. package/dist/chunk-3L6XLN4V.js +1090 -0
  45. package/dist/chunk-3T4PNG5O.js +447 -0
  46. package/dist/chunk-3W324KN7.js +13696 -0
  47. package/dist/chunk-4IATAIAF.js +89 -0
  48. package/dist/chunk-5M4F2FVD.js +204 -0
  49. package/dist/chunk-5TANMPI4.js +377 -0
  50. package/dist/chunk-67E5WIMW.js +333 -0
  51. package/dist/chunk-6NRJIARA.js +346 -0
  52. package/dist/chunk-6O22GTSE.js +1148 -0
  53. package/dist/chunk-7O5CMDP6.js +1345 -0
  54. package/dist/chunk-7P2JKEO3.js +382 -0
  55. package/dist/chunk-A4UY44T7.js +486 -0
  56. package/dist/chunk-AZHPQGSI.js +159 -0
  57. package/dist/chunk-BQAC3GCO.js +127 -0
  58. package/dist/chunk-CIWJRYIC.js +244 -0
  59. package/dist/chunk-CZO2DGGF.js +214 -0
  60. package/dist/chunk-D55SXO3N.js +3951 -0
  61. package/dist/chunk-EPDSRI6O.js +284 -0
  62. package/dist/chunk-EU34R2A3.js +1073 -0
  63. package/dist/chunk-G4KEDLSM.js +488 -0
  64. package/dist/chunk-IODP4JNE.js +551 -0
  65. package/dist/chunk-IZ6LCET7.js +58 -0
  66. package/dist/chunk-LPG3U5UW.js +731 -0
  67. package/dist/chunk-NH6TPXZV.js +13696 -0
  68. package/dist/chunk-O5TZI7OZ.js +50 -0
  69. package/dist/chunk-Q3N4KHLM.js +330 -0
  70. package/dist/chunk-QHQTMWYH.js +54 -0
  71. package/dist/chunk-QNYOPM2L.js +1921 -0
  72. package/dist/chunk-SPOA7EOD.js +81 -0
  73. package/dist/chunk-TK23WXKB.js +128 -0
  74. package/dist/chunk-TOVXER6J.js +76 -0
  75. package/dist/chunk-UIPAZYP7.js +171 -0
  76. package/dist/chunk-WXW4GF6M.js +495 -0
  77. package/dist/{chunk-YGOUKUNX.js → chunk-XLYBSXWS.js} +2 -1
  78. package/dist/core-memory-QXMQ5I7S.js +110 -0
  79. package/dist/crm-webhook-CH5W633Y.js +10 -0
  80. package/dist/cto-delegation-gate-XY3NMGTE.js +206 -0
  81. package/dist/daemon-orchestration-LS62JMTI.js +135 -0
  82. package/dist/dreaming-ZBKE2GFX.js +32 -0
  83. package/dist/exe-export-JNSQRIWI.js +73 -0
  84. package/dist/exe-import-AVGWQZLU.js +76 -0
  85. package/dist/exe-key-WR6QEHYO.js +579 -0
  86. package/dist/exe-snapshot-U6K3J6BD.js +164 -0
  87. package/dist/fast-db-init-ZHRRYI7M.js +7 -0
  88. package/dist/gateway/index.js +6 -6
  89. package/dist/git-task-sweep-64KSWRUI.js +40 -0
  90. package/dist/hooks/bug-report-worker.js +4 -4
  91. package/dist/hooks/codex-stop-task-finalizer.js +4 -4
  92. package/dist/hooks/commit-complete.js +4 -4
  93. package/dist/hooks/error-recall.js +2 -2
  94. package/dist/hooks/ingest.js +2 -2
  95. package/dist/hooks/instructions-loaded.js +1 -1
  96. package/dist/hooks/manifest.json +18 -18
  97. package/dist/hooks/notification.js +1 -1
  98. package/dist/hooks/post-compact.js +2 -2
  99. package/dist/hooks/post-tool-combined.js +2 -2
  100. package/dist/hooks/pre-compact.js +3 -3
  101. package/dist/hooks/pre-tool-use.js +6 -6
  102. package/dist/hooks/prompt-submit.js +15 -10
  103. package/dist/hooks/session-end.js +5 -5
  104. package/dist/hooks/session-start.js +5 -5
  105. package/dist/hooks/stop.js +5 -5
  106. package/dist/hooks/subagent-stop.js +2 -2
  107. package/dist/hooks/summary-worker.js +5 -5
  108. package/dist/index.js +9 -9
  109. package/dist/lib/consolidation.js +2 -2
  110. package/dist/lib/exe-daemon.js +17 -17
  111. package/dist/lib/hybrid-search.js +2 -2
  112. package/dist/lib/messaging.js +2 -2
  113. package/dist/lib/schedules.js +2 -2
  114. package/dist/lib/store.js +1 -1
  115. package/dist/lib/tasks.js +3 -3
  116. package/dist/lib/tmux-routing.js +1 -1
  117. package/dist/mcp/register-tools.js +24 -24
  118. package/dist/mcp/server.js +25 -25
  119. package/dist/mcp/tools/create-task.js +4 -4
  120. package/dist/mcp/tools/list-tasks.js +4 -4
  121. package/dist/mcp/tools/send-message.js +3 -3
  122. package/dist/mcp/tools/update-task.js +4 -4
  123. package/dist/notifications-45QSHDFA.js +45 -0
  124. package/dist/orchestrator-7XBMFK7D.js +33 -0
  125. package/dist/pipeline-router-MQKRNCTR.js +13 -0
  126. package/dist/reranker-CJW3UYE2.js +19 -0
  127. package/dist/review-polling-RL75XLAY.js +124 -0
  128. package/dist/runtime/index.js +3 -3
  129. package/dist/session-events-ZULAN4XL.js +36 -0
  130. package/dist/session-scope-V2RSOTDU.js +86 -0
  131. package/dist/skill-refinement-BSX6Q6IN.js +157 -0
  132. package/dist/task-enforcement-JRTAOYZT.js +333 -0
  133. package/dist/task-scope-GNCB2GAM.js +35 -0
  134. package/dist/tasks-crud-MZIOYF3R.js +77 -0
  135. package/dist/tasks-notify-7KNZ4ULO.js +38 -0
  136. package/dist/tasks-review-U5VEV4Y7.js +47 -0
  137. package/dist/telemetry-upload-BIB5TJA4.js +739 -0
  138. package/dist/tui/App.js +7 -7
  139. package/dist/tui-data-ZSB5DDEY.js +258 -0
  140. package/dist/worker-gate-TXLX33PX.js +21 -0
  141. package/dist/workflow-engine-3PIT3Y56.js +28 -0
  142. package/package.json +1 -1
  143. package/release-notes.json +14 -13
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  registerCreateTask
3
- } from "../../chunk-FIV5A6O2.js";
3
+ } from "../../chunk-G4KEDLSM.js";
4
4
  import "../../chunk-MLXJ5EZG.js";
5
- import "../../chunk-CRZWP3JB.js";
6
- import "../../chunk-CTV755VI.js";
5
+ import "../../chunk-3T4PNG5O.js";
6
+ import "../../chunk-CIWJRYIC.js";
7
7
  import "../../chunk-YG7PIB2R.js";
8
- import "../../chunk-UV4JFYSO.js";
8
+ import "../../chunk-D55SXO3N.js";
9
9
  import "../../chunk-PWLX576L.js";
10
10
  import "../../chunk-5CHYEKMH.js";
11
11
  import "../../chunk-4JERP7NT.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  registerListTasks
3
- } from "../../chunk-PIXFIUXC.js";
4
- import "../../chunk-CRZWP3JB.js";
5
- import "../../chunk-CTV755VI.js";
3
+ } from "../../chunk-4IATAIAF.js";
4
+ import "../../chunk-3T4PNG5O.js";
5
+ import "../../chunk-CIWJRYIC.js";
6
6
  import "../../chunk-YG7PIB2R.js";
7
- import "../../chunk-UV4JFYSO.js";
7
+ import "../../chunk-D55SXO3N.js";
8
8
  import "../../chunk-PWLX576L.js";
9
9
  import "../../chunk-5CHYEKMH.js";
10
10
  import "../../chunk-4JERP7NT.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  registerSendMessage
3
- } from "../../chunk-N2CFR2OZ.js";
4
- import "../../chunk-L5RL4GH4.js";
3
+ } from "../../chunk-O5TZI7OZ.js";
4
+ import "../../chunk-Q3N4KHLM.js";
5
5
  import "../../chunk-YG7PIB2R.js";
6
- import "../../chunk-UV4JFYSO.js";
6
+ import "../../chunk-D55SXO3N.js";
7
7
  import "../../chunk-PWLX576L.js";
8
8
  import "../../chunk-5CHYEKMH.js";
9
9
  import "../../chunk-4JERP7NT.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  registerUpdateTask
3
- } from "../../chunk-L5G37Y7S.js";
4
- import "../../chunk-CRZWP3JB.js";
5
- import "../../chunk-CTV755VI.js";
6
- import "../../chunk-UV4JFYSO.js";
3
+ } from "../../chunk-BQAC3GCO.js";
4
+ import "../../chunk-3T4PNG5O.js";
5
+ import "../../chunk-CIWJRYIC.js";
6
+ import "../../chunk-D55SXO3N.js";
7
7
  import "../../chunk-PWLX576L.js";
8
8
  import "../../chunk-5CHYEKMH.js";
9
9
  import "../../chunk-4JERP7NT.js";
@@ -0,0 +1,45 @@
1
+ import {
2
+ cleanupOldNotifications,
3
+ formatNotifications,
4
+ markAsRead,
5
+ markAsReadByTaskFile,
6
+ markDoneTaskNotificationsAsRead,
7
+ migrateJsonNotifications,
8
+ readUnreadNotifications,
9
+ writeNotification
10
+ } from "./chunk-D55SXO3N.js";
11
+ import "./chunk-PWLX576L.js";
12
+ import "./chunk-5CHYEKMH.js";
13
+ import "./chunk-4JERP7NT.js";
14
+ import "./chunk-3XNYEGA5.js";
15
+ import "./chunk-MVW62NIZ.js";
16
+ import "./chunk-OYNKIAVW.js";
17
+ import "./chunk-CX6GL3ZJ.js";
18
+ import "./chunk-JTADPL6X.js";
19
+ import "./chunk-XJUUWHVN.js";
20
+ import "./chunk-NGP6LSV2.js";
21
+ import "./chunk-A3T5KDD3.js";
22
+ import "./chunk-CVYC6DUW.js";
23
+ import "./chunk-OPU3NYOO.js";
24
+ import "./chunk-GJV3WDWM.js";
25
+ import "./chunk-MP2AFCGL.js";
26
+ import "./chunk-25NFDJ3N.js";
27
+ import "./chunk-HYZV25LY.js";
28
+ import "./chunk-QQZMP6QL.js";
29
+ import "./chunk-2I23RPSI.js";
30
+ import "./chunk-ACBEUQR2.js";
31
+ import "./chunk-FXU7JOXK.js";
32
+ import "./chunk-MOZ2YQ54.js";
33
+ import "./chunk-VXIMSRTO.js";
34
+ import "./chunk-LYH5HE24.js";
35
+ import "./chunk-MLKGABMK.js";
36
+ export {
37
+ cleanupOldNotifications,
38
+ formatNotifications,
39
+ markAsRead,
40
+ markAsReadByTaskFile,
41
+ markDoneTaskNotificationsAsRead,
42
+ migrateJsonNotifications,
43
+ readUnreadNotifications,
44
+ writeNotification
45
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ MultiAgentOrchestrator
3
+ } from "./chunk-EPDSRI6O.js";
4
+ import "./chunk-6WT44S2W.js";
5
+ import "./chunk-D55SXO3N.js";
6
+ import "./chunk-PWLX576L.js";
7
+ import "./chunk-5CHYEKMH.js";
8
+ import "./chunk-4JERP7NT.js";
9
+ import "./chunk-3XNYEGA5.js";
10
+ import "./chunk-MVW62NIZ.js";
11
+ import "./chunk-OYNKIAVW.js";
12
+ import "./chunk-CX6GL3ZJ.js";
13
+ import "./chunk-JTADPL6X.js";
14
+ import "./chunk-XJUUWHVN.js";
15
+ import "./chunk-NGP6LSV2.js";
16
+ import "./chunk-A3T5KDD3.js";
17
+ import "./chunk-CVYC6DUW.js";
18
+ import "./chunk-OPU3NYOO.js";
19
+ import "./chunk-GJV3WDWM.js";
20
+ import "./chunk-MP2AFCGL.js";
21
+ import "./chunk-25NFDJ3N.js";
22
+ import "./chunk-HYZV25LY.js";
23
+ import "./chunk-QQZMP6QL.js";
24
+ import "./chunk-2I23RPSI.js";
25
+ import "./chunk-ACBEUQR2.js";
26
+ import "./chunk-FXU7JOXK.js";
27
+ import "./chunk-MOZ2YQ54.js";
28
+ import "./chunk-VXIMSRTO.js";
29
+ import "./chunk-LYH5HE24.js";
30
+ import "./chunk-MLKGABMK.js";
31
+ export {
32
+ MultiAgentOrchestrator
33
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ ingest
3
+ } from "./chunk-5M4F2FVD.js";
4
+ import "./chunk-QQZMP6QL.js";
5
+ import "./chunk-2I23RPSI.js";
6
+ import "./chunk-ACBEUQR2.js";
7
+ import "./chunk-FXU7JOXK.js";
8
+ import "./chunk-VXIMSRTO.js";
9
+ import "./chunk-LYH5HE24.js";
10
+ import "./chunk-MLKGABMK.js";
11
+ export {
12
+ ingest
13
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ disposeReranker,
3
+ getRerankerModelPath,
4
+ isRerankerAvailable,
5
+ rerank,
6
+ rerankWithContext,
7
+ rerankWithScores
8
+ } from "./chunk-IZ6LCET7.js";
9
+ import "./chunk-VXIMSRTO.js";
10
+ import "./chunk-LYH5HE24.js";
11
+ import "./chunk-MLKGABMK.js";
12
+ export {
13
+ disposeReranker,
14
+ getRerankerModelPath,
15
+ isRerankerAvailable,
16
+ rerank,
17
+ rerankWithContext,
18
+ rerankWithScores
19
+ };
@@ -0,0 +1,124 @@
1
+ import {
2
+ isExeSession,
3
+ strictSessionScopeFilter
4
+ } from "./chunk-D55SXO3N.js";
5
+ import "./chunk-PWLX576L.js";
6
+ import "./chunk-5CHYEKMH.js";
7
+ import "./chunk-4JERP7NT.js";
8
+ import "./chunk-3XNYEGA5.js";
9
+ import "./chunk-MVW62NIZ.js";
10
+ import "./chunk-OYNKIAVW.js";
11
+ import "./chunk-CX6GL3ZJ.js";
12
+ import "./chunk-JTADPL6X.js";
13
+ import "./chunk-XJUUWHVN.js";
14
+ import "./chunk-NGP6LSV2.js";
15
+ import "./chunk-A3T5KDD3.js";
16
+ import "./chunk-CVYC6DUW.js";
17
+ import "./chunk-OPU3NYOO.js";
18
+ import "./chunk-GJV3WDWM.js";
19
+ import "./chunk-MP2AFCGL.js";
20
+ import "./chunk-25NFDJ3N.js";
21
+ import "./chunk-HYZV25LY.js";
22
+ import {
23
+ DEFAULT_COORDINATOR_TEMPLATE_NAME,
24
+ getCoordinatorName
25
+ } from "./chunk-QQZMP6QL.js";
26
+ import "./chunk-2I23RPSI.js";
27
+ import "./chunk-ACBEUQR2.js";
28
+ import "./chunk-FXU7JOXK.js";
29
+ import "./chunk-MOZ2YQ54.js";
30
+ import "./chunk-VXIMSRTO.js";
31
+ import "./chunk-LYH5HE24.js";
32
+ import "./chunk-MLKGABMK.js";
33
+
34
+ // src/lib/review-polling.ts
35
+ import { execSync } from "child_process";
36
+ async function pollPendingReviews(deps, _state) {
37
+ let sessions;
38
+ try {
39
+ sessions = deps.listTmuxSessions().filter((s) => isExeSession(s));
40
+ } catch (err) {
41
+ process.stderr.write(
42
+ `[review-polling] tmux session listing failed: ${err instanceof Error ? err.message : String(err)}
43
+ `
44
+ );
45
+ return [];
46
+ }
47
+ if (sessions.length === 0) return [];
48
+ const sent = [];
49
+ for (const exeSession of sessions) {
50
+ try {
51
+ const orphans = await deps.findOrphanedDoneTasks(exeSession);
52
+ for (const orphan of orphans) {
53
+ try {
54
+ await deps.createReviewForOrphan(orphan);
55
+ } catch {
56
+ }
57
+ }
58
+ } catch {
59
+ }
60
+ }
61
+ return sent;
62
+ }
63
+ function createRealDeps(getClient) {
64
+ return {
65
+ listTmuxSessions: () => {
66
+ try {
67
+ return execSync("tmux list-sessions -F '#{session_name}' 2>/dev/null", {
68
+ encoding: "utf8",
69
+ timeout: 3e3
70
+ }).trim().split("\n").filter(Boolean);
71
+ } catch {
72
+ return [];
73
+ }
74
+ },
75
+ countPendingReviews: async (sessionScope) => {
76
+ const client = getClient();
77
+ const rpScope = strictSessionScopeFilter(sessionScope);
78
+ const result = await client.execute({
79
+ sql: `SELECT COUNT(*) as count FROM tasks
80
+ WHERE status = 'needs_review'${rpScope.sql}`,
81
+ args: [...rpScope.args]
82
+ });
83
+ return Number(result.rows[0]?.count ?? 0);
84
+ },
85
+ sendIntercom: (session) => {
86
+ import("./lib/tmux-routing.js").then(({ sendIntercom: centralSend }) => centralSend(session)).catch(() => {
87
+ });
88
+ },
89
+ findOrphanedDoneTasks: async (sessionScope) => {
90
+ const client = getClient();
91
+ const coordinatorName = getCoordinatorName();
92
+ const odScope = strictSessionScopeFilter(sessionScope, "t");
93
+ const result = await client.execute({
94
+ sql: `SELECT t.id, t.title, t.assigned_to, t.assigned_by,
95
+ t.project_name, t.task_file, t.result, t.status
96
+ FROM tasks t
97
+ WHERE t.status = 'needs_review'
98
+ AND t.assigned_to != ?
99
+ AND t.assigned_to != ?${odScope.sql}
100
+ AND (t.result IS NULL OR t.result NOT LIKE '%## Review notes%')`,
101
+ args: [coordinatorName, DEFAULT_COORDINATOR_TEMPLATE_NAME, ...odScope.args]
102
+ });
103
+ return result.rows;
104
+ },
105
+ createReviewForOrphan: async (task) => {
106
+ const { createReviewForCompletedTask } = await import("./tasks-review-U5VEV4Y7.js");
107
+ const cwd = process.cwd();
108
+ await createReviewForCompletedTask(
109
+ task,
110
+ task.result ?? void 0,
111
+ cwd,
112
+ (/* @__PURE__ */ new Date()).toISOString()
113
+ );
114
+ process.stderr.write(`[exed] Created missing review for: ${task.title} (${task.assigned_to})
115
+ `);
116
+ }
117
+ // findUrgentUnread and findUnstartedTasks removed (2026-05-25 consolidation).
118
+ // All employee nudging handled by task-enforcement → sendIntercom.
119
+ };
120
+ }
121
+ export {
122
+ createRealDeps,
123
+ pollPendingReviews
124
+ };
@@ -3,10 +3,10 @@ import {
3
3
  SessionManager,
4
4
  checkGitSafety,
5
5
  targetsMainBranch
6
- } from "../chunk-RPELMUVE.js";
6
+ } from "../chunk-LPG3U5UW.js";
7
7
  import {
8
8
  MultiAgentOrchestrator
9
- } from "../chunk-X57DHMWB.js";
9
+ } from "../chunk-EPDSRI6O.js";
10
10
  import {
11
11
  createQuietRenderer,
12
12
  createTerminalRenderer,
@@ -57,7 +57,7 @@ import {
57
57
  createDefaultHooks
58
58
  } from "../chunk-O377P7GM.js";
59
59
  import "../chunk-6WT44S2W.js";
60
- import "../chunk-UV4JFYSO.js";
60
+ import "../chunk-D55SXO3N.js";
61
61
  import "../chunk-PWLX576L.js";
62
62
  import "../chunk-5CHYEKMH.js";
63
63
  import "../chunk-4JERP7NT.js";
@@ -0,0 +1,36 @@
1
+ import {
2
+ ensureSessionEventsTable,
3
+ listRecentSessionEvents,
4
+ recordSessionEvent
5
+ } from "./chunk-TK23WXKB.js";
6
+ import "./chunk-D55SXO3N.js";
7
+ import "./chunk-PWLX576L.js";
8
+ import "./chunk-5CHYEKMH.js";
9
+ import "./chunk-4JERP7NT.js";
10
+ import "./chunk-3XNYEGA5.js";
11
+ import "./chunk-MVW62NIZ.js";
12
+ import "./chunk-OYNKIAVW.js";
13
+ import "./chunk-CX6GL3ZJ.js";
14
+ import "./chunk-JTADPL6X.js";
15
+ import "./chunk-XJUUWHVN.js";
16
+ import "./chunk-NGP6LSV2.js";
17
+ import "./chunk-A3T5KDD3.js";
18
+ import "./chunk-CVYC6DUW.js";
19
+ import "./chunk-OPU3NYOO.js";
20
+ import "./chunk-GJV3WDWM.js";
21
+ import "./chunk-MP2AFCGL.js";
22
+ import "./chunk-25NFDJ3N.js";
23
+ import "./chunk-HYZV25LY.js";
24
+ import "./chunk-QQZMP6QL.js";
25
+ import "./chunk-2I23RPSI.js";
26
+ import "./chunk-ACBEUQR2.js";
27
+ import "./chunk-FXU7JOXK.js";
28
+ import "./chunk-MOZ2YQ54.js";
29
+ import "./chunk-VXIMSRTO.js";
30
+ import "./chunk-LYH5HE24.js";
31
+ import "./chunk-MLKGABMK.js";
32
+ export {
33
+ ensureSessionEventsTable,
34
+ listRecentSessionEvents,
35
+ recordSessionEvent
36
+ };
@@ -0,0 +1,86 @@
1
+ import {
2
+ resolveExeSession
3
+ } from "./chunk-D55SXO3N.js";
4
+ import "./chunk-PWLX576L.js";
5
+ import "./chunk-5CHYEKMH.js";
6
+ import "./chunk-4JERP7NT.js";
7
+ import {
8
+ listSessions
9
+ } from "./chunk-3XNYEGA5.js";
10
+ import "./chunk-MVW62NIZ.js";
11
+ import "./chunk-OYNKIAVW.js";
12
+ import "./chunk-CX6GL3ZJ.js";
13
+ import "./chunk-JTADPL6X.js";
14
+ import "./chunk-XJUUWHVN.js";
15
+ import "./chunk-NGP6LSV2.js";
16
+ import "./chunk-A3T5KDD3.js";
17
+ import "./chunk-CVYC6DUW.js";
18
+ import {
19
+ getProjectName
20
+ } from "./chunk-OPU3NYOO.js";
21
+ import "./chunk-GJV3WDWM.js";
22
+ import "./chunk-MP2AFCGL.js";
23
+ import "./chunk-25NFDJ3N.js";
24
+ import "./chunk-HYZV25LY.js";
25
+ import {
26
+ isCoordinatorName
27
+ } from "./chunk-QQZMP6QL.js";
28
+ import "./chunk-2I23RPSI.js";
29
+ import "./chunk-ACBEUQR2.js";
30
+ import "./chunk-FXU7JOXK.js";
31
+ import "./chunk-MOZ2YQ54.js";
32
+ import "./chunk-VXIMSRTO.js";
33
+ import "./chunk-LYH5HE24.js";
34
+ import "./chunk-MLKGABMK.js";
35
+
36
+ // src/lib/session-scope.ts
37
+ function getSessionProject(sessionName) {
38
+ const sessions = listSessions();
39
+ const entry = sessions.find((s) => s.windowName === sessionName);
40
+ if (!entry) return null;
41
+ const parts = entry.projectDir.split("/").filter(Boolean);
42
+ return parts[parts.length - 1] ?? null;
43
+ }
44
+ function findSessionForProject(projectName) {
45
+ const sessions = listSessions();
46
+ for (const s of sessions) {
47
+ const proj = s.projectDir.split("/").filter(Boolean).pop();
48
+ if (proj === projectName && isCoordinatorName(s.agentId)) return s;
49
+ }
50
+ return null;
51
+ }
52
+ function assertSessionScope(actionType, targetProject) {
53
+ try {
54
+ const currentProject = getProjectName();
55
+ const exeSession = resolveExeSession();
56
+ if (!exeSession) {
57
+ return { allowed: true, reason: "no_session" };
58
+ }
59
+ if (currentProject === targetProject) {
60
+ return {
61
+ allowed: true,
62
+ reason: "same_session",
63
+ currentProject,
64
+ targetProject
65
+ };
66
+ }
67
+ process.stderr.write(
68
+ `[session-scope] BLOCKED cross-project ${actionType}: session project="${currentProject}" \u2260 target project="${targetProject}"
69
+ `
70
+ );
71
+ return {
72
+ allowed: false,
73
+ reason: "cross_session_denied",
74
+ currentProject,
75
+ targetProject,
76
+ targetSession: findSessionForProject(targetProject)?.windowName
77
+ };
78
+ } catch {
79
+ return { allowed: true, reason: "no_session" };
80
+ }
81
+ }
82
+ export {
83
+ assertSessionScope,
84
+ findSessionForProject,
85
+ getSessionProject
86
+ };
@@ -0,0 +1,157 @@
1
+ import {
2
+ getClient
3
+ } from "./chunk-QQZMP6QL.js";
4
+ import "./chunk-2I23RPSI.js";
5
+ import "./chunk-ACBEUQR2.js";
6
+ import "./chunk-FXU7JOXK.js";
7
+ import "./chunk-VXIMSRTO.js";
8
+ import "./chunk-LYH5HE24.js";
9
+ import "./chunk-MLKGABMK.js";
10
+
11
+ // src/lib/skill-refinement.ts
12
+ import crypto from "crypto";
13
+ async function incrementSkillUsage(behaviors) {
14
+ const skills = behaviors.filter((b) => b.domain === "skill");
15
+ if (skills.length === 0) return;
16
+ try {
17
+ const client = getClient();
18
+ const now = (/* @__PURE__ */ new Date()).toISOString();
19
+ for (const skill of skills) {
20
+ await client.execute({
21
+ sql: `UPDATE behaviors SET use_count = use_count + 1, last_used_at = ?, updated_at = ? WHERE id = ?`,
22
+ args: [now, now, skill.id]
23
+ });
24
+ }
25
+ } catch (err) {
26
+ process.stderr.write(
27
+ `[skill-refinement] Failed to increment usage: ${err instanceof Error ? err.message : String(err)}
28
+ `
29
+ );
30
+ }
31
+ }
32
+ async function incrementSkillSuccess(assignedTo, projectName) {
33
+ try {
34
+ const client = getClient();
35
+ const now = (/* @__PURE__ */ new Date()).toISOString();
36
+ const cutoff = new Date(Date.now() - 24 * 60 * 60 * 1e3).toISOString();
37
+ const rows = await client.execute({
38
+ sql: `SELECT id FROM behaviors
39
+ WHERE agent_id = ? AND domain = 'skill' AND active = 1
40
+ AND use_count > 0 AND last_used_at > ?
41
+ ${projectName ? "AND (project_name = ? OR project_name IS NULL)" : ""}`,
42
+ args: projectName ? [assignedTo, cutoff, projectName] : [assignedTo, cutoff]
43
+ });
44
+ for (const row of rows.rows) {
45
+ const id = String(row.id);
46
+ await client.execute({
47
+ sql: `UPDATE behaviors SET success_count = success_count + 1, updated_at = ? WHERE id = ?`,
48
+ args: [now, id]
49
+ });
50
+ }
51
+ if (rows.rows.length > 0) {
52
+ process.stderr.write(
53
+ `[skill-refinement] Incremented success_count for ${rows.rows.length} skill(s) (agent: ${assignedTo})
54
+ `
55
+ );
56
+ }
57
+ } catch (err) {
58
+ process.stderr.write(
59
+ `[skill-refinement] Failed to increment success: ${err instanceof Error ? err.message : String(err)}
60
+ `
61
+ );
62
+ }
63
+ }
64
+ var MIN_USES_FOR_REVIEW = 3;
65
+ var LOW_SUCCESS_RATE = 0.8;
66
+ var HIGH_SUCCESS_RATE = 0.9;
67
+ var MIN_USES_FOR_PROMOTION = 10;
68
+ async function runSkillRefinement() {
69
+ const client = getClient();
70
+ const now = (/* @__PURE__ */ new Date()).toISOString();
71
+ const result = {
72
+ reviewed: 0,
73
+ flaggedLowSuccess: 0,
74
+ boostedConfidence: 0,
75
+ promotedToIdentity: 0
76
+ };
77
+ const rows = await client.execute({
78
+ sql: `SELECT id, agent_id, content, use_count, success_count, last_refined_at, project_name
79
+ FROM behaviors
80
+ WHERE domain = 'skill' AND active = 1 AND use_count >= ?`,
81
+ args: [MIN_USES_FOR_REVIEW]
82
+ });
83
+ for (const rawRow of rows.rows) {
84
+ const row = rawRow;
85
+ result.reviewed++;
86
+ const successRate = row.use_count > 0 ? row.success_count / row.use_count : 0;
87
+ if (successRate < LOW_SUCCESS_RATE) {
88
+ result.flaggedLowSuccess++;
89
+ const { writeMemory } = await import("./lib/store.js");
90
+ await writeMemory({
91
+ id: crypto.randomUUID(),
92
+ agent_id: row.agent_id,
93
+ agent_role: "",
94
+ session_id: "",
95
+ timestamp: now,
96
+ tool_name: "skill-refinement",
97
+ project_name: row.project_name ?? "",
98
+ has_error: false,
99
+ raw_text: `SKILL REVIEW NEEDED: "${row.content.slice(0, 100)}..." has ${Math.round(successRate * 100)}% success rate (${row.success_count}/${row.use_count} uses). Consider revising or deactivating.`,
100
+ vector: null,
101
+ memory_type: "observation"
102
+ });
103
+ await client.execute({
104
+ sql: `UPDATE behaviors SET last_refined_at = ?, updated_at = ? WHERE id = ?`,
105
+ args: [now, now, row.id]
106
+ });
107
+ } else if (row.use_count >= MIN_USES_FOR_PROMOTION && successRate > HIGH_SUCCESS_RATE) {
108
+ result.promotedToIdentity++;
109
+ try {
110
+ const { getIdentity, updateIdentity } = await import("./lib/identity.js");
111
+ const identity = await getIdentity(row.agent_id);
112
+ if (identity) {
113
+ const promotionBlock = `
114
+
115
+ ## Promoted Skill (auto-promoted ${now.split("T")[0]})
116
+ ${row.content}`;
117
+ await updateIdentity(row.agent_id, identity + promotionBlock, "skill-refinement");
118
+ }
119
+ await client.execute({
120
+ sql: `UPDATE behaviors SET active = 0, last_refined_at = ?, updated_at = ? WHERE id = ?`,
121
+ args: [now, now, row.id]
122
+ });
123
+ const { writeMemory: writePromoMemory } = await import("./lib/store.js");
124
+ await writePromoMemory({
125
+ id: crypto.randomUUID(),
126
+ agent_id: row.agent_id,
127
+ agent_role: "",
128
+ session_id: "",
129
+ timestamp: now,
130
+ tool_name: "skill-refinement",
131
+ project_name: row.project_name ?? "",
132
+ has_error: false,
133
+ raw_text: `SKILL PROMOTED TO IDENTITY: "${row.content.slice(0, 100)}..." \u2014 ${row.success_count}/${row.use_count} uses (${Math.round(successRate * 100)}% success). Deactivated as behavior, appended to identity.`,
134
+ vector: null,
135
+ memory_type: "decision"
136
+ });
137
+ } catch (err) {
138
+ process.stderr.write(
139
+ `[skill-refinement] Failed to promote skill ${row.id}: ${err instanceof Error ? err.message : String(err)}
140
+ `
141
+ );
142
+ }
143
+ } else if (successRate > HIGH_SUCCESS_RATE) {
144
+ result.boostedConfidence++;
145
+ await client.execute({
146
+ sql: `UPDATE behaviors SET priority = 'p0', last_refined_at = ?, updated_at = ? WHERE id = ? AND priority != 'p0'`,
147
+ args: [now, now, row.id]
148
+ });
149
+ }
150
+ }
151
+ return result;
152
+ }
153
+ export {
154
+ incrementSkillSuccess,
155
+ incrementSkillUsage,
156
+ runSkillRefinement
157
+ };