@askexenow/exe-os 0.9.66 → 0.9.67
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/stack-manifests/v0.9.json +54 -5
- package/dist/bin/age-ontology-load.js +61 -0
- package/dist/bin/agentic-ontology-backfill.js +4708 -0
- package/dist/bin/agentic-reflection-backfill.js +4144 -0
- package/dist/bin/{exe-link.js → agentic-semantic-label.js} +1523 -2275
- package/dist/bin/backfill-conversations.js +506 -20
- package/dist/bin/backfill-responses.js +506 -20
- package/dist/bin/backfill-vectors.js +233 -20
- package/dist/bin/bulk-sync-postgres.js +4876 -0
- package/dist/bin/cleanup-stale-review-tasks.js +507 -21
- package/dist/bin/cli.js +2450 -1530
- package/dist/bin/exe-assign.js +506 -20
- package/dist/bin/exe-boot.js +410 -60
- package/dist/bin/exe-cloud.js +795 -105
- package/dist/bin/exe-dispatch.js +516 -22
- package/dist/bin/exe-doctor.js +587 -30
- package/dist/bin/exe-export-behaviors.js +518 -24
- package/dist/bin/exe-forget.js +507 -21
- package/dist/bin/exe-gateway.js +571 -25
- package/dist/bin/exe-heartbeat.js +518 -24
- package/dist/bin/exe-kill.js +507 -21
- package/dist/bin/exe-launch-agent.js +2312 -1069
- package/dist/bin/exe-new-employee.js +197 -165
- package/dist/bin/exe-pending-messages.js +507 -21
- package/dist/bin/exe-pending-notifications.js +507 -21
- package/dist/bin/exe-pending-reviews.js +507 -21
- package/dist/bin/exe-rename.js +507 -21
- package/dist/bin/exe-review.js +507 -21
- package/dist/bin/exe-search.js +518 -24
- package/dist/bin/exe-session-cleanup.js +516 -22
- package/dist/bin/exe-settings.js +4 -0
- package/dist/bin/exe-start-codex.js +682 -143
- package/dist/bin/exe-start-opencode.js +627 -79
- package/dist/bin/exe-status.js +507 -21
- package/dist/bin/exe-team.js +507 -21
- package/dist/bin/git-sweep.js +516 -22
- package/dist/bin/graph-backfill.js +558 -21
- package/dist/bin/graph-export.js +507 -21
- package/dist/bin/graph-layer-benchmark.js +109 -0
- package/dist/bin/install.js +305 -288
- package/dist/bin/intercom-check.js +516 -22
- package/dist/bin/postgres-agentic-reflection-backfill.js +187 -0
- package/dist/bin/postgres-agentic-semantic-backfill.js +237 -0
- package/dist/bin/scan-tasks.js +516 -22
- package/dist/bin/setup.js +412 -62
- package/dist/bin/shard-migrate.js +506 -20
- package/dist/gateway/index.js +569 -23
- package/dist/hooks/bug-report-worker.js +519 -25
- package/dist/hooks/codex-stop-task-finalizer.js +516 -22
- package/dist/hooks/commit-complete.js +516 -22
- package/dist/hooks/error-recall.js +518 -24
- package/dist/hooks/ingest.js +516 -22
- package/dist/hooks/instructions-loaded.js +507 -21
- package/dist/hooks/notification.js +507 -21
- package/dist/hooks/post-compact.js +507 -21
- package/dist/hooks/post-tool-combined.js +519 -25
- package/dist/hooks/pre-compact.js +516 -22
- package/dist/hooks/pre-tool-use.js +507 -21
- package/dist/hooks/prompt-submit.js +519 -25
- package/dist/hooks/session-end.js +516 -22
- package/dist/hooks/session-start.js +520 -26
- package/dist/hooks/stop.js +517 -23
- package/dist/hooks/subagent-stop.js +507 -21
- package/dist/hooks/summary-worker.js +411 -61
- package/dist/index.js +569 -23
- package/dist/lib/cloud-sync.js +391 -53
- package/dist/lib/config.js +13 -1
- package/dist/lib/consolidation.js +1 -1
- package/dist/lib/database.js +124 -0
- package/dist/lib/db.js +124 -0
- package/dist/lib/device-registry.js +124 -0
- package/dist/lib/embedder.js +13 -1
- package/dist/lib/exe-daemon.js +2184 -561
- package/dist/lib/hybrid-search.js +518 -24
- package/dist/lib/identity.js +3 -0
- package/dist/lib/keychain.js +178 -22
- package/dist/lib/messaging.js +3 -0
- package/dist/lib/reminders.js +3 -0
- package/dist/lib/schedules.js +233 -20
- package/dist/lib/skill-learning.js +16 -1
- package/dist/lib/store.js +506 -20
- package/dist/lib/tasks.js +16 -1
- package/dist/lib/tmux-routing.js +16 -1
- package/dist/lib/token-spend.js +3 -0
- package/dist/mcp/server.js +1757 -428
- package/dist/mcp/tools/complete-reminder.js +3 -0
- package/dist/mcp/tools/create-reminder.js +3 -0
- package/dist/mcp/tools/create-task.js +16 -1
- package/dist/mcp/tools/deactivate-behavior.js +3 -0
- package/dist/mcp/tools/list-reminders.js +3 -0
- package/dist/mcp/tools/list-tasks.js +3 -0
- package/dist/mcp/tools/send-message.js +3 -0
- package/dist/mcp/tools/update-task.js +16 -1
- package/dist/runtime/index.js +516 -22
- package/dist/tui/App.js +594 -29
- package/package.json +8 -5
- package/src/commands/exe/cloud.md +6 -10
- package/stack.release.json +3 -3
- package/src/commands/exe/link.md +0 -18
package/dist/runtime/index.js
CHANGED
|
@@ -183,6 +183,10 @@ async function loadConfig() {
|
|
|
183
183
|
if (config.dbPath.startsWith("~")) {
|
|
184
184
|
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
185
185
|
}
|
|
186
|
+
const envDbPath = path2.join(dir, "memories.db");
|
|
187
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
188
|
+
config.dbPath = envDbPath;
|
|
189
|
+
}
|
|
186
190
|
return config;
|
|
187
191
|
} catch {
|
|
188
192
|
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
@@ -203,7 +207,15 @@ function loadConfigSync() {
|
|
|
203
207
|
normalizeSessionLifecycle(migratedCfg);
|
|
204
208
|
normalizeAutoUpdate(migratedCfg);
|
|
205
209
|
normalizeOrchestration(migratedCfg);
|
|
206
|
-
|
|
210
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
211
|
+
if (config.dbPath.startsWith("~")) {
|
|
212
|
+
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
213
|
+
}
|
|
214
|
+
const envDbPath = path2.join(dir, "memories.db");
|
|
215
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
216
|
+
config.dbPath = envDbPath;
|
|
217
|
+
}
|
|
218
|
+
return config;
|
|
207
219
|
} catch {
|
|
208
220
|
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
209
221
|
}
|
|
@@ -2305,6 +2317,9 @@ function getClient() {
|
|
|
2305
2317
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
2306
2318
|
return _daemonClient;
|
|
2307
2319
|
}
|
|
2320
|
+
if (!_resilientClient) {
|
|
2321
|
+
return _adapterClient;
|
|
2322
|
+
}
|
|
2308
2323
|
return _resilientClient;
|
|
2309
2324
|
}
|
|
2310
2325
|
async function initDaemonClient() {
|
|
@@ -3337,6 +3352,127 @@ async function ensureSchema() {
|
|
|
3337
3352
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
3338
3353
|
END;
|
|
3339
3354
|
`);
|
|
3355
|
+
await client.executeMultiple(`
|
|
3356
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
3357
|
+
id TEXT PRIMARY KEY,
|
|
3358
|
+
agent_id TEXT NOT NULL,
|
|
3359
|
+
project_name TEXT,
|
|
3360
|
+
started_at TEXT NOT NULL,
|
|
3361
|
+
last_event_at TEXT NOT NULL,
|
|
3362
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3363
|
+
properties TEXT DEFAULT '{}'
|
|
3364
|
+
);
|
|
3365
|
+
|
|
3366
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
3367
|
+
ON agent_sessions(agent_id, started_at);
|
|
3368
|
+
|
|
3369
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
3370
|
+
id TEXT PRIMARY KEY,
|
|
3371
|
+
statement TEXT NOT NULL,
|
|
3372
|
+
owner_agent_id TEXT,
|
|
3373
|
+
project_name TEXT,
|
|
3374
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
3375
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
3376
|
+
success_criteria TEXT,
|
|
3377
|
+
parent_goal_id TEXT,
|
|
3378
|
+
due_at TEXT,
|
|
3379
|
+
achieved_at TEXT,
|
|
3380
|
+
supersedes_id TEXT,
|
|
3381
|
+
created_at TEXT NOT NULL,
|
|
3382
|
+
updated_at TEXT NOT NULL,
|
|
3383
|
+
source_memory_id TEXT
|
|
3384
|
+
);
|
|
3385
|
+
|
|
3386
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
3387
|
+
ON agent_goals(project_name, status, priority);
|
|
3388
|
+
|
|
3389
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
3390
|
+
id TEXT PRIMARY KEY,
|
|
3391
|
+
event_type TEXT NOT NULL,
|
|
3392
|
+
occurred_at TEXT NOT NULL,
|
|
3393
|
+
sequence_index INTEGER NOT NULL,
|
|
3394
|
+
actor_agent_id TEXT,
|
|
3395
|
+
agent_role TEXT,
|
|
3396
|
+
project_name TEXT,
|
|
3397
|
+
session_id TEXT,
|
|
3398
|
+
task_id TEXT,
|
|
3399
|
+
goal_id TEXT,
|
|
3400
|
+
parent_event_id TEXT,
|
|
3401
|
+
intention TEXT,
|
|
3402
|
+
outcome TEXT,
|
|
3403
|
+
evidence_memory_id TEXT,
|
|
3404
|
+
impact TEXT,
|
|
3405
|
+
payload TEXT DEFAULT '{}',
|
|
3406
|
+
created_at TEXT NOT NULL
|
|
3407
|
+
);
|
|
3408
|
+
|
|
3409
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
3410
|
+
ON agent_events(occurred_at, sequence_index);
|
|
3411
|
+
|
|
3412
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
3413
|
+
ON agent_events(session_id, sequence_index);
|
|
3414
|
+
|
|
3415
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
3416
|
+
ON agent_events(goal_id, occurred_at);
|
|
3417
|
+
|
|
3418
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
3419
|
+
ON agent_events(evidence_memory_id);
|
|
3420
|
+
|
|
3421
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
3422
|
+
id TEXT PRIMARY KEY,
|
|
3423
|
+
goal_id TEXT NOT NULL,
|
|
3424
|
+
link_type TEXT NOT NULL,
|
|
3425
|
+
target_id TEXT NOT NULL,
|
|
3426
|
+
target_type TEXT NOT NULL,
|
|
3427
|
+
created_at TEXT NOT NULL
|
|
3428
|
+
);
|
|
3429
|
+
|
|
3430
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
3431
|
+
ON agent_goal_links(goal_id, target_type);
|
|
3432
|
+
|
|
3433
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
3434
|
+
id TEXT PRIMARY KEY,
|
|
3435
|
+
source_memory_id TEXT NOT NULL,
|
|
3436
|
+
event_id TEXT,
|
|
3437
|
+
labeler TEXT NOT NULL,
|
|
3438
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
3439
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3440
|
+
labels TEXT NOT NULL,
|
|
3441
|
+
created_at TEXT NOT NULL,
|
|
3442
|
+
updated_at TEXT NOT NULL
|
|
3443
|
+
);
|
|
3444
|
+
|
|
3445
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
3446
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
3447
|
+
|
|
3448
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
3449
|
+
ON agent_semantic_labels(event_id);
|
|
3450
|
+
|
|
3451
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
3452
|
+
id TEXT PRIMARY KEY,
|
|
3453
|
+
project_name TEXT,
|
|
3454
|
+
session_id TEXT,
|
|
3455
|
+
window_start_at TEXT NOT NULL,
|
|
3456
|
+
window_end_at TEXT NOT NULL,
|
|
3457
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3458
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
3459
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
3460
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
3461
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
3462
|
+
summary TEXT NOT NULL,
|
|
3463
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
3464
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
3465
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
3466
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3467
|
+
created_at TEXT NOT NULL
|
|
3468
|
+
);
|
|
3469
|
+
|
|
3470
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
3471
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
3472
|
+
|
|
3473
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
3474
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
3475
|
+
`);
|
|
3340
3476
|
try {
|
|
3341
3477
|
await client.execute({
|
|
3342
3478
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -6795,7 +6931,7 @@ var init_tmux_routing = __esm({
|
|
|
6795
6931
|
|
|
6796
6932
|
// src/lib/keychain.ts
|
|
6797
6933
|
import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
|
|
6798
|
-
import { existsSync as existsSync16 } from "fs";
|
|
6934
|
+
import { existsSync as existsSync16, statSync as statSync2 } from "fs";
|
|
6799
6935
|
import { execSync as execSync8 } from "child_process";
|
|
6800
6936
|
import path20 from "path";
|
|
6801
6937
|
import os13 from "os";
|
|
@@ -6805,29 +6941,65 @@ function getKeyDir() {
|
|
|
6805
6941
|
function getKeyPath() {
|
|
6806
6942
|
return path20.join(getKeyDir(), "master.key");
|
|
6807
6943
|
}
|
|
6808
|
-
function
|
|
6944
|
+
function nativeKeychainAllowed() {
|
|
6945
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
6946
|
+
}
|
|
6947
|
+
function linuxSecretAvailable() {
|
|
6948
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6949
|
+
if (process.platform !== "linux") return false;
|
|
6950
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
6951
|
+
try {
|
|
6952
|
+
execSync8("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
6953
|
+
} catch {
|
|
6954
|
+
linuxSecretAvailability = false;
|
|
6955
|
+
return false;
|
|
6956
|
+
}
|
|
6957
|
+
try {
|
|
6958
|
+
execSync8("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
6959
|
+
linuxSecretAvailability = true;
|
|
6960
|
+
} catch {
|
|
6961
|
+
linuxSecretAvailability = false;
|
|
6962
|
+
}
|
|
6963
|
+
return linuxSecretAvailability;
|
|
6964
|
+
}
|
|
6965
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
6966
|
+
if (process.platform !== "linux") return false;
|
|
6967
|
+
try {
|
|
6968
|
+
const uid = typeof os13.userInfo().uid === "number" ? os13.userInfo().uid : -1;
|
|
6969
|
+
const st = statSync2(keyPath);
|
|
6970
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
6971
|
+
if (uid === 0) return true;
|
|
6972
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
6973
|
+
return Boolean(exeOsDir && path20.resolve(keyPath).startsWith(path20.resolve(exeOsDir) + path20.sep));
|
|
6974
|
+
} catch {
|
|
6975
|
+
return false;
|
|
6976
|
+
}
|
|
6977
|
+
}
|
|
6978
|
+
function macKeychainGet(service = SERVICE) {
|
|
6979
|
+
if (!nativeKeychainAllowed()) return null;
|
|
6809
6980
|
if (process.platform !== "darwin") return null;
|
|
6810
6981
|
try {
|
|
6811
6982
|
return execSync8(
|
|
6812
|
-
`security find-generic-password -s "${
|
|
6983
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
6813
6984
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
6814
6985
|
).trim();
|
|
6815
6986
|
} catch {
|
|
6816
6987
|
return null;
|
|
6817
6988
|
}
|
|
6818
6989
|
}
|
|
6819
|
-
function macKeychainSet(value) {
|
|
6990
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
6991
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6820
6992
|
if (process.platform !== "darwin") return false;
|
|
6821
6993
|
try {
|
|
6822
6994
|
try {
|
|
6823
6995
|
execSync8(
|
|
6824
|
-
`security delete-generic-password -s "${
|
|
6996
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
6825
6997
|
{ timeout: 5e3 }
|
|
6826
6998
|
);
|
|
6827
6999
|
} catch {
|
|
6828
7000
|
}
|
|
6829
7001
|
execSync8(
|
|
6830
|
-
`security add-generic-password -s "${
|
|
7002
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
6831
7003
|
{ timeout: 5e3 }
|
|
6832
7004
|
);
|
|
6833
7005
|
return true;
|
|
@@ -6835,22 +7007,48 @@ function macKeychainSet(value) {
|
|
|
6835
7007
|
return false;
|
|
6836
7008
|
}
|
|
6837
7009
|
}
|
|
6838
|
-
function
|
|
6839
|
-
if (
|
|
7010
|
+
function macKeychainDelete(service = SERVICE) {
|
|
7011
|
+
if (!nativeKeychainAllowed()) return false;
|
|
7012
|
+
if (process.platform !== "darwin") return false;
|
|
7013
|
+
try {
|
|
7014
|
+
execSync8(
|
|
7015
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
7016
|
+
{ timeout: 5e3 }
|
|
7017
|
+
);
|
|
7018
|
+
return true;
|
|
7019
|
+
} catch {
|
|
7020
|
+
return false;
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
function linuxSecretGet(service = SERVICE) {
|
|
7024
|
+
if (!linuxSecretAvailable()) return null;
|
|
6840
7025
|
try {
|
|
6841
7026
|
return execSync8(
|
|
6842
|
-
`secret-tool lookup service "${
|
|
7027
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6843
7028
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
6844
7029
|
).trim();
|
|
6845
7030
|
} catch {
|
|
6846
7031
|
return null;
|
|
6847
7032
|
}
|
|
6848
7033
|
}
|
|
6849
|
-
function linuxSecretSet(value) {
|
|
7034
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
7035
|
+
if (!linuxSecretAvailable()) return false;
|
|
7036
|
+
try {
|
|
7037
|
+
execSync8(
|
|
7038
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
7039
|
+
{ timeout: 5e3 }
|
|
7040
|
+
);
|
|
7041
|
+
return true;
|
|
7042
|
+
} catch {
|
|
7043
|
+
return false;
|
|
7044
|
+
}
|
|
7045
|
+
}
|
|
7046
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
7047
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6850
7048
|
if (process.platform !== "linux") return false;
|
|
6851
7049
|
try {
|
|
6852
7050
|
execSync8(
|
|
6853
|
-
`
|
|
7051
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6854
7052
|
{ timeout: 5e3 }
|
|
6855
7053
|
);
|
|
6856
7054
|
return true;
|
|
@@ -6859,6 +7057,7 @@ function linuxSecretSet(value) {
|
|
|
6859
7057
|
}
|
|
6860
7058
|
}
|
|
6861
7059
|
async function tryKeytar() {
|
|
7060
|
+
if (!nativeKeychainAllowed()) return null;
|
|
6862
7061
|
try {
|
|
6863
7062
|
return await import("keytar");
|
|
6864
7063
|
} catch {
|
|
@@ -6932,7 +7131,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
6932
7131
|
return "plaintext";
|
|
6933
7132
|
}
|
|
6934
7133
|
async function getMasterKey() {
|
|
6935
|
-
|
|
7134
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
7135
|
+
if (!nativeValue) {
|
|
7136
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
7137
|
+
if (legacyValue) {
|
|
7138
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
7139
|
+
if (migrated) {
|
|
7140
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
7141
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
7142
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
7143
|
+
}
|
|
7144
|
+
nativeValue = legacyValue;
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
6936
7147
|
if (nativeValue) {
|
|
6937
7148
|
return Buffer.from(nativeValue, "base64");
|
|
6938
7149
|
}
|
|
@@ -6940,12 +7151,17 @@ async function getMasterKey() {
|
|
|
6940
7151
|
if (keytar) {
|
|
6941
7152
|
try {
|
|
6942
7153
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
6943
|
-
|
|
6944
|
-
|
|
7154
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
7155
|
+
if (legacyKeytarValue) {
|
|
7156
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
6945
7157
|
if (migrated) {
|
|
6946
7158
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
7159
|
+
try {
|
|
7160
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
7161
|
+
} catch {
|
|
7162
|
+
}
|
|
6947
7163
|
}
|
|
6948
|
-
return Buffer.from(
|
|
7164
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
6949
7165
|
}
|
|
6950
7166
|
} catch {
|
|
6951
7167
|
}
|
|
@@ -6970,7 +7186,7 @@ async function getMasterKey() {
|
|
|
6970
7186
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
6971
7187
|
if (!decrypted) {
|
|
6972
7188
|
process.stderr.write(
|
|
6973
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
7189
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
6974
7190
|
);
|
|
6975
7191
|
return null;
|
|
6976
7192
|
}
|
|
@@ -6979,6 +7195,9 @@ async function getMasterKey() {
|
|
|
6979
7195
|
b64Value = content;
|
|
6980
7196
|
}
|
|
6981
7197
|
const key = Buffer.from(b64Value, "base64");
|
|
7198
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
7199
|
+
return key;
|
|
7200
|
+
}
|
|
6982
7201
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
6983
7202
|
if (migrated) {
|
|
6984
7203
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -7006,12 +7225,14 @@ async function getMasterKey() {
|
|
|
7006
7225
|
return null;
|
|
7007
7226
|
}
|
|
7008
7227
|
}
|
|
7009
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
7228
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
7010
7229
|
var init_keychain = __esm({
|
|
7011
7230
|
"src/lib/keychain.ts"() {
|
|
7012
7231
|
"use strict";
|
|
7013
|
-
SERVICE = "exe-
|
|
7232
|
+
SERVICE = "exe-os";
|
|
7233
|
+
LEGACY_SERVICE = "exe-mem";
|
|
7014
7234
|
ACCOUNT = "master-key";
|
|
7235
|
+
linuxSecretAvailability = null;
|
|
7015
7236
|
ENCRYPTED_PREFIX = "enc:";
|
|
7016
7237
|
}
|
|
7017
7238
|
});
|
|
@@ -7226,7 +7447,7 @@ __export(shard_manager_exports, {
|
|
|
7226
7447
|
shardExists: () => shardExists
|
|
7227
7448
|
});
|
|
7228
7449
|
import path21 from "path";
|
|
7229
|
-
import { existsSync as existsSync17, mkdirSync as mkdirSync8, readdirSync as readdirSync4, renameSync as renameSync4, statSync as
|
|
7450
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync8, readdirSync as readdirSync4, renameSync as renameSync4, statSync as statSync3 } from "fs";
|
|
7230
7451
|
import { createClient as createClient2 } from "@libsql/client";
|
|
7231
7452
|
function initShardManager(encryptionKey) {
|
|
7232
7453
|
_encryptionKey = encryptionKey;
|
|
@@ -7290,7 +7511,7 @@ async function auditShardHealth(options = {}) {
|
|
|
7290
7511
|
const shards = [];
|
|
7291
7512
|
for (const name of names) {
|
|
7292
7513
|
const dbPath = path21.join(SHARDS_DIR, `${name}.db`);
|
|
7293
|
-
const stat =
|
|
7514
|
+
const stat = statSync3(dbPath);
|
|
7294
7515
|
const item = {
|
|
7295
7516
|
name,
|
|
7296
7517
|
path: dbPath,
|
|
@@ -7543,7 +7764,7 @@ async function getReadyShardClient(projectName) {
|
|
|
7543
7764
|
_shardLastAccess.delete(safeName);
|
|
7544
7765
|
const dbPath = path21.join(SHARDS_DIR, `${safeName}.db`);
|
|
7545
7766
|
if (existsSync17(dbPath)) {
|
|
7546
|
-
const stat =
|
|
7767
|
+
const stat = statSync3(dbPath);
|
|
7547
7768
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
7548
7769
|
const archivedPath = path21.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
7549
7770
|
renameSync4(dbPath, archivedPath);
|
|
@@ -8050,6 +8271,274 @@ var init_memory_cards = __esm({
|
|
|
8050
8271
|
}
|
|
8051
8272
|
});
|
|
8052
8273
|
|
|
8274
|
+
// src/lib/agentic-ontology.ts
|
|
8275
|
+
var agentic_ontology_exports = {};
|
|
8276
|
+
__export(agentic_ontology_exports, {
|
|
8277
|
+
clean: () => clean,
|
|
8278
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
8279
|
+
inferIntention: () => inferIntention,
|
|
8280
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
8281
|
+
inferOutcome: () => inferOutcome,
|
|
8282
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
8283
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
8284
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
8285
|
+
ontologyPayload: () => ontologyPayload,
|
|
8286
|
+
stableId: () => stableId2
|
|
8287
|
+
});
|
|
8288
|
+
import { createHash as createHash3 } from "crypto";
|
|
8289
|
+
function stableId2(...parts) {
|
|
8290
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
8291
|
+
}
|
|
8292
|
+
function clean(text, max = 240) {
|
|
8293
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
8294
|
+
}
|
|
8295
|
+
function inferOntologyEventType(row) {
|
|
8296
|
+
const lower = row.raw_text.toLowerCase();
|
|
8297
|
+
if (row.has_error) return "error";
|
|
8298
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
8299
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
8300
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
8301
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
8302
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
8303
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
8304
|
+
return "memory_observation";
|
|
8305
|
+
}
|
|
8306
|
+
function inferIntention(row) {
|
|
8307
|
+
if (row.intent) return clean(row.intent, 220);
|
|
8308
|
+
const text = clean(row.raw_text, 1e3);
|
|
8309
|
+
const patterns = [
|
|
8310
|
+
/(?:we need to|need to|let'?s|i want to|we should|goal is to|objective is to|trying to)\s+([^.!?\n]{8,220})/i,
|
|
8311
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
8312
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
8313
|
+
];
|
|
8314
|
+
for (const p of patterns) {
|
|
8315
|
+
const m = text.match(p);
|
|
8316
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
8317
|
+
}
|
|
8318
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
8319
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
8320
|
+
}
|
|
8321
|
+
return null;
|
|
8322
|
+
}
|
|
8323
|
+
function inferOutcome(row) {
|
|
8324
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
8325
|
+
if (row.has_error) return "error";
|
|
8326
|
+
const lower = row.raw_text.toLowerCase();
|
|
8327
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
8328
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
8329
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
8330
|
+
return null;
|
|
8331
|
+
}
|
|
8332
|
+
function extractGoalCandidates(row) {
|
|
8333
|
+
const text = clean(row.raw_text, 1600);
|
|
8334
|
+
const patterns = [
|
|
8335
|
+
/(?:we need to|need to|i want to|we should|goal is to|objective is to|trying to|let'?s)\s+([^.!?\n]{12,220})/gi,
|
|
8336
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
8337
|
+
];
|
|
8338
|
+
const out = [];
|
|
8339
|
+
for (const pattern of patterns) {
|
|
8340
|
+
for (const m of text.matchAll(pattern)) {
|
|
8341
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
8342
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
8343
|
+
if (out.length >= 3) return out;
|
|
8344
|
+
}
|
|
8345
|
+
}
|
|
8346
|
+
return out;
|
|
8347
|
+
}
|
|
8348
|
+
function uniq(values, max = 6) {
|
|
8349
|
+
const out = [];
|
|
8350
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
8351
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
8352
|
+
if (out.length >= max) break;
|
|
8353
|
+
}
|
|
8354
|
+
return out;
|
|
8355
|
+
}
|
|
8356
|
+
function extractMatches(text, patterns, max = 5) {
|
|
8357
|
+
const out = [];
|
|
8358
|
+
for (const pattern of patterns) {
|
|
8359
|
+
for (const match of text.matchAll(pattern)) {
|
|
8360
|
+
const value = match[1] ?? match[0];
|
|
8361
|
+
if (value) out.push(value);
|
|
8362
|
+
if (out.length >= max) return uniq(out, max);
|
|
8363
|
+
}
|
|
8364
|
+
}
|
|
8365
|
+
return uniq(out, max);
|
|
8366
|
+
}
|
|
8367
|
+
function inferSemanticLabel(row) {
|
|
8368
|
+
const text = clean(row.raw_text, 2400);
|
|
8369
|
+
const eventType = inferOntologyEventType(row);
|
|
8370
|
+
const intention = inferIntention(row);
|
|
8371
|
+
const outcome = inferOutcome(row);
|
|
8372
|
+
const goals = extractGoalCandidates(row);
|
|
8373
|
+
const milestones = extractMatches(text, [
|
|
8374
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
8375
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
8376
|
+
]);
|
|
8377
|
+
const problems = extractMatches(text, [
|
|
8378
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
8379
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
8380
|
+
]);
|
|
8381
|
+
const decisions = extractMatches(text, [
|
|
8382
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
8383
|
+
]);
|
|
8384
|
+
const temporalAnchors = extractMatches(text, [
|
|
8385
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
8386
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
8387
|
+
], 8);
|
|
8388
|
+
const nextActions = extractMatches(text, [
|
|
8389
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
8390
|
+
]);
|
|
8391
|
+
const actors = uniq([
|
|
8392
|
+
row.agent_id,
|
|
8393
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
8394
|
+
], 6);
|
|
8395
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
8396
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
8397
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
8398
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
8399
|
+
return {
|
|
8400
|
+
labeler: "deterministic",
|
|
8401
|
+
schemaVersion: 1,
|
|
8402
|
+
eventType,
|
|
8403
|
+
intention,
|
|
8404
|
+
outcome,
|
|
8405
|
+
impact,
|
|
8406
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
8407
|
+
goals,
|
|
8408
|
+
milestones,
|
|
8409
|
+
problems,
|
|
8410
|
+
decisions,
|
|
8411
|
+
actors,
|
|
8412
|
+
temporalAnchors,
|
|
8413
|
+
successSignals,
|
|
8414
|
+
failureSignals,
|
|
8415
|
+
nextActions,
|
|
8416
|
+
summary: clean(text, 280)
|
|
8417
|
+
};
|
|
8418
|
+
}
|
|
8419
|
+
function ontologyPayload(row) {
|
|
8420
|
+
const semantic = inferSemanticLabel(row);
|
|
8421
|
+
return {
|
|
8422
|
+
tool_name: row.tool_name,
|
|
8423
|
+
memory_version: row.version ?? null,
|
|
8424
|
+
domain: row.domain ?? null,
|
|
8425
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
8426
|
+
semantic
|
|
8427
|
+
};
|
|
8428
|
+
}
|
|
8429
|
+
function safeJson(value) {
|
|
8430
|
+
try {
|
|
8431
|
+
return JSON.parse(value);
|
|
8432
|
+
} catch {
|
|
8433
|
+
return value.slice(0, 1e3);
|
|
8434
|
+
}
|
|
8435
|
+
}
|
|
8436
|
+
async function resolveClient(client) {
|
|
8437
|
+
if (client) return client;
|
|
8438
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
8439
|
+
return getClient2();
|
|
8440
|
+
}
|
|
8441
|
+
async function insertOntologyForMemory(row, client) {
|
|
8442
|
+
const db = await resolveClient(client);
|
|
8443
|
+
const occurredAt = row.timestamp;
|
|
8444
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
8445
|
+
const eventType = inferOntologyEventType(row);
|
|
8446
|
+
const intention = inferIntention(row);
|
|
8447
|
+
const outcome = inferOutcome(row);
|
|
8448
|
+
const eventId = stableId2("event", row.id);
|
|
8449
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
8450
|
+
await db.execute({
|
|
8451
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
8452
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
8453
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
8454
|
+
event_count = event_count + 1`,
|
|
8455
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
8456
|
+
});
|
|
8457
|
+
await db.execute({
|
|
8458
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
8459
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
8460
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
8461
|
+
impact, payload, created_at)
|
|
8462
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
8463
|
+
args: [
|
|
8464
|
+
eventId,
|
|
8465
|
+
eventType,
|
|
8466
|
+
occurredAt,
|
|
8467
|
+
sequence,
|
|
8468
|
+
row.agent_id,
|
|
8469
|
+
row.agent_role,
|
|
8470
|
+
row.project_name,
|
|
8471
|
+
row.session_id,
|
|
8472
|
+
row.task_id ?? null,
|
|
8473
|
+
intention,
|
|
8474
|
+
outcome,
|
|
8475
|
+
row.id,
|
|
8476
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
8477
|
+
JSON.stringify(ontologyPayload(row)),
|
|
8478
|
+
now
|
|
8479
|
+
]
|
|
8480
|
+
});
|
|
8481
|
+
const semantic = inferSemanticLabel(row);
|
|
8482
|
+
await db.execute({
|
|
8483
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
8484
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
8485
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
8486
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
8487
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
8488
|
+
args: [
|
|
8489
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
8490
|
+
row.id,
|
|
8491
|
+
eventId,
|
|
8492
|
+
semantic.labeler,
|
|
8493
|
+
semantic.schemaVersion,
|
|
8494
|
+
semantic.confidence,
|
|
8495
|
+
JSON.stringify(semantic),
|
|
8496
|
+
now,
|
|
8497
|
+
now
|
|
8498
|
+
]
|
|
8499
|
+
});
|
|
8500
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
8501
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
8502
|
+
await db.execute({
|
|
8503
|
+
sql: `INSERT INTO agent_goals
|
|
8504
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
8505
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
8506
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
8507
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
8508
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
8509
|
+
});
|
|
8510
|
+
await db.execute({
|
|
8511
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
8512
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
8513
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
8514
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
8515
|
+
});
|
|
8516
|
+
await db.execute({
|
|
8517
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
8518
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
8519
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
8520
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
8521
|
+
});
|
|
8522
|
+
}
|
|
8523
|
+
}
|
|
8524
|
+
async function insertOntologyForBatch(rows, client) {
|
|
8525
|
+
const db = await resolveClient(client);
|
|
8526
|
+
let count = 0;
|
|
8527
|
+
for (const row of rows) {
|
|
8528
|
+
try {
|
|
8529
|
+
await insertOntologyForMemory(row, db);
|
|
8530
|
+
count++;
|
|
8531
|
+
} catch {
|
|
8532
|
+
}
|
|
8533
|
+
}
|
|
8534
|
+
return count;
|
|
8535
|
+
}
|
|
8536
|
+
var init_agentic_ontology = __esm({
|
|
8537
|
+
"src/lib/agentic-ontology.ts"() {
|
|
8538
|
+
"use strict";
|
|
8539
|
+
}
|
|
8540
|
+
});
|
|
8541
|
+
|
|
8053
8542
|
// src/lib/store.ts
|
|
8054
8543
|
var store_exports = {};
|
|
8055
8544
|
__export(store_exports, {
|
|
@@ -8393,6 +8882,11 @@ async function flushBatch() {
|
|
|
8393
8882
|
await insertMemoryCardsForBatch2(batch);
|
|
8394
8883
|
} catch {
|
|
8395
8884
|
}
|
|
8885
|
+
try {
|
|
8886
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
8887
|
+
await insertOntologyForBatch2(batch);
|
|
8888
|
+
} catch {
|
|
8889
|
+
}
|
|
8396
8890
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
8397
8891
|
_pendingRecords.splice(0, batch.length);
|
|
8398
8892
|
try {
|