@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
|
@@ -238,6 +238,10 @@ async function loadConfig() {
|
|
|
238
238
|
if (config.dbPath.startsWith("~")) {
|
|
239
239
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
240
240
|
}
|
|
241
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
242
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
243
|
+
config.dbPath = envDbPath;
|
|
244
|
+
}
|
|
241
245
|
return config;
|
|
242
246
|
} catch {
|
|
243
247
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
@@ -258,7 +262,15 @@ function loadConfigSync() {
|
|
|
258
262
|
normalizeSessionLifecycle(migratedCfg);
|
|
259
263
|
normalizeAutoUpdate(migratedCfg);
|
|
260
264
|
normalizeOrchestration(migratedCfg);
|
|
261
|
-
|
|
265
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
266
|
+
if (config.dbPath.startsWith("~")) {
|
|
267
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
268
|
+
}
|
|
269
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
270
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
271
|
+
config.dbPath = envDbPath;
|
|
272
|
+
}
|
|
273
|
+
return config;
|
|
262
274
|
} catch {
|
|
263
275
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
264
276
|
}
|
|
@@ -2146,6 +2158,9 @@ function getClient() {
|
|
|
2146
2158
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
2147
2159
|
return _daemonClient;
|
|
2148
2160
|
}
|
|
2161
|
+
if (!_resilientClient) {
|
|
2162
|
+
return _adapterClient;
|
|
2163
|
+
}
|
|
2149
2164
|
return _resilientClient;
|
|
2150
2165
|
}
|
|
2151
2166
|
async function initDaemonClient() {
|
|
@@ -3178,6 +3193,127 @@ async function ensureSchema() {
|
|
|
3178
3193
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
3179
3194
|
END;
|
|
3180
3195
|
`);
|
|
3196
|
+
await client.executeMultiple(`
|
|
3197
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
3198
|
+
id TEXT PRIMARY KEY,
|
|
3199
|
+
agent_id TEXT NOT NULL,
|
|
3200
|
+
project_name TEXT,
|
|
3201
|
+
started_at TEXT NOT NULL,
|
|
3202
|
+
last_event_at TEXT NOT NULL,
|
|
3203
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3204
|
+
properties TEXT DEFAULT '{}'
|
|
3205
|
+
);
|
|
3206
|
+
|
|
3207
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
3208
|
+
ON agent_sessions(agent_id, started_at);
|
|
3209
|
+
|
|
3210
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
3211
|
+
id TEXT PRIMARY KEY,
|
|
3212
|
+
statement TEXT NOT NULL,
|
|
3213
|
+
owner_agent_id TEXT,
|
|
3214
|
+
project_name TEXT,
|
|
3215
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
3216
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
3217
|
+
success_criteria TEXT,
|
|
3218
|
+
parent_goal_id TEXT,
|
|
3219
|
+
due_at TEXT,
|
|
3220
|
+
achieved_at TEXT,
|
|
3221
|
+
supersedes_id TEXT,
|
|
3222
|
+
created_at TEXT NOT NULL,
|
|
3223
|
+
updated_at TEXT NOT NULL,
|
|
3224
|
+
source_memory_id TEXT
|
|
3225
|
+
);
|
|
3226
|
+
|
|
3227
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
3228
|
+
ON agent_goals(project_name, status, priority);
|
|
3229
|
+
|
|
3230
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
3231
|
+
id TEXT PRIMARY KEY,
|
|
3232
|
+
event_type TEXT NOT NULL,
|
|
3233
|
+
occurred_at TEXT NOT NULL,
|
|
3234
|
+
sequence_index INTEGER NOT NULL,
|
|
3235
|
+
actor_agent_id TEXT,
|
|
3236
|
+
agent_role TEXT,
|
|
3237
|
+
project_name TEXT,
|
|
3238
|
+
session_id TEXT,
|
|
3239
|
+
task_id TEXT,
|
|
3240
|
+
goal_id TEXT,
|
|
3241
|
+
parent_event_id TEXT,
|
|
3242
|
+
intention TEXT,
|
|
3243
|
+
outcome TEXT,
|
|
3244
|
+
evidence_memory_id TEXT,
|
|
3245
|
+
impact TEXT,
|
|
3246
|
+
payload TEXT DEFAULT '{}',
|
|
3247
|
+
created_at TEXT NOT NULL
|
|
3248
|
+
);
|
|
3249
|
+
|
|
3250
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
3251
|
+
ON agent_events(occurred_at, sequence_index);
|
|
3252
|
+
|
|
3253
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
3254
|
+
ON agent_events(session_id, sequence_index);
|
|
3255
|
+
|
|
3256
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
3257
|
+
ON agent_events(goal_id, occurred_at);
|
|
3258
|
+
|
|
3259
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
3260
|
+
ON agent_events(evidence_memory_id);
|
|
3261
|
+
|
|
3262
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
3263
|
+
id TEXT PRIMARY KEY,
|
|
3264
|
+
goal_id TEXT NOT NULL,
|
|
3265
|
+
link_type TEXT NOT NULL,
|
|
3266
|
+
target_id TEXT NOT NULL,
|
|
3267
|
+
target_type TEXT NOT NULL,
|
|
3268
|
+
created_at TEXT NOT NULL
|
|
3269
|
+
);
|
|
3270
|
+
|
|
3271
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
3272
|
+
ON agent_goal_links(goal_id, target_type);
|
|
3273
|
+
|
|
3274
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
3275
|
+
id TEXT PRIMARY KEY,
|
|
3276
|
+
source_memory_id TEXT NOT NULL,
|
|
3277
|
+
event_id TEXT,
|
|
3278
|
+
labeler TEXT NOT NULL,
|
|
3279
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
3280
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3281
|
+
labels TEXT NOT NULL,
|
|
3282
|
+
created_at TEXT NOT NULL,
|
|
3283
|
+
updated_at TEXT NOT NULL
|
|
3284
|
+
);
|
|
3285
|
+
|
|
3286
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
3287
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
3288
|
+
|
|
3289
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
3290
|
+
ON agent_semantic_labels(event_id);
|
|
3291
|
+
|
|
3292
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
3293
|
+
id TEXT PRIMARY KEY,
|
|
3294
|
+
project_name TEXT,
|
|
3295
|
+
session_id TEXT,
|
|
3296
|
+
window_start_at TEXT NOT NULL,
|
|
3297
|
+
window_end_at TEXT NOT NULL,
|
|
3298
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
3299
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
3300
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
3301
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
3302
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
3303
|
+
summary TEXT NOT NULL,
|
|
3304
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
3305
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
3306
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
3307
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3308
|
+
created_at TEXT NOT NULL
|
|
3309
|
+
);
|
|
3310
|
+
|
|
3311
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
3312
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
3313
|
+
|
|
3314
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
3315
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
3316
|
+
`);
|
|
3181
3317
|
try {
|
|
3182
3318
|
await client.execute({
|
|
3183
3319
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -3327,7 +3463,7 @@ var init_database = __esm({
|
|
|
3327
3463
|
|
|
3328
3464
|
// src/lib/keychain.ts
|
|
3329
3465
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3330
|
-
import { existsSync as existsSync7 } from "fs";
|
|
3466
|
+
import { existsSync as existsSync7, statSync as statSync2 } from "fs";
|
|
3331
3467
|
import { execSync as execSync2 } from "child_process";
|
|
3332
3468
|
import path7 from "path";
|
|
3333
3469
|
import os5 from "os";
|
|
@@ -3337,29 +3473,78 @@ function getKeyDir() {
|
|
|
3337
3473
|
function getKeyPath() {
|
|
3338
3474
|
return path7.join(getKeyDir(), "master.key");
|
|
3339
3475
|
}
|
|
3340
|
-
function
|
|
3476
|
+
function nativeKeychainAllowed() {
|
|
3477
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
3478
|
+
}
|
|
3479
|
+
function linuxSecretAvailable() {
|
|
3480
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3481
|
+
if (process.platform !== "linux") return false;
|
|
3482
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
3483
|
+
try {
|
|
3484
|
+
execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
3485
|
+
} catch {
|
|
3486
|
+
linuxSecretAvailability = false;
|
|
3487
|
+
return false;
|
|
3488
|
+
}
|
|
3489
|
+
try {
|
|
3490
|
+
execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
3491
|
+
linuxSecretAvailability = true;
|
|
3492
|
+
} catch {
|
|
3493
|
+
linuxSecretAvailability = false;
|
|
3494
|
+
}
|
|
3495
|
+
return linuxSecretAvailability;
|
|
3496
|
+
}
|
|
3497
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3498
|
+
if (process.platform !== "linux") return false;
|
|
3499
|
+
try {
|
|
3500
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3501
|
+
const st = statSync2(keyPath);
|
|
3502
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3503
|
+
if (uid === 0) return true;
|
|
3504
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3505
|
+
return Boolean(exeOsDir && path7.resolve(keyPath).startsWith(path7.resolve(exeOsDir) + path7.sep));
|
|
3506
|
+
} catch {
|
|
3507
|
+
return false;
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
function macKeychainGet(service = SERVICE) {
|
|
3511
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3341
3512
|
if (process.platform !== "darwin") return null;
|
|
3342
3513
|
try {
|
|
3343
3514
|
return execSync2(
|
|
3344
|
-
`security find-generic-password -s "${
|
|
3515
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
3345
3516
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3346
3517
|
).trim();
|
|
3347
3518
|
} catch {
|
|
3348
3519
|
return null;
|
|
3349
3520
|
}
|
|
3350
3521
|
}
|
|
3351
|
-
function macKeychainSet(value) {
|
|
3522
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
3523
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3352
3524
|
if (process.platform !== "darwin") return false;
|
|
3353
3525
|
try {
|
|
3354
3526
|
try {
|
|
3355
3527
|
execSync2(
|
|
3356
|
-
`security delete-generic-password -s "${
|
|
3528
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3357
3529
|
{ timeout: 5e3 }
|
|
3358
3530
|
);
|
|
3359
3531
|
} catch {
|
|
3360
3532
|
}
|
|
3361
3533
|
execSync2(
|
|
3362
|
-
`security add-generic-password -s "${
|
|
3534
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
3535
|
+
{ timeout: 5e3 }
|
|
3536
|
+
);
|
|
3537
|
+
return true;
|
|
3538
|
+
} catch {
|
|
3539
|
+
return false;
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3542
|
+
function macKeychainDelete(service = SERVICE) {
|
|
3543
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3544
|
+
if (process.platform !== "darwin") return false;
|
|
3545
|
+
try {
|
|
3546
|
+
execSync2(
|
|
3547
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3363
3548
|
{ timeout: 5e3 }
|
|
3364
3549
|
);
|
|
3365
3550
|
return true;
|
|
@@ -3367,22 +3552,35 @@ function macKeychainSet(value) {
|
|
|
3367
3552
|
return false;
|
|
3368
3553
|
}
|
|
3369
3554
|
}
|
|
3370
|
-
function linuxSecretGet() {
|
|
3371
|
-
if (
|
|
3555
|
+
function linuxSecretGet(service = SERVICE) {
|
|
3556
|
+
if (!linuxSecretAvailable()) return null;
|
|
3372
3557
|
try {
|
|
3373
3558
|
return execSync2(
|
|
3374
|
-
`secret-tool lookup service "${
|
|
3559
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3375
3560
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3376
3561
|
).trim();
|
|
3377
3562
|
} catch {
|
|
3378
3563
|
return null;
|
|
3379
3564
|
}
|
|
3380
3565
|
}
|
|
3381
|
-
function linuxSecretSet(value) {
|
|
3566
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
3567
|
+
if (!linuxSecretAvailable()) return false;
|
|
3568
|
+
try {
|
|
3569
|
+
execSync2(
|
|
3570
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3571
|
+
{ timeout: 5e3 }
|
|
3572
|
+
);
|
|
3573
|
+
return true;
|
|
3574
|
+
} catch {
|
|
3575
|
+
return false;
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
3579
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3382
3580
|
if (process.platform !== "linux") return false;
|
|
3383
3581
|
try {
|
|
3384
3582
|
execSync2(
|
|
3385
|
-
`
|
|
3583
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3386
3584
|
{ timeout: 5e3 }
|
|
3387
3585
|
);
|
|
3388
3586
|
return true;
|
|
@@ -3391,6 +3589,7 @@ function linuxSecretSet(value) {
|
|
|
3391
3589
|
}
|
|
3392
3590
|
}
|
|
3393
3591
|
async function tryKeytar() {
|
|
3592
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3394
3593
|
try {
|
|
3395
3594
|
return await import("keytar");
|
|
3396
3595
|
} catch {
|
|
@@ -3464,7 +3663,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
3464
3663
|
return "plaintext";
|
|
3465
3664
|
}
|
|
3466
3665
|
async function getMasterKey() {
|
|
3467
|
-
|
|
3666
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
3667
|
+
if (!nativeValue) {
|
|
3668
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
3669
|
+
if (legacyValue) {
|
|
3670
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
3671
|
+
if (migrated) {
|
|
3672
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
3673
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
3674
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
3675
|
+
}
|
|
3676
|
+
nativeValue = legacyValue;
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3468
3679
|
if (nativeValue) {
|
|
3469
3680
|
return Buffer.from(nativeValue, "base64");
|
|
3470
3681
|
}
|
|
@@ -3472,12 +3683,17 @@ async function getMasterKey() {
|
|
|
3472
3683
|
if (keytar) {
|
|
3473
3684
|
try {
|
|
3474
3685
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
3475
|
-
|
|
3476
|
-
|
|
3686
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
3687
|
+
if (legacyKeytarValue) {
|
|
3688
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
3477
3689
|
if (migrated) {
|
|
3478
3690
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
3691
|
+
try {
|
|
3692
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
3693
|
+
} catch {
|
|
3694
|
+
}
|
|
3479
3695
|
}
|
|
3480
|
-
return Buffer.from(
|
|
3696
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
3481
3697
|
}
|
|
3482
3698
|
} catch {
|
|
3483
3699
|
}
|
|
@@ -3502,7 +3718,7 @@ async function getMasterKey() {
|
|
|
3502
3718
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
3503
3719
|
if (!decrypted) {
|
|
3504
3720
|
process.stderr.write(
|
|
3505
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
3721
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
3506
3722
|
);
|
|
3507
3723
|
return null;
|
|
3508
3724
|
}
|
|
@@ -3511,6 +3727,9 @@ async function getMasterKey() {
|
|
|
3511
3727
|
b64Value = content;
|
|
3512
3728
|
}
|
|
3513
3729
|
const key = Buffer.from(b64Value, "base64");
|
|
3730
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
3731
|
+
return key;
|
|
3732
|
+
}
|
|
3514
3733
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
3515
3734
|
if (migrated) {
|
|
3516
3735
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -3538,12 +3757,14 @@ async function getMasterKey() {
|
|
|
3538
3757
|
return null;
|
|
3539
3758
|
}
|
|
3540
3759
|
}
|
|
3541
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
3760
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
3542
3761
|
var init_keychain = __esm({
|
|
3543
3762
|
"src/lib/keychain.ts"() {
|
|
3544
3763
|
"use strict";
|
|
3545
|
-
SERVICE = "exe-
|
|
3764
|
+
SERVICE = "exe-os";
|
|
3765
|
+
LEGACY_SERVICE = "exe-mem";
|
|
3546
3766
|
ACCOUNT = "master-key";
|
|
3767
|
+
linuxSecretAvailability = null;
|
|
3547
3768
|
ENCRYPTED_PREFIX = "enc:";
|
|
3548
3769
|
}
|
|
3549
3770
|
});
|
|
@@ -3813,7 +4034,7 @@ __export(shard_manager_exports, {
|
|
|
3813
4034
|
shardExists: () => shardExists
|
|
3814
4035
|
});
|
|
3815
4036
|
import path8 from "path";
|
|
3816
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as
|
|
4037
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync3 } from "fs";
|
|
3817
4038
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3818
4039
|
function initShardManager(encryptionKey) {
|
|
3819
4040
|
_encryptionKey = encryptionKey;
|
|
@@ -3877,7 +4098,7 @@ async function auditShardHealth(options = {}) {
|
|
|
3877
4098
|
const shards = [];
|
|
3878
4099
|
for (const name of names) {
|
|
3879
4100
|
const dbPath = path8.join(SHARDS_DIR, `${name}.db`);
|
|
3880
|
-
const stat =
|
|
4101
|
+
const stat = statSync3(dbPath);
|
|
3881
4102
|
const item = {
|
|
3882
4103
|
name,
|
|
3883
4104
|
path: dbPath,
|
|
@@ -4130,7 +4351,7 @@ async function getReadyShardClient(projectName) {
|
|
|
4130
4351
|
_shardLastAccess.delete(safeName);
|
|
4131
4352
|
const dbPath = path8.join(SHARDS_DIR, `${safeName}.db`);
|
|
4132
4353
|
if (existsSync8(dbPath)) {
|
|
4133
|
-
const stat =
|
|
4354
|
+
const stat = statSync3(dbPath);
|
|
4134
4355
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
4135
4356
|
const archivedPath = path8.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
4136
4357
|
renameSync3(dbPath, archivedPath);
|
|
@@ -4637,6 +4858,274 @@ var init_memory_cards = __esm({
|
|
|
4637
4858
|
}
|
|
4638
4859
|
});
|
|
4639
4860
|
|
|
4861
|
+
// src/lib/agentic-ontology.ts
|
|
4862
|
+
var agentic_ontology_exports = {};
|
|
4863
|
+
__export(agentic_ontology_exports, {
|
|
4864
|
+
clean: () => clean,
|
|
4865
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
4866
|
+
inferIntention: () => inferIntention,
|
|
4867
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
4868
|
+
inferOutcome: () => inferOutcome,
|
|
4869
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
4870
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
4871
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
4872
|
+
ontologyPayload: () => ontologyPayload,
|
|
4873
|
+
stableId: () => stableId2
|
|
4874
|
+
});
|
|
4875
|
+
import { createHash as createHash3 } from "crypto";
|
|
4876
|
+
function stableId2(...parts) {
|
|
4877
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
4878
|
+
}
|
|
4879
|
+
function clean(text, max = 240) {
|
|
4880
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
4881
|
+
}
|
|
4882
|
+
function inferOntologyEventType(row) {
|
|
4883
|
+
const lower = row.raw_text.toLowerCase();
|
|
4884
|
+
if (row.has_error) return "error";
|
|
4885
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
4886
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
4887
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
4888
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
4889
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
4890
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
4891
|
+
return "memory_observation";
|
|
4892
|
+
}
|
|
4893
|
+
function inferIntention(row) {
|
|
4894
|
+
if (row.intent) return clean(row.intent, 220);
|
|
4895
|
+
const text = clean(row.raw_text, 1e3);
|
|
4896
|
+
const patterns = [
|
|
4897
|
+
/(?: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,
|
|
4898
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
4899
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
4900
|
+
];
|
|
4901
|
+
for (const p of patterns) {
|
|
4902
|
+
const m = text.match(p);
|
|
4903
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
4904
|
+
}
|
|
4905
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
4906
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
4907
|
+
}
|
|
4908
|
+
return null;
|
|
4909
|
+
}
|
|
4910
|
+
function inferOutcome(row) {
|
|
4911
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
4912
|
+
if (row.has_error) return "error";
|
|
4913
|
+
const lower = row.raw_text.toLowerCase();
|
|
4914
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
4915
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
4916
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
4917
|
+
return null;
|
|
4918
|
+
}
|
|
4919
|
+
function extractGoalCandidates(row) {
|
|
4920
|
+
const text = clean(row.raw_text, 1600);
|
|
4921
|
+
const patterns = [
|
|
4922
|
+
/(?: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,
|
|
4923
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
4924
|
+
];
|
|
4925
|
+
const out = [];
|
|
4926
|
+
for (const pattern of patterns) {
|
|
4927
|
+
for (const m of text.matchAll(pattern)) {
|
|
4928
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
4929
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
4930
|
+
if (out.length >= 3) return out;
|
|
4931
|
+
}
|
|
4932
|
+
}
|
|
4933
|
+
return out;
|
|
4934
|
+
}
|
|
4935
|
+
function uniq(values, max = 6) {
|
|
4936
|
+
const out = [];
|
|
4937
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
4938
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
4939
|
+
if (out.length >= max) break;
|
|
4940
|
+
}
|
|
4941
|
+
return out;
|
|
4942
|
+
}
|
|
4943
|
+
function extractMatches(text, patterns, max = 5) {
|
|
4944
|
+
const out = [];
|
|
4945
|
+
for (const pattern of patterns) {
|
|
4946
|
+
for (const match of text.matchAll(pattern)) {
|
|
4947
|
+
const value = match[1] ?? match[0];
|
|
4948
|
+
if (value) out.push(value);
|
|
4949
|
+
if (out.length >= max) return uniq(out, max);
|
|
4950
|
+
}
|
|
4951
|
+
}
|
|
4952
|
+
return uniq(out, max);
|
|
4953
|
+
}
|
|
4954
|
+
function inferSemanticLabel(row) {
|
|
4955
|
+
const text = clean(row.raw_text, 2400);
|
|
4956
|
+
const eventType = inferOntologyEventType(row);
|
|
4957
|
+
const intention = inferIntention(row);
|
|
4958
|
+
const outcome = inferOutcome(row);
|
|
4959
|
+
const goals = extractGoalCandidates(row);
|
|
4960
|
+
const milestones = extractMatches(text, [
|
|
4961
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
4962
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
4963
|
+
]);
|
|
4964
|
+
const problems = extractMatches(text, [
|
|
4965
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
4966
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
4967
|
+
]);
|
|
4968
|
+
const decisions = extractMatches(text, [
|
|
4969
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
4970
|
+
]);
|
|
4971
|
+
const temporalAnchors = extractMatches(text, [
|
|
4972
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
4973
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
4974
|
+
], 8);
|
|
4975
|
+
const nextActions = extractMatches(text, [
|
|
4976
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
4977
|
+
]);
|
|
4978
|
+
const actors = uniq([
|
|
4979
|
+
row.agent_id,
|
|
4980
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
4981
|
+
], 6);
|
|
4982
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
4983
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
4984
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
4985
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
4986
|
+
return {
|
|
4987
|
+
labeler: "deterministic",
|
|
4988
|
+
schemaVersion: 1,
|
|
4989
|
+
eventType,
|
|
4990
|
+
intention,
|
|
4991
|
+
outcome,
|
|
4992
|
+
impact,
|
|
4993
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
4994
|
+
goals,
|
|
4995
|
+
milestones,
|
|
4996
|
+
problems,
|
|
4997
|
+
decisions,
|
|
4998
|
+
actors,
|
|
4999
|
+
temporalAnchors,
|
|
5000
|
+
successSignals,
|
|
5001
|
+
failureSignals,
|
|
5002
|
+
nextActions,
|
|
5003
|
+
summary: clean(text, 280)
|
|
5004
|
+
};
|
|
5005
|
+
}
|
|
5006
|
+
function ontologyPayload(row) {
|
|
5007
|
+
const semantic = inferSemanticLabel(row);
|
|
5008
|
+
return {
|
|
5009
|
+
tool_name: row.tool_name,
|
|
5010
|
+
memory_version: row.version ?? null,
|
|
5011
|
+
domain: row.domain ?? null,
|
|
5012
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
5013
|
+
semantic
|
|
5014
|
+
};
|
|
5015
|
+
}
|
|
5016
|
+
function safeJson(value) {
|
|
5017
|
+
try {
|
|
5018
|
+
return JSON.parse(value);
|
|
5019
|
+
} catch {
|
|
5020
|
+
return value.slice(0, 1e3);
|
|
5021
|
+
}
|
|
5022
|
+
}
|
|
5023
|
+
async function resolveClient(client) {
|
|
5024
|
+
if (client) return client;
|
|
5025
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
5026
|
+
return getClient2();
|
|
5027
|
+
}
|
|
5028
|
+
async function insertOntologyForMemory(row, client) {
|
|
5029
|
+
const db = await resolveClient(client);
|
|
5030
|
+
const occurredAt = row.timestamp;
|
|
5031
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
5032
|
+
const eventType = inferOntologyEventType(row);
|
|
5033
|
+
const intention = inferIntention(row);
|
|
5034
|
+
const outcome = inferOutcome(row);
|
|
5035
|
+
const eventId = stableId2("event", row.id);
|
|
5036
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5037
|
+
await db.execute({
|
|
5038
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
5039
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
5040
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
5041
|
+
event_count = event_count + 1`,
|
|
5042
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
5043
|
+
});
|
|
5044
|
+
await db.execute({
|
|
5045
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
5046
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
5047
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
5048
|
+
impact, payload, created_at)
|
|
5049
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
5050
|
+
args: [
|
|
5051
|
+
eventId,
|
|
5052
|
+
eventType,
|
|
5053
|
+
occurredAt,
|
|
5054
|
+
sequence,
|
|
5055
|
+
row.agent_id,
|
|
5056
|
+
row.agent_role,
|
|
5057
|
+
row.project_name,
|
|
5058
|
+
row.session_id,
|
|
5059
|
+
row.task_id ?? null,
|
|
5060
|
+
intention,
|
|
5061
|
+
outcome,
|
|
5062
|
+
row.id,
|
|
5063
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
5064
|
+
JSON.stringify(ontologyPayload(row)),
|
|
5065
|
+
now
|
|
5066
|
+
]
|
|
5067
|
+
});
|
|
5068
|
+
const semantic = inferSemanticLabel(row);
|
|
5069
|
+
await db.execute({
|
|
5070
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
5071
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
5072
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
5073
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
5074
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
5075
|
+
args: [
|
|
5076
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
5077
|
+
row.id,
|
|
5078
|
+
eventId,
|
|
5079
|
+
semantic.labeler,
|
|
5080
|
+
semantic.schemaVersion,
|
|
5081
|
+
semantic.confidence,
|
|
5082
|
+
JSON.stringify(semantic),
|
|
5083
|
+
now,
|
|
5084
|
+
now
|
|
5085
|
+
]
|
|
5086
|
+
});
|
|
5087
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
5088
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
5089
|
+
await db.execute({
|
|
5090
|
+
sql: `INSERT INTO agent_goals
|
|
5091
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
5092
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
5093
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
5094
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
5095
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
5096
|
+
});
|
|
5097
|
+
await db.execute({
|
|
5098
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
5099
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
5100
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
5101
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
5102
|
+
});
|
|
5103
|
+
await db.execute({
|
|
5104
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
5105
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
5106
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
5107
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
5108
|
+
});
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
async function insertOntologyForBatch(rows, client) {
|
|
5112
|
+
const db = await resolveClient(client);
|
|
5113
|
+
let count = 0;
|
|
5114
|
+
for (const row of rows) {
|
|
5115
|
+
try {
|
|
5116
|
+
await insertOntologyForMemory(row, db);
|
|
5117
|
+
count++;
|
|
5118
|
+
} catch {
|
|
5119
|
+
}
|
|
5120
|
+
}
|
|
5121
|
+
return count;
|
|
5122
|
+
}
|
|
5123
|
+
var init_agentic_ontology = __esm({
|
|
5124
|
+
"src/lib/agentic-ontology.ts"() {
|
|
5125
|
+
"use strict";
|
|
5126
|
+
}
|
|
5127
|
+
});
|
|
5128
|
+
|
|
4640
5129
|
// src/lib/store.ts
|
|
4641
5130
|
var store_exports = {};
|
|
4642
5131
|
__export(store_exports, {
|
|
@@ -4980,6 +5469,11 @@ async function flushBatch() {
|
|
|
4980
5469
|
await insertMemoryCardsForBatch2(batch);
|
|
4981
5470
|
} catch {
|
|
4982
5471
|
}
|
|
5472
|
+
try {
|
|
5473
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
5474
|
+
await insertOntologyForBatch2(batch);
|
|
5475
|
+
} catch {
|
|
5476
|
+
}
|
|
4983
5477
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
4984
5478
|
_pendingRecords.splice(0, batch.length);
|
|
4985
5479
|
try {
|
|
@@ -8918,7 +9412,7 @@ init_database();
|
|
|
8918
9412
|
init_tasks();
|
|
8919
9413
|
|
|
8920
9414
|
// src/lib/bug-intake.ts
|
|
8921
|
-
import { createHash as
|
|
9415
|
+
import { createHash as createHash4, randomUUID as randomUUID4 } from "crypto";
|
|
8922
9416
|
var BUG_INTAKE_SCHEMA_VERSION = 1;
|
|
8923
9417
|
function firstMeaningfulLine(text) {
|
|
8924
9418
|
return text.split("\n").find((line) => line.trim().length > 0)?.trim().slice(0, 80) ?? "unknown error";
|
|
@@ -8930,11 +9424,11 @@ function stableFingerprint(input) {
|
|
|
8930
9424
|
firstMeaningfulLine(input.errorText ?? ""),
|
|
8931
9425
|
input.projectName ?? "unknown"
|
|
8932
9426
|
].join("|");
|
|
8933
|
-
return
|
|
9427
|
+
return createHash4("sha256").update(basis).digest("hex").slice(0, 16);
|
|
8934
9428
|
}
|
|
8935
9429
|
function hashLicense(licenseKey) {
|
|
8936
9430
|
if (!licenseKey) return void 0;
|
|
8937
|
-
return
|
|
9431
|
+
return createHash4("sha256").update(licenseKey).digest("hex").slice(0, 16);
|
|
8938
9432
|
}
|
|
8939
9433
|
function buildBugIntake(input) {
|
|
8940
9434
|
const toolName = input.toolName ?? "unknown";
|