@askexenow/exe-os 0.9.300 → 0.9.301
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/deploy/compose/erp-nginx/nginx.conf +6 -3
- package/dist/active-agent-UNJO6AJ2.js +27 -0
- package/dist/active-agent-Y5LSIMVC.js +28 -0
- package/dist/agentic-ontology-QEV7GI3T.js +25 -0
- package/dist/backfill-metadata-RQZ4BN7G.js +600 -0
- package/dist/behaviors-A3L5CWMK.js +46 -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 +7 -7
- package/dist/bin/cc-doctor.js +4 -4
- package/dist/bin/cleanup-stale-review-tasks.js +9 -9
- package/dist/bin/cli.js +15 -15
- package/dist/bin/exe-agent-config.js +2 -2
- package/dist/bin/exe-agent.js +4 -4
- package/dist/bin/exe-assign.js +5 -5
- package/dist/bin/exe-boot.js +23 -18
- package/dist/bin/exe-call.js +4 -4
- package/dist/bin/exe-cloud.js +7 -7
- package/dist/bin/exe-dispatch.js +9 -9
- package/dist/bin/exe-doctor.js +2 -2
- 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 +9 -9
- package/dist/bin/exe-kill.js +12 -12
- package/dist/bin/exe-launch-agent.js +16 -16
- package/dist/bin/exe-new-employee.js +6 -6
- package/dist/bin/exe-pending-messages.js +10 -10
- package/dist/bin/exe-pending-notifications.js +9 -9
- package/dist/bin/exe-pending-reviews.js +9 -9
- package/dist/bin/exe-rename.js +4 -4
- package/dist/bin/exe-review.js +11 -11
- package/dist/bin/exe-search.js +5 -5
- package/dist/bin/exe-session-cleanup.js +14 -14
- package/dist/bin/exe-settings.js +7 -7
- package/dist/bin/exe-start-codex.js +11 -11
- package/dist/bin/exe-start-opencode.js +8 -8
- package/dist/bin/exe-status.js +10 -10
- package/dist/bin/exe-team.js +3 -3
- package/dist/bin/exe-watchdog.js +3 -3
- package/dist/bin/git-sweep.js +10 -10
- 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 +9 -9
- package/dist/bin/setup.js +1 -1
- package/dist/bin/shard-migrate.js +4 -4
- package/dist/capability-cards-VTGDTOZ4.js +89 -0
- package/dist/capacity-monitor-G2MAJPRP.js +51 -0
- package/dist/catchup-brief-VBGEJQRS.js +175 -0
- package/dist/chunk-24JVDLQJ.js +345 -0
- package/dist/chunk-2T3OYZMR.js +1158 -0
- package/dist/chunk-3ABY3QDX.js +199 -0
- package/dist/chunk-3G3ECFB5.js +668 -0
- package/dist/chunk-3LHOFGHT.js +280 -0
- package/dist/chunk-3RA62PNQ.js +58 -0
- package/dist/chunk-3XRS5AVV.js +567 -0
- package/dist/chunk-3YK7X5FD.js +1186 -0
- package/dist/chunk-4L6PVYFE.js +54 -0
- package/dist/chunk-4O67LBMK.js +377 -0
- package/dist/chunk-4OIU3N6U.js +167 -0
- package/dist/chunk-5SYYMNPE.js +30 -0
- package/dist/chunk-5TO5PH7O.js +304 -0
- package/dist/chunk-5XD2Y463.js +402 -0
- package/dist/chunk-63AENHJC.js +123 -0
- package/dist/chunk-673IFJYB.js +731 -0
- package/dist/chunk-7AWH47AR.js +448 -0
- package/dist/chunk-7P4B6AEP.js +227 -0
- package/dist/chunk-7VHOALNC.js +244 -0
- package/dist/chunk-ASJHCAVL.js +38 -0
- package/dist/chunk-DICIFTCS.js +150 -0
- package/dist/chunk-DIFI5JDC.js +76 -0
- package/dist/chunk-DPOIJ5SM.js +284 -0
- package/dist/chunk-FAZNXNA5.js +33 -0
- package/dist/chunk-FCHG5RC4.js +197 -0
- package/dist/chunk-FFKSPZO2.js +157 -0
- package/dist/chunk-FNHYH5U6.js +331 -0
- package/dist/chunk-FWPDAQ6Q.js +1350 -0
- package/dist/chunk-FZB73QOI.js +210 -0
- package/dist/chunk-GJBR6QLD.js +630 -0
- package/dist/chunk-GRSYAHKI.js +535 -0
- package/dist/chunk-J5HFRVNW.js +362 -0
- package/dist/chunk-J6SD7LT2.js +171 -0
- package/dist/chunk-JURL2S27.js +128 -0
- package/dist/chunk-KPUYYOFS.js +122 -0
- package/dist/chunk-LAFARYU5.js +456 -0
- package/dist/chunk-LSDXEHKL.js +381 -0
- package/dist/chunk-MS2EOZJQ.js +290 -0
- package/dist/chunk-MUIMJGSQ.js +128 -0
- package/dist/chunk-NJMPNYBS.js +427 -0
- package/dist/chunk-OJACH2JF.js +128 -0
- package/dist/chunk-OO4IFABD.js +382 -0
- package/dist/chunk-Q65NCNL4.js +1352 -0
- package/dist/chunk-QIGS2LRT.js +735 -0
- package/dist/chunk-S73ZAJ2S.js +262 -0
- package/dist/chunk-SJ4UF7YK.js +1094 -0
- package/dist/chunk-SOZ7D77I.js +204 -0
- package/dist/chunk-TDX2LK2M.js +240 -0
- package/dist/chunk-U5RKGLV6.js +50 -0
- package/dist/chunk-UFGTHBHP.js +127 -0
- package/dist/chunk-ULCYWCPI.js +1079 -0
- package/dist/chunk-V6LOEOXG.js +3372 -0
- package/dist/chunk-VAZOVAW4.js +2162 -0
- package/dist/chunk-VEUQVKKT.js +185 -0
- package/dist/chunk-VIDDJ5RF.js +214 -0
- package/dist/chunk-VNB4ROYG.js +348 -0
- package/dist/chunk-VWUQFZFB.js +395 -0
- package/dist/chunk-W77GRCNA.js +85 -0
- package/dist/chunk-WVMG4ZRH.js +14597 -0
- package/dist/chunk-WYVOTRRZ.js +129 -0
- package/dist/chunk-XQQ7D4I4.js +85 -0
- package/dist/chunk-YHJPTIPR.js +836 -0
- package/dist/chunk-YLKS7KKC.js +2145 -0
- package/dist/chunk-YU3KEVCO.js +333 -0
- package/dist/chunk-ZDPU3JTF.js +221 -0
- package/dist/chunk-ZDY4LYAJ.js +81 -0
- package/dist/chunk-ZG33AACD.js +70 -0
- package/dist/chunk-ZKHPZ6KN.js +181 -0
- package/dist/chunk-ZO2TM5N5.js +97 -0
- package/dist/chunk-ZSUACDQC.js +4388 -0
- package/dist/co-activation-XM25BLZM.js +74 -0
- package/dist/co-occurrence-CKEMDPWO.js +95 -0
- package/dist/core-memory-ZDA76EU3.js +110 -0
- package/dist/crdt-sync-BJKZB6T6.js +33 -0
- package/dist/crm-webhook-E5PAFAUN.js +10 -0
- package/dist/cto-delegation-gate-EMY6ZZ2F.js +280 -0
- package/dist/daemon-orchestration-Y5Y6YNE3.js +143 -0
- package/dist/db-backup-HFJ53IBU.js +43 -0
- package/dist/doc-graph-extractor-ID45AQ2P.js +133 -0
- package/dist/dreaming-N6B7KBIE.js +34 -0
- package/dist/exe-drift-CPUEAPIU.js +70 -0
- package/dist/exe-export-4RTGDV53.js +77 -0
- package/dist/exe-import-AZMIF34Z.js +80 -0
- package/dist/exe-key-LJV23AJI.js +673 -0
- package/dist/exe-snapshot-ZOZBW7V6.js +338 -0
- package/dist/fast-db-init-ATRZGHOL.js +7 -0
- package/dist/gateway/index.js +8 -8
- package/dist/git-staleness-XNOKI4D3.js +112 -0
- package/dist/git-task-sweep-3MO4OVND.js +42 -0
- package/dist/global-procedures-EBAPPWGZ.js +22 -0
- package/dist/graph-auto-extract-VJOUQBPK.js +183 -0
- package/dist/hooks/bug-report-worker.js +11 -11
- package/dist/hooks/codex-stop-task-finalizer.js +11 -11
- package/dist/hooks/commit-complete.js +11 -11
- 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 +14 -14
- package/dist/hooks/prompt-submit.js +26 -24
- package/dist/hooks/session-end.js +15 -15
- package/dist/hooks/session-start.js +12 -12
- package/dist/hooks/stop.js +14 -14
- package/dist/hooks/subagent-stop.js +10 -10
- package/dist/hooks/summary-worker.js +14 -14
- package/dist/index.js +17 -17
- package/dist/installer-37KFNAWE.js +344 -0
- package/dist/installer-F55NR4E2.js +298 -0
- package/dist/installer-KOYBUS4J.js +40 -0
- package/dist/lib/cloud-sync.js +7 -7
- 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 +40 -40
- package/dist/lib/hybrid-search.js +5 -5
- package/dist/lib/identity.js +2 -2
- package/dist/lib/messaging.js +9 -9
- 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 +6 -6
- package/dist/lib/store.js +4 -4
- package/dist/lib/task-router.js +3 -3
- package/dist/lib/tasks.js +10 -10
- package/dist/lib/tmux-routing.js +8 -8
- 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 +12 -12
- package/dist/mcp/tools/deactivate-behavior.js +7 -7
- package/dist/mcp/tools/list-reminders.js +4 -4
- package/dist/mcp/tools/list-tasks.js +12 -12
- package/dist/mcp/tools/send-message.js +11 -11
- package/dist/mcp/tools/update-task.js +11 -11
- package/dist/mcp-http-config-7KJZI7UD.js +31 -0
- package/dist/memory-cards-ZIT7ZKL5.js +180 -0
- package/dist/memory-graph-extractor-LY2VORZT.js +22 -0
- package/dist/memory-poisoning-defense-SEM25TY5.js +224 -0
- package/dist/memory-reflection-J2W7CJ7C.js +244 -0
- package/dist/notifications-RLMSI4YE.js +47 -0
- package/dist/orchestration-events-TGQYA72K.js +27 -0
- package/dist/orchestrator-JQD5G3CW.js +35 -0
- package/dist/pipeline-router-3Q3YBYSM.js +15 -0
- package/dist/plan-limits-YGXTYCW4.js +28 -0
- package/dist/project-boot-TDOZKKDR.js +299 -0
- package/dist/projection-worker-TMKUSVGD.js +1084 -0
- package/dist/prospective-memory-CNJDBNWF.js +232 -0
- package/dist/reranker-YQIRNGDM.js +19 -0
- package/dist/retrieval-health-M5BVB7EV.js +12 -0
- package/dist/review-polling-ZMB3OBPC.js +126 -0
- package/dist/runtime/index.js +11 -11
- package/dist/session-events-UTMCKDIN.js +38 -0
- package/dist/session-kill-telemetry-FRQA5MVD.js +31 -0
- package/dist/session-scope-2BD6QLNI.js +88 -0
- package/dist/setup-wizard-W64I6SHC.js +12 -0
- package/dist/skill-refinement-FXCXTUS2.js +159 -0
- package/dist/steward-gate-JDR3SLH3.js +15 -0
- package/dist/task-enforcement-WCEA4FZI.js +506 -0
- package/dist/task-scope-L5GDL2AV.js +37 -0
- package/dist/tasks-crud-S36AFYYM.js +79 -0
- package/dist/tasks-notify-W2W2BJRB.js +40 -0
- package/dist/tasks-review-34WV7BX2.js +49 -0
- package/dist/telemetry-upload-3CSVO3J7.js +741 -0
- package/dist/token-budget-ZG2MQ5GD.js +86 -0
- package/dist/tool-telemetry-ODL4F2CW.js +17 -0
- package/dist/tui/App.js +16 -16
- package/dist/tui-data-Z5UF7KEI.js +260 -0
- package/dist/wiki-acl-SZFHCEC4.js +111 -0
- package/dist/worker-gate-OOO6BWZ6.js +21 -0
- package/dist/workflow-engine-QY3IFFR2.js +28 -0
- package/dist/worktree-CNOQZBNT.js +28 -0
- package/dist/worktree-sweep-SE7ITXC4.js +21 -0
- package/package.json +1 -1
- package/release-notes.json +88 -88
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getClient
|
|
3
|
+
} from "./chunk-V6LOEOXG.js";
|
|
4
|
+
import {
|
|
5
|
+
loadConfig
|
|
6
|
+
} from "./chunk-R36FAN53.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/reminders.ts
|
|
9
|
+
import crypto from "crypto";
|
|
10
|
+
async function getCloudConfig() {
|
|
11
|
+
try {
|
|
12
|
+
const config = await loadConfig();
|
|
13
|
+
if (config.cloud?.apiKey && config.cloud?.endpoint) {
|
|
14
|
+
return { apiKey: config.cloud.apiKey, endpoint: config.cloud.endpoint };
|
|
15
|
+
}
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function apiBaseUrl(cloud) {
|
|
21
|
+
try {
|
|
22
|
+
const url = new URL(cloud.endpoint);
|
|
23
|
+
if (url.hostname.startsWith("sync.")) {
|
|
24
|
+
url.hostname = url.hostname.replace(/^sync\./, "api.");
|
|
25
|
+
return url.origin;
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
}
|
|
29
|
+
return "https://api.askexe.com";
|
|
30
|
+
}
|
|
31
|
+
async function cloudPushReminder(cloud, text, dueDate) {
|
|
32
|
+
try {
|
|
33
|
+
const base = apiBaseUrl(cloud);
|
|
34
|
+
await fetch(`${base}/v1/reminders`, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
headers: {
|
|
37
|
+
"Authorization": `Bearer ${cloud.apiKey}`,
|
|
38
|
+
"Content-Type": "application/json"
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify({ text, due_date: dueDate })
|
|
41
|
+
});
|
|
42
|
+
} catch (err) {
|
|
43
|
+
process.stderr.write(`[reminders] cloud push failed: ${err instanceof Error ? err.message : String(err)}
|
|
44
|
+
`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function cloudFetchReminders(cloud) {
|
|
48
|
+
try {
|
|
49
|
+
const base = apiBaseUrl(cloud);
|
|
50
|
+
const res = await fetch(`${base}/v1/reminders`, {
|
|
51
|
+
method: "GET",
|
|
52
|
+
headers: {
|
|
53
|
+
"Authorization": `Bearer ${cloud.apiKey}`
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
if (!res.ok) return [];
|
|
57
|
+
const data = await res.json();
|
|
58
|
+
if (!Array.isArray(data.items)) return [];
|
|
59
|
+
return data.items.map((r) => ({
|
|
60
|
+
id: r.id,
|
|
61
|
+
text: r.text,
|
|
62
|
+
createdAt: r.created_at,
|
|
63
|
+
dueDate: r.due_date,
|
|
64
|
+
completedAt: r.completed_at,
|
|
65
|
+
source: "cloud"
|
|
66
|
+
}));
|
|
67
|
+
} catch (err) {
|
|
68
|
+
process.stderr.write(`[reminders] cloud fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
69
|
+
`);
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function cloudDeleteReminder(cloud, id) {
|
|
74
|
+
try {
|
|
75
|
+
const base = apiBaseUrl(cloud);
|
|
76
|
+
await fetch(`${base}/v1/reminders/${encodeURIComponent(id)}`, {
|
|
77
|
+
method: "DELETE",
|
|
78
|
+
headers: {
|
|
79
|
+
"Authorization": `Bearer ${cloud.apiKey}`
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
} catch (err) {
|
|
83
|
+
process.stderr.write(`[reminders] cloud delete failed: ${err instanceof Error ? err.message : String(err)}
|
|
84
|
+
`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function dedup(local, cloud) {
|
|
88
|
+
const localKeys = /* @__PURE__ */ new Set();
|
|
89
|
+
for (const r of local) {
|
|
90
|
+
localKeys.add(`${r.text.trim().toLowerCase()}|${r.dueDate ?? ""}`);
|
|
91
|
+
}
|
|
92
|
+
const merged = local.map((r) => ({ ...r, source: "local" }));
|
|
93
|
+
for (const r of cloud) {
|
|
94
|
+
const key = `${r.text.trim().toLowerCase()}|${r.dueDate ?? ""}`;
|
|
95
|
+
if (localKeys.has(key)) {
|
|
96
|
+
const existing = merged.find(
|
|
97
|
+
(m) => m.text.trim().toLowerCase() === r.text.trim().toLowerCase() && (m.dueDate ?? "") === (r.dueDate ?? "")
|
|
98
|
+
);
|
|
99
|
+
if (existing) existing.source = "both";
|
|
100
|
+
} else {
|
|
101
|
+
merged.push({ ...r, source: "cloud" });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return merged;
|
|
105
|
+
}
|
|
106
|
+
async function createReminder(text, dueDate) {
|
|
107
|
+
const client = getClient();
|
|
108
|
+
const id = crypto.randomUUID();
|
|
109
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
110
|
+
await client.execute({
|
|
111
|
+
sql: `INSERT INTO reminders (id, text, created_at, due_date) VALUES (?, ?, ?, ?)`,
|
|
112
|
+
args: [id, text, now, dueDate ?? null]
|
|
113
|
+
});
|
|
114
|
+
const cloud = await getCloudConfig();
|
|
115
|
+
if (cloud) {
|
|
116
|
+
cloudPushReminder(cloud, text, dueDate ?? null).catch(() => {
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return { id, text, createdAt: now, dueDate: dueDate ?? null, completedAt: null };
|
|
120
|
+
}
|
|
121
|
+
async function listReminders(includeCompleted = false) {
|
|
122
|
+
const client = getClient();
|
|
123
|
+
const sql = includeCompleted ? `SELECT id, text, created_at, due_date, completed_at FROM reminders ORDER BY due_date ASC NULLS LAST LIMIT 500` : `SELECT id, text, created_at, due_date, completed_at FROM reminders WHERE completed_at IS NULL ORDER BY due_date ASC NULLS LAST LIMIT 500`;
|
|
124
|
+
const result = await client.execute(sql);
|
|
125
|
+
const local = result.rows.map((row) => ({
|
|
126
|
+
id: String(row.id),
|
|
127
|
+
text: String(row.text),
|
|
128
|
+
createdAt: String(row.created_at),
|
|
129
|
+
dueDate: row.due_date ? String(row.due_date) : null,
|
|
130
|
+
completedAt: row.completed_at ? String(row.completed_at) : null
|
|
131
|
+
}));
|
|
132
|
+
const cloud = await getCloudConfig();
|
|
133
|
+
if (cloud) {
|
|
134
|
+
const cloudReminders = await cloudFetchReminders(cloud);
|
|
135
|
+
return dedup(local, cloudReminders);
|
|
136
|
+
}
|
|
137
|
+
return local;
|
|
138
|
+
}
|
|
139
|
+
async function completeReminder(idOrText) {
|
|
140
|
+
const client = getClient();
|
|
141
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
142
|
+
let result = await client.execute({
|
|
143
|
+
sql: `SELECT id, text FROM reminders WHERE id = ? AND completed_at IS NULL`,
|
|
144
|
+
args: [idOrText]
|
|
145
|
+
});
|
|
146
|
+
if (result.rows.length === 0) {
|
|
147
|
+
result = await client.execute({
|
|
148
|
+
sql: `SELECT id, text FROM reminders WHERE completed_at IS NULL AND text LIKE '%' || ? || '%' LIMIT 1`,
|
|
149
|
+
args: [idOrText]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (result.rows.length === 0) return null;
|
|
153
|
+
const row = result.rows[0];
|
|
154
|
+
const id = String(row.id);
|
|
155
|
+
const text = String(row.text);
|
|
156
|
+
await client.execute({
|
|
157
|
+
sql: `UPDATE reminders SET completed_at = ? WHERE id = ?`,
|
|
158
|
+
args: [now, id]
|
|
159
|
+
});
|
|
160
|
+
const cloud = await getCloudConfig();
|
|
161
|
+
if (cloud) {
|
|
162
|
+
cloudDeleteReminder(cloud, id).catch(() => {
|
|
163
|
+
});
|
|
164
|
+
cloudFetchReminders(cloud).then((cloudReminders) => {
|
|
165
|
+
for (const cr of cloudReminders) {
|
|
166
|
+
if (cr.text.trim().toLowerCase() === text.trim().toLowerCase()) {
|
|
167
|
+
cloudDeleteReminder(cloud, cr.id).catch(() => {
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}).catch(() => {
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return { id, text, createdAt: "", dueDate: null, completedAt: now };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export {
|
|
178
|
+
createReminder,
|
|
179
|
+
listReminders,
|
|
180
|
+
completeReminder
|
|
181
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listBehaviors
|
|
3
|
+
} from "./chunk-FNHYH5U6.js";
|
|
4
|
+
import {
|
|
5
|
+
loadConfigSync
|
|
6
|
+
} from "./chunk-R36FAN53.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/behaviors-export.ts
|
|
9
|
+
import os from "os";
|
|
10
|
+
import path from "path";
|
|
11
|
+
import {
|
|
12
|
+
existsSync,
|
|
13
|
+
mkdirSync,
|
|
14
|
+
readdirSync,
|
|
15
|
+
statSync,
|
|
16
|
+
unlinkSync,
|
|
17
|
+
writeFileSync
|
|
18
|
+
} from "fs";
|
|
19
|
+
var BEHAVIORS_EXPORT_DIR = path.join(
|
|
20
|
+
os.homedir(),
|
|
21
|
+
".exe-os",
|
|
22
|
+
"behaviors-export"
|
|
23
|
+
);
|
|
24
|
+
var STALE_EXPORT_AGE_MS = 60 * 60 * 1e3;
|
|
25
|
+
var DEFAULT_BEHAVIOR_LIMIT = 30;
|
|
26
|
+
function getBehaviorLimit() {
|
|
27
|
+
try {
|
|
28
|
+
const cfg = loadConfigSync();
|
|
29
|
+
return cfg.behaviorExportLimit ?? DEFAULT_BEHAVIOR_LIMIT;
|
|
30
|
+
} catch {
|
|
31
|
+
return DEFAULT_BEHAVIOR_LIMIT;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function sweepStaleBehaviorExports(now = Date.now()) {
|
|
35
|
+
if (!existsSync(BEHAVIORS_EXPORT_DIR)) return;
|
|
36
|
+
let entries;
|
|
37
|
+
try {
|
|
38
|
+
entries = readdirSync(BEHAVIORS_EXPORT_DIR);
|
|
39
|
+
} catch {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const filePath = path.join(BEHAVIORS_EXPORT_DIR, entry);
|
|
44
|
+
try {
|
|
45
|
+
const stat = statSync(filePath);
|
|
46
|
+
if (now - stat.mtimeMs > STALE_EXPORT_AGE_MS) {
|
|
47
|
+
unlinkSync(filePath);
|
|
48
|
+
}
|
|
49
|
+
} catch {
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function renderBehaviorLine(row) {
|
|
54
|
+
const tag = row.domain ? `[${row.domain}] ` : "";
|
|
55
|
+
const scope = row.project_name ? ` (${row.project_name})` : "";
|
|
56
|
+
return `- ${tag}${row.content}${scope}`;
|
|
57
|
+
}
|
|
58
|
+
function renderBehaviorExport(behaviors) {
|
|
59
|
+
if (behaviors.length === 0) {
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
const lines = behaviors.map(renderBehaviorLine);
|
|
63
|
+
return [
|
|
64
|
+
"<system-reminder>",
|
|
65
|
+
"## Your Behavioral Memory",
|
|
66
|
+
"Validated patterns and corrections for this session. Follow them.",
|
|
67
|
+
"Sourced from exe-os Layer 2 (Expertise). Changes apply on next spawn.",
|
|
68
|
+
"",
|
|
69
|
+
...lines,
|
|
70
|
+
"</system-reminder>",
|
|
71
|
+
""
|
|
72
|
+
].join("\n");
|
|
73
|
+
}
|
|
74
|
+
function exportFilePath(agentId, projectName, sessionKey) {
|
|
75
|
+
if (!sessionKey) {
|
|
76
|
+
return path.join(BEHAVIORS_EXPORT_DIR, `${agentId}.md`);
|
|
77
|
+
}
|
|
78
|
+
const safeProject = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
79
|
+
return path.join(
|
|
80
|
+
BEHAVIORS_EXPORT_DIR,
|
|
81
|
+
`${agentId}-${safeProject}-${sessionKey}.md`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
async function exportBehaviorsForAgent(agentId, projectName, sessionKey) {
|
|
85
|
+
mkdirSync(BEHAVIORS_EXPORT_DIR, { recursive: true });
|
|
86
|
+
sweepStaleBehaviorExports();
|
|
87
|
+
const behaviors = await listBehaviors(agentId, projectName, getBehaviorLimit());
|
|
88
|
+
if (behaviors.length === 0) return null;
|
|
89
|
+
const body = renderBehaviorExport(behaviors);
|
|
90
|
+
const target = exportFilePath(agentId, projectName, sessionKey);
|
|
91
|
+
writeFileSync(target, body, "utf-8");
|
|
92
|
+
return target;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
exportBehaviorsForAgent
|
|
97
|
+
};
|