@askexenow/exe-os 0.9.30 → 0.9.32
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 +135 -7
- package/dist/bin/backfill-responses.js +135 -7
- package/dist/bin/backfill-vectors.js +135 -7
- package/dist/bin/cleanup-stale-review-tasks.js +139 -11
- package/dist/bin/cli.js +812 -486
- package/dist/bin/exe-assign.js +135 -7
- package/dist/bin/exe-boot.js +422 -113
- package/dist/bin/exe-cloud.js +160 -9
- package/dist/bin/exe-dispatch.js +136 -8
- package/dist/bin/exe-doctor.js +255 -13
- package/dist/bin/exe-export-behaviors.js +136 -8
- package/dist/bin/exe-forget.js +136 -8
- package/dist/bin/exe-gateway.js +171 -24
- package/dist/bin/exe-heartbeat.js +141 -13
- package/dist/bin/exe-kill.js +140 -12
- package/dist/bin/exe-launch-agent.js +143 -15
- package/dist/bin/exe-link.js +357 -48
- package/dist/bin/exe-pending-messages.js +136 -8
- package/dist/bin/exe-pending-notifications.js +136 -8
- package/dist/bin/exe-pending-reviews.js +138 -10
- package/dist/bin/exe-review.js +136 -8
- package/dist/bin/exe-search.js +155 -20
- package/dist/bin/exe-session-cleanup.js +166 -38
- package/dist/bin/exe-start-codex.js +142 -14
- package/dist/bin/exe-start-opencode.js +140 -12
- package/dist/bin/exe-status.js +148 -20
- package/dist/bin/exe-team.js +136 -8
- package/dist/bin/git-sweep.js +138 -10
- package/dist/bin/graph-backfill.js +135 -7
- package/dist/bin/graph-export.js +136 -8
- package/dist/bin/intercom-check.js +153 -25
- package/dist/bin/scan-tasks.js +138 -10
- package/dist/bin/setup.js +447 -121
- package/dist/bin/shard-migrate.js +135 -7
- package/dist/gateway/index.js +151 -23
- package/dist/hooks/bug-report-worker.js +151 -23
- package/dist/hooks/codex-stop-task-finalizer.js +145 -17
- package/dist/hooks/commit-complete.js +138 -10
- package/dist/hooks/error-recall.js +159 -24
- package/dist/hooks/ingest.js +142 -14
- package/dist/hooks/instructions-loaded.js +136 -8
- package/dist/hooks/notification.js +136 -8
- package/dist/hooks/post-compact.js +136 -8
- package/dist/hooks/post-tool-combined.js +159 -24
- package/dist/hooks/pre-compact.js +136 -8
- package/dist/hooks/pre-tool-use.js +144 -16
- package/dist/hooks/prompt-submit.js +195 -55
- package/dist/hooks/session-end.js +141 -13
- package/dist/hooks/session-start.js +165 -30
- package/dist/hooks/stop.js +136 -8
- package/dist/hooks/subagent-stop.js +136 -8
- package/dist/hooks/summary-worker.js +374 -65
- package/dist/index.js +136 -8
- package/dist/lib/cloud-sync.js +355 -46
- package/dist/lib/consolidation.js +1 -0
- package/dist/lib/exe-daemon.js +469 -127
- package/dist/lib/hybrid-search.js +155 -20
- package/dist/lib/keychain.js +191 -7
- package/dist/lib/schedules.js +138 -10
- package/dist/lib/store.js +135 -7
- package/dist/mcp/server.js +706 -213
- package/dist/runtime/index.js +136 -8
- package/dist/tui/App.js +208 -31
- package/package.json +1 -1
|
@@ -1428,8 +1428,8 @@ function findPackageRoot() {
|
|
|
1428
1428
|
function getAvailableMemoryGB() {
|
|
1429
1429
|
if (process.platform === "darwin") {
|
|
1430
1430
|
try {
|
|
1431
|
-
const { execSync:
|
|
1432
|
-
const vmstat =
|
|
1431
|
+
const { execSync: execSync11 } = __require("child_process");
|
|
1432
|
+
const vmstat = execSync11("vm_stat", { encoding: "utf8" });
|
|
1433
1433
|
const pageSize = 16384;
|
|
1434
1434
|
const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
|
|
1435
1435
|
const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
|
|
@@ -3113,6 +3113,7 @@ var init_database = __esm({
|
|
|
3113
3113
|
// src/lib/keychain.ts
|
|
3114
3114
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
3115
3115
|
import { existsSync as existsSync7 } from "fs";
|
|
3116
|
+
import { execSync as execSync2 } from "child_process";
|
|
3116
3117
|
import path7 from "path";
|
|
3117
3118
|
import os5 from "os";
|
|
3118
3119
|
function getKeyDir() {
|
|
@@ -3121,6 +3122,59 @@ function getKeyDir() {
|
|
|
3121
3122
|
function getKeyPath() {
|
|
3122
3123
|
return path7.join(getKeyDir(), "master.key");
|
|
3123
3124
|
}
|
|
3125
|
+
function macKeychainGet() {
|
|
3126
|
+
if (process.platform !== "darwin") return null;
|
|
3127
|
+
try {
|
|
3128
|
+
return execSync2(
|
|
3129
|
+
`security find-generic-password -s "${SERVICE}" -a "${ACCOUNT}" -w 2>/dev/null`,
|
|
3130
|
+
{ encoding: "utf-8", timeout: 5e3 }
|
|
3131
|
+
).trim();
|
|
3132
|
+
} catch {
|
|
3133
|
+
return null;
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
function macKeychainSet(value) {
|
|
3137
|
+
if (process.platform !== "darwin") return false;
|
|
3138
|
+
try {
|
|
3139
|
+
try {
|
|
3140
|
+
execSync2(
|
|
3141
|
+
`security delete-generic-password -s "${SERVICE}" -a "${ACCOUNT}" 2>/dev/null`,
|
|
3142
|
+
{ timeout: 5e3 }
|
|
3143
|
+
);
|
|
3144
|
+
} catch {
|
|
3145
|
+
}
|
|
3146
|
+
execSync2(
|
|
3147
|
+
`security add-generic-password -s "${SERVICE}" -a "${ACCOUNT}" -w "${value}"`,
|
|
3148
|
+
{ timeout: 5e3 }
|
|
3149
|
+
);
|
|
3150
|
+
return true;
|
|
3151
|
+
} catch {
|
|
3152
|
+
return false;
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
function linuxSecretGet() {
|
|
3156
|
+
if (process.platform !== "linux") return null;
|
|
3157
|
+
try {
|
|
3158
|
+
return execSync2(
|
|
3159
|
+
`secret-tool lookup service "${SERVICE}" account "${ACCOUNT}" 2>/dev/null`,
|
|
3160
|
+
{ encoding: "utf-8", timeout: 5e3 }
|
|
3161
|
+
).trim();
|
|
3162
|
+
} catch {
|
|
3163
|
+
return null;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
function linuxSecretSet(value) {
|
|
3167
|
+
if (process.platform !== "linux") return false;
|
|
3168
|
+
try {
|
|
3169
|
+
execSync2(
|
|
3170
|
+
`echo -n "${value}" | secret-tool store --label="exe-os master key" service "${SERVICE}" account "${ACCOUNT}"`,
|
|
3171
|
+
{ timeout: 5e3 }
|
|
3172
|
+
);
|
|
3173
|
+
return true;
|
|
3174
|
+
} catch {
|
|
3175
|
+
return false;
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3124
3178
|
async function tryKeytar() {
|
|
3125
3179
|
try {
|
|
3126
3180
|
return await import("keytar");
|
|
@@ -3128,13 +3182,63 @@ async function tryKeytar() {
|
|
|
3128
3182
|
return null;
|
|
3129
3183
|
}
|
|
3130
3184
|
}
|
|
3185
|
+
function deriveMachineKey() {
|
|
3186
|
+
try {
|
|
3187
|
+
const crypto9 = __require("crypto");
|
|
3188
|
+
const material = [
|
|
3189
|
+
os5.hostname(),
|
|
3190
|
+
os5.userInfo().username,
|
|
3191
|
+
os5.arch(),
|
|
3192
|
+
os5.platform(),
|
|
3193
|
+
// Machine ID on Linux (stable across reboots)
|
|
3194
|
+
process.platform === "linux" ? readMachineId() : ""
|
|
3195
|
+
].join("|");
|
|
3196
|
+
return crypto9.createHash("sha256").update(material).digest();
|
|
3197
|
+
} catch {
|
|
3198
|
+
return null;
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
function readMachineId() {
|
|
3202
|
+
try {
|
|
3203
|
+
const { readFileSync: readFileSync18 } = __require("fs");
|
|
3204
|
+
return readFileSync18("/etc/machine-id", "utf-8").trim();
|
|
3205
|
+
} catch {
|
|
3206
|
+
return "";
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
function decryptWithMachineKey(encrypted, machineKey) {
|
|
3210
|
+
if (!encrypted.startsWith(ENCRYPTED_PREFIX)) return null;
|
|
3211
|
+
try {
|
|
3212
|
+
const crypto9 = __require("crypto");
|
|
3213
|
+
const parts = encrypted.slice(ENCRYPTED_PREFIX.length).split(":");
|
|
3214
|
+
if (parts.length !== 3) return null;
|
|
3215
|
+
const [ivB64, tagB64, cipherB64] = parts;
|
|
3216
|
+
const iv = Buffer.from(ivB64, "base64");
|
|
3217
|
+
const authTag = Buffer.from(tagB64, "base64");
|
|
3218
|
+
const decipher = crypto9.createDecipheriv("aes-256-gcm", machineKey, iv);
|
|
3219
|
+
decipher.setAuthTag(authTag);
|
|
3220
|
+
let decrypted = decipher.update(cipherB64, "base64", "utf-8");
|
|
3221
|
+
decrypted += decipher.final("utf-8");
|
|
3222
|
+
return decrypted;
|
|
3223
|
+
} catch {
|
|
3224
|
+
return null;
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3131
3227
|
async function getMasterKey() {
|
|
3228
|
+
const nativeValue = macKeychainGet() ?? linuxSecretGet();
|
|
3229
|
+
if (nativeValue) {
|
|
3230
|
+
return Buffer.from(nativeValue, "base64");
|
|
3231
|
+
}
|
|
3132
3232
|
const keytar = await tryKeytar();
|
|
3133
3233
|
if (keytar) {
|
|
3134
3234
|
try {
|
|
3135
|
-
const
|
|
3136
|
-
if (
|
|
3137
|
-
|
|
3235
|
+
const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
|
|
3236
|
+
if (keytarValue) {
|
|
3237
|
+
const migrated = macKeychainSet(keytarValue) || linuxSecretSet(keytarValue);
|
|
3238
|
+
if (migrated) {
|
|
3239
|
+
process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
|
|
3240
|
+
}
|
|
3241
|
+
return Buffer.from(keytarValue, "base64");
|
|
3138
3242
|
}
|
|
3139
3243
|
} catch {
|
|
3140
3244
|
}
|
|
@@ -3148,8 +3252,31 @@ async function getMasterKey() {
|
|
|
3148
3252
|
return null;
|
|
3149
3253
|
}
|
|
3150
3254
|
try {
|
|
3151
|
-
const content = await readFile3(keyPath, "utf-8");
|
|
3152
|
-
|
|
3255
|
+
const content = (await readFile3(keyPath, "utf-8")).trim();
|
|
3256
|
+
let b64Value;
|
|
3257
|
+
if (content.startsWith(ENCRYPTED_PREFIX)) {
|
|
3258
|
+
const machineKey = deriveMachineKey();
|
|
3259
|
+
if (!machineKey) {
|
|
3260
|
+
process.stderr.write("[keychain] Cannot derive machine key to decrypt stored key.\n");
|
|
3261
|
+
return null;
|
|
3262
|
+
}
|
|
3263
|
+
const decrypted = decryptWithMachineKey(content, machineKey);
|
|
3264
|
+
if (!decrypted) {
|
|
3265
|
+
process.stderr.write(
|
|
3266
|
+
"[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os link import\n"
|
|
3267
|
+
);
|
|
3268
|
+
return null;
|
|
3269
|
+
}
|
|
3270
|
+
b64Value = decrypted;
|
|
3271
|
+
} else {
|
|
3272
|
+
b64Value = content;
|
|
3273
|
+
}
|
|
3274
|
+
const key = Buffer.from(b64Value, "base64");
|
|
3275
|
+
const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
|
|
3276
|
+
if (migrated) {
|
|
3277
|
+
process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
|
|
3278
|
+
}
|
|
3279
|
+
return key;
|
|
3153
3280
|
} catch (err) {
|
|
3154
3281
|
process.stderr.write(
|
|
3155
3282
|
`[keychain] Key read failed at ${keyPath}: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -3158,12 +3285,13 @@ async function getMasterKey() {
|
|
|
3158
3285
|
return null;
|
|
3159
3286
|
}
|
|
3160
3287
|
}
|
|
3161
|
-
var SERVICE, ACCOUNT;
|
|
3288
|
+
var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
|
|
3162
3289
|
var init_keychain = __esm({
|
|
3163
3290
|
"src/lib/keychain.ts"() {
|
|
3164
3291
|
"use strict";
|
|
3165
3292
|
SERVICE = "exe-mem";
|
|
3166
3293
|
ACCOUNT = "master-key";
|
|
3294
|
+
ENCRYPTED_PREFIX = "enc:";
|
|
3167
3295
|
}
|
|
3168
3296
|
});
|
|
3169
3297
|
|
|
@@ -4686,7 +4814,7 @@ __export(project_name_exports, {
|
|
|
4686
4814
|
_resetCache: () => _resetCache,
|
|
4687
4815
|
getProjectName: () => getProjectName
|
|
4688
4816
|
});
|
|
4689
|
-
import { execSync as
|
|
4817
|
+
import { execSync as execSync3 } from "child_process";
|
|
4690
4818
|
import path10 from "path";
|
|
4691
4819
|
function getProjectName(cwd) {
|
|
4692
4820
|
const dir = cwd ?? process.cwd();
|
|
@@ -4694,7 +4822,7 @@ function getProjectName(cwd) {
|
|
|
4694
4822
|
try {
|
|
4695
4823
|
let repoRoot;
|
|
4696
4824
|
try {
|
|
4697
|
-
const gitCommonDir =
|
|
4825
|
+
const gitCommonDir = execSync3("git rev-parse --path-format=absolute --git-common-dir", {
|
|
4698
4826
|
cwd: dir,
|
|
4699
4827
|
encoding: "utf8",
|
|
4700
4828
|
timeout: 2e3,
|
|
@@ -4702,7 +4830,7 @@ function getProjectName(cwd) {
|
|
|
4702
4830
|
}).trim();
|
|
4703
4831
|
repoRoot = path10.dirname(gitCommonDir);
|
|
4704
4832
|
} catch {
|
|
4705
|
-
repoRoot =
|
|
4833
|
+
repoRoot = execSync3("git rev-parse --show-toplevel", {
|
|
4706
4834
|
cwd: dir,
|
|
4707
4835
|
encoding: "utf8",
|
|
4708
4836
|
timeout: 2e3,
|
|
@@ -4736,14 +4864,14 @@ var file_grep_exports = {};
|
|
|
4736
4864
|
__export(file_grep_exports, {
|
|
4737
4865
|
grepProjectFiles: () => grepProjectFiles
|
|
4738
4866
|
});
|
|
4739
|
-
import { execSync as
|
|
4867
|
+
import { execSync as execSync4 } from "child_process";
|
|
4740
4868
|
import { readFileSync as readFileSync6, readdirSync as readdirSync2, statSync as statSync2, existsSync as existsSync10 } from "fs";
|
|
4741
4869
|
import path11 from "path";
|
|
4742
4870
|
import crypto2 from "crypto";
|
|
4743
4871
|
function hasRipgrep() {
|
|
4744
4872
|
if (_hasRg === null) {
|
|
4745
4873
|
try {
|
|
4746
|
-
|
|
4874
|
+
execSync4("rg --version", { stdio: "ignore", timeout: 2e3 });
|
|
4747
4875
|
_hasRg = true;
|
|
4748
4876
|
} catch {
|
|
4749
4877
|
_hasRg = false;
|
|
@@ -4809,7 +4937,7 @@ function grepWithRipgrep(pattern, projectRoot, patterns) {
|
|
|
4809
4937
|
const globs = (patterns ?? DEFAULT_PATTERNS).map((p) => `--glob '${p}'`).join(" ");
|
|
4810
4938
|
const excludes = EXCLUDE_DIRS.map((d) => `--glob '!${d}'`).join(" ");
|
|
4811
4939
|
const cmd = `rg -i -c --hidden --no-config --no-ignore '${pattern.replace(/'/g, "\\'")}' . ${globs} ${excludes} --max-filesize ${MAX_FILE_SIZE} 2>/dev/null || true`;
|
|
4812
|
-
const output =
|
|
4940
|
+
const output = execSync4(cmd, {
|
|
4813
4941
|
cwd: projectRoot,
|
|
4814
4942
|
encoding: "utf8",
|
|
4815
4943
|
timeout: 3e3,
|
|
@@ -4824,12 +4952,12 @@ function grepWithRipgrep(pattern, projectRoot, patterns) {
|
|
|
4824
4952
|
const matchCount = parseInt(line.slice(colonIdx + 1));
|
|
4825
4953
|
if (isNaN(matchCount) || matchCount === 0) continue;
|
|
4826
4954
|
try {
|
|
4827
|
-
const firstMatch =
|
|
4955
|
+
const firstMatch = execSync4(
|
|
4828
4956
|
`rg -i -n --hidden '${pattern.replace(/'/g, "\\'")}' '${filePath}' --max-count 1 2>/dev/null | head -1`,
|
|
4829
4957
|
{ cwd: projectRoot, encoding: "utf8", timeout: 1e3 }
|
|
4830
4958
|
).trim();
|
|
4831
4959
|
const lineNum = parseInt(firstMatch.split(":")[0] ?? "1");
|
|
4832
|
-
const totalLines =
|
|
4960
|
+
const totalLines = execSync4(`wc -l < '${filePath}'`, {
|
|
4833
4961
|
cwd: projectRoot,
|
|
4834
4962
|
encoding: "utf8",
|
|
4835
4963
|
timeout: 1e3
|
|
@@ -5458,10 +5586,17 @@ async function applyEntityBoost(results, query, client) {
|
|
|
5458
5586
|
if (ENTITY_BOOST_WEIGHT === 0 || results.length === 0) {
|
|
5459
5587
|
return emptyResult;
|
|
5460
5588
|
}
|
|
5461
|
-
|
|
5589
|
+
const debugStart = process.env.EXE_DEBUG_HOOKS ? performance.now() : 0;
|
|
5590
|
+
const debugEnd = () => {
|
|
5591
|
+
if (!process.env.EXE_DEBUG_HOOKS) return;
|
|
5592
|
+
process.stderr.write(
|
|
5593
|
+
`[entity-boost] ${(performance.now() - debugStart).toFixed(3)}ms
|
|
5594
|
+
`
|
|
5595
|
+
);
|
|
5596
|
+
};
|
|
5462
5597
|
const entities = await matchEntities(query, client);
|
|
5463
5598
|
if (entities.length === 0) {
|
|
5464
|
-
|
|
5599
|
+
debugEnd();
|
|
5465
5600
|
return emptyResult;
|
|
5466
5601
|
}
|
|
5467
5602
|
const boostMap = /* @__PURE__ */ new Map();
|
|
@@ -5483,7 +5618,7 @@ async function applyEntityBoost(results, query, client) {
|
|
|
5483
5618
|
await traverseAndScore(entities, client, boostMap, resultIds, graphContextMap);
|
|
5484
5619
|
await applyHyperedgeBoost(entities, client, boostMap, resultIds);
|
|
5485
5620
|
if (boostMap.size === 0) {
|
|
5486
|
-
|
|
5621
|
+
debugEnd();
|
|
5487
5622
|
return emptyResult;
|
|
5488
5623
|
}
|
|
5489
5624
|
const scored = results.map((r, i) => ({
|
|
@@ -5494,7 +5629,7 @@ async function applyEntityBoost(results, query, client) {
|
|
|
5494
5629
|
scored.sort(
|
|
5495
5630
|
(a, b) => b.baseScore + b.entityBoost - (a.baseScore + a.entityBoost)
|
|
5496
5631
|
);
|
|
5497
|
-
|
|
5632
|
+
debugEnd();
|
|
5498
5633
|
return {
|
|
5499
5634
|
results: scored.map((s) => s.record),
|
|
5500
5635
|
graphContext: graphContextMap
|
|
@@ -5526,7 +5661,7 @@ var init_entity_boost = __esm({
|
|
|
5526
5661
|
});
|
|
5527
5662
|
|
|
5528
5663
|
// src/lib/session-key.ts
|
|
5529
|
-
import { execSync as
|
|
5664
|
+
import { execSync as execSync5 } from "child_process";
|
|
5530
5665
|
function normalizeCommand(command) {
|
|
5531
5666
|
const trimmed = command.trim().toLowerCase();
|
|
5532
5667
|
const parts = trimmed.split(/[\\/]/);
|
|
@@ -5545,7 +5680,7 @@ function resolveRuntimeProcess() {
|
|
|
5545
5680
|
let pid = process.ppid;
|
|
5546
5681
|
for (let i = 0; i < 10; i++) {
|
|
5547
5682
|
try {
|
|
5548
|
-
const info =
|
|
5683
|
+
const info = execSync5(`ps -p ${pid} -o ppid=,comm=`, {
|
|
5549
5684
|
encoding: "utf8",
|
|
5550
5685
|
timeout: 2e3
|
|
5551
5686
|
}).trim();
|
|
@@ -5602,7 +5737,7 @@ __export(session_registry_exports, {
|
|
|
5602
5737
|
registerSession: () => registerSession
|
|
5603
5738
|
});
|
|
5604
5739
|
import { readFileSync as readFileSync9, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5, existsSync as existsSync12 } from "fs";
|
|
5605
|
-
import { execSync as
|
|
5740
|
+
import { execSync as execSync7 } from "child_process";
|
|
5606
5741
|
import path14 from "path";
|
|
5607
5742
|
import os7 from "os";
|
|
5608
5743
|
function registerSession(entry) {
|
|
@@ -5642,7 +5777,7 @@ function pruneStaleSessions() {
|
|
|
5642
5777
|
if (sessions.length === 0) return 0;
|
|
5643
5778
|
let liveSessions = [];
|
|
5644
5779
|
try {
|
|
5645
|
-
liveSessions =
|
|
5780
|
+
liveSessions = execSync7("tmux list-sessions -F '#{session_name}' 2>/dev/null", {
|
|
5646
5781
|
encoding: "utf8"
|
|
5647
5782
|
}).trim().split("\n").filter(Boolean);
|
|
5648
5783
|
} catch {
|
|
@@ -5790,14 +5925,14 @@ var init_transport = __esm({
|
|
|
5790
5925
|
});
|
|
5791
5926
|
|
|
5792
5927
|
// src/lib/cc-agent-support.ts
|
|
5793
|
-
import { execSync as
|
|
5928
|
+
import { execSync as execSync8 } from "child_process";
|
|
5794
5929
|
function _resetCcAgentSupportCache() {
|
|
5795
5930
|
_cachedSupport = null;
|
|
5796
5931
|
}
|
|
5797
5932
|
function claudeSupportsAgentFlag() {
|
|
5798
5933
|
if (_cachedSupport !== null) return _cachedSupport;
|
|
5799
5934
|
try {
|
|
5800
|
-
const helpOutput =
|
|
5935
|
+
const helpOutput = execSync8("claude --help 2>&1", {
|
|
5801
5936
|
encoding: "utf-8",
|
|
5802
5937
|
timeout: 5e3
|
|
5803
5938
|
});
|
|
@@ -6282,7 +6417,7 @@ var init_session_scope = __esm({
|
|
|
6282
6417
|
import crypto5 from "crypto";
|
|
6283
6418
|
import path19 from "path";
|
|
6284
6419
|
import os11 from "os";
|
|
6285
|
-
import { execSync as
|
|
6420
|
+
import { execSync as execSync9 } from "child_process";
|
|
6286
6421
|
import { mkdir as mkdir4, writeFile as writeFile4, appendFile } from "fs/promises";
|
|
6287
6422
|
import { existsSync as existsSync17, readFileSync as readFileSync14 } from "fs";
|
|
6288
6423
|
async function writeCheckpoint(input2) {
|
|
@@ -6627,14 +6762,14 @@ function isTmuxSessionAlive(identifier) {
|
|
|
6627
6762
|
if (!identifier || identifier === "unknown") return true;
|
|
6628
6763
|
try {
|
|
6629
6764
|
if (identifier.startsWith("%")) {
|
|
6630
|
-
const output =
|
|
6765
|
+
const output = execSync9("tmux list-panes -a -F '#{pane_id}'", {
|
|
6631
6766
|
timeout: 2e3,
|
|
6632
6767
|
encoding: "utf8",
|
|
6633
6768
|
stdio: ["pipe", "pipe", "pipe"]
|
|
6634
6769
|
});
|
|
6635
6770
|
return output.split("\n").some((l) => l.trim() === identifier);
|
|
6636
6771
|
} else {
|
|
6637
|
-
|
|
6772
|
+
execSync9(`tmux has-session -t ${JSON.stringify(identifier)}`, {
|
|
6638
6773
|
timeout: 2e3,
|
|
6639
6774
|
stdio: ["pipe", "pipe", "pipe"]
|
|
6640
6775
|
});
|
|
@@ -6643,7 +6778,7 @@ function isTmuxSessionAlive(identifier) {
|
|
|
6643
6778
|
} catch {
|
|
6644
6779
|
if (identifier.startsWith("%")) return true;
|
|
6645
6780
|
try {
|
|
6646
|
-
|
|
6781
|
+
execSync9("tmux list-sessions", {
|
|
6647
6782
|
timeout: 2e3,
|
|
6648
6783
|
stdio: ["pipe", "pipe", "pipe"]
|
|
6649
6784
|
});
|
|
@@ -6658,12 +6793,12 @@ function checkStaleCompletion(taskContext, taskCreatedAt) {
|
|
|
6658
6793
|
if (!DELEGATION_KEYWORDS.test(taskContext)) return null;
|
|
6659
6794
|
try {
|
|
6660
6795
|
const since = new Date(taskCreatedAt).toISOString();
|
|
6661
|
-
const branch =
|
|
6796
|
+
const branch = execSync9(
|
|
6662
6797
|
"git rev-parse --abbrev-ref HEAD 2>/dev/null",
|
|
6663
6798
|
{ encoding: "utf8", timeout: 3e3 }
|
|
6664
6799
|
).trim();
|
|
6665
6800
|
const branchArg = branch && branch !== "HEAD" ? branch : "";
|
|
6666
|
-
const commitCount =
|
|
6801
|
+
const commitCount = execSync9(
|
|
6667
6802
|
`git log --oneline --since="${since}" ${branchArg} 2>/dev/null | wc -l`,
|
|
6668
6803
|
{ encoding: "utf8", timeout: 5e3 }
|
|
6669
6804
|
).trim();
|
|
@@ -8193,7 +8328,7 @@ __export(tmux_routing_exports, {
|
|
|
8193
8328
|
spawnEmployee: () => spawnEmployee,
|
|
8194
8329
|
verifyPaneAtCapacity: () => verifyPaneAtCapacity
|
|
8195
8330
|
});
|
|
8196
|
-
import { execFileSync as execFileSync2, execSync as
|
|
8331
|
+
import { execFileSync as execFileSync2, execSync as execSync10 } from "child_process";
|
|
8197
8332
|
import { readFileSync as readFileSync15, writeFileSync as writeFileSync10, mkdirSync as mkdirSync9, existsSync as existsSync19, appendFileSync, readdirSync as readdirSync6 } from "fs";
|
|
8198
8333
|
import path23 from "path";
|
|
8199
8334
|
import os12 from "os";
|
|
@@ -8903,7 +9038,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
|
|
|
8903
9038
|
let booted = false;
|
|
8904
9039
|
for (let i = 0; i < 30; i++) {
|
|
8905
9040
|
try {
|
|
8906
|
-
|
|
9041
|
+
execSync10("sleep 0.5");
|
|
8907
9042
|
} catch {
|
|
8908
9043
|
}
|
|
8909
9044
|
try {
|
|
@@ -9960,7 +10095,7 @@ init_config();
|
|
|
9960
10095
|
init_session_key();
|
|
9961
10096
|
init_employees();
|
|
9962
10097
|
import { readFileSync as readFileSync8, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync as unlinkSync4, readdirSync as readdirSync3 } from "fs";
|
|
9963
|
-
import { execSync as
|
|
10098
|
+
import { execSync as execSync6 } from "child_process";
|
|
9964
10099
|
import path13 from "path";
|
|
9965
10100
|
var CACHE_DIR2 = path13.join(EXE_AI_DIR, "session-cache");
|
|
9966
10101
|
var STALE_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -10038,7 +10173,7 @@ function getActiveAgent() {
|
|
|
10038
10173
|
} catch {
|
|
10039
10174
|
}
|
|
10040
10175
|
try {
|
|
10041
|
-
const sessionName =
|
|
10176
|
+
const sessionName = execSync6(
|
|
10042
10177
|
"tmux display-message -p '#{session_name}' 2>/dev/null",
|
|
10043
10178
|
{ encoding: "utf8", timeout: 2e3 }
|
|
10044
10179
|
).trim();
|
|
@@ -10067,6 +10202,7 @@ if (!loadConfigSync().autoRetrieval) {
|
|
|
10067
10202
|
process.exit(0);
|
|
10068
10203
|
}
|
|
10069
10204
|
var CACHE_DIR3 = path25.join(EXE_AI_DIR, "session-cache");
|
|
10205
|
+
var IS_CODEX_RUNTIME = process.env.EXE_RUNTIME?.toLowerCase() === "codex";
|
|
10070
10206
|
function loadInjectedIds(sessionId) {
|
|
10071
10207
|
try {
|
|
10072
10208
|
const raw = readFileSync17(path25.join(CACHE_DIR3, `${sessionId}.json`), "utf8");
|
|
@@ -10125,8 +10261,8 @@ process.stdin.on("end", async () => {
|
|
|
10125
10261
|
}
|
|
10126
10262
|
}
|
|
10127
10263
|
try {
|
|
10128
|
-
const { execSync:
|
|
10129
|
-
const currentSession =
|
|
10264
|
+
const { execSync: execSync11 } = await import("child_process");
|
|
10265
|
+
const currentSession = execSync11("tmux display-message -p '#{session_name}' 2>/dev/null", {
|
|
10130
10266
|
encoding: "utf8",
|
|
10131
10267
|
timeout: 2e3
|
|
10132
10268
|
}).trim();
|
|
@@ -10187,8 +10323,10 @@ process.stdin.on("end", async () => {
|
|
|
10187
10323
|
const cacheStatus = isCacheCold(sessionKey);
|
|
10188
10324
|
if (cacheStatus.cold) {
|
|
10189
10325
|
const idleMinutes = Number.isFinite(cacheStatus.idleMs) ? `${Math.max(1, Math.floor(cacheStatus.idleMs / 6e4))}m` : "5m+";
|
|
10190
|
-
|
|
10326
|
+
if (!IS_CODEX_RUNTIME) {
|
|
10327
|
+
cacheContext = `## Cache Status
|
|
10191
10328
|
\u26A0\uFE0F Cache cold (idle ${idleMinutes}). Next response will re-process the full context (higher cost). This is informational \u2014 no action needed.`;
|
|
10329
|
+
}
|
|
10192
10330
|
try {
|
|
10193
10331
|
const { getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
10194
10332
|
const client = getClient2();
|
|
@@ -10203,22 +10341,24 @@ process.stdin.on("end", async () => {
|
|
|
10203
10341
|
}
|
|
10204
10342
|
} catch {
|
|
10205
10343
|
}
|
|
10206
|
-
const memories = await search(
|
|
10207
|
-
prompt.slice(0, 200),
|
|
10208
|
-
agent.agentId,
|
|
10209
|
-
{ limit: 5 }
|
|
10210
|
-
);
|
|
10211
10344
|
let memoryContext = "";
|
|
10212
|
-
if (
|
|
10213
|
-
const
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10345
|
+
if (!IS_CODEX_RUNTIME) {
|
|
10346
|
+
const memories = await search(
|
|
10347
|
+
prompt.slice(0, 200),
|
|
10348
|
+
agent.agentId,
|
|
10349
|
+
{ limit: 5 }
|
|
10350
|
+
);
|
|
10351
|
+
if (memories.length > 0) {
|
|
10352
|
+
const injected = loadInjectedIds(data.session_id);
|
|
10353
|
+
const fresh = memories.filter((m) => !injected.has(m.id));
|
|
10354
|
+
if (fresh.length > 0) {
|
|
10355
|
+
for (const m of fresh) injected.add(m.id);
|
|
10356
|
+
saveInjectedIds(data.session_id, injected);
|
|
10357
|
+
memoryContext = `## Relevant Memories
|
|
10219
10358
|
${fresh.map(
|
|
10220
|
-
|
|
10221
|
-
|
|
10359
|
+
(m) => `[${m.timestamp}] ${m.tool_name}: ${m.raw_text.slice(0, 300)}`
|
|
10360
|
+
).join("\n")}`;
|
|
10361
|
+
}
|
|
10222
10362
|
}
|
|
10223
10363
|
}
|
|
10224
10364
|
let reviewContext = "";
|
|
@@ -10229,8 +10369,8 @@ ${fresh.map(
|
|
|
10229
10369
|
const lastCheckPath = path25.join(CACHE_DIR3, `review-lastcheck-${sessionKey}.json`);
|
|
10230
10370
|
let sessionScope;
|
|
10231
10371
|
try {
|
|
10232
|
-
const { execSync:
|
|
10233
|
-
const tmuxSession =
|
|
10372
|
+
const { execSync: execSync11 } = await import("child_process");
|
|
10373
|
+
const tmuxSession = execSync11("tmux display-message -p '#{session_name}'", { encoding: "utf8", timeout: 2e3 }).trim();
|
|
10234
10374
|
if (isExeSession(tmuxSession)) sessionScope = tmuxSession;
|
|
10235
10375
|
} catch {
|
|
10236
10376
|
}
|