@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
|
@@ -239,6 +239,10 @@ async function loadConfig() {
|
|
|
239
239
|
if (config.dbPath.startsWith("~")) {
|
|
240
240
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
241
241
|
}
|
|
242
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
243
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
244
|
+
config.dbPath = envDbPath;
|
|
245
|
+
}
|
|
242
246
|
return config;
|
|
243
247
|
} catch {
|
|
244
248
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
@@ -259,7 +263,15 @@ function loadConfigSync() {
|
|
|
259
263
|
normalizeSessionLifecycle(migratedCfg);
|
|
260
264
|
normalizeAutoUpdate(migratedCfg);
|
|
261
265
|
normalizeOrchestration(migratedCfg);
|
|
262
|
-
|
|
266
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
267
|
+
if (config.dbPath.startsWith("~")) {
|
|
268
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
269
|
+
}
|
|
270
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
271
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
272
|
+
config.dbPath = envDbPath;
|
|
273
|
+
}
|
|
274
|
+
return config;
|
|
263
275
|
} catch {
|
|
264
276
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
265
277
|
}
|
|
@@ -1845,6 +1857,9 @@ function getClient() {
|
|
|
1845
1857
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
1846
1858
|
return _daemonClient;
|
|
1847
1859
|
}
|
|
1860
|
+
if (!_resilientClient) {
|
|
1861
|
+
return _adapterClient;
|
|
1862
|
+
}
|
|
1848
1863
|
return _resilientClient;
|
|
1849
1864
|
}
|
|
1850
1865
|
async function initDaemonClient() {
|
|
@@ -2877,6 +2892,127 @@ async function ensureSchema() {
|
|
|
2877
2892
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
2878
2893
|
END;
|
|
2879
2894
|
`);
|
|
2895
|
+
await client.executeMultiple(`
|
|
2896
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
2897
|
+
id TEXT PRIMARY KEY,
|
|
2898
|
+
agent_id TEXT NOT NULL,
|
|
2899
|
+
project_name TEXT,
|
|
2900
|
+
started_at TEXT NOT NULL,
|
|
2901
|
+
last_event_at TEXT NOT NULL,
|
|
2902
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
2903
|
+
properties TEXT DEFAULT '{}'
|
|
2904
|
+
);
|
|
2905
|
+
|
|
2906
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
2907
|
+
ON agent_sessions(agent_id, started_at);
|
|
2908
|
+
|
|
2909
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
2910
|
+
id TEXT PRIMARY KEY,
|
|
2911
|
+
statement TEXT NOT NULL,
|
|
2912
|
+
owner_agent_id TEXT,
|
|
2913
|
+
project_name TEXT,
|
|
2914
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
2915
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
2916
|
+
success_criteria TEXT,
|
|
2917
|
+
parent_goal_id TEXT,
|
|
2918
|
+
due_at TEXT,
|
|
2919
|
+
achieved_at TEXT,
|
|
2920
|
+
supersedes_id TEXT,
|
|
2921
|
+
created_at TEXT NOT NULL,
|
|
2922
|
+
updated_at TEXT NOT NULL,
|
|
2923
|
+
source_memory_id TEXT
|
|
2924
|
+
);
|
|
2925
|
+
|
|
2926
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
2927
|
+
ON agent_goals(project_name, status, priority);
|
|
2928
|
+
|
|
2929
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
2930
|
+
id TEXT PRIMARY KEY,
|
|
2931
|
+
event_type TEXT NOT NULL,
|
|
2932
|
+
occurred_at TEXT NOT NULL,
|
|
2933
|
+
sequence_index INTEGER NOT NULL,
|
|
2934
|
+
actor_agent_id TEXT,
|
|
2935
|
+
agent_role TEXT,
|
|
2936
|
+
project_name TEXT,
|
|
2937
|
+
session_id TEXT,
|
|
2938
|
+
task_id TEXT,
|
|
2939
|
+
goal_id TEXT,
|
|
2940
|
+
parent_event_id TEXT,
|
|
2941
|
+
intention TEXT,
|
|
2942
|
+
outcome TEXT,
|
|
2943
|
+
evidence_memory_id TEXT,
|
|
2944
|
+
impact TEXT,
|
|
2945
|
+
payload TEXT DEFAULT '{}',
|
|
2946
|
+
created_at TEXT NOT NULL
|
|
2947
|
+
);
|
|
2948
|
+
|
|
2949
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
2950
|
+
ON agent_events(occurred_at, sequence_index);
|
|
2951
|
+
|
|
2952
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
2953
|
+
ON agent_events(session_id, sequence_index);
|
|
2954
|
+
|
|
2955
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
2956
|
+
ON agent_events(goal_id, occurred_at);
|
|
2957
|
+
|
|
2958
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
2959
|
+
ON agent_events(evidence_memory_id);
|
|
2960
|
+
|
|
2961
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
2962
|
+
id TEXT PRIMARY KEY,
|
|
2963
|
+
goal_id TEXT NOT NULL,
|
|
2964
|
+
link_type TEXT NOT NULL,
|
|
2965
|
+
target_id TEXT NOT NULL,
|
|
2966
|
+
target_type TEXT NOT NULL,
|
|
2967
|
+
created_at TEXT NOT NULL
|
|
2968
|
+
);
|
|
2969
|
+
|
|
2970
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
2971
|
+
ON agent_goal_links(goal_id, target_type);
|
|
2972
|
+
|
|
2973
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
2974
|
+
id TEXT PRIMARY KEY,
|
|
2975
|
+
source_memory_id TEXT NOT NULL,
|
|
2976
|
+
event_id TEXT,
|
|
2977
|
+
labeler TEXT NOT NULL,
|
|
2978
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
2979
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
2980
|
+
labels TEXT NOT NULL,
|
|
2981
|
+
created_at TEXT NOT NULL,
|
|
2982
|
+
updated_at TEXT NOT NULL
|
|
2983
|
+
);
|
|
2984
|
+
|
|
2985
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
2986
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
2987
|
+
|
|
2988
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
2989
|
+
ON agent_semantic_labels(event_id);
|
|
2990
|
+
|
|
2991
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
2992
|
+
id TEXT PRIMARY KEY,
|
|
2993
|
+
project_name TEXT,
|
|
2994
|
+
session_id TEXT,
|
|
2995
|
+
window_start_at TEXT NOT NULL,
|
|
2996
|
+
window_end_at TEXT NOT NULL,
|
|
2997
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
2998
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
2999
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
3000
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
3001
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
3002
|
+
summary TEXT NOT NULL,
|
|
3003
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
3004
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
3005
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
3006
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
3007
|
+
created_at TEXT NOT NULL
|
|
3008
|
+
);
|
|
3009
|
+
|
|
3010
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
3011
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
3012
|
+
|
|
3013
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
3014
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
3015
|
+
`);
|
|
2880
3016
|
try {
|
|
2881
3017
|
await client.execute({
|
|
2882
3018
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -3026,7 +3162,7 @@ var init_database = __esm({
|
|
|
3026
3162
|
|
|
3027
3163
|
// src/lib/keychain.ts
|
|
3028
3164
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3029
|
-
import { existsSync as existsSync6 } from "fs";
|
|
3165
|
+
import { existsSync as existsSync6, statSync as statSync2 } from "fs";
|
|
3030
3166
|
import { execSync as execSync2 } from "child_process";
|
|
3031
3167
|
import path6 from "path";
|
|
3032
3168
|
import os5 from "os";
|
|
@@ -3036,29 +3172,78 @@ function getKeyDir() {
|
|
|
3036
3172
|
function getKeyPath() {
|
|
3037
3173
|
return path6.join(getKeyDir(), "master.key");
|
|
3038
3174
|
}
|
|
3039
|
-
function
|
|
3175
|
+
function nativeKeychainAllowed() {
|
|
3176
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
3177
|
+
}
|
|
3178
|
+
function linuxSecretAvailable() {
|
|
3179
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3180
|
+
if (process.platform !== "linux") return false;
|
|
3181
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
3182
|
+
try {
|
|
3183
|
+
execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
3184
|
+
} catch {
|
|
3185
|
+
linuxSecretAvailability = false;
|
|
3186
|
+
return false;
|
|
3187
|
+
}
|
|
3188
|
+
try {
|
|
3189
|
+
execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
3190
|
+
linuxSecretAvailability = true;
|
|
3191
|
+
} catch {
|
|
3192
|
+
linuxSecretAvailability = false;
|
|
3193
|
+
}
|
|
3194
|
+
return linuxSecretAvailability;
|
|
3195
|
+
}
|
|
3196
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3197
|
+
if (process.platform !== "linux") return false;
|
|
3198
|
+
try {
|
|
3199
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3200
|
+
const st = statSync2(keyPath);
|
|
3201
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3202
|
+
if (uid === 0) return true;
|
|
3203
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3204
|
+
return Boolean(exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep));
|
|
3205
|
+
} catch {
|
|
3206
|
+
return false;
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
function macKeychainGet(service = SERVICE) {
|
|
3210
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3040
3211
|
if (process.platform !== "darwin") return null;
|
|
3041
3212
|
try {
|
|
3042
3213
|
return execSync2(
|
|
3043
|
-
`security find-generic-password -s "${
|
|
3214
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
3044
3215
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3045
3216
|
).trim();
|
|
3046
3217
|
} catch {
|
|
3047
3218
|
return null;
|
|
3048
3219
|
}
|
|
3049
3220
|
}
|
|
3050
|
-
function macKeychainSet(value) {
|
|
3221
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
3222
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3051
3223
|
if (process.platform !== "darwin") return false;
|
|
3052
3224
|
try {
|
|
3053
3225
|
try {
|
|
3054
3226
|
execSync2(
|
|
3055
|
-
`security delete-generic-password -s "${
|
|
3227
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3056
3228
|
{ timeout: 5e3 }
|
|
3057
3229
|
);
|
|
3058
3230
|
} catch {
|
|
3059
3231
|
}
|
|
3060
3232
|
execSync2(
|
|
3061
|
-
`security add-generic-password -s "${
|
|
3233
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
3234
|
+
{ timeout: 5e3 }
|
|
3235
|
+
);
|
|
3236
|
+
return true;
|
|
3237
|
+
} catch {
|
|
3238
|
+
return false;
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
function macKeychainDelete(service = SERVICE) {
|
|
3242
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3243
|
+
if (process.platform !== "darwin") return false;
|
|
3244
|
+
try {
|
|
3245
|
+
execSync2(
|
|
3246
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3062
3247
|
{ timeout: 5e3 }
|
|
3063
3248
|
);
|
|
3064
3249
|
return true;
|
|
@@ -3066,22 +3251,35 @@ function macKeychainSet(value) {
|
|
|
3066
3251
|
return false;
|
|
3067
3252
|
}
|
|
3068
3253
|
}
|
|
3069
|
-
function linuxSecretGet() {
|
|
3070
|
-
if (
|
|
3254
|
+
function linuxSecretGet(service = SERVICE) {
|
|
3255
|
+
if (!linuxSecretAvailable()) return null;
|
|
3071
3256
|
try {
|
|
3072
3257
|
return execSync2(
|
|
3073
|
-
`secret-tool lookup service "${
|
|
3258
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3074
3259
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3075
3260
|
).trim();
|
|
3076
3261
|
} catch {
|
|
3077
3262
|
return null;
|
|
3078
3263
|
}
|
|
3079
3264
|
}
|
|
3080
|
-
function linuxSecretSet(value) {
|
|
3265
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
3266
|
+
if (!linuxSecretAvailable()) return false;
|
|
3267
|
+
try {
|
|
3268
|
+
execSync2(
|
|
3269
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3270
|
+
{ timeout: 5e3 }
|
|
3271
|
+
);
|
|
3272
|
+
return true;
|
|
3273
|
+
} catch {
|
|
3274
|
+
return false;
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
3278
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3081
3279
|
if (process.platform !== "linux") return false;
|
|
3082
3280
|
try {
|
|
3083
3281
|
execSync2(
|
|
3084
|
-
`
|
|
3282
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3085
3283
|
{ timeout: 5e3 }
|
|
3086
3284
|
);
|
|
3087
3285
|
return true;
|
|
@@ -3090,6 +3288,7 @@ function linuxSecretSet(value) {
|
|
|
3090
3288
|
}
|
|
3091
3289
|
}
|
|
3092
3290
|
async function tryKeytar() {
|
|
3291
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3093
3292
|
try {
|
|
3094
3293
|
return await import("keytar");
|
|
3095
3294
|
} catch {
|
|
@@ -3163,7 +3362,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
3163
3362
|
return "plaintext";
|
|
3164
3363
|
}
|
|
3165
3364
|
async function getMasterKey() {
|
|
3166
|
-
|
|
3365
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
3366
|
+
if (!nativeValue) {
|
|
3367
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
3368
|
+
if (legacyValue) {
|
|
3369
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
3370
|
+
if (migrated) {
|
|
3371
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
3372
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
3373
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
3374
|
+
}
|
|
3375
|
+
nativeValue = legacyValue;
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3167
3378
|
if (nativeValue) {
|
|
3168
3379
|
return Buffer.from(nativeValue, "base64");
|
|
3169
3380
|
}
|
|
@@ -3171,12 +3382,17 @@ async function getMasterKey() {
|
|
|
3171
3382
|
if (keytar) {
|
|
3172
3383
|
try {
|
|
3173
3384
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
3174
|
-
|
|
3175
|
-
|
|
3385
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
3386
|
+
if (legacyKeytarValue) {
|
|
3387
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
3176
3388
|
if (migrated) {
|
|
3177
3389
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
3390
|
+
try {
|
|
3391
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
3392
|
+
} catch {
|
|
3393
|
+
}
|
|
3178
3394
|
}
|
|
3179
|
-
return Buffer.from(
|
|
3395
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
3180
3396
|
}
|
|
3181
3397
|
} catch {
|
|
3182
3398
|
}
|
|
@@ -3201,7 +3417,7 @@ async function getMasterKey() {
|
|
|
3201
3417
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
3202
3418
|
if (!decrypted) {
|
|
3203
3419
|
process.stderr.write(
|
|
3204
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
3420
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
3205
3421
|
);
|
|
3206
3422
|
return null;
|
|
3207
3423
|
}
|
|
@@ -3210,6 +3426,9 @@ async function getMasterKey() {
|
|
|
3210
3426
|
b64Value = content;
|
|
3211
3427
|
}
|
|
3212
3428
|
const key = Buffer.from(b64Value, "base64");
|
|
3429
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
3430
|
+
return key;
|
|
3431
|
+
}
|
|
3213
3432
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
3214
3433
|
if (migrated) {
|
|
3215
3434
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -3237,12 +3456,14 @@ async function getMasterKey() {
|
|
|
3237
3456
|
return null;
|
|
3238
3457
|
}
|
|
3239
3458
|
}
|
|
3240
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
3459
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
3241
3460
|
var init_keychain = __esm({
|
|
3242
3461
|
"src/lib/keychain.ts"() {
|
|
3243
3462
|
"use strict";
|
|
3244
|
-
SERVICE = "exe-
|
|
3463
|
+
SERVICE = "exe-os";
|
|
3464
|
+
LEGACY_SERVICE = "exe-mem";
|
|
3245
3465
|
ACCOUNT = "master-key";
|
|
3466
|
+
linuxSecretAvailability = null;
|
|
3246
3467
|
ENCRYPTED_PREFIX = "enc:";
|
|
3247
3468
|
}
|
|
3248
3469
|
});
|
|
@@ -3512,7 +3733,7 @@ __export(shard_manager_exports, {
|
|
|
3512
3733
|
shardExists: () => shardExists
|
|
3513
3734
|
});
|
|
3514
3735
|
import path7 from "path";
|
|
3515
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as
|
|
3736
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync3 } from "fs";
|
|
3516
3737
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3517
3738
|
function initShardManager(encryptionKey) {
|
|
3518
3739
|
_encryptionKey = encryptionKey;
|
|
@@ -3576,7 +3797,7 @@ async function auditShardHealth(options = {}) {
|
|
|
3576
3797
|
const shards = [];
|
|
3577
3798
|
for (const name of names) {
|
|
3578
3799
|
const dbPath = path7.join(SHARDS_DIR, `${name}.db`);
|
|
3579
|
-
const stat =
|
|
3800
|
+
const stat = statSync3(dbPath);
|
|
3580
3801
|
const item = {
|
|
3581
3802
|
name,
|
|
3582
3803
|
path: dbPath,
|
|
@@ -3829,7 +4050,7 @@ async function getReadyShardClient(projectName) {
|
|
|
3829
4050
|
_shardLastAccess.delete(safeName);
|
|
3830
4051
|
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3831
4052
|
if (existsSync7(dbPath)) {
|
|
3832
|
-
const stat =
|
|
4053
|
+
const stat = statSync3(dbPath);
|
|
3833
4054
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3834
4055
|
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3835
4056
|
renameSync3(dbPath, archivedPath);
|
|
@@ -4336,6 +4557,274 @@ var init_memory_cards = __esm({
|
|
|
4336
4557
|
}
|
|
4337
4558
|
});
|
|
4338
4559
|
|
|
4560
|
+
// src/lib/agentic-ontology.ts
|
|
4561
|
+
var agentic_ontology_exports = {};
|
|
4562
|
+
__export(agentic_ontology_exports, {
|
|
4563
|
+
clean: () => clean,
|
|
4564
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
4565
|
+
inferIntention: () => inferIntention,
|
|
4566
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
4567
|
+
inferOutcome: () => inferOutcome,
|
|
4568
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
4569
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
4570
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
4571
|
+
ontologyPayload: () => ontologyPayload,
|
|
4572
|
+
stableId: () => stableId2
|
|
4573
|
+
});
|
|
4574
|
+
import { createHash as createHash3 } from "crypto";
|
|
4575
|
+
function stableId2(...parts) {
|
|
4576
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
4577
|
+
}
|
|
4578
|
+
function clean(text, max = 240) {
|
|
4579
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
4580
|
+
}
|
|
4581
|
+
function inferOntologyEventType(row) {
|
|
4582
|
+
const lower = row.raw_text.toLowerCase();
|
|
4583
|
+
if (row.has_error) return "error";
|
|
4584
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
4585
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
4586
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
4587
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
4588
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
4589
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
4590
|
+
return "memory_observation";
|
|
4591
|
+
}
|
|
4592
|
+
function inferIntention(row) {
|
|
4593
|
+
if (row.intent) return clean(row.intent, 220);
|
|
4594
|
+
const text = clean(row.raw_text, 1e3);
|
|
4595
|
+
const patterns = [
|
|
4596
|
+
/(?: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,
|
|
4597
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
4598
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
4599
|
+
];
|
|
4600
|
+
for (const p of patterns) {
|
|
4601
|
+
const m = text.match(p);
|
|
4602
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
4603
|
+
}
|
|
4604
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
4605
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
4606
|
+
}
|
|
4607
|
+
return null;
|
|
4608
|
+
}
|
|
4609
|
+
function inferOutcome(row) {
|
|
4610
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
4611
|
+
if (row.has_error) return "error";
|
|
4612
|
+
const lower = row.raw_text.toLowerCase();
|
|
4613
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
4614
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
4615
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
4616
|
+
return null;
|
|
4617
|
+
}
|
|
4618
|
+
function extractGoalCandidates(row) {
|
|
4619
|
+
const text = clean(row.raw_text, 1600);
|
|
4620
|
+
const patterns = [
|
|
4621
|
+
/(?: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,
|
|
4622
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
4623
|
+
];
|
|
4624
|
+
const out = [];
|
|
4625
|
+
for (const pattern of patterns) {
|
|
4626
|
+
for (const m of text.matchAll(pattern)) {
|
|
4627
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
4628
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
4629
|
+
if (out.length >= 3) return out;
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4632
|
+
return out;
|
|
4633
|
+
}
|
|
4634
|
+
function uniq(values, max = 6) {
|
|
4635
|
+
const out = [];
|
|
4636
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
4637
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
4638
|
+
if (out.length >= max) break;
|
|
4639
|
+
}
|
|
4640
|
+
return out;
|
|
4641
|
+
}
|
|
4642
|
+
function extractMatches(text, patterns, max = 5) {
|
|
4643
|
+
const out = [];
|
|
4644
|
+
for (const pattern of patterns) {
|
|
4645
|
+
for (const match of text.matchAll(pattern)) {
|
|
4646
|
+
const value = match[1] ?? match[0];
|
|
4647
|
+
if (value) out.push(value);
|
|
4648
|
+
if (out.length >= max) return uniq(out, max);
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
return uniq(out, max);
|
|
4652
|
+
}
|
|
4653
|
+
function inferSemanticLabel(row) {
|
|
4654
|
+
const text = clean(row.raw_text, 2400);
|
|
4655
|
+
const eventType = inferOntologyEventType(row);
|
|
4656
|
+
const intention = inferIntention(row);
|
|
4657
|
+
const outcome = inferOutcome(row);
|
|
4658
|
+
const goals = extractGoalCandidates(row);
|
|
4659
|
+
const milestones = extractMatches(text, [
|
|
4660
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
4661
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
4662
|
+
]);
|
|
4663
|
+
const problems = extractMatches(text, [
|
|
4664
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
4665
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
4666
|
+
]);
|
|
4667
|
+
const decisions = extractMatches(text, [
|
|
4668
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
4669
|
+
]);
|
|
4670
|
+
const temporalAnchors = extractMatches(text, [
|
|
4671
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
4672
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
4673
|
+
], 8);
|
|
4674
|
+
const nextActions = extractMatches(text, [
|
|
4675
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
4676
|
+
]);
|
|
4677
|
+
const actors = uniq([
|
|
4678
|
+
row.agent_id,
|
|
4679
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
4680
|
+
], 6);
|
|
4681
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
4682
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
4683
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
4684
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
4685
|
+
return {
|
|
4686
|
+
labeler: "deterministic",
|
|
4687
|
+
schemaVersion: 1,
|
|
4688
|
+
eventType,
|
|
4689
|
+
intention,
|
|
4690
|
+
outcome,
|
|
4691
|
+
impact,
|
|
4692
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
4693
|
+
goals,
|
|
4694
|
+
milestones,
|
|
4695
|
+
problems,
|
|
4696
|
+
decisions,
|
|
4697
|
+
actors,
|
|
4698
|
+
temporalAnchors,
|
|
4699
|
+
successSignals,
|
|
4700
|
+
failureSignals,
|
|
4701
|
+
nextActions,
|
|
4702
|
+
summary: clean(text, 280)
|
|
4703
|
+
};
|
|
4704
|
+
}
|
|
4705
|
+
function ontologyPayload(row) {
|
|
4706
|
+
const semantic = inferSemanticLabel(row);
|
|
4707
|
+
return {
|
|
4708
|
+
tool_name: row.tool_name,
|
|
4709
|
+
memory_version: row.version ?? null,
|
|
4710
|
+
domain: row.domain ?? null,
|
|
4711
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
4712
|
+
semantic
|
|
4713
|
+
};
|
|
4714
|
+
}
|
|
4715
|
+
function safeJson(value) {
|
|
4716
|
+
try {
|
|
4717
|
+
return JSON.parse(value);
|
|
4718
|
+
} catch {
|
|
4719
|
+
return value.slice(0, 1e3);
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
async function resolveClient(client) {
|
|
4723
|
+
if (client) return client;
|
|
4724
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
4725
|
+
return getClient2();
|
|
4726
|
+
}
|
|
4727
|
+
async function insertOntologyForMemory(row, client) {
|
|
4728
|
+
const db = await resolveClient(client);
|
|
4729
|
+
const occurredAt = row.timestamp;
|
|
4730
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
4731
|
+
const eventType = inferOntologyEventType(row);
|
|
4732
|
+
const intention = inferIntention(row);
|
|
4733
|
+
const outcome = inferOutcome(row);
|
|
4734
|
+
const eventId = stableId2("event", row.id);
|
|
4735
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4736
|
+
await db.execute({
|
|
4737
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
4738
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
4739
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
4740
|
+
event_count = event_count + 1`,
|
|
4741
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
4742
|
+
});
|
|
4743
|
+
await db.execute({
|
|
4744
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
4745
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
4746
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
4747
|
+
impact, payload, created_at)
|
|
4748
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
4749
|
+
args: [
|
|
4750
|
+
eventId,
|
|
4751
|
+
eventType,
|
|
4752
|
+
occurredAt,
|
|
4753
|
+
sequence,
|
|
4754
|
+
row.agent_id,
|
|
4755
|
+
row.agent_role,
|
|
4756
|
+
row.project_name,
|
|
4757
|
+
row.session_id,
|
|
4758
|
+
row.task_id ?? null,
|
|
4759
|
+
intention,
|
|
4760
|
+
outcome,
|
|
4761
|
+
row.id,
|
|
4762
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
4763
|
+
JSON.stringify(ontologyPayload(row)),
|
|
4764
|
+
now
|
|
4765
|
+
]
|
|
4766
|
+
});
|
|
4767
|
+
const semantic = inferSemanticLabel(row);
|
|
4768
|
+
await db.execute({
|
|
4769
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
4770
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
4771
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
4772
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
4773
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
4774
|
+
args: [
|
|
4775
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
4776
|
+
row.id,
|
|
4777
|
+
eventId,
|
|
4778
|
+
semantic.labeler,
|
|
4779
|
+
semantic.schemaVersion,
|
|
4780
|
+
semantic.confidence,
|
|
4781
|
+
JSON.stringify(semantic),
|
|
4782
|
+
now,
|
|
4783
|
+
now
|
|
4784
|
+
]
|
|
4785
|
+
});
|
|
4786
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
4787
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
4788
|
+
await db.execute({
|
|
4789
|
+
sql: `INSERT INTO agent_goals
|
|
4790
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
4791
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
4792
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
4793
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
4794
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
4795
|
+
});
|
|
4796
|
+
await db.execute({
|
|
4797
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
4798
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
4799
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
4800
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
4801
|
+
});
|
|
4802
|
+
await db.execute({
|
|
4803
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
4804
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
4805
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
4806
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
4807
|
+
});
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
async function insertOntologyForBatch(rows, client) {
|
|
4811
|
+
const db = await resolveClient(client);
|
|
4812
|
+
let count = 0;
|
|
4813
|
+
for (const row of rows) {
|
|
4814
|
+
try {
|
|
4815
|
+
await insertOntologyForMemory(row, db);
|
|
4816
|
+
count++;
|
|
4817
|
+
} catch {
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
return count;
|
|
4821
|
+
}
|
|
4822
|
+
var init_agentic_ontology = __esm({
|
|
4823
|
+
"src/lib/agentic-ontology.ts"() {
|
|
4824
|
+
"use strict";
|
|
4825
|
+
}
|
|
4826
|
+
});
|
|
4827
|
+
|
|
4339
4828
|
// src/lib/store.ts
|
|
4340
4829
|
var store_exports = {};
|
|
4341
4830
|
__export(store_exports, {
|
|
@@ -4679,6 +5168,11 @@ async function flushBatch() {
|
|
|
4679
5168
|
await insertMemoryCardsForBatch2(batch);
|
|
4680
5169
|
} catch {
|
|
4681
5170
|
}
|
|
5171
|
+
try {
|
|
5172
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
5173
|
+
await insertOntologyForBatch2(batch);
|
|
5174
|
+
} catch {
|
|
5175
|
+
}
|
|
4682
5176
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
4683
5177
|
_pendingRecords.splice(0, batch.length);
|
|
4684
5178
|
try {
|