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