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