@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/hooks/stop.js
CHANGED
|
@@ -168,6 +168,10 @@ async function loadConfig() {
|
|
|
168
168
|
if (config.dbPath.startsWith("~")) {
|
|
169
169
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
170
170
|
}
|
|
171
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
172
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
173
|
+
config.dbPath = envDbPath;
|
|
174
|
+
}
|
|
171
175
|
return config;
|
|
172
176
|
} catch {
|
|
173
177
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
@@ -188,7 +192,15 @@ function loadConfigSync() {
|
|
|
188
192
|
normalizeSessionLifecycle(migratedCfg);
|
|
189
193
|
normalizeAutoUpdate(migratedCfg);
|
|
190
194
|
normalizeOrchestration(migratedCfg);
|
|
191
|
-
|
|
195
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
196
|
+
if (config.dbPath.startsWith("~")) {
|
|
197
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
198
|
+
}
|
|
199
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
200
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
201
|
+
config.dbPath = envDbPath;
|
|
202
|
+
}
|
|
203
|
+
return config;
|
|
192
204
|
} catch {
|
|
193
205
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
194
206
|
}
|
|
@@ -2068,6 +2080,9 @@ function getClient() {
|
|
|
2068
2080
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
2069
2081
|
return _daemonClient;
|
|
2070
2082
|
}
|
|
2083
|
+
if (!_resilientClient) {
|
|
2084
|
+
return _adapterClient;
|
|
2085
|
+
}
|
|
2071
2086
|
return _resilientClient;
|
|
2072
2087
|
}
|
|
2073
2088
|
async function initDaemonClient() {
|
|
@@ -3100,6 +3115,127 @@ async function ensureSchema() {
|
|
|
3100
3115
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
3101
3116
|
END;
|
|
3102
3117
|
`);
|
|
3118
|
+
await client.executeMultiple(`
|
|
3119
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
3120
|
+
id TEXT PRIMARY KEY,
|
|
3121
|
+
agent_id TEXT NOT NULL,
|
|
3122
|
+
project_name TEXT,
|
|
3123
|
+
started_at TEXT NOT NULL,
|
|
3124
|
+
last_event_at TEXT NOT NULL,
|
|
3125
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3126
|
+
properties TEXT DEFAULT '{}'
|
|
3127
|
+
);
|
|
3128
|
+
|
|
3129
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
3130
|
+
ON agent_sessions(agent_id, started_at);
|
|
3131
|
+
|
|
3132
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
3133
|
+
id TEXT PRIMARY KEY,
|
|
3134
|
+
statement TEXT NOT NULL,
|
|
3135
|
+
owner_agent_id TEXT,
|
|
3136
|
+
project_name TEXT,
|
|
3137
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
3138
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
3139
|
+
success_criteria TEXT,
|
|
3140
|
+
parent_goal_id TEXT,
|
|
3141
|
+
due_at TEXT,
|
|
3142
|
+
achieved_at TEXT,
|
|
3143
|
+
supersedes_id TEXT,
|
|
3144
|
+
created_at TEXT NOT NULL,
|
|
3145
|
+
updated_at TEXT NOT NULL,
|
|
3146
|
+
source_memory_id TEXT
|
|
3147
|
+
);
|
|
3148
|
+
|
|
3149
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
3150
|
+
ON agent_goals(project_name, status, priority);
|
|
3151
|
+
|
|
3152
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
3153
|
+
id TEXT PRIMARY KEY,
|
|
3154
|
+
event_type TEXT NOT NULL,
|
|
3155
|
+
occurred_at TEXT NOT NULL,
|
|
3156
|
+
sequence_index INTEGER NOT NULL,
|
|
3157
|
+
actor_agent_id TEXT,
|
|
3158
|
+
agent_role TEXT,
|
|
3159
|
+
project_name TEXT,
|
|
3160
|
+
session_id TEXT,
|
|
3161
|
+
task_id TEXT,
|
|
3162
|
+
goal_id TEXT,
|
|
3163
|
+
parent_event_id TEXT,
|
|
3164
|
+
intention TEXT,
|
|
3165
|
+
outcome TEXT,
|
|
3166
|
+
evidence_memory_id TEXT,
|
|
3167
|
+
impact TEXT,
|
|
3168
|
+
payload TEXT DEFAULT '{}',
|
|
3169
|
+
created_at TEXT NOT NULL
|
|
3170
|
+
);
|
|
3171
|
+
|
|
3172
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
3173
|
+
ON agent_events(occurred_at, sequence_index);
|
|
3174
|
+
|
|
3175
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
3176
|
+
ON agent_events(session_id, sequence_index);
|
|
3177
|
+
|
|
3178
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
3179
|
+
ON agent_events(goal_id, occurred_at);
|
|
3180
|
+
|
|
3181
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
3182
|
+
ON agent_events(evidence_memory_id);
|
|
3183
|
+
|
|
3184
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
3185
|
+
id TEXT PRIMARY KEY,
|
|
3186
|
+
goal_id TEXT NOT NULL,
|
|
3187
|
+
link_type TEXT NOT NULL,
|
|
3188
|
+
target_id TEXT NOT NULL,
|
|
3189
|
+
target_type TEXT NOT NULL,
|
|
3190
|
+
created_at TEXT NOT NULL
|
|
3191
|
+
);
|
|
3192
|
+
|
|
3193
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
3194
|
+
ON agent_goal_links(goal_id, target_type);
|
|
3195
|
+
|
|
3196
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
3197
|
+
id TEXT PRIMARY KEY,
|
|
3198
|
+
source_memory_id TEXT NOT NULL,
|
|
3199
|
+
event_id TEXT,
|
|
3200
|
+
labeler TEXT NOT NULL,
|
|
3201
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
3202
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3203
|
+
labels TEXT NOT NULL,
|
|
3204
|
+
created_at TEXT NOT NULL,
|
|
3205
|
+
updated_at TEXT NOT NULL
|
|
3206
|
+
);
|
|
3207
|
+
|
|
3208
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
3209
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
3210
|
+
|
|
3211
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
3212
|
+
ON agent_semantic_labels(event_id);
|
|
3213
|
+
|
|
3214
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
3215
|
+
id TEXT PRIMARY KEY,
|
|
3216
|
+
project_name TEXT,
|
|
3217
|
+
session_id TEXT,
|
|
3218
|
+
window_start_at TEXT NOT NULL,
|
|
3219
|
+
window_end_at TEXT NOT NULL,
|
|
3220
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3221
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
3222
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
3223
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
3224
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
3225
|
+
summary TEXT NOT NULL,
|
|
3226
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
3227
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
3228
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
3229
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3230
|
+
created_at TEXT NOT NULL
|
|
3231
|
+
);
|
|
3232
|
+
|
|
3233
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
3234
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
3235
|
+
|
|
3236
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
3237
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
3238
|
+
`);
|
|
3103
3239
|
try {
|
|
3104
3240
|
await client.execute({
|
|
3105
3241
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -3392,7 +3528,7 @@ var init_task_scope = __esm({
|
|
|
3392
3528
|
|
|
3393
3529
|
// src/lib/keychain.ts
|
|
3394
3530
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3395
|
-
import { existsSync as existsSync12 } from "fs";
|
|
3531
|
+
import { existsSync as existsSync12, statSync as statSync2 } from "fs";
|
|
3396
3532
|
import { execSync as execSync5 } from "child_process";
|
|
3397
3533
|
import path14 from "path";
|
|
3398
3534
|
import os10 from "os";
|
|
@@ -3402,29 +3538,65 @@ function getKeyDir() {
|
|
|
3402
3538
|
function getKeyPath() {
|
|
3403
3539
|
return path14.join(getKeyDir(), "master.key");
|
|
3404
3540
|
}
|
|
3405
|
-
function
|
|
3541
|
+
function nativeKeychainAllowed() {
|
|
3542
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
3543
|
+
}
|
|
3544
|
+
function linuxSecretAvailable() {
|
|
3545
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3546
|
+
if (process.platform !== "linux") return false;
|
|
3547
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
3548
|
+
try {
|
|
3549
|
+
execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
3550
|
+
} catch {
|
|
3551
|
+
linuxSecretAvailability = false;
|
|
3552
|
+
return false;
|
|
3553
|
+
}
|
|
3554
|
+
try {
|
|
3555
|
+
execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
3556
|
+
linuxSecretAvailability = true;
|
|
3557
|
+
} catch {
|
|
3558
|
+
linuxSecretAvailability = false;
|
|
3559
|
+
}
|
|
3560
|
+
return linuxSecretAvailability;
|
|
3561
|
+
}
|
|
3562
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3563
|
+
if (process.platform !== "linux") return false;
|
|
3564
|
+
try {
|
|
3565
|
+
const uid = typeof os10.userInfo().uid === "number" ? os10.userInfo().uid : -1;
|
|
3566
|
+
const st = statSync2(keyPath);
|
|
3567
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3568
|
+
if (uid === 0) return true;
|
|
3569
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3570
|
+
return Boolean(exeOsDir && path14.resolve(keyPath).startsWith(path14.resolve(exeOsDir) + path14.sep));
|
|
3571
|
+
} catch {
|
|
3572
|
+
return false;
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
function macKeychainGet(service = SERVICE) {
|
|
3576
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3406
3577
|
if (process.platform !== "darwin") return null;
|
|
3407
3578
|
try {
|
|
3408
3579
|
return execSync5(
|
|
3409
|
-
`security find-generic-password -s "${
|
|
3580
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
3410
3581
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3411
3582
|
).trim();
|
|
3412
3583
|
} catch {
|
|
3413
3584
|
return null;
|
|
3414
3585
|
}
|
|
3415
3586
|
}
|
|
3416
|
-
function macKeychainSet(value) {
|
|
3587
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
3588
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3417
3589
|
if (process.platform !== "darwin") return false;
|
|
3418
3590
|
try {
|
|
3419
3591
|
try {
|
|
3420
3592
|
execSync5(
|
|
3421
|
-
`security delete-generic-password -s "${
|
|
3593
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3422
3594
|
{ timeout: 5e3 }
|
|
3423
3595
|
);
|
|
3424
3596
|
} catch {
|
|
3425
3597
|
}
|
|
3426
3598
|
execSync5(
|
|
3427
|
-
`security add-generic-password -s "${
|
|
3599
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
3428
3600
|
{ timeout: 5e3 }
|
|
3429
3601
|
);
|
|
3430
3602
|
return true;
|
|
@@ -3432,22 +3604,48 @@ function macKeychainSet(value) {
|
|
|
3432
3604
|
return false;
|
|
3433
3605
|
}
|
|
3434
3606
|
}
|
|
3435
|
-
function
|
|
3436
|
-
if (
|
|
3607
|
+
function macKeychainDelete(service = SERVICE) {
|
|
3608
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3609
|
+
if (process.platform !== "darwin") return false;
|
|
3610
|
+
try {
|
|
3611
|
+
execSync5(
|
|
3612
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3613
|
+
{ timeout: 5e3 }
|
|
3614
|
+
);
|
|
3615
|
+
return true;
|
|
3616
|
+
} catch {
|
|
3617
|
+
return false;
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
function linuxSecretGet(service = SERVICE) {
|
|
3621
|
+
if (!linuxSecretAvailable()) return null;
|
|
3437
3622
|
try {
|
|
3438
3623
|
return execSync5(
|
|
3439
|
-
`secret-tool lookup service "${
|
|
3624
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3440
3625
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3441
3626
|
).trim();
|
|
3442
3627
|
} catch {
|
|
3443
3628
|
return null;
|
|
3444
3629
|
}
|
|
3445
3630
|
}
|
|
3446
|
-
function linuxSecretSet(value) {
|
|
3631
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
3632
|
+
if (!linuxSecretAvailable()) return false;
|
|
3633
|
+
try {
|
|
3634
|
+
execSync5(
|
|
3635
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3636
|
+
{ timeout: 5e3 }
|
|
3637
|
+
);
|
|
3638
|
+
return true;
|
|
3639
|
+
} catch {
|
|
3640
|
+
return false;
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
3644
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3447
3645
|
if (process.platform !== "linux") return false;
|
|
3448
3646
|
try {
|
|
3449
3647
|
execSync5(
|
|
3450
|
-
`
|
|
3648
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3451
3649
|
{ timeout: 5e3 }
|
|
3452
3650
|
);
|
|
3453
3651
|
return true;
|
|
@@ -3456,6 +3654,7 @@ function linuxSecretSet(value) {
|
|
|
3456
3654
|
}
|
|
3457
3655
|
}
|
|
3458
3656
|
async function tryKeytar() {
|
|
3657
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3459
3658
|
try {
|
|
3460
3659
|
return await import("keytar");
|
|
3461
3660
|
} catch {
|
|
@@ -3529,7 +3728,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
3529
3728
|
return "plaintext";
|
|
3530
3729
|
}
|
|
3531
3730
|
async function getMasterKey() {
|
|
3532
|
-
|
|
3731
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
3732
|
+
if (!nativeValue) {
|
|
3733
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
3734
|
+
if (legacyValue) {
|
|
3735
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
3736
|
+
if (migrated) {
|
|
3737
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
3738
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
3739
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
3740
|
+
}
|
|
3741
|
+
nativeValue = legacyValue;
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3533
3744
|
if (nativeValue) {
|
|
3534
3745
|
return Buffer.from(nativeValue, "base64");
|
|
3535
3746
|
}
|
|
@@ -3537,12 +3748,17 @@ async function getMasterKey() {
|
|
|
3537
3748
|
if (keytar) {
|
|
3538
3749
|
try {
|
|
3539
3750
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
3540
|
-
|
|
3541
|
-
|
|
3751
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
3752
|
+
if (legacyKeytarValue) {
|
|
3753
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
3542
3754
|
if (migrated) {
|
|
3543
3755
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
3756
|
+
try {
|
|
3757
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
3758
|
+
} catch {
|
|
3759
|
+
}
|
|
3544
3760
|
}
|
|
3545
|
-
return Buffer.from(
|
|
3761
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
3546
3762
|
}
|
|
3547
3763
|
} catch {
|
|
3548
3764
|
}
|
|
@@ -3567,7 +3783,7 @@ async function getMasterKey() {
|
|
|
3567
3783
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
3568
3784
|
if (!decrypted) {
|
|
3569
3785
|
process.stderr.write(
|
|
3570
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
3786
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
3571
3787
|
);
|
|
3572
3788
|
return null;
|
|
3573
3789
|
}
|
|
@@ -3576,6 +3792,9 @@ async function getMasterKey() {
|
|
|
3576
3792
|
b64Value = content;
|
|
3577
3793
|
}
|
|
3578
3794
|
const key = Buffer.from(b64Value, "base64");
|
|
3795
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
3796
|
+
return key;
|
|
3797
|
+
}
|
|
3579
3798
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
3580
3799
|
if (migrated) {
|
|
3581
3800
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -3603,12 +3822,14 @@ async function getMasterKey() {
|
|
|
3603
3822
|
return null;
|
|
3604
3823
|
}
|
|
3605
3824
|
}
|
|
3606
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
3825
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
3607
3826
|
var init_keychain = __esm({
|
|
3608
3827
|
"src/lib/keychain.ts"() {
|
|
3609
3828
|
"use strict";
|
|
3610
|
-
SERVICE = "exe-
|
|
3829
|
+
SERVICE = "exe-os";
|
|
3830
|
+
LEGACY_SERVICE = "exe-mem";
|
|
3611
3831
|
ACCOUNT = "master-key";
|
|
3832
|
+
linuxSecretAvailability = null;
|
|
3612
3833
|
ENCRYPTED_PREFIX = "enc:";
|
|
3613
3834
|
}
|
|
3614
3835
|
});
|
|
@@ -3878,7 +4099,7 @@ __export(shard_manager_exports, {
|
|
|
3878
4099
|
shardExists: () => shardExists
|
|
3879
4100
|
});
|
|
3880
4101
|
import path15 from "path";
|
|
3881
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync7, readdirSync as readdirSync3, renameSync as renameSync4, statSync as
|
|
4102
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync7, readdirSync as readdirSync3, renameSync as renameSync4, statSync as statSync3 } from "fs";
|
|
3882
4103
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3883
4104
|
function initShardManager(encryptionKey) {
|
|
3884
4105
|
_encryptionKey = encryptionKey;
|
|
@@ -3942,7 +4163,7 @@ async function auditShardHealth(options = {}) {
|
|
|
3942
4163
|
const shards = [];
|
|
3943
4164
|
for (const name of names) {
|
|
3944
4165
|
const dbPath = path15.join(SHARDS_DIR, `${name}.db`);
|
|
3945
|
-
const stat =
|
|
4166
|
+
const stat = statSync3(dbPath);
|
|
3946
4167
|
const item = {
|
|
3947
4168
|
name,
|
|
3948
4169
|
path: dbPath,
|
|
@@ -4195,7 +4416,7 @@ async function getReadyShardClient(projectName) {
|
|
|
4195
4416
|
_shardLastAccess.delete(safeName);
|
|
4196
4417
|
const dbPath = path15.join(SHARDS_DIR, `${safeName}.db`);
|
|
4197
4418
|
if (existsSync13(dbPath)) {
|
|
4198
|
-
const stat =
|
|
4419
|
+
const stat = statSync3(dbPath);
|
|
4199
4420
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
4200
4421
|
const archivedPath = path15.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
4201
4422
|
renameSync4(dbPath, archivedPath);
|
|
@@ -4702,6 +4923,274 @@ var init_memory_cards = __esm({
|
|
|
4702
4923
|
}
|
|
4703
4924
|
});
|
|
4704
4925
|
|
|
4926
|
+
// src/lib/agentic-ontology.ts
|
|
4927
|
+
var agentic_ontology_exports = {};
|
|
4928
|
+
__export(agentic_ontology_exports, {
|
|
4929
|
+
clean: () => clean,
|
|
4930
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
4931
|
+
inferIntention: () => inferIntention,
|
|
4932
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
4933
|
+
inferOutcome: () => inferOutcome,
|
|
4934
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
4935
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
4936
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
4937
|
+
ontologyPayload: () => ontologyPayload,
|
|
4938
|
+
stableId: () => stableId2
|
|
4939
|
+
});
|
|
4940
|
+
import { createHash as createHash3 } from "crypto";
|
|
4941
|
+
function stableId2(...parts) {
|
|
4942
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
4943
|
+
}
|
|
4944
|
+
function clean(text, max = 240) {
|
|
4945
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
4946
|
+
}
|
|
4947
|
+
function inferOntologyEventType(row) {
|
|
4948
|
+
const lower = row.raw_text.toLowerCase();
|
|
4949
|
+
if (row.has_error) return "error";
|
|
4950
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
4951
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
4952
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
4953
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
4954
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
4955
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
4956
|
+
return "memory_observation";
|
|
4957
|
+
}
|
|
4958
|
+
function inferIntention(row) {
|
|
4959
|
+
if (row.intent) return clean(row.intent, 220);
|
|
4960
|
+
const text = clean(row.raw_text, 1e3);
|
|
4961
|
+
const patterns = [
|
|
4962
|
+
/(?: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,
|
|
4963
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
4964
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
4965
|
+
];
|
|
4966
|
+
for (const p of patterns) {
|
|
4967
|
+
const m = text.match(p);
|
|
4968
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
4969
|
+
}
|
|
4970
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
4971
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
4972
|
+
}
|
|
4973
|
+
return null;
|
|
4974
|
+
}
|
|
4975
|
+
function inferOutcome(row) {
|
|
4976
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
4977
|
+
if (row.has_error) return "error";
|
|
4978
|
+
const lower = row.raw_text.toLowerCase();
|
|
4979
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
4980
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
4981
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
4982
|
+
return null;
|
|
4983
|
+
}
|
|
4984
|
+
function extractGoalCandidates(row) {
|
|
4985
|
+
const text = clean(row.raw_text, 1600);
|
|
4986
|
+
const patterns = [
|
|
4987
|
+
/(?: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,
|
|
4988
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
4989
|
+
];
|
|
4990
|
+
const out = [];
|
|
4991
|
+
for (const pattern of patterns) {
|
|
4992
|
+
for (const m of text.matchAll(pattern)) {
|
|
4993
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
4994
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
4995
|
+
if (out.length >= 3) return out;
|
|
4996
|
+
}
|
|
4997
|
+
}
|
|
4998
|
+
return out;
|
|
4999
|
+
}
|
|
5000
|
+
function uniq(values, max = 6) {
|
|
5001
|
+
const out = [];
|
|
5002
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
5003
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
5004
|
+
if (out.length >= max) break;
|
|
5005
|
+
}
|
|
5006
|
+
return out;
|
|
5007
|
+
}
|
|
5008
|
+
function extractMatches(text, patterns, max = 5) {
|
|
5009
|
+
const out = [];
|
|
5010
|
+
for (const pattern of patterns) {
|
|
5011
|
+
for (const match of text.matchAll(pattern)) {
|
|
5012
|
+
const value = match[1] ?? match[0];
|
|
5013
|
+
if (value) out.push(value);
|
|
5014
|
+
if (out.length >= max) return uniq(out, max);
|
|
5015
|
+
}
|
|
5016
|
+
}
|
|
5017
|
+
return uniq(out, max);
|
|
5018
|
+
}
|
|
5019
|
+
function inferSemanticLabel(row) {
|
|
5020
|
+
const text = clean(row.raw_text, 2400);
|
|
5021
|
+
const eventType = inferOntologyEventType(row);
|
|
5022
|
+
const intention = inferIntention(row);
|
|
5023
|
+
const outcome = inferOutcome(row);
|
|
5024
|
+
const goals = extractGoalCandidates(row);
|
|
5025
|
+
const milestones = extractMatches(text, [
|
|
5026
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
5027
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
5028
|
+
]);
|
|
5029
|
+
const problems = extractMatches(text, [
|
|
5030
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
5031
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
5032
|
+
]);
|
|
5033
|
+
const decisions = extractMatches(text, [
|
|
5034
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
5035
|
+
]);
|
|
5036
|
+
const temporalAnchors = extractMatches(text, [
|
|
5037
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
5038
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
5039
|
+
], 8);
|
|
5040
|
+
const nextActions = extractMatches(text, [
|
|
5041
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
5042
|
+
]);
|
|
5043
|
+
const actors = uniq([
|
|
5044
|
+
row.agent_id,
|
|
5045
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
5046
|
+
], 6);
|
|
5047
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
5048
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
5049
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
5050
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
5051
|
+
return {
|
|
5052
|
+
labeler: "deterministic",
|
|
5053
|
+
schemaVersion: 1,
|
|
5054
|
+
eventType,
|
|
5055
|
+
intention,
|
|
5056
|
+
outcome,
|
|
5057
|
+
impact,
|
|
5058
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
5059
|
+
goals,
|
|
5060
|
+
milestones,
|
|
5061
|
+
problems,
|
|
5062
|
+
decisions,
|
|
5063
|
+
actors,
|
|
5064
|
+
temporalAnchors,
|
|
5065
|
+
successSignals,
|
|
5066
|
+
failureSignals,
|
|
5067
|
+
nextActions,
|
|
5068
|
+
summary: clean(text, 280)
|
|
5069
|
+
};
|
|
5070
|
+
}
|
|
5071
|
+
function ontologyPayload(row) {
|
|
5072
|
+
const semantic = inferSemanticLabel(row);
|
|
5073
|
+
return {
|
|
5074
|
+
tool_name: row.tool_name,
|
|
5075
|
+
memory_version: row.version ?? null,
|
|
5076
|
+
domain: row.domain ?? null,
|
|
5077
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
5078
|
+
semantic
|
|
5079
|
+
};
|
|
5080
|
+
}
|
|
5081
|
+
function safeJson(value) {
|
|
5082
|
+
try {
|
|
5083
|
+
return JSON.parse(value);
|
|
5084
|
+
} catch {
|
|
5085
|
+
return value.slice(0, 1e3);
|
|
5086
|
+
}
|
|
5087
|
+
}
|
|
5088
|
+
async function resolveClient(client) {
|
|
5089
|
+
if (client) return client;
|
|
5090
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
5091
|
+
return getClient2();
|
|
5092
|
+
}
|
|
5093
|
+
async function insertOntologyForMemory(row, client) {
|
|
5094
|
+
const db = await resolveClient(client);
|
|
5095
|
+
const occurredAt = row.timestamp;
|
|
5096
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
5097
|
+
const eventType = inferOntologyEventType(row);
|
|
5098
|
+
const intention = inferIntention(row);
|
|
5099
|
+
const outcome = inferOutcome(row);
|
|
5100
|
+
const eventId = stableId2("event", row.id);
|
|
5101
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5102
|
+
await db.execute({
|
|
5103
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
5104
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
5105
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
5106
|
+
event_count = event_count + 1`,
|
|
5107
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
5108
|
+
});
|
|
5109
|
+
await db.execute({
|
|
5110
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
5111
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
5112
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
5113
|
+
impact, payload, created_at)
|
|
5114
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
5115
|
+
args: [
|
|
5116
|
+
eventId,
|
|
5117
|
+
eventType,
|
|
5118
|
+
occurredAt,
|
|
5119
|
+
sequence,
|
|
5120
|
+
row.agent_id,
|
|
5121
|
+
row.agent_role,
|
|
5122
|
+
row.project_name,
|
|
5123
|
+
row.session_id,
|
|
5124
|
+
row.task_id ?? null,
|
|
5125
|
+
intention,
|
|
5126
|
+
outcome,
|
|
5127
|
+
row.id,
|
|
5128
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
5129
|
+
JSON.stringify(ontologyPayload(row)),
|
|
5130
|
+
now
|
|
5131
|
+
]
|
|
5132
|
+
});
|
|
5133
|
+
const semantic = inferSemanticLabel(row);
|
|
5134
|
+
await db.execute({
|
|
5135
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
5136
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
5137
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
5138
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
5139
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
5140
|
+
args: [
|
|
5141
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
5142
|
+
row.id,
|
|
5143
|
+
eventId,
|
|
5144
|
+
semantic.labeler,
|
|
5145
|
+
semantic.schemaVersion,
|
|
5146
|
+
semantic.confidence,
|
|
5147
|
+
JSON.stringify(semantic),
|
|
5148
|
+
now,
|
|
5149
|
+
now
|
|
5150
|
+
]
|
|
5151
|
+
});
|
|
5152
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
5153
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
5154
|
+
await db.execute({
|
|
5155
|
+
sql: `INSERT INTO agent_goals
|
|
5156
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
5157
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
5158
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
5159
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
5160
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
5161
|
+
});
|
|
5162
|
+
await db.execute({
|
|
5163
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
5164
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
5165
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
5166
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
5167
|
+
});
|
|
5168
|
+
await db.execute({
|
|
5169
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
5170
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
5171
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
5172
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
5173
|
+
});
|
|
5174
|
+
}
|
|
5175
|
+
}
|
|
5176
|
+
async function insertOntologyForBatch(rows, client) {
|
|
5177
|
+
const db = await resolveClient(client);
|
|
5178
|
+
let count = 0;
|
|
5179
|
+
for (const row of rows) {
|
|
5180
|
+
try {
|
|
5181
|
+
await insertOntologyForMemory(row, db);
|
|
5182
|
+
count++;
|
|
5183
|
+
} catch {
|
|
5184
|
+
}
|
|
5185
|
+
}
|
|
5186
|
+
return count;
|
|
5187
|
+
}
|
|
5188
|
+
var init_agentic_ontology = __esm({
|
|
5189
|
+
"src/lib/agentic-ontology.ts"() {
|
|
5190
|
+
"use strict";
|
|
5191
|
+
}
|
|
5192
|
+
});
|
|
5193
|
+
|
|
4705
5194
|
// src/lib/store.ts
|
|
4706
5195
|
var store_exports = {};
|
|
4707
5196
|
__export(store_exports, {
|
|
@@ -5045,6 +5534,11 @@ async function flushBatch() {
|
|
|
5045
5534
|
await insertMemoryCardsForBatch2(batch);
|
|
5046
5535
|
} catch {
|
|
5047
5536
|
}
|
|
5537
|
+
try {
|
|
5538
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
5539
|
+
await insertOntologyForBatch2(batch);
|
|
5540
|
+
} catch {
|
|
5541
|
+
}
|
|
5048
5542
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
5049
5543
|
_pendingRecords.splice(0, batch.length);
|
|
5050
5544
|
try {
|
|
@@ -5393,7 +5887,7 @@ var init_fast_db_init = __esm({
|
|
|
5393
5887
|
});
|
|
5394
5888
|
|
|
5395
5889
|
// src/lib/memory-queue.ts
|
|
5396
|
-
import { appendFileSync as appendFileSync2, readFileSync as readFileSync11, renameSync as renameSync5, unlinkSync as unlinkSync4, existsSync as existsSync14, statSync as
|
|
5890
|
+
import { appendFileSync as appendFileSync2, readFileSync as readFileSync11, renameSync as renameSync5, unlinkSync as unlinkSync4, existsSync as existsSync14, statSync as statSync4 } from "fs";
|
|
5397
5891
|
import path16 from "path";
|
|
5398
5892
|
function enqueueMemory(entry) {
|
|
5399
5893
|
appendFileSync2(QUEUE_PATH2, JSON.stringify(entry) + "\n");
|