@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
|
@@ -248,6 +248,10 @@ async function loadConfig() {
|
|
|
248
248
|
if (config.dbPath.startsWith("~")) {
|
|
249
249
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
250
250
|
}
|
|
251
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
252
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
253
|
+
config.dbPath = envDbPath;
|
|
254
|
+
}
|
|
251
255
|
return config;
|
|
252
256
|
} catch {
|
|
253
257
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
@@ -268,7 +272,15 @@ function loadConfigSync() {
|
|
|
268
272
|
normalizeSessionLifecycle(migratedCfg);
|
|
269
273
|
normalizeAutoUpdate(migratedCfg);
|
|
270
274
|
normalizeOrchestration(migratedCfg);
|
|
271
|
-
|
|
275
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
276
|
+
if (config.dbPath.startsWith("~")) {
|
|
277
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
278
|
+
}
|
|
279
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
280
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
281
|
+
config.dbPath = envDbPath;
|
|
282
|
+
}
|
|
283
|
+
return config;
|
|
272
284
|
} catch {
|
|
273
285
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
274
286
|
}
|
|
@@ -1779,6 +1791,9 @@ function getClient() {
|
|
|
1779
1791
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
1780
1792
|
return _daemonClient;
|
|
1781
1793
|
}
|
|
1794
|
+
if (!_resilientClient) {
|
|
1795
|
+
return _adapterClient;
|
|
1796
|
+
}
|
|
1782
1797
|
return _resilientClient;
|
|
1783
1798
|
}
|
|
1784
1799
|
async function initDaemonClient() {
|
|
@@ -2811,6 +2826,127 @@ async function ensureSchema() {
|
|
|
2811
2826
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
2812
2827
|
END;
|
|
2813
2828
|
`);
|
|
2829
|
+
await client.executeMultiple(`
|
|
2830
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
2831
|
+
id TEXT PRIMARY KEY,
|
|
2832
|
+
agent_id TEXT NOT NULL,
|
|
2833
|
+
project_name TEXT,
|
|
2834
|
+
started_at TEXT NOT NULL,
|
|
2835
|
+
last_event_at TEXT NOT NULL,
|
|
2836
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
2837
|
+
properties TEXT DEFAULT '{}'
|
|
2838
|
+
);
|
|
2839
|
+
|
|
2840
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
2841
|
+
ON agent_sessions(agent_id, started_at);
|
|
2842
|
+
|
|
2843
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
2844
|
+
id TEXT PRIMARY KEY,
|
|
2845
|
+
statement TEXT NOT NULL,
|
|
2846
|
+
owner_agent_id TEXT,
|
|
2847
|
+
project_name TEXT,
|
|
2848
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
2849
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
2850
|
+
success_criteria TEXT,
|
|
2851
|
+
parent_goal_id TEXT,
|
|
2852
|
+
due_at TEXT,
|
|
2853
|
+
achieved_at TEXT,
|
|
2854
|
+
supersedes_id TEXT,
|
|
2855
|
+
created_at TEXT NOT NULL,
|
|
2856
|
+
updated_at TEXT NOT NULL,
|
|
2857
|
+
source_memory_id TEXT
|
|
2858
|
+
);
|
|
2859
|
+
|
|
2860
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
2861
|
+
ON agent_goals(project_name, status, priority);
|
|
2862
|
+
|
|
2863
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
2864
|
+
id TEXT PRIMARY KEY,
|
|
2865
|
+
event_type TEXT NOT NULL,
|
|
2866
|
+
occurred_at TEXT NOT NULL,
|
|
2867
|
+
sequence_index INTEGER NOT NULL,
|
|
2868
|
+
actor_agent_id TEXT,
|
|
2869
|
+
agent_role TEXT,
|
|
2870
|
+
project_name TEXT,
|
|
2871
|
+
session_id TEXT,
|
|
2872
|
+
task_id TEXT,
|
|
2873
|
+
goal_id TEXT,
|
|
2874
|
+
parent_event_id TEXT,
|
|
2875
|
+
intention TEXT,
|
|
2876
|
+
outcome TEXT,
|
|
2877
|
+
evidence_memory_id TEXT,
|
|
2878
|
+
impact TEXT,
|
|
2879
|
+
payload TEXT DEFAULT '{}',
|
|
2880
|
+
created_at TEXT NOT NULL
|
|
2881
|
+
);
|
|
2882
|
+
|
|
2883
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
2884
|
+
ON agent_events(occurred_at, sequence_index);
|
|
2885
|
+
|
|
2886
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
2887
|
+
ON agent_events(session_id, sequence_index);
|
|
2888
|
+
|
|
2889
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
2890
|
+
ON agent_events(goal_id, occurred_at);
|
|
2891
|
+
|
|
2892
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
2893
|
+
ON agent_events(evidence_memory_id);
|
|
2894
|
+
|
|
2895
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
2896
|
+
id TEXT PRIMARY KEY,
|
|
2897
|
+
goal_id TEXT NOT NULL,
|
|
2898
|
+
link_type TEXT NOT NULL,
|
|
2899
|
+
target_id TEXT NOT NULL,
|
|
2900
|
+
target_type TEXT NOT NULL,
|
|
2901
|
+
created_at TEXT NOT NULL
|
|
2902
|
+
);
|
|
2903
|
+
|
|
2904
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
2905
|
+
ON agent_goal_links(goal_id, target_type);
|
|
2906
|
+
|
|
2907
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
2908
|
+
id TEXT PRIMARY KEY,
|
|
2909
|
+
source_memory_id TEXT NOT NULL,
|
|
2910
|
+
event_id TEXT,
|
|
2911
|
+
labeler TEXT NOT NULL,
|
|
2912
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
2913
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
2914
|
+
labels TEXT NOT NULL,
|
|
2915
|
+
created_at TEXT NOT NULL,
|
|
2916
|
+
updated_at TEXT NOT NULL
|
|
2917
|
+
);
|
|
2918
|
+
|
|
2919
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
2920
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
2921
|
+
|
|
2922
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
2923
|
+
ON agent_semantic_labels(event_id);
|
|
2924
|
+
|
|
2925
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
2926
|
+
id TEXT PRIMARY KEY,
|
|
2927
|
+
project_name TEXT,
|
|
2928
|
+
session_id TEXT,
|
|
2929
|
+
window_start_at TEXT NOT NULL,
|
|
2930
|
+
window_end_at TEXT NOT NULL,
|
|
2931
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
2932
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
2933
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
2934
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
2935
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
2936
|
+
summary TEXT NOT NULL,
|
|
2937
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
2938
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
2939
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
2940
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
2941
|
+
created_at TEXT NOT NULL
|
|
2942
|
+
);
|
|
2943
|
+
|
|
2944
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
2945
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
2946
|
+
|
|
2947
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
2948
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
2949
|
+
`);
|
|
2814
2950
|
try {
|
|
2815
2951
|
await client.execute({
|
|
2816
2952
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -2960,7 +3096,7 @@ var init_database = __esm({
|
|
|
2960
3096
|
|
|
2961
3097
|
// src/lib/keychain.ts
|
|
2962
3098
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
2963
|
-
import { existsSync as existsSync6 } from "fs";
|
|
3099
|
+
import { existsSync as existsSync6, statSync as statSync2 } from "fs";
|
|
2964
3100
|
import { execSync as execSync2 } from "child_process";
|
|
2965
3101
|
import path6 from "path";
|
|
2966
3102
|
import os5 from "os";
|
|
@@ -2970,29 +3106,65 @@ function getKeyDir() {
|
|
|
2970
3106
|
function getKeyPath() {
|
|
2971
3107
|
return path6.join(getKeyDir(), "master.key");
|
|
2972
3108
|
}
|
|
2973
|
-
function
|
|
3109
|
+
function nativeKeychainAllowed() {
|
|
3110
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
3111
|
+
}
|
|
3112
|
+
function linuxSecretAvailable() {
|
|
3113
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3114
|
+
if (process.platform !== "linux") return false;
|
|
3115
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
3116
|
+
try {
|
|
3117
|
+
execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
3118
|
+
} catch {
|
|
3119
|
+
linuxSecretAvailability = false;
|
|
3120
|
+
return false;
|
|
3121
|
+
}
|
|
3122
|
+
try {
|
|
3123
|
+
execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
3124
|
+
linuxSecretAvailability = true;
|
|
3125
|
+
} catch {
|
|
3126
|
+
linuxSecretAvailability = false;
|
|
3127
|
+
}
|
|
3128
|
+
return linuxSecretAvailability;
|
|
3129
|
+
}
|
|
3130
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3131
|
+
if (process.platform !== "linux") return false;
|
|
3132
|
+
try {
|
|
3133
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3134
|
+
const st = statSync2(keyPath);
|
|
3135
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3136
|
+
if (uid === 0) return true;
|
|
3137
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3138
|
+
return Boolean(exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep));
|
|
3139
|
+
} catch {
|
|
3140
|
+
return false;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
function macKeychainGet(service = SERVICE) {
|
|
3144
|
+
if (!nativeKeychainAllowed()) return null;
|
|
2974
3145
|
if (process.platform !== "darwin") return null;
|
|
2975
3146
|
try {
|
|
2976
3147
|
return execSync2(
|
|
2977
|
-
`security find-generic-password -s "${
|
|
3148
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
2978
3149
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
2979
3150
|
).trim();
|
|
2980
3151
|
} catch {
|
|
2981
3152
|
return null;
|
|
2982
3153
|
}
|
|
2983
3154
|
}
|
|
2984
|
-
function macKeychainSet(value) {
|
|
3155
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
3156
|
+
if (!nativeKeychainAllowed()) return false;
|
|
2985
3157
|
if (process.platform !== "darwin") return false;
|
|
2986
3158
|
try {
|
|
2987
3159
|
try {
|
|
2988
3160
|
execSync2(
|
|
2989
|
-
`security delete-generic-password -s "${
|
|
3161
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
2990
3162
|
{ timeout: 5e3 }
|
|
2991
3163
|
);
|
|
2992
3164
|
} catch {
|
|
2993
3165
|
}
|
|
2994
3166
|
execSync2(
|
|
2995
|
-
`security add-generic-password -s "${
|
|
3167
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
2996
3168
|
{ timeout: 5e3 }
|
|
2997
3169
|
);
|
|
2998
3170
|
return true;
|
|
@@ -3000,22 +3172,48 @@ function macKeychainSet(value) {
|
|
|
3000
3172
|
return false;
|
|
3001
3173
|
}
|
|
3002
3174
|
}
|
|
3003
|
-
function
|
|
3004
|
-
if (
|
|
3175
|
+
function macKeychainDelete(service = SERVICE) {
|
|
3176
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3177
|
+
if (process.platform !== "darwin") return false;
|
|
3178
|
+
try {
|
|
3179
|
+
execSync2(
|
|
3180
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3181
|
+
{ timeout: 5e3 }
|
|
3182
|
+
);
|
|
3183
|
+
return true;
|
|
3184
|
+
} catch {
|
|
3185
|
+
return false;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
function linuxSecretGet(service = SERVICE) {
|
|
3189
|
+
if (!linuxSecretAvailable()) return null;
|
|
3005
3190
|
try {
|
|
3006
3191
|
return execSync2(
|
|
3007
|
-
`secret-tool lookup service "${
|
|
3192
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3008
3193
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
3009
3194
|
).trim();
|
|
3010
3195
|
} catch {
|
|
3011
3196
|
return null;
|
|
3012
3197
|
}
|
|
3013
3198
|
}
|
|
3014
|
-
function linuxSecretSet(value) {
|
|
3199
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
3200
|
+
if (!linuxSecretAvailable()) return false;
|
|
3201
|
+
try {
|
|
3202
|
+
execSync2(
|
|
3203
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3204
|
+
{ timeout: 5e3 }
|
|
3205
|
+
);
|
|
3206
|
+
return true;
|
|
3207
|
+
} catch {
|
|
3208
|
+
return false;
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
3212
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3015
3213
|
if (process.platform !== "linux") return false;
|
|
3016
3214
|
try {
|
|
3017
3215
|
execSync2(
|
|
3018
|
-
`
|
|
3216
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3019
3217
|
{ timeout: 5e3 }
|
|
3020
3218
|
);
|
|
3021
3219
|
return true;
|
|
@@ -3024,6 +3222,7 @@ function linuxSecretSet(value) {
|
|
|
3024
3222
|
}
|
|
3025
3223
|
}
|
|
3026
3224
|
async function tryKeytar() {
|
|
3225
|
+
if (!nativeKeychainAllowed()) return null;
|
|
3027
3226
|
try {
|
|
3028
3227
|
return await import("keytar");
|
|
3029
3228
|
} catch {
|
|
@@ -3097,7 +3296,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
3097
3296
|
return "plaintext";
|
|
3098
3297
|
}
|
|
3099
3298
|
async function getMasterKey() {
|
|
3100
|
-
|
|
3299
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
3300
|
+
if (!nativeValue) {
|
|
3301
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
3302
|
+
if (legacyValue) {
|
|
3303
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
3304
|
+
if (migrated) {
|
|
3305
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
3306
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
3307
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
3308
|
+
}
|
|
3309
|
+
nativeValue = legacyValue;
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3101
3312
|
if (nativeValue) {
|
|
3102
3313
|
return Buffer.from(nativeValue, "base64");
|
|
3103
3314
|
}
|
|
@@ -3105,12 +3316,17 @@ async function getMasterKey() {
|
|
|
3105
3316
|
if (keytar) {
|
|
3106
3317
|
try {
|
|
3107
3318
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
3108
|
-
|
|
3109
|
-
|
|
3319
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
3320
|
+
if (legacyKeytarValue) {
|
|
3321
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
3110
3322
|
if (migrated) {
|
|
3111
3323
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
3324
|
+
try {
|
|
3325
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
3326
|
+
} catch {
|
|
3327
|
+
}
|
|
3112
3328
|
}
|
|
3113
|
-
return Buffer.from(
|
|
3329
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
3114
3330
|
}
|
|
3115
3331
|
} catch {
|
|
3116
3332
|
}
|
|
@@ -3135,7 +3351,7 @@ async function getMasterKey() {
|
|
|
3135
3351
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
3136
3352
|
if (!decrypted) {
|
|
3137
3353
|
process.stderr.write(
|
|
3138
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
3354
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
3139
3355
|
);
|
|
3140
3356
|
return null;
|
|
3141
3357
|
}
|
|
@@ -3144,6 +3360,9 @@ async function getMasterKey() {
|
|
|
3144
3360
|
b64Value = content;
|
|
3145
3361
|
}
|
|
3146
3362
|
const key = Buffer.from(b64Value, "base64");
|
|
3363
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
3364
|
+
return key;
|
|
3365
|
+
}
|
|
3147
3366
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
3148
3367
|
if (migrated) {
|
|
3149
3368
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -3171,12 +3390,14 @@ async function getMasterKey() {
|
|
|
3171
3390
|
return null;
|
|
3172
3391
|
}
|
|
3173
3392
|
}
|
|
3174
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
3393
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
3175
3394
|
var init_keychain = __esm({
|
|
3176
3395
|
"src/lib/keychain.ts"() {
|
|
3177
3396
|
"use strict";
|
|
3178
|
-
SERVICE = "exe-
|
|
3397
|
+
SERVICE = "exe-os";
|
|
3398
|
+
LEGACY_SERVICE = "exe-mem";
|
|
3179
3399
|
ACCOUNT = "master-key";
|
|
3400
|
+
linuxSecretAvailability = null;
|
|
3180
3401
|
ENCRYPTED_PREFIX = "enc:";
|
|
3181
3402
|
}
|
|
3182
3403
|
});
|
|
@@ -3446,7 +3667,7 @@ __export(shard_manager_exports, {
|
|
|
3446
3667
|
shardExists: () => shardExists
|
|
3447
3668
|
});
|
|
3448
3669
|
import path7 from "path";
|
|
3449
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as
|
|
3670
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync3 } from "fs";
|
|
3450
3671
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3451
3672
|
function initShardManager(encryptionKey) {
|
|
3452
3673
|
_encryptionKey = encryptionKey;
|
|
@@ -3510,7 +3731,7 @@ async function auditShardHealth(options = {}) {
|
|
|
3510
3731
|
const shards = [];
|
|
3511
3732
|
for (const name of names) {
|
|
3512
3733
|
const dbPath = path7.join(SHARDS_DIR, `${name}.db`);
|
|
3513
|
-
const stat =
|
|
3734
|
+
const stat = statSync3(dbPath);
|
|
3514
3735
|
const item = {
|
|
3515
3736
|
name,
|
|
3516
3737
|
path: dbPath,
|
|
@@ -3763,7 +3984,7 @@ async function getReadyShardClient(projectName) {
|
|
|
3763
3984
|
_shardLastAccess.delete(safeName);
|
|
3764
3985
|
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3765
3986
|
if (existsSync7(dbPath)) {
|
|
3766
|
-
const stat =
|
|
3987
|
+
const stat = statSync3(dbPath);
|
|
3767
3988
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3768
3989
|
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3769
3990
|
renameSync3(dbPath, archivedPath);
|
|
@@ -4270,6 +4491,274 @@ var init_memory_cards = __esm({
|
|
|
4270
4491
|
}
|
|
4271
4492
|
});
|
|
4272
4493
|
|
|
4494
|
+
// src/lib/agentic-ontology.ts
|
|
4495
|
+
var agentic_ontology_exports = {};
|
|
4496
|
+
__export(agentic_ontology_exports, {
|
|
4497
|
+
clean: () => clean,
|
|
4498
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
4499
|
+
inferIntention: () => inferIntention,
|
|
4500
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
4501
|
+
inferOutcome: () => inferOutcome,
|
|
4502
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
4503
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
4504
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
4505
|
+
ontologyPayload: () => ontologyPayload,
|
|
4506
|
+
stableId: () => stableId2
|
|
4507
|
+
});
|
|
4508
|
+
import { createHash as createHash3 } from "crypto";
|
|
4509
|
+
function stableId2(...parts) {
|
|
4510
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
4511
|
+
}
|
|
4512
|
+
function clean(text, max = 240) {
|
|
4513
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
4514
|
+
}
|
|
4515
|
+
function inferOntologyEventType(row) {
|
|
4516
|
+
const lower = row.raw_text.toLowerCase();
|
|
4517
|
+
if (row.has_error) return "error";
|
|
4518
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
4519
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
4520
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
4521
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
4522
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
4523
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
4524
|
+
return "memory_observation";
|
|
4525
|
+
}
|
|
4526
|
+
function inferIntention(row) {
|
|
4527
|
+
if (row.intent) return clean(row.intent, 220);
|
|
4528
|
+
const text = clean(row.raw_text, 1e3);
|
|
4529
|
+
const patterns = [
|
|
4530
|
+
/(?: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,
|
|
4531
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
4532
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
4533
|
+
];
|
|
4534
|
+
for (const p of patterns) {
|
|
4535
|
+
const m = text.match(p);
|
|
4536
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
4537
|
+
}
|
|
4538
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
4539
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
4540
|
+
}
|
|
4541
|
+
return null;
|
|
4542
|
+
}
|
|
4543
|
+
function inferOutcome(row) {
|
|
4544
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
4545
|
+
if (row.has_error) return "error";
|
|
4546
|
+
const lower = row.raw_text.toLowerCase();
|
|
4547
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
4548
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
4549
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
4550
|
+
return null;
|
|
4551
|
+
}
|
|
4552
|
+
function extractGoalCandidates(row) {
|
|
4553
|
+
const text = clean(row.raw_text, 1600);
|
|
4554
|
+
const patterns = [
|
|
4555
|
+
/(?: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,
|
|
4556
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
4557
|
+
];
|
|
4558
|
+
const out = [];
|
|
4559
|
+
for (const pattern of patterns) {
|
|
4560
|
+
for (const m of text.matchAll(pattern)) {
|
|
4561
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
4562
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
4563
|
+
if (out.length >= 3) return out;
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
return out;
|
|
4567
|
+
}
|
|
4568
|
+
function uniq(values, max = 6) {
|
|
4569
|
+
const out = [];
|
|
4570
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
4571
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
4572
|
+
if (out.length >= max) break;
|
|
4573
|
+
}
|
|
4574
|
+
return out;
|
|
4575
|
+
}
|
|
4576
|
+
function extractMatches(text, patterns, max = 5) {
|
|
4577
|
+
const out = [];
|
|
4578
|
+
for (const pattern of patterns) {
|
|
4579
|
+
for (const match of text.matchAll(pattern)) {
|
|
4580
|
+
const value = match[1] ?? match[0];
|
|
4581
|
+
if (value) out.push(value);
|
|
4582
|
+
if (out.length >= max) return uniq(out, max);
|
|
4583
|
+
}
|
|
4584
|
+
}
|
|
4585
|
+
return uniq(out, max);
|
|
4586
|
+
}
|
|
4587
|
+
function inferSemanticLabel(row) {
|
|
4588
|
+
const text = clean(row.raw_text, 2400);
|
|
4589
|
+
const eventType = inferOntologyEventType(row);
|
|
4590
|
+
const intention = inferIntention(row);
|
|
4591
|
+
const outcome = inferOutcome(row);
|
|
4592
|
+
const goals = extractGoalCandidates(row);
|
|
4593
|
+
const milestones = extractMatches(text, [
|
|
4594
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
4595
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
4596
|
+
]);
|
|
4597
|
+
const problems = extractMatches(text, [
|
|
4598
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
4599
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
4600
|
+
]);
|
|
4601
|
+
const decisions = extractMatches(text, [
|
|
4602
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
4603
|
+
]);
|
|
4604
|
+
const temporalAnchors = extractMatches(text, [
|
|
4605
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
4606
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
4607
|
+
], 8);
|
|
4608
|
+
const nextActions = extractMatches(text, [
|
|
4609
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
4610
|
+
]);
|
|
4611
|
+
const actors = uniq([
|
|
4612
|
+
row.agent_id,
|
|
4613
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
4614
|
+
], 6);
|
|
4615
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
4616
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
4617
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
4618
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
4619
|
+
return {
|
|
4620
|
+
labeler: "deterministic",
|
|
4621
|
+
schemaVersion: 1,
|
|
4622
|
+
eventType,
|
|
4623
|
+
intention,
|
|
4624
|
+
outcome,
|
|
4625
|
+
impact,
|
|
4626
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
4627
|
+
goals,
|
|
4628
|
+
milestones,
|
|
4629
|
+
problems,
|
|
4630
|
+
decisions,
|
|
4631
|
+
actors,
|
|
4632
|
+
temporalAnchors,
|
|
4633
|
+
successSignals,
|
|
4634
|
+
failureSignals,
|
|
4635
|
+
nextActions,
|
|
4636
|
+
summary: clean(text, 280)
|
|
4637
|
+
};
|
|
4638
|
+
}
|
|
4639
|
+
function ontologyPayload(row) {
|
|
4640
|
+
const semantic = inferSemanticLabel(row);
|
|
4641
|
+
return {
|
|
4642
|
+
tool_name: row.tool_name,
|
|
4643
|
+
memory_version: row.version ?? null,
|
|
4644
|
+
domain: row.domain ?? null,
|
|
4645
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
4646
|
+
semantic
|
|
4647
|
+
};
|
|
4648
|
+
}
|
|
4649
|
+
function safeJson(value) {
|
|
4650
|
+
try {
|
|
4651
|
+
return JSON.parse(value);
|
|
4652
|
+
} catch {
|
|
4653
|
+
return value.slice(0, 1e3);
|
|
4654
|
+
}
|
|
4655
|
+
}
|
|
4656
|
+
async function resolveClient(client) {
|
|
4657
|
+
if (client) return client;
|
|
4658
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
4659
|
+
return getClient2();
|
|
4660
|
+
}
|
|
4661
|
+
async function insertOntologyForMemory(row, client) {
|
|
4662
|
+
const db = await resolveClient(client);
|
|
4663
|
+
const occurredAt = row.timestamp;
|
|
4664
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
4665
|
+
const eventType = inferOntologyEventType(row);
|
|
4666
|
+
const intention = inferIntention(row);
|
|
4667
|
+
const outcome = inferOutcome(row);
|
|
4668
|
+
const eventId = stableId2("event", row.id);
|
|
4669
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4670
|
+
await db.execute({
|
|
4671
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
4672
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
4673
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
4674
|
+
event_count = event_count + 1`,
|
|
4675
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
4676
|
+
});
|
|
4677
|
+
await db.execute({
|
|
4678
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
4679
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
4680
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
4681
|
+
impact, payload, created_at)
|
|
4682
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
4683
|
+
args: [
|
|
4684
|
+
eventId,
|
|
4685
|
+
eventType,
|
|
4686
|
+
occurredAt,
|
|
4687
|
+
sequence,
|
|
4688
|
+
row.agent_id,
|
|
4689
|
+
row.agent_role,
|
|
4690
|
+
row.project_name,
|
|
4691
|
+
row.session_id,
|
|
4692
|
+
row.task_id ?? null,
|
|
4693
|
+
intention,
|
|
4694
|
+
outcome,
|
|
4695
|
+
row.id,
|
|
4696
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
4697
|
+
JSON.stringify(ontologyPayload(row)),
|
|
4698
|
+
now
|
|
4699
|
+
]
|
|
4700
|
+
});
|
|
4701
|
+
const semantic = inferSemanticLabel(row);
|
|
4702
|
+
await db.execute({
|
|
4703
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
4704
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
4705
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
4706
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
4707
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
4708
|
+
args: [
|
|
4709
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
4710
|
+
row.id,
|
|
4711
|
+
eventId,
|
|
4712
|
+
semantic.labeler,
|
|
4713
|
+
semantic.schemaVersion,
|
|
4714
|
+
semantic.confidence,
|
|
4715
|
+
JSON.stringify(semantic),
|
|
4716
|
+
now,
|
|
4717
|
+
now
|
|
4718
|
+
]
|
|
4719
|
+
});
|
|
4720
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
4721
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
4722
|
+
await db.execute({
|
|
4723
|
+
sql: `INSERT INTO agent_goals
|
|
4724
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
4725
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
4726
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
4727
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
4728
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
4729
|
+
});
|
|
4730
|
+
await db.execute({
|
|
4731
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
4732
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
4733
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
4734
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
4735
|
+
});
|
|
4736
|
+
await db.execute({
|
|
4737
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
4738
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
4739
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
4740
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
4741
|
+
});
|
|
4742
|
+
}
|
|
4743
|
+
}
|
|
4744
|
+
async function insertOntologyForBatch(rows, client) {
|
|
4745
|
+
const db = await resolveClient(client);
|
|
4746
|
+
let count = 0;
|
|
4747
|
+
for (const row of rows) {
|
|
4748
|
+
try {
|
|
4749
|
+
await insertOntologyForMemory(row, db);
|
|
4750
|
+
count++;
|
|
4751
|
+
} catch {
|
|
4752
|
+
}
|
|
4753
|
+
}
|
|
4754
|
+
return count;
|
|
4755
|
+
}
|
|
4756
|
+
var init_agentic_ontology = __esm({
|
|
4757
|
+
"src/lib/agentic-ontology.ts"() {
|
|
4758
|
+
"use strict";
|
|
4759
|
+
}
|
|
4760
|
+
});
|
|
4761
|
+
|
|
4273
4762
|
// src/lib/store.ts
|
|
4274
4763
|
var store_exports = {};
|
|
4275
4764
|
__export(store_exports, {
|
|
@@ -4613,6 +5102,11 @@ async function flushBatch() {
|
|
|
4613
5102
|
await insertMemoryCardsForBatch2(batch);
|
|
4614
5103
|
} catch {
|
|
4615
5104
|
}
|
|
5105
|
+
try {
|
|
5106
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
5107
|
+
await insertOntologyForBatch2(batch);
|
|
5108
|
+
} catch {
|
|
5109
|
+
}
|
|
4616
5110
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
4617
5111
|
_pendingRecords.splice(0, batch.length);
|
|
4618
5112
|
try {
|