@askexenow/exe-os 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -79
- package/dist/bin/backfill-responses.js +160 -8
- package/dist/bin/backfill-vectors.js +130 -1
- package/dist/bin/cleanup-stale-review-tasks.js +130 -1
- package/dist/bin/cli.js +10111 -7540
- package/dist/bin/exe-agent.js +159 -1
- package/dist/bin/exe-assign.js +235 -16
- package/dist/bin/exe-boot.js +344 -472
- package/dist/bin/exe-call.js +145 -1
- package/dist/bin/exe-cloud.js +11 -0
- package/dist/bin/exe-dispatch.js +37 -24
- package/dist/bin/exe-doctor.js +130 -1
- package/dist/bin/exe-export-behaviors.js +150 -7
- package/dist/bin/exe-forget.js +822 -665
- package/dist/bin/exe-gateway.js +470 -62
- package/dist/bin/exe-heartbeat.js +133 -2
- package/dist/bin/exe-kill.js +150 -7
- package/dist/bin/exe-launch-agent.js +150 -7
- package/dist/bin/exe-new-employee.js +756 -224
- package/dist/bin/exe-pending-messages.js +132 -2
- package/dist/bin/exe-pending-notifications.js +130 -1
- package/dist/bin/exe-pending-reviews.js +132 -2
- package/dist/bin/exe-review.js +160 -8
- package/dist/bin/exe-search.js +2473 -2008
- package/dist/bin/exe-session-cleanup.js +238 -51
- package/dist/bin/exe-settings.js +11 -0
- package/dist/bin/exe-status.js +130 -1
- package/dist/bin/exe-team.js +130 -1
- package/dist/bin/git-sweep.js +272 -16
- package/dist/bin/graph-backfill.js +150 -7
- package/dist/bin/graph-export.js +150 -7
- package/dist/bin/install.js +5 -0
- package/dist/bin/scan-tasks.js +238 -19
- package/dist/bin/setup.js +1776 -10
- package/dist/bin/shard-migrate.js +150 -7
- package/dist/bin/update.js +9 -6
- package/dist/bin/wiki-sync.js +150 -7
- package/dist/gateway/index.js +470 -62
- package/dist/hooks/bug-report-worker.js +195 -35
- package/dist/hooks/commit-complete.js +272 -16
- package/dist/hooks/error-recall.js +2313 -1847
- package/dist/hooks/exe-heartbeat-hook.js +5 -0
- package/dist/hooks/ingest-worker.js +330 -58
- package/dist/hooks/ingest.js +11 -0
- package/dist/hooks/instructions-loaded.js +199 -10
- package/dist/hooks/notification.js +199 -10
- package/dist/hooks/post-compact.js +199 -10
- package/dist/hooks/pre-compact.js +199 -10
- package/dist/hooks/pre-tool-use.js +199 -10
- package/dist/hooks/prompt-ingest-worker.js +179 -14
- package/dist/hooks/prompt-submit.js +781 -285
- package/dist/hooks/response-ingest-worker.js +1900 -1405
- package/dist/hooks/session-end.js +456 -12
- package/dist/hooks/session-start.js +2188 -1724
- package/dist/hooks/stop.js +200 -10
- package/dist/hooks/subagent-stop.js +199 -10
- package/dist/hooks/summary-worker.js +604 -334
- package/dist/index.js +554 -61
- package/dist/lib/cloud-sync.js +5 -0
- package/dist/lib/config.js +13 -0
- package/dist/lib/consolidation.js +5 -0
- package/dist/lib/database.js +104 -0
- package/dist/lib/device-registry.js +109 -0
- package/dist/lib/embedder.js +13 -0
- package/dist/lib/employee-templates.js +53 -26
- package/dist/lib/employees.js +5 -0
- package/dist/lib/exe-daemon-client.js +5 -0
- package/dist/lib/exe-daemon.js +493 -79
- package/dist/lib/file-grep.js +20 -4
- package/dist/lib/hybrid-search.js +1435 -190
- package/dist/lib/identity-templates.js +126 -5
- package/dist/lib/identity.js +5 -0
- package/dist/lib/license.js +5 -0
- package/dist/lib/messaging.js +37 -24
- package/dist/lib/schedules.js +130 -1
- package/dist/lib/skill-learning.js +11 -0
- package/dist/lib/status-brief.js +5 -0
- package/dist/lib/store.js +199 -10
- package/dist/lib/task-router.js +72 -6
- package/dist/lib/tasks.js +179 -50
- package/dist/lib/tmux-routing.js +179 -46
- package/dist/mcp/server.js +2129 -1855
- package/dist/mcp/tools/create-task.js +86 -36
- package/dist/mcp/tools/deactivate-behavior.js +5 -0
- package/dist/mcp/tools/list-tasks.js +39 -11
- package/dist/mcp/tools/send-message.js +37 -24
- package/dist/mcp/tools/update-task.js +153 -38
- package/dist/runtime/index.js +451 -59
- package/dist/tui/App.js +454 -59
- package/package.json +1 -1
|
@@ -222,6 +222,27 @@ async function ensureSchema() {
|
|
|
222
222
|
});
|
|
223
223
|
} catch {
|
|
224
224
|
}
|
|
225
|
+
try {
|
|
226
|
+
await client.execute({
|
|
227
|
+
sql: `ALTER TABLE tasks ADD COLUMN checkpoint TEXT`,
|
|
228
|
+
args: []
|
|
229
|
+
});
|
|
230
|
+
} catch {
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
await client.execute({
|
|
234
|
+
sql: `ALTER TABLE tasks ADD COLUMN checkpoint_count INTEGER NOT NULL DEFAULT 0`,
|
|
235
|
+
args: []
|
|
236
|
+
});
|
|
237
|
+
} catch {
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
await client.execute({
|
|
241
|
+
sql: `ALTER TABLE tasks ADD COLUMN complexity TEXT NOT NULL DEFAULT 'standard'`,
|
|
242
|
+
args: []
|
|
243
|
+
});
|
|
244
|
+
} catch {
|
|
245
|
+
}
|
|
225
246
|
try {
|
|
226
247
|
await client.execute({
|
|
227
248
|
sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
|
|
@@ -632,6 +653,15 @@ async function ensureSchema() {
|
|
|
632
653
|
} catch {
|
|
633
654
|
}
|
|
634
655
|
}
|
|
656
|
+
for (const col of [
|
|
657
|
+
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
658
|
+
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'"
|
|
659
|
+
]) {
|
|
660
|
+
try {
|
|
661
|
+
await client.execute(col);
|
|
662
|
+
} catch {
|
|
663
|
+
}
|
|
664
|
+
}
|
|
635
665
|
await client.executeMultiple(`
|
|
636
666
|
CREATE INDEX IF NOT EXISTS idx_memories_workspace
|
|
637
667
|
ON memories(workspace_id);
|
|
@@ -696,6 +726,34 @@ async function ensureSchema() {
|
|
|
696
726
|
CREATE INDEX IF NOT EXISTS idx_conversations_channel
|
|
697
727
|
ON conversations(channel_id);
|
|
698
728
|
`);
|
|
729
|
+
try {
|
|
730
|
+
await client.execute({
|
|
731
|
+
sql: `ALTER TABLE tasks ADD COLUMN budget_tokens INTEGER`,
|
|
732
|
+
args: []
|
|
733
|
+
});
|
|
734
|
+
} catch {
|
|
735
|
+
}
|
|
736
|
+
try {
|
|
737
|
+
await client.execute({
|
|
738
|
+
sql: `ALTER TABLE tasks ADD COLUMN budget_fallback_model TEXT`,
|
|
739
|
+
args: []
|
|
740
|
+
});
|
|
741
|
+
} catch {
|
|
742
|
+
}
|
|
743
|
+
try {
|
|
744
|
+
await client.execute({
|
|
745
|
+
sql: `ALTER TABLE tasks ADD COLUMN tokens_used INTEGER DEFAULT 0`,
|
|
746
|
+
args: []
|
|
747
|
+
});
|
|
748
|
+
} catch {
|
|
749
|
+
}
|
|
750
|
+
try {
|
|
751
|
+
await client.execute({
|
|
752
|
+
sql: `ALTER TABLE tasks ADD COLUMN tokens_warned_at INTEGER`,
|
|
753
|
+
args: []
|
|
754
|
+
});
|
|
755
|
+
} catch {
|
|
756
|
+
}
|
|
699
757
|
await client.executeMultiple(`
|
|
700
758
|
CREATE VIRTUAL TABLE IF NOT EXISTS conversations_fts USING fts5(
|
|
701
759
|
content_text,
|
|
@@ -722,6 +780,52 @@ async function ensureSchema() {
|
|
|
722
780
|
VALUES (new.rowid, new.content_text, new.sender_name, new.agent_response);
|
|
723
781
|
END;
|
|
724
782
|
`);
|
|
783
|
+
try {
|
|
784
|
+
await client.execute({
|
|
785
|
+
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
786
|
+
args: []
|
|
787
|
+
});
|
|
788
|
+
} catch {
|
|
789
|
+
}
|
|
790
|
+
try {
|
|
791
|
+
await client.execute(
|
|
792
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)`
|
|
793
|
+
);
|
|
794
|
+
} catch {
|
|
795
|
+
}
|
|
796
|
+
try {
|
|
797
|
+
await client.execute({
|
|
798
|
+
sql: `UPDATE memories SET tier = 1 WHERE tool_name = 'commit_to_long_term_memory' AND importance >= 8 AND tier = 3`,
|
|
799
|
+
args: []
|
|
800
|
+
});
|
|
801
|
+
await client.execute({
|
|
802
|
+
sql: `UPDATE memories SET tier = 2 WHERE tool_name IN ('store_memory', 'manual') AND importance >= 5 AND tier = 3`,
|
|
803
|
+
args: []
|
|
804
|
+
});
|
|
805
|
+
} catch {
|
|
806
|
+
}
|
|
807
|
+
try {
|
|
808
|
+
await client.execute({
|
|
809
|
+
sql: `ALTER TABLE memories ADD COLUMN supersedes_id TEXT`,
|
|
810
|
+
args: []
|
|
811
|
+
});
|
|
812
|
+
} catch {
|
|
813
|
+
}
|
|
814
|
+
try {
|
|
815
|
+
await client.execute(
|
|
816
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL`
|
|
817
|
+
);
|
|
818
|
+
} catch {
|
|
819
|
+
}
|
|
820
|
+
for (const col of [
|
|
821
|
+
"ALTER TABLE tasks ADD COLUMN checkpoint TEXT",
|
|
822
|
+
"ALTER TABLE tasks ADD COLUMN checkpoint_count INTEGER DEFAULT 0"
|
|
823
|
+
]) {
|
|
824
|
+
try {
|
|
825
|
+
await client.execute(col);
|
|
826
|
+
} catch {
|
|
827
|
+
}
|
|
828
|
+
}
|
|
725
829
|
}
|
|
726
830
|
var _client, initTurso;
|
|
727
831
|
var init_database = __esm({
|
|
@@ -798,6 +902,11 @@ function normalizeSessionLifecycle(raw) {
|
|
|
798
902
|
const userSL = raw.sessionLifecycle ?? {};
|
|
799
903
|
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
800
904
|
}
|
|
905
|
+
function normalizeAutoUpdate(raw) {
|
|
906
|
+
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
907
|
+
const userAU = raw.autoUpdate ?? {};
|
|
908
|
+
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
909
|
+
}
|
|
801
910
|
async function loadConfig() {
|
|
802
911
|
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
803
912
|
await mkdir2(dir, { recursive: true });
|
|
@@ -820,6 +929,7 @@ async function loadConfig() {
|
|
|
820
929
|
}
|
|
821
930
|
normalizeScalingRoadmap(migratedCfg);
|
|
822
931
|
normalizeSessionLifecycle(migratedCfg);
|
|
932
|
+
normalizeAutoUpdate(migratedCfg);
|
|
823
933
|
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
824
934
|
if (config.dbPath.startsWith("~")) {
|
|
825
935
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
@@ -895,6 +1005,11 @@ var init_config = __esm({
|
|
|
895
1005
|
idleKillTicksRequired: 3,
|
|
896
1006
|
idleKillIntercomAckWindowMs: 1e4,
|
|
897
1007
|
maxAutoInstances: 10
|
|
1008
|
+
},
|
|
1009
|
+
autoUpdate: {
|
|
1010
|
+
checkOnBoot: true,
|
|
1011
|
+
autoInstall: false,
|
|
1012
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
898
1013
|
}
|
|
899
1014
|
};
|
|
900
1015
|
CONFIG_MIGRATIONS = [
|
|
@@ -1028,13 +1143,27 @@ async function ensureShardSchema(client) {
|
|
|
1028
1143
|
"ALTER TABLE memories ADD COLUMN document_id TEXT",
|
|
1029
1144
|
"ALTER TABLE memories ADD COLUMN user_id TEXT",
|
|
1030
1145
|
"ALTER TABLE memories ADD COLUMN char_offset INTEGER",
|
|
1031
|
-
"ALTER TABLE memories ADD COLUMN page_number INTEGER"
|
|
1146
|
+
"ALTER TABLE memories ADD COLUMN page_number INTEGER",
|
|
1147
|
+
// Source provenance columns (must match database.ts)
|
|
1148
|
+
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1149
|
+
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
1150
|
+
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
1151
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
1032
1152
|
]) {
|
|
1033
1153
|
try {
|
|
1034
1154
|
await client.execute(col);
|
|
1035
1155
|
} catch {
|
|
1036
1156
|
}
|
|
1037
1157
|
}
|
|
1158
|
+
for (const idx of [
|
|
1159
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)",
|
|
1160
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL"
|
|
1161
|
+
]) {
|
|
1162
|
+
try {
|
|
1163
|
+
await client.execute(idx);
|
|
1164
|
+
} catch {
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1038
1167
|
try {
|
|
1039
1168
|
await client.execute("CREATE INDEX IF NOT EXISTS idx_memories_status ON memories(status)");
|
|
1040
1169
|
} catch {
|
|
@@ -1197,11 +1326,12 @@ var init_provider_table = __esm({
|
|
|
1197
1326
|
import { readFileSync as readFileSync2, writeFileSync, renameSync as renameSync2, existsSync as existsSync4, mkdirSync as mkdirSync2 } from "fs";
|
|
1198
1327
|
import path5 from "path";
|
|
1199
1328
|
import os3 from "os";
|
|
1200
|
-
var QUEUE_PATH, INTERCOM_LOG;
|
|
1329
|
+
var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
|
|
1201
1330
|
var init_intercom_queue = __esm({
|
|
1202
1331
|
"src/lib/intercom-queue.ts"() {
|
|
1203
1332
|
"use strict";
|
|
1204
1333
|
QUEUE_PATH = path5.join(os3.homedir(), ".exe-os", "intercom-queue.json");
|
|
1334
|
+
TTL_MS = 60 * 60 * 1e3;
|
|
1205
1335
|
INTERCOM_LOG = path5.join(os3.homedir(), ".exe-os", "intercom.log");
|
|
1206
1336
|
}
|
|
1207
1337
|
});
|
|
@@ -81,6 +81,11 @@ function normalizeSessionLifecycle(raw) {
|
|
|
81
81
|
const userSL = raw.sessionLifecycle ?? {};
|
|
82
82
|
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
83
83
|
}
|
|
84
|
+
function normalizeAutoUpdate(raw) {
|
|
85
|
+
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
86
|
+
const userAU = raw.autoUpdate ?? {};
|
|
87
|
+
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
88
|
+
}
|
|
84
89
|
async function loadConfig() {
|
|
85
90
|
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
86
91
|
await mkdir2(dir, { recursive: true });
|
|
@@ -103,6 +108,7 @@ async function loadConfig() {
|
|
|
103
108
|
}
|
|
104
109
|
normalizeScalingRoadmap(migratedCfg);
|
|
105
110
|
normalizeSessionLifecycle(migratedCfg);
|
|
111
|
+
normalizeAutoUpdate(migratedCfg);
|
|
106
112
|
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
107
113
|
if (config.dbPath.startsWith("~")) {
|
|
108
114
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
@@ -178,6 +184,11 @@ var init_config = __esm({
|
|
|
178
184
|
idleKillTicksRequired: 3,
|
|
179
185
|
idleKillIntercomAckWindowMs: 1e4,
|
|
180
186
|
maxAutoInstances: 10
|
|
187
|
+
},
|
|
188
|
+
autoUpdate: {
|
|
189
|
+
checkOnBoot: true,
|
|
190
|
+
autoInstall: false,
|
|
191
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
181
192
|
}
|
|
182
193
|
};
|
|
183
194
|
CONFIG_MIGRATIONS = [
|
|
@@ -311,13 +322,27 @@ async function ensureShardSchema(client) {
|
|
|
311
322
|
"ALTER TABLE memories ADD COLUMN document_id TEXT",
|
|
312
323
|
"ALTER TABLE memories ADD COLUMN user_id TEXT",
|
|
313
324
|
"ALTER TABLE memories ADD COLUMN char_offset INTEGER",
|
|
314
|
-
"ALTER TABLE memories ADD COLUMN page_number INTEGER"
|
|
325
|
+
"ALTER TABLE memories ADD COLUMN page_number INTEGER",
|
|
326
|
+
// Source provenance columns (must match database.ts)
|
|
327
|
+
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
328
|
+
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
329
|
+
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
330
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
315
331
|
]) {
|
|
316
332
|
try {
|
|
317
333
|
await client.execute(col);
|
|
318
334
|
} catch {
|
|
319
335
|
}
|
|
320
336
|
}
|
|
337
|
+
for (const idx of [
|
|
338
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)",
|
|
339
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL"
|
|
340
|
+
]) {
|
|
341
|
+
try {
|
|
342
|
+
await client.execute(idx);
|
|
343
|
+
} catch {
|
|
344
|
+
}
|
|
345
|
+
}
|
|
321
346
|
try {
|
|
322
347
|
await client.execute("CREATE INDEX IF NOT EXISTS idx_memories_status ON memories(status)");
|
|
323
348
|
} catch {
|
|
@@ -631,6 +656,27 @@ async function ensureSchema() {
|
|
|
631
656
|
});
|
|
632
657
|
} catch {
|
|
633
658
|
}
|
|
659
|
+
try {
|
|
660
|
+
await client.execute({
|
|
661
|
+
sql: `ALTER TABLE tasks ADD COLUMN checkpoint TEXT`,
|
|
662
|
+
args: []
|
|
663
|
+
});
|
|
664
|
+
} catch {
|
|
665
|
+
}
|
|
666
|
+
try {
|
|
667
|
+
await client.execute({
|
|
668
|
+
sql: `ALTER TABLE tasks ADD COLUMN checkpoint_count INTEGER NOT NULL DEFAULT 0`,
|
|
669
|
+
args: []
|
|
670
|
+
});
|
|
671
|
+
} catch {
|
|
672
|
+
}
|
|
673
|
+
try {
|
|
674
|
+
await client.execute({
|
|
675
|
+
sql: `ALTER TABLE tasks ADD COLUMN complexity TEXT NOT NULL DEFAULT 'standard'`,
|
|
676
|
+
args: []
|
|
677
|
+
});
|
|
678
|
+
} catch {
|
|
679
|
+
}
|
|
634
680
|
try {
|
|
635
681
|
await client.execute({
|
|
636
682
|
sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
|
|
@@ -1041,6 +1087,15 @@ async function ensureSchema() {
|
|
|
1041
1087
|
} catch {
|
|
1042
1088
|
}
|
|
1043
1089
|
}
|
|
1090
|
+
for (const col of [
|
|
1091
|
+
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1092
|
+
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'"
|
|
1093
|
+
]) {
|
|
1094
|
+
try {
|
|
1095
|
+
await client.execute(col);
|
|
1096
|
+
} catch {
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1044
1099
|
await client.executeMultiple(`
|
|
1045
1100
|
CREATE INDEX IF NOT EXISTS idx_memories_workspace
|
|
1046
1101
|
ON memories(workspace_id);
|
|
@@ -1105,6 +1160,34 @@ async function ensureSchema() {
|
|
|
1105
1160
|
CREATE INDEX IF NOT EXISTS idx_conversations_channel
|
|
1106
1161
|
ON conversations(channel_id);
|
|
1107
1162
|
`);
|
|
1163
|
+
try {
|
|
1164
|
+
await client.execute({
|
|
1165
|
+
sql: `ALTER TABLE tasks ADD COLUMN budget_tokens INTEGER`,
|
|
1166
|
+
args: []
|
|
1167
|
+
});
|
|
1168
|
+
} catch {
|
|
1169
|
+
}
|
|
1170
|
+
try {
|
|
1171
|
+
await client.execute({
|
|
1172
|
+
sql: `ALTER TABLE tasks ADD COLUMN budget_fallback_model TEXT`,
|
|
1173
|
+
args: []
|
|
1174
|
+
});
|
|
1175
|
+
} catch {
|
|
1176
|
+
}
|
|
1177
|
+
try {
|
|
1178
|
+
await client.execute({
|
|
1179
|
+
sql: `ALTER TABLE tasks ADD COLUMN tokens_used INTEGER DEFAULT 0`,
|
|
1180
|
+
args: []
|
|
1181
|
+
});
|
|
1182
|
+
} catch {
|
|
1183
|
+
}
|
|
1184
|
+
try {
|
|
1185
|
+
await client.execute({
|
|
1186
|
+
sql: `ALTER TABLE tasks ADD COLUMN tokens_warned_at INTEGER`,
|
|
1187
|
+
args: []
|
|
1188
|
+
});
|
|
1189
|
+
} catch {
|
|
1190
|
+
}
|
|
1108
1191
|
await client.executeMultiple(`
|
|
1109
1192
|
CREATE VIRTUAL TABLE IF NOT EXISTS conversations_fts USING fts5(
|
|
1110
1193
|
content_text,
|
|
@@ -1131,6 +1214,52 @@ async function ensureSchema() {
|
|
|
1131
1214
|
VALUES (new.rowid, new.content_text, new.sender_name, new.agent_response);
|
|
1132
1215
|
END;
|
|
1133
1216
|
`);
|
|
1217
|
+
try {
|
|
1218
|
+
await client.execute({
|
|
1219
|
+
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
1220
|
+
args: []
|
|
1221
|
+
});
|
|
1222
|
+
} catch {
|
|
1223
|
+
}
|
|
1224
|
+
try {
|
|
1225
|
+
await client.execute(
|
|
1226
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)`
|
|
1227
|
+
);
|
|
1228
|
+
} catch {
|
|
1229
|
+
}
|
|
1230
|
+
try {
|
|
1231
|
+
await client.execute({
|
|
1232
|
+
sql: `UPDATE memories SET tier = 1 WHERE tool_name = 'commit_to_long_term_memory' AND importance >= 8 AND tier = 3`,
|
|
1233
|
+
args: []
|
|
1234
|
+
});
|
|
1235
|
+
await client.execute({
|
|
1236
|
+
sql: `UPDATE memories SET tier = 2 WHERE tool_name IN ('store_memory', 'manual') AND importance >= 5 AND tier = 3`,
|
|
1237
|
+
args: []
|
|
1238
|
+
});
|
|
1239
|
+
} catch {
|
|
1240
|
+
}
|
|
1241
|
+
try {
|
|
1242
|
+
await client.execute({
|
|
1243
|
+
sql: `ALTER TABLE memories ADD COLUMN supersedes_id TEXT`,
|
|
1244
|
+
args: []
|
|
1245
|
+
});
|
|
1246
|
+
} catch {
|
|
1247
|
+
}
|
|
1248
|
+
try {
|
|
1249
|
+
await client.execute(
|
|
1250
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL`
|
|
1251
|
+
);
|
|
1252
|
+
} catch {
|
|
1253
|
+
}
|
|
1254
|
+
for (const col of [
|
|
1255
|
+
"ALTER TABLE tasks ADD COLUMN checkpoint TEXT",
|
|
1256
|
+
"ALTER TABLE tasks ADD COLUMN checkpoint_count INTEGER DEFAULT 0"
|
|
1257
|
+
]) {
|
|
1258
|
+
try {
|
|
1259
|
+
await client.execute(col);
|
|
1260
|
+
} catch {
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1134
1263
|
}
|
|
1135
1264
|
|
|
1136
1265
|
// src/lib/keychain.ts
|
|
@@ -223,6 +223,27 @@ async function ensureSchema() {
|
|
|
223
223
|
});
|
|
224
224
|
} catch {
|
|
225
225
|
}
|
|
226
|
+
try {
|
|
227
|
+
await client.execute({
|
|
228
|
+
sql: `ALTER TABLE tasks ADD COLUMN checkpoint TEXT`,
|
|
229
|
+
args: []
|
|
230
|
+
});
|
|
231
|
+
} catch {
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
await client.execute({
|
|
235
|
+
sql: `ALTER TABLE tasks ADD COLUMN checkpoint_count INTEGER NOT NULL DEFAULT 0`,
|
|
236
|
+
args: []
|
|
237
|
+
});
|
|
238
|
+
} catch {
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
await client.execute({
|
|
242
|
+
sql: `ALTER TABLE tasks ADD COLUMN complexity TEXT NOT NULL DEFAULT 'standard'`,
|
|
243
|
+
args: []
|
|
244
|
+
});
|
|
245
|
+
} catch {
|
|
246
|
+
}
|
|
226
247
|
try {
|
|
227
248
|
await client.execute({
|
|
228
249
|
sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
|
|
@@ -633,6 +654,15 @@ async function ensureSchema() {
|
|
|
633
654
|
} catch {
|
|
634
655
|
}
|
|
635
656
|
}
|
|
657
|
+
for (const col of [
|
|
658
|
+
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
659
|
+
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'"
|
|
660
|
+
]) {
|
|
661
|
+
try {
|
|
662
|
+
await client.execute(col);
|
|
663
|
+
} catch {
|
|
664
|
+
}
|
|
665
|
+
}
|
|
636
666
|
await client.executeMultiple(`
|
|
637
667
|
CREATE INDEX IF NOT EXISTS idx_memories_workspace
|
|
638
668
|
ON memories(workspace_id);
|
|
@@ -697,6 +727,34 @@ async function ensureSchema() {
|
|
|
697
727
|
CREATE INDEX IF NOT EXISTS idx_conversations_channel
|
|
698
728
|
ON conversations(channel_id);
|
|
699
729
|
`);
|
|
730
|
+
try {
|
|
731
|
+
await client.execute({
|
|
732
|
+
sql: `ALTER TABLE tasks ADD COLUMN budget_tokens INTEGER`,
|
|
733
|
+
args: []
|
|
734
|
+
});
|
|
735
|
+
} catch {
|
|
736
|
+
}
|
|
737
|
+
try {
|
|
738
|
+
await client.execute({
|
|
739
|
+
sql: `ALTER TABLE tasks ADD COLUMN budget_fallback_model TEXT`,
|
|
740
|
+
args: []
|
|
741
|
+
});
|
|
742
|
+
} catch {
|
|
743
|
+
}
|
|
744
|
+
try {
|
|
745
|
+
await client.execute({
|
|
746
|
+
sql: `ALTER TABLE tasks ADD COLUMN tokens_used INTEGER DEFAULT 0`,
|
|
747
|
+
args: []
|
|
748
|
+
});
|
|
749
|
+
} catch {
|
|
750
|
+
}
|
|
751
|
+
try {
|
|
752
|
+
await client.execute({
|
|
753
|
+
sql: `ALTER TABLE tasks ADD COLUMN tokens_warned_at INTEGER`,
|
|
754
|
+
args: []
|
|
755
|
+
});
|
|
756
|
+
} catch {
|
|
757
|
+
}
|
|
700
758
|
await client.executeMultiple(`
|
|
701
759
|
CREATE VIRTUAL TABLE IF NOT EXISTS conversations_fts USING fts5(
|
|
702
760
|
content_text,
|
|
@@ -723,6 +781,52 @@ async function ensureSchema() {
|
|
|
723
781
|
VALUES (new.rowid, new.content_text, new.sender_name, new.agent_response);
|
|
724
782
|
END;
|
|
725
783
|
`);
|
|
784
|
+
try {
|
|
785
|
+
await client.execute({
|
|
786
|
+
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
787
|
+
args: []
|
|
788
|
+
});
|
|
789
|
+
} catch {
|
|
790
|
+
}
|
|
791
|
+
try {
|
|
792
|
+
await client.execute(
|
|
793
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)`
|
|
794
|
+
);
|
|
795
|
+
} catch {
|
|
796
|
+
}
|
|
797
|
+
try {
|
|
798
|
+
await client.execute({
|
|
799
|
+
sql: `UPDATE memories SET tier = 1 WHERE tool_name = 'commit_to_long_term_memory' AND importance >= 8 AND tier = 3`,
|
|
800
|
+
args: []
|
|
801
|
+
});
|
|
802
|
+
await client.execute({
|
|
803
|
+
sql: `UPDATE memories SET tier = 2 WHERE tool_name IN ('store_memory', 'manual') AND importance >= 5 AND tier = 3`,
|
|
804
|
+
args: []
|
|
805
|
+
});
|
|
806
|
+
} catch {
|
|
807
|
+
}
|
|
808
|
+
try {
|
|
809
|
+
await client.execute({
|
|
810
|
+
sql: `ALTER TABLE memories ADD COLUMN supersedes_id TEXT`,
|
|
811
|
+
args: []
|
|
812
|
+
});
|
|
813
|
+
} catch {
|
|
814
|
+
}
|
|
815
|
+
try {
|
|
816
|
+
await client.execute(
|
|
817
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL`
|
|
818
|
+
);
|
|
819
|
+
} catch {
|
|
820
|
+
}
|
|
821
|
+
for (const col of [
|
|
822
|
+
"ALTER TABLE tasks ADD COLUMN checkpoint TEXT",
|
|
823
|
+
"ALTER TABLE tasks ADD COLUMN checkpoint_count INTEGER DEFAULT 0"
|
|
824
|
+
]) {
|
|
825
|
+
try {
|
|
826
|
+
await client.execute(col);
|
|
827
|
+
} catch {
|
|
828
|
+
}
|
|
829
|
+
}
|
|
726
830
|
}
|
|
727
831
|
var _client, initTurso;
|
|
728
832
|
var init_database = __esm({
|
|
@@ -799,6 +903,11 @@ function normalizeSessionLifecycle(raw) {
|
|
|
799
903
|
const userSL = raw.sessionLifecycle ?? {};
|
|
800
904
|
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
801
905
|
}
|
|
906
|
+
function normalizeAutoUpdate(raw) {
|
|
907
|
+
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
908
|
+
const userAU = raw.autoUpdate ?? {};
|
|
909
|
+
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
910
|
+
}
|
|
802
911
|
async function loadConfig() {
|
|
803
912
|
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
804
913
|
await mkdir2(dir, { recursive: true });
|
|
@@ -821,6 +930,7 @@ async function loadConfig() {
|
|
|
821
930
|
}
|
|
822
931
|
normalizeScalingRoadmap(migratedCfg);
|
|
823
932
|
normalizeSessionLifecycle(migratedCfg);
|
|
933
|
+
normalizeAutoUpdate(migratedCfg);
|
|
824
934
|
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
825
935
|
if (config.dbPath.startsWith("~")) {
|
|
826
936
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
@@ -896,6 +1006,11 @@ var init_config = __esm({
|
|
|
896
1006
|
idleKillTicksRequired: 3,
|
|
897
1007
|
idleKillIntercomAckWindowMs: 1e4,
|
|
898
1008
|
maxAutoInstances: 10
|
|
1009
|
+
},
|
|
1010
|
+
autoUpdate: {
|
|
1011
|
+
checkOnBoot: true,
|
|
1012
|
+
autoInstall: false,
|
|
1013
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
899
1014
|
}
|
|
900
1015
|
};
|
|
901
1016
|
CONFIG_MIGRATIONS = [
|
|
@@ -1029,13 +1144,27 @@ async function ensureShardSchema(client) {
|
|
|
1029
1144
|
"ALTER TABLE memories ADD COLUMN document_id TEXT",
|
|
1030
1145
|
"ALTER TABLE memories ADD COLUMN user_id TEXT",
|
|
1031
1146
|
"ALTER TABLE memories ADD COLUMN char_offset INTEGER",
|
|
1032
|
-
"ALTER TABLE memories ADD COLUMN page_number INTEGER"
|
|
1147
|
+
"ALTER TABLE memories ADD COLUMN page_number INTEGER",
|
|
1148
|
+
// Source provenance columns (must match database.ts)
|
|
1149
|
+
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1150
|
+
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
1151
|
+
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
1152
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
1033
1153
|
]) {
|
|
1034
1154
|
try {
|
|
1035
1155
|
await client.execute(col);
|
|
1036
1156
|
} catch {
|
|
1037
1157
|
}
|
|
1038
1158
|
}
|
|
1159
|
+
for (const idx of [
|
|
1160
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_tier ON memories(tier)",
|
|
1161
|
+
"CREATE INDEX IF NOT EXISTS idx_memories_supersedes ON memories(supersedes_id) WHERE supersedes_id IS NOT NULL"
|
|
1162
|
+
]) {
|
|
1163
|
+
try {
|
|
1164
|
+
await client.execute(idx);
|
|
1165
|
+
} catch {
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1039
1168
|
try {
|
|
1040
1169
|
await client.execute("CREATE INDEX IF NOT EXISTS idx_memories_status ON memories(status)");
|
|
1041
1170
|
} catch {
|
|
@@ -1243,11 +1372,12 @@ var init_provider_table = __esm({
|
|
|
1243
1372
|
import { readFileSync as readFileSync4, writeFileSync, renameSync as renameSync2, existsSync as existsSync7, mkdirSync as mkdirSync2 } from "fs";
|
|
1244
1373
|
import path8 from "path";
|
|
1245
1374
|
import os4 from "os";
|
|
1246
|
-
var QUEUE_PATH, INTERCOM_LOG;
|
|
1375
|
+
var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
|
|
1247
1376
|
var init_intercom_queue = __esm({
|
|
1248
1377
|
"src/lib/intercom-queue.ts"() {
|
|
1249
1378
|
"use strict";
|
|
1250
1379
|
QUEUE_PATH = path8.join(os4.homedir(), ".exe-os", "intercom-queue.json");
|
|
1380
|
+
TTL_MS = 60 * 60 * 1e3;
|
|
1251
1381
|
INTERCOM_LOG = path8.join(os4.homedir(), ".exe-os", "intercom.log");
|
|
1252
1382
|
}
|
|
1253
1383
|
});
|