@askexenow/exe-os 0.8.62 → 0.8.64
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/dist/bin/backfill-conversations.js +2 -3
- package/dist/bin/backfill-responses.js +3 -4
- package/dist/bin/backfill-vectors.js +0 -1
- package/dist/bin/cleanup-stale-review-tasks.js +0 -1
- package/dist/bin/cli.js +52 -80
- package/dist/bin/exe-assign.js +0 -1
- package/dist/bin/exe-boot.js +40 -72
- package/dist/bin/exe-cloud.js +28 -60
- package/dist/bin/exe-dispatch.js +0 -1
- package/dist/bin/exe-doctor.js +0 -1
- package/dist/bin/exe-export-behaviors.js +1 -2
- package/dist/bin/exe-forget.js +0 -1
- package/dist/bin/exe-gateway.js +16 -17
- package/dist/bin/exe-heartbeat.js +1 -2
- package/dist/bin/exe-kill.js +2 -3
- package/dist/bin/exe-launch-agent.js +1 -2
- package/dist/bin/exe-link.js +28 -66
- package/dist/bin/exe-pending-messages.js +1 -2
- package/dist/bin/exe-pending-notifications.js +0 -1
- package/dist/bin/exe-pending-reviews.js +1 -2
- package/dist/bin/exe-review.js +0 -1
- package/dist/bin/exe-search.js +2 -3
- package/dist/bin/exe-session-cleanup.js +4 -5
- package/dist/bin/exe-status.js +0 -1
- package/dist/bin/exe-team.js +0 -1
- package/dist/bin/git-sweep.js +0 -1
- package/dist/bin/graph-backfill.js +5 -6
- package/dist/bin/graph-export.js +0 -1
- package/dist/bin/scan-tasks.js +0 -1
- package/dist/bin/setup.js +34 -62
- package/dist/bin/shard-migrate.js +0 -1
- package/dist/bin/wiki-sync.js +0 -1
- package/dist/gateway/index.js +16 -17
- package/dist/hooks/bug-report-worker.js +11 -12
- package/dist/hooks/commit-complete.js +0 -1
- package/dist/hooks/error-recall.js +2 -3
- package/dist/hooks/ingest-worker.js +14 -15
- package/dist/hooks/instructions-loaded.js +0 -1
- package/dist/hooks/notification.js +0 -1
- package/dist/hooks/post-compact.js +0 -1
- package/dist/hooks/pre-compact.js +2 -3
- package/dist/hooks/pre-tool-use.js +0 -1
- package/dist/hooks/prompt-ingest-worker.js +2 -3
- package/dist/hooks/prompt-submit.js +6 -7
- package/dist/hooks/response-ingest-worker.js +2 -3
- package/dist/hooks/session-end.js +3 -4
- package/dist/hooks/session-start.js +2 -3
- package/dist/hooks/stop.js +2 -3
- package/dist/hooks/subagent-stop.js +0 -1
- package/dist/hooks/summary-worker.js +30 -62
- package/dist/index.js +7 -8
- package/dist/lib/consolidation.js +0 -1
- package/dist/lib/exe-daemon.js +33 -65
- package/dist/lib/hybrid-search.js +2 -3
- package/dist/lib/keychain.js +19 -58
- package/dist/lib/schedules.js +2 -3
- package/dist/lib/store.js +0 -1
- package/dist/mcp/server.js +29 -30
- package/dist/runtime/index.js +2 -3
- package/dist/tui/App.js +24 -56
- package/package.json +1 -1
package/dist/bin/exe-cloud.js
CHANGED
|
@@ -608,7 +608,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
608
608
|
import { existsSync } from "fs";
|
|
609
609
|
import path from "path";
|
|
610
610
|
import os from "os";
|
|
611
|
-
import crypto from "crypto";
|
|
612
611
|
var SERVICE = "exe-mem";
|
|
613
612
|
var ACCOUNT = "master-key";
|
|
614
613
|
function getKeyDir() {
|
|
@@ -662,83 +661,52 @@ async function setMasterKey(key) {
|
|
|
662
661
|
await writeFile(keyPath, b64 + "\n", "utf-8");
|
|
663
662
|
await chmod(keyPath, 384);
|
|
664
663
|
}
|
|
665
|
-
function
|
|
666
|
-
if (key.length !== 32) {
|
|
667
|
-
throw new Error(`Key must be 32 bytes, got ${key.length}`);
|
|
668
|
-
}
|
|
669
|
-
const hash = crypto.createHash("sha256").update(key).digest();
|
|
670
|
-
const checksumByte = hash[0];
|
|
671
|
-
let bits = "";
|
|
672
|
-
for (const byte of key) {
|
|
673
|
-
bits += byte.toString(2).padStart(8, "0");
|
|
674
|
-
}
|
|
675
|
-
bits += checksumByte.toString(2).padStart(8, "0");
|
|
676
|
-
const words = [];
|
|
677
|
-
let wordlist;
|
|
664
|
+
async function loadBip39() {
|
|
678
665
|
try {
|
|
679
|
-
|
|
680
|
-
wordlist = bip39.wordlists?.english ?? bip39.default?.wordlists?.english;
|
|
681
|
-
if (!wordlist) throw new Error("no wordlist");
|
|
666
|
+
return await import("bip39");
|
|
682
667
|
} catch {
|
|
683
|
-
throw new Error(
|
|
668
|
+
throw new Error(
|
|
669
|
+
"bip39 package not found. Run: npm install -g bip39\nOr reinstall exe-os: npm install -g @askexenow/exe-os"
|
|
670
|
+
);
|
|
684
671
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
672
|
+
}
|
|
673
|
+
async function exportMnemonic(key) {
|
|
674
|
+
if (key.length !== 32) {
|
|
675
|
+
throw new Error(`Key must be 32 bytes, got ${key.length}`);
|
|
688
676
|
}
|
|
689
|
-
|
|
677
|
+
const { entropyToMnemonic } = await loadBip39();
|
|
678
|
+
return entropyToMnemonic(key.toString("hex"));
|
|
690
679
|
}
|
|
691
|
-
function importMnemonic(mnemonic) {
|
|
692
|
-
const
|
|
680
|
+
async function importMnemonic(mnemonic) {
|
|
681
|
+
const trimmed = mnemonic.trim();
|
|
682
|
+
const words = trimmed.split(/\s+/);
|
|
693
683
|
if (words.length !== 24) {
|
|
694
684
|
throw new Error(`Expected 24 words, got ${words.length}`);
|
|
695
685
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
wordlist = bip39.wordlists?.english ?? bip39.default?.wordlists?.english;
|
|
700
|
-
if (!wordlist) throw new Error("no wordlist");
|
|
701
|
-
} catch {
|
|
702
|
-
throw new Error("bip39 package required. Install with: npm install bip39");
|
|
703
|
-
}
|
|
704
|
-
let bits = "";
|
|
705
|
-
for (const word of words) {
|
|
706
|
-
const index = wordlist.indexOf(word.toLowerCase());
|
|
707
|
-
if (index === -1) {
|
|
708
|
-
throw new Error(`Invalid BIP39 word: "${word}"`);
|
|
709
|
-
}
|
|
710
|
-
bits += index.toString(2).padStart(11, "0");
|
|
711
|
-
}
|
|
712
|
-
const entropyBits = bits.slice(0, 256);
|
|
713
|
-
const checksumBits = bits.slice(256, 264);
|
|
714
|
-
const key = Buffer.alloc(32);
|
|
715
|
-
for (let i = 0; i < 32; i++) {
|
|
716
|
-
key[i] = parseInt(entropyBits.slice(i * 8, (i + 1) * 8), 2);
|
|
717
|
-
}
|
|
718
|
-
const hash = crypto.createHash("sha256").update(key).digest();
|
|
719
|
-
const expectedChecksum = hash[0].toString(2).padStart(8, "0");
|
|
720
|
-
if (checksumBits !== expectedChecksum) {
|
|
721
|
-
throw new Error("Invalid mnemonic checksum");
|
|
686
|
+
const { validateMnemonic, mnemonicToEntropy } = await loadBip39();
|
|
687
|
+
if (!validateMnemonic(trimmed)) {
|
|
688
|
+
throw new Error("Invalid mnemonic \u2014 check for typos or missing words");
|
|
722
689
|
}
|
|
723
|
-
|
|
690
|
+
const entropy = mnemonicToEntropy(trimmed);
|
|
691
|
+
return Buffer.from(entropy, "hex");
|
|
724
692
|
}
|
|
725
693
|
|
|
726
694
|
// src/bin/exe-cloud.ts
|
|
727
695
|
init_config();
|
|
728
696
|
|
|
729
697
|
// src/lib/ws-auth.ts
|
|
730
|
-
import
|
|
698
|
+
import crypto from "crypto";
|
|
731
699
|
var WS_AUTH_HKDF_INFO = "exe-os-ws-auth-v1";
|
|
732
700
|
var ORG_ID_HKDF_INFO = "exe-os-org-id-v1";
|
|
733
701
|
function deriveWsAuthToken(masterKey) {
|
|
734
|
-
return Buffer.from(
|
|
702
|
+
return Buffer.from(crypto.hkdfSync("sha256", masterKey, "", WS_AUTH_HKDF_INFO, 32));
|
|
735
703
|
}
|
|
736
704
|
function deriveOrgId(masterKey) {
|
|
737
|
-
const raw = Buffer.from(
|
|
738
|
-
return
|
|
705
|
+
const raw = Buffer.from(crypto.hkdfSync("sha256", masterKey, "", ORG_ID_HKDF_INFO, 32));
|
|
706
|
+
return crypto.createHash("sha256").update(raw).digest("hex").slice(0, 32);
|
|
739
707
|
}
|
|
740
708
|
function hashAuthToken(token) {
|
|
741
|
-
return
|
|
709
|
+
return crypto.createHash("sha256").update(token).digest("hex");
|
|
742
710
|
}
|
|
743
711
|
|
|
744
712
|
// src/lib/is-main.ts
|
|
@@ -757,7 +725,7 @@ function isMainModule(importMetaUrl) {
|
|
|
757
725
|
|
|
758
726
|
// src/lib/cloud-sync.ts
|
|
759
727
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as existsSync5, readdirSync, mkdirSync as mkdirSync2, appendFileSync, unlinkSync, openSync, closeSync } from "fs";
|
|
760
|
-
import
|
|
728
|
+
import crypto3 from "crypto";
|
|
761
729
|
import path5 from "path";
|
|
762
730
|
import { homedir } from "os";
|
|
763
731
|
|
|
@@ -765,7 +733,7 @@ import { homedir } from "os";
|
|
|
765
733
|
import { createClient } from "@libsql/client";
|
|
766
734
|
|
|
767
735
|
// src/lib/crypto.ts
|
|
768
|
-
import
|
|
736
|
+
import crypto2 from "crypto";
|
|
769
737
|
|
|
770
738
|
// src/lib/compress.ts
|
|
771
739
|
import { brotliCompressSync, brotliDecompressSync, constants } from "zlib";
|
|
@@ -823,7 +791,7 @@ async function setupMode() {
|
|
|
823
791
|
if (hasPhrase.toLowerCase().startsWith("y")) {
|
|
824
792
|
const mnemonic = await ask(rl, " Paste your 24 words: ");
|
|
825
793
|
try {
|
|
826
|
-
const key = importMnemonic(mnemonic);
|
|
794
|
+
const key = await importMnemonic(mnemonic);
|
|
827
795
|
await setMasterKey(key);
|
|
828
796
|
console.log(" \u2713 Key imported.\n");
|
|
829
797
|
} catch (err) {
|
|
@@ -930,7 +898,7 @@ async function syncMode() {
|
|
|
930
898
|
process.exit(1);
|
|
931
899
|
}
|
|
932
900
|
const config = await loadConfig();
|
|
933
|
-
const mnemonic = exportMnemonic(key);
|
|
901
|
+
const mnemonic = await exportMnemonic(key);
|
|
934
902
|
console.log(BAR);
|
|
935
903
|
console.log(" EXE CLOUD \u2014 DEVICE SYNC INFO");
|
|
936
904
|
console.log(BAR);
|
package/dist/bin/exe-dispatch.js
CHANGED
|
@@ -4450,7 +4450,6 @@ import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4
|
|
|
4450
4450
|
import { existsSync as existsSync11 } from "fs";
|
|
4451
4451
|
import path14 from "path";
|
|
4452
4452
|
import os6 from "os";
|
|
4453
|
-
import crypto6 from "crypto";
|
|
4454
4453
|
var SERVICE = "exe-mem";
|
|
4455
4454
|
var ACCOUNT = "master-key";
|
|
4456
4455
|
function getKeyDir() {
|
package/dist/bin/exe-doctor.js
CHANGED
|
@@ -1651,7 +1651,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
1651
1651
|
import { existsSync } from "fs";
|
|
1652
1652
|
import path from "path";
|
|
1653
1653
|
import os from "os";
|
|
1654
|
-
import crypto from "crypto";
|
|
1655
1654
|
var SERVICE = "exe-mem";
|
|
1656
1655
|
var ACCOUNT = "master-key";
|
|
1657
1656
|
function getKeyDir() {
|
|
@@ -1543,7 +1543,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
1543
1543
|
import { existsSync } from "fs";
|
|
1544
1544
|
import path from "path";
|
|
1545
1545
|
import os from "os";
|
|
1546
|
-
import crypto from "crypto";
|
|
1547
1546
|
var SERVICE = "exe-mem";
|
|
1548
1547
|
var ACCOUNT = "master-key";
|
|
1549
1548
|
function getKeyDir() {
|
|
@@ -1873,7 +1872,7 @@ import {
|
|
|
1873
1872
|
|
|
1874
1873
|
// src/lib/behaviors.ts
|
|
1875
1874
|
init_database();
|
|
1876
|
-
import
|
|
1875
|
+
import crypto from "crypto";
|
|
1877
1876
|
async function listBehaviors(agentId2, projectName2, limit = 30) {
|
|
1878
1877
|
const client = getClient();
|
|
1879
1878
|
const result = await client.execute({
|
package/dist/bin/exe-forget.js
CHANGED
|
@@ -928,7 +928,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
928
928
|
import { existsSync } from "fs";
|
|
929
929
|
import path from "path";
|
|
930
930
|
import os from "os";
|
|
931
|
-
import crypto from "crypto";
|
|
932
931
|
function getKeyDir() {
|
|
933
932
|
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path.join(os.homedir(), ".exe-os");
|
|
934
933
|
}
|
package/dist/bin/exe-gateway.js
CHANGED
|
@@ -1923,7 +1923,6 @@ import { readFile as readFile2, writeFile as writeFile2, unlink, mkdir as mkdir2
|
|
|
1923
1923
|
import { existsSync as existsSync3 } from "fs";
|
|
1924
1924
|
import path3 from "path";
|
|
1925
1925
|
import os2 from "os";
|
|
1926
|
-
import crypto from "crypto";
|
|
1927
1926
|
function getKeyDir() {
|
|
1928
1927
|
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path3.join(os2.homedir(), ".exe-os");
|
|
1929
1928
|
}
|
|
@@ -5113,7 +5112,7 @@ var init_plan_limits = __esm({
|
|
|
5113
5112
|
});
|
|
5114
5113
|
|
|
5115
5114
|
// src/lib/notifications.ts
|
|
5116
|
-
import
|
|
5115
|
+
import crypto2 from "crypto";
|
|
5117
5116
|
import path11 from "path";
|
|
5118
5117
|
import os6 from "os";
|
|
5119
5118
|
import {
|
|
@@ -5126,7 +5125,7 @@ import {
|
|
|
5126
5125
|
async function writeNotification(notification) {
|
|
5127
5126
|
try {
|
|
5128
5127
|
const client = getClient();
|
|
5129
|
-
const id =
|
|
5128
|
+
const id = crypto2.randomUUID();
|
|
5130
5129
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5131
5130
|
await client.execute({
|
|
5132
5131
|
sql: `INSERT INTO notifications (id, agent_id, agent_role, event, project, summary, task_file, read, created_at)
|
|
@@ -5165,7 +5164,7 @@ var init_notifications = __esm({
|
|
|
5165
5164
|
});
|
|
5166
5165
|
|
|
5167
5166
|
// src/lib/session-kill-telemetry.ts
|
|
5168
|
-
import
|
|
5167
|
+
import crypto3 from "crypto";
|
|
5169
5168
|
async function recordSessionKill(input) {
|
|
5170
5169
|
try {
|
|
5171
5170
|
const client = getClient();
|
|
@@ -5175,7 +5174,7 @@ async function recordSessionKill(input) {
|
|
|
5175
5174
|
ticks_idle, estimated_tokens_saved)
|
|
5176
5175
|
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
|
5177
5176
|
args: [
|
|
5178
|
-
|
|
5177
|
+
crypto3.randomUUID(),
|
|
5179
5178
|
input.sessionName,
|
|
5180
5179
|
input.agentId,
|
|
5181
5180
|
(/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -5223,7 +5222,7 @@ var init_task_scope = __esm({
|
|
|
5223
5222
|
});
|
|
5224
5223
|
|
|
5225
5224
|
// src/lib/tasks-crud.ts
|
|
5226
|
-
import
|
|
5225
|
+
import crypto4 from "crypto";
|
|
5227
5226
|
import path12 from "path";
|
|
5228
5227
|
import { execSync as execSync4 } from "child_process";
|
|
5229
5228
|
import { mkdir as mkdir4, writeFile as writeFile4, appendFile } from "fs/promises";
|
|
@@ -5314,7 +5313,7 @@ async function resolveTask(client, identifier, scopeSession) {
|
|
|
5314
5313
|
}
|
|
5315
5314
|
async function createTaskCore(input) {
|
|
5316
5315
|
const client = getClient();
|
|
5317
|
-
const id =
|
|
5316
|
+
const id = crypto4.randomUUID();
|
|
5318
5317
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5319
5318
|
const slug = slugify(input.title);
|
|
5320
5319
|
const taskFile = input.taskFile ?? `exe/${input.assignedTo}/${slug}.md`;
|
|
@@ -6100,10 +6099,10 @@ var init_tasks_notify = __esm({
|
|
|
6100
6099
|
});
|
|
6101
6100
|
|
|
6102
6101
|
// src/lib/behaviors.ts
|
|
6103
|
-
import
|
|
6102
|
+
import crypto5 from "crypto";
|
|
6104
6103
|
async function storeBehavior(opts) {
|
|
6105
6104
|
const client = getClient();
|
|
6106
|
-
const id =
|
|
6105
|
+
const id = crypto5.randomUUID();
|
|
6107
6106
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6108
6107
|
await client.execute({
|
|
6109
6108
|
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, priority, content, active, created_at, updated_at)
|
|
@@ -6132,7 +6131,7 @@ __export(skill_learning_exports, {
|
|
|
6132
6131
|
storeTrajectory: () => storeTrajectory,
|
|
6133
6132
|
sweepTrajectories: () => sweepTrajectories
|
|
6134
6133
|
});
|
|
6135
|
-
import
|
|
6134
|
+
import crypto6 from "crypto";
|
|
6136
6135
|
async function extractTrajectory(taskId, agentId) {
|
|
6137
6136
|
const client = getClient();
|
|
6138
6137
|
const result = await client.execute({
|
|
@@ -6161,11 +6160,11 @@ async function extractTrajectory(taskId, agentId) {
|
|
|
6161
6160
|
return signature;
|
|
6162
6161
|
}
|
|
6163
6162
|
function hashSignature(signature) {
|
|
6164
|
-
return
|
|
6163
|
+
return crypto6.createHash("sha256").update(signature.join("|")).digest("hex").slice(0, 16);
|
|
6165
6164
|
}
|
|
6166
6165
|
async function storeTrajectory(opts) {
|
|
6167
6166
|
const client = getClient();
|
|
6168
|
-
const id =
|
|
6167
|
+
const id = crypto6.randomUUID();
|
|
6169
6168
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
6170
6169
|
const signatureHash = hashSignature(opts.signature);
|
|
6171
6170
|
await client.execute({
|
|
@@ -7543,10 +7542,10 @@ __export(messaging_exports, {
|
|
|
7543
7542
|
sendMessage: () => sendMessage,
|
|
7544
7543
|
setWsClientSend: () => setWsClientSend
|
|
7545
7544
|
});
|
|
7546
|
-
import
|
|
7545
|
+
import crypto7 from "crypto";
|
|
7547
7546
|
function generateUlid() {
|
|
7548
7547
|
const timestamp = Date.now().toString(36).padStart(10, "0");
|
|
7549
|
-
const random =
|
|
7548
|
+
const random = crypto7.randomBytes(10).toString("hex").slice(0, 16);
|
|
7550
7549
|
return (timestamp + random).toUpperCase();
|
|
7551
7550
|
}
|
|
7552
7551
|
function rowToMessage(row) {
|
|
@@ -8378,11 +8377,11 @@ init_crm_bridge();
|
|
|
8378
8377
|
|
|
8379
8378
|
// src/lib/pipeline-router.ts
|
|
8380
8379
|
init_database();
|
|
8381
|
-
import
|
|
8380
|
+
import crypto from "crypto";
|
|
8382
8381
|
async function sinkConversationStore(msg, agentResponse, agentName) {
|
|
8383
8382
|
try {
|
|
8384
8383
|
const client = getClient();
|
|
8385
|
-
const id =
|
|
8384
|
+
const id = crypto.randomUUID();
|
|
8386
8385
|
const mediaJson = msg.media ? JSON.stringify(msg.media) : null;
|
|
8387
8386
|
await client.execute({
|
|
8388
8387
|
sql: `INSERT INTO conversations
|
|
@@ -8432,7 +8431,7 @@ async function sinkMemory(msg, agentResponse, agentName) {
|
|
|
8432
8431
|
].filter(Boolean).join("\n");
|
|
8433
8432
|
const vector = await embed2(rawText);
|
|
8434
8433
|
await writeMemory2({
|
|
8435
|
-
id:
|
|
8434
|
+
id: crypto.randomUUID(),
|
|
8436
8435
|
agent_id: agentName ?? "gateway",
|
|
8437
8436
|
agent_role: "gateway",
|
|
8438
8437
|
session_id: `gateway-${msg.platform}`,
|
|
@@ -1627,7 +1627,7 @@ var init_employees = __esm({
|
|
|
1627
1627
|
});
|
|
1628
1628
|
|
|
1629
1629
|
// src/lib/notifications.ts
|
|
1630
|
-
import
|
|
1630
|
+
import crypto from "crypto";
|
|
1631
1631
|
import path5 from "path";
|
|
1632
1632
|
import os3 from "os";
|
|
1633
1633
|
import {
|
|
@@ -1998,7 +1998,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
1998
1998
|
import { existsSync } from "fs";
|
|
1999
1999
|
import path from "path";
|
|
2000
2000
|
import os from "os";
|
|
2001
|
-
import crypto from "crypto";
|
|
2002
2001
|
var SERVICE = "exe-mem";
|
|
2003
2002
|
var ACCOUNT = "master-key";
|
|
2004
2003
|
function getKeyDir() {
|
package/dist/bin/exe-kill.js
CHANGED
|
@@ -1546,7 +1546,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
1546
1546
|
import { existsSync } from "fs";
|
|
1547
1547
|
import path from "path";
|
|
1548
1548
|
import os from "os";
|
|
1549
|
-
import crypto from "crypto";
|
|
1550
1549
|
var SERVICE = "exe-mem";
|
|
1551
1550
|
var ACCOUNT = "master-key";
|
|
1552
1551
|
function getKeyDir() {
|
|
@@ -1864,7 +1863,7 @@ function vectorToBlob(vector) {
|
|
|
1864
1863
|
|
|
1865
1864
|
// src/lib/session-kill-telemetry.ts
|
|
1866
1865
|
init_database();
|
|
1867
|
-
import
|
|
1866
|
+
import crypto from "crypto";
|
|
1868
1867
|
async function recordSessionKill(input) {
|
|
1869
1868
|
try {
|
|
1870
1869
|
const client = getClient();
|
|
@@ -1874,7 +1873,7 @@ async function recordSessionKill(input) {
|
|
|
1874
1873
|
ticks_idle, estimated_tokens_saved)
|
|
1875
1874
|
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
|
1876
1875
|
args: [
|
|
1877
|
-
|
|
1876
|
+
crypto.randomUUID(),
|
|
1878
1877
|
input.sessionName,
|
|
1879
1878
|
input.agentId,
|
|
1880
1879
|
(/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2488,7 +2488,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
2488
2488
|
import { existsSync } from "fs";
|
|
2489
2489
|
import path from "path";
|
|
2490
2490
|
import os from "os";
|
|
2491
|
-
import crypto from "crypto";
|
|
2492
2491
|
var SERVICE = "exe-mem";
|
|
2493
2492
|
var ACCOUNT = "master-key";
|
|
2494
2493
|
function getKeyDir() {
|
|
@@ -2818,7 +2817,7 @@ import {
|
|
|
2818
2817
|
|
|
2819
2818
|
// src/lib/behaviors.ts
|
|
2820
2819
|
init_database();
|
|
2821
|
-
import
|
|
2820
|
+
import crypto from "crypto";
|
|
2822
2821
|
async function listBehaviors(agentId, projectName, limit = 30) {
|
|
2823
2822
|
const client = getClient();
|
|
2824
2823
|
const result = await client.execute({
|
package/dist/bin/exe-link.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
|
-
}) : x)(function(x) {
|
|
7
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
9
|
-
});
|
|
10
4
|
var __esm = (fn, res) => function __init() {
|
|
11
5
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
6
|
};
|
|
@@ -271,13 +265,13 @@ __export(crypto_exports, {
|
|
|
271
265
|
initSyncCrypto: () => initSyncCrypto,
|
|
272
266
|
isSyncCryptoInitialized: () => isSyncCryptoInitialized
|
|
273
267
|
});
|
|
274
|
-
import
|
|
268
|
+
import crypto from "crypto";
|
|
275
269
|
function initSyncCrypto(masterKey) {
|
|
276
270
|
if (masterKey.length !== 32) {
|
|
277
271
|
throw new Error(`Master key must be 32 bytes, got ${masterKey.length}`);
|
|
278
272
|
}
|
|
279
273
|
_syncKey = Buffer.from(
|
|
280
|
-
|
|
274
|
+
crypto.hkdfSync("sha256", masterKey, "", SYNC_HKDF_INFO, 32)
|
|
281
275
|
);
|
|
282
276
|
}
|
|
283
277
|
function isSyncCryptoInitialized() {
|
|
@@ -291,8 +285,8 @@ function requireSyncKey() {
|
|
|
291
285
|
}
|
|
292
286
|
function encryptSyncBlob(data) {
|
|
293
287
|
const key = requireSyncKey();
|
|
294
|
-
const iv =
|
|
295
|
-
const cipher =
|
|
288
|
+
const iv = crypto.randomBytes(IV_LENGTH);
|
|
289
|
+
const cipher = crypto.createCipheriv(ALGORITHM, key, iv);
|
|
296
290
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
|
297
291
|
const tag = cipher.getAuthTag();
|
|
298
292
|
return Buffer.concat([iv, encrypted, tag]).toString("base64");
|
|
@@ -306,7 +300,7 @@ function decryptSyncBlob(ciphertext) {
|
|
|
306
300
|
const iv = combined.subarray(0, IV_LENGTH);
|
|
307
301
|
const tag = combined.subarray(combined.length - TAG_LENGTH);
|
|
308
302
|
const encrypted = combined.subarray(IV_LENGTH, combined.length - TAG_LENGTH);
|
|
309
|
-
const decipher =
|
|
303
|
+
const decipher = crypto.createDecipheriv(ALGORITHM, key, iv);
|
|
310
304
|
decipher.setAuthTag(tag);
|
|
311
305
|
return Buffer.concat([decipher.update(encrypted), decipher.final()]);
|
|
312
306
|
}
|
|
@@ -501,7 +495,7 @@ __export(cloud_sync_exports, {
|
|
|
501
495
|
recordRosterDeletion: () => recordRosterDeletion
|
|
502
496
|
});
|
|
503
497
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as existsSync5, readdirSync, mkdirSync as mkdirSync2, appendFileSync, unlinkSync, openSync, closeSync } from "fs";
|
|
504
|
-
import
|
|
498
|
+
import crypto2 from "crypto";
|
|
505
499
|
import path5 from "path";
|
|
506
500
|
import { homedir } from "os";
|
|
507
501
|
function sqlSafe(v) {
|
|
@@ -884,7 +878,7 @@ function buildRosterBlob(paths) {
|
|
|
884
878
|
}
|
|
885
879
|
const deletedNames = consumeRosterDeletions();
|
|
886
880
|
const content = JSON.stringify({ roster, identities, config, deletedNames });
|
|
887
|
-
const hash =
|
|
881
|
+
const hash = crypto2.createHash("sha256").update(content).digest("hex").slice(0, 16);
|
|
888
882
|
return { roster, identities, config, deletedNames, version: hash };
|
|
889
883
|
}
|
|
890
884
|
async function cloudPushRoster(config) {
|
|
@@ -1466,7 +1460,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
1466
1460
|
import { existsSync } from "fs";
|
|
1467
1461
|
import path from "path";
|
|
1468
1462
|
import os from "os";
|
|
1469
|
-
import crypto from "crypto";
|
|
1470
1463
|
var SERVICE = "exe-mem";
|
|
1471
1464
|
var ACCOUNT = "master-key";
|
|
1472
1465
|
function getKeyDir() {
|
|
@@ -1520,65 +1513,34 @@ async function setMasterKey(key) {
|
|
|
1520
1513
|
await writeFile(keyPath, b64 + "\n", "utf-8");
|
|
1521
1514
|
await chmod(keyPath, 384);
|
|
1522
1515
|
}
|
|
1523
|
-
function
|
|
1524
|
-
if (key.length !== 32) {
|
|
1525
|
-
throw new Error(`Key must be 32 bytes, got ${key.length}`);
|
|
1526
|
-
}
|
|
1527
|
-
const hash = crypto.createHash("sha256").update(key).digest();
|
|
1528
|
-
const checksumByte = hash[0];
|
|
1529
|
-
let bits = "";
|
|
1530
|
-
for (const byte of key) {
|
|
1531
|
-
bits += byte.toString(2).padStart(8, "0");
|
|
1532
|
-
}
|
|
1533
|
-
bits += checksumByte.toString(2).padStart(8, "0");
|
|
1534
|
-
const words = [];
|
|
1535
|
-
let wordlist;
|
|
1516
|
+
async function loadBip39() {
|
|
1536
1517
|
try {
|
|
1537
|
-
|
|
1538
|
-
wordlist = bip39.wordlists?.english ?? bip39.default?.wordlists?.english;
|
|
1539
|
-
if (!wordlist) throw new Error("no wordlist");
|
|
1518
|
+
return await import("bip39");
|
|
1540
1519
|
} catch {
|
|
1541
|
-
throw new Error(
|
|
1520
|
+
throw new Error(
|
|
1521
|
+
"bip39 package not found. Run: npm install -g bip39\nOr reinstall exe-os: npm install -g @askexenow/exe-os"
|
|
1522
|
+
);
|
|
1542
1523
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1524
|
+
}
|
|
1525
|
+
async function exportMnemonic(key) {
|
|
1526
|
+
if (key.length !== 32) {
|
|
1527
|
+
throw new Error(`Key must be 32 bytes, got ${key.length}`);
|
|
1546
1528
|
}
|
|
1547
|
-
|
|
1529
|
+
const { entropyToMnemonic } = await loadBip39();
|
|
1530
|
+
return entropyToMnemonic(key.toString("hex"));
|
|
1548
1531
|
}
|
|
1549
|
-
function importMnemonic(mnemonic) {
|
|
1550
|
-
const
|
|
1532
|
+
async function importMnemonic(mnemonic) {
|
|
1533
|
+
const trimmed = mnemonic.trim();
|
|
1534
|
+
const words = trimmed.split(/\s+/);
|
|
1551
1535
|
if (words.length !== 24) {
|
|
1552
1536
|
throw new Error(`Expected 24 words, got ${words.length}`);
|
|
1553
1537
|
}
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
wordlist = bip39.wordlists?.english ?? bip39.default?.wordlists?.english;
|
|
1558
|
-
if (!wordlist) throw new Error("no wordlist");
|
|
1559
|
-
} catch {
|
|
1560
|
-
throw new Error("bip39 package required. Install with: npm install bip39");
|
|
1561
|
-
}
|
|
1562
|
-
let bits = "";
|
|
1563
|
-
for (const word of words) {
|
|
1564
|
-
const index = wordlist.indexOf(word.toLowerCase());
|
|
1565
|
-
if (index === -1) {
|
|
1566
|
-
throw new Error(`Invalid BIP39 word: "${word}"`);
|
|
1567
|
-
}
|
|
1568
|
-
bits += index.toString(2).padStart(11, "0");
|
|
1569
|
-
}
|
|
1570
|
-
const entropyBits = bits.slice(0, 256);
|
|
1571
|
-
const checksumBits = bits.slice(256, 264);
|
|
1572
|
-
const key = Buffer.alloc(32);
|
|
1573
|
-
for (let i = 0; i < 32; i++) {
|
|
1574
|
-
key[i] = parseInt(entropyBits.slice(i * 8, (i + 1) * 8), 2);
|
|
1575
|
-
}
|
|
1576
|
-
const hash = crypto.createHash("sha256").update(key).digest();
|
|
1577
|
-
const expectedChecksum = hash[0].toString(2).padStart(8, "0");
|
|
1578
|
-
if (checksumBits !== expectedChecksum) {
|
|
1579
|
-
throw new Error("Invalid mnemonic checksum");
|
|
1538
|
+
const { validateMnemonic, mnemonicToEntropy } = await loadBip39();
|
|
1539
|
+
if (!validateMnemonic(trimmed)) {
|
|
1540
|
+
throw new Error("Invalid mnemonic \u2014 check for typos or missing words");
|
|
1580
1541
|
}
|
|
1581
|
-
|
|
1542
|
+
const entropy = mnemonicToEntropy(trimmed);
|
|
1543
|
+
return Buffer.from(entropy, "hex");
|
|
1582
1544
|
}
|
|
1583
1545
|
|
|
1584
1546
|
// src/lib/is-main.ts
|
|
@@ -1604,7 +1566,7 @@ async function main() {
|
|
|
1604
1566
|
console.error("No master key found. Run /exe-setup first.");
|
|
1605
1567
|
process.exit(1);
|
|
1606
1568
|
}
|
|
1607
|
-
const mnemonic = exportMnemonic(key);
|
|
1569
|
+
const mnemonic = await exportMnemonic(key);
|
|
1608
1570
|
console.log("Your 24-word recovery phrase:\n");
|
|
1609
1571
|
const showFull = process.argv.includes("--show-full");
|
|
1610
1572
|
if (showFull) {
|
|
@@ -1629,7 +1591,7 @@ async function main() {
|
|
|
1629
1591
|
});
|
|
1630
1592
|
});
|
|
1631
1593
|
try {
|
|
1632
|
-
const key = importMnemonic(mnemonic);
|
|
1594
|
+
const key = await importMnemonic(mnemonic);
|
|
1633
1595
|
await setMasterKey(key);
|
|
1634
1596
|
console.log("Master key imported and stored securely.");
|
|
1635
1597
|
try {
|
|
@@ -1727,7 +1727,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
1727
1727
|
import { existsSync } from "fs";
|
|
1728
1728
|
import path from "path";
|
|
1729
1729
|
import os from "os";
|
|
1730
|
-
import crypto from "crypto";
|
|
1731
1730
|
var SERVICE = "exe-mem";
|
|
1732
1731
|
var ACCOUNT = "master-key";
|
|
1733
1732
|
function getKeyDir() {
|
|
@@ -1849,7 +1848,7 @@ async function initStore(options) {
|
|
|
1849
1848
|
// src/lib/messaging.ts
|
|
1850
1849
|
init_database();
|
|
1851
1850
|
init_tmux_routing();
|
|
1852
|
-
import
|
|
1851
|
+
import crypto from "crypto";
|
|
1853
1852
|
function rowToMessage(row) {
|
|
1854
1853
|
return {
|
|
1855
1854
|
id: row.id,
|
|
@@ -1535,7 +1535,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
1535
1535
|
import { existsSync } from "fs";
|
|
1536
1536
|
import path from "path";
|
|
1537
1537
|
import os from "os";
|
|
1538
|
-
import crypto from "crypto";
|
|
1539
1538
|
var SERVICE = "exe-mem";
|
|
1540
1539
|
var ACCOUNT = "master-key";
|
|
1541
1540
|
function getKeyDir() {
|
|
@@ -1597,7 +1597,7 @@ var init_employees = __esm({
|
|
|
1597
1597
|
});
|
|
1598
1598
|
|
|
1599
1599
|
// src/lib/notifications.ts
|
|
1600
|
-
import
|
|
1600
|
+
import crypto from "crypto";
|
|
1601
1601
|
import path5 from "path";
|
|
1602
1602
|
import os3 from "os";
|
|
1603
1603
|
import {
|
|
@@ -1817,7 +1817,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
1817
1817
|
import { existsSync } from "fs";
|
|
1818
1818
|
import path from "path";
|
|
1819
1819
|
import os from "os";
|
|
1820
|
-
import crypto from "crypto";
|
|
1821
1820
|
var SERVICE = "exe-mem";
|
|
1822
1821
|
var ACCOUNT = "master-key";
|
|
1823
1822
|
function getKeyDir() {
|
package/dist/bin/exe-review.js
CHANGED
|
@@ -1563,7 +1563,6 @@ import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3
|
|
|
1563
1563
|
import { existsSync as existsSync3 } from "fs";
|
|
1564
1564
|
import path3 from "path";
|
|
1565
1565
|
import os2 from "os";
|
|
1566
|
-
import crypto from "crypto";
|
|
1567
1566
|
var SERVICE = "exe-mem";
|
|
1568
1567
|
var ACCOUNT = "master-key";
|
|
1569
1568
|
function getKeyDir() {
|
package/dist/bin/exe-search.js
CHANGED
|
@@ -938,7 +938,6 @@ import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
|
938
938
|
import { existsSync } from "fs";
|
|
939
939
|
import path from "path";
|
|
940
940
|
import os from "os";
|
|
941
|
-
import crypto from "crypto";
|
|
942
941
|
function getKeyDir() {
|
|
943
942
|
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path.join(os.homedir(), ".exe-os");
|
|
944
943
|
}
|
|
@@ -2753,7 +2752,7 @@ __export(file_grep_exports, {
|
|
|
2753
2752
|
import { execSync as execSync2 } from "child_process";
|
|
2754
2753
|
import { readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, existsSync as existsSync5 } from "fs";
|
|
2755
2754
|
import path6 from "path";
|
|
2756
|
-
import
|
|
2755
|
+
import crypto from "crypto";
|
|
2757
2756
|
function hasRipgrep() {
|
|
2758
2757
|
if (_hasRg === null) {
|
|
2759
2758
|
try {
|
|
@@ -2786,7 +2785,7 @@ async function grepProjectFiles(query, projectRoot, options) {
|
|
|
2786
2785
|
const chunkCtx = getChunkContext(hit.filePath, hit.lineNumber);
|
|
2787
2786
|
const prefix = chunkCtx ? `[file: ${hit.filePath}:${hit.lineNumber} in ${chunkCtx}]` : `[file: ${hit.filePath}:${hit.lineNumber}]`;
|
|
2788
2787
|
return {
|
|
2789
|
-
id:
|
|
2788
|
+
id: crypto.createHash("sha256").update(`${hit.filePath}:${hit.lineNumber}`).digest("hex").slice(0, 36),
|
|
2790
2789
|
agent_id: "project",
|
|
2791
2790
|
agent_role: "file",
|
|
2792
2791
|
session_id: "file-grep",
|