@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
|
@@ -183,6 +183,10 @@ async function loadConfig() {
|
|
|
183
183
|
if (config.dbPath.startsWith("~")) {
|
|
184
184
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
185
185
|
}
|
|
186
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
187
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
188
|
+
config.dbPath = envDbPath;
|
|
189
|
+
}
|
|
186
190
|
return config;
|
|
187
191
|
} catch {
|
|
188
192
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
@@ -203,7 +207,15 @@ function loadConfigSync() {
|
|
|
203
207
|
normalizeSessionLifecycle(migratedCfg);
|
|
204
208
|
normalizeAutoUpdate(migratedCfg);
|
|
205
209
|
normalizeOrchestration(migratedCfg);
|
|
206
|
-
|
|
210
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
211
|
+
if (config.dbPath.startsWith("~")) {
|
|
212
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
213
|
+
}
|
|
214
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
215
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
216
|
+
config.dbPath = envDbPath;
|
|
217
|
+
}
|
|
218
|
+
return config;
|
|
207
219
|
} catch {
|
|
208
220
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
209
221
|
}
|
|
@@ -1829,6 +1841,9 @@ function getClient() {
|
|
|
1829
1841
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
1830
1842
|
return _daemonClient;
|
|
1831
1843
|
}
|
|
1844
|
+
if (!_resilientClient) {
|
|
1845
|
+
return _adapterClient;
|
|
1846
|
+
}
|
|
1832
1847
|
return _resilientClient;
|
|
1833
1848
|
}
|
|
1834
1849
|
async function initDaemonClient() {
|
|
@@ -2861,6 +2876,127 @@ async function ensureSchema() {
|
|
|
2861
2876
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
2862
2877
|
END;
|
|
2863
2878
|
`);
|
|
2879
|
+
await client.executeMultiple(`
|
|
2880
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
2881
|
+
id TEXT PRIMARY KEY,
|
|
2882
|
+
agent_id TEXT NOT NULL,
|
|
2883
|
+
project_name TEXT,
|
|
2884
|
+
started_at TEXT NOT NULL,
|
|
2885
|
+
last_event_at TEXT NOT NULL,
|
|
2886
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
2887
|
+
properties TEXT DEFAULT '{}'
|
|
2888
|
+
);
|
|
2889
|
+
|
|
2890
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
2891
|
+
ON agent_sessions(agent_id, started_at);
|
|
2892
|
+
|
|
2893
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
2894
|
+
id TEXT PRIMARY KEY,
|
|
2895
|
+
statement TEXT NOT NULL,
|
|
2896
|
+
owner_agent_id TEXT,
|
|
2897
|
+
project_name TEXT,
|
|
2898
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
2899
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
2900
|
+
success_criteria TEXT,
|
|
2901
|
+
parent_goal_id TEXT,
|
|
2902
|
+
due_at TEXT,
|
|
2903
|
+
achieved_at TEXT,
|
|
2904
|
+
supersedes_id TEXT,
|
|
2905
|
+
created_at TEXT NOT NULL,
|
|
2906
|
+
updated_at TEXT NOT NULL,
|
|
2907
|
+
source_memory_id TEXT
|
|
2908
|
+
);
|
|
2909
|
+
|
|
2910
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
2911
|
+
ON agent_goals(project_name, status, priority);
|
|
2912
|
+
|
|
2913
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
2914
|
+
id TEXT PRIMARY KEY,
|
|
2915
|
+
event_type TEXT NOT NULL,
|
|
2916
|
+
occurred_at TEXT NOT NULL,
|
|
2917
|
+
sequence_index INTEGER NOT NULL,
|
|
2918
|
+
actor_agent_id TEXT,
|
|
2919
|
+
agent_role TEXT,
|
|
2920
|
+
project_name TEXT,
|
|
2921
|
+
session_id TEXT,
|
|
2922
|
+
task_id TEXT,
|
|
2923
|
+
goal_id TEXT,
|
|
2924
|
+
parent_event_id TEXT,
|
|
2925
|
+
intention TEXT,
|
|
2926
|
+
outcome TEXT,
|
|
2927
|
+
evidence_memory_id TEXT,
|
|
2928
|
+
impact TEXT,
|
|
2929
|
+
payload TEXT DEFAULT '{}',
|
|
2930
|
+
created_at TEXT NOT NULL
|
|
2931
|
+
);
|
|
2932
|
+
|
|
2933
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
2934
|
+
ON agent_events(occurred_at, sequence_index);
|
|
2935
|
+
|
|
2936
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
2937
|
+
ON agent_events(session_id, sequence_index);
|
|
2938
|
+
|
|
2939
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
2940
|
+
ON agent_events(goal_id, occurred_at);
|
|
2941
|
+
|
|
2942
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
2943
|
+
ON agent_events(evidence_memory_id);
|
|
2944
|
+
|
|
2945
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
2946
|
+
id TEXT PRIMARY KEY,
|
|
2947
|
+
goal_id TEXT NOT NULL,
|
|
2948
|
+
link_type TEXT NOT NULL,
|
|
2949
|
+
target_id TEXT NOT NULL,
|
|
2950
|
+
target_type TEXT NOT NULL,
|
|
2951
|
+
created_at TEXT NOT NULL
|
|
2952
|
+
);
|
|
2953
|
+
|
|
2954
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
2955
|
+
ON agent_goal_links(goal_id, target_type);
|
|
2956
|
+
|
|
2957
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
2958
|
+
id TEXT PRIMARY KEY,
|
|
2959
|
+
source_memory_id TEXT NOT NULL,
|
|
2960
|
+
event_id TEXT,
|
|
2961
|
+
labeler TEXT NOT NULL,
|
|
2962
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
2963
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
2964
|
+
labels TEXT NOT NULL,
|
|
2965
|
+
created_at TEXT NOT NULL,
|
|
2966
|
+
updated_at TEXT NOT NULL
|
|
2967
|
+
);
|
|
2968
|
+
|
|
2969
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
2970
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
2971
|
+
|
|
2972
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
2973
|
+
ON agent_semantic_labels(event_id);
|
|
2974
|
+
|
|
2975
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
2976
|
+
id TEXT PRIMARY KEY,
|
|
2977
|
+
project_name TEXT,
|
|
2978
|
+
session_id TEXT,
|
|
2979
|
+
window_start_at TEXT NOT NULL,
|
|
2980
|
+
window_end_at TEXT NOT NULL,
|
|
2981
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
2982
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
2983
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
2984
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
2985
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
2986
|
+
summary TEXT NOT NULL,
|
|
2987
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
2988
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
2989
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
2990
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
2991
|
+
created_at TEXT NOT NULL
|
|
2992
|
+
);
|
|
2993
|
+
|
|
2994
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
2995
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
2996
|
+
|
|
2997
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
2998
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
2999
|
+
`);
|
|
2864
3000
|
try {
|
|
2865
3001
|
await client.execute({
|
|
2866
3002
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -3010,7 +3146,7 @@ var init_database = __esm({
|
|
|
3010
3146
|
|
|
3011
3147
|
// src/lib/keychain.ts
|
|
3012
3148
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3013
|
-
import { existsSync as existsSync6 } from "fs";
|
|
3149
|
+
import { existsSync as existsSync6, statSync as statSync2 } from "fs";
|
|
3014
3150
|
import { execSync as execSync2 } from "child_process";
|
|
3015
3151
|
import path6 from "path";
|
|
3016
3152
|
import os5 from "os";
|
|
@@ -3020,29 +3156,65 @@ function getKeyDir() {
|
|
|
3020
3156
|
function getKeyPath() {
|
|
3021
3157
|
return path6.join(getKeyDir(), "master.key");
|
|
3022
3158
|
}
|
|
3023
|
-
function
|
|
3159
|
+
function nativeKeychainAllowed() {
|
|
3160
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
3161
|
+
}
|
|
3162
|
+
function linuxSecretAvailable() {
|
|
3163
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3164
|
+
if (process.platform !== "linux") return false;
|
|
3165
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
3166
|
+
try {
|
|
3167
|
+
execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
3168
|
+
} catch {
|
|
3169
|
+
linuxSecretAvailability = false;
|
|
3170
|
+
return false;
|
|
3171
|
+
}
|
|
3172
|
+
try {
|
|
3173
|
+
execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
3174
|
+
linuxSecretAvailability = true;
|
|
3175
|
+
} catch {
|
|
3176
|
+
linuxSecretAvailability = false;
|
|
3177
|
+
}
|
|
3178
|
+
return linuxSecretAvailability;
|
|
3179
|
+
}
|
|
3180
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3181
|
+
if (process.platform !== "linux") return false;
|
|
3182
|
+
try {
|
|
3183
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3184
|
+
const st = statSync2(keyPath);
|
|
3185
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3186
|
+
if (uid === 0) return true;
|
|
3187
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3188
|
+
return Boolean(exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep));
|
|
3189
|
+
} catch {
|
|
3190
|
+
return false;
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
function macKeychainGet(service = SERVICE) {
|
|
3194
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3024
3195
|
if (process.platform !== "darwin") return null;
|
|
3025
3196
|
try {
|
|
3026
3197
|
return execSync2(
|
|
3027
|
-
`security find-generic-password -s "${
|
|
3198
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
3028
3199
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3029
3200
|
).trim();
|
|
3030
3201
|
} catch {
|
|
3031
3202
|
return null;
|
|
3032
3203
|
}
|
|
3033
3204
|
}
|
|
3034
|
-
function macKeychainSet(value) {
|
|
3205
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
3206
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3035
3207
|
if (process.platform !== "darwin") return false;
|
|
3036
3208
|
try {
|
|
3037
3209
|
try {
|
|
3038
3210
|
execSync2(
|
|
3039
|
-
`security delete-generic-password -s "${
|
|
3211
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3040
3212
|
{ timeout: 5e3 }
|
|
3041
3213
|
);
|
|
3042
3214
|
} catch {
|
|
3043
3215
|
}
|
|
3044
3216
|
execSync2(
|
|
3045
|
-
`security add-generic-password -s "${
|
|
3217
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
3046
3218
|
{ timeout: 5e3 }
|
|
3047
3219
|
);
|
|
3048
3220
|
return true;
|
|
@@ -3050,22 +3222,48 @@ function macKeychainSet(value) {
|
|
|
3050
3222
|
return false;
|
|
3051
3223
|
}
|
|
3052
3224
|
}
|
|
3053
|
-
function
|
|
3054
|
-
if (
|
|
3225
|
+
function macKeychainDelete(service = SERVICE) {
|
|
3226
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3227
|
+
if (process.platform !== "darwin") return false;
|
|
3228
|
+
try {
|
|
3229
|
+
execSync2(
|
|
3230
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3231
|
+
{ timeout: 5e3 }
|
|
3232
|
+
);
|
|
3233
|
+
return true;
|
|
3234
|
+
} catch {
|
|
3235
|
+
return false;
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
function linuxSecretGet(service = SERVICE) {
|
|
3239
|
+
if (!linuxSecretAvailable()) return null;
|
|
3055
3240
|
try {
|
|
3056
3241
|
return execSync2(
|
|
3057
|
-
`secret-tool lookup service "${
|
|
3242
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3058
3243
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3059
3244
|
).trim();
|
|
3060
3245
|
} catch {
|
|
3061
3246
|
return null;
|
|
3062
3247
|
}
|
|
3063
3248
|
}
|
|
3064
|
-
function linuxSecretSet(value) {
|
|
3249
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
3250
|
+
if (!linuxSecretAvailable()) return false;
|
|
3251
|
+
try {
|
|
3252
|
+
execSync2(
|
|
3253
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3254
|
+
{ timeout: 5e3 }
|
|
3255
|
+
);
|
|
3256
|
+
return true;
|
|
3257
|
+
} catch {
|
|
3258
|
+
return false;
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
3262
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3065
3263
|
if (process.platform !== "linux") return false;
|
|
3066
3264
|
try {
|
|
3067
3265
|
execSync2(
|
|
3068
|
-
`
|
|
3266
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3069
3267
|
{ timeout: 5e3 }
|
|
3070
3268
|
);
|
|
3071
3269
|
return true;
|
|
@@ -3074,6 +3272,7 @@ function linuxSecretSet(value) {
|
|
|
3074
3272
|
}
|
|
3075
3273
|
}
|
|
3076
3274
|
async function tryKeytar() {
|
|
3275
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3077
3276
|
try {
|
|
3078
3277
|
return await import("keytar");
|
|
3079
3278
|
} catch {
|
|
@@ -3147,7 +3346,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
3147
3346
|
return "plaintext";
|
|
3148
3347
|
}
|
|
3149
3348
|
async function getMasterKey() {
|
|
3150
|
-
|
|
3349
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
3350
|
+
if (!nativeValue) {
|
|
3351
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
3352
|
+
if (legacyValue) {
|
|
3353
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
3354
|
+
if (migrated) {
|
|
3355
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
3356
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
3357
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
3358
|
+
}
|
|
3359
|
+
nativeValue = legacyValue;
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3151
3362
|
if (nativeValue) {
|
|
3152
3363
|
return Buffer.from(nativeValue, "base64");
|
|
3153
3364
|
}
|
|
@@ -3155,12 +3366,17 @@ async function getMasterKey() {
|
|
|
3155
3366
|
if (keytar) {
|
|
3156
3367
|
try {
|
|
3157
3368
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
3158
|
-
|
|
3159
|
-
|
|
3369
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
3370
|
+
if (legacyKeytarValue) {
|
|
3371
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
3160
3372
|
if (migrated) {
|
|
3161
3373
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
3374
|
+
try {
|
|
3375
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
3376
|
+
} catch {
|
|
3377
|
+
}
|
|
3162
3378
|
}
|
|
3163
|
-
return Buffer.from(
|
|
3379
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
3164
3380
|
}
|
|
3165
3381
|
} catch {
|
|
3166
3382
|
}
|
|
@@ -3185,7 +3401,7 @@ async function getMasterKey() {
|
|
|
3185
3401
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
3186
3402
|
if (!decrypted) {
|
|
3187
3403
|
process.stderr.write(
|
|
3188
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
3404
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
3189
3405
|
);
|
|
3190
3406
|
return null;
|
|
3191
3407
|
}
|
|
@@ -3194,6 +3410,9 @@ async function getMasterKey() {
|
|
|
3194
3410
|
b64Value = content;
|
|
3195
3411
|
}
|
|
3196
3412
|
const key = Buffer.from(b64Value, "base64");
|
|
3413
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
3414
|
+
return key;
|
|
3415
|
+
}
|
|
3197
3416
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
3198
3417
|
if (migrated) {
|
|
3199
3418
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -3221,12 +3440,14 @@ async function getMasterKey() {
|
|
|
3221
3440
|
return null;
|
|
3222
3441
|
}
|
|
3223
3442
|
}
|
|
3224
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
3443
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
3225
3444
|
var init_keychain = __esm({
|
|
3226
3445
|
"src/lib/keychain.ts"() {
|
|
3227
3446
|
"use strict";
|
|
3228
|
-
SERVICE = "exe-
|
|
3447
|
+
SERVICE = "exe-os";
|
|
3448
|
+
LEGACY_SERVICE = "exe-mem";
|
|
3229
3449
|
ACCOUNT = "master-key";
|
|
3450
|
+
linuxSecretAvailability = null;
|
|
3230
3451
|
ENCRYPTED_PREFIX = "enc:";
|
|
3231
3452
|
}
|
|
3232
3453
|
});
|
|
@@ -3496,7 +3717,7 @@ __export(shard_manager_exports, {
|
|
|
3496
3717
|
shardExists: () => shardExists
|
|
3497
3718
|
});
|
|
3498
3719
|
import path7 from "path";
|
|
3499
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as
|
|
3720
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync3 } from "fs";
|
|
3500
3721
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3501
3722
|
function initShardManager(encryptionKey) {
|
|
3502
3723
|
_encryptionKey = encryptionKey;
|
|
@@ -3560,7 +3781,7 @@ async function auditShardHealth(options = {}) {
|
|
|
3560
3781
|
const shards = [];
|
|
3561
3782
|
for (const name of names) {
|
|
3562
3783
|
const dbPath = path7.join(SHARDS_DIR, `${name}.db`);
|
|
3563
|
-
const stat =
|
|
3784
|
+
const stat = statSync3(dbPath);
|
|
3564
3785
|
const item = {
|
|
3565
3786
|
name,
|
|
3566
3787
|
path: dbPath,
|
|
@@ -3813,7 +4034,7 @@ async function getReadyShardClient(projectName) {
|
|
|
3813
4034
|
_shardLastAccess.delete(safeName);
|
|
3814
4035
|
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3815
4036
|
if (existsSync7(dbPath)) {
|
|
3816
|
-
const stat =
|
|
4037
|
+
const stat = statSync3(dbPath);
|
|
3817
4038
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3818
4039
|
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3819
4040
|
renameSync3(dbPath, archivedPath);
|
|
@@ -4320,6 +4541,274 @@ var init_memory_cards = __esm({
|
|
|
4320
4541
|
}
|
|
4321
4542
|
});
|
|
4322
4543
|
|
|
4544
|
+
// src/lib/agentic-ontology.ts
|
|
4545
|
+
var agentic_ontology_exports = {};
|
|
4546
|
+
__export(agentic_ontology_exports, {
|
|
4547
|
+
clean: () => clean,
|
|
4548
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
4549
|
+
inferIntention: () => inferIntention,
|
|
4550
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
4551
|
+
inferOutcome: () => inferOutcome,
|
|
4552
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
4553
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
4554
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
4555
|
+
ontologyPayload: () => ontologyPayload,
|
|
4556
|
+
stableId: () => stableId2
|
|
4557
|
+
});
|
|
4558
|
+
import { createHash as createHash3 } from "crypto";
|
|
4559
|
+
function stableId2(...parts) {
|
|
4560
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
4561
|
+
}
|
|
4562
|
+
function clean(text, max = 240) {
|
|
4563
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
4564
|
+
}
|
|
4565
|
+
function inferOntologyEventType(row) {
|
|
4566
|
+
const lower = row.raw_text.toLowerCase();
|
|
4567
|
+
if (row.has_error) return "error";
|
|
4568
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
4569
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
4570
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
4571
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
4572
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
4573
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
4574
|
+
return "memory_observation";
|
|
4575
|
+
}
|
|
4576
|
+
function inferIntention(row) {
|
|
4577
|
+
if (row.intent) return clean(row.intent, 220);
|
|
4578
|
+
const text = clean(row.raw_text, 1e3);
|
|
4579
|
+
const patterns = [
|
|
4580
|
+
/(?: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,
|
|
4581
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
4582
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
4583
|
+
];
|
|
4584
|
+
for (const p of patterns) {
|
|
4585
|
+
const m = text.match(p);
|
|
4586
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
4587
|
+
}
|
|
4588
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
4589
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
4590
|
+
}
|
|
4591
|
+
return null;
|
|
4592
|
+
}
|
|
4593
|
+
function inferOutcome(row) {
|
|
4594
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
4595
|
+
if (row.has_error) return "error";
|
|
4596
|
+
const lower = row.raw_text.toLowerCase();
|
|
4597
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
4598
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
4599
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
4600
|
+
return null;
|
|
4601
|
+
}
|
|
4602
|
+
function extractGoalCandidates(row) {
|
|
4603
|
+
const text = clean(row.raw_text, 1600);
|
|
4604
|
+
const patterns = [
|
|
4605
|
+
/(?: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,
|
|
4606
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
4607
|
+
];
|
|
4608
|
+
const out = [];
|
|
4609
|
+
for (const pattern of patterns) {
|
|
4610
|
+
for (const m of text.matchAll(pattern)) {
|
|
4611
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
4612
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
4613
|
+
if (out.length >= 3) return out;
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
return out;
|
|
4617
|
+
}
|
|
4618
|
+
function uniq(values, max = 6) {
|
|
4619
|
+
const out = [];
|
|
4620
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
4621
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
4622
|
+
if (out.length >= max) break;
|
|
4623
|
+
}
|
|
4624
|
+
return out;
|
|
4625
|
+
}
|
|
4626
|
+
function extractMatches(text, patterns, max = 5) {
|
|
4627
|
+
const out = [];
|
|
4628
|
+
for (const pattern of patterns) {
|
|
4629
|
+
for (const match of text.matchAll(pattern)) {
|
|
4630
|
+
const value = match[1] ?? match[0];
|
|
4631
|
+
if (value) out.push(value);
|
|
4632
|
+
if (out.length >= max) return uniq(out, max);
|
|
4633
|
+
}
|
|
4634
|
+
}
|
|
4635
|
+
return uniq(out, max);
|
|
4636
|
+
}
|
|
4637
|
+
function inferSemanticLabel(row) {
|
|
4638
|
+
const text = clean(row.raw_text, 2400);
|
|
4639
|
+
const eventType = inferOntologyEventType(row);
|
|
4640
|
+
const intention = inferIntention(row);
|
|
4641
|
+
const outcome = inferOutcome(row);
|
|
4642
|
+
const goals = extractGoalCandidates(row);
|
|
4643
|
+
const milestones = extractMatches(text, [
|
|
4644
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
4645
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
4646
|
+
]);
|
|
4647
|
+
const problems = extractMatches(text, [
|
|
4648
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
4649
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
4650
|
+
]);
|
|
4651
|
+
const decisions = extractMatches(text, [
|
|
4652
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
4653
|
+
]);
|
|
4654
|
+
const temporalAnchors = extractMatches(text, [
|
|
4655
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
4656
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
4657
|
+
], 8);
|
|
4658
|
+
const nextActions = extractMatches(text, [
|
|
4659
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
4660
|
+
]);
|
|
4661
|
+
const actors = uniq([
|
|
4662
|
+
row.agent_id,
|
|
4663
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
4664
|
+
], 6);
|
|
4665
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
4666
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
4667
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
4668
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
4669
|
+
return {
|
|
4670
|
+
labeler: "deterministic",
|
|
4671
|
+
schemaVersion: 1,
|
|
4672
|
+
eventType,
|
|
4673
|
+
intention,
|
|
4674
|
+
outcome,
|
|
4675
|
+
impact,
|
|
4676
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
4677
|
+
goals,
|
|
4678
|
+
milestones,
|
|
4679
|
+
problems,
|
|
4680
|
+
decisions,
|
|
4681
|
+
actors,
|
|
4682
|
+
temporalAnchors,
|
|
4683
|
+
successSignals,
|
|
4684
|
+
failureSignals,
|
|
4685
|
+
nextActions,
|
|
4686
|
+
summary: clean(text, 280)
|
|
4687
|
+
};
|
|
4688
|
+
}
|
|
4689
|
+
function ontologyPayload(row) {
|
|
4690
|
+
const semantic = inferSemanticLabel(row);
|
|
4691
|
+
return {
|
|
4692
|
+
tool_name: row.tool_name,
|
|
4693
|
+
memory_version: row.version ?? null,
|
|
4694
|
+
domain: row.domain ?? null,
|
|
4695
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
4696
|
+
semantic
|
|
4697
|
+
};
|
|
4698
|
+
}
|
|
4699
|
+
function safeJson(value) {
|
|
4700
|
+
try {
|
|
4701
|
+
return JSON.parse(value);
|
|
4702
|
+
} catch {
|
|
4703
|
+
return value.slice(0, 1e3);
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
async function resolveClient(client) {
|
|
4707
|
+
if (client) return client;
|
|
4708
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
4709
|
+
return getClient2();
|
|
4710
|
+
}
|
|
4711
|
+
async function insertOntologyForMemory(row, client) {
|
|
4712
|
+
const db = await resolveClient(client);
|
|
4713
|
+
const occurredAt = row.timestamp;
|
|
4714
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
4715
|
+
const eventType = inferOntologyEventType(row);
|
|
4716
|
+
const intention = inferIntention(row);
|
|
4717
|
+
const outcome = inferOutcome(row);
|
|
4718
|
+
const eventId = stableId2("event", row.id);
|
|
4719
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4720
|
+
await db.execute({
|
|
4721
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
4722
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
4723
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
4724
|
+
event_count = event_count + 1`,
|
|
4725
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
4726
|
+
});
|
|
4727
|
+
await db.execute({
|
|
4728
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
4729
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
4730
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
4731
|
+
impact, payload, created_at)
|
|
4732
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
4733
|
+
args: [
|
|
4734
|
+
eventId,
|
|
4735
|
+
eventType,
|
|
4736
|
+
occurredAt,
|
|
4737
|
+
sequence,
|
|
4738
|
+
row.agent_id,
|
|
4739
|
+
row.agent_role,
|
|
4740
|
+
row.project_name,
|
|
4741
|
+
row.session_id,
|
|
4742
|
+
row.task_id ?? null,
|
|
4743
|
+
intention,
|
|
4744
|
+
outcome,
|
|
4745
|
+
row.id,
|
|
4746
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
4747
|
+
JSON.stringify(ontologyPayload(row)),
|
|
4748
|
+
now
|
|
4749
|
+
]
|
|
4750
|
+
});
|
|
4751
|
+
const semantic = inferSemanticLabel(row);
|
|
4752
|
+
await db.execute({
|
|
4753
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
4754
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
4755
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
4756
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
4757
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
4758
|
+
args: [
|
|
4759
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
4760
|
+
row.id,
|
|
4761
|
+
eventId,
|
|
4762
|
+
semantic.labeler,
|
|
4763
|
+
semantic.schemaVersion,
|
|
4764
|
+
semantic.confidence,
|
|
4765
|
+
JSON.stringify(semantic),
|
|
4766
|
+
now,
|
|
4767
|
+
now
|
|
4768
|
+
]
|
|
4769
|
+
});
|
|
4770
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
4771
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
4772
|
+
await db.execute({
|
|
4773
|
+
sql: `INSERT INTO agent_goals
|
|
4774
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
4775
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
4776
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
4777
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
4778
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
4779
|
+
});
|
|
4780
|
+
await db.execute({
|
|
4781
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
4782
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
4783
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
4784
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
4785
|
+
});
|
|
4786
|
+
await db.execute({
|
|
4787
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
4788
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
4789
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
4790
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
4791
|
+
});
|
|
4792
|
+
}
|
|
4793
|
+
}
|
|
4794
|
+
async function insertOntologyForBatch(rows, client) {
|
|
4795
|
+
const db = await resolveClient(client);
|
|
4796
|
+
let count = 0;
|
|
4797
|
+
for (const row of rows) {
|
|
4798
|
+
try {
|
|
4799
|
+
await insertOntologyForMemory(row, db);
|
|
4800
|
+
count++;
|
|
4801
|
+
} catch {
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
return count;
|
|
4805
|
+
}
|
|
4806
|
+
var init_agentic_ontology = __esm({
|
|
4807
|
+
"src/lib/agentic-ontology.ts"() {
|
|
4808
|
+
"use strict";
|
|
4809
|
+
}
|
|
4810
|
+
});
|
|
4811
|
+
|
|
4323
4812
|
// src/lib/store.ts
|
|
4324
4813
|
var store_exports = {};
|
|
4325
4814
|
__export(store_exports, {
|
|
@@ -4663,6 +5152,11 @@ async function flushBatch() {
|
|
|
4663
5152
|
await insertMemoryCardsForBatch2(batch);
|
|
4664
5153
|
} catch {
|
|
4665
5154
|
}
|
|
5155
|
+
try {
|
|
5156
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
5157
|
+
await insertOntologyForBatch2(batch);
|
|
5158
|
+
} catch {
|
|
5159
|
+
}
|
|
4666
5160
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
4667
5161
|
_pendingRecords.splice(0, batch.length);
|
|
4668
5162
|
try {
|