@askexenow/exe-os 0.9.77 → 0.9.79
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/agentic-ontology-backfill.js +2 -2
- package/dist/bin/agentic-reflection-backfill.js +2 -2
- package/dist/bin/agentic-semantic-label.js +2 -2
- package/dist/bin/backfill-conversations.js +2 -2
- package/dist/bin/backfill-responses.js +2 -2
- package/dist/bin/backfill-vectors.js +2 -2
- package/dist/bin/bulk-sync-postgres.js +2 -2
- package/dist/bin/cleanup-stale-review-tasks.js +2 -2
- package/dist/bin/cli.js +839 -528
- package/dist/bin/customer-readiness.js +19 -0
- package/dist/bin/exe-agent.js +2 -2
- package/dist/bin/exe-assign.js +2 -2
- package/dist/bin/exe-boot.js +2 -2
- package/dist/bin/exe-call.js +2 -2
- package/dist/bin/exe-cloud.js +2 -2
- package/dist/bin/exe-dispatch.js +2 -2
- package/dist/bin/exe-doctor.js +2 -2
- package/dist/bin/exe-export-behaviors.js +2 -2
- package/dist/bin/exe-forget.js +2 -2
- package/dist/bin/exe-gateway.js +158 -16
- package/dist/bin/exe-heartbeat.js +2 -2
- package/dist/bin/exe-kill.js +2 -2
- package/dist/bin/exe-launch-agent.js +2 -2
- package/dist/bin/exe-new-employee.js +2 -2
- package/dist/bin/exe-pending-messages.js +2 -2
- package/dist/bin/exe-pending-notifications.js +2 -2
- package/dist/bin/exe-pending-reviews.js +2 -2
- package/dist/bin/exe-rename.js +2 -2
- package/dist/bin/exe-review.js +2 -2
- package/dist/bin/exe-search.js +2 -2
- package/dist/bin/exe-session-cleanup.js +2 -2
- package/dist/bin/exe-start-codex.js +2 -2
- package/dist/bin/exe-start-opencode.js +2 -2
- package/dist/bin/exe-status.js +2 -2
- package/dist/bin/exe-support.js +537 -0
- package/dist/bin/exe-team.js +2 -2
- package/dist/bin/git-sweep.js +2 -2
- package/dist/bin/graph-backfill.js +2 -2
- package/dist/bin/graph-export.js +2 -2
- package/dist/bin/intercom-check.js +2 -2
- package/dist/bin/scan-tasks.js +2 -2
- package/dist/bin/setup.js +3 -2
- package/dist/bin/shard-migrate.js +2 -2
- package/dist/bin/update.js +9 -0
- package/dist/gateway/index.js +2 -2
- package/dist/hooks/bug-report-worker.js +2 -2
- package/dist/hooks/codex-stop-task-finalizer.js +2 -2
- package/dist/hooks/commit-complete.js +2 -2
- package/dist/hooks/error-recall.js +2 -2
- package/dist/hooks/ingest.js +2 -2
- package/dist/hooks/instructions-loaded.js +2 -2
- package/dist/hooks/notification.js +2 -2
- package/dist/hooks/post-compact.js +2 -2
- package/dist/hooks/post-tool-combined.js +2 -2
- package/dist/hooks/pre-compact.js +2 -2
- package/dist/hooks/pre-tool-use.js +2 -2
- package/dist/hooks/prompt-submit.js +2 -2
- package/dist/hooks/session-end.js +2 -2
- package/dist/hooks/session-start.js +2 -2
- package/dist/hooks/stop.js +2 -2
- package/dist/hooks/subagent-stop.js +2 -2
- package/dist/hooks/summary-worker.js +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/employee-templates.js +2 -2
- package/dist/lib/exe-daemon.js +28 -16
- package/dist/lib/hybrid-search.js +2 -2
- package/dist/lib/schedules.js +2 -2
- package/dist/lib/store.js +2 -2
- package/dist/mcp/server.js +27 -15
- package/dist/runtime/index.js +2 -2
- package/dist/tui/App.js +2 -2
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -2619,8 +2619,8 @@ function deriveMachineKey() {
|
|
|
2619
2619
|
}
|
|
2620
2620
|
function readMachineId() {
|
|
2621
2621
|
try {
|
|
2622
|
-
const { readFileSync:
|
|
2623
|
-
return
|
|
2622
|
+
const { readFileSync: readFileSync37 } = __require("fs");
|
|
2623
|
+
return readFileSync37("/etc/machine-id", "utf-8").trim();
|
|
2624
2624
|
} catch {
|
|
2625
2625
|
return "";
|
|
2626
2626
|
}
|
|
@@ -8667,7 +8667,7 @@ var init_platform_procedures = __esm({
|
|
|
8667
8667
|
title: "Customer patch triage \u2014 upstream bug vs customization",
|
|
8668
8668
|
domain: "support",
|
|
8669
8669
|
priority: "p0",
|
|
8670
|
-
content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
|
|
8670
|
+
content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, run `exe-os support test` and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
|
|
8671
8671
|
},
|
|
8672
8672
|
// --- Operations ---
|
|
8673
8673
|
{
|
|
@@ -8749,7 +8749,7 @@ var init_platform_procedures = __esm({
|
|
|
8749
8749
|
title: "MCP tools \u2014 identity, behavior, and decisions",
|
|
8750
8750
|
domain: "tool-use",
|
|
8751
8751
|
priority: "p1",
|
|
8752
|
-
content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only."
|
|
8752
|
+
content: "get_identity: read an agent's exe.md (Layer 1 identity). update_identity: write an agent's exe.md. Identity > behavior \u2014 use for permanent rules. store_behavior: record a correction or pattern for an agent (Layer 2 expertise). list_behaviors: view an agent's active behaviors. deactivate_behavior: soft-delete a stale or conflicting behavior. store_decision: record an ADR (architectural decision record). get_decision: retrieve a past decision by query. create_bug_report: customer-facing bug/support intake; use whenever an Exe OS bug or emergency hotfix is encountered so the report reaches AskExe directly. Customers only get report access; internal list/get/triage support tools are AskExe-only. If a customer-side agent cannot send upstream, run `exe-os support test` from the terminal to verify local file write, license auth, support endpoint health, and upstream POST."
|
|
8753
8753
|
},
|
|
8754
8754
|
{
|
|
8755
8755
|
title: "MCP tools \u2014 communication and messaging",
|
|
@@ -10945,12 +10945,310 @@ var init_exe_key = __esm({
|
|
|
10945
10945
|
}
|
|
10946
10946
|
});
|
|
10947
10947
|
|
|
10948
|
+
// src/bin/exe-support.ts
|
|
10949
|
+
var exe_support_exports = {};
|
|
10950
|
+
__export(exe_support_exports, {
|
|
10951
|
+
main: () => main4
|
|
10952
|
+
});
|
|
10953
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync14, unlinkSync as unlinkSync7, writeFileSync as writeFileSync13 } from "fs";
|
|
10954
|
+
import path20 from "path";
|
|
10955
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
10956
|
+
async function main4(argv = process.argv.slice(2)) {
|
|
10957
|
+
const command = argv[0] && !argv[0].startsWith("--") ? argv[0] : "health";
|
|
10958
|
+
const json = argv.includes("--json");
|
|
10959
|
+
const project = getArg(argv, "--project") ?? "support-smoke";
|
|
10960
|
+
if (command === "help" || argv.includes("--help") || argv.includes("-h")) {
|
|
10961
|
+
printHelp();
|
|
10962
|
+
return;
|
|
10963
|
+
}
|
|
10964
|
+
if (command === "health") {
|
|
10965
|
+
const result = await runHealth();
|
|
10966
|
+
output(result, json, "health");
|
|
10967
|
+
process.exitCode = hasFailures(result) ? 1 : 0;
|
|
10968
|
+
return;
|
|
10969
|
+
}
|
|
10970
|
+
if (command === "test") {
|
|
10971
|
+
const result = await runTest(project);
|
|
10972
|
+
output(result, json, "test");
|
|
10973
|
+
process.exitCode = hasFailures(result) ? 1 : 0;
|
|
10974
|
+
return;
|
|
10975
|
+
}
|
|
10976
|
+
console.error("Usage: exe-os support health|test [--project <name>] [--json]");
|
|
10977
|
+
process.exitCode = 1;
|
|
10978
|
+
}
|
|
10979
|
+
async function runHealth() {
|
|
10980
|
+
const checks = [];
|
|
10981
|
+
const endpoints = await resolveEndpoints();
|
|
10982
|
+
checks.push(checkLocalWrite());
|
|
10983
|
+
checks.push({
|
|
10984
|
+
check: "license_key_present",
|
|
10985
|
+
level: loadLicense() ? "pass" : "fail",
|
|
10986
|
+
detail: loadLicense() ? "license.key found" : "missing ~/.exe-os/license.key; run exe-os setup or exe-os cloud setup",
|
|
10987
|
+
next: loadLicense() ? void 0 : "Run `exe-os setup` or ask AskExe for the customer license key."
|
|
10988
|
+
});
|
|
10989
|
+
checks.push({
|
|
10990
|
+
check: "license_token_cached",
|
|
10991
|
+
level: readCachedLicenseToken() ? "pass" : "warn",
|
|
10992
|
+
detail: readCachedLicenseToken() ? "cached license token found" : "no cached token yet; support can still use license.key",
|
|
10993
|
+
next: readCachedLicenseToken() ? void 0 : "This is OK if license.key exists. It refreshes after cloud/license validation."
|
|
10994
|
+
});
|
|
10995
|
+
try {
|
|
10996
|
+
const res = await fetch(endpoints.healthEndpoint, { method: "GET", signal: AbortSignal.timeout(1e4) });
|
|
10997
|
+
const body = await safeJson2(res);
|
|
10998
|
+
checks.push({
|
|
10999
|
+
check: "support_health_endpoint",
|
|
11000
|
+
level: res.ok && body?.status !== "down" ? "pass" : "fail",
|
|
11001
|
+
detail: `${res.status} ${body?.status ?? res.statusText}`,
|
|
11002
|
+
next: res.ok ? void 0 : "Check internet access, DNS, or AskExe support status."
|
|
11003
|
+
});
|
|
11004
|
+
for (const remote of body?.checks ?? []) {
|
|
11005
|
+
const name = remote.name ?? "unknown";
|
|
11006
|
+
checks.push({
|
|
11007
|
+
check: `server_${name}`,
|
|
11008
|
+
level: remote.ok === true ? "pass" : name === "admin_inbox_configured" ? "warn" : "fail",
|
|
11009
|
+
detail: remote.detail ?? (remote.ok ? "ok" : "failed"),
|
|
11010
|
+
next: remote.ok ? void 0 : "AskExe must fix this server-side."
|
|
11011
|
+
});
|
|
11012
|
+
}
|
|
11013
|
+
} catch (err) {
|
|
11014
|
+
checks.push({
|
|
11015
|
+
check: "support_health_endpoint",
|
|
11016
|
+
level: "fail",
|
|
11017
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
11018
|
+
next: "Check internet access, then run `exe-os support health` again."
|
|
11019
|
+
});
|
|
11020
|
+
}
|
|
11021
|
+
return checks;
|
|
11022
|
+
}
|
|
11023
|
+
async function runTest(project) {
|
|
11024
|
+
const checks = await runHealth();
|
|
11025
|
+
const endpoints = await resolveEndpoints();
|
|
11026
|
+
const licenseKey = loadLicense();
|
|
11027
|
+
const licenseToken = readCachedLicenseToken();
|
|
11028
|
+
const id = randomUUID4();
|
|
11029
|
+
const version = readPackageVersion();
|
|
11030
|
+
const reportPath = writeLocalTestReport(id, project, version);
|
|
11031
|
+
checks.push({ check: "local_report_file", level: "pass", detail: reportPath });
|
|
11032
|
+
if (!licenseKey && !licenseToken) {
|
|
11033
|
+
checks.push({
|
|
11034
|
+
check: "upstream_post",
|
|
11035
|
+
level: "fail",
|
|
11036
|
+
detail: "not sent because this device has no license key/token",
|
|
11037
|
+
next: "Run `exe-os setup` or ask AskExe to provision this customer device."
|
|
11038
|
+
});
|
|
11039
|
+
return checks;
|
|
11040
|
+
}
|
|
11041
|
+
const payload = {
|
|
11042
|
+
id,
|
|
11043
|
+
title: `TEST \u2014 ${project} support intake (${version})`,
|
|
11044
|
+
classification: "unclear",
|
|
11045
|
+
severity: "p3",
|
|
11046
|
+
summary: "Synthetic exe-os support intake smoke test. Safe to close.",
|
|
11047
|
+
customer_impact: "No customer impact; diagnostic only.",
|
|
11048
|
+
reproduction_steps: ["Run exe-os support test"],
|
|
11049
|
+
expected: "The report reaches AskExe support intake and can be triaged.",
|
|
11050
|
+
actual: "Smoke test submitted by exe-os support test.",
|
|
11051
|
+
package_version: `@askexenow/exe-os@${version}`,
|
|
11052
|
+
project_name: project,
|
|
11053
|
+
agent_id: "support-test",
|
|
11054
|
+
agent_role: "diagnostic",
|
|
11055
|
+
report_path: reportPath,
|
|
11056
|
+
markdown: readFileSync14(reportPath, "utf8")
|
|
11057
|
+
};
|
|
11058
|
+
try {
|
|
11059
|
+
const headers = { "content-type": "application/json" };
|
|
11060
|
+
if (licenseKey) headers["x-exe-license-key"] = licenseKey;
|
|
11061
|
+
if (licenseToken) headers["x-exe-license-token"] = licenseToken;
|
|
11062
|
+
const res = await fetch(endpoints.bugEndpoint, {
|
|
11063
|
+
method: "POST",
|
|
11064
|
+
headers,
|
|
11065
|
+
body: JSON.stringify(payload),
|
|
11066
|
+
signal: AbortSignal.timeout(15e3)
|
|
11067
|
+
});
|
|
11068
|
+
const data = await safeJson2(res);
|
|
11069
|
+
checks.push({
|
|
11070
|
+
check: "upstream_post",
|
|
11071
|
+
level: res.ok ? "pass" : "fail",
|
|
11072
|
+
detail: res.ok ? `sent id=${String(data?.id ?? id)}` : summarizeHttpFailure(res.status, data),
|
|
11073
|
+
next: res.ok ? void 0 : nextForPostFailure(res.status)
|
|
11074
|
+
});
|
|
11075
|
+
if (res.ok) {
|
|
11076
|
+
checks.push(await maybeCloseAdmin(String(data?.id ?? id), endpoints.adminEndpoint, version));
|
|
11077
|
+
}
|
|
11078
|
+
} catch (err) {
|
|
11079
|
+
checks.push({
|
|
11080
|
+
check: "upstream_post",
|
|
11081
|
+
level: "fail",
|
|
11082
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
11083
|
+
next: "Check internet access, then run `exe-os support test` again."
|
|
11084
|
+
});
|
|
11085
|
+
}
|
|
11086
|
+
return checks;
|
|
11087
|
+
}
|
|
11088
|
+
async function resolveEndpoints() {
|
|
11089
|
+
const config = await loadConfig();
|
|
11090
|
+
const bugEndpoint = process.env.EXE_SUPPORT_BUG_REPORT_ENDPOINT ?? config.support?.bugReportEndpoint ?? DEFAULT_BUG_ENDPOINT;
|
|
11091
|
+
const healthEndpoint = process.env.EXE_SUPPORT_HEALTH_ENDPOINT ?? bugEndpoint.replace(/\/bug-reports\/?$/, "/health");
|
|
11092
|
+
const adminEndpoint = process.env.ASKEXE_SUPPORT_ADMIN_ENDPOINT ?? process.env.EXE_SUPPORT_ADMIN_ENDPOINT ?? DEFAULT_ADMIN_ENDPOINT;
|
|
11093
|
+
return { bugEndpoint, healthEndpoint, adminEndpoint };
|
|
11094
|
+
}
|
|
11095
|
+
function checkLocalWrite() {
|
|
11096
|
+
const dir = path20.join(EXE_AI_DIR, "bug-reports");
|
|
11097
|
+
const testPath = path20.join(dir, ".support-write-test");
|
|
11098
|
+
try {
|
|
11099
|
+
mkdirSync13(dir, { recursive: true, mode: 448 });
|
|
11100
|
+
writeFileSync13(testPath, "ok\n", { mode: 384 });
|
|
11101
|
+
unlinkSync7(testPath);
|
|
11102
|
+
return { check: "local_bug_report_dir_writable", level: "pass", detail: dir };
|
|
11103
|
+
} catch (err) {
|
|
11104
|
+
return {
|
|
11105
|
+
check: "local_bug_report_dir_writable",
|
|
11106
|
+
level: "fail",
|
|
11107
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
11108
|
+
next: "Fix permissions on ~/.exe-os or rerun setup on a writable user account."
|
|
11109
|
+
};
|
|
11110
|
+
}
|
|
11111
|
+
}
|
|
11112
|
+
function writeLocalTestReport(id, project, version) {
|
|
11113
|
+
const dir = path20.join(EXE_AI_DIR, "bug-reports");
|
|
11114
|
+
mkdirSync13(dir, { recursive: true, mode: 448 });
|
|
11115
|
+
const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
11116
|
+
const filePath = path20.join(dir, `${date}-support-intake-test-${id.slice(0, 8)}.md`);
|
|
11117
|
+
writeFileSync13(filePath, `# TEST \u2014 ${project} support intake
|
|
11118
|
+
|
|
11119
|
+
Report ID: ${id}
|
|
11120
|
+
Package: @askexenow/exe-os@${version}
|
|
11121
|
+
|
|
11122
|
+
Synthetic smoke test from \`exe-os support test\`. Safe to close.
|
|
11123
|
+
`, { mode: 384 });
|
|
11124
|
+
return filePath;
|
|
11125
|
+
}
|
|
11126
|
+
async function maybeCloseAdmin(id, adminEndpoint, version) {
|
|
11127
|
+
const token = process.env.ASKEXE_SUPPORT_ADMIN_TOKEN ?? process.env.EXE_SUPPORT_ADMIN_TOKEN;
|
|
11128
|
+
if (!token) {
|
|
11129
|
+
return { check: "askexe_admin_autoclose", level: "warn", detail: "skipped; admin token is AskExe-only" };
|
|
11130
|
+
}
|
|
11131
|
+
try {
|
|
11132
|
+
const res = await fetch(`${adminEndpoint}/${encodeURIComponent(id)}`, {
|
|
11133
|
+
method: "PATCH",
|
|
11134
|
+
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
|
|
11135
|
+
body: JSON.stringify({
|
|
11136
|
+
status: "closed",
|
|
11137
|
+
triage_notes: "Auto-closed synthetic support smoke test.",
|
|
11138
|
+
fixed_version: version
|
|
11139
|
+
}),
|
|
11140
|
+
signal: AbortSignal.timeout(1e4)
|
|
11141
|
+
});
|
|
11142
|
+
return {
|
|
11143
|
+
check: "askexe_admin_autoclose",
|
|
11144
|
+
level: res.ok ? "pass" : "warn",
|
|
11145
|
+
detail: res.ok ? "closed" : `${res.status} ${await res.text()}`,
|
|
11146
|
+
next: res.ok ? void 0 : "Report was sent; AskExe can close the smoke report manually."
|
|
11147
|
+
};
|
|
11148
|
+
} catch (err) {
|
|
11149
|
+
return {
|
|
11150
|
+
check: "askexe_admin_autoclose",
|
|
11151
|
+
level: "warn",
|
|
11152
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
11153
|
+
next: "Report was sent; AskExe can close the smoke report manually."
|
|
11154
|
+
};
|
|
11155
|
+
}
|
|
11156
|
+
}
|
|
11157
|
+
function readPackageVersion() {
|
|
11158
|
+
let dir = path20.dirname(new URL(import.meta.url).pathname);
|
|
11159
|
+
for (let i = 0; i < 6; i++) {
|
|
11160
|
+
const pkg = path20.join(dir, "package.json");
|
|
11161
|
+
try {
|
|
11162
|
+
const parsed = JSON.parse(readFileSync14(pkg, "utf8"));
|
|
11163
|
+
if (parsed.version) return parsed.version;
|
|
11164
|
+
} catch {
|
|
11165
|
+
}
|
|
11166
|
+
dir = path20.dirname(dir);
|
|
11167
|
+
}
|
|
11168
|
+
return "unknown";
|
|
11169
|
+
}
|
|
11170
|
+
async function safeJson2(res) {
|
|
11171
|
+
try {
|
|
11172
|
+
return await res.json();
|
|
11173
|
+
} catch {
|
|
11174
|
+
return null;
|
|
11175
|
+
}
|
|
11176
|
+
}
|
|
11177
|
+
function getArg(argv, name) {
|
|
11178
|
+
const idx = argv.indexOf(name);
|
|
11179
|
+
if (idx >= 0) return argv[idx + 1];
|
|
11180
|
+
const prefix = `${name}=`;
|
|
11181
|
+
const found = argv.find((arg) => arg.startsWith(prefix));
|
|
11182
|
+
return found?.slice(prefix.length);
|
|
11183
|
+
}
|
|
11184
|
+
function hasFailures(rows) {
|
|
11185
|
+
return rows.some((row) => row.level === "fail");
|
|
11186
|
+
}
|
|
11187
|
+
function summarizeHttpFailure(status, data) {
|
|
11188
|
+
const error = data?.error;
|
|
11189
|
+
return `${status} ${error?.message ?? JSON.stringify(data)}`;
|
|
11190
|
+
}
|
|
11191
|
+
function nextForPostFailure(status) {
|
|
11192
|
+
if (status === 401) return "License credentials were not sent. Run `exe-os support health` and check license_key_present.";
|
|
11193
|
+
if (status === 403) return "License is valid locally but not accepted by support intake. AskExe must check server-side license provisioning.";
|
|
11194
|
+
if (status >= 500) return "AskExe support intake is unhealthy server-side. Try again shortly and report the local file path.";
|
|
11195
|
+
return "Run `exe-os support health`; if it passes, send this output to AskExe.";
|
|
11196
|
+
}
|
|
11197
|
+
function printHelp() {
|
|
11198
|
+
console.log(`
|
|
11199
|
+
exe-os support
|
|
11200
|
+
|
|
11201
|
+
Customer-safe diagnostics for AskExe bug-report intake.
|
|
11202
|
+
|
|
11203
|
+
Commands:
|
|
11204
|
+
exe-os support health Check local setup + AskExe support server health
|
|
11205
|
+
exe-os support test --project hygo Send a safe smoke report end-to-end
|
|
11206
|
+
|
|
11207
|
+
What success means:
|
|
11208
|
+
health = this device looks ready
|
|
11209
|
+
test = AskExe received a real report from this device
|
|
11210
|
+
`);
|
|
11211
|
+
}
|
|
11212
|
+
function output(rows, json, command) {
|
|
11213
|
+
if (json) {
|
|
11214
|
+
console.log(JSON.stringify({ ok: !hasFailures(rows), checks: rows }, null, 2));
|
|
11215
|
+
return;
|
|
11216
|
+
}
|
|
11217
|
+
console.log(`
|
|
11218
|
+
exe-os support ${command}
|
|
11219
|
+
`);
|
|
11220
|
+
for (const row of rows) {
|
|
11221
|
+
const icon = row.level === "pass" ? "\u2705" : row.level === "warn" ? "\u26A0\uFE0F " : "\u274C";
|
|
11222
|
+
console.log(`${icon} ${row.check}: ${row.detail}`);
|
|
11223
|
+
if (row.next) console.log(` \u2192 ${row.next}`);
|
|
11224
|
+
}
|
|
11225
|
+
console.log("");
|
|
11226
|
+
if (hasFailures(rows)) {
|
|
11227
|
+
console.log("Result: not ready. Fix the failed item(s), then rerun this command.");
|
|
11228
|
+
} else if (rows.some((row) => row.level === "warn")) {
|
|
11229
|
+
console.log("Result: ready with warnings. Bug reports can be sent; warnings are informational unless AskExe asked for stricter validation.");
|
|
11230
|
+
} else {
|
|
11231
|
+
console.log(command === "test" ? "Result: ready. AskExe received the test report." : "Result: ready. Run `exe-os support test --project <customer>` for an end-to-end send test.");
|
|
11232
|
+
}
|
|
11233
|
+
console.log("");
|
|
11234
|
+
}
|
|
11235
|
+
var DEFAULT_BUG_ENDPOINT, DEFAULT_ADMIN_ENDPOINT;
|
|
11236
|
+
var init_exe_support = __esm({
|
|
11237
|
+
"src/bin/exe-support.ts"() {
|
|
11238
|
+
"use strict";
|
|
11239
|
+
init_config();
|
|
11240
|
+
init_license();
|
|
11241
|
+
DEFAULT_BUG_ENDPOINT = "https://askexe.com/v1/support/bug-reports";
|
|
11242
|
+
DEFAULT_ADMIN_ENDPOINT = "https://askexe.com/admin/support/bug-reports";
|
|
11243
|
+
}
|
|
11244
|
+
});
|
|
11245
|
+
|
|
10948
11246
|
// src/bin/bulk-sync-postgres.ts
|
|
10949
11247
|
var bulk_sync_postgres_exports = {};
|
|
10950
11248
|
__export(bulk_sync_postgres_exports, {
|
|
10951
|
-
main: () =>
|
|
11249
|
+
main: () => main5
|
|
10952
11250
|
});
|
|
10953
|
-
async function
|
|
11251
|
+
async function main5() {
|
|
10954
11252
|
process.env.EXE_IS_DAEMON = "1";
|
|
10955
11253
|
await initStore({ lightweight: true });
|
|
10956
11254
|
const client = getClient();
|
|
@@ -11013,7 +11311,7 @@ var init_bulk_sync_postgres = __esm({
|
|
|
11013
11311
|
init_cloud_sync();
|
|
11014
11312
|
BATCH_SIZE = 500;
|
|
11015
11313
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
11016
|
-
|
|
11314
|
+
main5().catch((err) => {
|
|
11017
11315
|
process.stderr.write(`[bulk-sync] FATAL: ${err instanceof Error ? err.message : String(err)}
|
|
11018
11316
|
`);
|
|
11019
11317
|
process.exit(1);
|
|
@@ -11030,12 +11328,12 @@ __export(backfill_conversations_exports, {
|
|
|
11030
11328
|
import crypto6 from "crypto";
|
|
11031
11329
|
import { createReadStream } from "fs";
|
|
11032
11330
|
import { readdir as readdir2, stat } from "fs/promises";
|
|
11033
|
-
import
|
|
11331
|
+
import path21 from "path";
|
|
11034
11332
|
import { createInterface as createInterface3 } from "readline";
|
|
11035
11333
|
import { homedir as homedir3 } from "os";
|
|
11036
11334
|
import { parseArgs } from "util";
|
|
11037
11335
|
async function findJsonlFiles(sinceDate, projectFilter) {
|
|
11038
|
-
const projectsDir =
|
|
11336
|
+
const projectsDir = path21.join(homedir3(), ".claude", "projects");
|
|
11039
11337
|
const files = [];
|
|
11040
11338
|
async function walk(dir, depth = 0) {
|
|
11041
11339
|
if (depth > MAX_WALK_DEPTH) return;
|
|
@@ -11046,7 +11344,7 @@ async function findJsonlFiles(sinceDate, projectFilter) {
|
|
|
11046
11344
|
return;
|
|
11047
11345
|
}
|
|
11048
11346
|
for (const entry of entries) {
|
|
11049
|
-
const full =
|
|
11347
|
+
const full = path21.join(dir, entry.name);
|
|
11050
11348
|
if (entry.isDirectory()) {
|
|
11051
11349
|
if (entry.name === "subagents" || entry.name === "tool-results") continue;
|
|
11052
11350
|
await walk(full, depth + 1);
|
|
@@ -11071,7 +11369,7 @@ async function findJsonlFiles(sinceDate, projectFilter) {
|
|
|
11071
11369
|
if (!entry.isDirectory()) continue;
|
|
11072
11370
|
const decoded = decodeProjectDir(entry.name);
|
|
11073
11371
|
if (decoded.toLowerCase().includes(projectFilter.toLowerCase())) {
|
|
11074
|
-
await walk(
|
|
11372
|
+
await walk(path21.join(projectsDir, entry.name));
|
|
11075
11373
|
}
|
|
11076
11374
|
}
|
|
11077
11375
|
} else {
|
|
@@ -11088,14 +11386,14 @@ function decodeProjectDir(dirName) {
|
|
|
11088
11386
|
return dirName;
|
|
11089
11387
|
}
|
|
11090
11388
|
function projectNameFromPath(filePath) {
|
|
11091
|
-
const projectsDir =
|
|
11092
|
-
const relative =
|
|
11093
|
-
const projectDir = relative.split(
|
|
11389
|
+
const projectsDir = path21.join(homedir3(), ".claude", "projects");
|
|
11390
|
+
const relative = path21.relative(projectsDir, filePath);
|
|
11391
|
+
const projectDir = relative.split(path21.sep)[0] ?? "unknown";
|
|
11094
11392
|
return decodeProjectDir(projectDir);
|
|
11095
11393
|
}
|
|
11096
11394
|
async function parseConversation(filePath) {
|
|
11097
11395
|
const conv = {
|
|
11098
|
-
sessionId:
|
|
11396
|
+
sessionId: path21.basename(filePath, ".jsonl"),
|
|
11099
11397
|
projectName: projectNameFromPath(filePath),
|
|
11100
11398
|
cwd: void 0,
|
|
11101
11399
|
startTime: void 0,
|
|
@@ -11159,7 +11457,7 @@ async function parseConversation(filePath) {
|
|
|
11159
11457
|
}
|
|
11160
11458
|
}
|
|
11161
11459
|
if (conv.cwd) {
|
|
11162
|
-
conv.projectName =
|
|
11460
|
+
conv.projectName = path21.basename(conv.cwd);
|
|
11163
11461
|
const worktreeMatch = conv.cwd.match(/\.worktrees\/([^/]+)/);
|
|
11164
11462
|
if (worktreeMatch?.[1]) {
|
|
11165
11463
|
conv.agentId = worktreeMatch[1];
|
|
@@ -11811,9 +12109,9 @@ Unclassified: ${unclassified}
|
|
|
11811
12109
|
}
|
|
11812
12110
|
async function exportBatches(options) {
|
|
11813
12111
|
const fs8 = await import("fs");
|
|
11814
|
-
const
|
|
12112
|
+
const path56 = await import("path");
|
|
11815
12113
|
const client = getClient();
|
|
11816
|
-
const outDir =
|
|
12114
|
+
const outDir = path56.join(process.cwd(), "exe/output/classifications/input");
|
|
11817
12115
|
fs8.mkdirSync(outDir, { recursive: true });
|
|
11818
12116
|
const countResult = await client.execute({
|
|
11819
12117
|
sql: "SELECT COUNT(*) as cnt FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL",
|
|
@@ -11837,7 +12135,7 @@ async function exportBatches(options) {
|
|
|
11837
12135
|
const text = String(row.text || "").replace(/\n/g, " ");
|
|
11838
12136
|
return JSON.stringify({ id: row.id, text });
|
|
11839
12137
|
});
|
|
11840
|
-
const batchFile =
|
|
12138
|
+
const batchFile = path56.join(outDir, `batch-${String(batchNum).padStart(4, "0")}.jsonl`);
|
|
11841
12139
|
fs8.writeFileSync(batchFile, lines.join("\n") + "\n");
|
|
11842
12140
|
exported += batch.rows.length;
|
|
11843
12141
|
offset += options.batchSize;
|
|
@@ -11853,7 +12151,7 @@ async function exportBatches(options) {
|
|
|
11853
12151
|
}
|
|
11854
12152
|
async function importClassifications(importDir) {
|
|
11855
12153
|
const fs8 = await import("fs");
|
|
11856
|
-
const
|
|
12154
|
+
const path56 = await import("path");
|
|
11857
12155
|
const client = getClient();
|
|
11858
12156
|
const files = fs8.readdirSync(importDir).filter((f) => f.endsWith(".jsonl")).sort();
|
|
11859
12157
|
process.stderr.write(`[backfill-metadata] Found ${files.length} JSONL files to import from ${importDir}
|
|
@@ -11861,7 +12159,7 @@ async function importClassifications(importDir) {
|
|
|
11861
12159
|
let imported = 0;
|
|
11862
12160
|
let invalid = 0;
|
|
11863
12161
|
for (const file of files) {
|
|
11864
|
-
const lines = fs8.readFileSync(
|
|
12162
|
+
const lines = fs8.readFileSync(path56.join(importDir, file), "utf-8").split("\n").filter(Boolean);
|
|
11865
12163
|
for (const line of lines) {
|
|
11866
12164
|
try {
|
|
11867
12165
|
const rec = JSON.parse(line);
|
|
@@ -12002,17 +12300,17 @@ __export(identity_exports, {
|
|
|
12002
12300
|
listIdentities: () => listIdentities,
|
|
12003
12301
|
updateIdentity: () => updateIdentity
|
|
12004
12302
|
});
|
|
12005
|
-
import { existsSync as existsSync20, mkdirSync as
|
|
12303
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync14, readFileSync as readFileSync15, writeFileSync as writeFileSync14 } from "fs";
|
|
12006
12304
|
import { readdirSync as readdirSync4 } from "fs";
|
|
12007
|
-
import
|
|
12305
|
+
import path22 from "path";
|
|
12008
12306
|
import { createHash as createHash5 } from "crypto";
|
|
12009
12307
|
function ensureDir() {
|
|
12010
12308
|
if (!existsSync20(IDENTITY_DIR2)) {
|
|
12011
|
-
|
|
12309
|
+
mkdirSync14(IDENTITY_DIR2, { recursive: true });
|
|
12012
12310
|
}
|
|
12013
12311
|
}
|
|
12014
12312
|
function identityPath(agentId) {
|
|
12015
|
-
return
|
|
12313
|
+
return path22.join(IDENTITY_DIR2, `${agentId}.md`);
|
|
12016
12314
|
}
|
|
12017
12315
|
function sanitizeIdentityBody(body) {
|
|
12018
12316
|
return body.replace(/<!--[\s\S]*?-->/g, "").trim();
|
|
@@ -12057,7 +12355,7 @@ function contentHash(content) {
|
|
|
12057
12355
|
function getIdentity(agentId) {
|
|
12058
12356
|
const filePath = identityPath(agentId);
|
|
12059
12357
|
if (!existsSync20(filePath)) return null;
|
|
12060
|
-
const raw =
|
|
12358
|
+
const raw = readFileSync15(filePath, "utf-8");
|
|
12061
12359
|
const { frontmatter, body } = parseFrontmatter(raw);
|
|
12062
12360
|
return {
|
|
12063
12361
|
agentId,
|
|
@@ -12071,7 +12369,7 @@ async function updateIdentity(agentId, content, updatedBy) {
|
|
|
12071
12369
|
ensureDir();
|
|
12072
12370
|
const filePath = identityPath(agentId);
|
|
12073
12371
|
const hash = contentHash(content);
|
|
12074
|
-
|
|
12372
|
+
writeFileSync14(filePath, content, "utf-8");
|
|
12075
12373
|
try {
|
|
12076
12374
|
const client = getClient();
|
|
12077
12375
|
await client.execute({
|
|
@@ -12129,15 +12427,15 @@ var init_identity = __esm({
|
|
|
12129
12427
|
"use strict";
|
|
12130
12428
|
init_config();
|
|
12131
12429
|
init_database();
|
|
12132
|
-
IDENTITY_DIR2 =
|
|
12430
|
+
IDENTITY_DIR2 = path22.join(EXE_AI_DIR, "identity");
|
|
12133
12431
|
}
|
|
12134
12432
|
});
|
|
12135
12433
|
|
|
12136
12434
|
// src/lib/orchestration-package.ts
|
|
12137
|
-
import { randomUUID as
|
|
12138
|
-
import { copyFileSync as copyFileSync4, existsSync as existsSync21, mkdirSync as
|
|
12435
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
12436
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync21, mkdirSync as mkdirSync15, readFileSync as readFileSync16, writeFileSync as writeFileSync15 } from "fs";
|
|
12139
12437
|
import os13 from "os";
|
|
12140
|
-
import
|
|
12438
|
+
import path23 from "path";
|
|
12141
12439
|
function ensureObject(value, label) {
|
|
12142
12440
|
if (value == null || Array.isArray(value) || typeof value !== "object") {
|
|
12143
12441
|
throw new Error(`${label} must be an object`);
|
|
@@ -12196,15 +12494,15 @@ function validateProcedureEntry(value, index) {
|
|
|
12196
12494
|
};
|
|
12197
12495
|
}
|
|
12198
12496
|
function getRosterPath() {
|
|
12199
|
-
return
|
|
12497
|
+
return path23.join(os13.homedir(), EXE_OS_DIRNAME, ROSTER_FILENAME);
|
|
12200
12498
|
}
|
|
12201
12499
|
function getBackupPath() {
|
|
12202
|
-
return
|
|
12500
|
+
return path23.join(os13.homedir(), EXE_OS_DIRNAME, ROSTER_BACKUP_FILENAME);
|
|
12203
12501
|
}
|
|
12204
12502
|
function readRosterFile() {
|
|
12205
12503
|
const rosterPath = getRosterPath();
|
|
12206
12504
|
if (!existsSync21(rosterPath)) return [];
|
|
12207
|
-
const raw =
|
|
12505
|
+
const raw = readFileSync16(rosterPath, "utf-8");
|
|
12208
12506
|
const parsed = JSON.parse(raw);
|
|
12209
12507
|
if (!Array.isArray(parsed)) {
|
|
12210
12508
|
throw new Error("Roster file must contain a JSON array");
|
|
@@ -12216,7 +12514,7 @@ function writeRosterFile(roster) {
|
|
|
12216
12514
|
throw new Error("Refusing to write empty roster \u2014 this would delete all employees");
|
|
12217
12515
|
}
|
|
12218
12516
|
const rosterPath = getRosterPath();
|
|
12219
|
-
|
|
12517
|
+
mkdirSync15(path23.dirname(rosterPath), { recursive: true });
|
|
12220
12518
|
if (existsSync21(rosterPath)) {
|
|
12221
12519
|
const currentRoster = readRosterFile();
|
|
12222
12520
|
if (roster.length < currentRoster.length) {
|
|
@@ -12226,7 +12524,7 @@ function writeRosterFile(roster) {
|
|
|
12226
12524
|
}
|
|
12227
12525
|
copyFileSync4(rosterPath, getBackupPath());
|
|
12228
12526
|
}
|
|
12229
|
-
|
|
12527
|
+
writeFileSync15(rosterPath, `${JSON.stringify(roster, null, 2)}
|
|
12230
12528
|
`, "utf-8");
|
|
12231
12529
|
}
|
|
12232
12530
|
function buildImportedRosterEntries(roster, timestamp) {
|
|
@@ -12246,7 +12544,7 @@ async function insertBehaviors(behaviors, timestamp) {
|
|
|
12246
12544
|
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, priority, content, active, created_at, updated_at)
|
|
12247
12545
|
VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
12248
12546
|
args: [
|
|
12249
|
-
|
|
12547
|
+
randomUUID5(),
|
|
12250
12548
|
behavior.agent_id,
|
|
12251
12549
|
behavior.project_name,
|
|
12252
12550
|
behavior.domain,
|
|
@@ -12271,7 +12569,7 @@ async function insertProcedures(procedures, timestamp, options) {
|
|
|
12271
12569
|
sql: `INSERT INTO company_procedures (id, title, content, priority, domain, active, created_at, updated_at)
|
|
12272
12570
|
VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
|
|
12273
12571
|
args: [
|
|
12274
|
-
|
|
12572
|
+
randomUUID5(),
|
|
12275
12573
|
procedure.title,
|
|
12276
12574
|
procedure.content,
|
|
12277
12575
|
procedure.priority,
|
|
@@ -12493,8 +12791,8 @@ var exe_export_exports = {};
|
|
|
12493
12791
|
__export(exe_export_exports, {
|
|
12494
12792
|
runExeExport: () => runExeExport
|
|
12495
12793
|
});
|
|
12496
|
-
import { mkdirSync as
|
|
12497
|
-
import
|
|
12794
|
+
import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync16 } from "fs";
|
|
12795
|
+
import path24 from "path";
|
|
12498
12796
|
function printUsage() {
|
|
12499
12797
|
process.stdout.write("Usage: exe-os export --output <path>\n");
|
|
12500
12798
|
}
|
|
@@ -12515,8 +12813,8 @@ async function runExeExport(argv = process.argv.slice(2)) {
|
|
|
12515
12813
|
await initStore();
|
|
12516
12814
|
try {
|
|
12517
12815
|
const pkg = await exportOrchestration("cli");
|
|
12518
|
-
|
|
12519
|
-
|
|
12816
|
+
mkdirSync16(path24.dirname(outputPath), { recursive: true });
|
|
12817
|
+
writeFileSync16(outputPath, `${JSON.stringify(pkg, null, 2)}
|
|
12520
12818
|
`, "utf-8");
|
|
12521
12819
|
process.stdout.write(
|
|
12522
12820
|
`Exported ${pkg.roster.length} roster entries, ${Object.keys(pkg.identities).length} identities, ${pkg.behaviors.length} behaviors, ${pkg.procedures.length} procedures to ${outputPath}
|
|
@@ -12552,7 +12850,7 @@ var exe_import_exports = {};
|
|
|
12552
12850
|
__export(exe_import_exports, {
|
|
12553
12851
|
runExeImport: () => runExeImport
|
|
12554
12852
|
});
|
|
12555
|
-
import { readFileSync as
|
|
12853
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
12556
12854
|
function printUsage2() {
|
|
12557
12855
|
process.stdout.write("Usage: exe-os import --from <path> [--merge]\n");
|
|
12558
12856
|
}
|
|
@@ -12575,7 +12873,7 @@ async function runExeImport(argv = process.argv.slice(2)) {
|
|
|
12575
12873
|
if (parsed == null) return;
|
|
12576
12874
|
await initStore();
|
|
12577
12875
|
try {
|
|
12578
|
-
const raw =
|
|
12876
|
+
const raw = readFileSync17(parsed.packagePath, "utf-8");
|
|
12579
12877
|
const pkg = validatePackage(JSON.parse(raw));
|
|
12580
12878
|
const result = await importOrchestration(pkg, parsed.strategy);
|
|
12581
12879
|
process.stdout.write(
|
|
@@ -12616,14 +12914,14 @@ __export(session_registry_exports, {
|
|
|
12616
12914
|
refreshSessionProject: () => refreshSessionProject,
|
|
12617
12915
|
registerSession: () => registerSession
|
|
12618
12916
|
});
|
|
12619
|
-
import { readFileSync as
|
|
12917
|
+
import { readFileSync as readFileSync18, writeFileSync as writeFileSync17, mkdirSync as mkdirSync17, existsSync as existsSync22 } from "fs";
|
|
12620
12918
|
import { execSync as execSync5 } from "child_process";
|
|
12621
|
-
import
|
|
12919
|
+
import path25 from "path";
|
|
12622
12920
|
import os14 from "os";
|
|
12623
12921
|
function registerSession(entry) {
|
|
12624
|
-
const dir =
|
|
12922
|
+
const dir = path25.dirname(REGISTRY_PATH);
|
|
12625
12923
|
if (!existsSync22(dir)) {
|
|
12626
|
-
|
|
12924
|
+
mkdirSync17(dir, { recursive: true });
|
|
12627
12925
|
}
|
|
12628
12926
|
const sessions = listSessions();
|
|
12629
12927
|
const idx = sessions.findIndex((s) => s.windowName === entry.windowName);
|
|
@@ -12632,7 +12930,7 @@ function registerSession(entry) {
|
|
|
12632
12930
|
} else {
|
|
12633
12931
|
sessions.push(entry);
|
|
12634
12932
|
}
|
|
12635
|
-
|
|
12933
|
+
writeFileSync17(REGISTRY_PATH, JSON.stringify(sessions, null, 2));
|
|
12636
12934
|
}
|
|
12637
12935
|
function refreshSessionProject(windowName, projectDir) {
|
|
12638
12936
|
const sessions = listSessions();
|
|
@@ -12640,13 +12938,13 @@ function refreshSessionProject(windowName, projectDir) {
|
|
|
12640
12938
|
if (!entry || entry.projectDir === projectDir) return;
|
|
12641
12939
|
entry.projectDir = projectDir;
|
|
12642
12940
|
try {
|
|
12643
|
-
|
|
12941
|
+
writeFileSync17(REGISTRY_PATH, JSON.stringify(sessions, null, 2));
|
|
12644
12942
|
} catch {
|
|
12645
12943
|
}
|
|
12646
12944
|
}
|
|
12647
12945
|
function listSessions() {
|
|
12648
12946
|
try {
|
|
12649
|
-
const raw =
|
|
12947
|
+
const raw = readFileSync18(REGISTRY_PATH, "utf8");
|
|
12650
12948
|
return JSON.parse(raw);
|
|
12651
12949
|
} catch {
|
|
12652
12950
|
return [];
|
|
@@ -12667,7 +12965,7 @@ function pruneStaleSessions() {
|
|
|
12667
12965
|
const alive = sessions.filter((s) => liveSet.has(s.windowName));
|
|
12668
12966
|
const pruned = sessions.length - alive.length;
|
|
12669
12967
|
if (pruned > 0) {
|
|
12670
|
-
|
|
12968
|
+
writeFileSync17(REGISTRY_PATH, JSON.stringify(alive, null, 2));
|
|
12671
12969
|
}
|
|
12672
12970
|
return pruned;
|
|
12673
12971
|
}
|
|
@@ -12675,7 +12973,7 @@ var REGISTRY_PATH;
|
|
|
12675
12973
|
var init_session_registry = __esm({
|
|
12676
12974
|
"src/lib/session-registry.ts"() {
|
|
12677
12975
|
"use strict";
|
|
12678
|
-
REGISTRY_PATH =
|
|
12976
|
+
REGISTRY_PATH = path25.join(os14.homedir(), ".exe-os", "session-registry.json");
|
|
12679
12977
|
}
|
|
12680
12978
|
});
|
|
12681
12979
|
|
|
@@ -12931,17 +13229,17 @@ __export(intercom_queue_exports, {
|
|
|
12931
13229
|
queueIntercom: () => queueIntercom,
|
|
12932
13230
|
readQueue: () => readQueue
|
|
12933
13231
|
});
|
|
12934
|
-
import { readFileSync as
|
|
12935
|
-
import
|
|
13232
|
+
import { readFileSync as readFileSync19, writeFileSync as writeFileSync18, renameSync as renameSync5, existsSync as existsSync23, mkdirSync as mkdirSync18 } from "fs";
|
|
13233
|
+
import path26 from "path";
|
|
12936
13234
|
import os15 from "os";
|
|
12937
13235
|
function ensureDir2() {
|
|
12938
|
-
const dir =
|
|
12939
|
-
if (!existsSync23(dir))
|
|
13236
|
+
const dir = path26.dirname(QUEUE_PATH);
|
|
13237
|
+
if (!existsSync23(dir)) mkdirSync18(dir, { recursive: true });
|
|
12940
13238
|
}
|
|
12941
13239
|
function readQueue() {
|
|
12942
13240
|
try {
|
|
12943
13241
|
if (!existsSync23(QUEUE_PATH)) return [];
|
|
12944
|
-
return JSON.parse(
|
|
13242
|
+
return JSON.parse(readFileSync19(QUEUE_PATH, "utf8"));
|
|
12945
13243
|
} catch {
|
|
12946
13244
|
return [];
|
|
12947
13245
|
}
|
|
@@ -12949,7 +13247,7 @@ function readQueue() {
|
|
|
12949
13247
|
function writeQueue(queue) {
|
|
12950
13248
|
ensureDir2();
|
|
12951
13249
|
const tmp = `${QUEUE_PATH}.tmp`;
|
|
12952
|
-
|
|
13250
|
+
writeFileSync18(tmp, JSON.stringify(queue, null, 2));
|
|
12953
13251
|
renameSync5(tmp, QUEUE_PATH);
|
|
12954
13252
|
}
|
|
12955
13253
|
function queueIntercom(targetSession, reason) {
|
|
@@ -13041,20 +13339,20 @@ var QUEUE_PATH, MAX_RETRIES2, TTL_MS, INTERCOM_LOG;
|
|
|
13041
13339
|
var init_intercom_queue = __esm({
|
|
13042
13340
|
"src/lib/intercom-queue.ts"() {
|
|
13043
13341
|
"use strict";
|
|
13044
|
-
QUEUE_PATH =
|
|
13342
|
+
QUEUE_PATH = path26.join(os15.homedir(), ".exe-os", "intercom-queue.json");
|
|
13045
13343
|
MAX_RETRIES2 = 5;
|
|
13046
13344
|
TTL_MS = 60 * 60 * 1e3;
|
|
13047
|
-
INTERCOM_LOG =
|
|
13345
|
+
INTERCOM_LOG = path26.join(os15.homedir(), ".exe-os", "intercom.log");
|
|
13048
13346
|
}
|
|
13049
13347
|
});
|
|
13050
13348
|
|
|
13051
13349
|
// src/lib/plan-limits.ts
|
|
13052
|
-
import { readFileSync as
|
|
13053
|
-
import
|
|
13350
|
+
import { readFileSync as readFileSync20, existsSync as existsSync24 } from "fs";
|
|
13351
|
+
import path27 from "path";
|
|
13054
13352
|
function getLicenseSync() {
|
|
13055
13353
|
try {
|
|
13056
13354
|
if (!existsSync24(CACHE_PATH2)) return freeLicense();
|
|
13057
|
-
const raw = JSON.parse(
|
|
13355
|
+
const raw = JSON.parse(readFileSync20(CACHE_PATH2, "utf8"));
|
|
13058
13356
|
if (!raw.token || typeof raw.token !== "string") return freeLicense();
|
|
13059
13357
|
const parts = raw.token.split(".");
|
|
13060
13358
|
if (parts.length !== 3) return freeLicense();
|
|
@@ -13093,7 +13391,7 @@ function assertEmployeeLimitSync(rosterPath) {
|
|
|
13093
13391
|
let count = 0;
|
|
13094
13392
|
try {
|
|
13095
13393
|
if (existsSync24(filePath)) {
|
|
13096
|
-
const raw =
|
|
13394
|
+
const raw = readFileSync20(filePath, "utf8");
|
|
13097
13395
|
const employees = JSON.parse(raw);
|
|
13098
13396
|
count = Array.isArray(employees) ? employees.length : 0;
|
|
13099
13397
|
}
|
|
@@ -13122,7 +13420,7 @@ var init_plan_limits = __esm({
|
|
|
13122
13420
|
this.name = "PlanLimitError";
|
|
13123
13421
|
}
|
|
13124
13422
|
};
|
|
13125
|
-
CACHE_PATH2 =
|
|
13423
|
+
CACHE_PATH2 = path27.join(EXE_AI_DIR, "license-cache.json");
|
|
13126
13424
|
}
|
|
13127
13425
|
});
|
|
13128
13426
|
|
|
@@ -13167,12 +13465,12 @@ var init_task_scope = __esm({
|
|
|
13167
13465
|
|
|
13168
13466
|
// src/lib/notifications.ts
|
|
13169
13467
|
import crypto7 from "crypto";
|
|
13170
|
-
import
|
|
13468
|
+
import path28 from "path";
|
|
13171
13469
|
import os16 from "os";
|
|
13172
13470
|
import {
|
|
13173
|
-
readFileSync as
|
|
13471
|
+
readFileSync as readFileSync21,
|
|
13174
13472
|
readdirSync as readdirSync5,
|
|
13175
|
-
unlinkSync as
|
|
13473
|
+
unlinkSync as unlinkSync8,
|
|
13176
13474
|
existsSync as existsSync25,
|
|
13177
13475
|
rmdirSync
|
|
13178
13476
|
} from "fs";
|
|
@@ -13258,7 +13556,7 @@ var init_session_kill_telemetry = __esm({
|
|
|
13258
13556
|
|
|
13259
13557
|
// src/lib/project-name.ts
|
|
13260
13558
|
import { execSync as execSync8 } from "child_process";
|
|
13261
|
-
import
|
|
13559
|
+
import path29 from "path";
|
|
13262
13560
|
function getProjectName(cwd2) {
|
|
13263
13561
|
const dir = cwd2 ?? process.cwd();
|
|
13264
13562
|
if (_cached2 && _cachedCwd === dir) return _cached2;
|
|
@@ -13271,7 +13569,7 @@ function getProjectName(cwd2) {
|
|
|
13271
13569
|
timeout: 2e3,
|
|
13272
13570
|
stdio: ["pipe", "pipe", "pipe"]
|
|
13273
13571
|
}).trim();
|
|
13274
|
-
repoRoot =
|
|
13572
|
+
repoRoot = path29.dirname(gitCommonDir);
|
|
13275
13573
|
} catch {
|
|
13276
13574
|
repoRoot = execSync8("git rev-parse --show-toplevel", {
|
|
13277
13575
|
cwd: dir,
|
|
@@ -13280,11 +13578,11 @@ function getProjectName(cwd2) {
|
|
|
13280
13578
|
stdio: ["pipe", "pipe", "pipe"]
|
|
13281
13579
|
}).trim();
|
|
13282
13580
|
}
|
|
13283
|
-
_cached2 =
|
|
13581
|
+
_cached2 = path29.basename(repoRoot);
|
|
13284
13582
|
_cachedCwd = dir;
|
|
13285
13583
|
return _cached2;
|
|
13286
13584
|
} catch {
|
|
13287
|
-
_cached2 =
|
|
13585
|
+
_cached2 = path29.basename(dir);
|
|
13288
13586
|
_cachedCwd = dir;
|
|
13289
13587
|
return _cached2;
|
|
13290
13588
|
}
|
|
@@ -13378,11 +13676,11 @@ __export(tasks_crud_exports, {
|
|
|
13378
13676
|
writeCheckpoint: () => writeCheckpoint
|
|
13379
13677
|
});
|
|
13380
13678
|
import crypto9 from "crypto";
|
|
13381
|
-
import
|
|
13679
|
+
import path30 from "path";
|
|
13382
13680
|
import os17 from "os";
|
|
13383
13681
|
import { execSync as execSync9 } from "child_process";
|
|
13384
13682
|
import { mkdir as mkdir5, writeFile as writeFile5, appendFile } from "fs/promises";
|
|
13385
|
-
import { existsSync as existsSync26, readFileSync as
|
|
13683
|
+
import { existsSync as existsSync26, readFileSync as readFileSync22 } from "fs";
|
|
13386
13684
|
async function writeCheckpoint(input) {
|
|
13387
13685
|
const client = getClient();
|
|
13388
13686
|
const row = await resolveTask(client, input.taskId);
|
|
@@ -13581,8 +13879,8 @@ ${scopeMismatchWarning}` : scopeMismatchWarning;
|
|
|
13581
13879
|
}
|
|
13582
13880
|
if (input.baseDir) {
|
|
13583
13881
|
try {
|
|
13584
|
-
await mkdir5(
|
|
13585
|
-
await mkdir5(
|
|
13882
|
+
await mkdir5(path30.join(input.baseDir, "exe", "output"), { recursive: true });
|
|
13883
|
+
await mkdir5(path30.join(input.baseDir, "exe", "research"), { recursive: true });
|
|
13586
13884
|
await ensureArchitectureDoc(input.baseDir, input.projectName);
|
|
13587
13885
|
await ensureGitignoreExe(input.baseDir);
|
|
13588
13886
|
} catch {
|
|
@@ -13618,9 +13916,9 @@ ${scopeMismatchWarning}` : scopeMismatchWarning;
|
|
|
13618
13916
|
});
|
|
13619
13917
|
if (input.baseDir) {
|
|
13620
13918
|
try {
|
|
13621
|
-
const EXE_OS_DIR =
|
|
13622
|
-
const mdPath =
|
|
13623
|
-
const mdDir =
|
|
13919
|
+
const EXE_OS_DIR = path30.join(os17.homedir(), ".exe-os");
|
|
13920
|
+
const mdPath = path30.join(EXE_OS_DIR, taskFile);
|
|
13921
|
+
const mdDir = path30.dirname(mdPath);
|
|
13624
13922
|
if (!existsSync26(mdDir)) await mkdir5(mdDir, { recursive: true });
|
|
13625
13923
|
const reviewer = input.reviewer ?? input.assignedBy;
|
|
13626
13924
|
const mdContent = `# ${input.title}
|
|
@@ -13725,12 +14023,12 @@ function isTmuxSessionAlive(identifier) {
|
|
|
13725
14023
|
if (!identifier || identifier === "unknown") return true;
|
|
13726
14024
|
try {
|
|
13727
14025
|
if (identifier.startsWith("%")) {
|
|
13728
|
-
const
|
|
14026
|
+
const output2 = execSync9("tmux list-panes -a -F '#{pane_id}'", {
|
|
13729
14027
|
timeout: 2e3,
|
|
13730
14028
|
encoding: "utf8",
|
|
13731
14029
|
stdio: ["pipe", "pipe", "pipe"]
|
|
13732
14030
|
});
|
|
13733
|
-
return
|
|
14031
|
+
return output2.split("\n").some((l) => l.trim() === identifier);
|
|
13734
14032
|
} else {
|
|
13735
14033
|
execSync9(`tmux has-session -t ${JSON.stringify(identifier)}`, {
|
|
13736
14034
|
timeout: 2e3,
|
|
@@ -13921,7 +14219,7 @@ async function deleteTaskCore(taskId, _baseDir) {
|
|
|
13921
14219
|
return { taskFile, assignedTo, assignedBy, taskSlug };
|
|
13922
14220
|
}
|
|
13923
14221
|
async function ensureArchitectureDoc(baseDir, projectName) {
|
|
13924
|
-
const archPath =
|
|
14222
|
+
const archPath = path30.join(baseDir, "exe", "ARCHITECTURE.md");
|
|
13925
14223
|
try {
|
|
13926
14224
|
if (existsSync26(archPath)) return;
|
|
13927
14225
|
const template = [
|
|
@@ -13956,10 +14254,10 @@ async function ensureArchitectureDoc(baseDir, projectName) {
|
|
|
13956
14254
|
}
|
|
13957
14255
|
}
|
|
13958
14256
|
async function ensureGitignoreExe(baseDir) {
|
|
13959
|
-
const gitignorePath =
|
|
14257
|
+
const gitignorePath = path30.join(baseDir, ".gitignore");
|
|
13960
14258
|
try {
|
|
13961
14259
|
if (existsSync26(gitignorePath)) {
|
|
13962
|
-
const content =
|
|
14260
|
+
const content = readFileSync22(gitignorePath, "utf-8");
|
|
13963
14261
|
if (/^\/?exe\/?$/m.test(content)) return;
|
|
13964
14262
|
await appendFile(gitignorePath, "\n# Employee task assignments (private)\n/exe/\n");
|
|
13965
14263
|
} else {
|
|
@@ -14002,8 +14300,8 @@ __export(tasks_review_exports, {
|
|
|
14002
14300
|
isStale: () => isStale,
|
|
14003
14301
|
listPendingReviews: () => listPendingReviews
|
|
14004
14302
|
});
|
|
14005
|
-
import
|
|
14006
|
-
import { existsSync as existsSync27, readdirSync as readdirSync6, unlinkSync as
|
|
14303
|
+
import path31 from "path";
|
|
14304
|
+
import { existsSync as existsSync27, readdirSync as readdirSync6, unlinkSync as unlinkSync9 } from "fs";
|
|
14007
14305
|
function formatAge(isoTimestamp) {
|
|
14008
14306
|
if (!isoTimestamp) return "";
|
|
14009
14307
|
const ms = Date.now() - new Date(isoTimestamp).getTime();
|
|
@@ -14272,11 +14570,11 @@ async function cleanupReviewFile(row, taskFile, _baseDir) {
|
|
|
14272
14570
|
);
|
|
14273
14571
|
}
|
|
14274
14572
|
try {
|
|
14275
|
-
const cacheDir =
|
|
14573
|
+
const cacheDir = path31.join(EXE_AI_DIR, "session-cache");
|
|
14276
14574
|
if (existsSync27(cacheDir)) {
|
|
14277
14575
|
for (const f of readdirSync6(cacheDir)) {
|
|
14278
14576
|
if (f.startsWith("review-notified-")) {
|
|
14279
|
-
|
|
14577
|
+
unlinkSync9(path31.join(cacheDir, f));
|
|
14280
14578
|
}
|
|
14281
14579
|
}
|
|
14282
14580
|
}
|
|
@@ -14298,7 +14596,7 @@ var init_tasks_review = __esm({
|
|
|
14298
14596
|
});
|
|
14299
14597
|
|
|
14300
14598
|
// src/lib/tasks-chain.ts
|
|
14301
|
-
import
|
|
14599
|
+
import path32 from "path";
|
|
14302
14600
|
import { readFile as readFile5, writeFile as writeFile6 } from "fs/promises";
|
|
14303
14601
|
async function cascadeUnblock(taskId, baseDir, now2) {
|
|
14304
14602
|
const client = getClient();
|
|
@@ -14315,7 +14613,7 @@ async function cascadeUnblock(taskId, baseDir, now2) {
|
|
|
14315
14613
|
});
|
|
14316
14614
|
for (const ur of unblockedRows.rows) {
|
|
14317
14615
|
try {
|
|
14318
|
-
const ubFile =
|
|
14616
|
+
const ubFile = path32.join(baseDir, String(ur.task_file));
|
|
14319
14617
|
let ubContent = await readFile5(ubFile, "utf-8");
|
|
14320
14618
|
ubContent = ubContent.replace(/\*\*Status:\*\* blocked/, "**Status:** open");
|
|
14321
14619
|
ubContent = ubContent.replace(/\n\*\*Blocked by:\*\*.*\n/, "\n");
|
|
@@ -14500,8 +14798,8 @@ async function embedDirect(text) {
|
|
|
14500
14798
|
const llamaCpp = await import("node-llama-cpp");
|
|
14501
14799
|
const { MODELS_DIR: MODELS_DIR2 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
14502
14800
|
const { existsSync: existsSync41 } = await import("fs");
|
|
14503
|
-
const
|
|
14504
|
-
const modelPath =
|
|
14801
|
+
const path56 = await import("path");
|
|
14802
|
+
const modelPath = path56.join(MODELS_DIR2, "jina-embeddings-v5-small-q4_k_m.gguf");
|
|
14505
14803
|
if (!existsSync41(modelPath)) {
|
|
14506
14804
|
throw new Error(`Embedding model not found at ${modelPath}. Run '/exe-setup' to download it.`);
|
|
14507
14805
|
}
|
|
@@ -14868,8 +15166,8 @@ __export(tasks_exports, {
|
|
|
14868
15166
|
updateTaskStatus: () => updateTaskStatus,
|
|
14869
15167
|
writeCheckpoint: () => writeCheckpoint
|
|
14870
15168
|
});
|
|
14871
|
-
import
|
|
14872
|
-
import { writeFileSync as
|
|
15169
|
+
import path33 from "path";
|
|
15170
|
+
import { writeFileSync as writeFileSync19, mkdirSync as mkdirSync19, unlinkSync as unlinkSync10 } from "fs";
|
|
14873
15171
|
async function createTask(input) {
|
|
14874
15172
|
const result = await createTaskCore(input);
|
|
14875
15173
|
if (!input.skipDispatch && result.status !== "blocked" && !process.env.VITEST) {
|
|
@@ -14888,14 +15186,14 @@ async function updateTask(input) {
|
|
|
14888
15186
|
const { row, taskFile, now: now2, taskId } = await updateTaskStatus(input);
|
|
14889
15187
|
try {
|
|
14890
15188
|
const agent = String(row.assigned_to);
|
|
14891
|
-
const cacheDir =
|
|
14892
|
-
const cachePath =
|
|
15189
|
+
const cacheDir = path33.join(EXE_AI_DIR, "session-cache");
|
|
15190
|
+
const cachePath = path33.join(cacheDir, `current-task-${agent}.json`);
|
|
14893
15191
|
if (input.status === "in_progress") {
|
|
14894
|
-
|
|
14895
|
-
|
|
15192
|
+
mkdirSync19(cacheDir, { recursive: true });
|
|
15193
|
+
writeFileSync19(cachePath, JSON.stringify({ taskId, title: String(row.title) }));
|
|
14896
15194
|
} else if (input.status === "done" || input.status === "blocked" || input.status === "cancelled" || input.status === "closed") {
|
|
14897
15195
|
try {
|
|
14898
|
-
|
|
15196
|
+
unlinkSync10(cachePath);
|
|
14899
15197
|
} catch {
|
|
14900
15198
|
}
|
|
14901
15199
|
}
|
|
@@ -15361,13 +15659,13 @@ __export(tmux_routing_exports, {
|
|
|
15361
15659
|
verifyPaneAtCapacity: () => verifyPaneAtCapacity
|
|
15362
15660
|
});
|
|
15363
15661
|
import { execFileSync as execFileSync3, execSync as execSync10 } from "child_process";
|
|
15364
|
-
import { readFileSync as
|
|
15365
|
-
import
|
|
15662
|
+
import { readFileSync as readFileSync23, writeFileSync as writeFileSync20, mkdirSync as mkdirSync20, existsSync as existsSync28, appendFileSync as appendFileSync2, readdirSync as readdirSync7 } from "fs";
|
|
15663
|
+
import path34 from "path";
|
|
15366
15664
|
import os18 from "os";
|
|
15367
15665
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
15368
|
-
import { unlinkSync as
|
|
15666
|
+
import { unlinkSync as unlinkSync11 } from "fs";
|
|
15369
15667
|
function spawnLockPath(sessionName) {
|
|
15370
|
-
return
|
|
15668
|
+
return path34.join(SPAWN_LOCK_DIR, `${sessionName}.lock`);
|
|
15371
15669
|
}
|
|
15372
15670
|
function isProcessAlive(pid) {
|
|
15373
15671
|
try {
|
|
@@ -15379,12 +15677,12 @@ function isProcessAlive(pid) {
|
|
|
15379
15677
|
}
|
|
15380
15678
|
function acquireSpawnLock2(sessionName) {
|
|
15381
15679
|
if (!existsSync28(SPAWN_LOCK_DIR)) {
|
|
15382
|
-
|
|
15680
|
+
mkdirSync20(SPAWN_LOCK_DIR, { recursive: true });
|
|
15383
15681
|
}
|
|
15384
15682
|
const lockFile = spawnLockPath(sessionName);
|
|
15385
15683
|
if (existsSync28(lockFile)) {
|
|
15386
15684
|
try {
|
|
15387
|
-
const lock = JSON.parse(
|
|
15685
|
+
const lock = JSON.parse(readFileSync23(lockFile, "utf8"));
|
|
15388
15686
|
const age = Date.now() - lock.timestamp;
|
|
15389
15687
|
if (isProcessAlive(lock.pid) && age < 6e4) {
|
|
15390
15688
|
return false;
|
|
@@ -15392,20 +15690,20 @@ function acquireSpawnLock2(sessionName) {
|
|
|
15392
15690
|
} catch {
|
|
15393
15691
|
}
|
|
15394
15692
|
}
|
|
15395
|
-
|
|
15693
|
+
writeFileSync20(lockFile, JSON.stringify({ pid: process.pid, timestamp: Date.now() }));
|
|
15396
15694
|
return true;
|
|
15397
15695
|
}
|
|
15398
15696
|
function releaseSpawnLock2(sessionName) {
|
|
15399
15697
|
try {
|
|
15400
|
-
|
|
15698
|
+
unlinkSync11(spawnLockPath(sessionName));
|
|
15401
15699
|
} catch {
|
|
15402
15700
|
}
|
|
15403
15701
|
}
|
|
15404
15702
|
function resolveBehaviorsExporterScript() {
|
|
15405
15703
|
try {
|
|
15406
15704
|
const thisFile = fileURLToPath4(import.meta.url);
|
|
15407
|
-
const scriptPath =
|
|
15408
|
-
|
|
15705
|
+
const scriptPath = path34.join(
|
|
15706
|
+
path34.dirname(thisFile),
|
|
15409
15707
|
"..",
|
|
15410
15708
|
"bin",
|
|
15411
15709
|
"exe-export-behaviors.js"
|
|
@@ -15419,12 +15717,12 @@ function exportBehaviorsSync(agentId, projectName, sessionKey) {
|
|
|
15419
15717
|
const script = resolveBehaviorsExporterScript();
|
|
15420
15718
|
if (!script) return null;
|
|
15421
15719
|
try {
|
|
15422
|
-
const
|
|
15720
|
+
const output2 = execFileSync3(
|
|
15423
15721
|
process.execPath,
|
|
15424
15722
|
[script, agentId, projectName, sessionKey],
|
|
15425
15723
|
{ encoding: "utf-8", timeout: BEHAVIORS_EXPORT_TIMEOUT_MS }
|
|
15426
15724
|
).trim();
|
|
15427
|
-
return
|
|
15725
|
+
return output2.length > 0 ? output2 : null;
|
|
15428
15726
|
} catch (err) {
|
|
15429
15727
|
process.stderr.write(
|
|
15430
15728
|
`[tmux-routing] behaviors export failed for ${agentId}: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -15477,11 +15775,11 @@ function extractRootExe(name) {
|
|
|
15477
15775
|
}
|
|
15478
15776
|
function registerParentExe(sessionKey, parentExe, dispatchedBy) {
|
|
15479
15777
|
if (!existsSync28(SESSION_CACHE)) {
|
|
15480
|
-
|
|
15778
|
+
mkdirSync20(SESSION_CACHE, { recursive: true });
|
|
15481
15779
|
}
|
|
15482
15780
|
const rootExe = extractRootExe(parentExe) ?? parentExe;
|
|
15483
|
-
const filePath =
|
|
15484
|
-
|
|
15781
|
+
const filePath = path34.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`);
|
|
15782
|
+
writeFileSync20(filePath, JSON.stringify({
|
|
15485
15783
|
parentExe: rootExe,
|
|
15486
15784
|
dispatchedBy: dispatchedBy || rootExe,
|
|
15487
15785
|
registeredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -15489,7 +15787,7 @@ function registerParentExe(sessionKey, parentExe, dispatchedBy) {
|
|
|
15489
15787
|
}
|
|
15490
15788
|
function getParentExe(sessionKey) {
|
|
15491
15789
|
try {
|
|
15492
|
-
const data = JSON.parse(
|
|
15790
|
+
const data = JSON.parse(readFileSync23(path34.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`), "utf8"));
|
|
15493
15791
|
return data.parentExe || null;
|
|
15494
15792
|
} catch {
|
|
15495
15793
|
return null;
|
|
@@ -15497,8 +15795,8 @@ function getParentExe(sessionKey) {
|
|
|
15497
15795
|
}
|
|
15498
15796
|
function getDispatchedBy(sessionKey) {
|
|
15499
15797
|
try {
|
|
15500
|
-
const data = JSON.parse(
|
|
15501
|
-
|
|
15798
|
+
const data = JSON.parse(readFileSync23(
|
|
15799
|
+
path34.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`),
|
|
15502
15800
|
"utf8"
|
|
15503
15801
|
));
|
|
15504
15802
|
return data.dispatchedBy ?? data.parentExe ?? null;
|
|
@@ -15569,7 +15867,7 @@ async function verifyPaneAtCapacity(sessionName) {
|
|
|
15569
15867
|
function readDebounceState() {
|
|
15570
15868
|
try {
|
|
15571
15869
|
if (!existsSync28(DEBOUNCE_FILE)) return {};
|
|
15572
|
-
const raw = JSON.parse(
|
|
15870
|
+
const raw = JSON.parse(readFileSync23(DEBOUNCE_FILE, "utf8"));
|
|
15573
15871
|
const state = {};
|
|
15574
15872
|
for (const [key, val] of Object.entries(raw)) {
|
|
15575
15873
|
if (typeof val === "number") {
|
|
@@ -15585,8 +15883,8 @@ function readDebounceState() {
|
|
|
15585
15883
|
}
|
|
15586
15884
|
function writeDebounceState(state) {
|
|
15587
15885
|
try {
|
|
15588
|
-
if (!existsSync28(SESSION_CACHE))
|
|
15589
|
-
|
|
15886
|
+
if (!existsSync28(SESSION_CACHE)) mkdirSync20(SESSION_CACHE, { recursive: true });
|
|
15887
|
+
writeFileSync20(DEBOUNCE_FILE, JSON.stringify(state));
|
|
15590
15888
|
} catch {
|
|
15591
15889
|
}
|
|
15592
15890
|
}
|
|
@@ -15685,7 +15983,7 @@ function sendIntercom(targetSession) {
|
|
|
15685
15983
|
try {
|
|
15686
15984
|
const rawAgent = targetSession.split("-")[0] ?? targetSession;
|
|
15687
15985
|
const agent = baseAgentName(rawAgent);
|
|
15688
|
-
const markerPath =
|
|
15986
|
+
const markerPath = path34.join(SESSION_CACHE, `current-task-${agent}.json`);
|
|
15689
15987
|
if (existsSync28(markerPath)) {
|
|
15690
15988
|
logIntercom(`SKIP \u2192 ${targetSession} (has in_progress task marker + not idle \u2014 will auto-chain)`);
|
|
15691
15989
|
return "debounced";
|
|
@@ -15696,7 +15994,7 @@ function sendIntercom(targetSession) {
|
|
|
15696
15994
|
try {
|
|
15697
15995
|
const rawAgent = targetSession.split("-")[0] ?? targetSession;
|
|
15698
15996
|
const agent = baseAgentName(rawAgent);
|
|
15699
|
-
const taskDir =
|
|
15997
|
+
const taskDir = path34.join(process.cwd(), "exe", agent);
|
|
15700
15998
|
if (existsSync28(taskDir)) {
|
|
15701
15999
|
const files = readdirSync7(taskDir).filter(
|
|
15702
16000
|
(f) => f.endsWith(".md") && f !== "DONE.txt"
|
|
@@ -15856,26 +16154,26 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
|
|
|
15856
16154
|
const transport = getTransport();
|
|
15857
16155
|
const sessionName = employeeSessionName(employeeName, exeSession, opts?.instance);
|
|
15858
16156
|
const instanceLabel = opts?.instance != null && opts.instance > 0 ? `${employeeName}${opts.instance}` : employeeName;
|
|
15859
|
-
const logDir =
|
|
15860
|
-
const logFile =
|
|
16157
|
+
const logDir = path34.join(os18.homedir(), ".exe-os", "session-logs");
|
|
16158
|
+
const logFile = path34.join(logDir, `${instanceLabel}-${Date.now()}.log`);
|
|
15861
16159
|
if (!existsSync28(logDir)) {
|
|
15862
|
-
|
|
16160
|
+
mkdirSync20(logDir, { recursive: true });
|
|
15863
16161
|
}
|
|
15864
16162
|
transport.kill(sessionName);
|
|
15865
16163
|
let cleanupSuffix = "";
|
|
15866
16164
|
try {
|
|
15867
16165
|
const thisFile = fileURLToPath4(import.meta.url);
|
|
15868
|
-
const cleanupScript =
|
|
16166
|
+
const cleanupScript = path34.join(path34.dirname(thisFile), "..", "bin", "exe-session-cleanup.js");
|
|
15869
16167
|
if (existsSync28(cleanupScript)) {
|
|
15870
16168
|
cleanupSuffix = `; ${process.execPath} "${cleanupScript}" "${employeeName}" "${exeSession}"`;
|
|
15871
16169
|
}
|
|
15872
16170
|
} catch {
|
|
15873
16171
|
}
|
|
15874
16172
|
try {
|
|
15875
|
-
const claudeJsonPath =
|
|
16173
|
+
const claudeJsonPath = path34.join(os18.homedir(), ".claude.json");
|
|
15876
16174
|
let claudeJson = {};
|
|
15877
16175
|
try {
|
|
15878
|
-
claudeJson = JSON.parse(
|
|
16176
|
+
claudeJson = JSON.parse(readFileSync23(claudeJsonPath, "utf8"));
|
|
15879
16177
|
} catch {
|
|
15880
16178
|
}
|
|
15881
16179
|
if (!claudeJson.projects) claudeJson.projects = {};
|
|
@@ -15883,17 +16181,17 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
|
|
|
15883
16181
|
const trustDir = opts?.cwd ?? projectDir;
|
|
15884
16182
|
if (!projects[trustDir]) projects[trustDir] = {};
|
|
15885
16183
|
projects[trustDir].hasTrustDialogAccepted = true;
|
|
15886
|
-
|
|
16184
|
+
writeFileSync20(claudeJsonPath, JSON.stringify(claudeJson, null, 2) + "\n");
|
|
15887
16185
|
} catch {
|
|
15888
16186
|
}
|
|
15889
16187
|
try {
|
|
15890
|
-
const settingsDir =
|
|
16188
|
+
const settingsDir = path34.join(os18.homedir(), ".claude", "projects");
|
|
15891
16189
|
const normalizedKey = (opts?.cwd ?? projectDir).replace(/\//g, "-").replace(/^-/, "");
|
|
15892
|
-
const projSettingsDir =
|
|
15893
|
-
const settingsPath =
|
|
16190
|
+
const projSettingsDir = path34.join(settingsDir, normalizedKey);
|
|
16191
|
+
const settingsPath = path34.join(projSettingsDir, "settings.json");
|
|
15894
16192
|
let settings = {};
|
|
15895
16193
|
try {
|
|
15896
|
-
settings = JSON.parse(
|
|
16194
|
+
settings = JSON.parse(readFileSync23(settingsPath, "utf8"));
|
|
15897
16195
|
} catch {
|
|
15898
16196
|
}
|
|
15899
16197
|
const perms = settings.permissions ?? {};
|
|
@@ -15921,8 +16219,8 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
|
|
|
15921
16219
|
if (changed) {
|
|
15922
16220
|
perms.allow = allow;
|
|
15923
16221
|
settings.permissions = perms;
|
|
15924
|
-
|
|
15925
|
-
|
|
16222
|
+
mkdirSync20(projSettingsDir, { recursive: true });
|
|
16223
|
+
writeFileSync20(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
15926
16224
|
}
|
|
15927
16225
|
} catch {
|
|
15928
16226
|
}
|
|
@@ -15937,7 +16235,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
|
|
|
15937
16235
|
let behaviorsFlag = "";
|
|
15938
16236
|
let legacyFallbackWarned = false;
|
|
15939
16237
|
if (!useExeAgent && !useBinSymlink) {
|
|
15940
|
-
const identityPath2 =
|
|
16238
|
+
const identityPath2 = path34.join(
|
|
15941
16239
|
os18.homedir(),
|
|
15942
16240
|
".exe-os",
|
|
15943
16241
|
"identity",
|
|
@@ -15960,7 +16258,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
|
|
|
15960
16258
|
}
|
|
15961
16259
|
const behaviorsFile = exportBehaviorsSync(
|
|
15962
16260
|
employeeName,
|
|
15963
|
-
|
|
16261
|
+
path34.basename(spawnCwd),
|
|
15964
16262
|
sessionName
|
|
15965
16263
|
);
|
|
15966
16264
|
if (behaviorsFile) {
|
|
@@ -15975,16 +16273,16 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
|
|
|
15975
16273
|
}
|
|
15976
16274
|
let sessionContextFlag = "";
|
|
15977
16275
|
try {
|
|
15978
|
-
const ctxDir =
|
|
15979
|
-
|
|
15980
|
-
const ctxFile =
|
|
16276
|
+
const ctxDir = path34.join(os18.homedir(), ".exe-os", "session-cache");
|
|
16277
|
+
mkdirSync20(ctxDir, { recursive: true });
|
|
16278
|
+
const ctxFile = path34.join(ctxDir, `session-context-${sessionName}.md`);
|
|
15981
16279
|
const ctxContent = [
|
|
15982
16280
|
`## Session Context`,
|
|
15983
16281
|
`You are running in tmux session: ${sessionName}.`,
|
|
15984
16282
|
`Your parent coordinator session is ${exeSession}.`,
|
|
15985
16283
|
`Your employees (if any) use the -${exeSession} suffix.`
|
|
15986
16284
|
].join("\n");
|
|
15987
|
-
|
|
16285
|
+
writeFileSync20(ctxFile, ctxContent);
|
|
15988
16286
|
sessionContextFlag = ` --append-system-prompt-file ${ctxFile}`;
|
|
15989
16287
|
} catch {
|
|
15990
16288
|
}
|
|
@@ -16067,8 +16365,8 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
|
|
|
16067
16365
|
transport.pipeLog(sessionName, logFile);
|
|
16068
16366
|
try {
|
|
16069
16367
|
const mySession = getMySession();
|
|
16070
|
-
const dispatchInfo =
|
|
16071
|
-
|
|
16368
|
+
const dispatchInfo = path34.join(SESSION_CACHE, `dispatch-info-${sessionName}.json`);
|
|
16369
|
+
writeFileSync20(dispatchInfo, JSON.stringify({
|
|
16072
16370
|
dispatchedBy: mySession,
|
|
16073
16371
|
rootExe: exeSession,
|
|
16074
16372
|
provider: useBinSymlink ? ccProvider : useExeAgent ? opts.provider : useCodex ? "openai" : useOpencode ? "opencode" : "anthropic",
|
|
@@ -16143,15 +16441,15 @@ var init_tmux_routing = __esm({
|
|
|
16143
16441
|
init_plan_limits();
|
|
16144
16442
|
init_employees();
|
|
16145
16443
|
init_agent_symlinks();
|
|
16146
|
-
SPAWN_LOCK_DIR =
|
|
16147
|
-
SESSION_CACHE =
|
|
16444
|
+
SPAWN_LOCK_DIR = path34.join(os18.homedir(), ".exe-os", "spawn-locks");
|
|
16445
|
+
SESSION_CACHE = path34.join(os18.homedir(), ".exe-os", "session-cache");
|
|
16148
16446
|
BEHAVIORS_EXPORT_TIMEOUT_MS = 1e4;
|
|
16149
16447
|
VALID_SESSION_NAME = /^[a-z]+\d*-[a-zA-Z0-9_]+$/;
|
|
16150
16448
|
VERIFY_PANE_LINES = 200;
|
|
16151
16449
|
INTERCOM_DEBOUNCE_MS = 3e4;
|
|
16152
16450
|
CODEX_DEBOUNCE_MS = 12e4;
|
|
16153
|
-
INTERCOM_LOG2 =
|
|
16154
|
-
DEBOUNCE_FILE =
|
|
16451
|
+
INTERCOM_LOG2 = path34.join(os18.homedir(), ".exe-os", "intercom.log");
|
|
16452
|
+
DEBOUNCE_FILE = path34.join(SESSION_CACHE, "intercom-debounce.json");
|
|
16155
16453
|
DEBOUNCE_CLEANUP_AGE_MS = 5 * 60 * 1e3;
|
|
16156
16454
|
BUSY_PATTERN = /[✻✽✶✳·].*…|Running…|• Working|• Ran |• Explored|• Called|esc to interrupt/;
|
|
16157
16455
|
}
|
|
@@ -16453,9 +16751,9 @@ __export(active_agent_exports, {
|
|
|
16453
16751
|
resolveActiveAgentFromTmuxSession: () => resolveActiveAgentFromTmuxSession,
|
|
16454
16752
|
writeActiveAgent: () => writeActiveAgent
|
|
16455
16753
|
});
|
|
16456
|
-
import { readFileSync as
|
|
16754
|
+
import { readFileSync as readFileSync24, writeFileSync as writeFileSync21, mkdirSync as mkdirSync21, unlinkSync as unlinkSync12, readdirSync as readdirSync8 } from "fs";
|
|
16457
16755
|
import { execSync as execSync11 } from "child_process";
|
|
16458
|
-
import
|
|
16756
|
+
import path35 from "path";
|
|
16459
16757
|
function isNameWithOptionalInstance(candidate, baseName) {
|
|
16460
16758
|
if (candidate === baseName) return true;
|
|
16461
16759
|
if (!candidate.startsWith(baseName)) return false;
|
|
@@ -16499,12 +16797,12 @@ function resolveActiveAgentFromTmuxSession(sessionName) {
|
|
|
16499
16797
|
return null;
|
|
16500
16798
|
}
|
|
16501
16799
|
function getMarkerPath() {
|
|
16502
|
-
return
|
|
16800
|
+
return path35.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
|
|
16503
16801
|
}
|
|
16504
16802
|
function writeActiveAgent(agentId, agentRole) {
|
|
16505
16803
|
try {
|
|
16506
|
-
|
|
16507
|
-
|
|
16804
|
+
mkdirSync21(CACHE_DIR, { recursive: true });
|
|
16805
|
+
writeFileSync21(
|
|
16508
16806
|
getMarkerPath(),
|
|
16509
16807
|
JSON.stringify({ agentId, agentRole, startedAt: (/* @__PURE__ */ new Date()).toISOString() })
|
|
16510
16808
|
);
|
|
@@ -16513,7 +16811,7 @@ function writeActiveAgent(agentId, agentRole) {
|
|
|
16513
16811
|
}
|
|
16514
16812
|
function clearActiveAgent() {
|
|
16515
16813
|
try {
|
|
16516
|
-
|
|
16814
|
+
unlinkSync12(getMarkerPath());
|
|
16517
16815
|
} catch {
|
|
16518
16816
|
}
|
|
16519
16817
|
}
|
|
@@ -16522,14 +16820,14 @@ function getActiveAgent() {
|
|
|
16522
16820
|
if (httpCtx) return httpCtx;
|
|
16523
16821
|
try {
|
|
16524
16822
|
const markerPath = getMarkerPath();
|
|
16525
|
-
const raw =
|
|
16823
|
+
const raw = readFileSync24(markerPath, "utf8");
|
|
16526
16824
|
const data = JSON.parse(raw);
|
|
16527
16825
|
if (data.agentId) {
|
|
16528
16826
|
if (data.startedAt) {
|
|
16529
16827
|
const age = Date.now() - new Date(data.startedAt).getTime();
|
|
16530
16828
|
if (age > STALE_MS) {
|
|
16531
16829
|
try {
|
|
16532
|
-
|
|
16830
|
+
unlinkSync12(markerPath);
|
|
16533
16831
|
} catch {
|
|
16534
16832
|
}
|
|
16535
16833
|
} else {
|
|
@@ -16570,14 +16868,14 @@ function getAllActiveAgents() {
|
|
|
16570
16868
|
const key = file.slice("active-agent-".length, -".json".length);
|
|
16571
16869
|
if (key === "undefined") continue;
|
|
16572
16870
|
try {
|
|
16573
|
-
const raw =
|
|
16871
|
+
const raw = readFileSync24(path35.join(CACHE_DIR, file), "utf8");
|
|
16574
16872
|
const data = JSON.parse(raw);
|
|
16575
16873
|
if (!data.agentId) continue;
|
|
16576
16874
|
if (data.startedAt) {
|
|
16577
16875
|
const age = Date.now() - new Date(data.startedAt).getTime();
|
|
16578
16876
|
if (age > STALE_MS) {
|
|
16579
16877
|
try {
|
|
16580
|
-
|
|
16878
|
+
unlinkSync12(path35.join(CACHE_DIR, file));
|
|
16581
16879
|
} catch {
|
|
16582
16880
|
}
|
|
16583
16881
|
continue;
|
|
@@ -16600,11 +16898,11 @@ function getAllActiveAgents() {
|
|
|
16600
16898
|
function cleanupSessionMarkers() {
|
|
16601
16899
|
const key = getSessionKey();
|
|
16602
16900
|
try {
|
|
16603
|
-
|
|
16901
|
+
unlinkSync12(path35.join(CACHE_DIR, `active-agent-${key}.json`));
|
|
16604
16902
|
} catch {
|
|
16605
16903
|
}
|
|
16606
16904
|
try {
|
|
16607
|
-
|
|
16905
|
+
unlinkSync12(path35.join(CACHE_DIR, "active-agent-undefined.json"));
|
|
16608
16906
|
} catch {
|
|
16609
16907
|
}
|
|
16610
16908
|
}
|
|
@@ -16616,7 +16914,7 @@ var init_active_agent = __esm({
|
|
|
16616
16914
|
init_session_key();
|
|
16617
16915
|
init_agent_context();
|
|
16618
16916
|
init_employees();
|
|
16619
|
-
CACHE_DIR =
|
|
16917
|
+
CACHE_DIR = path35.join(EXE_AI_DIR, "session-cache");
|
|
16620
16918
|
STALE_MS = 24 * 60 * 60 * 1e3;
|
|
16621
16919
|
}
|
|
16622
16920
|
});
|
|
@@ -17269,17 +17567,17 @@ All memory, tasks, behaviors, documents, and wiki content belonging to {{company
|
|
|
17269
17567
|
// src/bin/exe-rename.ts
|
|
17270
17568
|
var exe_rename_exports = {};
|
|
17271
17569
|
__export(exe_rename_exports, {
|
|
17272
|
-
main: () =>
|
|
17570
|
+
main: () => main6,
|
|
17273
17571
|
renameEmployee: () => renameEmployee
|
|
17274
17572
|
});
|
|
17275
|
-
import { readFileSync as
|
|
17573
|
+
import { readFileSync as readFileSync25, writeFileSync as writeFileSync22, renameSync as renameSync6, unlinkSync as unlinkSync13, existsSync as existsSync29 } from "fs";
|
|
17276
17574
|
import { execSync as execSync12 } from "child_process";
|
|
17277
|
-
import
|
|
17575
|
+
import path36 from "path";
|
|
17278
17576
|
import { homedir as homedir4 } from "os";
|
|
17279
17577
|
async function renameEmployee(oldName, newName, opts = {}) {
|
|
17280
|
-
const rosterPath = opts.rosterPath ??
|
|
17281
|
-
const identityDir = opts.identityDir ??
|
|
17282
|
-
const agentsDir = opts.agentsDir ??
|
|
17578
|
+
const rosterPath = opts.rosterPath ?? path36.join(homedir4(), ".exe-os", "exe-employees.json");
|
|
17579
|
+
const identityDir = opts.identityDir ?? path36.join(homedir4(), ".exe-os", "identity");
|
|
17580
|
+
const agentsDir = opts.agentsDir ?? path36.join(homedir4(), ".claude", "agents");
|
|
17283
17581
|
const validation = validateEmployeeName(newName);
|
|
17284
17582
|
if (!validation.valid) {
|
|
17285
17583
|
return { success: false, error: validation.error };
|
|
@@ -17309,39 +17607,39 @@ async function renameEmployee(oldName, newName, opts = {}) {
|
|
|
17309
17607
|
undo: () => {
|
|
17310
17608
|
employee.name = originalName;
|
|
17311
17609
|
employee.systemPrompt = originalPrompt;
|
|
17312
|
-
|
|
17610
|
+
writeFileSync22(rosterPath, JSON.stringify(employees, null, 2) + "\n", "utf-8");
|
|
17313
17611
|
}
|
|
17314
17612
|
});
|
|
17315
|
-
const oldIdentityPath =
|
|
17316
|
-
const newIdentityPath =
|
|
17613
|
+
const oldIdentityPath = path36.join(identityDir, `${rosterOldName}.md`);
|
|
17614
|
+
const newIdentityPath = path36.join(identityDir, `${newName}.md`);
|
|
17317
17615
|
if (existsSync29(oldIdentityPath)) {
|
|
17318
|
-
const content =
|
|
17616
|
+
const content = readFileSync25(oldIdentityPath, "utf-8");
|
|
17319
17617
|
const updatedContent = rewriteRenamedEmployeeContent(content, rosterOldName, newName);
|
|
17320
17618
|
renameSync6(oldIdentityPath, newIdentityPath);
|
|
17321
|
-
|
|
17619
|
+
writeFileSync22(newIdentityPath, updatedContent, "utf-8");
|
|
17322
17620
|
rollbackStack.push({
|
|
17323
17621
|
description: "restore identity file",
|
|
17324
17622
|
undo: () => {
|
|
17325
17623
|
if (existsSync29(newIdentityPath)) {
|
|
17326
|
-
|
|
17624
|
+
writeFileSync22(newIdentityPath, content, "utf-8");
|
|
17327
17625
|
renameSync6(newIdentityPath, oldIdentityPath);
|
|
17328
17626
|
}
|
|
17329
17627
|
}
|
|
17330
17628
|
});
|
|
17331
17629
|
}
|
|
17332
|
-
const oldAgentPath =
|
|
17333
|
-
const newAgentPath =
|
|
17630
|
+
const oldAgentPath = path36.join(agentsDir, `${rosterOldName}.md`);
|
|
17631
|
+
const newAgentPath = path36.join(agentsDir, `${newName}.md`);
|
|
17334
17632
|
if (existsSync29(oldAgentPath)) {
|
|
17335
|
-
const agentContent =
|
|
17633
|
+
const agentContent = readFileSync25(oldAgentPath, "utf-8");
|
|
17336
17634
|
const updatedAgentContent = rewriteRenamedEmployeeContent(agentContent, rosterOldName, newName);
|
|
17337
17635
|
renameSync6(oldAgentPath, newAgentPath);
|
|
17338
|
-
|
|
17636
|
+
writeFileSync22(newAgentPath, updatedAgentContent, "utf-8");
|
|
17339
17637
|
rollbackStack.push({
|
|
17340
17638
|
description: "restore agent file",
|
|
17341
17639
|
undo: () => {
|
|
17342
17640
|
if (existsSync29(newAgentPath)) {
|
|
17343
17641
|
renameSync6(newAgentPath, oldAgentPath);
|
|
17344
|
-
|
|
17642
|
+
writeFileSync22(oldAgentPath, agentContent, "utf-8");
|
|
17345
17643
|
}
|
|
17346
17644
|
}
|
|
17347
17645
|
});
|
|
@@ -17423,12 +17721,12 @@ function removeOldSymlinks(name) {
|
|
|
17423
17721
|
try {
|
|
17424
17722
|
const exeBinPath = findExeBin2();
|
|
17425
17723
|
if (!exeBinPath) return;
|
|
17426
|
-
const binDir =
|
|
17724
|
+
const binDir = path36.dirname(exeBinPath);
|
|
17427
17725
|
for (const suffix of ["", "-opencode"]) {
|
|
17428
|
-
const linkPath =
|
|
17726
|
+
const linkPath = path36.join(binDir, `${name}${suffix}`);
|
|
17429
17727
|
if (existsSync29(linkPath)) {
|
|
17430
17728
|
try {
|
|
17431
|
-
|
|
17729
|
+
unlinkSync13(linkPath);
|
|
17432
17730
|
} catch {
|
|
17433
17731
|
}
|
|
17434
17732
|
}
|
|
@@ -17436,7 +17734,7 @@ function removeOldSymlinks(name) {
|
|
|
17436
17734
|
} catch {
|
|
17437
17735
|
}
|
|
17438
17736
|
}
|
|
17439
|
-
async function
|
|
17737
|
+
async function main6() {
|
|
17440
17738
|
const args2 = process.argv.slice(2);
|
|
17441
17739
|
if (args2.length < 2) {
|
|
17442
17740
|
console.error("Usage: exe-os rename <oldName> <newName>");
|
|
@@ -17464,7 +17762,7 @@ var init_exe_rename = __esm({
|
|
|
17464
17762
|
init_employee_templates();
|
|
17465
17763
|
init_is_main();
|
|
17466
17764
|
if (isMainModule(import.meta.url)) {
|
|
17467
|
-
|
|
17765
|
+
main6().catch((err) => {
|
|
17468
17766
|
console.error(err instanceof Error ? err.message : String(err));
|
|
17469
17767
|
process.exit(1);
|
|
17470
17768
|
});
|
|
@@ -17473,13 +17771,13 @@ var init_exe_rename = __esm({
|
|
|
17473
17771
|
});
|
|
17474
17772
|
|
|
17475
17773
|
// src/lib/model-downloader.ts
|
|
17476
|
-
import { createWriteStream, createReadStream as createReadStream2, existsSync as existsSync30, unlinkSync as
|
|
17774
|
+
import { createWriteStream, createReadStream as createReadStream2, existsSync as existsSync30, unlinkSync as unlinkSync14, renameSync as renameSync7 } from "fs";
|
|
17477
17775
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
17478
17776
|
import { createHash as createHash6 } from "crypto";
|
|
17479
|
-
import
|
|
17777
|
+
import path37 from "path";
|
|
17480
17778
|
async function downloadModel(opts) {
|
|
17481
17779
|
const { destDir, onProgress, fetchFn = globalThis.fetch } = opts;
|
|
17482
|
-
const destPath =
|
|
17780
|
+
const destPath = path37.join(destDir, LOCAL_FILENAME);
|
|
17483
17781
|
const tmpPath = destPath + ".tmp";
|
|
17484
17782
|
await mkdir6(destDir, { recursive: true });
|
|
17485
17783
|
if (existsSync30(destPath)) {
|
|
@@ -17494,7 +17792,7 @@ async function downloadModel(opts) {
|
|
|
17494
17792
|
let downloaded = 0;
|
|
17495
17793
|
for (let attempt = 1; attempt <= MAX_RETRIES4; attempt++) {
|
|
17496
17794
|
try {
|
|
17497
|
-
if (existsSync30(tmpPath))
|
|
17795
|
+
if (existsSync30(tmpPath)) unlinkSync14(tmpPath);
|
|
17498
17796
|
const response = await fetchFn(GGUF_URL, {
|
|
17499
17797
|
redirect: "follow",
|
|
17500
17798
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
|
|
@@ -17526,7 +17824,7 @@ async function downloadModel(opts) {
|
|
|
17526
17824
|
}
|
|
17527
17825
|
const actualHash = hash.digest("hex");
|
|
17528
17826
|
if (actualHash !== EXPECTED_SHA256) {
|
|
17529
|
-
|
|
17827
|
+
unlinkSync14(tmpPath);
|
|
17530
17828
|
throw new Error(
|
|
17531
17829
|
`SHA256 mismatch: expected ${EXPECTED_SHA256}, got ${actualHash}`
|
|
17532
17830
|
);
|
|
@@ -17539,7 +17837,7 @@ async function downloadModel(opts) {
|
|
|
17539
17837
|
process.stderr.write(`
|
|
17540
17838
|
Download attempt ${attempt} failed, retrying...
|
|
17541
17839
|
`);
|
|
17542
|
-
if (existsSync30(tmpPath))
|
|
17840
|
+
if (existsSync30(tmpPath)) unlinkSync14(tmpPath);
|
|
17543
17841
|
}
|
|
17544
17842
|
}
|
|
17545
17843
|
}
|
|
@@ -18113,37 +18411,37 @@ __export(session_wrappers_exports, {
|
|
|
18113
18411
|
});
|
|
18114
18412
|
import {
|
|
18115
18413
|
existsSync as existsSync31,
|
|
18116
|
-
readFileSync as
|
|
18117
|
-
writeFileSync as
|
|
18118
|
-
mkdirSync as
|
|
18414
|
+
readFileSync as readFileSync26,
|
|
18415
|
+
writeFileSync as writeFileSync23,
|
|
18416
|
+
mkdirSync as mkdirSync22,
|
|
18119
18417
|
chmodSync as chmodSync3,
|
|
18120
18418
|
readdirSync as readdirSync9,
|
|
18121
|
-
unlinkSync as
|
|
18419
|
+
unlinkSync as unlinkSync15
|
|
18122
18420
|
} from "fs";
|
|
18123
18421
|
import { execSync as execSync13 } from "child_process";
|
|
18124
|
-
import
|
|
18422
|
+
import path38 from "path";
|
|
18125
18423
|
import { homedir as homedir5 } from "os";
|
|
18126
18424
|
function generateSessionWrappers(packageRoot, homeDir) {
|
|
18127
18425
|
const home = homeDir ?? homedir5();
|
|
18128
|
-
const binDir =
|
|
18129
|
-
const rosterPath =
|
|
18426
|
+
const binDir = path38.join(home, ".exe-os", "bin");
|
|
18427
|
+
const rosterPath = path38.join(home, ".exe-os", "exe-employees.json");
|
|
18130
18428
|
const shouldMirrorToGlobalBin = homeDir === void 0;
|
|
18131
|
-
|
|
18132
|
-
const exeStartDst =
|
|
18429
|
+
mkdirSync22(binDir, { recursive: true });
|
|
18430
|
+
const exeStartDst = path38.join(binDir, "exe-start");
|
|
18133
18431
|
const candidates = [
|
|
18134
|
-
|
|
18135
|
-
|
|
18432
|
+
path38.join(packageRoot, "dist", "bin", "exe-start.sh"),
|
|
18433
|
+
path38.join(packageRoot, "src", "bin", "exe-start.sh")
|
|
18136
18434
|
];
|
|
18137
18435
|
for (const src of candidates) {
|
|
18138
18436
|
if (existsSync31(src)) {
|
|
18139
|
-
|
|
18437
|
+
writeFileSync23(exeStartDst, readFileSync26(src));
|
|
18140
18438
|
chmodSync3(exeStartDst, 493);
|
|
18141
18439
|
break;
|
|
18142
18440
|
}
|
|
18143
18441
|
}
|
|
18144
18442
|
let employees = [];
|
|
18145
18443
|
try {
|
|
18146
|
-
employees = JSON.parse(
|
|
18444
|
+
employees = JSON.parse(readFileSync26(rosterPath, "utf8"));
|
|
18147
18445
|
} catch {
|
|
18148
18446
|
return { created: 0, pathConfigured: false };
|
|
18149
18447
|
}
|
|
@@ -18153,11 +18451,11 @@ function generateSessionWrappers(packageRoot, homeDir) {
|
|
|
18153
18451
|
try {
|
|
18154
18452
|
for (const f of readdirSync9(binDir)) {
|
|
18155
18453
|
if (f === "exe-start") continue;
|
|
18156
|
-
const fPath =
|
|
18454
|
+
const fPath = path38.join(binDir, f);
|
|
18157
18455
|
try {
|
|
18158
|
-
const content =
|
|
18456
|
+
const content = readFileSync26(fPath, "utf8");
|
|
18159
18457
|
if (content.includes("exe-start")) {
|
|
18160
|
-
|
|
18458
|
+
unlinkSync15(fPath);
|
|
18161
18459
|
}
|
|
18162
18460
|
} catch {
|
|
18163
18461
|
}
|
|
@@ -18171,21 +18469,21 @@ exec "${exeStartDst}" "$0" "$@"
|
|
|
18171
18469
|
const globalBinDir = shouldMirrorToGlobalBin ? resolveGlobalBinDir() : null;
|
|
18172
18470
|
for (const emp of employees) {
|
|
18173
18471
|
for (let n = 1; n <= MAX_N; n++) {
|
|
18174
|
-
writeWrapper(
|
|
18472
|
+
writeWrapper(path38.join(binDir, `${emp.name}${n}`), wrapperContent);
|
|
18175
18473
|
if (globalBinDir) {
|
|
18176
|
-
writeWrapper(
|
|
18474
|
+
writeWrapper(path38.join(globalBinDir, `${emp.name}${n}`), wrapperContent);
|
|
18177
18475
|
}
|
|
18178
18476
|
created++;
|
|
18179
|
-
writeWrapper(
|
|
18477
|
+
writeWrapper(path38.join(binDir, `${emp.name}${n}-codex`), wrapperContent);
|
|
18180
18478
|
if (globalBinDir) {
|
|
18181
|
-
writeWrapper(
|
|
18479
|
+
writeWrapper(path38.join(globalBinDir, `${emp.name}${n}-codex`), wrapperContent);
|
|
18182
18480
|
}
|
|
18183
18481
|
created++;
|
|
18184
18482
|
}
|
|
18185
18483
|
}
|
|
18186
18484
|
const codexLauncherCandidates = [
|
|
18187
|
-
|
|
18188
|
-
|
|
18485
|
+
path38.join(packageRoot, "dist", "bin", "exe-start-codex.js"),
|
|
18486
|
+
path38.join(packageRoot, "src", "bin", "exe-start-codex.ts")
|
|
18189
18487
|
];
|
|
18190
18488
|
let codexLauncher = null;
|
|
18191
18489
|
for (const c of codexLauncherCandidates) {
|
|
@@ -18196,11 +18494,11 @@ exec "${exeStartDst}" "$0" "$@"
|
|
|
18196
18494
|
}
|
|
18197
18495
|
if (codexLauncher) {
|
|
18198
18496
|
for (const emp of employees) {
|
|
18199
|
-
const wrapperPath =
|
|
18497
|
+
const wrapperPath = path38.join(binDir, `${emp.name}-codex`);
|
|
18200
18498
|
const content = `#!/bin/bash
|
|
18201
18499
|
exec node "${codexLauncher}" --agent ${emp.name} "$@"
|
|
18202
18500
|
`;
|
|
18203
|
-
|
|
18501
|
+
writeFileSync23(wrapperPath, content);
|
|
18204
18502
|
chmodSync3(wrapperPath, 493);
|
|
18205
18503
|
created++;
|
|
18206
18504
|
}
|
|
@@ -18210,7 +18508,7 @@ exec node "${codexLauncher}" --agent ${emp.name} "$@"
|
|
|
18210
18508
|
}
|
|
18211
18509
|
function writeWrapper(wrapperPath, content) {
|
|
18212
18510
|
try {
|
|
18213
|
-
|
|
18511
|
+
writeFileSync23(wrapperPath, content);
|
|
18214
18512
|
chmodSync3(wrapperPath, 493);
|
|
18215
18513
|
} catch {
|
|
18216
18514
|
}
|
|
@@ -18218,12 +18516,12 @@ function writeWrapper(wrapperPath, content) {
|
|
|
18218
18516
|
function resolveGlobalBinDir() {
|
|
18219
18517
|
try {
|
|
18220
18518
|
const exeOsPath = execSync13("command -v exe-os", { encoding: "utf8", timeout: 3e3 }).trim().split("\n")[0];
|
|
18221
|
-
if (exeOsPath) return
|
|
18519
|
+
if (exeOsPath) return path38.dirname(exeOsPath);
|
|
18222
18520
|
} catch {
|
|
18223
18521
|
}
|
|
18224
18522
|
try {
|
|
18225
18523
|
const prefix = execSync13("npm prefix -g", { encoding: "utf8", timeout: 3e3 }).trim();
|
|
18226
|
-
if (prefix) return
|
|
18524
|
+
if (prefix) return path38.join(prefix, "bin");
|
|
18227
18525
|
} catch {
|
|
18228
18526
|
}
|
|
18229
18527
|
return null;
|
|
@@ -18239,24 +18537,24 @@ export PATH="${binDir}:$PATH"
|
|
|
18239
18537
|
const shell = process.env.SHELL ?? "/bin/bash";
|
|
18240
18538
|
const profilePaths = [];
|
|
18241
18539
|
if (shell.includes("zsh")) {
|
|
18242
|
-
profilePaths.push(
|
|
18540
|
+
profilePaths.push(path38.join(home, ".zshrc"));
|
|
18243
18541
|
} else if (shell.includes("bash")) {
|
|
18244
|
-
profilePaths.push(
|
|
18245
|
-
profilePaths.push(
|
|
18542
|
+
profilePaths.push(path38.join(home, ".bashrc"));
|
|
18543
|
+
profilePaths.push(path38.join(home, ".bash_profile"));
|
|
18246
18544
|
} else {
|
|
18247
|
-
profilePaths.push(
|
|
18545
|
+
profilePaths.push(path38.join(home, ".profile"));
|
|
18248
18546
|
}
|
|
18249
18547
|
for (const profilePath of profilePaths) {
|
|
18250
18548
|
try {
|
|
18251
18549
|
let content = "";
|
|
18252
18550
|
try {
|
|
18253
|
-
content =
|
|
18551
|
+
content = readFileSync26(profilePath, "utf8");
|
|
18254
18552
|
} catch {
|
|
18255
18553
|
}
|
|
18256
18554
|
if (content.includes(".exe-os/bin")) {
|
|
18257
18555
|
return false;
|
|
18258
18556
|
}
|
|
18259
|
-
|
|
18557
|
+
writeFileSync23(profilePath, content + exportLine);
|
|
18260
18558
|
return true;
|
|
18261
18559
|
} catch {
|
|
18262
18560
|
continue;
|
|
@@ -18279,40 +18577,40 @@ __export(setup_wizard_exports, {
|
|
|
18279
18577
|
validateModel: () => validateModel
|
|
18280
18578
|
});
|
|
18281
18579
|
import crypto13 from "crypto";
|
|
18282
|
-
import { existsSync as existsSync32, mkdirSync as
|
|
18580
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync23, readFileSync as readFileSync27, writeFileSync as writeFileSync24, unlinkSync as unlinkSync16 } from "fs";
|
|
18283
18581
|
import os19 from "os";
|
|
18284
|
-
import
|
|
18582
|
+
import path39 from "path";
|
|
18285
18583
|
import { createInterface as createInterface4 } from "readline";
|
|
18286
18584
|
function findPackageRoot2() {
|
|
18287
|
-
let dir =
|
|
18288
|
-
const root =
|
|
18585
|
+
let dir = path39.dirname(new URL(import.meta.url).pathname);
|
|
18586
|
+
const root = path39.parse(dir).root;
|
|
18289
18587
|
while (dir !== root) {
|
|
18290
|
-
const pkgPath =
|
|
18588
|
+
const pkgPath = path39.join(dir, "package.json");
|
|
18291
18589
|
if (existsSync32(pkgPath)) {
|
|
18292
18590
|
try {
|
|
18293
|
-
const pkg = JSON.parse(
|
|
18591
|
+
const pkg = JSON.parse(readFileSync27(pkgPath, "utf-8"));
|
|
18294
18592
|
if (pkg.name === "@askexenow/exe-os" || pkg.name === "exe-os") return dir;
|
|
18295
18593
|
} catch {
|
|
18296
18594
|
}
|
|
18297
18595
|
}
|
|
18298
|
-
dir =
|
|
18596
|
+
dir = path39.dirname(dir);
|
|
18299
18597
|
}
|
|
18300
18598
|
return null;
|
|
18301
18599
|
}
|
|
18302
18600
|
function loadSetupState() {
|
|
18303
18601
|
try {
|
|
18304
|
-
return JSON.parse(
|
|
18602
|
+
return JSON.parse(readFileSync27(SETUP_STATE_PATH, "utf8"));
|
|
18305
18603
|
} catch {
|
|
18306
18604
|
return { completedSteps: [], startedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
18307
18605
|
}
|
|
18308
18606
|
}
|
|
18309
18607
|
function saveSetupState(state) {
|
|
18310
|
-
|
|
18311
|
-
|
|
18608
|
+
mkdirSync23(path39.dirname(SETUP_STATE_PATH), { recursive: true });
|
|
18609
|
+
writeFileSync24(SETUP_STATE_PATH, JSON.stringify(state, null, 2));
|
|
18312
18610
|
}
|
|
18313
18611
|
function clearSetupState() {
|
|
18314
18612
|
try {
|
|
18315
|
-
|
|
18613
|
+
unlinkSync16(SETUP_STATE_PATH);
|
|
18316
18614
|
} catch {
|
|
18317
18615
|
}
|
|
18318
18616
|
}
|
|
@@ -18358,7 +18656,7 @@ async function validateModel(log) {
|
|
|
18358
18656
|
if (totalGB <= 8 || isLowMemory()) {
|
|
18359
18657
|
log(`System memory: ${totalGB.toFixed(0)}GB total, ${freeGB.toFixed(1)}GB free`);
|
|
18360
18658
|
log("Skipping in-memory model validation (low memory \u2014 will validate on first use).");
|
|
18361
|
-
const modelPath =
|
|
18659
|
+
const modelPath = path39.join(MODELS_DIR, LOCAL_FILENAME);
|
|
18362
18660
|
if (existsSync32(modelPath)) {
|
|
18363
18661
|
const { statSync: statSync8 } = await import("fs");
|
|
18364
18662
|
const size = statSync8(modelPath).size;
|
|
@@ -18645,10 +18943,10 @@ async function runSetupWizard(opts = {}) {
|
|
|
18645
18943
|
await saveConfig(config);
|
|
18646
18944
|
log("");
|
|
18647
18945
|
try {
|
|
18648
|
-
const claudeJsonPath =
|
|
18946
|
+
const claudeJsonPath = path39.join(os19.homedir(), ".claude.json");
|
|
18649
18947
|
let claudeJson = {};
|
|
18650
18948
|
try {
|
|
18651
|
-
claudeJson = JSON.parse(
|
|
18949
|
+
claudeJson = JSON.parse(readFileSync27(claudeJsonPath, "utf8"));
|
|
18652
18950
|
} catch {
|
|
18653
18951
|
}
|
|
18654
18952
|
if (!claudeJson.projects) claudeJson.projects = {};
|
|
@@ -18657,7 +18955,7 @@ async function runSetupWizard(opts = {}) {
|
|
|
18657
18955
|
if (!projects[dir]) projects[dir] = {};
|
|
18658
18956
|
projects[dir].hasTrustDialogAccepted = true;
|
|
18659
18957
|
}
|
|
18660
|
-
|
|
18958
|
+
writeFileSync24(claudeJsonPath, JSON.stringify(claudeJson, null, 2) + "\n");
|
|
18661
18959
|
} catch {
|
|
18662
18960
|
}
|
|
18663
18961
|
state.completedSteps.push(5);
|
|
@@ -18671,7 +18969,7 @@ async function runSetupWizard(opts = {}) {
|
|
|
18671
18969
|
const prefs = { ...existingPrefs };
|
|
18672
18970
|
log("=== Config Defaults ===");
|
|
18673
18971
|
log("");
|
|
18674
|
-
const ghosttyDetected = existsSync32(
|
|
18972
|
+
const ghosttyDetected = existsSync32(path39.join(os19.homedir(), ".config", "ghostty")) || existsSync32(path39.join(os19.homedir(), "Library", "Application Support", "com.mitchellh.ghostty"));
|
|
18675
18973
|
if (ghosttyDetected) {
|
|
18676
18974
|
const ghosttyAnswer = await ask3(rl, "Detected Ghostty terminal. Use exe-os Ghostty defaults? (Y/n) ");
|
|
18677
18975
|
prefs.ghostty = ghosttyAnswer.toLowerCase() !== "n";
|
|
@@ -18809,9 +19107,9 @@ async function runSetupWizard(opts = {}) {
|
|
|
18809
19107
|
const cooIdentityContent = getIdentityTemplate("coo");
|
|
18810
19108
|
if (cooIdentityContent) {
|
|
18811
19109
|
const cooIdPath = identityPath2(cooName);
|
|
18812
|
-
|
|
19110
|
+
mkdirSync23(path39.dirname(cooIdPath), { recursive: true });
|
|
18813
19111
|
const replaced = cooIdentityContent.replace(/agent_id:\s*exe/g, `agent_id: ${cooName}`).replace(/\$\{agent_id\}/g, cooName);
|
|
18814
|
-
|
|
19112
|
+
writeFileSync24(cooIdPath, replaced, "utf-8");
|
|
18815
19113
|
}
|
|
18816
19114
|
registerBinSymlinks2(cooName);
|
|
18817
19115
|
createdEmployees.push({ name: cooName, role: "COO" });
|
|
@@ -18927,9 +19225,9 @@ async function runSetupWizard(opts = {}) {
|
|
|
18927
19225
|
const ctoIdentityContent = getIdentityTemplate("cto");
|
|
18928
19226
|
if (ctoIdentityContent) {
|
|
18929
19227
|
const ctoIdPath = identityPath2(ctoName);
|
|
18930
|
-
|
|
19228
|
+
mkdirSync23(path39.dirname(ctoIdPath), { recursive: true });
|
|
18931
19229
|
const replaced = ctoIdentityContent.replace(/agent_id:\s*\w+/g, `agent_id: ${ctoName}`).replace(/\$\{agent_id\}/g, ctoName);
|
|
18932
|
-
|
|
19230
|
+
writeFileSync24(ctoIdPath, replaced, "utf-8");
|
|
18933
19231
|
}
|
|
18934
19232
|
registerBinSymlinks2(ctoName);
|
|
18935
19233
|
createdEmployees.push({ name: ctoName, role: "CTO" });
|
|
@@ -18950,9 +19248,9 @@ async function runSetupWizard(opts = {}) {
|
|
|
18950
19248
|
const cmoIdentityContent = getIdentityTemplate("cmo");
|
|
18951
19249
|
if (cmoIdentityContent) {
|
|
18952
19250
|
const cmoIdPath = identityPath2(cmoName);
|
|
18953
|
-
|
|
19251
|
+
mkdirSync23(path39.dirname(cmoIdPath), { recursive: true });
|
|
18954
19252
|
const replaced = cmoIdentityContent.replace(/agent_id:\s*\w+/g, `agent_id: ${cmoName}`).replace(/\$\{agent_id\}/g, cmoName);
|
|
18955
|
-
|
|
19253
|
+
writeFileSync24(cmoIdPath, replaced, "utf-8");
|
|
18956
19254
|
}
|
|
18957
19255
|
registerBinSymlinks2(cmoName);
|
|
18958
19256
|
createdEmployees.push({ name: cmoName, role: "CMO" });
|
|
@@ -18975,7 +19273,7 @@ async function runSetupWizard(opts = {}) {
|
|
|
18975
19273
|
log(`Session shortcuts generated (${cooName}1, ${cooName}2, ...)`);
|
|
18976
19274
|
}
|
|
18977
19275
|
if (wrapResult.pathConfigured) {
|
|
18978
|
-
const binDir =
|
|
19276
|
+
const binDir = path39.join(os19.homedir(), ".exe-os", "bin");
|
|
18979
19277
|
process.env.PATH = `${binDir}:${process.env.PATH ?? ""}`;
|
|
18980
19278
|
pathJustConfigured = true;
|
|
18981
19279
|
}
|
|
@@ -19018,7 +19316,7 @@ async function runSetupWizard(opts = {}) {
|
|
|
19018
19316
|
const pkgRoot2 = findPackageRoot2();
|
|
19019
19317
|
if (pkgRoot2) {
|
|
19020
19318
|
try {
|
|
19021
|
-
version = JSON.parse(
|
|
19319
|
+
version = JSON.parse(readFileSync27(path39.join(pkgRoot2, "package.json"), "utf-8")).version;
|
|
19022
19320
|
} catch {
|
|
19023
19321
|
}
|
|
19024
19322
|
}
|
|
@@ -19034,6 +19332,7 @@ async function runSetupWizard(opts = {}) {
|
|
|
19034
19332
|
log("");
|
|
19035
19333
|
log(" Recommended start: Phase 1 \u2014 talk to your COO first");
|
|
19036
19334
|
log(" Check/change phase: exe-os org phase");
|
|
19335
|
+
log(" Verify support intake: exe-os support test");
|
|
19037
19336
|
log(" Unlock executives later: exe-os org unlock executives");
|
|
19038
19337
|
log("");
|
|
19039
19338
|
log(` cd into a project folder: cd ~/my-project`);
|
|
@@ -19056,46 +19355,46 @@ var init_setup_wizard = __esm({
|
|
|
19056
19355
|
init_config();
|
|
19057
19356
|
init_keychain();
|
|
19058
19357
|
init_model_downloader();
|
|
19059
|
-
SETUP_STATE_PATH =
|
|
19358
|
+
SETUP_STATE_PATH = path39.join(os19.homedir(), ".exe-os", "setup-state.json");
|
|
19060
19359
|
}
|
|
19061
19360
|
});
|
|
19062
19361
|
|
|
19063
19362
|
// src/lib/update-backup.ts
|
|
19064
19363
|
import { copyFile, readFile as readFile6, readdir as readdir3, writeFile as writeFile7, rm as rm2, mkdir as mkdir7, cp } from "fs/promises";
|
|
19065
19364
|
import { existsSync as existsSync33 } from "fs";
|
|
19066
|
-
import
|
|
19365
|
+
import path40 from "path";
|
|
19067
19366
|
import os20 from "os";
|
|
19068
19367
|
function resolveDataDir2() {
|
|
19069
19368
|
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
19070
19369
|
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
19071
|
-
return
|
|
19370
|
+
return path40.join(os20.homedir(), ".exe-os");
|
|
19072
19371
|
}
|
|
19073
19372
|
function externalBackupTargets(homeDir) {
|
|
19074
19373
|
return [
|
|
19075
|
-
{ name: "claude.json", path:
|
|
19076
|
-
{ name: "claude-settings.json", path:
|
|
19077
|
-
{ name: "claude-CLAUDE.md", path:
|
|
19078
|
-
{ name: "tmux.conf", path:
|
|
19079
|
-
{ name: "zshrc", path:
|
|
19080
|
-
{ name: "bashrc", path:
|
|
19081
|
-
{ name: "ghostty-config", path:
|
|
19082
|
-
{ name: "codex-config.toml", path:
|
|
19083
|
-
{ name: "codex-hooks.json", path:
|
|
19084
|
-
{ name: "opencode-config.json", path:
|
|
19374
|
+
{ name: "claude.json", path: path40.join(homeDir, ".claude.json") },
|
|
19375
|
+
{ name: "claude-settings.json", path: path40.join(homeDir, ".claude", "settings.json") },
|
|
19376
|
+
{ name: "claude-CLAUDE.md", path: path40.join(homeDir, ".claude", "CLAUDE.md") },
|
|
19377
|
+
{ name: "tmux.conf", path: path40.join(homeDir, ".tmux.conf") },
|
|
19378
|
+
{ name: "zshrc", path: path40.join(homeDir, ".zshrc") },
|
|
19379
|
+
{ name: "bashrc", path: path40.join(homeDir, ".bashrc") },
|
|
19380
|
+
{ name: "ghostty-config", path: path40.join(homeDir, ".config", "ghostty", "config") },
|
|
19381
|
+
{ name: "codex-config.toml", path: path40.join(homeDir, ".codex", "config.toml") },
|
|
19382
|
+
{ name: "codex-hooks.json", path: path40.join(homeDir, ".codex", "hooks.json") },
|
|
19383
|
+
{ name: "opencode-config.json", path: path40.join(homeDir, ".config", "opencode", "opencode.json") }
|
|
19085
19384
|
];
|
|
19086
19385
|
}
|
|
19087
19386
|
async function createUpdateBackup(currentVersion, dataDir2, homeDir = os20.homedir()) {
|
|
19088
19387
|
const dir = dataDir2 ?? resolveDataDir2();
|
|
19089
|
-
const backupDir =
|
|
19388
|
+
const backupDir = path40.join(dir, BACKUP_DIR_NAME);
|
|
19090
19389
|
if (existsSync33(backupDir)) {
|
|
19091
19390
|
await rm2(backupDir, { recursive: true, force: true });
|
|
19092
19391
|
}
|
|
19093
19392
|
await mkdir7(backupDir, { recursive: true });
|
|
19094
19393
|
const backedUpFiles = [];
|
|
19095
19394
|
for (const target of BACKUP_TARGETS) {
|
|
19096
|
-
const src =
|
|
19395
|
+
const src = path40.join(dir, target.name);
|
|
19097
19396
|
if (!existsSync33(src)) continue;
|
|
19098
|
-
const dest =
|
|
19397
|
+
const dest = path40.join(backupDir, target.name);
|
|
19099
19398
|
if (target.type === "file") {
|
|
19100
19399
|
await copyFile(src, dest);
|
|
19101
19400
|
} else {
|
|
@@ -19106,18 +19405,18 @@ async function createUpdateBackup(currentVersion, dataDir2, homeDir = os20.homed
|
|
|
19106
19405
|
const entries = await readdir3(dir, { withFileTypes: true });
|
|
19107
19406
|
for (const entry of entries) {
|
|
19108
19407
|
if (entry.isFile() && entry.name.endsWith(".db") && entry.name !== BACKUP_DIR_NAME) {
|
|
19109
|
-
const src =
|
|
19110
|
-
const dest =
|
|
19408
|
+
const src = path40.join(dir, entry.name);
|
|
19409
|
+
const dest = path40.join(backupDir, entry.name);
|
|
19111
19410
|
await copyFile(src, dest);
|
|
19112
19411
|
backedUpFiles.push(entry.name);
|
|
19113
19412
|
}
|
|
19114
19413
|
}
|
|
19115
19414
|
const externalFiles = [];
|
|
19116
|
-
const externalDir =
|
|
19415
|
+
const externalDir = path40.join(backupDir, "external");
|
|
19117
19416
|
for (const target of externalBackupTargets(homeDir)) {
|
|
19118
19417
|
if (!existsSync33(target.path)) continue;
|
|
19119
19418
|
await mkdir7(externalDir, { recursive: true });
|
|
19120
|
-
await copyFile(target.path,
|
|
19419
|
+
await copyFile(target.path, path40.join(externalDir, target.name));
|
|
19121
19420
|
externalFiles.push(target);
|
|
19122
19421
|
}
|
|
19123
19422
|
const manifest = {
|
|
@@ -19127,15 +19426,15 @@ async function createUpdateBackup(currentVersion, dataDir2, homeDir = os20.homed
|
|
|
19127
19426
|
...externalFiles.length > 0 ? { externalFiles } : {}
|
|
19128
19427
|
};
|
|
19129
19428
|
await writeFile7(
|
|
19130
|
-
|
|
19429
|
+
path40.join(backupDir, "manifest.json"),
|
|
19131
19430
|
JSON.stringify(manifest, null, 2) + "\n"
|
|
19132
19431
|
);
|
|
19133
19432
|
return manifest;
|
|
19134
19433
|
}
|
|
19135
19434
|
async function restoreFromBackup(dataDir2) {
|
|
19136
19435
|
const dir = dataDir2 ?? resolveDataDir2();
|
|
19137
|
-
const backupDir =
|
|
19138
|
-
const manifestPath =
|
|
19436
|
+
const backupDir = path40.join(dir, BACKUP_DIR_NAME);
|
|
19437
|
+
const manifestPath = path40.join(backupDir, "manifest.json");
|
|
19139
19438
|
if (!existsSync33(manifestPath)) {
|
|
19140
19439
|
throw new Error(
|
|
19141
19440
|
`No backup found at ${backupDir}. Nothing to restore.`
|
|
@@ -19145,8 +19444,8 @@ async function restoreFromBackup(dataDir2) {
|
|
|
19145
19444
|
await readFile6(manifestPath, "utf-8")
|
|
19146
19445
|
);
|
|
19147
19446
|
for (const fileName of manifest.files) {
|
|
19148
|
-
const src =
|
|
19149
|
-
const dest =
|
|
19447
|
+
const src = path40.join(backupDir, fileName);
|
|
19448
|
+
const dest = path40.join(dir, fileName);
|
|
19150
19449
|
if (!existsSync33(src)) continue;
|
|
19151
19450
|
const stat2 = await import("fs/promises").then((m) => m.stat(src));
|
|
19152
19451
|
if (stat2.isDirectory()) {
|
|
@@ -19156,16 +19455,16 @@ async function restoreFromBackup(dataDir2) {
|
|
|
19156
19455
|
}
|
|
19157
19456
|
}
|
|
19158
19457
|
for (const external of manifest.externalFiles ?? []) {
|
|
19159
|
-
const src =
|
|
19458
|
+
const src = path40.join(backupDir, "external", external.name);
|
|
19160
19459
|
if (!existsSync33(src)) continue;
|
|
19161
|
-
await mkdir7(
|
|
19460
|
+
await mkdir7(path40.dirname(external.path), { recursive: true });
|
|
19162
19461
|
await copyFile(src, external.path);
|
|
19163
19462
|
}
|
|
19164
19463
|
return manifest;
|
|
19165
19464
|
}
|
|
19166
19465
|
async function deleteBackup(dataDir2) {
|
|
19167
19466
|
const dir = dataDir2 ?? resolveDataDir2();
|
|
19168
|
-
const backupDir =
|
|
19467
|
+
const backupDir = path40.join(dir, BACKUP_DIR_NAME);
|
|
19169
19468
|
if (existsSync33(backupDir)) {
|
|
19170
19469
|
await rm2(backupDir, { recursive: true, force: true });
|
|
19171
19470
|
}
|
|
@@ -19191,21 +19490,21 @@ var init_update_backup = __esm({
|
|
|
19191
19490
|
|
|
19192
19491
|
// src/lib/update-check.ts
|
|
19193
19492
|
import { execSync as execSync14 } from "child_process";
|
|
19194
|
-
import { readFileSync as
|
|
19195
|
-
import
|
|
19493
|
+
import { readFileSync as readFileSync28 } from "fs";
|
|
19494
|
+
import path41 from "path";
|
|
19196
19495
|
function getLocalVersion(packageRoot) {
|
|
19197
|
-
const pkgPath =
|
|
19198
|
-
const pkg = JSON.parse(
|
|
19496
|
+
const pkgPath = path41.join(packageRoot, "package.json");
|
|
19497
|
+
const pkg = JSON.parse(readFileSync28(pkgPath, "utf-8"));
|
|
19199
19498
|
return pkg.version;
|
|
19200
19499
|
}
|
|
19201
19500
|
function getRemoteVersion() {
|
|
19202
19501
|
try {
|
|
19203
|
-
const
|
|
19502
|
+
const output2 = execSync14("npm view @askexenow/exe-os version", {
|
|
19204
19503
|
encoding: "utf-8",
|
|
19205
19504
|
timeout: 15e3,
|
|
19206
19505
|
stdio: ["pipe", "pipe", "pipe"]
|
|
19207
19506
|
});
|
|
19208
|
-
return
|
|
19507
|
+
return output2.trim();
|
|
19209
19508
|
} catch {
|
|
19210
19509
|
return null;
|
|
19211
19510
|
}
|
|
@@ -19415,6 +19714,15 @@ async function runUpdate(cliArgs) {
|
|
|
19415
19714
|
}
|
|
19416
19715
|
} catch {
|
|
19417
19716
|
}
|
|
19717
|
+
try {
|
|
19718
|
+
console.log("\u{1FA7A} Checking AskExe support intake...");
|
|
19719
|
+
execSync15("exe-os support health", {
|
|
19720
|
+
stdio: ["pipe", "inherit", "inherit"],
|
|
19721
|
+
timeout: 3e4
|
|
19722
|
+
});
|
|
19723
|
+
} catch {
|
|
19724
|
+
console.log(" \u26A0\uFE0F Support health check failed. Run: exe-os support test");
|
|
19725
|
+
}
|
|
19418
19726
|
console.log("\n\u{1F680} Ready. Start your COO session to use the new version.\n");
|
|
19419
19727
|
}
|
|
19420
19728
|
var init_update = __esm({
|
|
@@ -19436,10 +19744,10 @@ var init_update = __esm({
|
|
|
19436
19744
|
// src/lib/stack-update.ts
|
|
19437
19745
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
19438
19746
|
import { createVerify, verify as verifySignature } from "crypto";
|
|
19439
|
-
import { existsSync as existsSync34, mkdirSync as
|
|
19747
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync24, readdirSync as readdirSync10, readFileSync as readFileSync29, renameSync as renameSync8, writeFileSync as writeFileSync25 } from "fs";
|
|
19440
19748
|
import http from "http";
|
|
19441
19749
|
import https from "https";
|
|
19442
|
-
import
|
|
19750
|
+
import path42 from "path";
|
|
19443
19751
|
function isSignedEnvelope(value) {
|
|
19444
19752
|
return !!value && typeof value === "object" && "manifest" in value && "signature" in value;
|
|
19445
19753
|
}
|
|
@@ -19473,21 +19781,21 @@ function stableJson(value) {
|
|
|
19473
19781
|
return `{${Object.keys(obj).sort().map((key) => `${JSON.stringify(key)}:${stableJson(obj[key])}`).join(",")}}`;
|
|
19474
19782
|
}
|
|
19475
19783
|
function findLatestBackupEnvFile(envFile) {
|
|
19476
|
-
const backupDir =
|
|
19784
|
+
const backupDir = path42.join(path42.dirname(envFile), ".exe-stack-backups");
|
|
19477
19785
|
if (!existsSync34(backupDir)) return null;
|
|
19478
19786
|
const backups = readdirSync10(backupDir).filter((name) => name.startsWith("env-") && name.endsWith(".bak")).sort();
|
|
19479
19787
|
const latest = backups.at(-1);
|
|
19480
|
-
return latest ?
|
|
19788
|
+
return latest ? path42.join(backupDir, latest) : null;
|
|
19481
19789
|
}
|
|
19482
19790
|
async function rollbackStackUpdate(options) {
|
|
19483
19791
|
const exec2 = options.exec ?? defaultExec;
|
|
19484
|
-
const backupEnvFile = options.lockFile && existsSync34(options.lockFile) ? JSON.parse(
|
|
19792
|
+
const backupEnvFile = options.lockFile && existsSync34(options.lockFile) ? JSON.parse(readFileSync29(options.lockFile, "utf8")).backupEnvFile : void 0;
|
|
19485
19793
|
const rollbackEnv = backupEnvFile && existsSync34(backupEnvFile) ? backupEnvFile : findLatestBackupEnvFile(options.envFile);
|
|
19486
19794
|
if (!rollbackEnv) throw new Error(`No stack backup env found beside ${options.envFile}`);
|
|
19487
|
-
|
|
19795
|
+
writeFileSync25(options.envFile, readFileSync29(rollbackEnv), { mode: 384 });
|
|
19488
19796
|
const composeArgs = ["compose", "--file", options.composeFile, "--env-file", options.envFile];
|
|
19489
19797
|
exec2("docker", [...composeArgs, "up", "-d"]);
|
|
19490
|
-
return { status: "rolled_back", targetVersion: "previous", changes: [], backupEnvFile: rollbackEnv, lockFile: options.lockFile ??
|
|
19798
|
+
return { status: "rolled_back", targetVersion: "previous", changes: [], backupEnvFile: rollbackEnv, lockFile: options.lockFile ?? path42.join(path42.dirname(options.envFile), ".exe-stack-lock.json") };
|
|
19491
19799
|
}
|
|
19492
19800
|
function parseStackManifest(raw, publicKey) {
|
|
19493
19801
|
const parsedRaw = JSON.parse(raw);
|
|
@@ -19512,7 +19820,7 @@ function parseStackManifest(raw, publicKey) {
|
|
|
19512
19820
|
}
|
|
19513
19821
|
async function loadStackManifest(ref, fetchText = defaultFetchText, publicKey, authToken) {
|
|
19514
19822
|
if (/^https?:\/\//.test(ref)) return parseStackManifest(await fetchTextWithAuth(ref, fetchText, authToken), publicKey);
|
|
19515
|
-
return parseStackManifest(
|
|
19823
|
+
return parseStackManifest(readFileSync29(ref, "utf8"), publicKey);
|
|
19516
19824
|
}
|
|
19517
19825
|
async function fetchTextWithAuth(ref, fetchText, authToken) {
|
|
19518
19826
|
if (!authToken || fetchText !== defaultFetchText) return fetchText(ref);
|
|
@@ -19641,9 +19949,9 @@ Emergency override requires --break-glass <reason> and writes an audit file.`
|
|
|
19641
19949
|
function writeBreakGlassAudit(plan, issues, options) {
|
|
19642
19950
|
const now2 = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
19643
19951
|
const stamp = now2().toISOString().replace(/[:.]/g, "-");
|
|
19644
|
-
const defaultDir = existsSync34("exe/output") ? "exe/output" :
|
|
19645
|
-
const auditFile = options.breakGlassAuditFile ??
|
|
19646
|
-
|
|
19952
|
+
const defaultDir = existsSync34("exe/output") ? "exe/output" : path42.dirname(options.envFile ?? ".");
|
|
19953
|
+
const auditFile = options.breakGlassAuditFile ?? path42.join(defaultDir, `stack-update-break-glass-${stamp}.md`);
|
|
19954
|
+
mkdirSync24(path42.dirname(auditFile), { recursive: true });
|
|
19647
19955
|
const body = [
|
|
19648
19956
|
`# Stack Update Break-Glass Audit \u2014 ${now2().toISOString()}`,
|
|
19649
19957
|
"",
|
|
@@ -19657,7 +19965,7 @@ function writeBreakGlassAudit(plan, issues, options) {
|
|
|
19657
19965
|
"Return this deployment to the standard pinned GHCR image path immediately after the emergency is resolved.",
|
|
19658
19966
|
""
|
|
19659
19967
|
].join("\n");
|
|
19660
|
-
|
|
19968
|
+
writeFileSync25(auditFile, body, { mode: 384 });
|
|
19661
19969
|
console.warn(`[stack-update] BREAK-GLASS deploy override recorded: ${auditFile}`);
|
|
19662
19970
|
}
|
|
19663
19971
|
function assertBreakingChangesAllowed(plan, allowedIds) {
|
|
@@ -19679,33 +19987,33 @@ async function runStackUpdate(options) {
|
|
|
19679
19987
|
const now2 = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
19680
19988
|
if (options.rollback) return rollbackStackUpdate(options);
|
|
19681
19989
|
const manifest = await loadStackManifest(options.manifestRef, options.fetchText, options.manifestPublicKey, options.manifestAuthToken);
|
|
19682
|
-
const envRaw =
|
|
19990
|
+
const envRaw = readFileSync29(options.envFile, "utf8");
|
|
19683
19991
|
const plan = createStackUpdatePlan(manifest, envRaw, options.targetVersion);
|
|
19684
19992
|
assertBreakingChangesAllowed(plan, options.allowedBreakingChangeIds ?? []);
|
|
19685
19993
|
assertDeploymentScopeAllowed(plan, options.deploymentPersona ?? "customer");
|
|
19686
19994
|
const plannedEnvRaw = patchEnv(envRaw, Object.fromEntries(plan.changes.map((c) => [c.key, c.after])));
|
|
19687
|
-
const composeRaw =
|
|
19995
|
+
const composeRaw = readFileSync29(options.composeFile, "utf8");
|
|
19688
19996
|
assertProductionDeployGate(plan, plannedEnvRaw, composeRaw, {
|
|
19689
19997
|
breakGlassReason: options.breakGlassReason,
|
|
19690
19998
|
breakGlassAuditFile: options.breakGlassAuditFile,
|
|
19691
19999
|
now: now2,
|
|
19692
20000
|
envFile: options.envFile
|
|
19693
20001
|
});
|
|
19694
|
-
const lockFile = options.lockFile ??
|
|
20002
|
+
const lockFile = options.lockFile ?? path42.join(path42.dirname(options.envFile), ".exe-stack-lock.json");
|
|
19695
20003
|
const previousVersion = readCurrentStackVersion(lockFile);
|
|
19696
20004
|
if (options.dryRun || plan.changes.length === 0) {
|
|
19697
20005
|
return { status: "planned", targetVersion: plan.targetVersion, changes: plan.changes, lockFile };
|
|
19698
20006
|
}
|
|
19699
20007
|
await postDeployAudit(options, "started", plan.targetVersion, previousVersion);
|
|
19700
|
-
const backupDir =
|
|
19701
|
-
|
|
20008
|
+
const backupDir = path42.join(path42.dirname(options.envFile), ".exe-stack-backups");
|
|
20009
|
+
mkdirSync24(backupDir, { recursive: true });
|
|
19702
20010
|
const stamp = now2().toISOString().replace(/[:.]/g, "-");
|
|
19703
|
-
const backupEnvFile =
|
|
19704
|
-
|
|
20011
|
+
const backupEnvFile = path42.join(backupDir, `env-${stamp}.bak`);
|
|
20012
|
+
writeFileSync25(backupEnvFile, envRaw, { mode: 384 });
|
|
19705
20013
|
const updates = Object.fromEntries(plan.changes.map((c) => [c.key, c.after]));
|
|
19706
20014
|
const patched = patchEnv(envRaw, updates);
|
|
19707
20015
|
const tmp = `${options.envFile}.tmp-${process.pid}`;
|
|
19708
|
-
|
|
20016
|
+
writeFileSync25(tmp, patched, { mode: 384 });
|
|
19709
20017
|
renameSync8(tmp, options.envFile);
|
|
19710
20018
|
const composeArgs = ["compose", "--file", options.composeFile, "--env-file", options.envFile];
|
|
19711
20019
|
let registryForLogout;
|
|
@@ -19718,11 +20026,11 @@ async function runStackUpdate(options) {
|
|
|
19718
20026
|
exec2("docker", [...composeArgs, "pull"]);
|
|
19719
20027
|
exec2("docker", [...composeArgs, "up", "-d"]);
|
|
19720
20028
|
await verifyReleaseHealth(plan.release, options.healthRetries ?? 12, options.healthDelayMs ?? 5e3);
|
|
19721
|
-
|
|
20029
|
+
writeFileSync25(lockFile, JSON.stringify({ stackVersion: plan.targetVersion, updatedAt: now2().toISOString(), backupEnvFile, services: plan.release.services }, null, 2) + "\n");
|
|
19722
20030
|
await postDeployAudit(options, "success", plan.targetVersion, previousVersion, void 0, { changes: plan.changes.length });
|
|
19723
20031
|
return { status: "updated", targetVersion: plan.targetVersion, changes: plan.changes, backupEnvFile, lockFile };
|
|
19724
20032
|
} catch (err) {
|
|
19725
|
-
|
|
20033
|
+
writeFileSync25(options.envFile, envRaw, { mode: 384 });
|
|
19726
20034
|
try {
|
|
19727
20035
|
exec2("docker", [...composeArgs, "up", "-d"]);
|
|
19728
20036
|
} catch {
|
|
@@ -19755,7 +20063,7 @@ async function fetchImageCredentials(options) {
|
|
|
19755
20063
|
function readCurrentStackVersion(lockFile) {
|
|
19756
20064
|
if (!existsSync34(lockFile)) return void 0;
|
|
19757
20065
|
try {
|
|
19758
|
-
const parsed = JSON.parse(
|
|
20066
|
+
const parsed = JSON.parse(readFileSync29(lockFile, "utf8"));
|
|
19759
20067
|
return parsed.stackVersion;
|
|
19760
20068
|
} catch {
|
|
19761
20069
|
return void 0;
|
|
@@ -19843,8 +20151,8 @@ async function defaultPostJson(url, body, authToken) {
|
|
|
19843
20151
|
if (!res.ok) throw new Error(`Failed to POST ${url}: HTTP ${res.status}`);
|
|
19844
20152
|
}
|
|
19845
20153
|
function defaultStackPaths() {
|
|
19846
|
-
const cwdCompose =
|
|
19847
|
-
const cwdEnv =
|
|
20154
|
+
const cwdCompose = path42.resolve("docker-compose.yml");
|
|
20155
|
+
const cwdEnv = path42.resolve(".env");
|
|
19848
20156
|
return {
|
|
19849
20157
|
composeFile: process.env.EXE_STACK_COMPOSE_FILE || (existsSync34(cwdCompose) ? cwdCompose : "/opt/exe-stack/docker-compose.yml"),
|
|
19850
20158
|
envFile: process.env.EXE_STACK_ENV_FILE || (existsSync34(cwdEnv) ? cwdEnv : "/opt/exe-stack/.env"),
|
|
@@ -19858,7 +20166,7 @@ function defaultStackPaths() {
|
|
|
19858
20166
|
function loadDefaultPublicKey() {
|
|
19859
20167
|
if (process.env.EXE_STACK_PUBLIC_KEY) return process.env.EXE_STACK_PUBLIC_KEY;
|
|
19860
20168
|
if (process.env.EXE_STACK_PUBLIC_KEY_FILE && existsSync34(process.env.EXE_STACK_PUBLIC_KEY_FILE)) {
|
|
19861
|
-
return
|
|
20169
|
+
return readFileSync29(process.env.EXE_STACK_PUBLIC_KEY_FILE, "utf8");
|
|
19862
20170
|
}
|
|
19863
20171
|
return void 0;
|
|
19864
20172
|
}
|
|
@@ -19873,9 +20181,9 @@ var init_stack_update = __esm({
|
|
|
19873
20181
|
// src/bin/stack-update.ts
|
|
19874
20182
|
var stack_update_exports = {};
|
|
19875
20183
|
__export(stack_update_exports, {
|
|
19876
|
-
runStackUpdateCli: () =>
|
|
20184
|
+
runStackUpdateCli: () => main7
|
|
19877
20185
|
});
|
|
19878
|
-
import { readFileSync as
|
|
20186
|
+
import { readFileSync as readFileSync30 } from "fs";
|
|
19879
20187
|
function parseArgs4(args2) {
|
|
19880
20188
|
const defaults = defaultStackPaths();
|
|
19881
20189
|
const opts = {
|
|
@@ -19907,8 +20215,8 @@ function parseArgs4(args2) {
|
|
|
19907
20215
|
else if (arg === "--env-file") opts.envFile = next();
|
|
19908
20216
|
else if (arg.startsWith("--env-file=")) opts.envFile = arg.split("=").slice(1).join("=");
|
|
19909
20217
|
else if (arg === "--lock-file") opts.lockFile = next();
|
|
19910
|
-
else if (arg === "--public-key") opts.manifestPublicKey =
|
|
19911
|
-
else if (arg.startsWith("--public-key=")) opts.manifestPublicKey =
|
|
20218
|
+
else if (arg === "--public-key") opts.manifestPublicKey = readFileSync30(next(), "utf8");
|
|
20219
|
+
else if (arg.startsWith("--public-key=")) opts.manifestPublicKey = readFileSync30(arg.split("=").slice(1).join("="), "utf8");
|
|
19912
20220
|
else if (arg === "--auth-token") opts.manifestAuthToken = next();
|
|
19913
20221
|
else if (arg.startsWith("--auth-token=")) opts.manifestAuthToken = arg.split("=").slice(1).join("=");
|
|
19914
20222
|
else if (arg === "--auth-token-env") opts.manifestAuthToken = process.env[next()] ?? "";
|
|
@@ -19940,7 +20248,7 @@ function parseArgs4(args2) {
|
|
|
19940
20248
|
else if (arg === "--allow-breaking") opts.allowedBreakingChangeIds.push(...next().split(",").map((s) => s.trim()).filter(Boolean));
|
|
19941
20249
|
else if (arg.startsWith("--allow-breaking=")) opts.allowedBreakingChangeIds.push(...arg.split("=")[1].split(",").map((s) => s.trim()).filter(Boolean));
|
|
19942
20250
|
else if (arg === "--help" || arg === "-h") {
|
|
19943
|
-
|
|
20251
|
+
printHelp2();
|
|
19944
20252
|
process.exit(0);
|
|
19945
20253
|
} else {
|
|
19946
20254
|
throw new Error(`Unknown option: ${arg}`);
|
|
@@ -19948,7 +20256,7 @@ function parseArgs4(args2) {
|
|
|
19948
20256
|
}
|
|
19949
20257
|
return opts;
|
|
19950
20258
|
}
|
|
19951
|
-
function
|
|
20259
|
+
function printHelp2() {
|
|
19952
20260
|
console.log(`exe-os stack-update \u2014 update a self-hosted Exe OS stack from a pinned manifest
|
|
19953
20261
|
|
|
19954
20262
|
Usage:
|
|
@@ -19999,7 +20307,7 @@ function printBreaking(changes) {
|
|
|
19999
20307
|
if (c.expectedDowntimeMinutes) console.log(` Expected downtime: ${c.expectedDowntimeMinutes} minutes`);
|
|
20000
20308
|
}
|
|
20001
20309
|
}
|
|
20002
|
-
async function
|
|
20310
|
+
async function main7() {
|
|
20003
20311
|
const opts = parseArgs4(process.argv.slice(2));
|
|
20004
20312
|
if (opts.rollback) {
|
|
20005
20313
|
if (!opts.yes) {
|
|
@@ -20011,11 +20319,11 @@ async function main6() {
|
|
|
20011
20319
|
return;
|
|
20012
20320
|
}
|
|
20013
20321
|
const manifest = await loadStackManifest(opts.manifestRef, void 0, opts.manifestPublicKey, opts.manifestAuthToken);
|
|
20014
|
-
const envRaw =
|
|
20322
|
+
const envRaw = readFileSync30(opts.envFile, "utf8");
|
|
20015
20323
|
const plan = createStackUpdatePlan(manifest, envRaw, opts.targetVersion);
|
|
20016
20324
|
assertDeploymentScopeAllowed(plan, opts.deploymentPersona);
|
|
20017
20325
|
const plannedEnvRaw = patchEnv(envRaw, Object.fromEntries(plan.changes.map((c) => [c.key, c.after])));
|
|
20018
|
-
assertProductionDeployGate(plan, plannedEnvRaw,
|
|
20326
|
+
assertProductionDeployGate(plan, plannedEnvRaw, readFileSync30(opts.composeFile, "utf8"), {
|
|
20019
20327
|
breakGlassReason: opts.breakGlassReason,
|
|
20020
20328
|
breakGlassAuditFile: opts.breakGlassAuditFile,
|
|
20021
20329
|
envFile: opts.envFile
|
|
@@ -20044,7 +20352,7 @@ var init_stack_update2 = __esm({
|
|
|
20044
20352
|
init_is_main();
|
|
20045
20353
|
init_stack_update();
|
|
20046
20354
|
if (isMainModule(import.meta.url)) {
|
|
20047
|
-
|
|
20355
|
+
main7().catch((err) => {
|
|
20048
20356
|
console.error(err instanceof Error ? err.message : String(err));
|
|
20049
20357
|
process.exit(1);
|
|
20050
20358
|
});
|
|
@@ -20216,9 +20524,9 @@ var init_registry_proxy = __esm({
|
|
|
20216
20524
|
// src/bin/registry-proxy.ts
|
|
20217
20525
|
var registry_proxy_exports = {};
|
|
20218
20526
|
__export(registry_proxy_exports, {
|
|
20219
|
-
main: () =>
|
|
20527
|
+
main: () => main8
|
|
20220
20528
|
});
|
|
20221
|
-
function
|
|
20529
|
+
function printHelp3() {
|
|
20222
20530
|
console.log(`exe-os registry-proxy \u2014 authenticated pull-through proxy for AskExe customer images
|
|
20223
20531
|
|
|
20224
20532
|
Environment:
|
|
@@ -20235,9 +20543,9 @@ Docker image shape for clients:
|
|
|
20235
20543
|
registry.askexe.com/askexe/exe-crm:v0.9.3
|
|
20236
20544
|
`);
|
|
20237
20545
|
}
|
|
20238
|
-
async function
|
|
20546
|
+
async function main8(args2 = process.argv.slice(2)) {
|
|
20239
20547
|
if (args2.includes("--help") || args2.includes("-h")) {
|
|
20240
|
-
|
|
20548
|
+
printHelp3();
|
|
20241
20549
|
return;
|
|
20242
20550
|
}
|
|
20243
20551
|
await runRegistryProxy(registryProxyOptionsFromEnv());
|
|
@@ -20248,7 +20556,7 @@ var init_registry_proxy2 = __esm({
|
|
|
20248
20556
|
init_is_main();
|
|
20249
20557
|
init_registry_proxy();
|
|
20250
20558
|
if (isMainModule(import.meta.url)) {
|
|
20251
|
-
|
|
20559
|
+
main8().catch((err) => {
|
|
20252
20560
|
console.error(err instanceof Error ? err.message : String(err));
|
|
20253
20561
|
process.exit(1);
|
|
20254
20562
|
});
|
|
@@ -22567,17 +22875,17 @@ var init_sanitize_ansi = __esm({
|
|
|
22567
22875
|
if (!hasAnsiControlCharacters(text)) {
|
|
22568
22876
|
return text;
|
|
22569
22877
|
}
|
|
22570
|
-
let
|
|
22878
|
+
let output2 = "";
|
|
22571
22879
|
for (const token of tokenizeAnsi(text)) {
|
|
22572
22880
|
if (token.type === "text" || token.type === "osc") {
|
|
22573
|
-
|
|
22881
|
+
output2 += token.value;
|
|
22574
22882
|
continue;
|
|
22575
22883
|
}
|
|
22576
22884
|
if (token.type === "csi" && token.finalCharacter === "m" && token.intermediateString === "" && sgrParametersRegex.test(token.parameterString)) {
|
|
22577
|
-
|
|
22885
|
+
output2 += token.value;
|
|
22578
22886
|
}
|
|
22579
22887
|
}
|
|
22580
|
-
return
|
|
22888
|
+
return output2;
|
|
22581
22889
|
};
|
|
22582
22890
|
sanitize_ansi_default = sanitizeAnsi;
|
|
22583
22891
|
}
|
|
@@ -23364,7 +23672,7 @@ var init_render_border = __esm({
|
|
|
23364
23672
|
"src/tui/ink/render-border.js"() {
|
|
23365
23673
|
"use strict";
|
|
23366
23674
|
init_colorize();
|
|
23367
|
-
renderBorder = (x, y, node,
|
|
23675
|
+
renderBorder = (x, y, node, output2) => {
|
|
23368
23676
|
if (node.style.borderStyle) {
|
|
23369
23677
|
const width = node.yogaNode.getComputedWidth();
|
|
23370
23678
|
const height = node.yogaNode.getComputedHeight();
|
|
@@ -23407,18 +23715,18 @@ var init_render_border = __esm({
|
|
|
23407
23715
|
}
|
|
23408
23716
|
const offsetY = showTopBorder ? 1 : 0;
|
|
23409
23717
|
if (topBorder) {
|
|
23410
|
-
|
|
23718
|
+
output2.write(x, y, topBorder, { transformers: [] });
|
|
23411
23719
|
}
|
|
23412
23720
|
if (showLeftBorder) {
|
|
23413
|
-
|
|
23721
|
+
output2.write(x, y + offsetY, leftBorder, { transformers: [] });
|
|
23414
23722
|
}
|
|
23415
23723
|
if (showRightBorder) {
|
|
23416
|
-
|
|
23724
|
+
output2.write(x + width - 1, y + offsetY, rightBorder, {
|
|
23417
23725
|
transformers: []
|
|
23418
23726
|
});
|
|
23419
23727
|
}
|
|
23420
23728
|
if (bottomBorder) {
|
|
23421
|
-
|
|
23729
|
+
output2.write(x, y + height - 1, bottomBorder, { transformers: [] });
|
|
23422
23730
|
}
|
|
23423
23731
|
}
|
|
23424
23732
|
};
|
|
@@ -23432,7 +23740,7 @@ var init_render_background = __esm({
|
|
|
23432
23740
|
"src/tui/ink/render-background.js"() {
|
|
23433
23741
|
"use strict";
|
|
23434
23742
|
init_colorize();
|
|
23435
|
-
renderBackground = (x, y, node,
|
|
23743
|
+
renderBackground = (x, y, node, output2) => {
|
|
23436
23744
|
if (!node.style.backgroundColor) {
|
|
23437
23745
|
return;
|
|
23438
23746
|
}
|
|
@@ -23449,7 +23757,7 @@ var init_render_background = __esm({
|
|
|
23449
23757
|
}
|
|
23450
23758
|
const backgroundLine = colorize_default(" ".repeat(contentWidth), node.style.backgroundColor, "background");
|
|
23451
23759
|
for (let row = 0; row < contentHeight; row++) {
|
|
23452
|
-
|
|
23760
|
+
output2.write(x + leftBorderWidth, y + topBorderHeight + row, backgroundLine, { transformers: [] });
|
|
23453
23761
|
}
|
|
23454
23762
|
};
|
|
23455
23763
|
render_background_default = renderBackground;
|
|
@@ -23485,13 +23793,13 @@ var init_render_node_to_output = __esm({
|
|
|
23485
23793
|
if (node.yogaNode?.getDisplay() === src_default.DISPLAY_NONE) {
|
|
23486
23794
|
return "";
|
|
23487
23795
|
}
|
|
23488
|
-
let
|
|
23796
|
+
let output2 = "";
|
|
23489
23797
|
if (node.nodeName === "ink-text") {
|
|
23490
|
-
|
|
23798
|
+
output2 = squash_text_nodes_default(node);
|
|
23491
23799
|
} else if (node.nodeName === "ink-box" || node.nodeName === "ink-root") {
|
|
23492
23800
|
const separator = node.style.flexDirection === "row" || node.style.flexDirection === "row-reverse" ? " " : "\n";
|
|
23493
23801
|
const childNodes = node.style.flexDirection === "row-reverse" || node.style.flexDirection === "column-reverse" ? [...node.childNodes].reverse() : [...node.childNodes];
|
|
23494
|
-
|
|
23802
|
+
output2 = childNodes.map((childNode) => {
|
|
23495
23803
|
const screenReaderOutput = renderNodeToScreenReaderOutput(childNode, {
|
|
23496
23804
|
parentRole: node.internal_accessibility?.role,
|
|
23497
23805
|
skipStaticElements: options.skipStaticElements
|
|
@@ -23505,16 +23813,16 @@ var init_render_node_to_output = __esm({
|
|
|
23505
23813
|
const stateKeys = Object.keys(state);
|
|
23506
23814
|
const stateDescription = stateKeys.filter((key) => state[key]).join(", ");
|
|
23507
23815
|
if (stateDescription) {
|
|
23508
|
-
|
|
23816
|
+
output2 = `(${stateDescription}) ${output2}`;
|
|
23509
23817
|
}
|
|
23510
23818
|
}
|
|
23511
23819
|
if (role && role !== options.parentRole) {
|
|
23512
|
-
|
|
23820
|
+
output2 = `${role}: ${output2}`;
|
|
23513
23821
|
}
|
|
23514
23822
|
}
|
|
23515
|
-
return
|
|
23823
|
+
return output2;
|
|
23516
23824
|
};
|
|
23517
|
-
renderNodeToOutput = (node,
|
|
23825
|
+
renderNodeToOutput = (node, output2, options) => {
|
|
23518
23826
|
const { offsetX = 0, offsetY = 0, transformers = [], skipStaticElements } = options;
|
|
23519
23827
|
if (skipStaticElements && node.internal_static) {
|
|
23520
23828
|
return;
|
|
@@ -23540,14 +23848,14 @@ var init_render_node_to_output = __esm({
|
|
|
23540
23848
|
text = wrap_text_default(text, maxWidth, textWrap);
|
|
23541
23849
|
}
|
|
23542
23850
|
text = applyPaddingToText(node, text);
|
|
23543
|
-
|
|
23851
|
+
output2.write(x, y, text, { transformers: newTransformers });
|
|
23544
23852
|
}
|
|
23545
23853
|
return;
|
|
23546
23854
|
}
|
|
23547
23855
|
let clipped = false;
|
|
23548
23856
|
if (node.nodeName === "ink-box") {
|
|
23549
|
-
render_background_default(x, y, node,
|
|
23550
|
-
render_border_default(x, y, node,
|
|
23857
|
+
render_background_default(x, y, node, output2);
|
|
23858
|
+
render_border_default(x, y, node, output2);
|
|
23551
23859
|
const clipHorizontally = node.style.overflowX === "hidden" || node.style.overflow === "hidden";
|
|
23552
23860
|
const clipVertically = node.style.overflowY === "hidden" || node.style.overflow === "hidden";
|
|
23553
23861
|
if (clipHorizontally || clipVertically) {
|
|
@@ -23555,13 +23863,13 @@ var init_render_node_to_output = __esm({
|
|
|
23555
23863
|
const x2 = clipHorizontally ? x + yogaNode.getComputedWidth() - yogaNode.getComputedBorder(src_default.EDGE_RIGHT) : void 0;
|
|
23556
23864
|
const y1 = clipVertically ? y + yogaNode.getComputedBorder(src_default.EDGE_TOP) : void 0;
|
|
23557
23865
|
const y2 = clipVertically ? y + yogaNode.getComputedHeight() - yogaNode.getComputedBorder(src_default.EDGE_BOTTOM) : void 0;
|
|
23558
|
-
|
|
23866
|
+
output2.clip({ x1, x2, y1, y2 });
|
|
23559
23867
|
clipped = true;
|
|
23560
23868
|
}
|
|
23561
23869
|
}
|
|
23562
23870
|
if (node.nodeName === "ink-root" || node.nodeName === "ink-box") {
|
|
23563
23871
|
for (const childNode of node.childNodes) {
|
|
23564
|
-
renderNodeToOutput(childNode,
|
|
23872
|
+
renderNodeToOutput(childNode, output2, {
|
|
23565
23873
|
offsetX: x,
|
|
23566
23874
|
offsetY: y,
|
|
23567
23875
|
transformers: newTransformers,
|
|
@@ -23569,7 +23877,7 @@ var init_render_node_to_output = __esm({
|
|
|
23569
23877
|
});
|
|
23570
23878
|
}
|
|
23571
23879
|
if (clipped) {
|
|
23572
|
-
|
|
23880
|
+
output2.unclip();
|
|
23573
23881
|
}
|
|
23574
23882
|
}
|
|
23575
23883
|
}
|
|
@@ -23654,7 +23962,7 @@ var init_output = __esm({
|
|
|
23654
23962
|
});
|
|
23655
23963
|
}
|
|
23656
23964
|
get() {
|
|
23657
|
-
const
|
|
23965
|
+
const output2 = [];
|
|
23658
23966
|
for (let y = 0; y < this.height; y++) {
|
|
23659
23967
|
const row = [];
|
|
23660
23968
|
for (let x = 0; x < this.width; x++) {
|
|
@@ -23665,7 +23973,7 @@ var init_output = __esm({
|
|
|
23665
23973
|
styles: []
|
|
23666
23974
|
});
|
|
23667
23975
|
}
|
|
23668
|
-
|
|
23976
|
+
output2.push(row);
|
|
23669
23977
|
}
|
|
23670
23978
|
const clips = [];
|
|
23671
23979
|
for (const operation of this.operations) {
|
|
@@ -23718,7 +24026,7 @@ var init_output = __esm({
|
|
|
23718
24026
|
}
|
|
23719
24027
|
let offsetY = 0;
|
|
23720
24028
|
for (let [index, line] of lines.entries()) {
|
|
23721
|
-
const currentLine =
|
|
24029
|
+
const currentLine = output2[y + offsetY];
|
|
23722
24030
|
if (!currentLine) {
|
|
23723
24031
|
continue;
|
|
23724
24032
|
}
|
|
@@ -23746,13 +24054,13 @@ var init_output = __esm({
|
|
|
23746
24054
|
}
|
|
23747
24055
|
}
|
|
23748
24056
|
}
|
|
23749
|
-
const generatedOutput =
|
|
24057
|
+
const generatedOutput = output2.map((line) => {
|
|
23750
24058
|
const lineWithoutEmptyItems = line.filter((item) => item !== void 0);
|
|
23751
24059
|
return styledCharsToString(lineWithoutEmptyItems).trimEnd();
|
|
23752
24060
|
}).join("\n");
|
|
23753
24061
|
return {
|
|
23754
24062
|
output: generatedOutput,
|
|
23755
|
-
height:
|
|
24063
|
+
height: output2.length
|
|
23756
24064
|
};
|
|
23757
24065
|
}
|
|
23758
24066
|
};
|
|
@@ -23769,10 +24077,10 @@ var init_renderer = __esm({
|
|
|
23769
24077
|
renderer = (node, isScreenReaderEnabled) => {
|
|
23770
24078
|
if (node.yogaNode) {
|
|
23771
24079
|
if (isScreenReaderEnabled) {
|
|
23772
|
-
const
|
|
24080
|
+
const output3 = renderNodeToScreenReaderOutput(node, {
|
|
23773
24081
|
skipStaticElements: true
|
|
23774
24082
|
});
|
|
23775
|
-
const outputHeight2 =
|
|
24083
|
+
const outputHeight2 = output3 === "" ? 0 : output3.split("\n").length;
|
|
23776
24084
|
let staticOutput2 = "";
|
|
23777
24085
|
if (node.staticNode) {
|
|
23778
24086
|
staticOutput2 = renderNodeToScreenReaderOutput(node.staticNode, {
|
|
@@ -23780,17 +24088,17 @@ var init_renderer = __esm({
|
|
|
23780
24088
|
});
|
|
23781
24089
|
}
|
|
23782
24090
|
return {
|
|
23783
|
-
output:
|
|
24091
|
+
output: output3,
|
|
23784
24092
|
outputHeight: outputHeight2,
|
|
23785
24093
|
staticOutput: staticOutput2 ? `${staticOutput2}
|
|
23786
24094
|
` : ""
|
|
23787
24095
|
};
|
|
23788
24096
|
}
|
|
23789
|
-
const
|
|
24097
|
+
const output2 = new Output({
|
|
23790
24098
|
width: node.yogaNode.getComputedWidth(),
|
|
23791
24099
|
height: node.yogaNode.getComputedHeight()
|
|
23792
24100
|
});
|
|
23793
|
-
render_node_to_output_default(node,
|
|
24101
|
+
render_node_to_output_default(node, output2, {
|
|
23794
24102
|
skipStaticElements: true
|
|
23795
24103
|
});
|
|
23796
24104
|
let staticOutput;
|
|
@@ -23803,7 +24111,7 @@ var init_renderer = __esm({
|
|
|
23803
24111
|
skipStaticElements: false
|
|
23804
24112
|
});
|
|
23805
24113
|
}
|
|
23806
|
-
const { output: generatedOutput, height: outputHeight } =
|
|
24114
|
+
const { output: generatedOutput, height: outputHeight } = output2.get();
|
|
23807
24115
|
return {
|
|
23808
24116
|
output: generatedOutput,
|
|
23809
24117
|
outputHeight,
|
|
@@ -24614,8 +24922,8 @@ var init_ErrorOverview = __esm({
|
|
|
24614
24922
|
"use strict";
|
|
24615
24923
|
init_Box();
|
|
24616
24924
|
init_Text();
|
|
24617
|
-
cleanupPath = (
|
|
24618
|
-
return
|
|
24925
|
+
cleanupPath = (path56) => {
|
|
24926
|
+
return path56?.replace(`file://${cwd()}/`, "");
|
|
24619
24927
|
};
|
|
24620
24928
|
stackUtils = new StackUtils({
|
|
24621
24929
|
cwd: cwd(),
|
|
@@ -25236,13 +25544,13 @@ var init_ink = __esm({
|
|
|
25236
25544
|
incremental: options.incrementalRendering
|
|
25237
25545
|
});
|
|
25238
25546
|
this.cursorPosition = void 0;
|
|
25239
|
-
this.throttledLog = unthrottled ? this.log : throttle((
|
|
25240
|
-
const shouldWrite = this.log.willRender(
|
|
25547
|
+
this.throttledLog = unthrottled ? this.log : throttle((output2) => {
|
|
25548
|
+
const shouldWrite = this.log.willRender(output2);
|
|
25241
25549
|
const sync = shouldSynchronize(this.options.stdout);
|
|
25242
25550
|
if (sync && shouldWrite) {
|
|
25243
25551
|
this.options.stdout.write(bsu);
|
|
25244
25552
|
}
|
|
25245
|
-
this.log(
|
|
25553
|
+
this.log(output2);
|
|
25246
25554
|
if (sync && shouldWrite) {
|
|
25247
25555
|
this.options.stdout.write(esu);
|
|
25248
25556
|
}
|
|
@@ -25333,22 +25641,22 @@ var init_ink = __esm({
|
|
|
25333
25641
|
return;
|
|
25334
25642
|
}
|
|
25335
25643
|
const startTime = performance.now();
|
|
25336
|
-
const { output, outputHeight, staticOutput } = renderer_default(this.rootNode, this.isScreenReaderEnabled);
|
|
25644
|
+
const { output: output2, outputHeight, staticOutput } = renderer_default(this.rootNode, this.isScreenReaderEnabled);
|
|
25337
25645
|
this.options.onRender?.({ renderTime: performance.now() - startTime });
|
|
25338
25646
|
const hasStaticOutput = staticOutput && staticOutput !== "\n";
|
|
25339
25647
|
if (this.options.debug) {
|
|
25340
25648
|
if (hasStaticOutput) {
|
|
25341
25649
|
this.fullStaticOutput += staticOutput;
|
|
25342
25650
|
}
|
|
25343
|
-
this.options.stdout.write(this.fullStaticOutput +
|
|
25651
|
+
this.options.stdout.write(this.fullStaticOutput + output2);
|
|
25344
25652
|
return;
|
|
25345
25653
|
}
|
|
25346
25654
|
if (isInCi2) {
|
|
25347
25655
|
if (hasStaticOutput) {
|
|
25348
25656
|
this.options.stdout.write(staticOutput);
|
|
25349
25657
|
}
|
|
25350
|
-
this.lastOutput =
|
|
25351
|
-
this.lastOutputToRender =
|
|
25658
|
+
this.lastOutput = output2;
|
|
25659
|
+
this.lastOutputToRender = output2 + "\n";
|
|
25352
25660
|
this.lastOutputHeight = outputHeight;
|
|
25353
25661
|
return;
|
|
25354
25662
|
}
|
|
@@ -25362,14 +25670,14 @@ var init_ink = __esm({
|
|
|
25362
25670
|
this.options.stdout.write(erase + staticOutput);
|
|
25363
25671
|
this.lastOutputHeight = 0;
|
|
25364
25672
|
}
|
|
25365
|
-
if (
|
|
25673
|
+
if (output2 === this.lastOutput && !hasStaticOutput) {
|
|
25366
25674
|
if (sync) {
|
|
25367
25675
|
this.options.stdout.write(esu);
|
|
25368
25676
|
}
|
|
25369
25677
|
return;
|
|
25370
25678
|
}
|
|
25371
25679
|
const terminalWidth = this.getTerminalWidth();
|
|
25372
|
-
const wrappedOutput = wrapAnsi2(
|
|
25680
|
+
const wrappedOutput = wrapAnsi2(output2, terminalWidth, {
|
|
25373
25681
|
trim: false,
|
|
25374
25682
|
hard: true
|
|
25375
25683
|
});
|
|
@@ -25379,7 +25687,7 @@ var init_ink = __esm({
|
|
|
25379
25687
|
const erase = this.lastOutputHeight > 0 ? ansiEscapes3.eraseLines(this.lastOutputHeight) : "";
|
|
25380
25688
|
this.options.stdout.write(erase + wrappedOutput);
|
|
25381
25689
|
}
|
|
25382
|
-
this.lastOutput =
|
|
25690
|
+
this.lastOutput = output2;
|
|
25383
25691
|
this.lastOutputToRender = wrappedOutput;
|
|
25384
25692
|
this.lastOutputHeight = wrappedOutput === "" ? 0 : wrappedOutput.split("\n").length;
|
|
25385
25693
|
if (sync) {
|
|
@@ -25391,14 +25699,14 @@ var init_ink = __esm({
|
|
|
25391
25699
|
this.fullStaticOutput += staticOutput;
|
|
25392
25700
|
}
|
|
25393
25701
|
const isFullscreen = this.options.stdout.isTTY && outputHeight >= this.options.stdout.rows;
|
|
25394
|
-
const outputToRender = isFullscreen ?
|
|
25702
|
+
const outputToRender = isFullscreen ? output2 : output2 + "\n";
|
|
25395
25703
|
if (this.lastOutputHeight >= this.options.stdout.rows) {
|
|
25396
25704
|
const sync = shouldSynchronize(this.options.stdout);
|
|
25397
25705
|
if (sync) {
|
|
25398
25706
|
this.options.stdout.write(bsu);
|
|
25399
25707
|
}
|
|
25400
|
-
this.options.stdout.write(ansiEscapes3.clearTerminal + this.fullStaticOutput +
|
|
25401
|
-
this.lastOutput =
|
|
25708
|
+
this.options.stdout.write(ansiEscapes3.clearTerminal + this.fullStaticOutput + output2);
|
|
25709
|
+
this.lastOutput = output2;
|
|
25402
25710
|
this.lastOutputToRender = outputToRender;
|
|
25403
25711
|
this.lastOutputHeight = outputHeight;
|
|
25404
25712
|
this.log.sync(outputToRender);
|
|
@@ -25418,10 +25726,10 @@ var init_ink = __esm({
|
|
|
25418
25726
|
if (sync) {
|
|
25419
25727
|
this.options.stdout.write(esu);
|
|
25420
25728
|
}
|
|
25421
|
-
} else if (
|
|
25729
|
+
} else if (output2 !== this.lastOutput || this.log.isCursorDirty()) {
|
|
25422
25730
|
this.throttledLog(outputToRender);
|
|
25423
25731
|
}
|
|
25424
|
-
this.lastOutput =
|
|
25732
|
+
this.lastOutput = output2;
|
|
25425
25733
|
this.lastOutputToRender = outputToRender;
|
|
25426
25734
|
this.lastOutputHeight = outputHeight;
|
|
25427
25735
|
};
|
|
@@ -28760,7 +29068,7 @@ var init_anthropic = __esm({
|
|
|
28760
29068
|
|
|
28761
29069
|
// src/lib/providers/openai-compat.ts
|
|
28762
29070
|
import OpenAI from "openai";
|
|
28763
|
-
import { randomUUID as
|
|
29071
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
28764
29072
|
var OpenAICompatProvider;
|
|
28765
29073
|
var init_openai_compat = __esm({
|
|
28766
29074
|
"src/lib/providers/openai-compat.ts"() {
|
|
@@ -28877,7 +29185,7 @@ var init_openai_compat = __esm({
|
|
|
28877
29185
|
}
|
|
28878
29186
|
content.push({
|
|
28879
29187
|
type: "tool_use",
|
|
28880
|
-
id: call.id ??
|
|
29188
|
+
id: call.id ?? randomUUID6(),
|
|
28881
29189
|
name: fn.name,
|
|
28882
29190
|
input
|
|
28883
29191
|
});
|
|
@@ -29078,10 +29386,10 @@ var init_hooks = __esm({
|
|
|
29078
29386
|
});
|
|
29079
29387
|
|
|
29080
29388
|
// src/runtime/safety-checks.ts
|
|
29081
|
-
import
|
|
29389
|
+
import path43 from "path";
|
|
29082
29390
|
import os21 from "os";
|
|
29083
29391
|
function checkPathSafety(filePath) {
|
|
29084
|
-
const resolved =
|
|
29392
|
+
const resolved = path43.resolve(filePath);
|
|
29085
29393
|
for (const { pattern, reason } of BYPASS_IMMUNE_PATTERNS) {
|
|
29086
29394
|
const matches = typeof pattern === "function" ? pattern(resolved) : pattern.test(resolved);
|
|
29087
29395
|
if (matches) {
|
|
@@ -29091,7 +29399,7 @@ function checkPathSafety(filePath) {
|
|
|
29091
29399
|
return { safe: true, bypassImmune: true };
|
|
29092
29400
|
}
|
|
29093
29401
|
function checkReadPathSafety(filePath) {
|
|
29094
|
-
const resolved =
|
|
29402
|
+
const resolved = path43.resolve(filePath);
|
|
29095
29403
|
const credPatterns = BYPASS_IMMUNE_PATTERNS.filter(
|
|
29096
29404
|
(p) => typeof p.pattern !== "function" && (p.reason.includes("secrets") || p.reason.includes("Private key") || p.reason.includes("Credential"))
|
|
29097
29405
|
);
|
|
@@ -29117,11 +29425,11 @@ var init_safety_checks = __esm({
|
|
|
29117
29425
|
reason: "Git config can set hooks and command execution"
|
|
29118
29426
|
},
|
|
29119
29427
|
{
|
|
29120
|
-
pattern: (p) => p.startsWith(
|
|
29428
|
+
pattern: (p) => p.startsWith(path43.join(HOME, ".claude")),
|
|
29121
29429
|
reason: "Claude configuration files are protected"
|
|
29122
29430
|
},
|
|
29123
29431
|
{
|
|
29124
|
-
pattern: (p) => p.startsWith(
|
|
29432
|
+
pattern: (p) => p.startsWith(path43.join(HOME, ".exe-os")),
|
|
29125
29433
|
reason: "exe-os configuration files are protected"
|
|
29126
29434
|
},
|
|
29127
29435
|
{
|
|
@@ -29138,7 +29446,7 @@ var init_safety_checks = __esm({
|
|
|
29138
29446
|
},
|
|
29139
29447
|
{
|
|
29140
29448
|
pattern: (p) => {
|
|
29141
|
-
const name =
|
|
29449
|
+
const name = path43.basename(p);
|
|
29142
29450
|
return [".bashrc", ".zshrc", ".profile", ".bash_profile", ".zprofile", ".zshenv"].includes(name);
|
|
29143
29451
|
},
|
|
29144
29452
|
reason: "Shell configuration files can execute arbitrary code on login"
|
|
@@ -29165,7 +29473,7 @@ __export(file_read_exports, {
|
|
|
29165
29473
|
FileReadTool: () => FileReadTool
|
|
29166
29474
|
});
|
|
29167
29475
|
import fs3 from "fs/promises";
|
|
29168
|
-
import
|
|
29476
|
+
import path44 from "path";
|
|
29169
29477
|
import { z } from "zod";
|
|
29170
29478
|
function isBinary(buf) {
|
|
29171
29479
|
for (let i = 0; i < buf.length; i++) {
|
|
@@ -29201,7 +29509,7 @@ var init_file_read = __esm({
|
|
|
29201
29509
|
return { behavior: "allow" };
|
|
29202
29510
|
},
|
|
29203
29511
|
async call(input, context) {
|
|
29204
|
-
const filePath =
|
|
29512
|
+
const filePath = path44.isAbsolute(input.file_path) ? input.file_path : path44.resolve(context.cwd, input.file_path);
|
|
29205
29513
|
let stat2;
|
|
29206
29514
|
try {
|
|
29207
29515
|
stat2 = await fs3.stat(filePath);
|
|
@@ -29241,7 +29549,7 @@ __export(glob_exports, {
|
|
|
29241
29549
|
GlobTool: () => GlobTool
|
|
29242
29550
|
});
|
|
29243
29551
|
import fs4 from "fs/promises";
|
|
29244
|
-
import
|
|
29552
|
+
import path45 from "path";
|
|
29245
29553
|
import { z as z2 } from "zod";
|
|
29246
29554
|
async function walkDir(dir, maxDepth = 10) {
|
|
29247
29555
|
const results = [];
|
|
@@ -29257,7 +29565,7 @@ async function walkDir(dir, maxDepth = 10) {
|
|
|
29257
29565
|
if (entry.isDirectory() && (entry.name === "node_modules" || entry.name === ".git")) {
|
|
29258
29566
|
continue;
|
|
29259
29567
|
}
|
|
29260
|
-
const fullPath =
|
|
29568
|
+
const fullPath = path45.join(current, entry.name);
|
|
29261
29569
|
if (entry.isDirectory()) {
|
|
29262
29570
|
await walk(fullPath, depth + 1);
|
|
29263
29571
|
} else {
|
|
@@ -29291,11 +29599,11 @@ var init_glob = __esm({
|
|
|
29291
29599
|
inputSchema: inputSchema2,
|
|
29292
29600
|
isReadOnly: true,
|
|
29293
29601
|
async call(input, context) {
|
|
29294
|
-
const baseDir = input.path ?
|
|
29602
|
+
const baseDir = input.path ? path45.isAbsolute(input.path) ? input.path : path45.resolve(context.cwd, input.path) : context.cwd;
|
|
29295
29603
|
try {
|
|
29296
29604
|
const entries = await walkDir(baseDir);
|
|
29297
29605
|
const matched = entries.filter(
|
|
29298
|
-
(e) => simpleGlobMatch(
|
|
29606
|
+
(e) => simpleGlobMatch(path45.relative(baseDir, e.path), input.pattern)
|
|
29299
29607
|
);
|
|
29300
29608
|
matched.sort((a, b) => b.mtime - a.mtime);
|
|
29301
29609
|
if (matched.length === 0) {
|
|
@@ -29321,7 +29629,7 @@ __export(grep_exports, {
|
|
|
29321
29629
|
});
|
|
29322
29630
|
import { spawn as spawn2 } from "child_process";
|
|
29323
29631
|
import fs5 from "fs/promises";
|
|
29324
|
-
import
|
|
29632
|
+
import path46 from "path";
|
|
29325
29633
|
import { z as z3 } from "zod";
|
|
29326
29634
|
function runRipgrep(input, searchPath, context) {
|
|
29327
29635
|
return new Promise((resolve, reject) => {
|
|
@@ -29349,8 +29657,8 @@ function runRipgrep(input, searchPath, context) {
|
|
|
29349
29657
|
context.abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
29350
29658
|
child.on("close", (code) => {
|
|
29351
29659
|
context.abortSignal.removeEventListener("abort", onAbort);
|
|
29352
|
-
const
|
|
29353
|
-
if (code === 1 && !
|
|
29660
|
+
const output2 = Buffer.concat(chunks).toString("utf-8").trim();
|
|
29661
|
+
if (code === 1 && !output2) {
|
|
29354
29662
|
resolve({ content: "No matches found." });
|
|
29355
29663
|
return;
|
|
29356
29664
|
}
|
|
@@ -29358,7 +29666,7 @@ function runRipgrep(input, searchPath, context) {
|
|
|
29358
29666
|
reject(new Error("ripgrep error"));
|
|
29359
29667
|
return;
|
|
29360
29668
|
}
|
|
29361
|
-
resolve({ content:
|
|
29669
|
+
resolve({ content: output2 || "No matches found." });
|
|
29362
29670
|
});
|
|
29363
29671
|
child.on("error", () => reject(new Error("rg not found")));
|
|
29364
29672
|
});
|
|
@@ -29375,7 +29683,7 @@ async function nodeGrep(input, searchPath) {
|
|
|
29375
29683
|
}
|
|
29376
29684
|
for (const entry of entries) {
|
|
29377
29685
|
if (entry.name === "node_modules" || entry.name === ".git") continue;
|
|
29378
|
-
const fullPath =
|
|
29686
|
+
const fullPath = path46.join(dir, entry.name);
|
|
29379
29687
|
if (entry.isDirectory()) {
|
|
29380
29688
|
await walk(fullPath);
|
|
29381
29689
|
} else {
|
|
@@ -29421,7 +29729,7 @@ var init_grep = __esm({
|
|
|
29421
29729
|
inputSchema: inputSchema3,
|
|
29422
29730
|
isReadOnly: true,
|
|
29423
29731
|
async call(input, context) {
|
|
29424
|
-
const searchPath = input.path ?
|
|
29732
|
+
const searchPath = input.path ? path46.isAbsolute(input.path) ? input.path : path46.resolve(context.cwd, input.path) : context.cwd;
|
|
29425
29733
|
try {
|
|
29426
29734
|
const result = await runRipgrep(input, searchPath, context);
|
|
29427
29735
|
return result;
|
|
@@ -29446,7 +29754,7 @@ __export(file_write_exports, {
|
|
|
29446
29754
|
FileWriteTool: () => FileWriteTool
|
|
29447
29755
|
});
|
|
29448
29756
|
import fs6 from "fs/promises";
|
|
29449
|
-
import
|
|
29757
|
+
import path47 from "path";
|
|
29450
29758
|
import { z as z4 } from "zod";
|
|
29451
29759
|
var inputSchema4, FileWriteTool;
|
|
29452
29760
|
var init_file_write = __esm({
|
|
@@ -29474,8 +29782,8 @@ var init_file_write = __esm({
|
|
|
29474
29782
|
return { behavior: "allow" };
|
|
29475
29783
|
},
|
|
29476
29784
|
async call(input, context) {
|
|
29477
|
-
const filePath =
|
|
29478
|
-
const dir =
|
|
29785
|
+
const filePath = path47.isAbsolute(input.file_path) ? input.file_path : path47.resolve(context.cwd, input.file_path);
|
|
29786
|
+
const dir = path47.dirname(filePath);
|
|
29479
29787
|
await fs6.mkdir(dir, { recursive: true });
|
|
29480
29788
|
await fs6.writeFile(filePath, input.content, "utf-8");
|
|
29481
29789
|
return {
|
|
@@ -29493,7 +29801,7 @@ __export(file_edit_exports, {
|
|
|
29493
29801
|
FileEditTool: () => FileEditTool
|
|
29494
29802
|
});
|
|
29495
29803
|
import fs7 from "fs/promises";
|
|
29496
|
-
import
|
|
29804
|
+
import path48 from "path";
|
|
29497
29805
|
import { z as z5 } from "zod";
|
|
29498
29806
|
function countOccurrences(haystack, needle) {
|
|
29499
29807
|
let count = 0;
|
|
@@ -29534,7 +29842,7 @@ var init_file_edit = __esm({
|
|
|
29534
29842
|
return { behavior: "allow" };
|
|
29535
29843
|
},
|
|
29536
29844
|
async call(input, context) {
|
|
29537
|
-
const filePath =
|
|
29845
|
+
const filePath = path48.isAbsolute(input.file_path) ? input.file_path : path48.resolve(context.cwd, input.file_path);
|
|
29538
29846
|
let content;
|
|
29539
29847
|
try {
|
|
29540
29848
|
content = await fs7.readFile(filePath, "utf-8");
|
|
@@ -29757,8 +30065,8 @@ var init_bash = __esm({
|
|
|
29757
30065
|
return;
|
|
29758
30066
|
}
|
|
29759
30067
|
if (code !== 0) {
|
|
29760
|
-
const
|
|
29761
|
-
resolve({ content:
|
|
30068
|
+
const output2 = stderr || stdout || `Exit code ${code}`;
|
|
30069
|
+
resolve({ content: output2, isError: true });
|
|
29762
30070
|
return;
|
|
29763
30071
|
}
|
|
29764
30072
|
resolve({ content: stdout || "(no output)" });
|
|
@@ -29776,7 +30084,7 @@ var init_bash = __esm({
|
|
|
29776
30084
|
// src/tui/views/CommandCenter.tsx
|
|
29777
30085
|
import { useState as useState6, useEffect as useEffect8, useMemo as useMemo4, useCallback as useCallback4, useRef as useRef4 } from "react";
|
|
29778
30086
|
import TextInput from "ink-text-input";
|
|
29779
|
-
import
|
|
30087
|
+
import path49 from "path";
|
|
29780
30088
|
import { homedir as homedir6 } from "os";
|
|
29781
30089
|
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
29782
30090
|
function CommandCenterView({
|
|
@@ -29811,7 +30119,7 @@ function CommandCenterView({
|
|
|
29811
30119
|
const { createPermissionsFromPreset: createPermissionsFromPreset2, EMPLOYEE_PERMISSIONS: EMPLOYEE_PERMISSIONS2 } = await Promise.resolve().then(() => (init_permissions(), permissions_exports));
|
|
29812
30120
|
const { getPresetByRole: getPresetByRole2 } = await Promise.resolve().then(() => (init_permission_presets(), permission_presets_exports));
|
|
29813
30121
|
const { createDefaultHooks: createDefaultHooks2 } = await Promise.resolve().then(() => (init_hooks(), hooks_exports));
|
|
29814
|
-
const { readFileSync:
|
|
30122
|
+
const { readFileSync: readFileSync37, existsSync: existsSync41 } = await import("fs");
|
|
29815
30123
|
const { join } = await import("path");
|
|
29816
30124
|
const { homedir: homedir8 } = await import("os");
|
|
29817
30125
|
const configPath = join(homedir8(), ".exe-os", "config.json");
|
|
@@ -29819,7 +30127,7 @@ function CommandCenterView({
|
|
|
29819
30127
|
let providerConfigs = {};
|
|
29820
30128
|
if (existsSync41(configPath)) {
|
|
29821
30129
|
try {
|
|
29822
|
-
const raw = JSON.parse(
|
|
30130
|
+
const raw = JSON.parse(readFileSync37(configPath, "utf8"));
|
|
29823
30131
|
if (Array.isArray(raw.failoverChain)) failoverChain = raw.failoverChain;
|
|
29824
30132
|
if (raw.providers && typeof raw.providers === "object") {
|
|
29825
30133
|
providerConfigs = raw.providers;
|
|
@@ -29880,7 +30188,7 @@ function CommandCenterView({
|
|
|
29880
30188
|
const markerDir = join(homedir8(), ".exe-os", "session-cache");
|
|
29881
30189
|
const agentFiles = (await import("fs")).readdirSync(markerDir).filter((f) => f.startsWith("active-agent-"));
|
|
29882
30190
|
for (const f of agentFiles) {
|
|
29883
|
-
const data = JSON.parse(
|
|
30191
|
+
const data = JSON.parse(readFileSync37(join(markerDir, f), "utf8"));
|
|
29884
30192
|
if (data.agentRole) {
|
|
29885
30193
|
agentRole = data.agentRole;
|
|
29886
30194
|
break;
|
|
@@ -30025,7 +30333,7 @@ function CommandCenterView({
|
|
|
30025
30333
|
const demoEntries = DEMO_PROJECTS.map((p) => ({
|
|
30026
30334
|
projectName: p.projectName,
|
|
30027
30335
|
exeSession: p.exeSession,
|
|
30028
|
-
projectDir:
|
|
30336
|
+
projectDir: path49.join(homedir6(), p.projectName),
|
|
30029
30337
|
employeeCount: p.employees.length,
|
|
30030
30338
|
activeCount: p.employees.filter((e) => e.status === "active").length,
|
|
30031
30339
|
memoryCount: p.employees.length * 4e3,
|
|
@@ -30401,11 +30709,11 @@ function TmuxPane({ sessionName, employeeName, employeeRole, projectName, onDeta
|
|
|
30401
30709
|
const capture = () => {
|
|
30402
30710
|
try {
|
|
30403
30711
|
const { execSync: execSync18 } = __require("child_process");
|
|
30404
|
-
const
|
|
30712
|
+
const output2 = execSync18(
|
|
30405
30713
|
`tmux capture-pane -t ${JSON.stringify(sessionName)} -p -e 2>/dev/null | tail -${CAPTURE_LINES}`,
|
|
30406
30714
|
{ encoding: "utf8", timeout: 3e3 }
|
|
30407
30715
|
);
|
|
30408
|
-
setLines(
|
|
30716
|
+
setLines(output2.split("\n"));
|
|
30409
30717
|
setAlive(true);
|
|
30410
30718
|
} catch {
|
|
30411
30719
|
setAlive(false);
|
|
@@ -30506,7 +30814,7 @@ var init_TmuxPane = __esm({
|
|
|
30506
30814
|
});
|
|
30507
30815
|
|
|
30508
30816
|
// src/lib/task-router.ts
|
|
30509
|
-
import { randomUUID as
|
|
30817
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
30510
30818
|
function resolveBloomRouting(complexity, config = DEFAULT_BLOOM_CONFIG) {
|
|
30511
30819
|
const tier = config.complexityToTier[complexity];
|
|
30512
30820
|
const rule = config.tierRules[tier];
|
|
@@ -31029,7 +31337,7 @@ var init_useOrchestrator = __esm({
|
|
|
31029
31337
|
|
|
31030
31338
|
// src/tui/views/Sessions.tsx
|
|
31031
31339
|
import React19, { useState as useState9, useEffect as useEffect11, useCallback as useCallback6 } from "react";
|
|
31032
|
-
import
|
|
31340
|
+
import path50 from "path";
|
|
31033
31341
|
import { homedir as homedir7 } from "os";
|
|
31034
31342
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
31035
31343
|
function isCoordinatorEntry(entry) {
|
|
@@ -31067,7 +31375,7 @@ function SessionsView({
|
|
|
31067
31375
|
if (demo) {
|
|
31068
31376
|
setProjects(DEMO_PROJECTS.map((p) => ({
|
|
31069
31377
|
...p,
|
|
31070
|
-
projectDir:
|
|
31378
|
+
projectDir: path50.join(homedir7(), p.projectName),
|
|
31071
31379
|
employees: p.employees.map((e) => ({ ...e, attached: e.status === "active" }))
|
|
31072
31380
|
})));
|
|
31073
31381
|
return;
|
|
@@ -32282,12 +32590,12 @@ async function loadGatewayConfig() {
|
|
|
32282
32590
|
state.running = false;
|
|
32283
32591
|
}
|
|
32284
32592
|
try {
|
|
32285
|
-
const { existsSync: existsSync41, readFileSync:
|
|
32593
|
+
const { existsSync: existsSync41, readFileSync: readFileSync37 } = await import("fs");
|
|
32286
32594
|
const { join } = await import("path");
|
|
32287
32595
|
const home = process.env.HOME ?? "";
|
|
32288
32596
|
const configPath = join(home, ".exe-os", "gateway.json");
|
|
32289
32597
|
if (existsSync41(configPath)) {
|
|
32290
|
-
const raw = JSON.parse(
|
|
32598
|
+
const raw = JSON.parse(readFileSync37(configPath, "utf8"));
|
|
32291
32599
|
state.port = raw.port ?? 3100;
|
|
32292
32600
|
state.gatewayUrl = raw.gatewayUrl ?? "";
|
|
32293
32601
|
if (raw.adapters) {
|
|
@@ -32885,12 +33193,12 @@ function TeamView({ onBack, onViewSessions }) {
|
|
|
32885
33193
|
setMembers(teamData);
|
|
32886
33194
|
setDbError(null);
|
|
32887
33195
|
try {
|
|
32888
|
-
const { existsSync: existsSync41, readFileSync:
|
|
33196
|
+
const { existsSync: existsSync41, readFileSync: readFileSync37 } = await import("fs");
|
|
32889
33197
|
const { join } = await import("path");
|
|
32890
33198
|
const home = process.env.HOME ?? "";
|
|
32891
33199
|
const gatewayConfig = join(home, ".exe-os", "gateway.json");
|
|
32892
33200
|
if (existsSync41(gatewayConfig)) {
|
|
32893
|
-
const raw = JSON.parse(
|
|
33201
|
+
const raw = JSON.parse(readFileSync37(gatewayConfig, "utf8"));
|
|
32894
33202
|
if (raw.agents && raw.agents.length > 0) {
|
|
32895
33203
|
setExternals(raw.agents.map((a) => ({
|
|
32896
33204
|
name: a.name,
|
|
@@ -33070,8 +33378,8 @@ __export(wiki_client_exports, {
|
|
|
33070
33378
|
listDocuments: () => listDocuments,
|
|
33071
33379
|
listWorkspaces: () => listWorkspaces
|
|
33072
33380
|
});
|
|
33073
|
-
async function wikiFetch(config,
|
|
33074
|
-
const url = `${config.baseUrl}/api/v1${
|
|
33381
|
+
async function wikiFetch(config, path56, method = "GET", body) {
|
|
33382
|
+
const url = `${config.baseUrl}/api/v1${path56}`;
|
|
33075
33383
|
const headers = {
|
|
33076
33384
|
Authorization: `Bearer ${config.apiKey}`,
|
|
33077
33385
|
"Content-Type": "application/json"
|
|
@@ -33104,7 +33412,7 @@ async function wikiFetch(config, path55, method = "GET", body) {
|
|
|
33104
33412
|
}
|
|
33105
33413
|
}
|
|
33106
33414
|
if (!response.ok) {
|
|
33107
|
-
throw new Error(`Wiki API ${method} ${
|
|
33415
|
+
throw new Error(`Wiki API ${method} ${path56}: ${response.status} ${response.statusText}`);
|
|
33108
33416
|
}
|
|
33109
33417
|
return response.json();
|
|
33110
33418
|
} finally {
|
|
@@ -33721,17 +34029,17 @@ function SettingsView({ onBack }) {
|
|
|
33721
34029
|
}
|
|
33722
34030
|
let version = "unknown";
|
|
33723
34031
|
try {
|
|
33724
|
-
const { readFileSync:
|
|
34032
|
+
const { readFileSync: readFileSync37 } = await import("fs");
|
|
33725
34033
|
const { createRequire: createRequire3 } = await import("module");
|
|
33726
34034
|
const require2 = createRequire3(import.meta.url);
|
|
33727
34035
|
const pkgPath = require2.resolve("@askexenow/exe-os/package.json");
|
|
33728
|
-
const pkg = JSON.parse(
|
|
34036
|
+
const pkg = JSON.parse(readFileSync37(pkgPath, "utf8"));
|
|
33729
34037
|
version = pkg.version;
|
|
33730
34038
|
} catch {
|
|
33731
34039
|
try {
|
|
33732
|
-
const { readFileSync:
|
|
34040
|
+
const { readFileSync: readFileSync37 } = await import("fs");
|
|
33733
34041
|
const { join: joinPath } = await import("path");
|
|
33734
|
-
const pkg = JSON.parse(
|
|
34042
|
+
const pkg = JSON.parse(readFileSync37(joinPath(process.cwd(), "package.json"), "utf8"));
|
|
33735
34043
|
version = pkg.version;
|
|
33736
34044
|
} catch {
|
|
33737
34045
|
}
|
|
@@ -34588,24 +34896,24 @@ __export(code_context_index_exports, {
|
|
|
34588
34896
|
traceCodeSymbol: () => traceCodeSymbol
|
|
34589
34897
|
});
|
|
34590
34898
|
import crypto14 from "crypto";
|
|
34591
|
-
import
|
|
34592
|
-
import { existsSync as existsSync36, mkdirSync as
|
|
34899
|
+
import path51 from "path";
|
|
34900
|
+
import { existsSync as existsSync36, mkdirSync as mkdirSync25, readFileSync as readFileSync32, readdirSync as readdirSync11, statSync as statSync7, writeFileSync as writeFileSync26 } from "fs";
|
|
34593
34901
|
import { spawnSync } from "child_process";
|
|
34594
34902
|
function normalizeProjectRoot(projectRoot) {
|
|
34595
|
-
return
|
|
34903
|
+
return path51.resolve(projectRoot || process.cwd());
|
|
34596
34904
|
}
|
|
34597
34905
|
function hashText(text) {
|
|
34598
34906
|
return crypto14.createHash("sha256").update(text).digest("hex");
|
|
34599
34907
|
}
|
|
34600
34908
|
function indexDir() {
|
|
34601
|
-
const dir =
|
|
34602
|
-
|
|
34909
|
+
const dir = path51.join(EXE_AI_DIR, "code-context");
|
|
34910
|
+
mkdirSync25(dir, { recursive: true });
|
|
34603
34911
|
return dir;
|
|
34604
34912
|
}
|
|
34605
34913
|
function getCodeContextIndexPath(projectRoot) {
|
|
34606
34914
|
const root = normalizeProjectRoot(projectRoot);
|
|
34607
34915
|
const rootHash = hashText(root).slice(0, 16);
|
|
34608
|
-
return
|
|
34916
|
+
return path51.join(indexDir(), `${rootHash}.json`);
|
|
34609
34917
|
}
|
|
34610
34918
|
function currentBranch(projectRoot) {
|
|
34611
34919
|
const result = spawnSync("git", ["branch", "--show-current"], { cwd: projectRoot, encoding: "utf8", timeout: 2e3 });
|
|
@@ -34618,8 +34926,8 @@ function shouldIgnore(relPath) {
|
|
|
34618
34926
|
}
|
|
34619
34927
|
function listRecursive(projectRoot, dir = projectRoot, out = []) {
|
|
34620
34928
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
34621
|
-
const abs =
|
|
34622
|
-
const rel =
|
|
34929
|
+
const abs = path51.join(dir, entry.name);
|
|
34930
|
+
const rel = path51.relative(projectRoot, abs).replaceAll(path51.sep, "/");
|
|
34623
34931
|
if (shouldIgnore(rel)) continue;
|
|
34624
34932
|
if (entry.isDirectory()) listRecursive(projectRoot, abs, out);
|
|
34625
34933
|
else if (entry.isFile()) out.push(rel);
|
|
@@ -34635,7 +34943,7 @@ function listCodeFiles(projectRoot, maxFiles) {
|
|
|
34635
34943
|
const rg = spawnSync("rg", ["--files"], { cwd: projectRoot, encoding: "utf8", timeout: 5e3, maxBuffer: 1024 * 1024 * 16 });
|
|
34636
34944
|
files = rg.status === 0 && rg.stdout.trim() ? rg.stdout.split("\n").map((s) => s.trim()).filter(Boolean) : listRecursive(projectRoot);
|
|
34637
34945
|
}
|
|
34638
|
-
return files.map((file) => file.replaceAll(
|
|
34946
|
+
return files.map((file) => file.replaceAll(path51.sep, "/")).filter((file) => isChunkable(file) && !shouldIgnore(file)).slice(0, maxFiles).sort();
|
|
34639
34947
|
}
|
|
34640
34948
|
function parseImportPaths(importText) {
|
|
34641
34949
|
const paths = [];
|
|
@@ -34648,13 +34956,13 @@ function parseImportPaths(importText) {
|
|
|
34648
34956
|
}
|
|
34649
34957
|
function resolveImport(fromFile, importPath, allFiles) {
|
|
34650
34958
|
if (!importPath.startsWith(".")) return null;
|
|
34651
|
-
const base =
|
|
34959
|
+
const base = path51.posix.normalize(path51.posix.join(path51.posix.dirname(fromFile.replaceAll(path51.sep, "/")), importPath));
|
|
34652
34960
|
const withoutKnownExt = base.replace(/\.(?:[a-z0-9]+)$/i, "");
|
|
34653
34961
|
const candidates = [base];
|
|
34654
34962
|
for (const ext of ["ts", "tsx", "js", "jsx", "py", "rs", "go", "java", "cs", "cpp", "c", "rb", "php", "swift", "kt", "scala", "sql", "md", "json", "yaml", "yml"]) {
|
|
34655
34963
|
candidates.push(`${withoutKnownExt}.${ext}`, `${base}.${ext}`);
|
|
34656
34964
|
}
|
|
34657
|
-
for (const indexName of ["index.ts", "index.tsx", "index.js", "mod.rs", "__init__.py"]) candidates.push(
|
|
34965
|
+
for (const indexName of ["index.ts", "index.tsx", "index.js", "mod.rs", "__init__.py"]) candidates.push(path51.posix.join(base, indexName));
|
|
34658
34966
|
return candidates.find((candidate) => allFiles.has(candidate)) ?? null;
|
|
34659
34967
|
}
|
|
34660
34968
|
function symbolId(filePath, chunk) {
|
|
@@ -34664,7 +34972,7 @@ function loadIndex(projectRoot) {
|
|
|
34664
34972
|
const file = getCodeContextIndexPath(projectRoot);
|
|
34665
34973
|
if (!existsSync36(file)) return null;
|
|
34666
34974
|
try {
|
|
34667
|
-
const parsed = JSON.parse(
|
|
34975
|
+
const parsed = JSON.parse(readFileSync32(file, "utf8"));
|
|
34668
34976
|
if (parsed.version !== INDEX_VERSION || parsed.projectRoot !== projectRoot) return null;
|
|
34669
34977
|
return parsed;
|
|
34670
34978
|
} catch {
|
|
@@ -34672,10 +34980,10 @@ function loadIndex(projectRoot) {
|
|
|
34672
34980
|
}
|
|
34673
34981
|
}
|
|
34674
34982
|
function saveIndex(index) {
|
|
34675
|
-
|
|
34983
|
+
writeFileSync26(getCodeContextIndexPath(index.projectRoot), JSON.stringify(index, null, 2));
|
|
34676
34984
|
}
|
|
34677
34985
|
function buildFileRecord(projectRoot, relPath, allFiles, previous) {
|
|
34678
|
-
const absPath =
|
|
34986
|
+
const absPath = path51.join(projectRoot, relPath);
|
|
34679
34987
|
let stat2;
|
|
34680
34988
|
try {
|
|
34681
34989
|
stat2 = statSync7(absPath);
|
|
@@ -34685,7 +34993,7 @@ function buildFileRecord(projectRoot, relPath, allFiles, previous) {
|
|
|
34685
34993
|
if (!stat2.isFile()) return { record: null, reused: false };
|
|
34686
34994
|
const language = languageForFile(relPath);
|
|
34687
34995
|
if (!language || !isChunkable(relPath)) return { record: null, reused: false };
|
|
34688
|
-
const source =
|
|
34996
|
+
const source = readFileSync32(absPath, "utf8");
|
|
34689
34997
|
const hash = hashText(source);
|
|
34690
34998
|
if (previous && previous.hash === hash && previous.mtimeMs === stat2.mtimeMs && previous.size === stat2.size && previous.language === language) {
|
|
34691
34999
|
return { record: previous, reused: true };
|
|
@@ -34713,13 +35021,13 @@ function buildCodeContextIndex(options = {}) {
|
|
|
34713
35021
|
const branch = currentBranch(projectRoot);
|
|
34714
35022
|
const previous = options.force ? null : loadIndex(projectRoot);
|
|
34715
35023
|
const files = listCodeFiles(projectRoot, maxFiles);
|
|
34716
|
-
const allFiles = new Set(files.map((file) => file.replaceAll(
|
|
35024
|
+
const allFiles = new Set(files.map((file) => file.replaceAll(path51.sep, "/")));
|
|
34717
35025
|
const fileRecords = {};
|
|
34718
35026
|
let rebuiltFiles = 0;
|
|
34719
35027
|
let reusedFiles = 0;
|
|
34720
35028
|
let skippedFiles = 0;
|
|
34721
35029
|
for (const rel of files) {
|
|
34722
|
-
const normalized = rel.replaceAll(
|
|
35030
|
+
const normalized = rel.replaceAll(path51.sep, "/");
|
|
34723
35031
|
const { record, reused } = buildFileRecord(projectRoot, normalized, allFiles, previous?.files[normalized]);
|
|
34724
35032
|
if (record) {
|
|
34725
35033
|
fileRecords[normalized] = record;
|
|
@@ -34748,11 +35056,11 @@ function loadOrBuildCodeContextIndex(options = {}) {
|
|
|
34748
35056
|
if (loaded) {
|
|
34749
35057
|
const currentFiles = listCodeFiles(projectRoot, options.maxFiles ?? DEFAULT_MAX_FILES);
|
|
34750
35058
|
const unchanged = currentFiles.every((rel) => {
|
|
34751
|
-
const normalized = rel.replaceAll(
|
|
35059
|
+
const normalized = rel.replaceAll(path51.sep, "/");
|
|
34752
35060
|
const existing = loaded.files[normalized];
|
|
34753
35061
|
if (!existing) return false;
|
|
34754
35062
|
try {
|
|
34755
|
-
const stat2 = statSync7(
|
|
35063
|
+
const stat2 = statSync7(path51.join(projectRoot, normalized));
|
|
34756
35064
|
return stat2.mtimeMs === existing.mtimeMs && stat2.size === existing.size;
|
|
34757
35065
|
} catch {
|
|
34758
35066
|
return false;
|
|
@@ -34805,9 +35113,9 @@ function globToRegex(pattern) {
|
|
|
34805
35113
|
}
|
|
34806
35114
|
function matchesPath(filePath, patterns) {
|
|
34807
35115
|
if (!patterns || patterns.length === 0) return true;
|
|
34808
|
-
const normalized = filePath.replaceAll(
|
|
35116
|
+
const normalized = filePath.replaceAll(path51.sep, "/");
|
|
34809
35117
|
return patterns.some((pattern) => {
|
|
34810
|
-
const p = pattern.replaceAll(
|
|
35118
|
+
const p = pattern.replaceAll(path51.sep, "/").replace(/^\.\//, "");
|
|
34811
35119
|
return normalized === p || normalized.startsWith(`${p}/`) || normalized.endsWith(p) || globToRegex(p).test(normalized);
|
|
34812
35120
|
});
|
|
34813
35121
|
}
|
|
@@ -34925,7 +35233,7 @@ function traceCodeSymbol(symbolName, options = {}) {
|
|
|
34925
35233
|
}
|
|
34926
35234
|
function resolveTargetFile(index, input) {
|
|
34927
35235
|
if (input.filePath) {
|
|
34928
|
-
const normalized = input.filePath.replaceAll(
|
|
35236
|
+
const normalized = input.filePath.replaceAll(path51.sep, "/").replace(/^\.\//, "");
|
|
34929
35237
|
if (index.files[normalized]) return { filePath: normalized, target: normalized };
|
|
34930
35238
|
const suffix = Object.keys(index.files).find((file) => file.endsWith(normalized));
|
|
34931
35239
|
if (suffix) return { filePath: suffix, target: input.filePath };
|
|
@@ -34955,7 +35263,7 @@ function analyzeBlastRadius(input) {
|
|
|
34955
35263
|
}
|
|
34956
35264
|
}
|
|
34957
35265
|
}
|
|
34958
|
-
const targetBase =
|
|
35266
|
+
const targetBase = path51.basename(target.filePath).replace(/\.[^.]+$/, "").toLowerCase();
|
|
34959
35267
|
const symbolLower = input.symbol?.toLowerCase();
|
|
34960
35268
|
const tests = Object.keys(index.files).filter((file) => {
|
|
34961
35269
|
const lower = file.toLowerCase();
|
|
@@ -35188,13 +35496,13 @@ __export(installer_exports2, {
|
|
|
35188
35496
|
verifyOpenCodeHooks: () => verifyOpenCodeHooks
|
|
35189
35497
|
});
|
|
35190
35498
|
import { readFile as readFile7, writeFile as writeFile8, mkdir as mkdir8 } from "fs/promises";
|
|
35191
|
-
import { existsSync as existsSync37, readFileSync as
|
|
35192
|
-
import
|
|
35499
|
+
import { existsSync as existsSync37, readFileSync as readFileSync33 } from "fs";
|
|
35500
|
+
import path52 from "path";
|
|
35193
35501
|
import os22 from "os";
|
|
35194
35502
|
async function registerOpenCodeMcp(packageRoot, homeDir = os22.homedir()) {
|
|
35195
35503
|
void packageRoot;
|
|
35196
|
-
const configDir =
|
|
35197
|
-
const configPath =
|
|
35504
|
+
const configDir = path52.join(homeDir, ".config", "opencode");
|
|
35505
|
+
const configPath = path52.join(configDir, "opencode.json");
|
|
35198
35506
|
await mkdir8(configDir, { recursive: true });
|
|
35199
35507
|
let config = {};
|
|
35200
35508
|
if (existsSync37(configPath)) {
|
|
@@ -35225,8 +35533,8 @@ async function registerOpenCodeMcp(packageRoot, homeDir = os22.homedir()) {
|
|
|
35225
35533
|
return true;
|
|
35226
35534
|
}
|
|
35227
35535
|
async function installOpenCodePlugin(packageRoot, homeDir = os22.homedir()) {
|
|
35228
|
-
const pluginDir =
|
|
35229
|
-
const pluginPath =
|
|
35536
|
+
const pluginDir = path52.join(homeDir, ".config", "opencode", "plugins");
|
|
35537
|
+
const pluginPath = path52.join(pluginDir, "exe-os.mjs");
|
|
35230
35538
|
await mkdir8(pluginDir, { recursive: true });
|
|
35231
35539
|
const pluginContent = PLUGIN_TEMPLATE.replace(
|
|
35232
35540
|
/__PACKAGE_ROOT__/g,
|
|
@@ -35242,18 +35550,18 @@ async function installOpenCodePlugin(packageRoot, homeDir = os22.homedir()) {
|
|
|
35242
35550
|
return true;
|
|
35243
35551
|
}
|
|
35244
35552
|
function verifyOpenCodeHooks(homeDir = os22.homedir()) {
|
|
35245
|
-
const configPath =
|
|
35246
|
-
const pluginPath =
|
|
35553
|
+
const configPath = path52.join(homeDir, ".config", "opencode", "opencode.json");
|
|
35554
|
+
const pluginPath = path52.join(homeDir, ".config", "opencode", "plugins", "exe-os.mjs");
|
|
35247
35555
|
if (!existsSync37(configPath)) return false;
|
|
35248
35556
|
try {
|
|
35249
|
-
const config = JSON.parse(
|
|
35557
|
+
const config = JSON.parse(readFileSync33(configPath, "utf-8"));
|
|
35250
35558
|
if (!config.mcp?.["exe-os"]?.enabled) return false;
|
|
35251
35559
|
} catch {
|
|
35252
35560
|
return false;
|
|
35253
35561
|
}
|
|
35254
35562
|
if (!existsSync37(pluginPath)) return false;
|
|
35255
35563
|
try {
|
|
35256
|
-
const plugin =
|
|
35564
|
+
const plugin = readFileSync33(pluginPath, "utf-8");
|
|
35257
35565
|
if (!plugin.includes(EXE_HOOK_FILES.postToolCombined)) return false;
|
|
35258
35566
|
if (textHasLegacySplitPostToolHook(plugin)) return false;
|
|
35259
35567
|
} catch {
|
|
@@ -35295,14 +35603,14 @@ __export(installer_exports3, {
|
|
|
35295
35603
|
verifyCodexHooks: () => verifyCodexHooks
|
|
35296
35604
|
});
|
|
35297
35605
|
import { readFile as readFile8, writeFile as writeFile9, mkdir as mkdir9 } from "fs/promises";
|
|
35298
|
-
import { existsSync as existsSync38, readFileSync as
|
|
35299
|
-
import
|
|
35606
|
+
import { existsSync as existsSync38, readFileSync as readFileSync34 } from "fs";
|
|
35607
|
+
import path53 from "path";
|
|
35300
35608
|
import os23 from "os";
|
|
35301
35609
|
async function mergeCodexHooks(packageRoot, homeDir = os23.homedir()) {
|
|
35302
|
-
const codexDir =
|
|
35303
|
-
const hooksPath =
|
|
35304
|
-
const logsDir =
|
|
35305
|
-
const hookLogPath =
|
|
35610
|
+
const codexDir = path53.join(homeDir, ".codex");
|
|
35611
|
+
const hooksPath = path53.join(codexDir, "hooks.json");
|
|
35612
|
+
const logsDir = path53.join(homeDir, ".exe-os", "logs");
|
|
35613
|
+
const hookLogPath = path53.join(logsDir, "hooks.log");
|
|
35306
35614
|
const logSuffix = ` 2>> "${hookLogPath}"`;
|
|
35307
35615
|
await mkdir9(codexDir, { recursive: true });
|
|
35308
35616
|
await mkdir9(logsDir, { recursive: true });
|
|
@@ -35327,7 +35635,7 @@ async function mergeCodexHooks(packageRoot, homeDir = os23.homedir()) {
|
|
|
35327
35635
|
// Combined hook: runs ingest + error-recall in one Node process.
|
|
35328
35636
|
// Eliminates a cold-start cycle per tool call (~3-6s savings on Codex).
|
|
35329
35637
|
type: "command",
|
|
35330
|
-
command: `node "${
|
|
35638
|
+
command: `node "${path53.join(packageRoot, "dist", "hooks", "post-tool-combined.js")}"${logSuffix}`
|
|
35331
35639
|
}
|
|
35332
35640
|
]
|
|
35333
35641
|
},
|
|
@@ -35341,7 +35649,7 @@ async function mergeCodexHooks(packageRoot, homeDir = os23.homedir()) {
|
|
|
35341
35649
|
// Single hook: prompt-submit handles memory retrieval + entity boost.
|
|
35342
35650
|
// exe-heartbeat-hook is CC-specific (intercom) — omitted on Codex.
|
|
35343
35651
|
type: "command",
|
|
35344
|
-
command: `node "${
|
|
35652
|
+
command: `node "${path53.join(packageRoot, "dist", "hooks", "prompt-submit.js")}"${logSuffix}`
|
|
35345
35653
|
}
|
|
35346
35654
|
]
|
|
35347
35655
|
},
|
|
@@ -35353,7 +35661,7 @@ async function mergeCodexHooks(packageRoot, homeDir = os23.homedir()) {
|
|
|
35353
35661
|
hooks: [
|
|
35354
35662
|
{
|
|
35355
35663
|
type: "command",
|
|
35356
|
-
command: `node "${
|
|
35664
|
+
command: `node "${path53.join(packageRoot, "dist", "hooks", "stop.js")}"${logSuffix}`
|
|
35357
35665
|
}
|
|
35358
35666
|
]
|
|
35359
35667
|
},
|
|
@@ -35366,7 +35674,7 @@ async function mergeCodexHooks(packageRoot, homeDir = os23.homedir()) {
|
|
|
35366
35674
|
hooks: [
|
|
35367
35675
|
{
|
|
35368
35676
|
type: "command",
|
|
35369
|
-
command: `node "${
|
|
35677
|
+
command: `node "${path53.join(packageRoot, "dist", "hooks", "pre-tool-use.js")}"${logSuffix}`
|
|
35370
35678
|
}
|
|
35371
35679
|
]
|
|
35372
35680
|
},
|
|
@@ -35415,10 +35723,10 @@ async function mergeCodexHooks(packageRoot, homeDir = os23.homedir()) {
|
|
|
35415
35723
|
return { added, skipped };
|
|
35416
35724
|
}
|
|
35417
35725
|
function verifyCodexHooks(homeDir = os23.homedir()) {
|
|
35418
|
-
const hooksPath =
|
|
35726
|
+
const hooksPath = path53.join(homeDir, ".codex", "hooks.json");
|
|
35419
35727
|
if (!existsSync38(hooksPath)) return false;
|
|
35420
35728
|
try {
|
|
35421
|
-
const hooksJson = JSON.parse(
|
|
35729
|
+
const hooksJson = JSON.parse(readFileSync34(hooksPath, "utf-8"));
|
|
35422
35730
|
if (!hooksJson.hooks) return false;
|
|
35423
35731
|
const required = ["PostToolUse", "UserPromptSubmit", "Stop", "PreToolUse"];
|
|
35424
35732
|
for (const event of required) {
|
|
@@ -35450,8 +35758,8 @@ function verifyCodexHooks(homeDir = os23.homedir()) {
|
|
|
35450
35758
|
async function installCodexStatusLine(homeDir = os23.homedir()) {
|
|
35451
35759
|
const prefs = loadPreferences(homeDir);
|
|
35452
35760
|
if (prefs.codexStatusLine === false) return "opted-out";
|
|
35453
|
-
const codexDir =
|
|
35454
|
-
const configPath =
|
|
35761
|
+
const codexDir = path53.join(homeDir, ".codex");
|
|
35762
|
+
const configPath = path53.join(codexDir, "config.toml");
|
|
35455
35763
|
await mkdir9(codexDir, { recursive: true });
|
|
35456
35764
|
let content = "";
|
|
35457
35765
|
if (existsSync38(configPath)) {
|
|
@@ -35506,8 +35814,8 @@ ${line}
|
|
|
35506
35814
|
return { content: next, changed: next !== sectionContent };
|
|
35507
35815
|
}
|
|
35508
35816
|
async function registerCodexMcpServer(packageRoot, homeDir = os23.homedir()) {
|
|
35509
|
-
const codexDir =
|
|
35510
|
-
const configPath =
|
|
35817
|
+
const codexDir = path53.join(homeDir, ".codex");
|
|
35818
|
+
const configPath = path53.join(codexDir, "config.toml");
|
|
35511
35819
|
void packageRoot;
|
|
35512
35820
|
await mkdir9(codexDir, { recursive: true });
|
|
35513
35821
|
let content = "";
|
|
@@ -35536,8 +35844,8 @@ async function registerCodexMcpServer(packageRoot, homeDir = os23.homedir()) {
|
|
|
35536
35844
|
return "registered";
|
|
35537
35845
|
}
|
|
35538
35846
|
async function ensureCodexHooksFeature(homeDir = os23.homedir()) {
|
|
35539
|
-
const configPath =
|
|
35540
|
-
await mkdir9(
|
|
35847
|
+
const configPath = path53.join(homeDir, ".codex", "config.toml");
|
|
35848
|
+
await mkdir9(path53.join(homeDir, ".codex"), { recursive: true });
|
|
35541
35849
|
let content = "";
|
|
35542
35850
|
if (existsSync38(configPath)) {
|
|
35543
35851
|
content = await readFile8(configPath, "utf-8");
|
|
@@ -35614,32 +35922,32 @@ __export(mcp_diagnostics_exports, {
|
|
|
35614
35922
|
diagnoseClaudeMcpConfig: () => diagnoseClaudeMcpConfig,
|
|
35615
35923
|
formatMcpDiagnosticReport: () => formatMcpDiagnosticReport
|
|
35616
35924
|
});
|
|
35617
|
-
import { existsSync as existsSync39, readFileSync as
|
|
35618
|
-
import
|
|
35925
|
+
import { existsSync as existsSync39, readFileSync as readFileSync35 } from "fs";
|
|
35926
|
+
import path54 from "path";
|
|
35619
35927
|
import os24 from "os";
|
|
35620
35928
|
function readJson(filePath) {
|
|
35621
35929
|
if (!existsSync39(filePath)) return null;
|
|
35622
35930
|
try {
|
|
35623
|
-
return JSON.parse(
|
|
35931
|
+
return JSON.parse(readFileSync35(filePath, "utf8"));
|
|
35624
35932
|
} catch {
|
|
35625
35933
|
return null;
|
|
35626
35934
|
}
|
|
35627
35935
|
}
|
|
35628
35936
|
function pathApplies2(projectPath, cwd2) {
|
|
35629
|
-
const project =
|
|
35630
|
-
const current =
|
|
35631
|
-
return current === project || current.startsWith(project +
|
|
35937
|
+
const project = path54.resolve(projectPath);
|
|
35938
|
+
const current = path54.resolve(cwd2);
|
|
35939
|
+
return current === project || current.startsWith(project + path54.sep);
|
|
35632
35940
|
}
|
|
35633
35941
|
function findAncestorMcpJsons2(cwd2, homeDir) {
|
|
35634
35942
|
const files = [];
|
|
35635
|
-
let dir =
|
|
35636
|
-
const root =
|
|
35637
|
-
const stop =
|
|
35943
|
+
let dir = path54.resolve(cwd2);
|
|
35944
|
+
const root = path54.parse(dir).root;
|
|
35945
|
+
const stop = path54.resolve(homeDir);
|
|
35638
35946
|
while (dir !== root) {
|
|
35639
|
-
const candidate =
|
|
35947
|
+
const candidate = path54.join(dir, ".mcp.json");
|
|
35640
35948
|
if (existsSync39(candidate)) files.push(candidate);
|
|
35641
35949
|
if (dir === stop) break;
|
|
35642
|
-
dir =
|
|
35950
|
+
dir = path54.dirname(dir);
|
|
35643
35951
|
}
|
|
35644
35952
|
return files;
|
|
35645
35953
|
}
|
|
@@ -35656,8 +35964,8 @@ function serverAllowedByPermissions(serverName, prefixes) {
|
|
|
35656
35964
|
return prefixes.has(serverName) || prefixes.has(serverName.replace(/-/g, "_"));
|
|
35657
35965
|
}
|
|
35658
35966
|
function diagnoseClaudeMcpConfig(homeDir = os24.homedir(), cwd2 = process.cwd(), env = process.env) {
|
|
35659
|
-
const claudeJsonPath =
|
|
35660
|
-
const settingsPath =
|
|
35967
|
+
const claudeJsonPath = path54.join(homeDir, ".claude.json");
|
|
35968
|
+
const settingsPath = path54.join(homeDir, ".claude", "settings.json");
|
|
35661
35969
|
const claudeJson = readJson(claudeJsonPath);
|
|
35662
35970
|
const settings = readJson(settingsPath);
|
|
35663
35971
|
const issues = [];
|
|
@@ -35777,7 +36085,7 @@ function diagnoseClaudeMcpConfig(homeDir = os24.homedir(), cwd2 = process.cwd(),
|
|
|
35777
36085
|
});
|
|
35778
36086
|
}
|
|
35779
36087
|
return {
|
|
35780
|
-
cwd:
|
|
36088
|
+
cwd: path54.resolve(cwd2),
|
|
35781
36089
|
globalServers,
|
|
35782
36090
|
projectServers: projectServers.sort((a, b) => a.name.localeCompare(b.name)),
|
|
35783
36091
|
mcpJsonServers: mcpJsonServers.sort((a, b) => a.name.localeCompare(b.name)),
|
|
@@ -35814,14 +36122,14 @@ var init_mcp_diagnostics = __esm({
|
|
|
35814
36122
|
});
|
|
35815
36123
|
|
|
35816
36124
|
// src/bin/cli.ts
|
|
35817
|
-
import { existsSync as existsSync40, readFileSync as
|
|
35818
|
-
import
|
|
36125
|
+
import { existsSync as existsSync40, readFileSync as readFileSync36, writeFileSync as writeFileSync27, readdirSync as readdirSync12, rmSync as rmSync2 } from "fs";
|
|
36126
|
+
import path55 from "path";
|
|
35819
36127
|
import os25 from "os";
|
|
35820
36128
|
var args = process.argv.slice(2);
|
|
35821
36129
|
if (args.includes("--version") || args.includes("-v")) {
|
|
35822
36130
|
try {
|
|
35823
|
-
const pkgPath =
|
|
35824
|
-
const pkg = JSON.parse(
|
|
36131
|
+
const pkgPath = path55.join(path55.dirname(new URL(import.meta.url).pathname), "..", "..", "package.json");
|
|
36132
|
+
const pkg = JSON.parse(readFileSync36(pkgPath, "utf8"));
|
|
35825
36133
|
console.log(pkg.version);
|
|
35826
36134
|
} catch {
|
|
35827
36135
|
console.log("unknown");
|
|
@@ -35943,6 +36251,9 @@ if (args.includes("--global")) {
|
|
|
35943
36251
|
const { main: runCloud } = await Promise.resolve().then(() => (init_exe_cloud(), exe_cloud_exports));
|
|
35944
36252
|
await runCloud();
|
|
35945
36253
|
}
|
|
36254
|
+
} else if (args[0] === "support") {
|
|
36255
|
+
const { main: runSupport } = await Promise.resolve().then(() => (init_exe_support(), exe_support_exports));
|
|
36256
|
+
await runSupport(args.slice(1));
|
|
35946
36257
|
} else if (args[0] === "bulk-sync-postgres") {
|
|
35947
36258
|
const { main: runBulkSyncPostgres } = await Promise.resolve().then(() => (init_bulk_sync_postgres(), bulk_sync_postgres_exports));
|
|
35948
36259
|
await runBulkSyncPostgres();
|
|
@@ -36046,11 +36357,11 @@ ID: ${result.id}`);
|
|
|
36046
36357
|
});
|
|
36047
36358
|
await init_App2().then(() => App_exports);
|
|
36048
36359
|
} else {
|
|
36049
|
-
const claudeDir =
|
|
36050
|
-
const settingsPath =
|
|
36360
|
+
const claudeDir = path55.join(os25.homedir(), ".claude");
|
|
36361
|
+
const settingsPath = path55.join(claudeDir, "settings.json");
|
|
36051
36362
|
const hasClaudeCode = existsSync40(settingsPath) && (() => {
|
|
36052
36363
|
try {
|
|
36053
|
-
const raw =
|
|
36364
|
+
const raw = readFileSync36(settingsPath, "utf8");
|
|
36054
36365
|
return raw.includes("exe-os") || raw.includes("exe-mem");
|
|
36055
36366
|
} catch {
|
|
36056
36367
|
return false;
|
|
@@ -36060,9 +36371,9 @@ ID: ${result.id}`);
|
|
|
36060
36371
|
const { DEFAULT_COORDINATOR_TEMPLATE_NAME: DEFAULT_COORDINATOR_TEMPLATE_NAME2 } = await Promise.resolve().then(() => (init_employees(), employees_exports));
|
|
36061
36372
|
let cooName = DEFAULT_COORDINATOR_TEMPLATE_NAME2;
|
|
36062
36373
|
try {
|
|
36063
|
-
const rosterPath =
|
|
36374
|
+
const rosterPath = path55.join(os25.homedir(), ".exe-os", "exe-employees.json");
|
|
36064
36375
|
if (existsSync40(rosterPath)) {
|
|
36065
|
-
const roster = JSON.parse(
|
|
36376
|
+
const roster = JSON.parse(readFileSync36(rosterPath, "utf8"));
|
|
36066
36377
|
const coo = roster.find((e) => e.role === "COO");
|
|
36067
36378
|
if (coo) cooName = coo.name;
|
|
36068
36379
|
}
|
|
@@ -36215,14 +36526,14 @@ async function runCodexInstall() {
|
|
|
36215
36526
|
}
|
|
36216
36527
|
async function runClaudeCheck() {
|
|
36217
36528
|
const { detectMcpNameCollisions: detectMcpNameCollisions2 } = await Promise.resolve().then(() => (init_installer(), installer_exports));
|
|
36218
|
-
const claudeDir =
|
|
36219
|
-
const settingsPath =
|
|
36220
|
-
const claudeJsonPath =
|
|
36529
|
+
const claudeDir = path55.join(os25.homedir(), ".claude");
|
|
36530
|
+
const settingsPath = path55.join(claudeDir, "settings.json");
|
|
36531
|
+
const claudeJsonPath = path55.join(os25.homedir(), ".claude.json");
|
|
36221
36532
|
let ok = true;
|
|
36222
36533
|
if (existsSync40(settingsPath)) {
|
|
36223
36534
|
let settings;
|
|
36224
36535
|
try {
|
|
36225
|
-
settings = JSON.parse(
|
|
36536
|
+
settings = JSON.parse(readFileSync36(settingsPath, "utf8"));
|
|
36226
36537
|
} catch {
|
|
36227
36538
|
console.log("\x1B[31m\u2717\x1B[0m settings.json is malformed (invalid JSON)");
|
|
36228
36539
|
ok = false;
|
|
@@ -36251,7 +36562,7 @@ async function runClaudeCheck() {
|
|
|
36251
36562
|
if (existsSync40(claudeJsonPath)) {
|
|
36252
36563
|
let claudeJson;
|
|
36253
36564
|
try {
|
|
36254
|
-
claudeJson = JSON.parse(
|
|
36565
|
+
claudeJson = JSON.parse(readFileSync36(claudeJsonPath, "utf8"));
|
|
36255
36566
|
} catch {
|
|
36256
36567
|
console.log("\x1B[31m\u2717\x1B[0m claude.json is malformed (invalid JSON)");
|
|
36257
36568
|
ok = false;
|
|
@@ -36284,7 +36595,7 @@ async function runClaudeCheck() {
|
|
|
36284
36595
|
} else {
|
|
36285
36596
|
console.log("\x1B[32m\u2713\x1B[0m No .mcp.json/project MCP name collisions detected");
|
|
36286
36597
|
}
|
|
36287
|
-
const skillsDir =
|
|
36598
|
+
const skillsDir = path55.join(claudeDir, "skills");
|
|
36288
36599
|
if (existsSync40(skillsDir)) {
|
|
36289
36600
|
console.log("\x1B[32m\u2713\x1B[0m Slash skills directory exists");
|
|
36290
36601
|
} else {
|
|
@@ -36309,16 +36620,16 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36309
36620
|
const dryRun = flags.includes("--dry-run");
|
|
36310
36621
|
const purge = flags.includes("--purge");
|
|
36311
36622
|
const homeDir = os25.homedir();
|
|
36312
|
-
const claudeDir =
|
|
36313
|
-
const settingsPath =
|
|
36314
|
-
const claudeJsonPath =
|
|
36315
|
-
const exeOsDir =
|
|
36623
|
+
const claudeDir = path55.join(homeDir, ".claude");
|
|
36624
|
+
const settingsPath = path55.join(claudeDir, "settings.json");
|
|
36625
|
+
const claudeJsonPath = path55.join(homeDir, ".claude.json");
|
|
36626
|
+
const exeOsDir = path55.join(homeDir, ".exe-os");
|
|
36316
36627
|
let removed = 0;
|
|
36317
36628
|
const log = (msg) => console.log(dryRun ? `[dry-run] ${msg}` : msg);
|
|
36318
36629
|
let settings = {};
|
|
36319
36630
|
if (existsSync40(settingsPath)) {
|
|
36320
36631
|
try {
|
|
36321
|
-
settings = JSON.parse(
|
|
36632
|
+
settings = JSON.parse(readFileSync36(settingsPath, "utf8"));
|
|
36322
36633
|
} catch {
|
|
36323
36634
|
console.error("Your ~/.claude/settings.json appears malformed.");
|
|
36324
36635
|
if (purge) {
|
|
@@ -36356,7 +36667,7 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36356
36667
|
permCount = before - settings.permissions.allow.length;
|
|
36357
36668
|
}
|
|
36358
36669
|
if (!dryRun) {
|
|
36359
|
-
|
|
36670
|
+
writeFileSync27(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
36360
36671
|
}
|
|
36361
36672
|
log("\u2713 Removed exe-os hooks from settings.json");
|
|
36362
36673
|
if (permCount > 0) log(`\u2713 Removed ${permCount} MCP permission entries`);
|
|
@@ -36364,7 +36675,7 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36364
36675
|
}
|
|
36365
36676
|
}
|
|
36366
36677
|
if (existsSync40(claudeJsonPath)) {
|
|
36367
|
-
const raw =
|
|
36678
|
+
const raw = readFileSync36(claudeJsonPath, "utf8");
|
|
36368
36679
|
if (raw.length > 1e6) {
|
|
36369
36680
|
console.error("claude.json exceeds 1 MB \u2014 skipping parse.");
|
|
36370
36681
|
} else {
|
|
@@ -36385,7 +36696,7 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36385
36696
|
}
|
|
36386
36697
|
if (removedMcp) {
|
|
36387
36698
|
if (!dryRun) {
|
|
36388
|
-
|
|
36699
|
+
writeFileSync27(claudeJsonPath, JSON.stringify(claudeJson, null, 2) + "\n");
|
|
36389
36700
|
}
|
|
36390
36701
|
log("\u2713 Removed exe-os MCP server from claude.json");
|
|
36391
36702
|
removed++;
|
|
@@ -36393,14 +36704,14 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36393
36704
|
}
|
|
36394
36705
|
}
|
|
36395
36706
|
}
|
|
36396
|
-
const skillsDir =
|
|
36707
|
+
const skillsDir = path55.join(claudeDir, "skills");
|
|
36397
36708
|
if (existsSync40(skillsDir)) {
|
|
36398
36709
|
let skillCount = 0;
|
|
36399
36710
|
try {
|
|
36400
36711
|
const entries = readdirSync12(skillsDir);
|
|
36401
36712
|
for (const entry of entries) {
|
|
36402
36713
|
if (entry.startsWith("exe")) {
|
|
36403
|
-
const fullPath =
|
|
36714
|
+
const fullPath = path55.join(skillsDir, entry);
|
|
36404
36715
|
if (!dryRun) rmSync2(fullPath, { recursive: true, force: true });
|
|
36405
36716
|
skillCount++;
|
|
36406
36717
|
}
|
|
@@ -36412,30 +36723,30 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36412
36723
|
removed++;
|
|
36413
36724
|
}
|
|
36414
36725
|
}
|
|
36415
|
-
const claudeMdPath =
|
|
36726
|
+
const claudeMdPath = path55.join(claudeDir, "CLAUDE.md");
|
|
36416
36727
|
if (existsSync40(claudeMdPath)) {
|
|
36417
|
-
const content =
|
|
36728
|
+
const content = readFileSync36(claudeMdPath, "utf8");
|
|
36418
36729
|
const startMarker = "<!-- exe-os:orchestration-start -->";
|
|
36419
36730
|
const endMarker = "<!-- exe-os:orchestration-end -->";
|
|
36420
36731
|
const startIdx = content.indexOf(startMarker);
|
|
36421
36732
|
const endIdx = content.indexOf(endMarker);
|
|
36422
36733
|
if (startIdx !== -1 && endIdx !== -1) {
|
|
36423
36734
|
const cleaned = (content.slice(0, startIdx) + content.slice(endIdx + endMarker.length)).replace(/\n{3,}/g, "\n\n").trim() + "\n";
|
|
36424
|
-
if (!dryRun)
|
|
36735
|
+
if (!dryRun) writeFileSync27(claudeMdPath, cleaned);
|
|
36425
36736
|
log("\u2713 Removed orchestration block from CLAUDE.md");
|
|
36426
36737
|
removed++;
|
|
36427
36738
|
}
|
|
36428
36739
|
}
|
|
36429
|
-
const agentsDir =
|
|
36740
|
+
const agentsDir = path55.join(claudeDir, "agents");
|
|
36430
36741
|
if (existsSync40(agentsDir)) {
|
|
36431
36742
|
let agentCount = 0;
|
|
36432
36743
|
try {
|
|
36433
36744
|
const entries = readdirSync12(agentsDir).filter((f) => f.endsWith(".md"));
|
|
36434
36745
|
let knownNames = /* @__PURE__ */ new Set();
|
|
36435
|
-
const rosterPath =
|
|
36746
|
+
const rosterPath = path55.join(exeOsDir, "exe-employees.json");
|
|
36436
36747
|
if (existsSync40(rosterPath)) {
|
|
36437
36748
|
try {
|
|
36438
|
-
const roster = JSON.parse(
|
|
36749
|
+
const roster = JSON.parse(readFileSync36(rosterPath, "utf8"));
|
|
36439
36750
|
knownNames = new Set(roster.map((e) => e.name));
|
|
36440
36751
|
} catch {
|
|
36441
36752
|
}
|
|
@@ -36443,7 +36754,7 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36443
36754
|
for (const entry of entries) {
|
|
36444
36755
|
const name = entry.replace(/\.md$/, "");
|
|
36445
36756
|
if (knownNames.has(name)) {
|
|
36446
|
-
if (!dryRun) rmSync2(
|
|
36757
|
+
if (!dryRun) rmSync2(path55.join(agentsDir, entry), { force: true });
|
|
36447
36758
|
agentCount++;
|
|
36448
36759
|
}
|
|
36449
36760
|
}
|
|
@@ -36454,16 +36765,16 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36454
36765
|
removed++;
|
|
36455
36766
|
}
|
|
36456
36767
|
}
|
|
36457
|
-
const projectsDir =
|
|
36768
|
+
const projectsDir = path55.join(claudeDir, "projects");
|
|
36458
36769
|
if (existsSync40(projectsDir)) {
|
|
36459
36770
|
let projectCount = 0;
|
|
36460
36771
|
try {
|
|
36461
36772
|
const projects = readdirSync12(projectsDir);
|
|
36462
36773
|
for (const proj of projects) {
|
|
36463
|
-
const projSettings =
|
|
36774
|
+
const projSettings = path55.join(projectsDir, proj, "settings.json");
|
|
36464
36775
|
if (!existsSync40(projSettings)) continue;
|
|
36465
36776
|
try {
|
|
36466
|
-
const pSettings = JSON.parse(
|
|
36777
|
+
const pSettings = JSON.parse(readFileSync36(projSettings, "utf8"));
|
|
36467
36778
|
let changed = false;
|
|
36468
36779
|
if (Array.isArray(pSettings.permissions?.allow)) {
|
|
36469
36780
|
const before = pSettings.permissions.allow.length;
|
|
@@ -36473,7 +36784,7 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36473
36784
|
if (pSettings.permissions.allow.length < before) changed = true;
|
|
36474
36785
|
}
|
|
36475
36786
|
if (changed && !dryRun) {
|
|
36476
|
-
|
|
36787
|
+
writeFileSync27(projSettings, JSON.stringify(pSettings, null, 2) + "\n");
|
|
36477
36788
|
}
|
|
36478
36789
|
if (changed) projectCount++;
|
|
36479
36790
|
} catch {
|
|
@@ -36497,17 +36808,17 @@ async function runClaudeUninstall(flags = []) {
|
|
|
36497
36808
|
};
|
|
36498
36809
|
const exeBinPath = findExeBin3();
|
|
36499
36810
|
if (!exeBinPath) throw new Error("exe-os not found in PATH");
|
|
36500
|
-
const binDir =
|
|
36811
|
+
const binDir = path55.dirname(exeBinPath);
|
|
36501
36812
|
let symlinkCount = 0;
|
|
36502
|
-
const rosterPath =
|
|
36813
|
+
const rosterPath = path55.join(exeOsDir, "exe-employees.json");
|
|
36503
36814
|
if (existsSync40(rosterPath)) {
|
|
36504
|
-
const roster = JSON.parse(
|
|
36815
|
+
const roster = JSON.parse(readFileSync36(rosterPath, "utf8"));
|
|
36505
36816
|
const { DEFAULT_COORDINATOR_TEMPLATE_NAME: DEFAULT_COORDINATOR_TEMPLATE_NAME2 } = await Promise.resolve().then(() => (init_employees(), employees_exports));
|
|
36506
36817
|
const coordinatorName = roster.find((e) => e.role?.toLowerCase() === "coo")?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME2;
|
|
36507
36818
|
for (const emp of roster) {
|
|
36508
36819
|
if (emp.name === coordinatorName) continue;
|
|
36509
36820
|
for (const suffix of ["", "-opencode"]) {
|
|
36510
|
-
const linkPath =
|
|
36821
|
+
const linkPath = path55.join(binDir, `${emp.name}${suffix}`);
|
|
36511
36822
|
if (existsSync40(linkPath)) {
|
|
36512
36823
|
if (!dryRun) rmSync2(linkPath, { force: true });
|
|
36513
36824
|
symlinkCount++;
|
|
@@ -36546,7 +36857,7 @@ async function checkForUpdateOnBoot() {
|
|
|
36546
36857
|
const config = await loadConfig2();
|
|
36547
36858
|
if (!config.autoUpdate.checkOnBoot) return;
|
|
36548
36859
|
const { checkForUpdate: checkForUpdate2 } = await Promise.resolve().then(() => (init_update(), update_exports));
|
|
36549
|
-
const packageRoot =
|
|
36860
|
+
const packageRoot = path55.resolve(
|
|
36550
36861
|
new URL("../..", import.meta.url).pathname
|
|
36551
36862
|
);
|
|
36552
36863
|
const result = checkForUpdate2(packageRoot);
|
|
@@ -36607,7 +36918,7 @@ async function runActivate(key) {
|
|
|
36607
36918
|
const idTemplate = getIdentityTemplate(identityKey);
|
|
36608
36919
|
if (idTemplate) {
|
|
36609
36920
|
const idPath = identityPath2(name);
|
|
36610
|
-
const dir =
|
|
36921
|
+
const dir = path55.dirname(idPath);
|
|
36611
36922
|
if (!fs8.existsSync(dir)) fs8.mkdirSync(dir, { recursive: true });
|
|
36612
36923
|
fs8.writeFileSync(idPath, idTemplate.replace(/^agent_id: \w+/m, `agent_id: ${name}`), "utf-8");
|
|
36613
36924
|
}
|