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