@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
|
@@ -236,6 +236,10 @@ async function loadConfig() {
|
|
|
236
236
|
if (config.dbPath.startsWith("~")) {
|
|
237
237
|
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
238
238
|
}
|
|
239
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
240
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
241
|
+
config.dbPath = envDbPath;
|
|
242
|
+
}
|
|
239
243
|
return config;
|
|
240
244
|
} catch {
|
|
241
245
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
@@ -256,7 +260,15 @@ function loadConfigSync() {
|
|
|
256
260
|
normalizeSessionLifecycle(migratedCfg);
|
|
257
261
|
normalizeAutoUpdate(migratedCfg);
|
|
258
262
|
normalizeOrchestration(migratedCfg);
|
|
259
|
-
|
|
263
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
264
|
+
if (config.dbPath.startsWith("~")) {
|
|
265
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
266
|
+
}
|
|
267
|
+
const envDbPath = path.join(dir, "memories.db");
|
|
268
|
+
if (process.env.EXE_OS_DIR && config.dbPath !== envDbPath && !existsSync2(config.dbPath) && existsSync2(envDbPath)) {
|
|
269
|
+
config.dbPath = envDbPath;
|
|
270
|
+
}
|
|
271
|
+
return config;
|
|
260
272
|
} catch {
|
|
261
273
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
262
274
|
}
|
|
@@ -1734,6 +1746,9 @@ function getClient() {
|
|
|
1734
1746
|
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
1735
1747
|
return _daemonClient;
|
|
1736
1748
|
}
|
|
1749
|
+
if (!_resilientClient) {
|
|
1750
|
+
return _adapterClient;
|
|
1751
|
+
}
|
|
1737
1752
|
return _resilientClient;
|
|
1738
1753
|
}
|
|
1739
1754
|
async function initDaemonClient() {
|
|
@@ -2766,6 +2781,127 @@ async function ensureSchema() {
|
|
|
2766
2781
|
VALUES (new.rowid, new.content, new.subject, new.predicate, new.object);
|
|
2767
2782
|
END;
|
|
2768
2783
|
`);
|
|
2784
|
+
await client.executeMultiple(`
|
|
2785
|
+
CREATE TABLE IF NOT EXISTS agent_sessions (
|
|
2786
|
+
id TEXT PRIMARY KEY,
|
|
2787
|
+
agent_id TEXT NOT NULL,
|
|
2788
|
+
project_name TEXT,
|
|
2789
|
+
started_at TEXT NOT NULL,
|
|
2790
|
+
last_event_at TEXT NOT NULL,
|
|
2791
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
2792
|
+
properties TEXT DEFAULT '{}'
|
|
2793
|
+
);
|
|
2794
|
+
|
|
2795
|
+
CREATE INDEX IF NOT EXISTS idx_agent_sessions_agent_time
|
|
2796
|
+
ON agent_sessions(agent_id, started_at);
|
|
2797
|
+
|
|
2798
|
+
CREATE TABLE IF NOT EXISTS agent_goals (
|
|
2799
|
+
id TEXT PRIMARY KEY,
|
|
2800
|
+
statement TEXT NOT NULL,
|
|
2801
|
+
owner_agent_id TEXT,
|
|
2802
|
+
project_name TEXT,
|
|
2803
|
+
status TEXT NOT NULL DEFAULT 'open',
|
|
2804
|
+
priority INTEGER NOT NULL DEFAULT 5,
|
|
2805
|
+
success_criteria TEXT,
|
|
2806
|
+
parent_goal_id TEXT,
|
|
2807
|
+
due_at TEXT,
|
|
2808
|
+
achieved_at TEXT,
|
|
2809
|
+
supersedes_id TEXT,
|
|
2810
|
+
created_at TEXT NOT NULL,
|
|
2811
|
+
updated_at TEXT NOT NULL,
|
|
2812
|
+
source_memory_id TEXT
|
|
2813
|
+
);
|
|
2814
|
+
|
|
2815
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goals_project_status
|
|
2816
|
+
ON agent_goals(project_name, status, priority);
|
|
2817
|
+
|
|
2818
|
+
CREATE TABLE IF NOT EXISTS agent_events (
|
|
2819
|
+
id TEXT PRIMARY KEY,
|
|
2820
|
+
event_type TEXT NOT NULL,
|
|
2821
|
+
occurred_at TEXT NOT NULL,
|
|
2822
|
+
sequence_index INTEGER NOT NULL,
|
|
2823
|
+
actor_agent_id TEXT,
|
|
2824
|
+
agent_role TEXT,
|
|
2825
|
+
project_name TEXT,
|
|
2826
|
+
session_id TEXT,
|
|
2827
|
+
task_id TEXT,
|
|
2828
|
+
goal_id TEXT,
|
|
2829
|
+
parent_event_id TEXT,
|
|
2830
|
+
intention TEXT,
|
|
2831
|
+
outcome TEXT,
|
|
2832
|
+
evidence_memory_id TEXT,
|
|
2833
|
+
impact TEXT,
|
|
2834
|
+
payload TEXT DEFAULT '{}',
|
|
2835
|
+
created_at TEXT NOT NULL
|
|
2836
|
+
);
|
|
2837
|
+
|
|
2838
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_time
|
|
2839
|
+
ON agent_events(occurred_at, sequence_index);
|
|
2840
|
+
|
|
2841
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_session_seq
|
|
2842
|
+
ON agent_events(session_id, sequence_index);
|
|
2843
|
+
|
|
2844
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_goal_time
|
|
2845
|
+
ON agent_events(goal_id, occurred_at);
|
|
2846
|
+
|
|
2847
|
+
CREATE INDEX IF NOT EXISTS idx_agent_events_memory
|
|
2848
|
+
ON agent_events(evidence_memory_id);
|
|
2849
|
+
|
|
2850
|
+
CREATE TABLE IF NOT EXISTS agent_goal_links (
|
|
2851
|
+
id TEXT PRIMARY KEY,
|
|
2852
|
+
goal_id TEXT NOT NULL,
|
|
2853
|
+
link_type TEXT NOT NULL,
|
|
2854
|
+
target_id TEXT NOT NULL,
|
|
2855
|
+
target_type TEXT NOT NULL,
|
|
2856
|
+
created_at TEXT NOT NULL
|
|
2857
|
+
);
|
|
2858
|
+
|
|
2859
|
+
CREATE INDEX IF NOT EXISTS idx_agent_goal_links_goal
|
|
2860
|
+
ON agent_goal_links(goal_id, target_type);
|
|
2861
|
+
|
|
2862
|
+
CREATE TABLE IF NOT EXISTS agent_semantic_labels (
|
|
2863
|
+
id TEXT PRIMARY KEY,
|
|
2864
|
+
source_memory_id TEXT NOT NULL,
|
|
2865
|
+
event_id TEXT,
|
|
2866
|
+
labeler TEXT NOT NULL,
|
|
2867
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
2868
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
2869
|
+
labels TEXT NOT NULL,
|
|
2870
|
+
created_at TEXT NOT NULL,
|
|
2871
|
+
updated_at TEXT NOT NULL
|
|
2872
|
+
);
|
|
2873
|
+
|
|
2874
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_memory
|
|
2875
|
+
ON agent_semantic_labels(source_memory_id, labeler);
|
|
2876
|
+
|
|
2877
|
+
CREATE INDEX IF NOT EXISTS idx_agent_semantic_labels_event
|
|
2878
|
+
ON agent_semantic_labels(event_id);
|
|
2879
|
+
|
|
2880
|
+
CREATE TABLE IF NOT EXISTS agent_reflection_checkpoints (
|
|
2881
|
+
id TEXT PRIMARY KEY,
|
|
2882
|
+
project_name TEXT,
|
|
2883
|
+
session_id TEXT,
|
|
2884
|
+
window_start_at TEXT NOT NULL,
|
|
2885
|
+
window_end_at TEXT NOT NULL,
|
|
2886
|
+
event_count INTEGER NOT NULL DEFAULT 0,
|
|
2887
|
+
goal_count INTEGER NOT NULL DEFAULT 0,
|
|
2888
|
+
success_count INTEGER NOT NULL DEFAULT 0,
|
|
2889
|
+
failure_count INTEGER NOT NULL DEFAULT 0,
|
|
2890
|
+
risk_count INTEGER NOT NULL DEFAULT 0,
|
|
2891
|
+
summary TEXT NOT NULL,
|
|
2892
|
+
learnings TEXT NOT NULL DEFAULT '[]',
|
|
2893
|
+
next_actions TEXT NOT NULL DEFAULT '[]',
|
|
2894
|
+
evidence_event_ids TEXT NOT NULL DEFAULT '[]',
|
|
2895
|
+
confidence REAL NOT NULL DEFAULT 0,
|
|
2896
|
+
created_at TEXT NOT NULL
|
|
2897
|
+
);
|
|
2898
|
+
|
|
2899
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_project_time
|
|
2900
|
+
ON agent_reflection_checkpoints(project_name, window_end_at);
|
|
2901
|
+
|
|
2902
|
+
CREATE INDEX IF NOT EXISTS idx_agent_reflection_session_time
|
|
2903
|
+
ON agent_reflection_checkpoints(session_id, window_end_at);
|
|
2904
|
+
`);
|
|
2769
2905
|
try {
|
|
2770
2906
|
await client.execute({
|
|
2771
2907
|
sql: `ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3`,
|
|
@@ -2915,7 +3051,7 @@ var init_database = __esm({
|
|
|
2915
3051
|
|
|
2916
3052
|
// src/lib/keychain.ts
|
|
2917
3053
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
2918
|
-
import { existsSync as existsSync6 } from "fs";
|
|
3054
|
+
import { existsSync as existsSync6, statSync as statSync2 } from "fs";
|
|
2919
3055
|
import { execSync as execSync2 } from "child_process";
|
|
2920
3056
|
import path6 from "path";
|
|
2921
3057
|
import os5 from "os";
|
|
@@ -2925,29 +3061,65 @@ function getKeyDir() {
|
|
|
2925
3061
|
function getKeyPath() {
|
|
2926
3062
|
return path6.join(getKeyDir(), "master.key");
|
|
2927
3063
|
}
|
|
2928
|
-
function
|
|
3064
|
+
function nativeKeychainAllowed() {
|
|
3065
|
+
return process.env.EXE_OS_DISABLE_NATIVE_KEYCHAIN !== "1";
|
|
3066
|
+
}
|
|
3067
|
+
function linuxSecretAvailable() {
|
|
3068
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3069
|
+
if (process.platform !== "linux") return false;
|
|
3070
|
+
if (linuxSecretAvailability !== null) return linuxSecretAvailability;
|
|
3071
|
+
try {
|
|
3072
|
+
execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
|
|
3073
|
+
} catch {
|
|
3074
|
+
linuxSecretAvailability = false;
|
|
3075
|
+
return false;
|
|
3076
|
+
}
|
|
3077
|
+
try {
|
|
3078
|
+
execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
|
|
3079
|
+
linuxSecretAvailability = true;
|
|
3080
|
+
} catch {
|
|
3081
|
+
linuxSecretAvailability = false;
|
|
3082
|
+
}
|
|
3083
|
+
return linuxSecretAvailability;
|
|
3084
|
+
}
|
|
3085
|
+
function isRootOnlyTrustedServerKeyFile(keyPath) {
|
|
3086
|
+
if (process.platform !== "linux") return false;
|
|
3087
|
+
try {
|
|
3088
|
+
const uid = typeof os5.userInfo().uid === "number" ? os5.userInfo().uid : -1;
|
|
3089
|
+
const st = statSync2(keyPath);
|
|
3090
|
+
if (!st.isFile() || (st.mode & 63) !== 0) return false;
|
|
3091
|
+
if (uid === 0) return true;
|
|
3092
|
+
const exeOsDir = process.env.EXE_OS_DIR;
|
|
3093
|
+
return Boolean(exeOsDir && path6.resolve(keyPath).startsWith(path6.resolve(exeOsDir) + path6.sep));
|
|
3094
|
+
} catch {
|
|
3095
|
+
return false;
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
function macKeychainGet(service = SERVICE) {
|
|
3099
|
+
if (!nativeKeychainAllowed()) return null;
|
|
2929
3100
|
if (process.platform !== "darwin") return null;
|
|
2930
3101
|
try {
|
|
2931
3102
|
return execSync2(
|
|
2932
|
-
`security find-generic-password -s "${
|
|
3103
|
+
`security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
2933
3104
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
2934
3105
|
).trim();
|
|
2935
3106
|
} catch {
|
|
2936
3107
|
return null;
|
|
2937
3108
|
}
|
|
2938
3109
|
}
|
|
2939
|
-
function macKeychainSet(value) {
|
|
3110
|
+
function macKeychainSet(value, service = SERVICE) {
|
|
3111
|
+
if (!nativeKeychainAllowed()) return false;
|
|
2940
3112
|
if (process.platform !== "darwin") return false;
|
|
2941
3113
|
try {
|
|
2942
3114
|
try {
|
|
2943
3115
|
execSync2(
|
|
2944
|
-
`security delete-generic-password -s "${
|
|
3116
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
2945
3117
|
{ timeout: 5e3 }
|
|
2946
3118
|
);
|
|
2947
3119
|
} catch {
|
|
2948
3120
|
}
|
|
2949
3121
|
execSync2(
|
|
2950
|
-
`security add-generic-password -s "${
|
|
3122
|
+
`security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
|
|
2951
3123
|
{ timeout: 5e3 }
|
|
2952
3124
|
);
|
|
2953
3125
|
return true;
|
|
@@ -2955,22 +3127,48 @@ function macKeychainSet(value) {
|
|
|
2955
3127
|
return false;
|
|
2956
3128
|
}
|
|
2957
3129
|
}
|
|
2958
|
-
function
|
|
2959
|
-
if (
|
|
3130
|
+
function macKeychainDelete(service = SERVICE) {
|
|
3131
|
+
if (!nativeKeychainAllowed()) return false;
|
|
3132
|
+
if (process.platform !== "darwin") return false;
|
|
3133
|
+
try {
|
|
3134
|
+
execSync2(
|
|
3135
|
+
`security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3136
|
+
{ timeout: 5e3 }
|
|
3137
|
+
);
|
|
3138
|
+
return true;
|
|
3139
|
+
} catch {
|
|
3140
|
+
return false;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
function linuxSecretGet(service = SERVICE) {
|
|
3144
|
+
if (!linuxSecretAvailable()) return null;
|
|
2960
3145
|
try {
|
|
2961
3146
|
return execSync2(
|
|
2962
|
-
`secret-tool lookup service "${
|
|
3147
|
+
`secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
2963
3148
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
2964
3149
|
).trim();
|
|
2965
3150
|
} catch {
|
|
2966
3151
|
return null;
|
|
2967
3152
|
}
|
|
2968
3153
|
}
|
|
2969
|
-
function linuxSecretSet(value) {
|
|
3154
|
+
function linuxSecretSet(value, service = SERVICE) {
|
|
3155
|
+
if (!linuxSecretAvailable()) return false;
|
|
3156
|
+
try {
|
|
3157
|
+
execSync2(
|
|
3158
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3159
|
+
{ timeout: 5e3 }
|
|
3160
|
+
);
|
|
3161
|
+
return true;
|
|
3162
|
+
} catch {
|
|
3163
|
+
return false;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
function linuxSecretDelete(service = SERVICE) {
|
|
3167
|
+
if (!nativeKeychainAllowed()) return false;
|
|
2970
3168
|
if (process.platform !== "linux") return false;
|
|
2971
3169
|
try {
|
|
2972
3170
|
execSync2(
|
|
2973
|
-
`
|
|
3171
|
+
`secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
|
|
2974
3172
|
{ timeout: 5e3 }
|
|
2975
3173
|
);
|
|
2976
3174
|
return true;
|
|
@@ -2979,6 +3177,7 @@ function linuxSecretSet(value) {
|
|
|
2979
3177
|
}
|
|
2980
3178
|
}
|
|
2981
3179
|
async function tryKeytar() {
|
|
3180
|
+
if (!nativeKeychainAllowed()) return null;
|
|
2982
3181
|
try {
|
|
2983
3182
|
return await import("keytar");
|
|
2984
3183
|
} catch {
|
|
@@ -3052,7 +3251,19 @@ async function writeMachineBoundFileFallback(b64) {
|
|
|
3052
3251
|
return "plaintext";
|
|
3053
3252
|
}
|
|
3054
3253
|
async function getMasterKey() {
|
|
3055
|
-
|
|
3254
|
+
let nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
3255
|
+
if (!nativeValue) {
|
|
3256
|
+
const legacyValue = macKeychainGet(LEGACY_SERVICE) ?? linuxSecretGet(LEGACY_SERVICE);
|
|
3257
|
+
if (legacyValue) {
|
|
3258
|
+
const migrated = macKeychainSet(legacyValue) || linuxSecretSet(legacyValue);
|
|
3259
|
+
if (migrated) {
|
|
3260
|
+
macKeychainDelete(LEGACY_SERVICE);
|
|
3261
|
+
linuxSecretDelete(LEGACY_SERVICE);
|
|
3262
|
+
process.stderr.write("[keychain] Migrated keychain service from exe-mem to exe-os.\n");
|
|
3263
|
+
}
|
|
3264
|
+
nativeValue = legacyValue;
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3056
3267
|
if (nativeValue) {
|
|
3057
3268
|
return Buffer.from(nativeValue, "base64");
|
|
3058
3269
|
}
|
|
@@ -3060,12 +3271,17 @@ async function getMasterKey() {
|
|
|
3060
3271
|
if (keytar) {
|
|
3061
3272
|
try {
|
|
3062
3273
|
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
3063
|
-
|
|
3064
|
-
|
|
3274
|
+
const legacyKeytarValue = keytarValue ?? await keytar.getPassword(LEGACY_SERVICE, ACCOUNT);
|
|
3275
|
+
if (legacyKeytarValue) {
|
|
3276
|
+
const migrated = macKeychainSet(legacyKeytarValue) || linuxSecretSet(legacyKeytarValue);
|
|
3065
3277
|
if (migrated) {
|
|
3066
3278
|
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
3279
|
+
try {
|
|
3280
|
+
await keytar.deletePassword(LEGACY_SERVICE, ACCOUNT);
|
|
3281
|
+
} catch {
|
|
3282
|
+
}
|
|
3067
3283
|
}
|
|
3068
|
-
return Buffer.from(
|
|
3284
|
+
return Buffer.from(legacyKeytarValue, "base64");
|
|
3069
3285
|
}
|
|
3070
3286
|
} catch {
|
|
3071
3287
|
}
|
|
@@ -3090,7 +3306,7 @@ async function getMasterKey() {
|
|
|
3090
3306
|
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
3091
3307
|
if (!decrypted) {
|
|
3092
3308
|
process.stderr.write(
|
|
3093
|
-
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os
|
|
3309
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase during setup: exe-os setup\n"
|
|
3094
3310
|
);
|
|
3095
3311
|
return null;
|
|
3096
3312
|
}
|
|
@@ -3099,6 +3315,9 @@ async function getMasterKey() {
|
|
|
3099
3315
|
b64Value = content;
|
|
3100
3316
|
}
|
|
3101
3317
|
const key = Buffer.from(b64Value, "base64");
|
|
3318
|
+
if (!content.startsWith(ENCRYPTED_PREFIX) && isRootOnlyTrustedServerKeyFile(keyPath)) {
|
|
3319
|
+
return key;
|
|
3320
|
+
}
|
|
3102
3321
|
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
3103
3322
|
if (migrated) {
|
|
3104
3323
|
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
@@ -3126,12 +3345,14 @@ async function getMasterKey() {
|
|
|
3126
3345
|
return null;
|
|
3127
3346
|
}
|
|
3128
3347
|
}
|
|
3129
|
-
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
3348
|
+
var SERVICE, LEGACY_SERVICE, ACCOUNT, linuxSecretAvailability, ENCRYPTED_PREFIX;
|
|
3130
3349
|
var init_keychain = __esm({
|
|
3131
3350
|
"src/lib/keychain.ts"() {
|
|
3132
3351
|
"use strict";
|
|
3133
|
-
SERVICE = "exe-
|
|
3352
|
+
SERVICE = "exe-os";
|
|
3353
|
+
LEGACY_SERVICE = "exe-mem";
|
|
3134
3354
|
ACCOUNT = "master-key";
|
|
3355
|
+
linuxSecretAvailability = null;
|
|
3135
3356
|
ENCRYPTED_PREFIX = "enc:";
|
|
3136
3357
|
}
|
|
3137
3358
|
});
|
|
@@ -3401,7 +3622,7 @@ __export(shard_manager_exports, {
|
|
|
3401
3622
|
shardExists: () => shardExists
|
|
3402
3623
|
});
|
|
3403
3624
|
import path7 from "path";
|
|
3404
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as
|
|
3625
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync3 } from "fs";
|
|
3405
3626
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3406
3627
|
function initShardManager(encryptionKey) {
|
|
3407
3628
|
_encryptionKey = encryptionKey;
|
|
@@ -3465,7 +3686,7 @@ async function auditShardHealth(options = {}) {
|
|
|
3465
3686
|
const shards = [];
|
|
3466
3687
|
for (const name of names) {
|
|
3467
3688
|
const dbPath = path7.join(SHARDS_DIR, `${name}.db`);
|
|
3468
|
-
const stat =
|
|
3689
|
+
const stat = statSync3(dbPath);
|
|
3469
3690
|
const item = {
|
|
3470
3691
|
name,
|
|
3471
3692
|
path: dbPath,
|
|
@@ -3718,7 +3939,7 @@ async function getReadyShardClient(projectName) {
|
|
|
3718
3939
|
_shardLastAccess.delete(safeName);
|
|
3719
3940
|
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3720
3941
|
if (existsSync7(dbPath)) {
|
|
3721
|
-
const stat =
|
|
3942
|
+
const stat = statSync3(dbPath);
|
|
3722
3943
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3723
3944
|
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3724
3945
|
renameSync3(dbPath, archivedPath);
|
|
@@ -4225,6 +4446,274 @@ var init_memory_cards = __esm({
|
|
|
4225
4446
|
}
|
|
4226
4447
|
});
|
|
4227
4448
|
|
|
4449
|
+
// src/lib/agentic-ontology.ts
|
|
4450
|
+
var agentic_ontology_exports = {};
|
|
4451
|
+
__export(agentic_ontology_exports, {
|
|
4452
|
+
clean: () => clean,
|
|
4453
|
+
extractGoalCandidates: () => extractGoalCandidates,
|
|
4454
|
+
inferIntention: () => inferIntention,
|
|
4455
|
+
inferOntologyEventType: () => inferOntologyEventType,
|
|
4456
|
+
inferOutcome: () => inferOutcome,
|
|
4457
|
+
inferSemanticLabel: () => inferSemanticLabel,
|
|
4458
|
+
insertOntologyForBatch: () => insertOntologyForBatch,
|
|
4459
|
+
insertOntologyForMemory: () => insertOntologyForMemory,
|
|
4460
|
+
ontologyPayload: () => ontologyPayload,
|
|
4461
|
+
stableId: () => stableId2
|
|
4462
|
+
});
|
|
4463
|
+
import { createHash as createHash3 } from "crypto";
|
|
4464
|
+
function stableId2(...parts) {
|
|
4465
|
+
return createHash3("sha256").update(parts.map((p) => String(p ?? "")).join("::")).digest("hex").slice(0, 32);
|
|
4466
|
+
}
|
|
4467
|
+
function clean(text, max = 240) {
|
|
4468
|
+
return text.replace(/\u0000/g, "").replace(/```[\s\S]*?```/g, " ").replace(/\s+/g, " ").trim().slice(0, max);
|
|
4469
|
+
}
|
|
4470
|
+
function inferOntologyEventType(row) {
|
|
4471
|
+
const lower = row.raw_text.toLowerCase();
|
|
4472
|
+
if (row.has_error) return "error";
|
|
4473
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published)\b/.test(lower)) return "milestone";
|
|
4474
|
+
if (/\b(blocked|failed|error|bug|regression|broken)\b/.test(lower)) return "problem";
|
|
4475
|
+
if (/\b(decided|decision|adr|we chose|approved|rejected)\b/.test(lower)) return "decision";
|
|
4476
|
+
if (/\b(goal|need to|we need|want to|trying to|objective)\b/.test(lower)) return "goal_signal";
|
|
4477
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) return "tool_action";
|
|
4478
|
+
if (row.tool_name.startsWith("memory_card")) return "memory_card";
|
|
4479
|
+
return "memory_observation";
|
|
4480
|
+
}
|
|
4481
|
+
function inferIntention(row) {
|
|
4482
|
+
if (row.intent) return clean(row.intent, 220);
|
|
4483
|
+
const text = clean(row.raw_text, 1e3);
|
|
4484
|
+
const patterns = [
|
|
4485
|
+
/(?: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,
|
|
4486
|
+
/(?:so that|in order to)\s+([^.!?\n]{8,220})/i,
|
|
4487
|
+
/(?:task|plan):\s*([^.!?\n]{8,220})/i
|
|
4488
|
+
];
|
|
4489
|
+
for (const p of patterns) {
|
|
4490
|
+
const m = text.match(p);
|
|
4491
|
+
if (m?.[1]) return clean(m[1], 220);
|
|
4492
|
+
}
|
|
4493
|
+
if (["Bash", "Read", "Edit", "Write", "Grep", "Glob"].includes(row.tool_name)) {
|
|
4494
|
+
return `${row.tool_name} during ${row.project_name}`;
|
|
4495
|
+
}
|
|
4496
|
+
return null;
|
|
4497
|
+
}
|
|
4498
|
+
function inferOutcome(row) {
|
|
4499
|
+
if (row.outcome) return clean(row.outcome, 220);
|
|
4500
|
+
if (row.has_error) return "error";
|
|
4501
|
+
const lower = row.raw_text.toLowerCase();
|
|
4502
|
+
if (/\b(done|complete|completed|fixed|resolved|shipped|deployed|pushed|published|passed)\b/.test(lower)) return "success_signal";
|
|
4503
|
+
if (/\b(blocked|failed|error|regression|broken|not working|could not)\b/.test(lower)) return "failure_signal";
|
|
4504
|
+
if (/\b(warning|risk|concern|caveat)\b/.test(lower)) return "risk_signal";
|
|
4505
|
+
return null;
|
|
4506
|
+
}
|
|
4507
|
+
function extractGoalCandidates(row) {
|
|
4508
|
+
const text = clean(row.raw_text, 1600);
|
|
4509
|
+
const patterns = [
|
|
4510
|
+
/(?: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,
|
|
4511
|
+
/(?:success means|success criteria|so that)\s+([^.!?\n]{12,220})/gi
|
|
4512
|
+
];
|
|
4513
|
+
const out = [];
|
|
4514
|
+
for (const pattern of patterns) {
|
|
4515
|
+
for (const m of text.matchAll(pattern)) {
|
|
4516
|
+
const candidate = clean(m[1] ?? "", 220);
|
|
4517
|
+
if (candidate.length >= 12 && !out.some((x) => x.toLowerCase() === candidate.toLowerCase())) out.push(candidate);
|
|
4518
|
+
if (out.length >= 3) return out;
|
|
4519
|
+
}
|
|
4520
|
+
}
|
|
4521
|
+
return out;
|
|
4522
|
+
}
|
|
4523
|
+
function uniq(values, max = 6) {
|
|
4524
|
+
const out = [];
|
|
4525
|
+
for (const value of values.map((v) => clean(v, 220)).filter(Boolean)) {
|
|
4526
|
+
if (!out.some((x) => x.toLowerCase() === value.toLowerCase())) out.push(value);
|
|
4527
|
+
if (out.length >= max) break;
|
|
4528
|
+
}
|
|
4529
|
+
return out;
|
|
4530
|
+
}
|
|
4531
|
+
function extractMatches(text, patterns, max = 5) {
|
|
4532
|
+
const out = [];
|
|
4533
|
+
for (const pattern of patterns) {
|
|
4534
|
+
for (const match of text.matchAll(pattern)) {
|
|
4535
|
+
const value = match[1] ?? match[0];
|
|
4536
|
+
if (value) out.push(value);
|
|
4537
|
+
if (out.length >= max) return uniq(out, max);
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
return uniq(out, max);
|
|
4541
|
+
}
|
|
4542
|
+
function inferSemanticLabel(row) {
|
|
4543
|
+
const text = clean(row.raw_text, 2400);
|
|
4544
|
+
const eventType = inferOntologyEventType(row);
|
|
4545
|
+
const intention = inferIntention(row);
|
|
4546
|
+
const outcome = inferOutcome(row);
|
|
4547
|
+
const goals = extractGoalCandidates(row);
|
|
4548
|
+
const milestones = extractMatches(text, [
|
|
4549
|
+
/\b(?:completed|finished|fixed|resolved|shipped|deployed|published|pushed|passed)\b([^.!?\n]{0,180})/gi,
|
|
4550
|
+
/(?:milestone|done):\s*([^.!?\n]{8,220})/gi
|
|
4551
|
+
]);
|
|
4552
|
+
const problems = extractMatches(text, [
|
|
4553
|
+
/\b(?:blocked by|failed because|bug|regression|broken|not working|error)\b([^.!?\n]{0,180})/gi,
|
|
4554
|
+
/(?:problem|issue|risk):\s*([^.!?\n]{8,220})/gi
|
|
4555
|
+
]);
|
|
4556
|
+
const decisions = extractMatches(text, [
|
|
4557
|
+
/(?:decided|decision|adr|we chose|approved|rejected)\s+([^.!?\n]{8,220})/gi
|
|
4558
|
+
]);
|
|
4559
|
+
const temporalAnchors = extractMatches(text, [
|
|
4560
|
+
/\b(\d{4}-\d{2}-\d{2}(?:[T ][0-9:.+-Z]+)?)\b/g,
|
|
4561
|
+
/\b(today|yesterday|tomorrow|this week|next week|last week|morning|afternoon|tonight)\b/gi
|
|
4562
|
+
], 8);
|
|
4563
|
+
const nextActions = extractMatches(text, [
|
|
4564
|
+
/(?:next|todo|follow[- ]?up|remaining|need to)\s*:?\s*([^.!?\n]{8,220})/gi
|
|
4565
|
+
]);
|
|
4566
|
+
const actors = uniq([
|
|
4567
|
+
row.agent_id,
|
|
4568
|
+
...extractMatches(text, [/\b(?:agent|employee|owner|assignee)[:= ]+([a-zA-Z][a-zA-Z0-9_-]{1,40})/gi], 5)
|
|
4569
|
+
], 6);
|
|
4570
|
+
const successSignals = milestones.length ? milestones : outcome === "success_signal" ? [clean(text, 180)] : [];
|
|
4571
|
+
const failureSignals = problems.length ? problems : outcome === "failure_signal" || row.has_error ? [clean(text, 180)] : [];
|
|
4572
|
+
const impact = successSignals.length && failureSignals.length ? "mixed" : failureSignals.length ? "negative" : successSignals.length ? "positive" : "neutral";
|
|
4573
|
+
const signalCount = goals.length + milestones.length + problems.length + decisions.length + nextActions.length;
|
|
4574
|
+
return {
|
|
4575
|
+
labeler: "deterministic",
|
|
4576
|
+
schemaVersion: 1,
|
|
4577
|
+
eventType,
|
|
4578
|
+
intention,
|
|
4579
|
+
outcome,
|
|
4580
|
+
impact,
|
|
4581
|
+
confidence: Math.min(0.95, 0.45 + signalCount * 0.08 + (intention ? 0.1 : 0) + (outcome ? 0.1 : 0)),
|
|
4582
|
+
goals,
|
|
4583
|
+
milestones,
|
|
4584
|
+
problems,
|
|
4585
|
+
decisions,
|
|
4586
|
+
actors,
|
|
4587
|
+
temporalAnchors,
|
|
4588
|
+
successSignals,
|
|
4589
|
+
failureSignals,
|
|
4590
|
+
nextActions,
|
|
4591
|
+
summary: clean(text, 280)
|
|
4592
|
+
};
|
|
4593
|
+
}
|
|
4594
|
+
function ontologyPayload(row) {
|
|
4595
|
+
const semantic = inferSemanticLabel(row);
|
|
4596
|
+
return {
|
|
4597
|
+
tool_name: row.tool_name,
|
|
4598
|
+
memory_version: row.version ?? null,
|
|
4599
|
+
domain: row.domain ?? null,
|
|
4600
|
+
trajectory: row.trajectory ? safeJson(row.trajectory) : null,
|
|
4601
|
+
semantic
|
|
4602
|
+
};
|
|
4603
|
+
}
|
|
4604
|
+
function safeJson(value) {
|
|
4605
|
+
try {
|
|
4606
|
+
return JSON.parse(value);
|
|
4607
|
+
} catch {
|
|
4608
|
+
return value.slice(0, 1e3);
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
4611
|
+
async function resolveClient(client) {
|
|
4612
|
+
if (client) return client;
|
|
4613
|
+
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
4614
|
+
return getClient2();
|
|
4615
|
+
}
|
|
4616
|
+
async function insertOntologyForMemory(row, client) {
|
|
4617
|
+
const db = await resolveClient(client);
|
|
4618
|
+
const occurredAt = row.timestamp;
|
|
4619
|
+
const sequence = Number(row.version ?? 0) || Math.floor(new Date(occurredAt).getTime() / 1e3);
|
|
4620
|
+
const eventType = inferOntologyEventType(row);
|
|
4621
|
+
const intention = inferIntention(row);
|
|
4622
|
+
const outcome = inferOutcome(row);
|
|
4623
|
+
const eventId = stableId2("event", row.id);
|
|
4624
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4625
|
+
await db.execute({
|
|
4626
|
+
sql: `INSERT INTO agent_sessions (id, agent_id, project_name, started_at, last_event_at, event_count, properties)
|
|
4627
|
+
VALUES (?, ?, ?, ?, ?, 1, ?)
|
|
4628
|
+
ON CONFLICT(id) DO UPDATE SET last_event_at = MAX(last_event_at, excluded.last_event_at),
|
|
4629
|
+
event_count = event_count + 1`,
|
|
4630
|
+
args: [row.session_id, row.agent_id, row.project_name, occurredAt, occurredAt, JSON.stringify({ agent_role: row.agent_role })]
|
|
4631
|
+
});
|
|
4632
|
+
await db.execute({
|
|
4633
|
+
sql: `INSERT OR IGNORE INTO agent_events
|
|
4634
|
+
(id, event_type, occurred_at, sequence_index, actor_agent_id, agent_role, project_name,
|
|
4635
|
+
session_id, task_id, goal_id, parent_event_id, intention, outcome, evidence_memory_id,
|
|
4636
|
+
impact, payload, created_at)
|
|
4637
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, ?, ?, ?, ?, ?, ?)`,
|
|
4638
|
+
args: [
|
|
4639
|
+
eventId,
|
|
4640
|
+
eventType,
|
|
4641
|
+
occurredAt,
|
|
4642
|
+
sequence,
|
|
4643
|
+
row.agent_id,
|
|
4644
|
+
row.agent_role,
|
|
4645
|
+
row.project_name,
|
|
4646
|
+
row.session_id,
|
|
4647
|
+
row.task_id ?? null,
|
|
4648
|
+
intention,
|
|
4649
|
+
outcome,
|
|
4650
|
+
row.id,
|
|
4651
|
+
row.has_error ? "negative" : outcome === "success_signal" ? "positive" : "neutral",
|
|
4652
|
+
JSON.stringify(ontologyPayload(row)),
|
|
4653
|
+
now
|
|
4654
|
+
]
|
|
4655
|
+
});
|
|
4656
|
+
const semantic = inferSemanticLabel(row);
|
|
4657
|
+
await db.execute({
|
|
4658
|
+
sql: `INSERT INTO agent_semantic_labels
|
|
4659
|
+
(id, source_memory_id, event_id, labeler, schema_version, confidence, labels, created_at, updated_at)
|
|
4660
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
4661
|
+
ON CONFLICT(id) DO UPDATE SET confidence = excluded.confidence,
|
|
4662
|
+
labels = excluded.labels, updated_at = excluded.updated_at`,
|
|
4663
|
+
args: [
|
|
4664
|
+
stableId2("semantic", row.id, semantic.labeler, semantic.schemaVersion),
|
|
4665
|
+
row.id,
|
|
4666
|
+
eventId,
|
|
4667
|
+
semantic.labeler,
|
|
4668
|
+
semantic.schemaVersion,
|
|
4669
|
+
semantic.confidence,
|
|
4670
|
+
JSON.stringify(semantic),
|
|
4671
|
+
now,
|
|
4672
|
+
now
|
|
4673
|
+
]
|
|
4674
|
+
});
|
|
4675
|
+
for (const statement of extractGoalCandidates(row)) {
|
|
4676
|
+
const goalId = stableId2("goal", row.project_name, statement.toLowerCase());
|
|
4677
|
+
await db.execute({
|
|
4678
|
+
sql: `INSERT INTO agent_goals
|
|
4679
|
+
(id, statement, owner_agent_id, project_name, status, priority, success_criteria,
|
|
4680
|
+
parent_goal_id, due_at, achieved_at, supersedes_id, created_at, updated_at, source_memory_id)
|
|
4681
|
+
VALUES (?, ?, ?, ?, 'open', 5, NULL, NULL, NULL, NULL, NULL, ?, ?, ?)
|
|
4682
|
+
ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at`,
|
|
4683
|
+
args: [goalId, statement, row.agent_id, row.project_name, now, now, row.id]
|
|
4684
|
+
});
|
|
4685
|
+
await db.execute({
|
|
4686
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
4687
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
4688
|
+
VALUES (?, ?, 'evidence', ?, 'memory', ?)`,
|
|
4689
|
+
args: [stableId2("goal_link", goalId, row.id, "memory"), goalId, row.id, now]
|
|
4690
|
+
});
|
|
4691
|
+
await db.execute({
|
|
4692
|
+
sql: `INSERT OR IGNORE INTO agent_goal_links
|
|
4693
|
+
(id, goal_id, link_type, target_id, target_type, created_at)
|
|
4694
|
+
VALUES (?, ?, 'event', ?, 'event', ?)`,
|
|
4695
|
+
args: [stableId2("goal_link", goalId, eventId, "event"), goalId, eventId, now]
|
|
4696
|
+
});
|
|
4697
|
+
}
|
|
4698
|
+
}
|
|
4699
|
+
async function insertOntologyForBatch(rows, client) {
|
|
4700
|
+
const db = await resolveClient(client);
|
|
4701
|
+
let count = 0;
|
|
4702
|
+
for (const row of rows) {
|
|
4703
|
+
try {
|
|
4704
|
+
await insertOntologyForMemory(row, db);
|
|
4705
|
+
count++;
|
|
4706
|
+
} catch {
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
return count;
|
|
4710
|
+
}
|
|
4711
|
+
var init_agentic_ontology = __esm({
|
|
4712
|
+
"src/lib/agentic-ontology.ts"() {
|
|
4713
|
+
"use strict";
|
|
4714
|
+
}
|
|
4715
|
+
});
|
|
4716
|
+
|
|
4228
4717
|
// src/lib/store.ts
|
|
4229
4718
|
var store_exports = {};
|
|
4230
4719
|
__export(store_exports, {
|
|
@@ -4568,6 +5057,11 @@ async function flushBatch() {
|
|
|
4568
5057
|
await insertMemoryCardsForBatch2(batch);
|
|
4569
5058
|
} catch {
|
|
4570
5059
|
}
|
|
5060
|
+
try {
|
|
5061
|
+
const { insertOntologyForBatch: insertOntologyForBatch2 } = await Promise.resolve().then(() => (init_agentic_ontology(), agentic_ontology_exports));
|
|
5062
|
+
await insertOntologyForBatch2(batch);
|
|
5063
|
+
} catch {
|
|
5064
|
+
}
|
|
4571
5065
|
schedulePostWriteMemoryHygiene(batch.map((row) => row.id));
|
|
4572
5066
|
_pendingRecords.splice(0, batch.length);
|
|
4573
5067
|
try {
|
|
@@ -5186,7 +5680,7 @@ __export(file_grep_exports, {
|
|
|
5186
5680
|
grepProjectFiles: () => grepProjectFiles
|
|
5187
5681
|
});
|
|
5188
5682
|
import { execSync as execSync4 } from "child_process";
|
|
5189
|
-
import { readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as
|
|
5683
|
+
import { readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync4, existsSync as existsSync9 } from "fs";
|
|
5190
5684
|
import path10 from "path";
|
|
5191
5685
|
import crypto2 from "crypto";
|
|
5192
5686
|
function hasRipgrep() {
|
|
@@ -5303,7 +5797,7 @@ function grepWithNodeFs(pattern, projectRoot, patterns) {
|
|
|
5303
5797
|
for (const filePath of files.slice(0, MAX_FILES)) {
|
|
5304
5798
|
const absPath = path10.join(projectRoot, filePath);
|
|
5305
5799
|
try {
|
|
5306
|
-
const stat =
|
|
5800
|
+
const stat = statSync4(absPath);
|
|
5307
5801
|
if (stat.size > MAX_FILE_SIZE) continue;
|
|
5308
5802
|
const content = readFileSync5(absPath, "utf8");
|
|
5309
5803
|
const lines = content.split("\n");
|