@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
|
@@ -475,6 +475,10 @@ async function loadConfig() {
|
|
|
475
475
|
if (config.dbPath.startsWith("~")) {
|
|
476
476
|
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
477
477
|
}
|
|
478
|
+
const envDbPath = path2.join(dir, "memories.db");
|
|
479
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync3(config.dbPath) && existsSync3(envDbPath)) {
|
|
480
|
+
config.dbPath = envDbPath;
|
|
481
|
+
}
|
|
478
482
|
return config;
|
|
479
483
|
} catch {
|
|
480
484
|
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
@@ -495,7 +499,15 @@ function loadConfigSync() {
|
|
|
495
499
|
normalizeSessionLifecycle(migratedCfg);
|
|
496
500
|
normalizeAutoUpdate(migratedCfg);
|
|
497
501
|
normalizeOrchestration(migratedCfg);
|
|
498
|
-
|
|
502
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
503
|
+
if (config.dbPath.startsWith("~")) {
|
|
504
|
+
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
505
|
+
}
|
|
506
|
+
const envDbPath = path2.join(dir, "memories.db");
|
|
507
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync3(config.dbPath) && existsSync3(envDbPath)) {
|
|
508
|
+
config.dbPath = envDbPath;
|
|
509
|
+
}
|
|
510
|
+
return config;
|
|
499
511
|
} catch {
|
|
500
512
|
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
501
513
|
}
|
|
@@ -2324,6 +2336,9 @@ function getClient() {
|
|
|
2324
2336
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
2325
2337
|
return _daemonClient;
|
|
2326
2338
|
}
|
|
2339
|
+
if (!_resilientClient) {
|
|
2340
|
+
return _adapterClient;
|
|
2341
|
+
}
|
|
2327
2342
|
return _resilientClient;
|
|
2328
2343
|
}
|
|
2329
2344
|
async function initDaemonClient() {
|
|
@@ -3356,6 +3371,127 @@ async function ensureSchema() {
|
|
|
3356
3371
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
3357
3372
|
END;
|
|
3358
3373
|
`);
|
|
3374
|
+
await client.executeMultiple(`
|
|
3375
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
3376
|
+
id TEXT PRIMARY KEY,
|
|
3377
|
+
agent_id TEXT NOT NULL,
|
|
3378
|
+
project_name TEXT,
|
|
3379
|
+
started_at TEXT NOT NULL,
|
|
3380
|
+
last_event_at TEXT NOT NULL,
|
|
3381
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3382
|
+
properties TEXT DEFAULT '{}'
|
|
3383
|
+
);
|
|
3384
|
+
|
|
3385
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
3386
|
+
ON agent_sessions(agent_id, started_at);
|
|
3387
|
+
|
|
3388
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
3389
|
+
id TEXT PRIMARY KEY,
|
|
3390
|
+
statement TEXT NOT NULL,
|
|
3391
|
+
owner_agent_id TEXT,
|
|
3392
|
+
project_name TEXT,
|
|
3393
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
3394
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
3395
|
+
success_criteria TEXT,
|
|
3396
|
+
parent_goal_id TEXT,
|
|
3397
|
+
due_at TEXT,
|
|
3398
|
+
achieved_at TEXT,
|
|
3399
|
+
supersedes_id TEXT,
|
|
3400
|
+
created_at TEXT NOT NULL,
|
|
3401
|
+
updated_at TEXT NOT NULL,
|
|
3402
|
+
source_memory_id TEXT
|
|
3403
|
+
);
|
|
3404
|
+
|
|
3405
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
3406
|
+
ON agent_goals(project_name, status, priority);
|
|
3407
|
+
|
|
3408
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
3409
|
+
id TEXT PRIMARY KEY,
|
|
3410
|
+
event_type TEXT NOT NULL,
|
|
3411
|
+
occurred_at TEXT NOT NULL,
|
|
3412
|
+
sequence_index INTEGER NOT NULL,
|
|
3413
|
+
actor_agent_id TEXT,
|
|
3414
|
+
agent_role TEXT,
|
|
3415
|
+
project_name TEXT,
|
|
3416
|
+
session_id TEXT,
|
|
3417
|
+
task_id TEXT,
|
|
3418
|
+
goal_id TEXT,
|
|
3419
|
+
parent_event_id TEXT,
|
|
3420
|
+
intention TEXT,
|
|
3421
|
+
outcome TEXT,
|
|
3422
|
+
evidence_memory_id TEXT,
|
|
3423
|
+
impact TEXT,
|
|
3424
|
+
payload TEXT DEFAULT '{}',
|
|
3425
|
+
created_at TEXT NOT NULL
|
|
3426
|
+
);
|
|
3427
|
+
|
|
3428
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
3429
|
+
ON agent_events(occurred_at, sequence_index);
|
|
3430
|
+
|
|
3431
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
3432
|
+
ON agent_events(session_id, sequence_index);
|
|
3433
|
+
|
|
3434
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
3435
|
+
ON agent_events(goal_id, occurred_at);
|
|
3436
|
+
|
|
3437
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
3438
|
+
ON agent_events(evidence_memory_id);
|
|
3439
|
+
|
|
3440
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
3441
|
+
id TEXT PRIMARY KEY,
|
|
3442
|
+
goal_id TEXT NOT NULL,
|
|
3443
|
+
link_type TEXT NOT NULL,
|
|
3444
|
+
target_id TEXT NOT NULL,
|
|
3445
|
+
target_type TEXT NOT NULL,
|
|
3446
|
+
created_at TEXT NOT NULL
|
|
3447
|
+
);
|
|
3448
|
+
|
|
3449
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
3450
|
+
ON agent_goal_links(goal_id, target_type);
|
|
3451
|
+
|
|
3452
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
3453
|
+
id TEXT PRIMARY KEY,
|
|
3454
|
+
source_memory_id TEXT NOT NULL,
|
|
3455
|
+
event_id TEXT,
|
|
3456
|
+
labeler TEXT NOT NULL,
|
|
3457
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
3458
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3459
|
+
labels TEXT NOT NULL,
|
|
3460
|
+
created_at TEXT NOT NULL,
|
|
3461
|
+
updated_at TEXT NOT NULL
|
|
3462
|
+
);
|
|
3463
|
+
|
|
3464
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
3465
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
3466
|
+
|
|
3467
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
3468
|
+
ON agent_semantic_labels(event_id);
|
|
3469
|
+
|
|
3470
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
3471
|
+
id TEXT PRIMARY KEY,
|
|
3472
|
+
project_name TEXT,
|
|
3473
|
+
session_id TEXT,
|
|
3474
|
+
window_start_at TEXT NOT NULL,
|
|
3475
|
+
window_end_at TEXT NOT NULL,
|
|
3476
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3477
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
3478
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
3479
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
3480
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
3481
|
+
summary TEXT NOT NULL,
|
|
3482
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
3483
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
3484
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
3485
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3486
|
+
created_at TEXT NOT NULL
|
|
3487
|
+
);
|
|
3488
|
+
|
|
3489
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
3490
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
3491
|
+
|
|
3492
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
3493
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
3494
|
+
`);
|
|
3359
3495
|
try {
|
|
3360
3496
|
await client.execute({
|
|
3361
3497
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -6753,7 +6889,7 @@ var init_task_scope = __esm({
|
|
|
6753
6889
|
|
|
6754
6890
|
// src/lib/keychain.ts
|
|
6755
6891
|
import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
|
|
6756
|
-
import { existsSync as existsSync16 } from "fs";
|
|
6892
|
+
import { existsSync as existsSync16, statSync as statSync2 } from "fs";
|
|
6757
6893
|
import { execSync as execSync8 } from "child_process";
|
|
6758
6894
|
import path19 from "path";
|
|
6759
6895
|
import os12 from "os";
|
|
@@ -6763,29 +6899,78 @@ function getKeyDir() {
|
|
|
6763
6899
|
function getKeyPath() {
|
|
6764
6900
|
return path19.join(getKeyDir(), "master.key");
|
|
6765
6901
|
}
|
|
6766
|
-
function
|
|
6902
|
+
function nativeKeychainAllowed() {
|
|
6903
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
6904
|
+
}
|
|
6905
|
+
function linuxSecretAvailable() {
|
|
6906
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6907
|
+
if (process.platform !== "linux") return false;
|
|
6908
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
6909
|
+
try {
|
|
6910
|
+
execSync8("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
6911
|
+
} catch {
|
|
6912
|
+
linuxSecretAvailability = false;
|
|
6913
|
+
return false;
|
|
6914
|
+
}
|
|
6915
|
+
try {
|
|
6916
|
+
execSync8("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
6917
|
+
linuxSecretAvailability = true;
|
|
6918
|
+
} catch {
|
|
6919
|
+
linuxSecretAvailability = false;
|
|
6920
|
+
}
|
|
6921
|
+
return linuxSecretAvailability;
|
|
6922
|
+
}
|
|
6923
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
6924
|
+
if (process.platform !== "linux") return false;
|
|
6925
|
+
try {
|
|
6926
|
+
const uid = typeof os12.userInfo().uid === "number" ? os12.userInfo().uid : -1;
|
|
6927
|
+
const st = statSync2(keyPath);
|
|
6928
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
6929
|
+
if (uid === 0) return true;
|
|
6930
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
6931
|
+
return Boolean(exeOsDir && path19.resolve(keyPath).startsWith(path19.resolve(exeOsDir) + path19.sep));
|
|
6932
|
+
} catch {
|
|
6933
|
+
return false;
|
|
6934
|
+
}
|
|
6935
|
+
}
|
|
6936
|
+
function macKeychainGet(service = SERVICE) {
|
|
6937
|
+
if (!nativeKeychainAllowed()) return null;
|
|
6767
6938
|
if (process.platform !== "darwin") return null;
|
|
6768
6939
|
try {
|
|
6769
6940
|
return execSync8(
|
|
6770
|
-
`security find-generic-password -s "${
|
|
6941
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
6771
6942
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
6772
6943
|
).trim();
|
|
6773
6944
|
} catch {
|
|
6774
6945
|
return null;
|
|
6775
6946
|
}
|
|
6776
6947
|
}
|
|
6777
|
-
function macKeychainSet(value) {
|
|
6948
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
6949
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6778
6950
|
if (process.platform !== "darwin") return false;
|
|
6779
6951
|
try {
|
|
6780
6952
|
try {
|
|
6781
6953
|
execSync8(
|
|
6782
|
-
`security delete-generic-password -s "${
|
|
6954
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
6783
6955
|
{ timeout: 5e3 }
|
|
6784
6956
|
);
|
|
6785
6957
|
} catch {
|
|
6786
6958
|
}
|
|
6787
6959
|
execSync8(
|
|
6788
|
-
`security add-generic-password -s "${
|
|
6960
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
6961
|
+
{ timeout: 5e3 }
|
|
6962
|
+
);
|
|
6963
|
+
return true;
|
|
6964
|
+
} catch {
|
|
6965
|
+
return false;
|
|
6966
|
+
}
|
|
6967
|
+
}
|
|
6968
|
+
function macKeychainDelete(service = SERVICE) {
|
|
6969
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6970
|
+
if (process.platform !== "darwin") return false;
|
|
6971
|
+
try {
|
|
6972
|
+
execSync8(
|
|
6973
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
6789
6974
|
{ timeout: 5e3 }
|
|
6790
6975
|
);
|
|
6791
6976
|
return true;
|
|
@@ -6793,22 +6978,35 @@ function macKeychainSet(value) {
|
|
|
6793
6978
|
return false;
|
|
6794
6979
|
}
|
|
6795
6980
|
}
|
|
6796
|
-
function linuxSecretGet() {
|
|
6797
|
-
if (
|
|
6981
|
+
function linuxSecretGet(service = SERVICE) {
|
|
6982
|
+
if (!linuxSecretAvailable()) return null;
|
|
6798
6983
|
try {
|
|
6799
6984
|
return execSync8(
|
|
6800
|
-
`secret-tool lookup service "${
|
|
6985
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6801
6986
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
6802
6987
|
).trim();
|
|
6803
6988
|
} catch {
|
|
6804
6989
|
return null;
|
|
6805
6990
|
}
|
|
6806
6991
|
}
|
|
6807
|
-
function linuxSecretSet(value) {
|
|
6992
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
6993
|
+
if (!linuxSecretAvailable()) return false;
|
|
6994
|
+
try {
|
|
6995
|
+
execSync8(
|
|
6996
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6997
|
+
{ timeout: 5e3 }
|
|
6998
|
+
);
|
|
6999
|
+
return true;
|
|
7000
|
+
} catch {
|
|
7001
|
+
return false;
|
|
7002
|
+
}
|
|
7003
|
+
}
|
|
7004
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
7005
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6808
7006
|
if (process.platform !== "linux") return false;
|
|
6809
7007
|
try {
|
|
6810
7008
|
execSync8(
|
|
6811
|
-
`
|
|
7009
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6812
7010
|
{ timeout: 5e3 }
|
|
6813
7011
|
);
|
|
6814
7012
|
return true;
|
|
@@ -6817,6 +7015,7 @@ function linuxSecretSet(value) {
|
|
|
6817
7015
|
}
|
|
6818
7016
|
}
|
|
6819
7017
|
async function tryKeytar() {
|
|
7018
|
+
if (!nativeKeychainAllowed()) return null;
|
|
6820
7019
|
try {
|
|
6821
7020
|
return await import("keytar");
|
|
6822
7021
|
} catch {
|
|
@@ -6890,7 +7089,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
6890
7089
|
return "plaintext";
|
|
6891
7090
|
}
|
|
6892
7091
|
async function getMasterKey() {
|
|
6893
|
-
|
|
7092
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
7093
|
+
if (!nativeValue) {
|
|
7094
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
7095
|
+
if (legacyValue) {
|
|
7096
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
7097
|
+
if (migrated) {
|
|
7098
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
7099
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
7100
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
7101
|
+
}
|
|
7102
|
+
nativeValue = legacyValue;
|
|
7103
|
+
}
|
|
7104
|
+
}
|
|
6894
7105
|
if (nativeValue) {
|
|
6895
7106
|
return Buffer.from(nativeValue, "base64");
|
|
6896
7107
|
}
|
|
@@ -6898,12 +7109,17 @@ async function getMasterKey() {
|
|
|
6898
7109
|
if (keytar) {
|
|
6899
7110
|
try {
|
|
6900
7111
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
6901
|
-
|
|
6902
|
-
|
|
7112
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
7113
|
+
if (legacyKeytarValue) {
|
|
7114
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
6903
7115
|
if (migrated) {
|
|
6904
7116
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
7117
|
+
try {
|
|
7118
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
7119
|
+
} catch {
|
|
7120
|
+
}
|
|
6905
7121
|
}
|
|
6906
|
-
return Buffer.from(
|
|
7122
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
6907
7123
|
}
|
|
6908
7124
|
} catch {
|
|
6909
7125
|
}
|
|
@@ -6928,7 +7144,7 @@ async function getMasterKey() {
|
|
|
6928
7144
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
6929
7145
|
if (!decrypted) {
|
|
6930
7146
|
process.stderr.write(
|
|
6931
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
7147
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
6932
7148
|
);
|
|
6933
7149
|
return null;
|
|
6934
7150
|
}
|
|
@@ -6937,6 +7153,9 @@ async function getMasterKey() {
|
|
|
6937
7153
|
b64Value = content;
|
|
6938
7154
|
}
|
|
6939
7155
|
const key = Buffer.from(b64Value, "base64");
|
|
7156
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
7157
|
+
return key;
|
|
7158
|
+
}
|
|
6940
7159
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
6941
7160
|
if (migrated) {
|
|
6942
7161
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -6964,12 +7183,14 @@ async function getMasterKey() {
|
|
|
6964
7183
|
return null;
|
|
6965
7184
|
}
|
|
6966
7185
|
}
|
|
6967
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
7186
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
6968
7187
|
var init_keychain = __esm({
|
|
6969
7188
|
"src/lib/keychain.ts"() {
|
|
6970
7189
|
"use strict";
|
|
6971
|
-
SERVICE = "exe-
|
|
7190
|
+
SERVICE = "exe-os";
|
|
7191
|
+
LEGACY_SERVICE = "exe-mem";
|
|
6972
7192
|
ACCOUNT = "master-key";
|
|
7193
|
+
linuxSecretAvailability = null;
|
|
6973
7194
|
ENCRYPTED_PREFIX = "enc:";
|
|
6974
7195
|
}
|
|
6975
7196
|
});
|
|
@@ -7184,7 +7405,7 @@ __export(shard_manager_exports, {
|
|
|
7184
7405
|
shardExists: () => shardExists
|
|
7185
7406
|
});
|
|
7186
7407
|
import path20 from "path";
|
|
7187
|
-
import { existsSync as existsSync17, mkdirSync as mkdirSync8, readdirSync as readdirSync4, renameSync as renameSync4, statSync as
|
|
7408
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync8, readdirSync as readdirSync4, renameSync as renameSync4, statSync as statSync3 } from "fs";
|
|
7188
7409
|
import { createClient as createClient2 } from "@libsql/client";
|
|
7189
7410
|
function initShardManager(encryptionKey) {
|
|
7190
7411
|
_encryptionKey = encryptionKey;
|
|
@@ -7248,7 +7469,7 @@ async function auditShardHealth(options = {}) {
|
|
|
7248
7469
|
const shards = [];
|
|
7249
7470
|
for (const name of names) {
|
|
7250
7471
|
const dbPath = path20.join(SHARDS_DIR, `${name}.db`);
|
|
7251
|
-
const stat =
|
|
7472
|
+
const stat = statSync3(dbPath);
|
|
7252
7473
|
const item = {
|
|
7253
7474
|
name,
|
|
7254
7475
|
path: dbPath,
|
|
@@ -7501,7 +7722,7 @@ async function getReadyShardClient(projectName) {
|
|
|
7501
7722
|
_shardLastAccess.delete(safeName);
|
|
7502
7723
|
const dbPath = path20.join(SHARDS_DIR, `${safeName}.db`);
|
|
7503
7724
|
if (existsSync17(dbPath)) {
|
|
7504
|
-
const stat =
|
|
7725
|
+
const stat = statSync3(dbPath);
|
|
7505
7726
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
7506
7727
|
const archivedPath = path20.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
7507
7728
|
renameSync4(dbPath, archivedPath);
|
|
@@ -8008,6 +8229,274 @@ var init_memory_cards = __esm({
|
|
|
8008
8229
|
}
|
|
8009
8230
|
});
|
|
8010
8231
|
|
|
8232
|
+
// src/lib/agentic-ontology.ts
|
|
8233
|
+
var agentic_ontology_exports = {};
|
|
8234
|
+
__export(agentic_ontology_exports, {
|
|
8235
|
+
clean: () => clean,
|
|
8236
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
8237
|
+
inferIntention: () => inferIntention,
|
|
8238
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
8239
|
+
inferOutcome: () => inferOutcome,
|
|
8240
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
8241
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
8242
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
8243
|
+
ontologyPayload: () => ontologyPayload,
|
|
8244
|
+
stableId: () => stableId2
|
|
8245
|
+
});
|
|
8246
|
+
import { createHash as createHash3 } from "crypto";
|
|
8247
|
+
function stableId2(...parts) {
|
|
8248
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
8249
|
+
}
|
|
8250
|
+
function clean(text, max = 240) {
|
|
8251
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
8252
|
+
}
|
|
8253
|
+
function inferOntologyEventType(row) {
|
|
8254
|
+
const lower = row.raw_text.toLowerCase();
|
|
8255
|
+
if (row.has_error) return "error";
|
|
8256
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
8257
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
8258
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
8259
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
8260
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
8261
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
8262
|
+
return "memory_observation";
|
|
8263
|
+
}
|
|
8264
|
+
function inferIntention(row) {
|
|
8265
|
+
if (row.intent) return clean(row.intent, 220);
|
|
8266
|
+
const text = clean(row.raw_text, 1e3);
|
|
8267
|
+
const patterns = [
|
|
8268
|
+
/(?: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,
|
|
8269
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
8270
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
8271
|
+
];
|
|
8272
|
+
for (const p of patterns) {
|
|
8273
|
+
const m = text.match(p);
|
|
8274
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
8275
|
+
}
|
|
8276
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
8277
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
8278
|
+
}
|
|
8279
|
+
return null;
|
|
8280
|
+
}
|
|
8281
|
+
function inferOutcome(row) {
|
|
8282
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
8283
|
+
if (row.has_error) return "error";
|
|
8284
|
+
const lower = row.raw_text.toLowerCase();
|
|
8285
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
8286
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
8287
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
8288
|
+
return null;
|
|
8289
|
+
}
|
|
8290
|
+
function extractGoalCandidates(row) {
|
|
8291
|
+
const text = clean(row.raw_text, 1600);
|
|
8292
|
+
const patterns = [
|
|
8293
|
+
/(?: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,
|
|
8294
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
8295
|
+
];
|
|
8296
|
+
const out = [];
|
|
8297
|
+
for (const pattern of patterns) {
|
|
8298
|
+
for (const m of text.matchAll(pattern)) {
|
|
8299
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
8300
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
8301
|
+
if (out.length >= 3) return out;
|
|
8302
|
+
}
|
|
8303
|
+
}
|
|
8304
|
+
return out;
|
|
8305
|
+
}
|
|
8306
|
+
function uniq(values, max = 6) {
|
|
8307
|
+
const out = [];
|
|
8308
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
8309
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
8310
|
+
if (out.length >= max) break;
|
|
8311
|
+
}
|
|
8312
|
+
return out;
|
|
8313
|
+
}
|
|
8314
|
+
function extractMatches(text, patterns, max = 5) {
|
|
8315
|
+
const out = [];
|
|
8316
|
+
for (const pattern of patterns) {
|
|
8317
|
+
for (const match of text.matchAll(pattern)) {
|
|
8318
|
+
const value = match[1] ?? match[0];
|
|
8319
|
+
if (value) out.push(value);
|
|
8320
|
+
if (out.length >= max) return uniq(out, max);
|
|
8321
|
+
}
|
|
8322
|
+
}
|
|
8323
|
+
return uniq(out, max);
|
|
8324
|
+
}
|
|
8325
|
+
function inferSemanticLabel(row) {
|
|
8326
|
+
const text = clean(row.raw_text, 2400);
|
|
8327
|
+
const eventType = inferOntologyEventType(row);
|
|
8328
|
+
const intention = inferIntention(row);
|
|
8329
|
+
const outcome = inferOutcome(row);
|
|
8330
|
+
const goals = extractGoalCandidates(row);
|
|
8331
|
+
const milestones = extractMatches(text, [
|
|
8332
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
8333
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
8334
|
+
]);
|
|
8335
|
+
const problems = extractMatches(text, [
|
|
8336
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
8337
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
8338
|
+
]);
|
|
8339
|
+
const decisions = extractMatches(text, [
|
|
8340
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
8341
|
+
]);
|
|
8342
|
+
const temporalAnchors = extractMatches(text, [
|
|
8343
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
8344
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
8345
|
+
], 8);
|
|
8346
|
+
const nextActions = extractMatches(text, [
|
|
8347
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
8348
|
+
]);
|
|
8349
|
+
const actors = uniq([
|
|
8350
|
+
row.agent_id,
|
|
8351
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
8352
|
+
], 6);
|
|
8353
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
8354
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
8355
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
8356
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
8357
|
+
return {
|
|
8358
|
+
labeler: "deterministic",
|
|
8359
|
+
schemaVersion: 1,
|
|
8360
|
+
eventType,
|
|
8361
|
+
intention,
|
|
8362
|
+
outcome,
|
|
8363
|
+
impact,
|
|
8364
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
8365
|
+
goals,
|
|
8366
|
+
milestones,
|
|
8367
|
+
problems,
|
|
8368
|
+
decisions,
|
|
8369
|
+
actors,
|
|
8370
|
+
temporalAnchors,
|
|
8371
|
+
successSignals,
|
|
8372
|
+
failureSignals,
|
|
8373
|
+
nextActions,
|
|
8374
|
+
summary: clean(text, 280)
|
|
8375
|
+
};
|
|
8376
|
+
}
|
|
8377
|
+
function ontologyPayload(row) {
|
|
8378
|
+
const semantic = inferSemanticLabel(row);
|
|
8379
|
+
return {
|
|
8380
|
+
tool_name: row.tool_name,
|
|
8381
|
+
memory_version: row.version ?? null,
|
|
8382
|
+
domain: row.domain ?? null,
|
|
8383
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
8384
|
+
semantic
|
|
8385
|
+
};
|
|
8386
|
+
}
|
|
8387
|
+
function safeJson(value) {
|
|
8388
|
+
try {
|
|
8389
|
+
return JSON.parse(value);
|
|
8390
|
+
} catch {
|
|
8391
|
+
return value.slice(0, 1e3);
|
|
8392
|
+
}
|
|
8393
|
+
}
|
|
8394
|
+
async function resolveClient(client) {
|
|
8395
|
+
if (client) return client;
|
|
8396
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
8397
|
+
return getClient2();
|
|
8398
|
+
}
|
|
8399
|
+
async function insertOntologyForMemory(row, client) {
|
|
8400
|
+
const db = await resolveClient(client);
|
|
8401
|
+
const occurredAt = row.timestamp;
|
|
8402
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
8403
|
+
const eventType = inferOntologyEventType(row);
|
|
8404
|
+
const intention = inferIntention(row);
|
|
8405
|
+
const outcome = inferOutcome(row);
|
|
8406
|
+
const eventId = stableId2("event", row.id);
|
|
8407
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
8408
|
+
await db.execute({
|
|
8409
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
8410
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
8411
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
8412
|
+
event_count = event_count + 1`,
|
|
8413
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
8414
|
+
});
|
|
8415
|
+
await db.execute({
|
|
8416
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
8417
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
8418
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
8419
|
+
impact, payload, created_at)
|
|
8420
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
8421
|
+
args: [
|
|
8422
|
+
eventId,
|
|
8423
|
+
eventType,
|
|
8424
|
+
occurredAt,
|
|
8425
|
+
sequence,
|
|
8426
|
+
row.agent_id,
|
|
8427
|
+
row.agent_role,
|
|
8428
|
+
row.project_name,
|
|
8429
|
+
row.session_id,
|
|
8430
|
+
row.task_id ?? null,
|
|
8431
|
+
intention,
|
|
8432
|
+
outcome,
|
|
8433
|
+
row.id,
|
|
8434
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
8435
|
+
JSON.stringify(ontologyPayload(row)),
|
|
8436
|
+
now
|
|
8437
|
+
]
|
|
8438
|
+
});
|
|
8439
|
+
const semantic = inferSemanticLabel(row);
|
|
8440
|
+
await db.execute({
|
|
8441
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
8442
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
8443
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
8444
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
8445
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
8446
|
+
args: [
|
|
8447
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
8448
|
+
row.id,
|
|
8449
|
+
eventId,
|
|
8450
|
+
semantic.labeler,
|
|
8451
|
+
semantic.schemaVersion,
|
|
8452
|
+
semantic.confidence,
|
|
8453
|
+
JSON.stringify(semantic),
|
|
8454
|
+
now,
|
|
8455
|
+
now
|
|
8456
|
+
]
|
|
8457
|
+
});
|
|
8458
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
8459
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
8460
|
+
await db.execute({
|
|
8461
|
+
sql: `INSERT INTO agent_goals
|
|
8462
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
8463
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
8464
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
8465
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
8466
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
8467
|
+
});
|
|
8468
|
+
await db.execute({
|
|
8469
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
8470
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
8471
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
8472
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
8473
|
+
});
|
|
8474
|
+
await db.execute({
|
|
8475
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
8476
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
8477
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
8478
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
8479
|
+
});
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8482
|
+
async function insertOntologyForBatch(rows, client) {
|
|
8483
|
+
const db = await resolveClient(client);
|
|
8484
|
+
let count = 0;
|
|
8485
|
+
for (const row of rows) {
|
|
8486
|
+
try {
|
|
8487
|
+
await insertOntologyForMemory(row, db);
|
|
8488
|
+
count++;
|
|
8489
|
+
} catch {
|
|
8490
|
+
}
|
|
8491
|
+
}
|
|
8492
|
+
return count;
|
|
8493
|
+
}
|
|
8494
|
+
var init_agentic_ontology = __esm({
|
|
8495
|
+
"src/lib/agentic-ontology.ts"() {
|
|
8496
|
+
"use strict";
|
|
8497
|
+
}
|
|
8498
|
+
});
|
|
8499
|
+
|
|
8011
8500
|
// src/lib/store.ts
|
|
8012
8501
|
var store_exports = {};
|
|
8013
8502
|
__export(store_exports, {
|
|
@@ -8351,6 +8840,11 @@ async function flushBatch() {
|
|
|
8351
8840
|
await insertMemoryCardsForBatch2(batch);
|
|
8352
8841
|
} catch {
|
|
8353
8842
|
}
|
|
8843
|
+
try {
|
|
8844
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
8845
|
+
await insertOntologyForBatch2(batch);
|
|
8846
|
+
} catch {
|
|
8847
|
+
}
|
|
8354
8848
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
8355
8849
|
_pendingRecords.splice(0, batch.length);
|
|
8356
8850
|
try {
|