@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
|
@@ -183,6 +183,10 @@ async function loadConfig() {
|
|
|
183
183
|
if (config.dbPath.startsWith("~")) {
|
|
184
184
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
185
185
|
}
|
|
186
|
+
const envDbPath = path.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: path.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: path.join(dir, "memories.db"), ...migratedCfg };
|
|
211
|
+
if (config.dbPath.startsWith("~")) {
|
|
212
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
213
|
+
}
|
|
214
|
+
const envDbPath = path.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: path.join(dir, "memories.db") };
|
|
209
221
|
}
|
|
@@ -2327,6 +2339,9 @@ function getClient() {
|
|
|
2327
2339
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
2328
2340
|
return _daemonClient;
|
|
2329
2341
|
}
|
|
2342
|
+
if (!_resilientClient) {
|
|
2343
|
+
return _adapterClient;
|
|
2344
|
+
}
|
|
2330
2345
|
return _resilientClient;
|
|
2331
2346
|
}
|
|
2332
2347
|
async function initDaemonClient() {
|
|
@@ -3359,6 +3374,127 @@ async function ensureSchema() {
|
|
|
3359
3374
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
3360
3375
|
END;
|
|
3361
3376
|
`);
|
|
3377
|
+
await client.executeMultiple(`
|
|
3378
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
3379
|
+
id TEXT PRIMARY KEY,
|
|
3380
|
+
agent_id TEXT NOT NULL,
|
|
3381
|
+
project_name TEXT,
|
|
3382
|
+
started_at TEXT NOT NULL,
|
|
3383
|
+
last_event_at TEXT NOT NULL,
|
|
3384
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3385
|
+
properties TEXT DEFAULT '{}'
|
|
3386
|
+
);
|
|
3387
|
+
|
|
3388
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
3389
|
+
ON agent_sessions(agent_id, started_at);
|
|
3390
|
+
|
|
3391
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
3392
|
+
id TEXT PRIMARY KEY,
|
|
3393
|
+
statement TEXT NOT NULL,
|
|
3394
|
+
owner_agent_id TEXT,
|
|
3395
|
+
project_name TEXT,
|
|
3396
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
3397
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
3398
|
+
success_criteria TEXT,
|
|
3399
|
+
parent_goal_id TEXT,
|
|
3400
|
+
due_at TEXT,
|
|
3401
|
+
achieved_at TEXT,
|
|
3402
|
+
supersedes_id TEXT,
|
|
3403
|
+
created_at TEXT NOT NULL,
|
|
3404
|
+
updated_at TEXT NOT NULL,
|
|
3405
|
+
source_memory_id TEXT
|
|
3406
|
+
);
|
|
3407
|
+
|
|
3408
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
3409
|
+
ON agent_goals(project_name, status, priority);
|
|
3410
|
+
|
|
3411
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
3412
|
+
id TEXT PRIMARY KEY,
|
|
3413
|
+
event_type TEXT NOT NULL,
|
|
3414
|
+
occurred_at TEXT NOT NULL,
|
|
3415
|
+
sequence_index INTEGER NOT NULL,
|
|
3416
|
+
actor_agent_id TEXT,
|
|
3417
|
+
agent_role TEXT,
|
|
3418
|
+
project_name TEXT,
|
|
3419
|
+
session_id TEXT,
|
|
3420
|
+
task_id TEXT,
|
|
3421
|
+
goal_id TEXT,
|
|
3422
|
+
parent_event_id TEXT,
|
|
3423
|
+
intention TEXT,
|
|
3424
|
+
outcome TEXT,
|
|
3425
|
+
evidence_memory_id TEXT,
|
|
3426
|
+
impact TEXT,
|
|
3427
|
+
payload TEXT DEFAULT '{}',
|
|
3428
|
+
created_at TEXT NOT NULL
|
|
3429
|
+
);
|
|
3430
|
+
|
|
3431
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
3432
|
+
ON agent_events(occurred_at, sequence_index);
|
|
3433
|
+
|
|
3434
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
3435
|
+
ON agent_events(session_id, sequence_index);
|
|
3436
|
+
|
|
3437
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
3438
|
+
ON agent_events(goal_id, occurred_at);
|
|
3439
|
+
|
|
3440
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
3441
|
+
ON agent_events(evidence_memory_id);
|
|
3442
|
+
|
|
3443
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
3444
|
+
id TEXT PRIMARY KEY,
|
|
3445
|
+
goal_id TEXT NOT NULL,
|
|
3446
|
+
link_type TEXT NOT NULL,
|
|
3447
|
+
target_id TEXT NOT NULL,
|
|
3448
|
+
target_type TEXT NOT NULL,
|
|
3449
|
+
created_at TEXT NOT NULL
|
|
3450
|
+
);
|
|
3451
|
+
|
|
3452
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
3453
|
+
ON agent_goal_links(goal_id, target_type);
|
|
3454
|
+
|
|
3455
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
3456
|
+
id TEXT PRIMARY KEY,
|
|
3457
|
+
source_memory_id TEXT NOT NULL,
|
|
3458
|
+
event_id TEXT,
|
|
3459
|
+
labeler TEXT NOT NULL,
|
|
3460
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
3461
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3462
|
+
labels TEXT NOT NULL,
|
|
3463
|
+
created_at TEXT NOT NULL,
|
|
3464
|
+
updated_at TEXT NOT NULL
|
|
3465
|
+
);
|
|
3466
|
+
|
|
3467
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
3468
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
3469
|
+
|
|
3470
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
3471
|
+
ON agent_semantic_labels(event_id);
|
|
3472
|
+
|
|
3473
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
3474
|
+
id TEXT PRIMARY KEY,
|
|
3475
|
+
project_name TEXT,
|
|
3476
|
+
session_id TEXT,
|
|
3477
|
+
window_start_at TEXT NOT NULL,
|
|
3478
|
+
window_end_at TEXT NOT NULL,
|
|
3479
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3480
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
3481
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
3482
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
3483
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
3484
|
+
summary TEXT NOT NULL,
|
|
3485
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
3486
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
3487
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
3488
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3489
|
+
created_at TEXT NOT NULL
|
|
3490
|
+
);
|
|
3491
|
+
|
|
3492
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
3493
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
3494
|
+
|
|
3495
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
3496
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
3497
|
+
`);
|
|
3362
3498
|
try {
|
|
3363
3499
|
await client.execute({
|
|
3364
3500
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -6946,7 +7082,7 @@ var init_task_scope = __esm({
|
|
|
6946
7082
|
|
|
6947
7083
|
// src/lib/keychain.ts
|
|
6948
7084
|
import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
|
|
6949
|
-
import { existsSync as existsSync18 } from "fs";
|
|
7085
|
+
import { existsSync as existsSync18, statSync as statSync3 } from "fs";
|
|
6950
7086
|
import { execSync as execSync8 } from "child_process";
|
|
6951
7087
|
import path22 from "path";
|
|
6952
7088
|
import os13 from "os";
|
|
@@ -6956,29 +7092,78 @@ function getKeyDir() {
|
|
|
6956
7092
|
function getKeyPath() {
|
|
6957
7093
|
return path22.join(getKeyDir(), "master.key");
|
|
6958
7094
|
}
|
|
6959
|
-
function
|
|
7095
|
+
function nativeKeychainAllowed() {
|
|
7096
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
7097
|
+
}
|
|
7098
|
+
function linuxSecretAvailable() {
|
|
7099
|
+
if (!nativeKeychainAllowed()) return false;
|
|
7100
|
+
if (process.platform !== "linux") return false;
|
|
7101
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
7102
|
+
try {
|
|
7103
|
+
execSync8("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
7104
|
+
} catch {
|
|
7105
|
+
linuxSecretAvailability = false;
|
|
7106
|
+
return false;
|
|
7107
|
+
}
|
|
7108
|
+
try {
|
|
7109
|
+
execSync8("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
7110
|
+
linuxSecretAvailability = true;
|
|
7111
|
+
} catch {
|
|
7112
|
+
linuxSecretAvailability = false;
|
|
7113
|
+
}
|
|
7114
|
+
return linuxSecretAvailability;
|
|
7115
|
+
}
|
|
7116
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
7117
|
+
if (process.platform !== "linux") return false;
|
|
7118
|
+
try {
|
|
7119
|
+
const uid = typeof os13.userInfo().uid === "number" ? os13.userInfo().uid : -1;
|
|
7120
|
+
const st = statSync3(keyPath);
|
|
7121
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
7122
|
+
if (uid === 0) return true;
|
|
7123
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
7124
|
+
return Boolean(exeOsDir && path22.resolve(keyPath).startsWith(path22.resolve(exeOsDir) + path22.sep));
|
|
7125
|
+
} catch {
|
|
7126
|
+
return false;
|
|
7127
|
+
}
|
|
7128
|
+
}
|
|
7129
|
+
function macKeychainGet(service = SERVICE) {
|
|
7130
|
+
if (!nativeKeychainAllowed()) return null;
|
|
6960
7131
|
if (process.platform !== "darwin") return null;
|
|
6961
7132
|
try {
|
|
6962
7133
|
return execSync8(
|
|
6963
|
-
`security find-generic-password -s "${
|
|
7134
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
6964
7135
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
6965
7136
|
).trim();
|
|
6966
7137
|
} catch {
|
|
6967
7138
|
return null;
|
|
6968
7139
|
}
|
|
6969
7140
|
}
|
|
6970
|
-
function macKeychainSet(value) {
|
|
7141
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
7142
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6971
7143
|
if (process.platform !== "darwin") return false;
|
|
6972
7144
|
try {
|
|
6973
7145
|
try {
|
|
6974
7146
|
execSync8(
|
|
6975
|
-
`security delete-generic-password -s "${
|
|
7147
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
6976
7148
|
{ timeout: 5e3 }
|
|
6977
7149
|
);
|
|
6978
7150
|
} catch {
|
|
6979
7151
|
}
|
|
6980
7152
|
execSync8(
|
|
6981
|
-
`security add-generic-password -s "${
|
|
7153
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
7154
|
+
{ timeout: 5e3 }
|
|
7155
|
+
);
|
|
7156
|
+
return true;
|
|
7157
|
+
} catch {
|
|
7158
|
+
return false;
|
|
7159
|
+
}
|
|
7160
|
+
}
|
|
7161
|
+
function macKeychainDelete(service = SERVICE) {
|
|
7162
|
+
if (!nativeKeychainAllowed()) return false;
|
|
7163
|
+
if (process.platform !== "darwin") return false;
|
|
7164
|
+
try {
|
|
7165
|
+
execSync8(
|
|
7166
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
6982
7167
|
{ timeout: 5e3 }
|
|
6983
7168
|
);
|
|
6984
7169
|
return true;
|
|
@@ -6986,22 +7171,35 @@ function macKeychainSet(value) {
|
|
|
6986
7171
|
return false;
|
|
6987
7172
|
}
|
|
6988
7173
|
}
|
|
6989
|
-
function linuxSecretGet() {
|
|
6990
|
-
if (
|
|
7174
|
+
function linuxSecretGet(service = SERVICE) {
|
|
7175
|
+
if (!linuxSecretAvailable()) return null;
|
|
6991
7176
|
try {
|
|
6992
7177
|
return execSync8(
|
|
6993
|
-
`secret-tool lookup service "${
|
|
7178
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6994
7179
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
6995
7180
|
).trim();
|
|
6996
7181
|
} catch {
|
|
6997
7182
|
return null;
|
|
6998
7183
|
}
|
|
6999
7184
|
}
|
|
7000
|
-
function linuxSecretSet(value) {
|
|
7185
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
7186
|
+
if (!linuxSecretAvailable()) return false;
|
|
7187
|
+
try {
|
|
7188
|
+
execSync8(
|
|
7189
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
7190
|
+
{ timeout: 5e3 }
|
|
7191
|
+
);
|
|
7192
|
+
return true;
|
|
7193
|
+
} catch {
|
|
7194
|
+
return false;
|
|
7195
|
+
}
|
|
7196
|
+
}
|
|
7197
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
7198
|
+
if (!nativeKeychainAllowed()) return false;
|
|
7001
7199
|
if (process.platform !== "linux") return false;
|
|
7002
7200
|
try {
|
|
7003
7201
|
execSync8(
|
|
7004
|
-
`
|
|
7202
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
7005
7203
|
{ timeout: 5e3 }
|
|
7006
7204
|
);
|
|
7007
7205
|
return true;
|
|
@@ -7010,6 +7208,7 @@ function linuxSecretSet(value) {
|
|
|
7010
7208
|
}
|
|
7011
7209
|
}
|
|
7012
7210
|
async function tryKeytar() {
|
|
7211
|
+
if (!nativeKeychainAllowed()) return null;
|
|
7013
7212
|
try {
|
|
7014
7213
|
return await import("keytar");
|
|
7015
7214
|
} catch {
|
|
@@ -7083,7 +7282,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
7083
7282
|
return "plaintext";
|
|
7084
7283
|
}
|
|
7085
7284
|
async function getMasterKey() {
|
|
7086
|
-
|
|
7285
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
7286
|
+
if (!nativeValue) {
|
|
7287
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
7288
|
+
if (legacyValue) {
|
|
7289
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
7290
|
+
if (migrated) {
|
|
7291
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
7292
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
7293
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
7294
|
+
}
|
|
7295
|
+
nativeValue = legacyValue;
|
|
7296
|
+
}
|
|
7297
|
+
}
|
|
7087
7298
|
if (nativeValue) {
|
|
7088
7299
|
return Buffer.from(nativeValue, "base64");
|
|
7089
7300
|
}
|
|
@@ -7091,12 +7302,17 @@ async function getMasterKey() {
|
|
|
7091
7302
|
if (keytar) {
|
|
7092
7303
|
try {
|
|
7093
7304
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
7094
|
-
|
|
7095
|
-
|
|
7305
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
7306
|
+
if (legacyKeytarValue) {
|
|
7307
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
7096
7308
|
if (migrated) {
|
|
7097
7309
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
7310
|
+
try {
|
|
7311
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
7312
|
+
} catch {
|
|
7313
|
+
}
|
|
7098
7314
|
}
|
|
7099
|
-
return Buffer.from(
|
|
7315
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
7100
7316
|
}
|
|
7101
7317
|
} catch {
|
|
7102
7318
|
}
|
|
@@ -7121,7 +7337,7 @@ async function getMasterKey() {
|
|
|
7121
7337
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
7122
7338
|
if (!decrypted) {
|
|
7123
7339
|
process.stderr.write(
|
|
7124
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
7340
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
7125
7341
|
);
|
|
7126
7342
|
return null;
|
|
7127
7343
|
}
|
|
@@ -7130,6 +7346,9 @@ async function getMasterKey() {
|
|
|
7130
7346
|
b64Value = content;
|
|
7131
7347
|
}
|
|
7132
7348
|
const key = Buffer.from(b64Value, "base64");
|
|
7349
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
7350
|
+
return key;
|
|
7351
|
+
}
|
|
7133
7352
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
7134
7353
|
if (migrated) {
|
|
7135
7354
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -7157,12 +7376,14 @@ async function getMasterKey() {
|
|
|
7157
7376
|
return null;
|
|
7158
7377
|
}
|
|
7159
7378
|
}
|
|
7160
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
7379
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
7161
7380
|
var init_keychain = __esm({
|
|
7162
7381
|
"src/lib/keychain.ts"() {
|
|
7163
7382
|
"use strict";
|
|
7164
|
-
SERVICE = "exe-
|
|
7383
|
+
SERVICE = "exe-os";
|
|
7384
|
+
LEGACY_SERVICE = "exe-mem";
|
|
7165
7385
|
ACCOUNT = "master-key";
|
|
7386
|
+
linuxSecretAvailability = null;
|
|
7166
7387
|
ENCRYPTED_PREFIX = "enc:";
|
|
7167
7388
|
}
|
|
7168
7389
|
});
|
|
@@ -7377,7 +7598,7 @@ __export(shard_manager_exports, {
|
|
|
7377
7598
|
shardExists: () => shardExists
|
|
7378
7599
|
});
|
|
7379
7600
|
import path23 from "path";
|
|
7380
|
-
import { existsSync as existsSync19, mkdirSync as mkdirSync10, readdirSync as readdirSync5, renameSync as renameSync5, statSync as
|
|
7601
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync10, readdirSync as readdirSync5, renameSync as renameSync5, statSync as statSync4 } from "fs";
|
|
7381
7602
|
import { createClient as createClient2 } from "@libsql/client";
|
|
7382
7603
|
function initShardManager(encryptionKey) {
|
|
7383
7604
|
_encryptionKey = encryptionKey;
|
|
@@ -7441,7 +7662,7 @@ async function auditShardHealth(options = {}) {
|
|
|
7441
7662
|
const shards = [];
|
|
7442
7663
|
for (const name of names) {
|
|
7443
7664
|
const dbPath = path23.join(SHARDS_DIR, `${name}.db`);
|
|
7444
|
-
const stat =
|
|
7665
|
+
const stat = statSync4(dbPath);
|
|
7445
7666
|
const item = {
|
|
7446
7667
|
name,
|
|
7447
7668
|
path: dbPath,
|
|
@@ -7694,7 +7915,7 @@ async function getReadyShardClient(projectName) {
|
|
|
7694
7915
|
_shardLastAccess.delete(safeName);
|
|
7695
7916
|
const dbPath = path23.join(SHARDS_DIR, `${safeName}.db`);
|
|
7696
7917
|
if (existsSync19(dbPath)) {
|
|
7697
|
-
const stat =
|
|
7918
|
+
const stat = statSync4(dbPath);
|
|
7698
7919
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
7699
7920
|
const archivedPath = path23.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
7700
7921
|
renameSync5(dbPath, archivedPath);
|
|
@@ -8201,6 +8422,274 @@ var init_memory_cards = __esm({
|
|
|
8201
8422
|
}
|
|
8202
8423
|
});
|
|
8203
8424
|
|
|
8425
|
+
// src/lib/agentic-ontology.ts
|
|
8426
|
+
var agentic_ontology_exports = {};
|
|
8427
|
+
__export(agentic_ontology_exports, {
|
|
8428
|
+
clean: () => clean,
|
|
8429
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
8430
|
+
inferIntention: () => inferIntention,
|
|
8431
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
8432
|
+
inferOutcome: () => inferOutcome,
|
|
8433
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
8434
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
8435
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
8436
|
+
ontologyPayload: () => ontologyPayload,
|
|
8437
|
+
stableId: () => stableId2
|
|
8438
|
+
});
|
|
8439
|
+
import { createHash as createHash3 } from "crypto";
|
|
8440
|
+
function stableId2(...parts) {
|
|
8441
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
8442
|
+
}
|
|
8443
|
+
function clean(text, max = 240) {
|
|
8444
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
8445
|
+
}
|
|
8446
|
+
function inferOntologyEventType(row) {
|
|
8447
|
+
const lower = row.raw_text.toLowerCase();
|
|
8448
|
+
if (row.has_error) return "error";
|
|
8449
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
8450
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
8451
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
8452
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
8453
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
8454
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
8455
|
+
return "memory_observation";
|
|
8456
|
+
}
|
|
8457
|
+
function inferIntention(row) {
|
|
8458
|
+
if (row.intent) return clean(row.intent, 220);
|
|
8459
|
+
const text = clean(row.raw_text, 1e3);
|
|
8460
|
+
const patterns = [
|
|
8461
|
+
/(?: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,
|
|
8462
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
8463
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
8464
|
+
];
|
|
8465
|
+
for (const p of patterns) {
|
|
8466
|
+
const m = text.match(p);
|
|
8467
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
8468
|
+
}
|
|
8469
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
8470
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
8471
|
+
}
|
|
8472
|
+
return null;
|
|
8473
|
+
}
|
|
8474
|
+
function inferOutcome(row) {
|
|
8475
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
8476
|
+
if (row.has_error) return "error";
|
|
8477
|
+
const lower = row.raw_text.toLowerCase();
|
|
8478
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
8479
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
8480
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
8481
|
+
return null;
|
|
8482
|
+
}
|
|
8483
|
+
function extractGoalCandidates(row) {
|
|
8484
|
+
const text = clean(row.raw_text, 1600);
|
|
8485
|
+
const patterns = [
|
|
8486
|
+
/(?: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,
|
|
8487
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
8488
|
+
];
|
|
8489
|
+
const out = [];
|
|
8490
|
+
for (const pattern of patterns) {
|
|
8491
|
+
for (const m of text.matchAll(pattern)) {
|
|
8492
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
8493
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
8494
|
+
if (out.length >= 3) return out;
|
|
8495
|
+
}
|
|
8496
|
+
}
|
|
8497
|
+
return out;
|
|
8498
|
+
}
|
|
8499
|
+
function uniq(values, max = 6) {
|
|
8500
|
+
const out = [];
|
|
8501
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
8502
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
8503
|
+
if (out.length >= max) break;
|
|
8504
|
+
}
|
|
8505
|
+
return out;
|
|
8506
|
+
}
|
|
8507
|
+
function extractMatches(text, patterns, max = 5) {
|
|
8508
|
+
const out = [];
|
|
8509
|
+
for (const pattern of patterns) {
|
|
8510
|
+
for (const match of text.matchAll(pattern)) {
|
|
8511
|
+
const value = match[1] ?? match[0];
|
|
8512
|
+
if (value) out.push(value);
|
|
8513
|
+
if (out.length >= max) return uniq(out, max);
|
|
8514
|
+
}
|
|
8515
|
+
}
|
|
8516
|
+
return uniq(out, max);
|
|
8517
|
+
}
|
|
8518
|
+
function inferSemanticLabel(row) {
|
|
8519
|
+
const text = clean(row.raw_text, 2400);
|
|
8520
|
+
const eventType = inferOntologyEventType(row);
|
|
8521
|
+
const intention = inferIntention(row);
|
|
8522
|
+
const outcome = inferOutcome(row);
|
|
8523
|
+
const goals = extractGoalCandidates(row);
|
|
8524
|
+
const milestones = extractMatches(text, [
|
|
8525
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
8526
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
8527
|
+
]);
|
|
8528
|
+
const problems = extractMatches(text, [
|
|
8529
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
8530
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
8531
|
+
]);
|
|
8532
|
+
const decisions = extractMatches(text, [
|
|
8533
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
8534
|
+
]);
|
|
8535
|
+
const temporalAnchors = extractMatches(text, [
|
|
8536
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
8537
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
8538
|
+
], 8);
|
|
8539
|
+
const nextActions = extractMatches(text, [
|
|
8540
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
8541
|
+
]);
|
|
8542
|
+
const actors = uniq([
|
|
8543
|
+
row.agent_id,
|
|
8544
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
8545
|
+
], 6);
|
|
8546
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
8547
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
8548
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
8549
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
8550
|
+
return {
|
|
8551
|
+
labeler: "deterministic",
|
|
8552
|
+
schemaVersion: 1,
|
|
8553
|
+
eventType,
|
|
8554
|
+
intention,
|
|
8555
|
+
outcome,
|
|
8556
|
+
impact,
|
|
8557
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
8558
|
+
goals,
|
|
8559
|
+
milestones,
|
|
8560
|
+
problems,
|
|
8561
|
+
decisions,
|
|
8562
|
+
actors,
|
|
8563
|
+
temporalAnchors,
|
|
8564
|
+
successSignals,
|
|
8565
|
+
failureSignals,
|
|
8566
|
+
nextActions,
|
|
8567
|
+
summary: clean(text, 280)
|
|
8568
|
+
};
|
|
8569
|
+
}
|
|
8570
|
+
function ontologyPayload(row) {
|
|
8571
|
+
const semantic = inferSemanticLabel(row);
|
|
8572
|
+
return {
|
|
8573
|
+
tool_name: row.tool_name,
|
|
8574
|
+
memory_version: row.version ?? null,
|
|
8575
|
+
domain: row.domain ?? null,
|
|
8576
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
8577
|
+
semantic
|
|
8578
|
+
};
|
|
8579
|
+
}
|
|
8580
|
+
function safeJson(value) {
|
|
8581
|
+
try {
|
|
8582
|
+
return JSON.parse(value);
|
|
8583
|
+
} catch {
|
|
8584
|
+
return value.slice(0, 1e3);
|
|
8585
|
+
}
|
|
8586
|
+
}
|
|
8587
|
+
async function resolveClient(client) {
|
|
8588
|
+
if (client) return client;
|
|
8589
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
8590
|
+
return getClient2();
|
|
8591
|
+
}
|
|
8592
|
+
async function insertOntologyForMemory(row, client) {
|
|
8593
|
+
const db = await resolveClient(client);
|
|
8594
|
+
const occurredAt = row.timestamp;
|
|
8595
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
8596
|
+
const eventType = inferOntologyEventType(row);
|
|
8597
|
+
const intention = inferIntention(row);
|
|
8598
|
+
const outcome = inferOutcome(row);
|
|
8599
|
+
const eventId = stableId2("event", row.id);
|
|
8600
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
8601
|
+
await db.execute({
|
|
8602
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
8603
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
8604
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
8605
|
+
event_count = event_count + 1`,
|
|
8606
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
8607
|
+
});
|
|
8608
|
+
await db.execute({
|
|
8609
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
8610
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
8611
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
8612
|
+
impact, payload, created_at)
|
|
8613
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
8614
|
+
args: [
|
|
8615
|
+
eventId,
|
|
8616
|
+
eventType,
|
|
8617
|
+
occurredAt,
|
|
8618
|
+
sequence,
|
|
8619
|
+
row.agent_id,
|
|
8620
|
+
row.agent_role,
|
|
8621
|
+
row.project_name,
|
|
8622
|
+
row.session_id,
|
|
8623
|
+
row.task_id ?? null,
|
|
8624
|
+
intention,
|
|
8625
|
+
outcome,
|
|
8626
|
+
row.id,
|
|
8627
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
8628
|
+
JSON.stringify(ontologyPayload(row)),
|
|
8629
|
+
now
|
|
8630
|
+
]
|
|
8631
|
+
});
|
|
8632
|
+
const semantic = inferSemanticLabel(row);
|
|
8633
|
+
await db.execute({
|
|
8634
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
8635
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
8636
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
8637
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
8638
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
8639
|
+
args: [
|
|
8640
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
8641
|
+
row.id,
|
|
8642
|
+
eventId,
|
|
8643
|
+
semantic.labeler,
|
|
8644
|
+
semantic.schemaVersion,
|
|
8645
|
+
semantic.confidence,
|
|
8646
|
+
JSON.stringify(semantic),
|
|
8647
|
+
now,
|
|
8648
|
+
now
|
|
8649
|
+
]
|
|
8650
|
+
});
|
|
8651
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
8652
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
8653
|
+
await db.execute({
|
|
8654
|
+
sql: `INSERT INTO agent_goals
|
|
8655
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
8656
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
8657
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
8658
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
8659
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
8660
|
+
});
|
|
8661
|
+
await db.execute({
|
|
8662
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
8663
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
8664
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
8665
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
8666
|
+
});
|
|
8667
|
+
await db.execute({
|
|
8668
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
8669
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
8670
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
8671
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
8672
|
+
});
|
|
8673
|
+
}
|
|
8674
|
+
}
|
|
8675
|
+
async function insertOntologyForBatch(rows, client) {
|
|
8676
|
+
const db = await resolveClient(client);
|
|
8677
|
+
let count = 0;
|
|
8678
|
+
for (const row of rows) {
|
|
8679
|
+
try {
|
|
8680
|
+
await insertOntologyForMemory(row, db);
|
|
8681
|
+
count++;
|
|
8682
|
+
} catch {
|
|
8683
|
+
}
|
|
8684
|
+
}
|
|
8685
|
+
return count;
|
|
8686
|
+
}
|
|
8687
|
+
var init_agentic_ontology = __esm({
|
|
8688
|
+
"src/lib/agentic-ontology.ts"() {
|
|
8689
|
+
"use strict";
|
|
8690
|
+
}
|
|
8691
|
+
});
|
|
8692
|
+
|
|
8204
8693
|
// src/lib/store.ts
|
|
8205
8694
|
var store_exports = {};
|
|
8206
8695
|
__export(store_exports, {
|
|
@@ -8544,6 +9033,11 @@ async function flushBatch() {
|
|
|
8544
9033
|
await insertMemoryCardsForBatch2(batch);
|
|
8545
9034
|
} catch {
|
|
8546
9035
|
}
|
|
9036
|
+
try {
|
|
9037
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
9038
|
+
await insertOntologyForBatch2(batch);
|
|
9039
|
+
} catch {
|
|
9040
|
+
}
|
|
8547
9041
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
8548
9042
|
_pendingRecords.splice(0, batch.length);
|
|
8549
9043
|
try {
|