@askexenow/exe-os 0.9.271 → 0.9.272
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.
- package/dist/active-agent-BDYXURXQ.js +26 -0
- package/dist/active-agent-YWBGAKGU.js +25 -0
- package/dist/agentic-ontology-56VHSVS3.js +25 -0
- package/dist/backfill-metadata-G46ABBVR.js +597 -0
- package/dist/backfill-metadata-VAV27KJK.js +597 -0
- package/dist/behaviors-USUTDXVA.js +25 -0
- package/dist/bin/agentic-ontology-backfill.js +5 -5
- package/dist/bin/agentic-reflection-backfill.js +6 -6
- package/dist/bin/agentic-semantic-label.js +5 -5
- package/dist/bin/backfill-conversations.js +4 -4
- package/dist/bin/backfill-responses.js +4 -4
- package/dist/bin/backfill-vectors.js +5 -5
- package/dist/bin/bulk-sync-postgres.js +6 -6
- package/dist/bin/cc-doctor.js +4 -4
- package/dist/bin/cleanup-stale-review-tasks.js +10 -10
- package/dist/bin/cli.js +16 -16
- package/dist/bin/exe-agent-config.js +3 -3
- package/dist/bin/exe-agent.js +4 -4
- package/dist/bin/exe-assign.js +5 -5
- package/dist/bin/exe-boot.js +17 -17
- package/dist/bin/exe-call.js +4 -4
- package/dist/bin/exe-cloud.js +4 -4
- package/dist/bin/exe-dispatch.js +10 -10
- package/dist/bin/exe-doctor.js +1 -1
- package/dist/bin/exe-export-behaviors.js +7 -7
- package/dist/bin/exe-forget.js +6 -6
- package/dist/bin/exe-gateway.js +7 -7
- package/dist/bin/exe-healthcheck.js +4 -4
- package/dist/bin/exe-heartbeat.js +10 -10
- package/dist/bin/exe-kill.js +13 -13
- package/dist/bin/exe-launch-agent.js +37 -19
- package/dist/bin/exe-new-employee.js +6 -6
- package/dist/bin/exe-pending-messages.js +11 -11
- package/dist/bin/exe-pending-notifications.js +10 -10
- package/dist/bin/exe-pending-reviews.js +10 -10
- package/dist/bin/exe-rename.js +4 -4
- package/dist/bin/exe-review.js +12 -12
- package/dist/bin/exe-search.js +5 -5
- package/dist/bin/exe-session-cleanup.js +15 -15
- package/dist/bin/exe-settings.js +5 -5
- package/dist/bin/exe-start-codex.js +11 -11
- package/dist/bin/exe-start-opencode.js +8 -8
- package/dist/bin/exe-status.js +11 -11
- package/dist/bin/exe-team.js +3 -3
- package/dist/bin/git-sweep.js +11 -11
- package/dist/bin/graph-backfill.js +4 -4
- package/dist/bin/graph-export.js +5 -5
- package/dist/bin/import-history.js +7 -7
- package/dist/bin/install.js +6 -6
- package/dist/bin/intercom-check.js +4 -4
- package/dist/bin/mcp-sessions.js +2 -2
- package/dist/bin/orchestration-metrics.js +4 -4
- package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
- package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
- package/dist/bin/scan-tasks.js +10 -10
- package/dist/bin/setup.js +1 -1
- package/dist/bin/shard-migrate.js +4 -4
- package/dist/capacity-monitor-IFVRCIM7.js +49 -0
- package/dist/capacity-monitor-Q47GBDSY.js +49 -0
- package/dist/catchup-brief-RP4QHXNT.js +151 -0
- package/dist/catchup-brief-TKA6TEK4.js +151 -0
- package/dist/chunk-23KJ2LXY.js +58 -0
- package/dist/chunk-2NQQP3FF.js +630 -0
- package/dist/chunk-3FU5I3KV.js +526 -0
- package/dist/chunk-46IEEKPU.js +13696 -0
- package/dist/chunk-57UAFTO2.js +3958 -0
- package/dist/chunk-5AS622MM.js +3958 -0
- package/dist/chunk-62DEE65H.js +371 -0
- package/dist/chunk-64T6DFSS.js +447 -0
- package/dist/chunk-6BWDP63Z.js +197 -0
- package/dist/chunk-6GPYL7TX.js +214 -0
- package/dist/chunk-6KWLUVFL.js +54 -0
- package/dist/chunk-6N5ISWBF.js +1148 -0
- package/dist/chunk-6OD7PVMC.js +333 -0
- package/dist/chunk-7ET5CYTD.js +382 -0
- package/dist/chunk-7IWLKR6N.js +76 -0
- package/dist/chunk-7OEUOJL5.js +1021 -0
- package/dist/chunk-AIRJTKDK.js +204 -0
- package/dist/chunk-ATJ3NXDP.js +244 -0
- package/dist/chunk-B5IS7LE4.js +128 -0
- package/dist/chunk-BKINEQVI.js +244 -0
- package/dist/chunk-BOJV6NI3.js +128 -0
- package/dist/chunk-BPHWI6N2.js +284 -0
- package/dist/chunk-BXCQWWJP.js +185 -0
- package/dist/chunk-BZ6K7AY3.js +50 -0
- package/dist/chunk-C54KIFLS.js +214 -0
- package/dist/chunk-C6OYEJJI.js +260 -0
- package/dist/chunk-CHBHR5W6.js +3556 -0
- package/dist/chunk-D2T3272U.js +171 -0
- package/dist/chunk-DCHEIVGT.js +221 -0
- package/dist/chunk-DHIBLMSP.js +30 -0
- package/dist/chunk-E2AF2WYY.js +346 -0
- package/dist/chunk-E2KZEZZW.js +1090 -0
- package/dist/chunk-E4KWB4WM.js +348 -0
- package/dist/chunk-ENU7URWK.js +1073 -0
- package/dist/chunk-EZ7KAZMC.js +132 -0
- package/dist/chunk-F4FSSHR4.js +1073 -0
- package/dist/chunk-FPXU56FG.js +346 -0
- package/dist/chunk-FY7HHR5I.js +128 -0
- package/dist/chunk-G2S2UMU4.js +159 -0
- package/dist/chunk-G33BHQCO.js +70 -0
- package/dist/chunk-GJQTL7RX.js +127 -0
- package/dist/chunk-GLCKDEM2.js +97 -0
- package/dist/chunk-GMA34SXV.js +240 -0
- package/dist/chunk-GVAVEBYR.js +2091 -0
- package/dist/chunk-HOSJTLBQ.js +513 -0
- package/dist/chunk-IC6HVAS3.js +56 -0
- package/dist/chunk-IDFJNO44.js +1051 -0
- package/dist/chunk-ILFJMEY5.js +97 -0
- package/dist/chunk-ISQAOSL3.js +1921 -0
- package/dist/chunk-J6V2DCZK.js +382 -0
- package/dist/chunk-JP4CLFLR.js +1148 -0
- package/dist/chunk-JTIOZHWG.js +58 -0
- package/dist/chunk-KDICWAYV.js +1345 -0
- package/dist/chunk-KOBIB6WG.js +159 -0
- package/dist/chunk-KQFDDQB6.js +13696 -0
- package/dist/chunk-KZNSOHCB.js +280 -0
- package/dist/chunk-LVMBYP3C.js +171 -0
- package/dist/chunk-M2WQW5NC.js +227 -0
- package/dist/chunk-MY6SP5NZ.js +551 -0
- package/dist/chunk-N2ACW2ZG.js +363 -0
- package/dist/chunk-NSMJDATI.js +495 -0
- package/dist/chunk-NSQ5JE23.js +1090 -0
- package/dist/chunk-NZL567WG.js +81 -0
- package/dist/chunk-O5OMH6LI.js +244 -0
- package/dist/chunk-OBUV3W7L.js +163 -0
- package/dist/chunk-OLDS7LJN.js +495 -0
- package/dist/chunk-OO2I22RX.js +38 -0
- package/dist/chunk-OPUUT33V.js +447 -0
- package/dist/chunk-OT3VMTKB.js +50 -0
- package/dist/chunk-P6RVIOVA.js +157 -0
- package/dist/chunk-PUA5564C.js +210 -0
- package/dist/chunk-PUQLKLQX.js +731 -0
- package/dist/chunk-QROKS65G.js +76 -0
- package/dist/chunk-R54I2N2T.js +818 -0
- package/dist/chunk-RCFYQHUP.js +818 -0
- package/dist/chunk-RJTND4YS.js +284 -0
- package/dist/chunk-SBLHQMMZ.js +81 -0
- package/dist/chunk-SG2ANG5C.js +123 -0
- package/dist/chunk-SVFNKSZV.js +333 -0
- package/dist/chunk-TAQT2DC7.js +330 -0
- package/dist/chunk-TB7HFW7M.js +127 -0
- package/dist/chunk-UUKDAIH2.js +731 -0
- package/dist/chunk-V6VEFEEH.js +1345 -0
- package/dist/chunk-VIO2ALGH.js +290 -0
- package/dist/chunk-VKCUSNJW.js +377 -0
- package/dist/chunk-VRPPJFIQ.js +1921 -0
- package/dist/chunk-WP3PVBBP.js +204 -0
- package/dist/chunk-WQEUY7DC.js +129 -0
- package/dist/chunk-WXMXUKCA.js +262 -0
- package/dist/chunk-X2WBH2IO.js +297 -0
- package/dist/chunk-X33TSJNO.js +394 -0
- package/dist/chunk-X7MMI2UI.js +89 -0
- package/dist/chunk-XG3BQZIK.js +85 -0
- package/dist/chunk-XIKBIAOS.js +75 -0
- package/dist/chunk-XPEB545Q.js +54 -0
- package/dist/chunk-XWH2MLWS.js +330 -0
- package/dist/chunk-YH7V73XW.js +89 -0
- package/dist/chunk-YMLM5D65.js +135 -0
- package/dist/chunk-YNJPRQ6J.js +377 -0
- package/dist/chunk-YSNEHBI6.js +551 -0
- package/dist/chunk-ZD6BMW2K.js +33 -0
- package/dist/chunk-ZKG5IYCG.js +668 -0
- package/dist/chunk-ZU4K7ZNX.js +197 -0
- package/dist/co-activation-HZMJC34P.js +72 -0
- package/dist/co-occurrence-AVYXRV4L.js +74 -0
- package/dist/core-memory-NPJCVUMF.js +110 -0
- package/dist/core-memory-OKGXL33Z.js +110 -0
- package/dist/crdt-sync-ZCH55JNR.js +33 -0
- package/dist/crm-webhook-6OMVUUGR.js +10 -0
- package/dist/crm-webhook-UCWF3XDB.js +10 -0
- package/dist/cto-delegation-gate-JFZFZGC2.js +206 -0
- package/dist/cto-delegation-gate-K32M4GVM.js +206 -0
- package/dist/daemon-orchestration-2Q7BYOHC.js +135 -0
- package/dist/daemon-orchestration-4RJ2CZJL.js +135 -0
- package/dist/db-backup-5GA2YFDX.js +33 -0
- package/dist/dreaming-I6KXO6E2.js +32 -0
- package/dist/dreaming-NJBK5ILR.js +32 -0
- package/dist/exe-drift-VSMIMHL4.js +68 -0
- package/dist/exe-export-DVHHIA6Y.js +73 -0
- package/dist/exe-export-GIVQDENS.js +73 -0
- package/dist/exe-import-7N46LSMQ.js +76 -0
- package/dist/exe-import-FINYUV5T.js +76 -0
- package/dist/exe-key-H45JY44F.js +579 -0
- package/dist/exe-key-MAEQGTB7.js +579 -0
- package/dist/exe-snapshot-3TEM3BFD.js +164 -0
- package/dist/exe-snapshot-HECGUHL3.js +164 -0
- package/dist/fast-db-init-3CNTADVO.js +7 -0
- package/dist/fast-db-init-HXCS2AP5.js +7 -0
- package/dist/gateway/index.js +8 -8
- package/dist/git-staleness-YCEBBIVK.js +110 -0
- package/dist/git-task-sweep-H34STRNT.js +40 -0
- package/dist/git-task-sweep-YL7NLDCK.js +40 -0
- package/dist/global-procedures-IHZM6C2K.js +20 -0
- package/dist/graph-auto-extract-RZQ3MHP2.js +162 -0
- package/dist/hooks/bug-report-worker.js +12 -12
- package/dist/hooks/codex-stop-task-finalizer.js +12 -12
- package/dist/hooks/commit-complete.js +12 -12
- package/dist/hooks/error-recall.js +6 -6
- package/dist/hooks/exe-heartbeat-hook.js +3 -3
- package/dist/hooks/ingest.js +6 -6
- package/dist/hooks/instructions-loaded.js +4 -4
- package/dist/hooks/manifest.json +19 -19
- package/dist/hooks/notification.js +4 -4
- package/dist/hooks/post-compact.js +11 -11
- package/dist/hooks/post-tool-combined.js +5 -5
- package/dist/hooks/pre-compact.js +12 -12
- package/dist/hooks/pre-tool-use.js +15 -15
- package/dist/hooks/prompt-submit.js +21 -21
- package/dist/hooks/session-end.js +16 -16
- package/dist/hooks/session-start.js +10 -10
- package/dist/hooks/stop.js +15 -15
- package/dist/hooks/subagent-stop.js +11 -11
- package/dist/hooks/summary-worker.js +15 -15
- package/dist/index.js +18 -18
- package/dist/installer-4EW5ZDGD.js +296 -0
- package/dist/installer-B2JTQO55.js +38 -0
- package/dist/installer-MIL352T7.js +342 -0
- package/dist/lib/agent-config.js +9 -3
- package/dist/lib/cloud-sync.js +4 -4
- package/dist/lib/consolidation.js +5 -5
- package/dist/lib/database.js +2 -2
- package/dist/lib/db.js +2 -2
- package/dist/lib/employee-templates.js +4 -4
- package/dist/lib/employees.js +2 -2
- package/dist/lib/exe-daemon.js +34 -34
- package/dist/lib/hybrid-search.js +5 -5
- package/dist/lib/identity.js +2 -2
- package/dist/lib/messaging.js +10 -10
- package/dist/lib/reminders.js +3 -3
- package/dist/lib/schedules.js +5 -5
- package/dist/lib/session-registry.js +4 -4
- package/dist/lib/skill-learning.js +4 -4
- package/dist/lib/store.js +4 -4
- package/dist/lib/task-router.js +3 -3
- package/dist/lib/tasks.js +11 -11
- package/dist/lib/tmux-routing.js +9 -9
- package/dist/lib/token-spend.js +3 -3
- package/dist/mcp/register-tools.js +54 -54
- package/dist/mcp/server.js +55 -55
- package/dist/mcp/tools/complete-reminder.js +4 -4
- package/dist/mcp/tools/create-reminder.js +4 -4
- package/dist/mcp/tools/create-task.js +13 -13
- package/dist/mcp/tools/deactivate-behavior.js +5 -5
- package/dist/mcp/tools/list-reminders.js +4 -4
- package/dist/mcp/tools/list-tasks.js +13 -13
- package/dist/mcp/tools/send-message.js +12 -12
- package/dist/mcp/tools/update-task.js +12 -12
- package/dist/mcp-http-config-OJQR246S.js +27 -0
- package/dist/memory-cards-IPULSQFA.js +174 -0
- package/dist/memory-graph-extractor-3TZZOKHY.js +17 -0
- package/dist/memory-poisoning-defense-SGUGR5YJ.js +225 -0
- package/dist/memory-reflection-H3WGCEM6.js +238 -0
- package/dist/notifications-VWPO6NJF.js +45 -0
- package/dist/notifications-WCSRQN2V.js +45 -0
- package/dist/orchestration-events-O5PSDEIO.js +25 -0
- package/dist/orchestrator-RAPEJUOI.js +33 -0
- package/dist/orchestrator-XPG6LJAI.js +33 -0
- package/dist/pipeline-router-5NT6FUC3.js +13 -0
- package/dist/pipeline-router-KSUXONDT.js +13 -0
- package/dist/plan-limits-53NXLNDQ.js +26 -0
- package/dist/project-boot-ITN3FZMM.js +299 -0
- package/dist/projection-worker-27XX5M2W.js +964 -0
- package/dist/reranker-GU7L2PJX.js +19 -0
- package/dist/reranker-TZEXIJAN.js +19 -0
- package/dist/review-polling-FA2J2Q5O.js +124 -0
- package/dist/review-polling-MLS4BQ3N.js +124 -0
- package/dist/runtime/index.js +12 -12
- package/dist/session-events-WWGF3B2N.js +36 -0
- package/dist/session-events-ZHXXAH6B.js +36 -0
- package/dist/session-kill-telemetry-O4TJHHOZ.js +29 -0
- package/dist/session-scope-CQXB7VMH.js +86 -0
- package/dist/session-scope-HHUMJYF6.js +86 -0
- package/dist/setup-wizard-UM2RHSBJ.js +12 -0
- package/dist/skill-refinement-MJPOHYD5.js +157 -0
- package/dist/skill-refinement-NVUBRK22.js +157 -0
- package/dist/stack-release-BAPCXMXW.js +713 -0
- package/dist/stack-release-W4TWTEZP.js +731 -0
- package/dist/steward-gate-VLE7OCKO.js +13 -0
- package/dist/task-enforcement-FUHDL6UR.js +391 -0
- package/dist/task-enforcement-QL3K4N3F.js +391 -0
- package/dist/task-scope-TZYMB634.js +35 -0
- package/dist/task-scope-ZVLUBS4C.js +35 -0
- package/dist/tasks-crud-4MSLJWXE.js +77 -0
- package/dist/tasks-crud-HIPXKRKX.js +77 -0
- package/dist/tasks-notify-7JBUNE7R.js +38 -0
- package/dist/tasks-notify-UPIJ3L4O.js +38 -0
- package/dist/tasks-review-5SJSFTUB.js +47 -0
- package/dist/tasks-review-JHSYBR5I.js +47 -0
- package/dist/telemetry-upload-BSGOXGUP.js +739 -0
- package/dist/telemetry-upload-LTX3C5HZ.js +739 -0
- package/dist/token-budget-2CDWQU3Q.js +84 -0
- package/dist/tool-telemetry-7YS7EN7B.js +17 -0
- package/dist/tui/App.js +17 -17
- package/dist/tui-data-GDGBOS6G.js +258 -0
- package/dist/tui-data-VXF2RBVM.js +258 -0
- package/dist/wiki-acl-MJIMXRQV.js +111 -0
- package/dist/worker-gate-WQGTZOSM.js +21 -0
- package/dist/worker-gate-X2YDTKTL.js +21 -0
- package/dist/workflow-engine-CYXRZXBM.js +28 -0
- package/dist/workflow-engine-KMLAXVA4.js +28 -0
- package/dist/worktree-NLSKVRNC.js +26 -0
- package/dist/worktree-sweep-44TMEPLE.js +19 -0
- package/package.json +1 -1
- package/release-notes.json +24 -19
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeMemoryViaDaemon
|
|
3
|
+
} from "./chunk-OSXQTCW5.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/auto-checkpoint.ts
|
|
6
|
+
var FILE_RE = /(?:^|\s)([\w./-]+\.(?:ts|tsx|js|jsx|json|md|yml|yaml|sql|go|py|css|scss|html|sh))(?:\b|$)/g;
|
|
7
|
+
var DECISION_RE = /\b(decision:|decided:|we decided|founder directive|captured in .*architecture|source of truth)\b/i;
|
|
8
|
+
function asString(value, fallback = "") {
|
|
9
|
+
if (value == null) return fallback;
|
|
10
|
+
return String(value);
|
|
11
|
+
}
|
|
12
|
+
function compactLine(text, max = 220) {
|
|
13
|
+
return text.replace(/\s+/g, " ").trim().slice(0, max);
|
|
14
|
+
}
|
|
15
|
+
function topEntries(counts, limit) {
|
|
16
|
+
return [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).slice(0, limit).map(([name, count]) => `${name}(${count})`);
|
|
17
|
+
}
|
|
18
|
+
function buildAutoCheckpoint(input) {
|
|
19
|
+
const maxSamples = input.maxSamples ?? 8;
|
|
20
|
+
const projectCounts = /* @__PURE__ */ new Map();
|
|
21
|
+
const toolCounts = /* @__PURE__ */ new Map();
|
|
22
|
+
const files = /* @__PURE__ */ new Set();
|
|
23
|
+
const errors = [];
|
|
24
|
+
const samples = [];
|
|
25
|
+
const decisionTexts = [];
|
|
26
|
+
for (const row of input.memories) {
|
|
27
|
+
const tool = asString(row.tool_name, "unknown");
|
|
28
|
+
const project = asString(row.project_name, input.projectName || "unknown");
|
|
29
|
+
const raw = asString(row.raw_text);
|
|
30
|
+
const hasError = row.has_error === 1 || row.has_error === true;
|
|
31
|
+
toolCounts.set(tool, (toolCounts.get(tool) ?? 0) + 1);
|
|
32
|
+
projectCounts.set(project, (projectCounts.get(project) ?? 0) + 1);
|
|
33
|
+
if (hasError && errors.length < 5) errors.push(compactLine(raw, 180));
|
|
34
|
+
if (samples.length < maxSamples && raw.length > 30) {
|
|
35
|
+
samples.push(`[${tool}] ${compactLine(raw)}`);
|
|
36
|
+
}
|
|
37
|
+
if (DECISION_RE.test(raw) && decisionTexts.length < 5) {
|
|
38
|
+
decisionTexts.push(`AUTO DECISION CANDIDATE [${input.agentId}]: ${compactLine(raw, 500)}`);
|
|
39
|
+
}
|
|
40
|
+
for (const match of raw.matchAll(FILE_RE)) {
|
|
41
|
+
if (match[1]) files.add(match[1]);
|
|
42
|
+
if (files.size >= 20) break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const taskLines = (input.tasks ?? []).slice(0, 10).map((task) => {
|
|
46
|
+
const status = asString(task.status, "unknown");
|
|
47
|
+
const priority = asString(task.priority, "?").toUpperCase();
|
|
48
|
+
const title = asString(task.title, "untitled");
|
|
49
|
+
const taskFile = asString(task.task_file);
|
|
50
|
+
return `- [${status}/${priority}] ${title}${taskFile ? ` (${taskFile})` : ""}`;
|
|
51
|
+
});
|
|
52
|
+
const parts = [
|
|
53
|
+
`CONTEXT CHECKPOINT [auto:${input.reason}]`,
|
|
54
|
+
`Agent: ${input.agentId} (${input.agentRole})`,
|
|
55
|
+
`Session: ${input.sessionId}`,
|
|
56
|
+
`Project: ${input.projectName}`,
|
|
57
|
+
`Time: ${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
58
|
+
"",
|
|
59
|
+
"## Recent Activity",
|
|
60
|
+
`- Memories scanned: ${input.memories.length}`,
|
|
61
|
+
`- Projects: ${topEntries(projectCounts, 5).join(", ") || input.projectName}`,
|
|
62
|
+
`- Tools: ${topEntries(toolCounts, 8).join(", ") || "none"}`
|
|
63
|
+
];
|
|
64
|
+
if (taskLines.length > 0) {
|
|
65
|
+
parts.push("", "## Open / Active Tasks", ...taskLines);
|
|
66
|
+
}
|
|
67
|
+
if (files.size > 0) {
|
|
68
|
+
parts.push("", "## Files Mentioned", ...[...files].slice(0, 20).map((f) => `- ${f}`));
|
|
69
|
+
}
|
|
70
|
+
if (samples.length > 0) {
|
|
71
|
+
parts.push("", "## Important Recent Traces", ...samples.map((s) => `- ${s}`));
|
|
72
|
+
}
|
|
73
|
+
if (errors.length > 0) {
|
|
74
|
+
parts.push("", "## Errors / Risks", ...errors.map((e) => `- ${e}`));
|
|
75
|
+
}
|
|
76
|
+
if (decisionTexts.length > 0) {
|
|
77
|
+
parts.push("", "## Decision Candidates", ...decisionTexts.map((d) => `- ${d.replace(/^AUTO DECISION CANDIDATE \\[[^\\]]+\\]: /, "")}`));
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
checkpointText: parts.join("\n"),
|
|
81
|
+
decisionTexts
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/lib/checkpoint-orchestrator.ts
|
|
86
|
+
function toolNameForReason(reason) {
|
|
87
|
+
switch (reason) {
|
|
88
|
+
case "periodic":
|
|
89
|
+
return "auto-summary";
|
|
90
|
+
case "session-end":
|
|
91
|
+
return "SessionEnd";
|
|
92
|
+
case "pre-compact":
|
|
93
|
+
return "pre-compact-hook";
|
|
94
|
+
case "capacity-signal":
|
|
95
|
+
return "auto-checkpoint";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function importanceForReason(reason, override) {
|
|
99
|
+
if (override !== void 0) return override;
|
|
100
|
+
switch (reason) {
|
|
101
|
+
case "periodic":
|
|
102
|
+
return 7;
|
|
103
|
+
case "session-end":
|
|
104
|
+
case "pre-compact":
|
|
105
|
+
case "capacity-signal":
|
|
106
|
+
return 8;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function buildContinuityCheckpoint(input) {
|
|
110
|
+
const { checkpointText, decisionTexts } = buildAutoCheckpoint({
|
|
111
|
+
agentId: input.agentId,
|
|
112
|
+
agentRole: input.agentRole,
|
|
113
|
+
sessionId: input.sessionId,
|
|
114
|
+
projectName: input.projectName,
|
|
115
|
+
reason: input.reason,
|
|
116
|
+
memories: input.memories ?? [],
|
|
117
|
+
tasks: input.tasks ?? [],
|
|
118
|
+
maxSamples: input.maxSamples
|
|
119
|
+
});
|
|
120
|
+
const extra = input.extraSections?.filter((section) => section.trim().length > 0) ?? [];
|
|
121
|
+
return {
|
|
122
|
+
checkpointText: extra.length > 0 ? `${checkpointText}
|
|
123
|
+
|
|
124
|
+
${extra.join("\n\n")}` : checkpointText,
|
|
125
|
+
decisionTexts
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
async function writeContinuityCheckpoint(input) {
|
|
129
|
+
const result = buildContinuityCheckpoint(input);
|
|
130
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
131
|
+
await writeMemoryViaDaemon({
|
|
132
|
+
raw_text: result.checkpointText,
|
|
133
|
+
agent_id: input.agentId,
|
|
134
|
+
agent_role: input.agentRole,
|
|
135
|
+
session_id: input.sessionId,
|
|
136
|
+
tool_name: toolNameForReason(input.reason),
|
|
137
|
+
project_name: input.projectName,
|
|
138
|
+
timestamp: now,
|
|
139
|
+
importance: importanceForReason(input.reason, input.importance),
|
|
140
|
+
task_id: input.taskId,
|
|
141
|
+
memory_type: "checkpoint"
|
|
142
|
+
});
|
|
143
|
+
const decisionLimit = input.reason === "periodic" ? 3 : 5;
|
|
144
|
+
for (const decisionText of result.decisionTexts.slice(0, decisionLimit)) {
|
|
145
|
+
await writeMemoryViaDaemon({
|
|
146
|
+
raw_text: decisionText,
|
|
147
|
+
agent_id: input.agentId,
|
|
148
|
+
agent_role: input.agentRole,
|
|
149
|
+
session_id: input.sessionId,
|
|
150
|
+
tool_name: "auto-decision",
|
|
151
|
+
project_name: input.projectName,
|
|
152
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
153
|
+
importance: 8,
|
|
154
|
+
memory_type: "decision"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
async function checkpointActiveTask(input) {
|
|
160
|
+
const { writeCheckpoint } = await import("./lib/tasks.js");
|
|
161
|
+
await writeCheckpoint({
|
|
162
|
+
taskId: input.taskId,
|
|
163
|
+
step: input.step ?? "pre-compaction-checkpoint",
|
|
164
|
+
contextSummary: `Auto-checkpoint before context compaction. Task: ${input.taskTitle}. Session: ${input.sessionId}. Project: ${input.projectName}.`
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
writeContinuityCheckpoint,
|
|
170
|
+
checkpointActiveTask
|
|
171
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// src/lib/crdt-sync.ts
|
|
2
|
+
import * as Y from "yjs";
|
|
3
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, unlinkSync } from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { homedir } from "os";
|
|
6
|
+
var DEFAULT_STATE_PATH = path.join(homedir(), ".exe-os", "crdt-state.bin");
|
|
7
|
+
var _statePathOverride = null;
|
|
8
|
+
function getStatePath() {
|
|
9
|
+
return _statePathOverride ?? DEFAULT_STATE_PATH;
|
|
10
|
+
}
|
|
11
|
+
function _setStatePath(p) {
|
|
12
|
+
_statePathOverride = p;
|
|
13
|
+
}
|
|
14
|
+
var doc = null;
|
|
15
|
+
function initCrdtDoc() {
|
|
16
|
+
if (doc) return doc;
|
|
17
|
+
doc = new Y.Doc();
|
|
18
|
+
const sp = getStatePath();
|
|
19
|
+
if (existsSync(sp)) {
|
|
20
|
+
try {
|
|
21
|
+
const state = readFileSync(sp);
|
|
22
|
+
Y.applyUpdate(doc, new Uint8Array(state));
|
|
23
|
+
} catch {
|
|
24
|
+
console.warn("[crdt-sync] WARN: corrupted state file, rebuilding from DB");
|
|
25
|
+
try {
|
|
26
|
+
unlinkSync(sp);
|
|
27
|
+
} catch {
|
|
28
|
+
}
|
|
29
|
+
rebuildFromDb().catch((err) => {
|
|
30
|
+
console.warn("[crdt-sync] rebuild from DB failed:", err);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
doc.on("update", () => {
|
|
35
|
+
persistState();
|
|
36
|
+
});
|
|
37
|
+
return doc;
|
|
38
|
+
}
|
|
39
|
+
function getMemoriesMap() {
|
|
40
|
+
const d = initCrdtDoc();
|
|
41
|
+
return d.getMap("memories");
|
|
42
|
+
}
|
|
43
|
+
function getBehaviorsMap() {
|
|
44
|
+
const d = initCrdtDoc();
|
|
45
|
+
return d.getMap("behaviors");
|
|
46
|
+
}
|
|
47
|
+
function applyRemoteUpdate(update) {
|
|
48
|
+
const d = initCrdtDoc();
|
|
49
|
+
Y.applyUpdate(d, update);
|
|
50
|
+
}
|
|
51
|
+
function getFullState() {
|
|
52
|
+
const d = initCrdtDoc();
|
|
53
|
+
return Y.encodeStateAsUpdate(d);
|
|
54
|
+
}
|
|
55
|
+
function getDiffUpdate(remoteStateVector) {
|
|
56
|
+
const d = initCrdtDoc();
|
|
57
|
+
return Y.encodeStateAsUpdate(d, remoteStateVector);
|
|
58
|
+
}
|
|
59
|
+
function getStateVector() {
|
|
60
|
+
const d = initCrdtDoc();
|
|
61
|
+
return Y.encodeStateVector(d);
|
|
62
|
+
}
|
|
63
|
+
function importExistingMemories(memories) {
|
|
64
|
+
const map = getMemoriesMap();
|
|
65
|
+
const d = initCrdtDoc();
|
|
66
|
+
let imported = 0;
|
|
67
|
+
d.transact(() => {
|
|
68
|
+
for (const mem of memories) {
|
|
69
|
+
if (!mem.id) continue;
|
|
70
|
+
if (map.has(mem.id)) continue;
|
|
71
|
+
const entry = new Y.Map();
|
|
72
|
+
entry.set("id", mem.id);
|
|
73
|
+
entry.set("agent_id", mem.agent_id ?? null);
|
|
74
|
+
entry.set("agent_role", mem.agent_role ?? null);
|
|
75
|
+
entry.set("session_id", mem.session_id ?? null);
|
|
76
|
+
entry.set("timestamp", mem.timestamp ?? null);
|
|
77
|
+
entry.set("tool_name", mem.tool_name ?? null);
|
|
78
|
+
entry.set("project_name", mem.project_name ?? null);
|
|
79
|
+
entry.set("has_error", mem.has_error ?? 0);
|
|
80
|
+
entry.set("raw_text", mem.raw_text ?? "");
|
|
81
|
+
entry.set("version", mem.version ?? 0);
|
|
82
|
+
entry.set("author_device_id", mem.author_device_id ?? null);
|
|
83
|
+
entry.set("scope", mem.scope ?? "business");
|
|
84
|
+
map.set(mem.id, entry);
|
|
85
|
+
imported++;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return imported;
|
|
89
|
+
}
|
|
90
|
+
function importExistingBehaviors(behaviors) {
|
|
91
|
+
const map = getBehaviorsMap();
|
|
92
|
+
const d = initCrdtDoc();
|
|
93
|
+
let imported = 0;
|
|
94
|
+
d.transact(() => {
|
|
95
|
+
for (const beh of behaviors) {
|
|
96
|
+
if (!beh.id) continue;
|
|
97
|
+
if (map.has(beh.id)) continue;
|
|
98
|
+
const entry = new Y.Map();
|
|
99
|
+
entry.set("id", beh.id);
|
|
100
|
+
entry.set("agent_id", beh.agent_id ?? null);
|
|
101
|
+
entry.set("project_name", beh.project_name ?? null);
|
|
102
|
+
entry.set("domain", beh.domain ?? null);
|
|
103
|
+
entry.set("content", beh.content ?? null);
|
|
104
|
+
entry.set("active", beh.active ?? 1);
|
|
105
|
+
entry.set("priority", beh.priority ?? "p1");
|
|
106
|
+
entry.set("created_at", beh.created_at ?? null);
|
|
107
|
+
entry.set("updated_at", beh.updated_at ?? null);
|
|
108
|
+
map.set(beh.id, entry);
|
|
109
|
+
imported++;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return imported;
|
|
113
|
+
}
|
|
114
|
+
function readAllMemories() {
|
|
115
|
+
const map = getMemoriesMap();
|
|
116
|
+
const records = [];
|
|
117
|
+
map.forEach((entry, id) => {
|
|
118
|
+
records.push({
|
|
119
|
+
id,
|
|
120
|
+
agent_id: entry.get("agent_id"),
|
|
121
|
+
agent_role: entry.get("agent_role"),
|
|
122
|
+
session_id: entry.get("session_id"),
|
|
123
|
+
timestamp: entry.get("timestamp"),
|
|
124
|
+
tool_name: entry.get("tool_name"),
|
|
125
|
+
project_name: entry.get("project_name"),
|
|
126
|
+
has_error: entry.get("has_error"),
|
|
127
|
+
raw_text: entry.get("raw_text"),
|
|
128
|
+
version: entry.get("version"),
|
|
129
|
+
author_device_id: entry.get("author_device_id"),
|
|
130
|
+
scope: entry.get("scope"),
|
|
131
|
+
session_scope: entry.get("session_scope")
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
return records;
|
|
135
|
+
}
|
|
136
|
+
function readAllBehaviors() {
|
|
137
|
+
const map = getBehaviorsMap();
|
|
138
|
+
const records = [];
|
|
139
|
+
map.forEach((entry, id) => {
|
|
140
|
+
records.push({
|
|
141
|
+
id,
|
|
142
|
+
agent_id: entry.get("agent_id"),
|
|
143
|
+
project_name: entry.get("project_name"),
|
|
144
|
+
domain: entry.get("domain"),
|
|
145
|
+
content: entry.get("content"),
|
|
146
|
+
active: entry.get("active"),
|
|
147
|
+
priority: entry.get("priority"),
|
|
148
|
+
created_at: entry.get("created_at"),
|
|
149
|
+
updated_at: entry.get("updated_at")
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
return records;
|
|
153
|
+
}
|
|
154
|
+
function onUpdate(callback) {
|
|
155
|
+
const d = initCrdtDoc();
|
|
156
|
+
const handler = (update) => callback(update);
|
|
157
|
+
d.on("update", handler);
|
|
158
|
+
return () => d.off("update", handler);
|
|
159
|
+
}
|
|
160
|
+
function persistState() {
|
|
161
|
+
if (!doc) return;
|
|
162
|
+
try {
|
|
163
|
+
const sp = getStatePath();
|
|
164
|
+
const dir = path.dirname(sp);
|
|
165
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
166
|
+
const state = Y.encodeStateAsUpdate(doc);
|
|
167
|
+
writeFileSync(sp, Buffer.from(state));
|
|
168
|
+
} catch {
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function isCrdtSyncEnabled() {
|
|
172
|
+
return process.env.EXE_CRDT_SYNC === "1";
|
|
173
|
+
}
|
|
174
|
+
async function rebuildFromDb() {
|
|
175
|
+
const { getClient } = await import("./lib/database.js");
|
|
176
|
+
const client = getClient();
|
|
177
|
+
const result = await client.execute(
|
|
178
|
+
"SELECT id, agent_id, agent_role, session_id, timestamp, tool_name, project_name, has_error, raw_text, version, author_device_id, scope, session_scope FROM memories"
|
|
179
|
+
);
|
|
180
|
+
const memories = result.rows.map((row) => ({
|
|
181
|
+
id: String(row.id),
|
|
182
|
+
agent_id: row.agent_id,
|
|
183
|
+
agent_role: row.agent_role,
|
|
184
|
+
session_id: row.session_id,
|
|
185
|
+
timestamp: row.timestamp,
|
|
186
|
+
tool_name: row.tool_name,
|
|
187
|
+
project_name: row.project_name,
|
|
188
|
+
has_error: row.has_error,
|
|
189
|
+
raw_text: row.raw_text,
|
|
190
|
+
version: row.version,
|
|
191
|
+
author_device_id: row.author_device_id,
|
|
192
|
+
scope: row.scope,
|
|
193
|
+
session_scope: row.session_scope
|
|
194
|
+
}));
|
|
195
|
+
const count = importExistingMemories(memories);
|
|
196
|
+
persistState();
|
|
197
|
+
return count;
|
|
198
|
+
}
|
|
199
|
+
function destroyCrdtDoc() {
|
|
200
|
+
if (doc) {
|
|
201
|
+
doc.destroy();
|
|
202
|
+
doc = null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export {
|
|
207
|
+
_setStatePath,
|
|
208
|
+
initCrdtDoc,
|
|
209
|
+
applyRemoteUpdate,
|
|
210
|
+
getFullState,
|
|
211
|
+
getDiffUpdate,
|
|
212
|
+
getStateVector,
|
|
213
|
+
importExistingMemories,
|
|
214
|
+
importExistingBehaviors,
|
|
215
|
+
readAllMemories,
|
|
216
|
+
readAllBehaviors,
|
|
217
|
+
onUpdate,
|
|
218
|
+
isCrdtSyncEnabled,
|
|
219
|
+
rebuildFromDb,
|
|
220
|
+
destroyCrdtDoc
|
|
221
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createReminder
|
|
3
|
+
} from "./chunk-IC6HVAS3.js";
|
|
4
|
+
|
|
5
|
+
// src/mcp/tools/create-reminder.ts
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
function registerCreateReminder(server) {
|
|
8
|
+
server.registerTool(
|
|
9
|
+
"create_reminder",
|
|
10
|
+
{
|
|
11
|
+
title: "Create Reminder",
|
|
12
|
+
description: "Set a reminder for the founder. Shown in the boot brief every session.",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
text: z.string().describe("What to remind about"),
|
|
15
|
+
due_date: z.string().optional().describe("Optional due date \u2014 ISO date (2026-04-01) or null for persistent")
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
async ({ text, due_date }) => {
|
|
19
|
+
const reminder = await createReminder(text, due_date);
|
|
20
|
+
const dueStr = reminder.dueDate ? ` (due: ${reminder.dueDate})` : "";
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: "text", text: `Reminder set: "${reminder.text}"${dueStr}` }]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
registerCreateReminder
|
|
30
|
+
};
|