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