@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/git-sweep.js
CHANGED
|
@@ -476,6 +476,10 @@ async function loadConfig() {
|
|
|
476
476
|
if (config.dbPath.startsWith("~")) {
|
|
477
477
|
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
478
478
|
}
|
|
479
|
+
const envDbPath = path2.join(dir, "memories.db");
|
|
480
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync3(config.dbPath) && existsSync3(envDbPath)) {
|
|
481
|
+
config.dbPath = envDbPath;
|
|
482
|
+
}
|
|
479
483
|
return config;
|
|
480
484
|
} catch {
|
|
481
485
|
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
@@ -496,7 +500,15 @@ function loadConfigSync() {
|
|
|
496
500
|
normalizeSessionLifecycle(migratedCfg);
|
|
497
501
|
normalizeAutoUpdate(migratedCfg);
|
|
498
502
|
normalizeOrchestration(migratedCfg);
|
|
499
|
-
|
|
503
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
504
|
+
if (config.dbPath.startsWith("~")) {
|
|
505
|
+
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
506
|
+
}
|
|
507
|
+
const envDbPath = path2.join(dir, "memories.db");
|
|
508
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync3(config.dbPath) && existsSync3(envDbPath)) {
|
|
509
|
+
config.dbPath = envDbPath;
|
|
510
|
+
}
|
|
511
|
+
return config;
|
|
500
512
|
} catch {
|
|
501
513
|
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
502
514
|
}
|
|
@@ -2259,6 +2271,9 @@ function getClient() {
|
|
|
2259
2271
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
2260
2272
|
return _daemonClient;
|
|
2261
2273
|
}
|
|
2274
|
+
if (!_resilientClient) {
|
|
2275
|
+
return _adapterClient;
|
|
2276
|
+
}
|
|
2262
2277
|
return _resilientClient;
|
|
2263
2278
|
}
|
|
2264
2279
|
async function initDaemonClient() {
|
|
@@ -3291,6 +3306,127 @@ async function ensureSchema() {
|
|
|
3291
3306
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
3292
3307
|
END;
|
|
3293
3308
|
`);
|
|
3309
|
+
await client.executeMultiple(`
|
|
3310
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
3311
|
+
id TEXT PRIMARY KEY,
|
|
3312
|
+
agent_id TEXT NOT NULL,
|
|
3313
|
+
project_name TEXT,
|
|
3314
|
+
started_at TEXT NOT NULL,
|
|
3315
|
+
last_event_at TEXT NOT NULL,
|
|
3316
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3317
|
+
properties TEXT DEFAULT '{}'
|
|
3318
|
+
);
|
|
3319
|
+
|
|
3320
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
3321
|
+
ON agent_sessions(agent_id, started_at);
|
|
3322
|
+
|
|
3323
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
3324
|
+
id TEXT PRIMARY KEY,
|
|
3325
|
+
statement TEXT NOT NULL,
|
|
3326
|
+
owner_agent_id TEXT,
|
|
3327
|
+
project_name TEXT,
|
|
3328
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
3329
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
3330
|
+
success_criteria TEXT,
|
|
3331
|
+
parent_goal_id TEXT,
|
|
3332
|
+
due_at TEXT,
|
|
3333
|
+
achieved_at TEXT,
|
|
3334
|
+
supersedes_id TEXT,
|
|
3335
|
+
created_at TEXT NOT NULL,
|
|
3336
|
+
updated_at TEXT NOT NULL,
|
|
3337
|
+
source_memory_id TEXT
|
|
3338
|
+
);
|
|
3339
|
+
|
|
3340
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
3341
|
+
ON agent_goals(project_name, status, priority);
|
|
3342
|
+
|
|
3343
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
3344
|
+
id TEXT PRIMARY KEY,
|
|
3345
|
+
event_type TEXT NOT NULL,
|
|
3346
|
+
occurred_at TEXT NOT NULL,
|
|
3347
|
+
sequence_index INTEGER NOT NULL,
|
|
3348
|
+
actor_agent_id TEXT,
|
|
3349
|
+
agent_role TEXT,
|
|
3350
|
+
project_name TEXT,
|
|
3351
|
+
session_id TEXT,
|
|
3352
|
+
task_id TEXT,
|
|
3353
|
+
goal_id TEXT,
|
|
3354
|
+
parent_event_id TEXT,
|
|
3355
|
+
intention TEXT,
|
|
3356
|
+
outcome TEXT,
|
|
3357
|
+
evidence_memory_id TEXT,
|
|
3358
|
+
impact TEXT,
|
|
3359
|
+
payload TEXT DEFAULT '{}',
|
|
3360
|
+
created_at TEXT NOT NULL
|
|
3361
|
+
);
|
|
3362
|
+
|
|
3363
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
3364
|
+
ON agent_events(occurred_at, sequence_index);
|
|
3365
|
+
|
|
3366
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
3367
|
+
ON agent_events(session_id, sequence_index);
|
|
3368
|
+
|
|
3369
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
3370
|
+
ON agent_events(goal_id, occurred_at);
|
|
3371
|
+
|
|
3372
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
3373
|
+
ON agent_events(evidence_memory_id);
|
|
3374
|
+
|
|
3375
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
3376
|
+
id TEXT PRIMARY KEY,
|
|
3377
|
+
goal_id TEXT NOT NULL,
|
|
3378
|
+
link_type TEXT NOT NULL,
|
|
3379
|
+
target_id TEXT NOT NULL,
|
|
3380
|
+
target_type TEXT NOT NULL,
|
|
3381
|
+
created_at TEXT NOT NULL
|
|
3382
|
+
);
|
|
3383
|
+
|
|
3384
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
3385
|
+
ON agent_goal_links(goal_id, target_type);
|
|
3386
|
+
|
|
3387
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
3388
|
+
id TEXT PRIMARY KEY,
|
|
3389
|
+
source_memory_id TEXT NOT NULL,
|
|
3390
|
+
event_id TEXT,
|
|
3391
|
+
labeler TEXT NOT NULL,
|
|
3392
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
3393
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3394
|
+
labels TEXT NOT NULL,
|
|
3395
|
+
created_at TEXT NOT NULL,
|
|
3396
|
+
updated_at TEXT NOT NULL
|
|
3397
|
+
);
|
|
3398
|
+
|
|
3399
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
3400
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
3401
|
+
|
|
3402
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
3403
|
+
ON agent_semantic_labels(event_id);
|
|
3404
|
+
|
|
3405
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
3406
|
+
id TEXT PRIMARY KEY,
|
|
3407
|
+
project_name TEXT,
|
|
3408
|
+
session_id TEXT,
|
|
3409
|
+
window_start_at TEXT NOT NULL,
|
|
3410
|
+
window_end_at TEXT NOT NULL,
|
|
3411
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3412
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
3413
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
3414
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
3415
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
3416
|
+
summary TEXT NOT NULL,
|
|
3417
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
3418
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
3419
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
3420
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3421
|
+
created_at TEXT NOT NULL
|
|
3422
|
+
);
|
|
3423
|
+
|
|
3424
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
3425
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
3426
|
+
|
|
3427
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
3428
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
3429
|
+
`);
|
|
3294
3430
|
try {
|
|
3295
3431
|
await client.execute({
|
|
3296
3432
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -6688,7 +6824,7 @@ var init_task_scope = __esm({
|
|
|
6688
6824
|
|
|
6689
6825
|
// src/lib/keychain.ts
|
|
6690
6826
|
import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
|
|
6691
|
-
import { existsSync as existsSync16 } from "fs";
|
|
6827
|
+
import { existsSync as existsSync16, statSync as statSync2 } from "fs";
|
|
6692
6828
|
import { execSync as execSync7 } from "child_process";
|
|
6693
6829
|
import path19 from "path";
|
|
6694
6830
|
import os12 from "os";
|
|
@@ -6698,29 +6834,65 @@ function getKeyDir() {
|
|
|
6698
6834
|
function getKeyPath() {
|
|
6699
6835
|
return path19.join(getKeyDir(), "master.key");
|
|
6700
6836
|
}
|
|
6701
|
-
function
|
|
6837
|
+
function nativeKeychainAllowed() {
|
|
6838
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
6839
|
+
}
|
|
6840
|
+
function linuxSecretAvailable() {
|
|
6841
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6842
|
+
if (process.platform !== "linux") return false;
|
|
6843
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
6844
|
+
try {
|
|
6845
|
+
execSync7("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
6846
|
+
} catch {
|
|
6847
|
+
linuxSecretAvailability = false;
|
|
6848
|
+
return false;
|
|
6849
|
+
}
|
|
6850
|
+
try {
|
|
6851
|
+
execSync7("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
6852
|
+
linuxSecretAvailability = true;
|
|
6853
|
+
} catch {
|
|
6854
|
+
linuxSecretAvailability = false;
|
|
6855
|
+
}
|
|
6856
|
+
return linuxSecretAvailability;
|
|
6857
|
+
}
|
|
6858
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
6859
|
+
if (process.platform !== "linux") return false;
|
|
6860
|
+
try {
|
|
6861
|
+
const uid = typeof os12.userInfo().uid === "number" ? os12.userInfo().uid : -1;
|
|
6862
|
+
const st = statSync2(keyPath);
|
|
6863
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
6864
|
+
if (uid === 0) return true;
|
|
6865
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
6866
|
+
return Boolean(exeOsDir && path19.resolve(keyPath).startsWith(path19.resolve(exeOsDir) + path19.sep));
|
|
6867
|
+
} catch {
|
|
6868
|
+
return false;
|
|
6869
|
+
}
|
|
6870
|
+
}
|
|
6871
|
+
function macKeychainGet(service = SERVICE) {
|
|
6872
|
+
if (!nativeKeychainAllowed()) return null;
|
|
6702
6873
|
if (process.platform !== "darwin") return null;
|
|
6703
6874
|
try {
|
|
6704
6875
|
return execSync7(
|
|
6705
|
-
`security find-generic-password -s "${
|
|
6876
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
6706
6877
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
6707
6878
|
).trim();
|
|
6708
6879
|
} catch {
|
|
6709
6880
|
return null;
|
|
6710
6881
|
}
|
|
6711
6882
|
}
|
|
6712
|
-
function macKeychainSet(value) {
|
|
6883
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
6884
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6713
6885
|
if (process.platform !== "darwin") return false;
|
|
6714
6886
|
try {
|
|
6715
6887
|
try {
|
|
6716
6888
|
execSync7(
|
|
6717
|
-
`security delete-generic-password -s "${
|
|
6889
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
6718
6890
|
{ timeout: 5e3 }
|
|
6719
6891
|
);
|
|
6720
6892
|
} catch {
|
|
6721
6893
|
}
|
|
6722
6894
|
execSync7(
|
|
6723
|
-
`security add-generic-password -s "${
|
|
6895
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
6724
6896
|
{ timeout: 5e3 }
|
|
6725
6897
|
);
|
|
6726
6898
|
return true;
|
|
@@ -6728,22 +6900,48 @@ function macKeychainSet(value) {
|
|
|
6728
6900
|
return false;
|
|
6729
6901
|
}
|
|
6730
6902
|
}
|
|
6731
|
-
function
|
|
6732
|
-
if (
|
|
6903
|
+
function macKeychainDelete(service = SERVICE) {
|
|
6904
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6905
|
+
if (process.platform !== "darwin") return false;
|
|
6906
|
+
try {
|
|
6907
|
+
execSync7(
|
|
6908
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
6909
|
+
{ timeout: 5e3 }
|
|
6910
|
+
);
|
|
6911
|
+
return true;
|
|
6912
|
+
} catch {
|
|
6913
|
+
return false;
|
|
6914
|
+
}
|
|
6915
|
+
}
|
|
6916
|
+
function linuxSecretGet(service = SERVICE) {
|
|
6917
|
+
if (!linuxSecretAvailable()) return null;
|
|
6733
6918
|
try {
|
|
6734
6919
|
return execSync7(
|
|
6735
|
-
`secret-tool lookup service "${
|
|
6920
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6736
6921
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
6737
6922
|
).trim();
|
|
6738
6923
|
} catch {
|
|
6739
6924
|
return null;
|
|
6740
6925
|
}
|
|
6741
6926
|
}
|
|
6742
|
-
function linuxSecretSet(value) {
|
|
6927
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
6928
|
+
if (!linuxSecretAvailable()) return false;
|
|
6929
|
+
try {
|
|
6930
|
+
execSync7(
|
|
6931
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6932
|
+
{ timeout: 5e3 }
|
|
6933
|
+
);
|
|
6934
|
+
return true;
|
|
6935
|
+
} catch {
|
|
6936
|
+
return false;
|
|
6937
|
+
}
|
|
6938
|
+
}
|
|
6939
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
6940
|
+
if (!nativeKeychainAllowed()) return false;
|
|
6743
6941
|
if (process.platform !== "linux") return false;
|
|
6744
6942
|
try {
|
|
6745
6943
|
execSync7(
|
|
6746
|
-
`
|
|
6944
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
6747
6945
|
{ timeout: 5e3 }
|
|
6748
6946
|
);
|
|
6749
6947
|
return true;
|
|
@@ -6752,6 +6950,7 @@ function linuxSecretSet(value) {
|
|
|
6752
6950
|
}
|
|
6753
6951
|
}
|
|
6754
6952
|
async function tryKeytar() {
|
|
6953
|
+
if (!nativeKeychainAllowed()) return null;
|
|
6755
6954
|
try {
|
|
6756
6955
|
return await import("keytar");
|
|
6757
6956
|
} catch {
|
|
@@ -6825,7 +7024,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
6825
7024
|
return "plaintext";
|
|
6826
7025
|
}
|
|
6827
7026
|
async function getMasterKey() {
|
|
6828
|
-
|
|
7027
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
7028
|
+
if (!nativeValue) {
|
|
7029
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
7030
|
+
if (legacyValue) {
|
|
7031
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
7032
|
+
if (migrated) {
|
|
7033
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
7034
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
7035
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
7036
|
+
}
|
|
7037
|
+
nativeValue = legacyValue;
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
6829
7040
|
if (nativeValue) {
|
|
6830
7041
|
return Buffer.from(nativeValue, "base64");
|
|
6831
7042
|
}
|
|
@@ -6833,12 +7044,17 @@ async function getMasterKey() {
|
|
|
6833
7044
|
if (keytar) {
|
|
6834
7045
|
try {
|
|
6835
7046
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
6836
|
-
|
|
6837
|
-
|
|
7047
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
7048
|
+
if (legacyKeytarValue) {
|
|
7049
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
6838
7050
|
if (migrated) {
|
|
6839
7051
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
7052
|
+
try {
|
|
7053
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
7054
|
+
} catch {
|
|
7055
|
+
}
|
|
6840
7056
|
}
|
|
6841
|
-
return Buffer.from(
|
|
7057
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
6842
7058
|
}
|
|
6843
7059
|
} catch {
|
|
6844
7060
|
}
|
|
@@ -6863,7 +7079,7 @@ async function getMasterKey() {
|
|
|
6863
7079
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
6864
7080
|
if (!decrypted) {
|
|
6865
7081
|
process.stderr.write(
|
|
6866
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
7082
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
6867
7083
|
);
|
|
6868
7084
|
return null;
|
|
6869
7085
|
}
|
|
@@ -6872,6 +7088,9 @@ async function getMasterKey() {
|
|
|
6872
7088
|
b64Value = content;
|
|
6873
7089
|
}
|
|
6874
7090
|
const key = Buffer.from(b64Value, "base64");
|
|
7091
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
7092
|
+
return key;
|
|
7093
|
+
}
|
|
6875
7094
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
6876
7095
|
if (migrated) {
|
|
6877
7096
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -6899,12 +7118,14 @@ async function getMasterKey() {
|
|
|
6899
7118
|
return null;
|
|
6900
7119
|
}
|
|
6901
7120
|
}
|
|
6902
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
7121
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
6903
7122
|
var init_keychain = __esm({
|
|
6904
7123
|
"src/lib/keychain.ts"() {
|
|
6905
7124
|
"use strict";
|
|
6906
|
-
SERVICE = "exe-
|
|
7125
|
+
SERVICE = "exe-os";
|
|
7126
|
+
LEGACY_SERVICE = "exe-mem";
|
|
6907
7127
|
ACCOUNT = "master-key";
|
|
7128
|
+
linuxSecretAvailability = null;
|
|
6908
7129
|
ENCRYPTED_PREFIX = "enc:";
|
|
6909
7130
|
}
|
|
6910
7131
|
});
|
|
@@ -7119,7 +7340,7 @@ __export(shard_manager_exports, {
|
|
|
7119
7340
|
shardExists: () => shardExists
|
|
7120
7341
|
});
|
|
7121
7342
|
import path20 from "path";
|
|
7122
|
-
import { existsSync as existsSync17, mkdirSync as mkdirSync8, readdirSync as readdirSync4, renameSync as renameSync4, statSync as
|
|
7343
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync8, readdirSync as readdirSync4, renameSync as renameSync4, statSync as statSync3 } from "fs";
|
|
7123
7344
|
import { createClient as createClient2 } from "@libsql/client";
|
|
7124
7345
|
function initShardManager(encryptionKey) {
|
|
7125
7346
|
_encryptionKey = encryptionKey;
|
|
@@ -7183,7 +7404,7 @@ async function auditShardHealth(options = {}) {
|
|
|
7183
7404
|
const shards = [];
|
|
7184
7405
|
for (const name of names) {
|
|
7185
7406
|
const dbPath = path20.join(SHARDS_DIR, `${name}.db`);
|
|
7186
|
-
const stat =
|
|
7407
|
+
const stat = statSync3(dbPath);
|
|
7187
7408
|
const item = {
|
|
7188
7409
|
name,
|
|
7189
7410
|
path: dbPath,
|
|
@@ -7436,7 +7657,7 @@ async function getReadyShardClient(projectName2) {
|
|
|
7436
7657
|
_shardLastAccess.delete(safeName);
|
|
7437
7658
|
const dbPath = path20.join(SHARDS_DIR, `${safeName}.db`);
|
|
7438
7659
|
if (existsSync17(dbPath)) {
|
|
7439
|
-
const stat =
|
|
7660
|
+
const stat = statSync3(dbPath);
|
|
7440
7661
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
7441
7662
|
const archivedPath = path20.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
7442
7663
|
renameSync4(dbPath, archivedPath);
|
|
@@ -7943,6 +8164,274 @@ var init_memory_cards = __esm({
|
|
|
7943
8164
|
}
|
|
7944
8165
|
});
|
|
7945
8166
|
|
|
8167
|
+
// src/lib/agentic-ontology.ts
|
|
8168
|
+
var agentic_ontology_exports = {};
|
|
8169
|
+
__export(agentic_ontology_exports, {
|
|
8170
|
+
clean: () => clean,
|
|
8171
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
8172
|
+
inferIntention: () => inferIntention,
|
|
8173
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
8174
|
+
inferOutcome: () => inferOutcome,
|
|
8175
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
8176
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
8177
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
8178
|
+
ontologyPayload: () => ontologyPayload,
|
|
8179
|
+
stableId: () => stableId2
|
|
8180
|
+
});
|
|
8181
|
+
import { createHash as createHash3 } from "crypto";
|
|
8182
|
+
function stableId2(...parts) {
|
|
8183
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
8184
|
+
}
|
|
8185
|
+
function clean(text, max = 240) {
|
|
8186
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
8187
|
+
}
|
|
8188
|
+
function inferOntologyEventType(row) {
|
|
8189
|
+
const lower = row.raw_text.toLowerCase();
|
|
8190
|
+
if (row.has_error) return "error";
|
|
8191
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
8192
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
8193
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
8194
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
8195
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
8196
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
8197
|
+
return "memory_observation";
|
|
8198
|
+
}
|
|
8199
|
+
function inferIntention(row) {
|
|
8200
|
+
if (row.intent) return clean(row.intent, 220);
|
|
8201
|
+
const text = clean(row.raw_text, 1e3);
|
|
8202
|
+
const patterns = [
|
|
8203
|
+
/(?: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,
|
|
8204
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
8205
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
8206
|
+
];
|
|
8207
|
+
for (const p of patterns) {
|
|
8208
|
+
const m = text.match(p);
|
|
8209
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
8210
|
+
}
|
|
8211
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
8212
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
8213
|
+
}
|
|
8214
|
+
return null;
|
|
8215
|
+
}
|
|
8216
|
+
function inferOutcome(row) {
|
|
8217
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
8218
|
+
if (row.has_error) return "error";
|
|
8219
|
+
const lower = row.raw_text.toLowerCase();
|
|
8220
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
8221
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
8222
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
8223
|
+
return null;
|
|
8224
|
+
}
|
|
8225
|
+
function extractGoalCandidates(row) {
|
|
8226
|
+
const text = clean(row.raw_text, 1600);
|
|
8227
|
+
const patterns = [
|
|
8228
|
+
/(?: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,
|
|
8229
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
8230
|
+
];
|
|
8231
|
+
const out = [];
|
|
8232
|
+
for (const pattern of patterns) {
|
|
8233
|
+
for (const m of text.matchAll(pattern)) {
|
|
8234
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
8235
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
8236
|
+
if (out.length >= 3) return out;
|
|
8237
|
+
}
|
|
8238
|
+
}
|
|
8239
|
+
return out;
|
|
8240
|
+
}
|
|
8241
|
+
function uniq(values, max = 6) {
|
|
8242
|
+
const out = [];
|
|
8243
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
8244
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
8245
|
+
if (out.length >= max) break;
|
|
8246
|
+
}
|
|
8247
|
+
return out;
|
|
8248
|
+
}
|
|
8249
|
+
function extractMatches(text, patterns, max = 5) {
|
|
8250
|
+
const out = [];
|
|
8251
|
+
for (const pattern of patterns) {
|
|
8252
|
+
for (const match of text.matchAll(pattern)) {
|
|
8253
|
+
const value = match[1] ?? match[0];
|
|
8254
|
+
if (value) out.push(value);
|
|
8255
|
+
if (out.length >= max) return uniq(out, max);
|
|
8256
|
+
}
|
|
8257
|
+
}
|
|
8258
|
+
return uniq(out, max);
|
|
8259
|
+
}
|
|
8260
|
+
function inferSemanticLabel(row) {
|
|
8261
|
+
const text = clean(row.raw_text, 2400);
|
|
8262
|
+
const eventType = inferOntologyEventType(row);
|
|
8263
|
+
const intention = inferIntention(row);
|
|
8264
|
+
const outcome = inferOutcome(row);
|
|
8265
|
+
const goals = extractGoalCandidates(row);
|
|
8266
|
+
const milestones = extractMatches(text, [
|
|
8267
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
8268
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
8269
|
+
]);
|
|
8270
|
+
const problems = extractMatches(text, [
|
|
8271
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
8272
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
8273
|
+
]);
|
|
8274
|
+
const decisions = extractMatches(text, [
|
|
8275
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
8276
|
+
]);
|
|
8277
|
+
const temporalAnchors = extractMatches(text, [
|
|
8278
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
8279
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
8280
|
+
], 8);
|
|
8281
|
+
const nextActions = extractMatches(text, [
|
|
8282
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
8283
|
+
]);
|
|
8284
|
+
const actors = uniq([
|
|
8285
|
+
row.agent_id,
|
|
8286
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
8287
|
+
], 6);
|
|
8288
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
8289
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
8290
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
8291
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
8292
|
+
return {
|
|
8293
|
+
labeler: "deterministic",
|
|
8294
|
+
schemaVersion: 1,
|
|
8295
|
+
eventType,
|
|
8296
|
+
intention,
|
|
8297
|
+
outcome,
|
|
8298
|
+
impact,
|
|
8299
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
8300
|
+
goals,
|
|
8301
|
+
milestones,
|
|
8302
|
+
problems,
|
|
8303
|
+
decisions,
|
|
8304
|
+
actors,
|
|
8305
|
+
temporalAnchors,
|
|
8306
|
+
successSignals,
|
|
8307
|
+
failureSignals,
|
|
8308
|
+
nextActions,
|
|
8309
|
+
summary: clean(text, 280)
|
|
8310
|
+
};
|
|
8311
|
+
}
|
|
8312
|
+
function ontologyPayload(row) {
|
|
8313
|
+
const semantic = inferSemanticLabel(row);
|
|
8314
|
+
return {
|
|
8315
|
+
tool_name: row.tool_name,
|
|
8316
|
+
memory_version: row.version ?? null,
|
|
8317
|
+
domain: row.domain ?? null,
|
|
8318
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
8319
|
+
semantic
|
|
8320
|
+
};
|
|
8321
|
+
}
|
|
8322
|
+
function safeJson(value) {
|
|
8323
|
+
try {
|
|
8324
|
+
return JSON.parse(value);
|
|
8325
|
+
} catch {
|
|
8326
|
+
return value.slice(0, 1e3);
|
|
8327
|
+
}
|
|
8328
|
+
}
|
|
8329
|
+
async function resolveClient(client) {
|
|
8330
|
+
if (client) return client;
|
|
8331
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
8332
|
+
return getClient2();
|
|
8333
|
+
}
|
|
8334
|
+
async function insertOntologyForMemory(row, client) {
|
|
8335
|
+
const db = await resolveClient(client);
|
|
8336
|
+
const occurredAt = row.timestamp;
|
|
8337
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
8338
|
+
const eventType = inferOntologyEventType(row);
|
|
8339
|
+
const intention = inferIntention(row);
|
|
8340
|
+
const outcome = inferOutcome(row);
|
|
8341
|
+
const eventId = stableId2("event", row.id);
|
|
8342
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
8343
|
+
await db.execute({
|
|
8344
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
8345
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
8346
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
8347
|
+
event_count = event_count + 1`,
|
|
8348
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
8349
|
+
});
|
|
8350
|
+
await db.execute({
|
|
8351
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
8352
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
8353
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
8354
|
+
impact, payload, created_at)
|
|
8355
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
8356
|
+
args: [
|
|
8357
|
+
eventId,
|
|
8358
|
+
eventType,
|
|
8359
|
+
occurredAt,
|
|
8360
|
+
sequence,
|
|
8361
|
+
row.agent_id,
|
|
8362
|
+
row.agent_role,
|
|
8363
|
+
row.project_name,
|
|
8364
|
+
row.session_id,
|
|
8365
|
+
row.task_id ?? null,
|
|
8366
|
+
intention,
|
|
8367
|
+
outcome,
|
|
8368
|
+
row.id,
|
|
8369
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
8370
|
+
JSON.stringify(ontologyPayload(row)),
|
|
8371
|
+
now
|
|
8372
|
+
]
|
|
8373
|
+
});
|
|
8374
|
+
const semantic = inferSemanticLabel(row);
|
|
8375
|
+
await db.execute({
|
|
8376
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
8377
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
8378
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
8379
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
8380
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
8381
|
+
args: [
|
|
8382
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
8383
|
+
row.id,
|
|
8384
|
+
eventId,
|
|
8385
|
+
semantic.labeler,
|
|
8386
|
+
semantic.schemaVersion,
|
|
8387
|
+
semantic.confidence,
|
|
8388
|
+
JSON.stringify(semantic),
|
|
8389
|
+
now,
|
|
8390
|
+
now
|
|
8391
|
+
]
|
|
8392
|
+
});
|
|
8393
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
8394
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
8395
|
+
await db.execute({
|
|
8396
|
+
sql: `INSERT INTO agent_goals
|
|
8397
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
8398
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
8399
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
8400
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
8401
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
8402
|
+
});
|
|
8403
|
+
await db.execute({
|
|
8404
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
8405
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
8406
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
8407
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
8408
|
+
});
|
|
8409
|
+
await db.execute({
|
|
8410
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
8411
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
8412
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
8413
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
8414
|
+
});
|
|
8415
|
+
}
|
|
8416
|
+
}
|
|
8417
|
+
async function insertOntologyForBatch(rows, client) {
|
|
8418
|
+
const db = await resolveClient(client);
|
|
8419
|
+
let count = 0;
|
|
8420
|
+
for (const row of rows) {
|
|
8421
|
+
try {
|
|
8422
|
+
await insertOntologyForMemory(row, db);
|
|
8423
|
+
count++;
|
|
8424
|
+
} catch {
|
|
8425
|
+
}
|
|
8426
|
+
}
|
|
8427
|
+
return count;
|
|
8428
|
+
}
|
|
8429
|
+
var init_agentic_ontology = __esm({
|
|
8430
|
+
"src/lib/agentic-ontology.ts"() {
|
|
8431
|
+
"use strict";
|
|
8432
|
+
}
|
|
8433
|
+
});
|
|
8434
|
+
|
|
7946
8435
|
// src/lib/store.ts
|
|
7947
8436
|
var store_exports = {};
|
|
7948
8437
|
__export(store_exports, {
|
|
@@ -8286,6 +8775,11 @@ async function flushBatch() {
|
|
|
8286
8775
|
await insertMemoryCardsForBatch2(batch);
|
|
8287
8776
|
} catch {
|
|
8288
8777
|
}
|
|
8778
|
+
try {
|
|
8779
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
8780
|
+
await insertOntologyForBatch2(batch);
|
|
8781
|
+
} catch {
|
|
8782
|
+
}
|
|
8289
8783
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
8290
8784
|
_pendingRecords.splice(0, batch.length);
|
|
8291
8785
|
try {
|