@adhdev/daemon-standalone 1.0.37-rc.7 → 1.0.38-rc.1
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/index.js +694 -324
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public/assets/index-DRTvhQtV.js +121 -0
- package/public/index.html +1 -1
- package/vendor/mcp-server/index.js +3 -3
- package/vendor/mcp-server/index.js.map +1 -1
- package/vendor/mcp-server/package.json +1 -1
- package/public/assets/index-DcawbjrQ.js +0 -121
package/dist/index.js
CHANGED
|
@@ -32608,6 +32608,38 @@ var require_dist3 = __commonJS({
|
|
|
32608
32608
|
function resolveAutoConvergeCodeChange(policy) {
|
|
32609
32609
|
return policy?.autoConvergeCodeChange === true;
|
|
32610
32610
|
}
|
|
32611
|
+
function resolveQuotaRoutingPolicy(value) {
|
|
32612
|
+
const staleAfterMs = Number(value?.staleAfterMs);
|
|
32613
|
+
const sessionMin = Number(value?.sessionMinRemainingPercent);
|
|
32614
|
+
const weeklyMin = Number(value?.weeklyMinRemainingPercent);
|
|
32615
|
+
const spreadMax = Number(value?.spreadBonusMax);
|
|
32616
|
+
const clampPercentField = (n, fallback) => Number.isFinite(n) ? Math.min(100, Math.max(0, n)) : fallback;
|
|
32617
|
+
return {
|
|
32618
|
+
staleAfterMs: Number.isFinite(staleAfterMs) && staleAfterMs >= 0 ? Math.floor(staleAfterMs) : DEFAULT_QUOTA_ROUTING_POLICY.staleAfterMs,
|
|
32619
|
+
sessionMinRemainingPercent: clampPercentField(sessionMin, DEFAULT_QUOTA_ROUTING_POLICY.sessionMinRemainingPercent),
|
|
32620
|
+
weeklyMinRemainingPercent: clampPercentField(weeklyMin, DEFAULT_QUOTA_ROUTING_POLICY.weeklyMinRemainingPercent),
|
|
32621
|
+
spreadBonusMax: Number.isFinite(spreadMax) && spreadMax >= 0 ? spreadMax : DEFAULT_QUOTA_ROUTING_POLICY.spreadBonusMax
|
|
32622
|
+
};
|
|
32623
|
+
}
|
|
32624
|
+
function normalizeQuotaRoutingPolicy(value) {
|
|
32625
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
32626
|
+
const record2 = value;
|
|
32627
|
+
const resolved = resolveQuotaRoutingPolicy(record2);
|
|
32628
|
+
const out = {};
|
|
32629
|
+
if (record2.staleAfterMs !== void 0 && resolved.staleAfterMs !== DEFAULT_QUOTA_ROUTING_POLICY.staleAfterMs) {
|
|
32630
|
+
out.staleAfterMs = resolved.staleAfterMs;
|
|
32631
|
+
}
|
|
32632
|
+
if (record2.sessionMinRemainingPercent !== void 0 && resolved.sessionMinRemainingPercent !== DEFAULT_QUOTA_ROUTING_POLICY.sessionMinRemainingPercent) {
|
|
32633
|
+
out.sessionMinRemainingPercent = resolved.sessionMinRemainingPercent;
|
|
32634
|
+
}
|
|
32635
|
+
if (record2.weeklyMinRemainingPercent !== void 0 && resolved.weeklyMinRemainingPercent !== DEFAULT_QUOTA_ROUTING_POLICY.weeklyMinRemainingPercent) {
|
|
32636
|
+
out.weeklyMinRemainingPercent = resolved.weeklyMinRemainingPercent;
|
|
32637
|
+
}
|
|
32638
|
+
if (record2.spreadBonusMax !== void 0 && resolved.spreadBonusMax !== DEFAULT_QUOTA_ROUTING_POLICY.spreadBonusMax) {
|
|
32639
|
+
out.spreadBonusMax = resolved.spreadBonusMax;
|
|
32640
|
+
}
|
|
32641
|
+
return Object.keys(out).length ? out : void 0;
|
|
32642
|
+
}
|
|
32611
32643
|
function resolveCoordinatorIdlePushPolicy(meshPolicy) {
|
|
32612
32644
|
return meshPolicy?.coordinatorIdlePushPolicy === "auto_silent_on_dispatch" ? "auto_silent_on_dispatch" : "always";
|
|
32613
32645
|
}
|
|
@@ -32691,6 +32723,12 @@ var require_dist3 = __commonJS({
|
|
|
32691
32723
|
} else {
|
|
32692
32724
|
delete policy.coordinatorIdlePushPolicy;
|
|
32693
32725
|
}
|
|
32726
|
+
const quotaRouting = normalizeQuotaRoutingPolicy(policy.quotaRouting);
|
|
32727
|
+
if (quotaRouting) {
|
|
32728
|
+
policy.quotaRouting = quotaRouting;
|
|
32729
|
+
} else {
|
|
32730
|
+
delete policy.quotaRouting;
|
|
32731
|
+
}
|
|
32694
32732
|
return policy;
|
|
32695
32733
|
}
|
|
32696
32734
|
function resolveDelegatedWorkerAutoApprove(meshPolicy, nodePolicy, provider, repoConfig, providerType) {
|
|
@@ -32755,6 +32793,7 @@ var require_dist3 = __commonJS({
|
|
|
32755
32793
|
var MESH_CONVERGE_REFINE_TAG;
|
|
32756
32794
|
var MESH_CONVERGE_FAST_FORWARD_TAG;
|
|
32757
32795
|
var DEFAULT_MESH_POLICY;
|
|
32796
|
+
var DEFAULT_QUOTA_ROUTING_POLICY;
|
|
32758
32797
|
var SILENT_IDLE_PUSH_TTL_MS;
|
|
32759
32798
|
var SESSION_CLEANUP_MODES;
|
|
32760
32799
|
var SPAWNED_SESSION_VISIBILITY_MODES;
|
|
@@ -32811,6 +32850,12 @@ var require_dist3 = __commonJS({
|
|
|
32811
32850
|
// are never affected — see coordinatorIdlePushPolicy).
|
|
32812
32851
|
coordinatorIdlePushPolicy: "always"
|
|
32813
32852
|
};
|
|
32853
|
+
DEFAULT_QUOTA_ROUTING_POLICY = {
|
|
32854
|
+
staleAfterMs: 30 * 60 * 1e3,
|
|
32855
|
+
sessionMinRemainingPercent: 10,
|
|
32856
|
+
weeklyMinRemainingPercent: 15,
|
|
32857
|
+
spreadBonusMax: 30
|
|
32858
|
+
};
|
|
32814
32859
|
SILENT_IDLE_PUSH_TTL_MS = 10 * 60 * 1e3;
|
|
32815
32860
|
SESSION_CLEANUP_MODES = /* @__PURE__ */ new Set([
|
|
32816
32861
|
"preserve",
|
|
@@ -33318,10 +33363,10 @@ var require_dist3 = __commonJS({
|
|
|
33318
33363
|
}
|
|
33319
33364
|
function getDaemonBuildInfo() {
|
|
33320
33365
|
if (cached2) return cached2;
|
|
33321
|
-
const commit = readInjected(true ? "
|
|
33322
|
-
const commitShort = readInjected(true ? "
|
|
33323
|
-
const version2 = readInjected(true ? "1.0.
|
|
33324
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
33366
|
+
const commit = readInjected(true ? "34f39f386f8c9aa0b5f8dfb597ba55e16cffee54" : void 0) ?? "unknown";
|
|
33367
|
+
const commitShort = readInjected(true ? "34f39f38" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
33368
|
+
const version2 = readInjected(true ? "1.0.38-rc.1" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
33369
|
+
const builtAt = readInjected(true ? "2026-08-06T05:39:02.333Z" : void 0);
|
|
33325
33370
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
33326
33371
|
return cached2;
|
|
33327
33372
|
}
|
|
@@ -34578,6 +34623,66 @@ var require_dist3 = __commonJS({
|
|
|
34578
34623
|
DAEMON_WS_PATH2 = "/ipc";
|
|
34579
34624
|
}
|
|
34580
34625
|
});
|
|
34626
|
+
function resolveBuildTrack(env2 = process.env) {
|
|
34627
|
+
const injected = true ? "" : void 0;
|
|
34628
|
+
const stamped = typeof injected === "string" ? injected.trim() : "";
|
|
34629
|
+
const raw = (stamped || (env2[BUILD_CHANNEL_ENV_VAR] ?? "").trim()).toLowerCase();
|
|
34630
|
+
return raw === "preview" || raw === "next" ? "preview" : "stable";
|
|
34631
|
+
}
|
|
34632
|
+
function getTrackIdentity(track = TRACK) {
|
|
34633
|
+
return track === "preview" ? PREVIEW_IDENTITY : STABLE_IDENTITY;
|
|
34634
|
+
}
|
|
34635
|
+
var BUILD_CHANNEL_ENV_VAR;
|
|
34636
|
+
var TRACK;
|
|
34637
|
+
var STABLE_IDENTITY;
|
|
34638
|
+
var PREVIEW_IDENTITY;
|
|
34639
|
+
var IDENTITY;
|
|
34640
|
+
var init_track_identity = __esm2({
|
|
34641
|
+
"src/track-identity.ts"() {
|
|
34642
|
+
"use strict";
|
|
34643
|
+
BUILD_CHANNEL_ENV_VAR = "ADHDEV_BUILD_CHANNEL";
|
|
34644
|
+
TRACK = resolveBuildTrack();
|
|
34645
|
+
STABLE_IDENTITY = {
|
|
34646
|
+
binaryName: "adhdev",
|
|
34647
|
+
configDirName: ".adhdev",
|
|
34648
|
+
defaultPort: 19222,
|
|
34649
|
+
serverUrl: "https://api.adhf.dev",
|
|
34650
|
+
launchdLabel: "dev.adhf.daemon",
|
|
34651
|
+
vbsFileName: "adhdev-daemon.vbs",
|
|
34652
|
+
sessionHostName: "adhdev",
|
|
34653
|
+
npmTag: "latest"
|
|
34654
|
+
};
|
|
34655
|
+
PREVIEW_IDENTITY = {
|
|
34656
|
+
binaryName: "adhdev-preview",
|
|
34657
|
+
configDirName: ".adhdev-preview",
|
|
34658
|
+
defaultPort: 19223,
|
|
34659
|
+
serverUrl: "https://api-preview.adhf.dev",
|
|
34660
|
+
launchdLabel: "dev.adhf.daemon.preview",
|
|
34661
|
+
vbsFileName: "adhdev-daemon-preview.vbs",
|
|
34662
|
+
sessionHostName: "adhdev-preview",
|
|
34663
|
+
npmTag: "next"
|
|
34664
|
+
};
|
|
34665
|
+
IDENTITY = getTrackIdentity(TRACK);
|
|
34666
|
+
}
|
|
34667
|
+
});
|
|
34668
|
+
function resolveConfigDir(env2 = process.env, homeDir) {
|
|
34669
|
+
const override = env2.ADHDEV_CONFIG_DIR;
|
|
34670
|
+
if (override && override.trim()) return override.trim();
|
|
34671
|
+
return (0, import_path3.join)(homeDir ?? (0, import_os2.homedir)(), getTrackIdentity(resolveBuildTrack(env2)).configDirName);
|
|
34672
|
+
}
|
|
34673
|
+
function resolveConfigLogsDir(env2 = process.env, homeDir) {
|
|
34674
|
+
return (0, import_path3.join)(resolveConfigDir(env2, homeDir), "logs");
|
|
34675
|
+
}
|
|
34676
|
+
var import_os2;
|
|
34677
|
+
var import_path3;
|
|
34678
|
+
var init_config_dir = __esm2({
|
|
34679
|
+
"src/config/config-dir.ts"() {
|
|
34680
|
+
"use strict";
|
|
34681
|
+
import_os2 = require("os");
|
|
34682
|
+
import_path3 = require("path");
|
|
34683
|
+
init_track_identity();
|
|
34684
|
+
}
|
|
34685
|
+
});
|
|
34581
34686
|
function setLogLevel(level) {
|
|
34582
34687
|
currentLevel = level;
|
|
34583
34688
|
daemonLog("Logger", `Log level set to: ${level}`, "info");
|
|
@@ -34586,9 +34691,7 @@ var require_dist3 = __commonJS({
|
|
|
34586
34691
|
return currentLevel;
|
|
34587
34692
|
}
|
|
34588
34693
|
function resolveLogDir() {
|
|
34589
|
-
|
|
34590
|
-
const home = override && override.trim() ? override.trim() : path32.join(os6.homedir(), ".adhdev");
|
|
34591
|
-
return path32.join(home, "logs");
|
|
34694
|
+
return resolveConfigLogsDir();
|
|
34592
34695
|
}
|
|
34593
34696
|
function ensureLogDir(dir) {
|
|
34594
34697
|
try {
|
|
@@ -34802,7 +34905,6 @@ var require_dist3 = __commonJS({
|
|
|
34802
34905
|
}
|
|
34803
34906
|
var fs22;
|
|
34804
34907
|
var path32;
|
|
34805
|
-
var os6;
|
|
34806
34908
|
var LEVEL_NUM;
|
|
34807
34909
|
var LEVEL_LABEL;
|
|
34808
34910
|
var currentLevel;
|
|
@@ -34828,9 +34930,9 @@ var require_dist3 = __commonJS({
|
|
|
34828
34930
|
"use strict";
|
|
34829
34931
|
fs22 = __toESM2(require("fs"));
|
|
34830
34932
|
path32 = __toESM2(require("path"));
|
|
34831
|
-
os6 = __toESM2(require("os"));
|
|
34832
34933
|
init_async_batch_writer();
|
|
34833
34934
|
init_ipc_protocol();
|
|
34935
|
+
init_config_dir();
|
|
34834
34936
|
LEVEL_NUM = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
34835
34937
|
LEVEL_LABEL = { debug: "DBG", info: "INF", warn: "WRN", error: "ERR" };
|
|
34836
34938
|
currentLevel = "info";
|
|
@@ -34978,14 +35080,14 @@ var require_dist3 = __commonJS({
|
|
|
34978
35080
|
});
|
|
34979
35081
|
function adhdevHome(env2 = process.env) {
|
|
34980
35082
|
const override = env2.ADHDEV_HOME?.trim();
|
|
34981
|
-
return override ? override : path42.join(
|
|
35083
|
+
return override ? override : path42.join(os6.homedir(), ".adhdev");
|
|
34982
35084
|
}
|
|
34983
35085
|
function statuslineDir(env2 = process.env) {
|
|
34984
35086
|
return path42.join(adhdevHome(env2), "claude-statusline");
|
|
34985
35087
|
}
|
|
34986
35088
|
function claudeConfigDir(env2 = process.env) {
|
|
34987
35089
|
const override = env2.CLAUDE_CONFIG_DIR?.trim();
|
|
34988
|
-
return override ? override : path42.join(
|
|
35090
|
+
return override ? override : path42.join(os6.homedir(), ".claude");
|
|
34989
35091
|
}
|
|
34990
35092
|
function claudeSettingsPath(env2 = process.env) {
|
|
34991
35093
|
return path42.join(claudeConfigDir(env2), "settings.json");
|
|
@@ -34999,12 +35101,12 @@ var require_dist3 = __commonJS({
|
|
|
34999
35101
|
function backupPath(env2 = process.env) {
|
|
35000
35102
|
return path42.join(statuslineDir(env2), "statusline-backup.json");
|
|
35001
35103
|
}
|
|
35002
|
-
var
|
|
35104
|
+
var os6;
|
|
35003
35105
|
var path42;
|
|
35004
35106
|
var init_paths = __esm2({
|
|
35005
35107
|
"src/quota/statusline/paths.ts"() {
|
|
35006
35108
|
"use strict";
|
|
35007
|
-
|
|
35109
|
+
os6 = __toESM2(require("os"));
|
|
35008
35110
|
path42 = __toESM2(require("path"));
|
|
35009
35111
|
}
|
|
35010
35112
|
});
|
|
@@ -35410,6 +35512,7 @@ child.on('exit', () => process.exit(0));
|
|
|
35410
35512
|
if (!isPlainObject2(raw)) continue;
|
|
35411
35513
|
const entry = {};
|
|
35412
35514
|
if (raw.enabled === true) entry.enabled = true;
|
|
35515
|
+
if (typeof raw.quotaEnabled === "boolean") entry.quotaEnabled = raw.quotaEnabled;
|
|
35413
35516
|
if (typeof raw.executable === "string" && raw.executable.trim()) {
|
|
35414
35517
|
entry.executable = raw.executable.trim();
|
|
35415
35518
|
}
|
|
@@ -35456,7 +35559,13 @@ child.on('exit', () => process.exit(0));
|
|
|
35456
35559
|
providerTarballUrl: asOptionalString(parsed.providerTarballUrl),
|
|
35457
35560
|
providerChannel: asOptionalString(parsed.providerChannel),
|
|
35458
35561
|
providerAllowUnverifiedTarball: asBoolean(parsed.providerAllowUnverifiedTarball, false),
|
|
35459
|
-
|
|
35562
|
+
// Phase 3: legacy runtime channel field, read-only and never written
|
|
35563
|
+
// anymore (channel is a build-time identity — track-identity.ts). An
|
|
35564
|
+
// explicit preview/next value is still honored so the provider-channel
|
|
35565
|
+
// derivation union (providers/channel/contract.ts) stays
|
|
35566
|
+
// behavior-neutral for stale configs; anything absent or unknown
|
|
35567
|
+
// resolves to THIS binary's build track instead of failing.
|
|
35568
|
+
updateChannel: parsed.updateChannel === "preview" || parsed.updateChannel === "next" ? "preview" : parsed.updateChannel === "stable" || parsed.updateChannel === "latest" ? "stable" : TRACK,
|
|
35460
35569
|
terminalSizingMode: parsed.terminalSizingMode === "fit" ? "fit" : "measured"
|
|
35461
35570
|
};
|
|
35462
35571
|
}
|
|
@@ -35479,25 +35588,24 @@ child.on('exit', () => process.exit(0));
|
|
|
35479
35588
|
};
|
|
35480
35589
|
}
|
|
35481
35590
|
function getConfigDir2() {
|
|
35482
|
-
const
|
|
35483
|
-
const dir = override && override.trim() ? override.trim() : (0, import_path3.join)((0, import_os2.homedir)(), ".adhdev");
|
|
35591
|
+
const dir = resolveConfigDir();
|
|
35484
35592
|
if (!(0, import_fs3.existsSync)(dir)) {
|
|
35485
35593
|
(0, import_fs3.mkdirSync)(dir, { recursive: true });
|
|
35486
35594
|
}
|
|
35487
35595
|
return dir;
|
|
35488
35596
|
}
|
|
35489
35597
|
function getDaemonDataDir() {
|
|
35490
|
-
const dir = (0,
|
|
35598
|
+
const dir = (0, import_path4.join)(getConfigDir2(), "daemon");
|
|
35491
35599
|
if (!(0, import_fs3.existsSync)(dir)) {
|
|
35492
35600
|
(0, import_fs3.mkdirSync)(dir, { recursive: true });
|
|
35493
35601
|
}
|
|
35494
35602
|
return dir;
|
|
35495
35603
|
}
|
|
35496
35604
|
function getConfigPath() {
|
|
35497
|
-
return (0,
|
|
35605
|
+
return (0, import_path4.join)(getConfigDir2(), "config.json");
|
|
35498
35606
|
}
|
|
35499
35607
|
function migrateStateToStateFile(raw) {
|
|
35500
|
-
const statePath = (0,
|
|
35608
|
+
const statePath = (0, import_path4.join)(getConfigDir2(), "state.json");
|
|
35501
35609
|
if ((0, import_fs3.existsSync)(statePath)) return;
|
|
35502
35610
|
const recentActivity = Array.isArray(raw.recentActivity) ? raw.recentActivity : [];
|
|
35503
35611
|
const savedProviderSessions = Array.isArray(raw.savedProviderSessions) ? raw.savedProviderSessions : [];
|
|
@@ -35591,8 +35699,7 @@ child.on('exit', () => process.exit(0));
|
|
|
35591
35699
|
function resetConfig() {
|
|
35592
35700
|
saveConfig({ ...DEFAULT_CONFIG });
|
|
35593
35701
|
}
|
|
35594
|
-
var
|
|
35595
|
-
var import_path3;
|
|
35702
|
+
var import_path4;
|
|
35596
35703
|
var import_fs3;
|
|
35597
35704
|
var import_crypto2;
|
|
35598
35705
|
var DEFAULT_CONFIG;
|
|
@@ -35600,12 +35707,16 @@ child.on('exit', () => process.exit(0));
|
|
|
35600
35707
|
var init_config = __esm2({
|
|
35601
35708
|
"src/config/config.ts"() {
|
|
35602
35709
|
"use strict";
|
|
35603
|
-
|
|
35604
|
-
import_path3 = require("path");
|
|
35710
|
+
import_path4 = require("path");
|
|
35605
35711
|
import_fs3 = require("fs");
|
|
35606
35712
|
import_crypto2 = require("crypto");
|
|
35713
|
+
init_config_dir();
|
|
35714
|
+
init_track_identity();
|
|
35607
35715
|
DEFAULT_CONFIG = {
|
|
35608
|
-
|
|
35716
|
+
// Track-stamped default origin: identical to the historical literal on
|
|
35717
|
+
// stable builds ('https://api.adhf.dev'); preview builds default to the
|
|
35718
|
+
// preview API instead of silently pinning stable.
|
|
35719
|
+
serverUrl: IDENTITY.serverUrl,
|
|
35609
35720
|
allowServerApiProxy: false,
|
|
35610
35721
|
quotaShowAccountEmail: true,
|
|
35611
35722
|
selectedIde: null,
|
|
@@ -36063,7 +36174,7 @@ child.on('exit', () => process.exit(0));
|
|
|
36063
36174
|
});
|
|
36064
36175
|
function kimiHome(env2) {
|
|
36065
36176
|
const override = env2.KIMI_CODE_HOME?.trim();
|
|
36066
|
-
return override ? override : path6.join(
|
|
36177
|
+
return override ? override : path6.join(os22.homedir(), ".kimi-code");
|
|
36067
36178
|
}
|
|
36068
36179
|
function credentialsPath(env2) {
|
|
36069
36180
|
return path6.join(kimiHome(env2), "credentials", "kimi-code.json");
|
|
@@ -36272,7 +36383,7 @@ child.on('exit', () => process.exit(0));
|
|
|
36272
36383
|
}
|
|
36273
36384
|
}
|
|
36274
36385
|
var fs5;
|
|
36275
|
-
var
|
|
36386
|
+
var os22;
|
|
36276
36387
|
var path6;
|
|
36277
36388
|
var DEFAULT_BASE_URL;
|
|
36278
36389
|
var REQUEST_TIMEOUT_MS2;
|
|
@@ -36281,7 +36392,7 @@ child.on('exit', () => process.exit(0));
|
|
|
36281
36392
|
"src/quota/fetchers/kimi.ts"() {
|
|
36282
36393
|
"use strict";
|
|
36283
36394
|
fs5 = __toESM2(require("fs"));
|
|
36284
|
-
|
|
36395
|
+
os22 = __toESM2(require("os"));
|
|
36285
36396
|
path6 = __toESM2(require("path"));
|
|
36286
36397
|
init_types();
|
|
36287
36398
|
init_deps();
|
|
@@ -36359,7 +36470,7 @@ child.on('exit', () => process.exit(0));
|
|
|
36359
36470
|
}
|
|
36360
36471
|
});
|
|
36361
36472
|
function quotaProviderEnabledFromLoader(loader2) {
|
|
36362
|
-
return (provider) => loader2.isMachineProviderEnabled(provider);
|
|
36473
|
+
return (provider) => loader2.isMachineProviderEnabled(provider) && (loader2.isMachineQuotaEnabled ? loader2.isMachineQuotaEnabled(provider) : true);
|
|
36363
36474
|
}
|
|
36364
36475
|
function toWireQuota(quota) {
|
|
36365
36476
|
return quota;
|
|
@@ -36724,7 +36835,7 @@ child.on('exit', () => process.exit(0));
|
|
|
36724
36835
|
function unixExtraBinDirs() {
|
|
36725
36836
|
const dirs = [];
|
|
36726
36837
|
const fs53 = require("fs");
|
|
36727
|
-
const home =
|
|
36838
|
+
const home = os32.homedir();
|
|
36728
36839
|
const push = (dir) => {
|
|
36729
36840
|
if (!dir) return;
|
|
36730
36841
|
try {
|
|
@@ -36748,11 +36859,11 @@ child.on('exit', () => process.exit(0));
|
|
|
36748
36859
|
function findBinary(name) {
|
|
36749
36860
|
const trimmed = String(name || "").trim();
|
|
36750
36861
|
if (!trimmed) return trimmed;
|
|
36751
|
-
const expanded = trimmed.startsWith("~") ? path8.join(
|
|
36862
|
+
const expanded = trimmed.startsWith("~") ? path8.join(os32.homedir(), trimmed.slice(1)) : trimmed;
|
|
36752
36863
|
if (path8.isAbsolute(expanded) || expanded.includes("/") || expanded.includes("\\")) {
|
|
36753
36864
|
return path8.isAbsolute(expanded) ? expanded : path8.resolve(expanded);
|
|
36754
36865
|
}
|
|
36755
|
-
const isWin =
|
|
36866
|
+
const isWin = os32.platform() === "win32";
|
|
36756
36867
|
const paths = (process.env.PATH || "").split(path8.delimiter);
|
|
36757
36868
|
const extraDirs = [];
|
|
36758
36869
|
if (isWin) {
|
|
@@ -36820,7 +36931,7 @@ child.on('exit', () => process.exit(0));
|
|
|
36820
36931
|
}
|
|
36821
36932
|
function shSingleQuote(arg) {
|
|
36822
36933
|
if (/^[a-zA-Z0-9@%_+=:,./-]+$/.test(arg)) return arg;
|
|
36823
|
-
if (
|
|
36934
|
+
if (os32.platform() === "win32") {
|
|
36824
36935
|
return `"${arg.replace(/"/g, '""')}"`;
|
|
36825
36936
|
}
|
|
36826
36937
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
@@ -36886,7 +36997,7 @@ child.on('exit', () => process.exit(0));
|
|
|
36886
36997
|
}
|
|
36887
36998
|
};
|
|
36888
36999
|
}
|
|
36889
|
-
var
|
|
37000
|
+
var os32;
|
|
36890
37001
|
var path8;
|
|
36891
37002
|
var import_child_process;
|
|
36892
37003
|
var TerminalTranscriptAccumulator;
|
|
@@ -36899,7 +37010,7 @@ child.on('exit', () => process.exit(0));
|
|
|
36899
37010
|
var init_provider_cli_shared = __esm2({
|
|
36900
37011
|
"src/cli-adapters/provider-cli-shared.ts"() {
|
|
36901
37012
|
"use strict";
|
|
36902
|
-
|
|
37013
|
+
os32 = __toESM2(require("os"));
|
|
36903
37014
|
path8 = __toESM2(require("path"));
|
|
36904
37015
|
import_child_process = require("child_process");
|
|
36905
37016
|
init_spawn_env();
|
|
@@ -37088,7 +37199,7 @@ child.on('exit', () => process.exit(0));
|
|
|
37088
37199
|
function expandHome(value) {
|
|
37089
37200
|
const trimmed = value.trim();
|
|
37090
37201
|
if (!trimmed.startsWith("~")) return trimmed;
|
|
37091
|
-
return path9.join(
|
|
37202
|
+
return path9.join(os42.homedir(), trimmed.slice(1));
|
|
37092
37203
|
}
|
|
37093
37204
|
function isExplicitCommandPath(command) {
|
|
37094
37205
|
const trimmed = command.trim();
|
|
@@ -37130,7 +37241,7 @@ child.on('exit', () => process.exit(0));
|
|
|
37130
37241
|
});
|
|
37131
37242
|
}
|
|
37132
37243
|
async function detectCLIs(providerLoader, options) {
|
|
37133
|
-
const platform10 =
|
|
37244
|
+
const platform10 = os42.platform();
|
|
37134
37245
|
const whichCmd = platform10 === "win32" ? "where" : "which";
|
|
37135
37246
|
const includeVersion = options?.includeVersion !== false;
|
|
37136
37247
|
const cliList = providerLoader ? providerLoader.getCliDetectionList() : [];
|
|
@@ -37172,7 +37283,7 @@ child.on('exit', () => process.exit(0));
|
|
|
37172
37283
|
const cliList = providerLoader.getCliDetectionList();
|
|
37173
37284
|
const target = cliList.find((c) => c.id === resolvedId);
|
|
37174
37285
|
if (target) {
|
|
37175
|
-
const platform10 =
|
|
37286
|
+
const platform10 = os42.platform();
|
|
37176
37287
|
const whichCmd = platform10 === "win32" ? "where" : "which";
|
|
37177
37288
|
try {
|
|
37178
37289
|
const firstPath = await resolveDetectionPath(target.command, whichCmd);
|
|
@@ -37255,7 +37366,7 @@ child.on('exit', () => process.exit(0));
|
|
|
37255
37366
|
return out;
|
|
37256
37367
|
}
|
|
37257
37368
|
var import_child_process2;
|
|
37258
|
-
var
|
|
37369
|
+
var os42;
|
|
37259
37370
|
var path9;
|
|
37260
37371
|
var import_fs4;
|
|
37261
37372
|
var PROVIDER_VERSIONS_TTL_MS;
|
|
@@ -37267,7 +37378,7 @@ child.on('exit', () => process.exit(0));
|
|
|
37267
37378
|
"src/detection/cli-detector.ts"() {
|
|
37268
37379
|
"use strict";
|
|
37269
37380
|
import_child_process2 = require("child_process");
|
|
37270
|
-
|
|
37381
|
+
os42 = __toESM2(require("os"));
|
|
37271
37382
|
path9 = __toESM2(require("path"));
|
|
37272
37383
|
import_fs4 = require("fs");
|
|
37273
37384
|
init_provider_cli_shared();
|
|
@@ -37345,7 +37456,7 @@ child.on('exit', () => process.exit(0));
|
|
|
37345
37456
|
resolveWorktreePath: () => resolveWorktreePath
|
|
37346
37457
|
});
|
|
37347
37458
|
function getDefaultWorktreeBaseDir() {
|
|
37348
|
-
return path11.join(
|
|
37459
|
+
return path11.join(os52.homedir(), ".adhdev", WORKTREE_DIR_NAME);
|
|
37349
37460
|
}
|
|
37350
37461
|
function resolveWorktreeBaseDir(worktreeBaseDir) {
|
|
37351
37462
|
const override = typeof worktreeBaseDir === "string" ? worktreeBaseDir.trim() : "";
|
|
@@ -37635,7 +37746,7 @@ ${error48.message || ""}`;
|
|
|
37635
37746
|
}
|
|
37636
37747
|
}
|
|
37637
37748
|
var path11;
|
|
37638
|
-
var
|
|
37749
|
+
var os52;
|
|
37639
37750
|
var import_promises3;
|
|
37640
37751
|
var import_node_fs2;
|
|
37641
37752
|
var import_node_child_process3;
|
|
@@ -37649,7 +37760,7 @@ ${error48.message || ""}`;
|
|
|
37649
37760
|
"src/git/git-worktree.ts"() {
|
|
37650
37761
|
"use strict";
|
|
37651
37762
|
path11 = __toESM2(require("path"));
|
|
37652
|
-
|
|
37763
|
+
os52 = __toESM2(require("os"));
|
|
37653
37764
|
import_promises3 = require("fs/promises");
|
|
37654
37765
|
import_node_fs2 = require("fs");
|
|
37655
37766
|
import_node_child_process3 = require("child_process");
|
|
@@ -37664,7 +37775,7 @@ ${error48.message || ""}`;
|
|
|
37664
37775
|
function expandPath(p) {
|
|
37665
37776
|
const t = (p || "").trim();
|
|
37666
37777
|
if (!t) return "";
|
|
37667
|
-
if (t.startsWith("~")) return path13.join(
|
|
37778
|
+
if (t.startsWith("~")) return path13.join(os7.homedir(), t.slice(1).replace(/^\//, ""));
|
|
37668
37779
|
return path13.resolve(t);
|
|
37669
37780
|
}
|
|
37670
37781
|
function validateWorkspacePath(absPath) {
|
|
@@ -37737,7 +37848,7 @@ ${error48.message || ""}`;
|
|
|
37737
37848
|
};
|
|
37738
37849
|
}
|
|
37739
37850
|
if (a.useHome === true) {
|
|
37740
|
-
return { ok: true, path:
|
|
37851
|
+
return { ok: true, path: os7.homedir(), source: "home" };
|
|
37741
37852
|
}
|
|
37742
37853
|
return {
|
|
37743
37854
|
ok: false,
|
|
@@ -37821,7 +37932,7 @@ ${error48.message || ""}`;
|
|
|
37821
37932
|
return { config: { ...config2, defaultWorkspaceId: id } };
|
|
37822
37933
|
}
|
|
37823
37934
|
var fs7;
|
|
37824
|
-
var
|
|
37935
|
+
var os7;
|
|
37825
37936
|
var path13;
|
|
37826
37937
|
var import_crypto22;
|
|
37827
37938
|
var MAX_WORKSPACES;
|
|
@@ -37829,7 +37940,7 @@ ${error48.message || ""}`;
|
|
|
37829
37940
|
"src/config/workspaces.ts"() {
|
|
37830
37941
|
"use strict";
|
|
37831
37942
|
fs7 = __toESM2(require("fs"));
|
|
37832
|
-
|
|
37943
|
+
os7 = __toESM2(require("os"));
|
|
37833
37944
|
path13 = __toESM2(require("path"));
|
|
37834
37945
|
import_crypto22 = require("crypto");
|
|
37835
37946
|
MAX_WORKSPACES = 50;
|
|
@@ -38964,7 +39075,7 @@ ${error48.message || ""}`;
|
|
|
38964
39075
|
updateNode: () => updateNode
|
|
38965
39076
|
});
|
|
38966
39077
|
function getMeshConfigPath() {
|
|
38967
|
-
return (0,
|
|
39078
|
+
return (0, import_path5.join)(getConfigDir2(), "meshes.json");
|
|
38968
39079
|
}
|
|
38969
39080
|
function loadMeshConfig(options = {}) {
|
|
38970
39081
|
const path54 = getMeshConfigPath();
|
|
@@ -39662,7 +39773,7 @@ ${error48.message || ""}`;
|
|
|
39662
39773
|
return normalized;
|
|
39663
39774
|
}
|
|
39664
39775
|
var import_fs5;
|
|
39665
|
-
var
|
|
39776
|
+
var import_path5;
|
|
39666
39777
|
var import_crypto3;
|
|
39667
39778
|
var mergeMeshPolicy;
|
|
39668
39779
|
var MAGI_KIND_PANEL_KINDS;
|
|
@@ -39671,7 +39782,7 @@ ${error48.message || ""}`;
|
|
|
39671
39782
|
"src/config/mesh-config.ts"() {
|
|
39672
39783
|
"use strict";
|
|
39673
39784
|
import_fs5 = require("fs");
|
|
39674
|
-
|
|
39785
|
+
import_path5 = require("path");
|
|
39675
39786
|
import_crypto3 = require("crypto");
|
|
39676
39787
|
init_hash();
|
|
39677
39788
|
init_config();
|
|
@@ -42070,9 +42181,9 @@ Next step: ${nextStep}`;
|
|
|
42070
42181
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
42071
42182
|
if (coordinatorDaemonId) {
|
|
42072
42183
|
const safeDaemon = coordinatorDaemonId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
42073
|
-
return (0,
|
|
42184
|
+
return (0, import_path6.join)(getLedgerDir(), `${safe}-${safeDaemon}.pending-events.jsonl`);
|
|
42074
42185
|
}
|
|
42075
|
-
return (0,
|
|
42186
|
+
return (0, import_path6.join)(getLedgerDir(), `${safe}.pending-events.jsonl`);
|
|
42076
42187
|
}
|
|
42077
42188
|
function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
|
|
42078
42189
|
if (!meshId) return [];
|
|
@@ -42679,7 +42790,7 @@ Next step: ${nextStep}`;
|
|
|
42679
42790
|
}
|
|
42680
42791
|
}
|
|
42681
42792
|
var import_fs6;
|
|
42682
|
-
var
|
|
42793
|
+
var import_path6;
|
|
42683
42794
|
var import_crypto6;
|
|
42684
42795
|
var REFINE_TERMINAL_EVENTS;
|
|
42685
42796
|
var meshV2DrainCounters;
|
|
@@ -42694,7 +42805,7 @@ Next step: ${nextStep}`;
|
|
|
42694
42805
|
"src/mesh/mesh-events-pending.ts"() {
|
|
42695
42806
|
"use strict";
|
|
42696
42807
|
import_fs6 = require("fs");
|
|
42697
|
-
|
|
42808
|
+
import_path6 = require("path");
|
|
42698
42809
|
import_crypto6 = require("crypto");
|
|
42699
42810
|
init_logger();
|
|
42700
42811
|
init_config();
|
|
@@ -43426,11 +43537,11 @@ Next step: ${nextStep}`;
|
|
|
43426
43537
|
const pinnedProvider = typeof providerType === "string" && providerType.trim() ? providerType.trim() : void 0;
|
|
43427
43538
|
const providerTags = pinnedProvider ? [pinnedProvider] : readNodeProviderTypes(node?.policy);
|
|
43428
43539
|
const worktreeBranch = typeof node?.worktreeBranch === "string" && node.worktreeBranch.trim() ? node.worktreeBranch.trim() : null;
|
|
43429
|
-
const
|
|
43540
|
+
const os30 = readNodeOverride(node, "platform") ?? readNodeReporter(node, "platform") ?? process.platform;
|
|
43430
43541
|
const arch2 = readNodeOverride(node, "arch") ?? readNodeReporter(node, "arch") ?? process.arch;
|
|
43431
43542
|
return normalizeMeshCapabilityTags([
|
|
43432
43543
|
...Array.isArray(node?.capabilities) ? node.capabilities : [],
|
|
43433
|
-
`os=${
|
|
43544
|
+
`os=${os30}`,
|
|
43434
43545
|
`arch=${arch2}`,
|
|
43435
43546
|
...providerTags.map((p) => `provider=${p}`),
|
|
43436
43547
|
// Worktree nodes automatically expose a "worktree=<branch>" tag so that
|
|
@@ -44124,11 +44235,11 @@ Next step: ${nextStep}`;
|
|
|
44124
44235
|
return meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
44125
44236
|
}
|
|
44126
44237
|
function legacyQueuePath(meshId) {
|
|
44127
|
-
return (0,
|
|
44238
|
+
return (0, import_path7.join)(getLedgerDir(), `${safeMeshId(meshId)}.queue.json`);
|
|
44128
44239
|
}
|
|
44129
44240
|
function cleanupStrayRootRuntimeDb(canonicalPath2) {
|
|
44130
44241
|
try {
|
|
44131
|
-
const strayPath = (0,
|
|
44242
|
+
const strayPath = (0, import_path7.join)(getConfigDir2(), "mesh-runtime.db");
|
|
44132
44243
|
if (strayPath === canonicalPath2) return;
|
|
44133
44244
|
if (!(0, import_fs7.existsSync)(strayPath)) return;
|
|
44134
44245
|
if ((0, import_fs7.statSync)(strayPath).size !== 0) return;
|
|
@@ -44146,10 +44257,10 @@ Next step: ${nextStep}`;
|
|
|
44146
44257
|
}
|
|
44147
44258
|
function meshRuntimeStorePath() {
|
|
44148
44259
|
const dir = getLedgerDir();
|
|
44149
|
-
const nextPath = (0,
|
|
44260
|
+
const nextPath = (0, import_path7.join)(dir, "mesh-runtime.db");
|
|
44150
44261
|
cleanupStrayRootRuntimeDb(nextPath);
|
|
44151
44262
|
if ((0, import_fs7.existsSync)(nextPath)) return nextPath;
|
|
44152
|
-
const legacyPath = (0,
|
|
44263
|
+
const legacyPath = (0, import_path7.join)(dir, "beads.db");
|
|
44153
44264
|
if (!(0, import_fs7.existsSync)(legacyPath)) return nextPath;
|
|
44154
44265
|
try {
|
|
44155
44266
|
(0, import_fs7.renameSync)(legacyPath, nextPath);
|
|
@@ -44229,7 +44340,7 @@ Next step: ${nextStep}`;
|
|
|
44229
44340
|
}
|
|
44230
44341
|
}
|
|
44231
44342
|
var import_fs7;
|
|
44232
|
-
var
|
|
44343
|
+
var import_path7;
|
|
44233
44344
|
var DatabaseCtor;
|
|
44234
44345
|
var loggedMigrationFailure;
|
|
44235
44346
|
var loggedStrayCleanup;
|
|
@@ -44241,7 +44352,7 @@ Next step: ${nextStep}`;
|
|
|
44241
44352
|
"src/mesh/mesh-runtime-store.ts"() {
|
|
44242
44353
|
"use strict";
|
|
44243
44354
|
import_fs7 = require("fs");
|
|
44244
|
-
|
|
44355
|
+
import_path7 = require("path");
|
|
44245
44356
|
init_logger();
|
|
44246
44357
|
init_load_better_sqlite3();
|
|
44247
44358
|
init_config();
|
|
@@ -44273,7 +44384,7 @@ Next step: ${nextStep}`;
|
|
|
44273
44384
|
static WAL_MAX_BYTES = 50 * 1024 * 1024;
|
|
44274
44385
|
// 50 MB
|
|
44275
44386
|
constructor(dbPath) {
|
|
44276
|
-
const dir = (0,
|
|
44387
|
+
const dir = (0, import_path7.dirname)(dbPath);
|
|
44277
44388
|
if (!(0, import_fs7.existsSync)(dir)) (0, import_fs7.mkdirSync)(dir, { recursive: true });
|
|
44278
44389
|
this.dbPath = dbPath;
|
|
44279
44390
|
this.db = new (loadDatabaseCtor())(dbPath);
|
|
@@ -46825,7 +46936,7 @@ Next step: ${nextStep}`;
|
|
|
46825
46936
|
return now - created >= ttlDays * MS_PER_DAY;
|
|
46826
46937
|
}
|
|
46827
46938
|
function getLedgerDir() {
|
|
46828
|
-
const dir = (0,
|
|
46939
|
+
const dir = (0, import_path8.join)(getConfigDir2(), LEDGER_DIR_NAME);
|
|
46829
46940
|
if (!(0, import_fs8.existsSync)(dir)) {
|
|
46830
46941
|
(0, import_fs8.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
46831
46942
|
}
|
|
@@ -46833,23 +46944,23 @@ Next step: ${nextStep}`;
|
|
|
46833
46944
|
}
|
|
46834
46945
|
function getLedgerPath(meshId) {
|
|
46835
46946
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
46836
|
-
return (0,
|
|
46947
|
+
return (0, import_path8.join)(getLedgerDir(), `${safe}.jsonl`);
|
|
46837
46948
|
}
|
|
46838
46949
|
function getRotatedPath(meshId, index) {
|
|
46839
46950
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
46840
|
-
return (0,
|
|
46951
|
+
return (0, import_path8.join)(getLedgerDir(), `${safe}.${index}.jsonl`);
|
|
46841
46952
|
}
|
|
46842
46953
|
function getArchivePath(meshId) {
|
|
46843
46954
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
46844
|
-
return (0,
|
|
46955
|
+
return (0, import_path8.join)(getLedgerDir(), `${safe}.archive.jsonl`);
|
|
46845
46956
|
}
|
|
46846
46957
|
function getRotatedArchivePath(meshId, index) {
|
|
46847
46958
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
46848
|
-
return (0,
|
|
46959
|
+
return (0, import_path8.join)(getLedgerDir(), `${safe}.archive.${index}.jsonl`);
|
|
46849
46960
|
}
|
|
46850
46961
|
function getArchivedCountsPath(meshId) {
|
|
46851
46962
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
46852
|
-
return (0,
|
|
46963
|
+
return (0, import_path8.join)(getLedgerDir(), `${safe}.archived-counts.json`);
|
|
46853
46964
|
}
|
|
46854
46965
|
function rotateArchiveFile(meshId, archivePath) {
|
|
46855
46966
|
let index = 1;
|
|
@@ -47651,7 +47762,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
47651
47762
|
return out;
|
|
47652
47763
|
}
|
|
47653
47764
|
function evictClosedRotationFile(safe, dir, entry) {
|
|
47654
|
-
const filePath = (0,
|
|
47765
|
+
const filePath = (0, import_path8.join)(dir, entry.name);
|
|
47655
47766
|
const counts = readArchivedCounts(safe);
|
|
47656
47767
|
const alreadyFolded = new Set(counts.evictedRotations ?? []);
|
|
47657
47768
|
if (alreadyFolded.has(entry.name)) {
|
|
@@ -47689,7 +47800,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
47689
47800
|
for (const name of names) {
|
|
47690
47801
|
if (!closedRotationKind(safe, name)) continue;
|
|
47691
47802
|
try {
|
|
47692
|
-
const st = (0, import_fs8.statSync)((0,
|
|
47803
|
+
const st = (0, import_fs8.statSync)((0, import_path8.join)(dir, name));
|
|
47693
47804
|
if (st.isFile()) stats.push({ name, sizeBytes: st.size, mtimeMs: st.mtimeMs });
|
|
47694
47805
|
} catch {
|
|
47695
47806
|
}
|
|
@@ -47749,7 +47860,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
47749
47860
|
return result;
|
|
47750
47861
|
}
|
|
47751
47862
|
var import_fs8;
|
|
47752
|
-
var
|
|
47863
|
+
var import_path8;
|
|
47753
47864
|
var import_crypto9;
|
|
47754
47865
|
var import_events;
|
|
47755
47866
|
var TASK_LIFECYCLE_LEDGER_KINDS;
|
|
@@ -47776,7 +47887,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
47776
47887
|
"src/mesh/mesh-ledger.ts"() {
|
|
47777
47888
|
"use strict";
|
|
47778
47889
|
import_fs8 = require("fs");
|
|
47779
|
-
|
|
47890
|
+
import_path8 = require("path");
|
|
47780
47891
|
import_crypto9 = require("crypto");
|
|
47781
47892
|
init_config();
|
|
47782
47893
|
init_mesh_retention_config();
|
|
@@ -48915,7 +49026,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
48915
49026
|
return { config: inline, source: "mesh.policy.refineConfig", sourceType: "mesh_policy" };
|
|
48916
49027
|
}
|
|
48917
49028
|
for (const relative8 of MESH_REFINE_CONFIG_LOCATIONS) {
|
|
48918
|
-
const configPath = (0,
|
|
49029
|
+
const configPath = (0, import_path9.join)(workspace, relative8);
|
|
48919
49030
|
if (!(0, import_fs9.existsSync)(configPath)) continue;
|
|
48920
49031
|
try {
|
|
48921
49032
|
const parsed = parseConfigText3(configPath, (0, import_fs9.readFileSync)(configPath, "utf-8"));
|
|
@@ -48934,7 +49045,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
48934
49045
|
}
|
|
48935
49046
|
function readPackageScripts(workspace) {
|
|
48936
49047
|
try {
|
|
48937
|
-
const parsed = JSON.parse((0, import_fs9.readFileSync)((0,
|
|
49048
|
+
const parsed = JSON.parse((0, import_fs9.readFileSync)((0, import_path9.join)(workspace, "package.json"), "utf-8"));
|
|
48938
49049
|
return isRecord3(parsed?.scripts) ? parsed.scripts : {};
|
|
48939
49050
|
} catch {
|
|
48940
49051
|
return {};
|
|
@@ -49010,7 +49121,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49010
49121
|
};
|
|
49011
49122
|
}
|
|
49012
49123
|
var import_fs9;
|
|
49013
|
-
var
|
|
49124
|
+
var import_path9;
|
|
49014
49125
|
var yaml3;
|
|
49015
49126
|
var MESH_REFINE_VALIDATION_CATEGORIES;
|
|
49016
49127
|
var MESH_REFINE_VALIDATION_SCOPES;
|
|
@@ -49024,7 +49135,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49024
49135
|
"src/mesh/refine-config.ts"() {
|
|
49025
49136
|
"use strict";
|
|
49026
49137
|
import_fs9 = require("fs");
|
|
49027
|
-
|
|
49138
|
+
import_path9 = require("path");
|
|
49028
49139
|
yaml3 = __toESM2(require_js_yaml());
|
|
49029
49140
|
MESH_REFINE_VALIDATION_CATEGORIES = ["typecheck", "test", "lint", "build"];
|
|
49030
49141
|
MESH_REFINE_VALIDATION_SCOPES = ["none", "web", "daemon"];
|
|
@@ -49407,7 +49518,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49407
49518
|
return { config: inline, source: "mesh.policy.worktreeBootstrapConfig", sourceType: "mesh_policy" };
|
|
49408
49519
|
}
|
|
49409
49520
|
for (const relative8 of MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS) {
|
|
49410
|
-
const configPath = (0,
|
|
49521
|
+
const configPath = (0, import_path10.join)(workspace, relative8);
|
|
49411
49522
|
if (!(0, import_fs11.existsSync)(configPath)) continue;
|
|
49412
49523
|
try {
|
|
49413
49524
|
const parsed = parseConfigText4(configPath, (0, import_fs11.readFileSync)(configPath, "utf-8"));
|
|
@@ -49423,7 +49534,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49423
49534
|
function computeStaleInputsDigest(workspace, staleInputs) {
|
|
49424
49535
|
const digest = {};
|
|
49425
49536
|
for (const relative8 of staleInputs ?? []) {
|
|
49426
|
-
const filePath = (0,
|
|
49537
|
+
const filePath = (0, import_path10.join)(workspace, relative8);
|
|
49427
49538
|
try {
|
|
49428
49539
|
digest[relative8] = (0, import_node_crypto2.createHash)("sha256").update((0, import_fs11.readFileSync)(filePath)).digest("hex");
|
|
49429
49540
|
} catch {
|
|
@@ -49496,10 +49607,10 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49496
49607
|
staleInputs: loaded.config.staleInputs
|
|
49497
49608
|
};
|
|
49498
49609
|
const staleInputPaths = loaded.config.staleInputs ?? [];
|
|
49499
|
-
const initiallyAbsent = staleInputPaths.filter((p) => !(0, import_fs11.existsSync)((0,
|
|
49610
|
+
const initiallyAbsent = staleInputPaths.filter((p) => !(0, import_fs11.existsSync)((0, import_path10.join)(workspace, p)));
|
|
49500
49611
|
for (const command of validation.commands) {
|
|
49501
49612
|
if (initiallyAbsent.length > 0) {
|
|
49502
|
-
const appearedNow = initiallyAbsent.filter((p) => (0, import_fs11.existsSync)((0,
|
|
49613
|
+
const appearedNow = initiallyAbsent.filter((p) => (0, import_fs11.existsSync)((0, import_path10.join)(workspace, p)));
|
|
49503
49614
|
if (appearedNow.length > 0) {
|
|
49504
49615
|
state.status = "stale";
|
|
49505
49616
|
state.completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -49507,7 +49618,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49507
49618
|
return state;
|
|
49508
49619
|
}
|
|
49509
49620
|
}
|
|
49510
|
-
const cwd = command.cwd ? (0,
|
|
49621
|
+
const cwd = command.cwd ? (0, import_path10.resolve)(workspace, command.cwd) : workspace;
|
|
49511
49622
|
const startedAt = Date.now();
|
|
49512
49623
|
state.lastCommand = command.displayCommand;
|
|
49513
49624
|
const resolvedCommand = resolveWin32Executable(command.command);
|
|
@@ -49568,7 +49679,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49568
49679
|
return state;
|
|
49569
49680
|
}
|
|
49570
49681
|
var import_fs11;
|
|
49571
|
-
var
|
|
49682
|
+
var import_path10;
|
|
49572
49683
|
var import_node_child_process4;
|
|
49573
49684
|
var import_node_crypto2;
|
|
49574
49685
|
var import_node_util3;
|
|
@@ -49584,7 +49695,7 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49584
49695
|
"src/mesh/worktree-bootstrap-config.ts"() {
|
|
49585
49696
|
"use strict";
|
|
49586
49697
|
import_fs11 = require("fs");
|
|
49587
|
-
|
|
49698
|
+
import_path10 = require("path");
|
|
49588
49699
|
import_node_child_process4 = require("child_process");
|
|
49589
49700
|
import_node_crypto2 = require("crypto");
|
|
49590
49701
|
import_node_util3 = require("util");
|
|
@@ -49812,14 +49923,14 @@ When the user asks to **set up / configure / onboard** this repo for Repo Mesh (
|
|
|
49812
49923
|
}
|
|
49813
49924
|
function resolveHermesCoordinatorHome(meshId, workspace) {
|
|
49814
49925
|
const key2 = `${meshId || "mesh"}
|
|
49815
|
-
${(0, import_node_path3.resolve)(workspace ||
|
|
49926
|
+
${(0, import_node_path3.resolve)(workspace || os8.tmpdir())}`;
|
|
49816
49927
|
const hash2 = shortHash(key2);
|
|
49817
|
-
return (0, import_node_path3.join)(
|
|
49928
|
+
return (0, import_node_path3.join)(os8.tmpdir(), `adhdev-hermes-mesh-coordinator-${hash2}`);
|
|
49818
49929
|
}
|
|
49819
49930
|
function resolveMcpConfigPath(configPath, workspace) {
|
|
49820
49931
|
const trimmed = configPath.trim();
|
|
49821
|
-
if (trimmed === "~") return
|
|
49822
|
-
if (trimmed.startsWith("~/")) return (0, import_node_path3.join)(
|
|
49932
|
+
if (trimmed === "~") return os8.homedir();
|
|
49933
|
+
if (trimmed.startsWith("~/")) return (0, import_node_path3.join)(os8.homedir(), trimmed.slice(2));
|
|
49823
49934
|
if ((0, import_node_path3.isAbsolute)(trimmed)) return trimmed;
|
|
49824
49935
|
return (0, import_node_path3.join)(workspace, trimmed);
|
|
49825
49936
|
}
|
|
@@ -50023,7 +50134,7 @@ ${rendered}`, "utf-8");
|
|
|
50023
50134
|
});
|
|
50024
50135
|
}
|
|
50025
50136
|
var import_node_fs3;
|
|
50026
|
-
var
|
|
50137
|
+
var os8;
|
|
50027
50138
|
var import_session_host_core32;
|
|
50028
50139
|
var import_node_path3;
|
|
50029
50140
|
var DEFAULT_SERVER_NAME;
|
|
@@ -50034,7 +50145,7 @@ ${rendered}`, "utf-8");
|
|
|
50034
50145
|
"src/commands/mesh-coordinator.ts"() {
|
|
50035
50146
|
"use strict";
|
|
50036
50147
|
import_node_fs3 = require("fs");
|
|
50037
|
-
|
|
50148
|
+
os8 = __toESM2(require("os"));
|
|
50038
50149
|
import_session_host_core32 = require_dist();
|
|
50039
50150
|
import_node_path3 = require("path");
|
|
50040
50151
|
init_logger();
|
|
@@ -50046,7 +50157,7 @@ ${rendered}`, "utf-8");
|
|
|
50046
50157
|
}
|
|
50047
50158
|
});
|
|
50048
50159
|
function getRegistryPath() {
|
|
50049
|
-
return (0,
|
|
50160
|
+
return (0, import_path12.join)(getDaemonDataDir(), "mesh-coordinators.json");
|
|
50050
50161
|
}
|
|
50051
50162
|
function loadMeshCoordinatorRegistry() {
|
|
50052
50163
|
const path54 = getRegistryPath();
|
|
@@ -50098,13 +50209,13 @@ ${rendered}`, "utf-8");
|
|
|
50098
50209
|
function listCoordinatorsForWorkspace(workspace) {
|
|
50099
50210
|
return [..._registry.values()].filter((e) => e.workspace === workspace);
|
|
50100
50211
|
}
|
|
50101
|
-
var
|
|
50212
|
+
var import_path12;
|
|
50102
50213
|
var import_fs13;
|
|
50103
50214
|
var _registry;
|
|
50104
50215
|
var init_coordinator_registry = __esm2({
|
|
50105
50216
|
"src/mesh/coordinator-registry.ts"() {
|
|
50106
50217
|
"use strict";
|
|
50107
|
-
|
|
50218
|
+
import_path12 = require("path");
|
|
50108
50219
|
import_fs13 = require("fs");
|
|
50109
50220
|
init_config();
|
|
50110
50221
|
_registry = /* @__PURE__ */ new Map();
|
|
@@ -54242,18 +54353,51 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
54242
54353
|
}
|
|
54243
54354
|
function selectFinalAssistantTurnEndMessage(messages) {
|
|
54244
54355
|
if (!Array.isArray(messages) || messages.length === 0) return null;
|
|
54356
|
+
let chromeFallbacks = 0;
|
|
54245
54357
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
54246
54358
|
const msg = messages[i];
|
|
54247
54359
|
if (!msg) continue;
|
|
54248
54360
|
const classification = classifyChatMessageVisibility(msg);
|
|
54249
54361
|
if (!classification.isUserFacing) continue;
|
|
54250
54362
|
if (msg.role === "assistant" || msg.role === "model") {
|
|
54251
|
-
|
|
54363
|
+
const text = flattenContent(msg.content).trim();
|
|
54364
|
+
if (!text) return null;
|
|
54365
|
+
if (chromeFallbacks < FINAL_SUMMARY_CHROME_FALLBACK_MAX_DEPTH && isTranscriptChromeOnlyText(text)) {
|
|
54366
|
+
chromeFallbacks++;
|
|
54367
|
+
continue;
|
|
54368
|
+
}
|
|
54369
|
+
return msg;
|
|
54252
54370
|
}
|
|
54253
54371
|
return null;
|
|
54254
54372
|
}
|
|
54255
54373
|
return null;
|
|
54256
54374
|
}
|
|
54375
|
+
function isTranscriptChromeOnlyText(text) {
|
|
54376
|
+
const lines = (typeof text === "string" ? text : "").split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
54377
|
+
if (lines.length === 0) return false;
|
|
54378
|
+
let sawHardChrome = false;
|
|
54379
|
+
let previousWasPanelLine = false;
|
|
54380
|
+
let orphanLines = 0;
|
|
54381
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
54382
|
+
const line = lines[i];
|
|
54383
|
+
if (TRANSCRIPT_CHROME_HARD_LINE_PATTERNS.some((pattern) => pattern.test(line))) {
|
|
54384
|
+
sawHardChrome = true;
|
|
54385
|
+
previousWasPanelLine = false;
|
|
54386
|
+
continue;
|
|
54387
|
+
}
|
|
54388
|
+
if (sawHardChrome && TRANSCRIPT_CHROME_PANEL_LINE_PATTERNS.some((pattern) => pattern.test(line))) {
|
|
54389
|
+
previousWasPanelLine = true;
|
|
54390
|
+
continue;
|
|
54391
|
+
}
|
|
54392
|
+
if (sawHardChrome && previousWasPanelLine && orphanLines < TRANSCRIPT_CHROME_MAX_ORPHAN_LINES) {
|
|
54393
|
+
orphanLines++;
|
|
54394
|
+
previousWasPanelLine = false;
|
|
54395
|
+
continue;
|
|
54396
|
+
}
|
|
54397
|
+
return false;
|
|
54398
|
+
}
|
|
54399
|
+
return sawHardChrome;
|
|
54400
|
+
}
|
|
54257
54401
|
function hasTrailingToolActivityAfterFinalAssistant(messages) {
|
|
54258
54402
|
if (!Array.isArray(messages) || messages.length === 0) return false;
|
|
54259
54403
|
let sawTrailingToolActivity = false;
|
|
@@ -54555,6 +54699,10 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
54555
54699
|
return (Array.isArray(messages) ? messages : []).filter((message) => classifyChatMessageVisibility(message).surface === surface);
|
|
54556
54700
|
}
|
|
54557
54701
|
var DEFAULT_FINAL_SUMMARY_MAX_CHARS;
|
|
54702
|
+
var FINAL_SUMMARY_CHROME_FALLBACK_MAX_DEPTH;
|
|
54703
|
+
var TRANSCRIPT_CHROME_HARD_LINE_PATTERNS;
|
|
54704
|
+
var TRANSCRIPT_CHROME_PANEL_LINE_PATTERNS;
|
|
54705
|
+
var TRANSCRIPT_CHROME_MAX_ORPHAN_LINES;
|
|
54558
54706
|
var BUILTIN_CHAT_MESSAGE_KINDS;
|
|
54559
54707
|
var CHAT_MESSAGE_VISIBILITIES;
|
|
54560
54708
|
var CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES;
|
|
@@ -54574,6 +54722,35 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
54574
54722
|
"use strict";
|
|
54575
54723
|
init_contracts2();
|
|
54576
54724
|
DEFAULT_FINAL_SUMMARY_MAX_CHARS = 16e3;
|
|
54725
|
+
FINAL_SUMMARY_CHROME_FALLBACK_MAX_DEPTH = 2;
|
|
54726
|
+
TRANSCRIPT_CHROME_HARD_LINE_PATTERNS = [
|
|
54727
|
+
// Bottom status bar: "auto K3 thinking: high ~/Work/adhdev main [±]"
|
|
54728
|
+
/\bauto\s+K\d+\s+thinking:\s*\S+/i,
|
|
54729
|
+
// Bottom status bar (older kimi-for-coding form) / context meter
|
|
54730
|
+
/\bkimi-for-coding(?:-highspeed)?\s+(?:thinking|idle)\b/i,
|
|
54731
|
+
/\bcontext:\s*\d+(?:\.\d+)?%/,
|
|
54732
|
+
// Collapsed-panel hints: "… +3 more (2 done) · ctrl+t to expand",
|
|
54733
|
+
// "(12 more lines, ctrl+o to expand)", "... (248 earlier lines)"
|
|
54734
|
+
/\bctrl\+t to expand\b/i,
|
|
54735
|
+
/\bctrl\+o to expand\b/i,
|
|
54736
|
+
/\(\d+\s+earlier lines\)/i,
|
|
54737
|
+
// Keybinding hints: "Press Ctrl+B to run in background", "↑ to edit · ctrl-s to steer immediately"
|
|
54738
|
+
/\bPress Ctrl\+B to run in background\b/i,
|
|
54739
|
+
/↑\s*to edit\b/,
|
|
54740
|
+
/\bctrl-s to steer\b/i,
|
|
54741
|
+
// Spinner frames: braille "⠦ thinking..." / moon-phase "🌕 · Tip: …"
|
|
54742
|
+
// (`u` flag: the moon glyphs are astral code points — a bare class only matches one
|
|
54743
|
+
// surrogate half and never fires)
|
|
54744
|
+
/^\s*[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏]\s*\S/u,
|
|
54745
|
+
/^\s*[🌑🌒🌓🌔🌕🌖🌗🌘]\s*·\s*Tip:/u,
|
|
54746
|
+
// Pure box-drawing horizontal rule framing a panel
|
|
54747
|
+
/^\s*[─━═]{8,}\s*$/
|
|
54748
|
+
];
|
|
54749
|
+
TRANSCRIPT_CHROME_PANEL_LINE_PATTERNS = [
|
|
54750
|
+
/^\s*Todo\s*$/i,
|
|
54751
|
+
/^\s*[○✓✗◌◯☐☑✔]\s+\S/
|
|
54752
|
+
];
|
|
54753
|
+
TRANSCRIPT_CHROME_MAX_ORPHAN_LINES = 1;
|
|
54577
54754
|
BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
|
|
54578
54755
|
CHAT_MESSAGE_VISIBILITIES = ["user", "debug", "internal", "hidden"];
|
|
54579
54756
|
CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES = ["visible", "chat", "user", "debug", "internal", "hidden"];
|
|
@@ -56230,6 +56407,86 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
56230
56407
|
CAT = "EvtTrace";
|
|
56231
56408
|
}
|
|
56232
56409
|
});
|
|
56410
|
+
function quotaEntryFor(node, providerType) {
|
|
56411
|
+
const facts = node?.nodeFacts;
|
|
56412
|
+
if (!facts || typeof facts !== "object") return null;
|
|
56413
|
+
const reportedAt = Number(facts.reportedAt);
|
|
56414
|
+
if (!Number.isFinite(reportedAt) || reportedAt <= 0) return null;
|
|
56415
|
+
const quota = facts.quota?.[providerType];
|
|
56416
|
+
if (!quota || typeof quota !== "object") return null;
|
|
56417
|
+
return { facts: { reportedAt }, quota };
|
|
56418
|
+
}
|
|
56419
|
+
function quotaSnapshotAgeMs(facts, quota, now = Date.now()) {
|
|
56420
|
+
const updatedAt = Number(quota.updatedAt);
|
|
56421
|
+
if (!Number.isFinite(updatedAt) || updatedAt <= 0) return Number.POSITIVE_INFINITY;
|
|
56422
|
+
return Math.max(0, now - facts.reportedAt) + Math.max(0, facts.reportedAt - updatedAt);
|
|
56423
|
+
}
|
|
56424
|
+
function isQuotaSnapshotFresh(facts, quota, policy, now = Date.now()) {
|
|
56425
|
+
return quotaSnapshotAgeMs(facts, quota, now) <= resolveQuotaRoutingPolicy(policy).staleAfterMs;
|
|
56426
|
+
}
|
|
56427
|
+
function remainingPercent(window) {
|
|
56428
|
+
if (!window) return void 0;
|
|
56429
|
+
const used = Number(window.usedPercent);
|
|
56430
|
+
if (!Number.isFinite(used)) return void 0;
|
|
56431
|
+
return Math.min(100, Math.max(0, 100 - used));
|
|
56432
|
+
}
|
|
56433
|
+
function evaluateProviderQuotaGate(node, providerType, policy, now = Date.now()) {
|
|
56434
|
+
const entry = quotaEntryFor(node, providerType);
|
|
56435
|
+
if (!entry) return null;
|
|
56436
|
+
const { facts, quota } = entry;
|
|
56437
|
+
if (quota.status !== "ok") return null;
|
|
56438
|
+
if (!isQuotaSnapshotFresh(facts, quota, policy, now)) return null;
|
|
56439
|
+
const resolved = resolveQuotaRoutingPolicy(policy);
|
|
56440
|
+
const session = remainingPercent(quota.session);
|
|
56441
|
+
if (session !== void 0 && session < resolved.sessionMinRemainingPercent) {
|
|
56442
|
+
return {
|
|
56443
|
+
reason: PROVIDER_QUOTA_SESSION_LOW_SKIP_REASON,
|
|
56444
|
+
window: "session",
|
|
56445
|
+
remainingPercent: session,
|
|
56446
|
+
thresholdPercent: resolved.sessionMinRemainingPercent
|
|
56447
|
+
};
|
|
56448
|
+
}
|
|
56449
|
+
const weekly = remainingPercent(quota.weekly);
|
|
56450
|
+
if (weekly !== void 0 && weekly < resolved.weeklyMinRemainingPercent) {
|
|
56451
|
+
return {
|
|
56452
|
+
reason: PROVIDER_QUOTA_WEEKLY_LOW_SKIP_REASON,
|
|
56453
|
+
window: "weekly",
|
|
56454
|
+
remainingPercent: weekly,
|
|
56455
|
+
thresholdPercent: resolved.weeklyMinRemainingPercent
|
|
56456
|
+
};
|
|
56457
|
+
}
|
|
56458
|
+
return null;
|
|
56459
|
+
}
|
|
56460
|
+
function quotaSpreadBonusByProvider(node, policy, now = Date.now()) {
|
|
56461
|
+
const resolved = resolveQuotaRoutingPolicy(policy);
|
|
56462
|
+
const facts = node?.nodeFacts;
|
|
56463
|
+
const quota = facts?.quota;
|
|
56464
|
+
const out = {};
|
|
56465
|
+
if (!quota || typeof quota !== "object") return out;
|
|
56466
|
+
const reportedAt = Number(facts.reportedAt);
|
|
56467
|
+
if (!Number.isFinite(reportedAt) || reportedAt <= 0) return out;
|
|
56468
|
+
for (const [provider, snapshot] of Object.entries(quota)) {
|
|
56469
|
+
let bonus = 0;
|
|
56470
|
+
if (snapshot && typeof snapshot === "object" && snapshot.status === "ok" && isQuotaSnapshotFresh({ reportedAt }, snapshot, policy, now)) {
|
|
56471
|
+
const ratios = [remainingPercent(snapshot.session), remainingPercent(snapshot.weekly)].filter((r) => r !== void 0).map((r) => r / 100);
|
|
56472
|
+
if (ratios.length) {
|
|
56473
|
+
bonus = Math.round(resolved.spreadBonusMax * Math.min(...ratios));
|
|
56474
|
+
}
|
|
56475
|
+
}
|
|
56476
|
+
out[provider] = bonus;
|
|
56477
|
+
}
|
|
56478
|
+
return out;
|
|
56479
|
+
}
|
|
56480
|
+
var PROVIDER_QUOTA_SESSION_LOW_SKIP_REASON;
|
|
56481
|
+
var PROVIDER_QUOTA_WEEKLY_LOW_SKIP_REASON;
|
|
56482
|
+
var init_mesh_quota_routing = __esm2({
|
|
56483
|
+
"src/mesh/mesh-quota-routing.ts"() {
|
|
56484
|
+
"use strict";
|
|
56485
|
+
init_repo_mesh_types();
|
|
56486
|
+
PROVIDER_QUOTA_SESSION_LOW_SKIP_REASON = "provider_quota_session_low";
|
|
56487
|
+
PROVIDER_QUOTA_WEEKLY_LOW_SKIP_REASON = "provider_quota_weekly_low";
|
|
56488
|
+
}
|
|
56489
|
+
});
|
|
56233
56490
|
function normalizeNodeIdKey(nodeId) {
|
|
56234
56491
|
return normalizeMeshNodeId({ id: nodeId ?? void 0 }) ?? "";
|
|
56235
56492
|
}
|
|
@@ -57208,7 +57465,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57208
57465
|
}));
|
|
57209
57466
|
return { pool, uniqueNodes };
|
|
57210
57467
|
}
|
|
57211
|
-
function scoreSlotForTask(slot, task) {
|
|
57468
|
+
function scoreSlotForTask(slot, task, quotaBonus = 0) {
|
|
57212
57469
|
let score = 1;
|
|
57213
57470
|
const diff = isMeshTaskDifficulty(task.difficulty) ? task.difficulty : void 0;
|
|
57214
57471
|
if (diff) {
|
|
@@ -57224,20 +57481,21 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57224
57481
|
const covered = req.every((t) => cap.has(t));
|
|
57225
57482
|
score += covered ? 30 : 0;
|
|
57226
57483
|
}
|
|
57484
|
+
score += quotaBonus;
|
|
57227
57485
|
return score;
|
|
57228
57486
|
}
|
|
57229
|
-
function bestSlotForTask(node, task, meshId) {
|
|
57487
|
+
function bestSlotForTask(node, task, meshId, quotaBonusByProvider) {
|
|
57230
57488
|
const slots = resolveNodeCapabilitySlots(node, meshId);
|
|
57231
57489
|
if (!slots.length) return null;
|
|
57232
57490
|
let best = null;
|
|
57233
57491
|
for (const slot of slots) {
|
|
57234
|
-
const score = scoreSlotForTask(slot, task);
|
|
57492
|
+
const score = scoreSlotForTask(slot, task, quotaBonusByProvider?.[slot.provider] ?? 0);
|
|
57235
57493
|
if (!best || score > best.score) best = { slot, score };
|
|
57236
57494
|
}
|
|
57237
57495
|
return best;
|
|
57238
57496
|
}
|
|
57239
|
-
function nodeFitnessForTask(node, task, meshId) {
|
|
57240
|
-
return bestSlotForTask(node, task, meshId)?.score ?? 0;
|
|
57497
|
+
function nodeFitnessForTask(node, task, meshId, quotaBonusByProvider) {
|
|
57498
|
+
return bestSlotForTask(node, task, meshId, quotaBonusByProvider)?.score ?? 0;
|
|
57241
57499
|
}
|
|
57242
57500
|
function slotCoversTaskDifficulty(slot, difficulty) {
|
|
57243
57501
|
if (!slot) return false;
|
|
@@ -57257,8 +57515,17 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57257
57515
|
}
|
|
57258
57516
|
if (strategy === "fitness" && opts?.task) {
|
|
57259
57517
|
const task = opts.task;
|
|
57518
|
+
const bonusCache = /* @__PURE__ */ new Map();
|
|
57519
|
+
const bonusFor = (c) => {
|
|
57520
|
+
let bonus = bonusCache.get(c.nodeId);
|
|
57521
|
+
if (!bonus) {
|
|
57522
|
+
bonus = quotaSpreadBonusByProvider(c.node, opts.quotaRouting);
|
|
57523
|
+
bonusCache.set(c.nodeId, bonus);
|
|
57524
|
+
}
|
|
57525
|
+
return bonus;
|
|
57526
|
+
};
|
|
57260
57527
|
return [...nodes].sort((a, b) => {
|
|
57261
|
-
const fitDelta = nodeFitnessForTask(b.node, task, meshId) - nodeFitnessForTask(a.node, task, meshId);
|
|
57528
|
+
const fitDelta = nodeFitnessForTask(b.node, task, meshId, bonusFor(b)) - nodeFitnessForTask(a.node, task, meshId, bonusFor(a));
|
|
57262
57529
|
if (fitDelta !== 0) return fitDelta;
|
|
57263
57530
|
const prioDelta = resolveNodeSchedulingPriority(b.node?.policy) - resolveNodeSchedulingPriority(a.node?.policy);
|
|
57264
57531
|
if (prioDelta !== 0) return prioDelta;
|
|
@@ -57431,12 +57698,13 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57431
57698
|
retractActionableSkipIfPreviouslyNotified(meshId, taskId);
|
|
57432
57699
|
}
|
|
57433
57700
|
}
|
|
57434
|
-
async function resolveUsableProvider(components, nodeId, node, meshId, requiredTags, task) {
|
|
57701
|
+
async function resolveUsableProvider(components, nodeId, node, meshId, requiredTags, task, quotaRouting) {
|
|
57435
57702
|
const providerLoader = components.providerLoader;
|
|
57436
57703
|
if (!providerLoader) return { reason: "provider_loader_unavailable" };
|
|
57437
57704
|
const slots = resolveNodeCapabilitySlots(node, meshId);
|
|
57438
57705
|
if (!slots.length) return { reason: "missing_provider_priority" };
|
|
57439
|
-
const
|
|
57706
|
+
const quotaBonusByProvider = task ? quotaSpreadBonusByProvider(node, quotaRouting) : void 0;
|
|
57707
|
+
const orderedSlots = task ? [...slots].sort((a, b) => scoreSlotForTask(b, task, quotaBonusByProvider?.[b.provider] ?? 0) - scoreSlotForTask(a, task, quotaBonusByProvider?.[a.provider] ?? 0)) : slots;
|
|
57440
57708
|
const failed = [];
|
|
57441
57709
|
for (const slot of orderedSlots) {
|
|
57442
57710
|
const requestedType = slot.provider;
|
|
@@ -57639,8 +57907,10 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57639
57907
|
strategy,
|
|
57640
57908
|
candidateNodes.map((node, index) => ({ nodeId: readMeshNodeId(node), node, index })).filter((c) => c.nodeId),
|
|
57641
57909
|
// Auto-launch drains one task at a time, so the task IS in scope here —
|
|
57642
|
-
// pass it through for the 'fitness' strategy's task→slot ranking.
|
|
57643
|
-
|
|
57910
|
+
// pass it through for the 'fitness' strategy's task→slot ranking. The
|
|
57911
|
+
// mesh's quotaRouting thresholds ride along so the fitness score can
|
|
57912
|
+
// include the quota-headroom spread bonus (fail-open when unset).
|
|
57913
|
+
{ bumpCursor: true, task: { difficulty: task.difficulty, requiredTags: task.requiredTags }, quotaRouting: mesh?.policy?.quotaRouting ?? null }
|
|
57644
57914
|
).map((c) => c.node);
|
|
57645
57915
|
const skippedCandidates = [];
|
|
57646
57916
|
const SKIPPED_CANDIDATES_MAX = 12;
|
|
@@ -57699,11 +57969,17 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57699
57969
|
}
|
|
57700
57970
|
autoLaunchInProgress.add(launchKey);
|
|
57701
57971
|
try {
|
|
57702
|
-
const resolved = await resolveUsableProvider(components, nodeId, node, meshId, task.requiredTags, { difficulty: task.difficulty, requiredTags: task.requiredTags });
|
|
57972
|
+
const resolved = await resolveUsableProvider(components, nodeId, node, meshId, task.requiredTags, { difficulty: task.difficulty, requiredTags: task.requiredTags }, mesh?.policy?.quotaRouting ?? null);
|
|
57703
57973
|
if (!resolved.providerType) {
|
|
57704
57974
|
markSkip(nodeId, resolved.reason || "provider_unusable");
|
|
57705
57975
|
continue;
|
|
57706
57976
|
}
|
|
57977
|
+
const quotaBlock = evaluateProviderQuotaGate(node, resolved.providerType, mesh?.policy?.quotaRouting ?? null);
|
|
57978
|
+
if (quotaBlock) {
|
|
57979
|
+
LOG2.info("MeshQueue", `QUOTA GATE: provider '${resolved.providerType}' on node ${nodeId} has ${quotaBlock.remainingPercent.toFixed(1)}% ${quotaBlock.window} quota remaining (< ${quotaBlock.thresholdPercent}% threshold, task ${task.id}); leaving the task queued until the window resets`);
|
|
57980
|
+
markSkip(nodeId, quotaBlock.reason, { providerType: resolved.providerType });
|
|
57981
|
+
continue;
|
|
57982
|
+
}
|
|
57707
57983
|
const slotCoversDifficulty = slotCoversTaskDifficulty(resolved.slot, task.difficulty);
|
|
57708
57984
|
const requestedModel = resolveLaunchAxis(task.model, task.modelSource, resolved.model, slotCoversDifficulty);
|
|
57709
57985
|
const effectiveThinkingLevel = resolveLaunchAxis(task.thinkingLevel, task.thinkingLevelSource, resolved.thinkingLevel, slotCoversDifficulty);
|
|
@@ -57822,7 +58098,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57822
58098
|
const requiredTags = Array.isArray(task.requiredTags) ? task.requiredTags.filter((t) => !!t) : [];
|
|
57823
58099
|
const routingDecision = {
|
|
57824
58100
|
source: "autoLaunch",
|
|
57825
|
-
fitnessScore: nodeFitnessForTask(node, { difficulty: task.difficulty, requiredTags: task.requiredTags }, meshId),
|
|
58101
|
+
fitnessScore: nodeFitnessForTask(node, { difficulty: task.difficulty, requiredTags: task.requiredTags }, meshId, quotaSpreadBonusByProvider(node, mesh?.policy?.quotaRouting ?? null)),
|
|
57826
58102
|
...skippedCandidates.length ? { skippedCandidates } : {},
|
|
57827
58103
|
requiredTagsResult: {
|
|
57828
58104
|
required: requiredTags,
|
|
@@ -58258,6 +58534,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
58258
58534
|
init_mesh_json_config();
|
|
58259
58535
|
init_dist();
|
|
58260
58536
|
init_mesh_node_slots();
|
|
58537
|
+
init_mesh_quota_routing();
|
|
58261
58538
|
init_mesh_events_stale();
|
|
58262
58539
|
init_mesh_events_utils();
|
|
58263
58540
|
init_mesh_node_identity();
|
|
@@ -58306,6 +58583,10 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
58306
58583
|
// busy counterpart SLOT_MODEL_BUSY_SKIP_REASON is deliberately NOT listed:
|
|
58307
58584
|
// that one clears on its own when the slot goes idle.
|
|
58308
58585
|
SLOT_MODEL_ABSENT_SKIP_REASON
|
|
58586
|
+
// QUOTA GATE: 'provider_quota_session_low' / 'provider_quota_weekly_low' are
|
|
58587
|
+
// deliberately NOT listed either — an exhausted quota window RESETS, so the
|
|
58588
|
+
// block self-resolves exactly like the slot-busy case; the task waits in the
|
|
58589
|
+
// queue and the coordinator is not paged (mesh-quota-routing.ts).
|
|
58309
58590
|
];
|
|
58310
58591
|
TRANSIENT_TARGET_NODE_BOOTSTRAP_PENDING_REASON = "target_node_bootstrap_pending";
|
|
58311
58592
|
lastActionableSkipNotified = /* @__PURE__ */ new Map();
|
|
@@ -58572,7 +58853,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
58572
58853
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
58573
58854
|
}
|
|
58574
58855
|
function getStatePath() {
|
|
58575
|
-
return (0,
|
|
58856
|
+
return (0, import_path14.join)(getConfigDir2(), "state.json");
|
|
58576
58857
|
}
|
|
58577
58858
|
function normalizeState(raw) {
|
|
58578
58859
|
const parsed = isPlainObject22(raw) ? raw : {};
|
|
@@ -58677,13 +58958,13 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
58677
58958
|
saveState({ ...state, deferredRestartSchedules: next });
|
|
58678
58959
|
}
|
|
58679
58960
|
var import_fs16;
|
|
58680
|
-
var
|
|
58961
|
+
var import_path14;
|
|
58681
58962
|
var DEFAULT_STATE;
|
|
58682
58963
|
var init_state_store = __esm2({
|
|
58683
58964
|
"src/config/state-store.ts"() {
|
|
58684
58965
|
"use strict";
|
|
58685
58966
|
import_fs16 = require("fs");
|
|
58686
|
-
|
|
58967
|
+
import_path14 = require("path");
|
|
58687
58968
|
init_config();
|
|
58688
58969
|
DEFAULT_STATE = {
|
|
58689
58970
|
recentActivity: [],
|
|
@@ -58698,7 +58979,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
58698
58979
|
}
|
|
58699
58980
|
});
|
|
58700
58981
|
async function updateDarwinMemoryCache() {
|
|
58701
|
-
if (
|
|
58982
|
+
if (os9.platform() !== "darwin") return;
|
|
58702
58983
|
try {
|
|
58703
58984
|
const { stdout } = await execAsync2("vm_stat", {
|
|
58704
58985
|
encoding: "utf-8",
|
|
@@ -58722,26 +59003,26 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
58722
59003
|
const fileBacked = counts["file_backed"] ?? 0;
|
|
58723
59004
|
const availPages = free + inactive + speculative + purgeable + fileBacked;
|
|
58724
59005
|
const bytes = availPages * pageSize;
|
|
58725
|
-
cachedDarwinAvail = Number.isFinite(bytes) && bytes >= 0 ? Math.min(bytes,
|
|
59006
|
+
cachedDarwinAvail = Number.isFinite(bytes) && bytes >= 0 ? Math.min(bytes, os9.totalmem()) : null;
|
|
58726
59007
|
} catch {
|
|
58727
59008
|
}
|
|
58728
59009
|
}
|
|
58729
59010
|
function getHostMemorySnapshot() {
|
|
58730
|
-
if (
|
|
59011
|
+
if (os9.platform() === "darwin" && !darwinMemoryInterval) {
|
|
58731
59012
|
updateDarwinMemoryCache();
|
|
58732
59013
|
darwinMemoryInterval = setInterval(updateDarwinMemoryCache, 3e3);
|
|
58733
59014
|
darwinMemoryInterval.unref();
|
|
58734
59015
|
}
|
|
58735
|
-
const totalMem =
|
|
58736
|
-
const freeMem =
|
|
58737
|
-
const availableMem =
|
|
59016
|
+
const totalMem = os9.totalmem();
|
|
59017
|
+
const freeMem = os9.freemem();
|
|
59018
|
+
const availableMem = os9.platform() === "darwin" ? cachedDarwinAvail ?? freeMem : freeMem;
|
|
58738
59019
|
return {
|
|
58739
59020
|
totalMem,
|
|
58740
59021
|
freeMem,
|
|
58741
59022
|
availableMem
|
|
58742
59023
|
};
|
|
58743
59024
|
}
|
|
58744
|
-
var
|
|
59025
|
+
var os9;
|
|
58745
59026
|
var import_child_process4;
|
|
58746
59027
|
var import_util3;
|
|
58747
59028
|
var execAsync2;
|
|
@@ -58750,7 +59031,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
58750
59031
|
var init_host_memory = __esm2({
|
|
58751
59032
|
"src/system/host-memory.ts"() {
|
|
58752
59033
|
"use strict";
|
|
58753
|
-
|
|
59034
|
+
os9 = __toESM2(require("os"));
|
|
58754
59035
|
import_child_process4 = require("child_process");
|
|
58755
59036
|
import_util3 = require("util");
|
|
58756
59037
|
execAsync2 = (0, import_util3.promisify)(import_child_process4.exec);
|
|
@@ -59889,8 +60170,8 @@ ${cleanBody}`;
|
|
|
59889
60170
|
}
|
|
59890
60171
|
function buildMachineInfo2(profile = "full") {
|
|
59891
60172
|
const base = {
|
|
59892
|
-
hostname:
|
|
59893
|
-
platform:
|
|
60173
|
+
hostname: os10.hostname(),
|
|
60174
|
+
platform: os10.platform()
|
|
59894
60175
|
};
|
|
59895
60176
|
if (profile === "live") {
|
|
59896
60177
|
return base;
|
|
@@ -59899,23 +60180,23 @@ ${cleanBody}`;
|
|
|
59899
60180
|
const memSnap2 = getHostMemorySnapshot();
|
|
59900
60181
|
return {
|
|
59901
60182
|
...base,
|
|
59902
|
-
arch:
|
|
59903
|
-
cpus:
|
|
60183
|
+
arch: os10.arch(),
|
|
60184
|
+
cpus: os10.cpus().length,
|
|
59904
60185
|
totalMem: memSnap2.totalMem,
|
|
59905
|
-
release:
|
|
60186
|
+
release: os10.release()
|
|
59906
60187
|
};
|
|
59907
60188
|
}
|
|
59908
60189
|
const memSnap = getHostMemorySnapshot();
|
|
59909
60190
|
return {
|
|
59910
60191
|
...base,
|
|
59911
|
-
arch:
|
|
59912
|
-
cpus:
|
|
60192
|
+
arch: os10.arch(),
|
|
60193
|
+
cpus: os10.cpus().length,
|
|
59913
60194
|
totalMem: memSnap.totalMem,
|
|
59914
60195
|
freeMem: memSnap.freeMem,
|
|
59915
60196
|
availableMem: memSnap.availableMem,
|
|
59916
|
-
loadavg:
|
|
59917
|
-
uptime:
|
|
59918
|
-
release:
|
|
60197
|
+
loadavg: os10.loadavg(),
|
|
60198
|
+
uptime: os10.uptime(),
|
|
60199
|
+
release: os10.release()
|
|
59919
60200
|
};
|
|
59920
60201
|
}
|
|
59921
60202
|
function parseMessageTime(value) {
|
|
@@ -60152,13 +60433,13 @@ ${cleanBody}`;
|
|
|
60152
60433
|
}
|
|
60153
60434
|
};
|
|
60154
60435
|
}
|
|
60155
|
-
var
|
|
60436
|
+
var os10;
|
|
60156
60437
|
var READ_DEBUG_ENABLED;
|
|
60157
60438
|
var recentReadDebugSignatureBySession;
|
|
60158
60439
|
var init_snapshot2 = __esm2({
|
|
60159
60440
|
"src/status/snapshot.ts"() {
|
|
60160
60441
|
"use strict";
|
|
60161
|
-
|
|
60442
|
+
os10 = __toESM2(require("os"));
|
|
60162
60443
|
init_config();
|
|
60163
60444
|
init_state_store();
|
|
60164
60445
|
init_recent_activity();
|
|
@@ -62448,7 +62729,7 @@ ${cleanBody}`;
|
|
|
62448
62729
|
return [];
|
|
62449
62730
|
}
|
|
62450
62731
|
for (const name of names) {
|
|
62451
|
-
const path54 = (0,
|
|
62732
|
+
const path54 = (0, import_path15.join)(dir, name);
|
|
62452
62733
|
try {
|
|
62453
62734
|
const st = (0, import_fs17.statSync)(path54);
|
|
62454
62735
|
if (st.isFile()) out.push({ path: path54, mtimeMs: st.mtimeMs });
|
|
@@ -62476,7 +62757,7 @@ ${cleanBody}`;
|
|
|
62476
62757
|
return deleted;
|
|
62477
62758
|
}
|
|
62478
62759
|
function pruneExpiredSessionHostRuntimes(now = Date.now()) {
|
|
62479
|
-
const root = (0,
|
|
62760
|
+
const root = (0, import_path15.join)(getConfigDir2(), "session-host");
|
|
62480
62761
|
if (!(0, import_fs17.existsSync)(root)) return 0;
|
|
62481
62762
|
let apps;
|
|
62482
62763
|
try {
|
|
@@ -62486,7 +62767,7 @@ ${cleanBody}`;
|
|
|
62486
62767
|
}
|
|
62487
62768
|
const candidates = [];
|
|
62488
62769
|
for (const app of apps) {
|
|
62489
|
-
const runtimesDir = (0,
|
|
62770
|
+
const runtimesDir = (0, import_path15.join)(root, app, "runtimes");
|
|
62490
62771
|
if (!(0, import_fs17.existsSync)(runtimesDir)) continue;
|
|
62491
62772
|
for (const f of listDirFiles(runtimesDir)) {
|
|
62492
62773
|
if (!f.path.endsWith(".json")) continue;
|
|
@@ -62590,7 +62871,7 @@ ${cleanBody}`;
|
|
|
62590
62871
|
return signalled;
|
|
62591
62872
|
}
|
|
62592
62873
|
var import_fs17;
|
|
62593
|
-
var
|
|
62874
|
+
var import_path15;
|
|
62594
62875
|
var DAY_MS2;
|
|
62595
62876
|
var LEDGER_JSONL_MAX_AGE_MS;
|
|
62596
62877
|
var SESSION_HOST_RUNTIME_MAX_AGE_MS;
|
|
@@ -62600,7 +62881,7 @@ ${cleanBody}`;
|
|
|
62600
62881
|
"src/mesh/mesh-disk-retention.ts"() {
|
|
62601
62882
|
"use strict";
|
|
62602
62883
|
import_fs17 = require("fs");
|
|
62603
|
-
|
|
62884
|
+
import_path15 = require("path");
|
|
62604
62885
|
init_config();
|
|
62605
62886
|
init_mesh_ledger();
|
|
62606
62887
|
init_runtime_surface();
|
|
@@ -62614,7 +62895,7 @@ ${cleanBody}`;
|
|
|
62614
62895
|
}
|
|
62615
62896
|
});
|
|
62616
62897
|
function retentionStatePath() {
|
|
62617
|
-
return (0,
|
|
62898
|
+
return (0, import_path16.join)(getLedgerDir(), "worktree-node-retention-state.json");
|
|
62618
62899
|
}
|
|
62619
62900
|
function stateKey(meshId, nodeId) {
|
|
62620
62901
|
return `${meshId}::${nodeId}`;
|
|
@@ -62679,7 +62960,7 @@ ${cleanBody}`;
|
|
|
62679
62960
|
return String(stdout || "");
|
|
62680
62961
|
}
|
|
62681
62962
|
function normalizePathForCompare(value) {
|
|
62682
|
-
const resolved = (0,
|
|
62963
|
+
const resolved = (0, import_path16.resolve)(value);
|
|
62683
62964
|
try {
|
|
62684
62965
|
return fs11.realpathSync(resolved);
|
|
62685
62966
|
} catch {
|
|
@@ -62732,7 +63013,7 @@ ${cleanBody}`;
|
|
|
62732
63013
|
if (workspace && ctx.processCwd) {
|
|
62733
63014
|
const normalizedWorkspace = normalizePathForCompare(workspace);
|
|
62734
63015
|
const normalizedCwd = normalizePathForCompare(ctx.processCwd);
|
|
62735
|
-
if (normalizedCwd === normalizedWorkspace || normalizedCwd.startsWith(normalizedWorkspace +
|
|
63016
|
+
if (normalizedCwd === normalizedWorkspace || normalizedCwd.startsWith(normalizedWorkspace + import_path16.sep)) {
|
|
62736
63017
|
return skip("process_cwd_reference", "Worktree path is (or contains) the current process working directory; an open-runtime/cwd reference blocks removal.");
|
|
62737
63018
|
}
|
|
62738
63019
|
}
|
|
@@ -63096,7 +63377,7 @@ ${cleanBody}`;
|
|
|
63096
63377
|
}
|
|
63097
63378
|
var fs11;
|
|
63098
63379
|
var import_os22;
|
|
63099
|
-
var
|
|
63380
|
+
var import_path16;
|
|
63100
63381
|
var LOG_CATEGORY;
|
|
63101
63382
|
var metrics2;
|
|
63102
63383
|
var init_mesh_worktree_retention = __esm2({
|
|
@@ -63104,7 +63385,7 @@ ${cleanBody}`;
|
|
|
63104
63385
|
"use strict";
|
|
63105
63386
|
fs11 = __toESM2(require("fs"));
|
|
63106
63387
|
import_os22 = require("os");
|
|
63107
|
-
|
|
63388
|
+
import_path16 = require("path");
|
|
63108
63389
|
init_dist();
|
|
63109
63390
|
init_logger();
|
|
63110
63391
|
init_config();
|
|
@@ -66789,14 +67070,14 @@ ${cleanBody}`;
|
|
|
66789
67070
|
}
|
|
66790
67071
|
return cachedPty;
|
|
66791
67072
|
}
|
|
66792
|
-
var
|
|
67073
|
+
var os13;
|
|
66793
67074
|
var cachedPty;
|
|
66794
67075
|
var NodePtyRuntimeTransport;
|
|
66795
67076
|
var NodePtyTransportFactory;
|
|
66796
67077
|
var init_pty_transport = __esm2({
|
|
66797
67078
|
"src/cli-adapters/pty-transport.ts"() {
|
|
66798
67079
|
"use strict";
|
|
66799
|
-
|
|
67080
|
+
os13 = __toESM2(require("os"));
|
|
66800
67081
|
init_spawn_env();
|
|
66801
67082
|
init_resolve_executable();
|
|
66802
67083
|
NodePtyRuntimeTransport = class {
|
|
@@ -66836,9 +67117,9 @@ ${cleanBody}`;
|
|
|
66836
67117
|
try {
|
|
66837
67118
|
const fs53 = require("fs");
|
|
66838
67119
|
const stat2 = fs53.statSync(cwd);
|
|
66839
|
-
if (!stat2.isDirectory()) cwd =
|
|
67120
|
+
if (!stat2.isDirectory()) cwd = os13.homedir();
|
|
66840
67121
|
} catch {
|
|
66841
|
-
cwd =
|
|
67122
|
+
cwd = os13.homedir();
|
|
66842
67123
|
}
|
|
66843
67124
|
}
|
|
66844
67125
|
const handle = pty.spawn(resolveWin32Executable(command), args, {
|
|
@@ -69301,7 +69582,7 @@ ${cont}` : cont;
|
|
|
69301
69582
|
function resolveCliSpawnPlanFromParts(options) {
|
|
69302
69583
|
const { command, baseArgs, shell, baseEnv, workingDir, extraArgs, extraEnv, geometry, diagnosticCliType, diagnosticProviderVersion } = options;
|
|
69303
69584
|
const binaryPath = findBinary(command);
|
|
69304
|
-
const isWin =
|
|
69585
|
+
const isWin = os14.platform() === "win32";
|
|
69305
69586
|
const allArgs = [...baseArgs ?? [], ...extraArgs ?? []].map(
|
|
69306
69587
|
(arg) => typeof arg === "string" ? arg.replace(/\{\{workingDir\}\}/g, workingDir) : arg
|
|
69307
69588
|
);
|
|
@@ -69389,13 +69670,13 @@ ${cont}` : cont;
|
|
|
69389
69670
|
}
|
|
69390
69671
|
return "";
|
|
69391
69672
|
}
|
|
69392
|
-
var
|
|
69673
|
+
var os14;
|
|
69393
69674
|
var path27;
|
|
69394
69675
|
var import_session_host_core7;
|
|
69395
69676
|
var init_provider_cli_runtime = __esm2({
|
|
69396
69677
|
"src/cli-adapters/provider-cli-runtime.ts"() {
|
|
69397
69678
|
"use strict";
|
|
69398
|
-
|
|
69679
|
+
os14 = __toESM2(require("os"));
|
|
69399
69680
|
path27 = __toESM2(require("path"));
|
|
69400
69681
|
init_logger();
|
|
69401
69682
|
import_session_host_core7 = require_dist();
|
|
@@ -69510,6 +69791,13 @@ ${cont}` : cont;
|
|
|
69510
69791
|
out.sort((a, b) => b.lastMessageAt - a.lastMessageAt);
|
|
69511
69792
|
return out;
|
|
69512
69793
|
}
|
|
69794
|
+
function toPosixPath(p) {
|
|
69795
|
+
return p.replace(/\\/g, "/");
|
|
69796
|
+
}
|
|
69797
|
+
function splitTemplateDirLeaf(expandedRoot) {
|
|
69798
|
+
const idx = expandedRoot.lastIndexOf("/");
|
|
69799
|
+
return idx >= 0 ? { dirPart: expandedRoot.slice(0, idx), leaf: expandedRoot.slice(idx + 1) } : { dirPart: "", leaf: expandedRoot };
|
|
69800
|
+
}
|
|
69513
69801
|
function enumerateSessionFiles(src, input) {
|
|
69514
69802
|
const expandedRoot = expandTemplateRootForEnumeration(src.path, input);
|
|
69515
69803
|
if (!expandedRoot) return [];
|
|
@@ -69519,9 +69807,7 @@ ${cont}` : cont;
|
|
|
69519
69807
|
dirTemplate = templateVarsToGlob(expandedRoot);
|
|
69520
69808
|
fileRegex = globToRegex(src.file_pattern);
|
|
69521
69809
|
} else {
|
|
69522
|
-
const
|
|
69523
|
-
const dirPart = idx >= 0 ? expandedRoot.slice(0, idx) : "";
|
|
69524
|
-
const leaf = idx >= 0 ? expandedRoot.slice(idx + 1) : expandedRoot;
|
|
69810
|
+
const { dirPart, leaf } = splitTemplateDirLeaf(expandedRoot);
|
|
69525
69811
|
dirTemplate = templateVarsToGlob(dirPart);
|
|
69526
69812
|
fileRegex = globToRegex(templateVarsToGlob(leaf));
|
|
69527
69813
|
}
|
|
@@ -69534,14 +69820,17 @@ ${cont}` : cont;
|
|
|
69534
69820
|
}
|
|
69535
69821
|
function expandTemplateRootForEnumeration(template, input) {
|
|
69536
69822
|
if (!template) return "";
|
|
69823
|
+
const posixHome = () => toPosixPath(os15.homedir());
|
|
69537
69824
|
let out = template;
|
|
69538
|
-
if (out
|
|
69825
|
+
if (out === "~") out = posixHome();
|
|
69826
|
+
else if (out.startsWith("~/")) out = `${posixHome()}/${out.slice(2)}`;
|
|
69539
69827
|
out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
|
|
69540
69828
|
const v = input.envOverrides?.[name] ?? process.env[name];
|
|
69541
69829
|
return v != null && v !== "" ? v : fallback ?? "";
|
|
69542
69830
|
});
|
|
69543
|
-
if (out
|
|
69544
|
-
|
|
69831
|
+
if (out === "~") out = posixHome();
|
|
69832
|
+
else if (out.startsWith("~/")) out = `${posixHome()}/${out.slice(2)}`;
|
|
69833
|
+
return toPosixPath(out);
|
|
69545
69834
|
}
|
|
69546
69835
|
function templateVarsToGlob(template) {
|
|
69547
69836
|
return template.replace(/\{[a-zA-Z_][a-zA-Z0-9_]*\}/g, "*");
|
|
@@ -70089,13 +70378,13 @@ ${cont}` : cont;
|
|
|
70089
70378
|
if (!template) return null;
|
|
70090
70379
|
let out = template;
|
|
70091
70380
|
if (out.startsWith("~/") || out === "~") {
|
|
70092
|
-
out = path28.join(
|
|
70381
|
+
out = path28.join(os15.homedir(), out.slice(2));
|
|
70093
70382
|
}
|
|
70094
70383
|
out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
|
|
70095
70384
|
const v = input.envOverrides?.[name] ?? process.env[name];
|
|
70096
70385
|
return v != null && v !== "" ? v : fallback ?? "";
|
|
70097
70386
|
});
|
|
70098
|
-
if (out.startsWith("~/")) out = path28.join(
|
|
70387
|
+
if (out.startsWith("~/")) out = path28.join(os15.homedir(), out.slice(2));
|
|
70099
70388
|
const now = /* @__PURE__ */ new Date();
|
|
70100
70389
|
const workspaceRaw = input.workspace ?? "";
|
|
70101
70390
|
let workspaceResolved = workspaceRaw;
|
|
@@ -70126,17 +70415,20 @@ ${cont}` : cont;
|
|
|
70126
70415
|
function claudeProjectDirName(workspace) {
|
|
70127
70416
|
return workspace.replace(/[^A-Za-z0-9_-]/g, "-");
|
|
70128
70417
|
}
|
|
70129
|
-
function
|
|
70130
|
-
|
|
70131
|
-
let head = template;
|
|
70132
|
-
if (head.startsWith("~/") || head === "~") head = path28.join(os16.homedir(), head.slice(2));
|
|
70133
|
-
const segs = head.split("/");
|
|
70418
|
+
function staticTemplateBase(templateHead) {
|
|
70419
|
+
const segs = toPosixPath(templateHead).split("/");
|
|
70134
70420
|
const baseParts = [];
|
|
70135
70421
|
for (const seg of segs) {
|
|
70136
70422
|
if (/[{}*?]/.test(seg)) break;
|
|
70137
70423
|
baseParts.push(seg);
|
|
70138
70424
|
}
|
|
70139
|
-
|
|
70425
|
+
return baseParts.join("/");
|
|
70426
|
+
}
|
|
70427
|
+
function scanProjectsRootForSessionFile(template, input, requestedSessionId) {
|
|
70428
|
+
if (!requestedSessionId) return null;
|
|
70429
|
+
let head = template;
|
|
70430
|
+
if (head.startsWith("~/") || head === "~") head = path28.join(os15.homedir(), head.slice(2));
|
|
70431
|
+
const base = staticTemplateBase(head);
|
|
70140
70432
|
if (!base) return null;
|
|
70141
70433
|
let baseStat = null;
|
|
70142
70434
|
try {
|
|
@@ -70174,11 +70466,16 @@ ${cont}` : cont;
|
|
|
70174
70466
|
const re = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]");
|
|
70175
70467
|
return new RegExp(`^${re}$`);
|
|
70176
70468
|
}
|
|
70469
|
+
function splitTemplateRoot(template) {
|
|
70470
|
+
const parts = toPosixPath(template).split("/");
|
|
70471
|
+
if (parts[0] === "") return { root: "/", segments: parts.slice(1) };
|
|
70472
|
+
if (/^[A-Za-z]:$/.test(parts[0])) return { root: `${parts[0]}/`, segments: parts.slice(1) };
|
|
70473
|
+
return { root: parts[0], segments: parts.slice(1) };
|
|
70474
|
+
}
|
|
70177
70475
|
function expandDirGlob(template) {
|
|
70178
|
-
const
|
|
70179
|
-
let dirs =
|
|
70180
|
-
for (
|
|
70181
|
-
const seg = parts[i];
|
|
70476
|
+
const { root, segments } = splitTemplateRoot(template);
|
|
70477
|
+
let dirs = [root];
|
|
70478
|
+
for (const seg of segments) {
|
|
70182
70479
|
if (!seg) continue;
|
|
70183
70480
|
const next = [];
|
|
70184
70481
|
if (seg === "**") {
|
|
@@ -70279,13 +70576,13 @@ ${cont}` : cont;
|
|
|
70279
70576
|
if (!template) return null;
|
|
70280
70577
|
let out = template;
|
|
70281
70578
|
if (out.startsWith("~/") || out === "~") {
|
|
70282
|
-
out = path28.join(
|
|
70579
|
+
out = path28.join(os15.homedir(), out.slice(2));
|
|
70283
70580
|
}
|
|
70284
70581
|
out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
|
|
70285
70582
|
const v = input.envOverrides?.[name] ?? process.env[name];
|
|
70286
70583
|
return v != null && v !== "" ? v : fallback ?? "";
|
|
70287
70584
|
});
|
|
70288
|
-
if (out.startsWith("~/")) out = path28.join(
|
|
70585
|
+
if (out.startsWith("~/")) out = path28.join(os15.homedir(), out.slice(2));
|
|
70289
70586
|
const workspaceRaw = input.workspace ?? "";
|
|
70290
70587
|
let workspaceResolved = workspaceRaw;
|
|
70291
70588
|
if (workspaceRaw) {
|
|
@@ -70744,7 +71041,7 @@ ${cont}` : cont;
|
|
|
70744
71041
|
return t.negate ? !result : result;
|
|
70745
71042
|
}
|
|
70746
71043
|
var fs222;
|
|
70747
|
-
var
|
|
71044
|
+
var os15;
|
|
70748
71045
|
var path28;
|
|
70749
71046
|
var UUID_RE;
|
|
70750
71047
|
var DEFAULT_TOOL_CALL_TYPES;
|
|
@@ -70753,7 +71050,7 @@ ${cont}` : cont;
|
|
|
70753
71050
|
"src/providers/spec/native-history-executor.ts"() {
|
|
70754
71051
|
"use strict";
|
|
70755
71052
|
fs222 = __toESM2(require("fs"));
|
|
70756
|
-
|
|
71053
|
+
os15 = __toESM2(require("os"));
|
|
70757
71054
|
path28 = __toESM2(require("path"));
|
|
70758
71055
|
init_logger();
|
|
70759
71056
|
init_load_better_sqlite3();
|
|
@@ -71049,7 +71346,7 @@ ${cont}` : cont;
|
|
|
71049
71346
|
missingBackgroundSourceWarned.add(cliType);
|
|
71050
71347
|
LOG2.warn("CLI", `[${cliType}] background-task tracking declared but nativeHistory.source missing after provider resolve; background detection inactive`);
|
|
71051
71348
|
}
|
|
71052
|
-
var
|
|
71349
|
+
var os16;
|
|
71053
71350
|
var import_crypto11;
|
|
71054
71351
|
var import_session_host_core8;
|
|
71055
71352
|
var missingBackgroundSourceWarned;
|
|
@@ -71058,7 +71355,7 @@ ${cont}` : cont;
|
|
|
71058
71355
|
var init_provider_cli_adapter = __esm2({
|
|
71059
71356
|
"src/cli-adapters/provider-cli-adapter.ts"() {
|
|
71060
71357
|
"use strict";
|
|
71061
|
-
|
|
71358
|
+
os16 = __toESM2(require("os"));
|
|
71062
71359
|
import_crypto11 = require("crypto");
|
|
71063
71360
|
init_logger();
|
|
71064
71361
|
init_debug_config();
|
|
@@ -71085,7 +71382,7 @@ ${cont}` : cont;
|
|
|
71085
71382
|
this.transportFactory = transportFactory;
|
|
71086
71383
|
this.cliType = provider.type;
|
|
71087
71384
|
this.cliName = provider.name;
|
|
71088
|
-
this.workingDir = workingDir.startsWith("~") ? workingDir.replace(/^~/,
|
|
71385
|
+
this.workingDir = workingDir.startsWith("~") ? workingDir.replace(/^~/, os16.homedir()) : workingDir;
|
|
71089
71386
|
const resolvedConfig = resolveCliAdapterConfig(provider);
|
|
71090
71387
|
this.timeouts = resolvedConfig.timeouts;
|
|
71091
71388
|
this.approvalKeys = resolvedConfig.approvalKeys;
|
|
@@ -73530,6 +73827,7 @@ ${lastSnapshot}`;
|
|
|
73530
73827
|
ALWAYS_ON_TRACE_CATEGORIES: () => ALWAYS_ON_TRACE_CATEGORIES,
|
|
73531
73828
|
AcpProviderInstance: () => AcpProviderInstance,
|
|
73532
73829
|
AgentStreamPoller: () => AgentStreamPoller,
|
|
73830
|
+
BUILD_CHANNEL_ENV_VAR: () => BUILD_CHANNEL_ENV_VAR,
|
|
73533
73831
|
BUILTIN_CHAT_MESSAGE_KINDS: () => BUILTIN_CHAT_MESSAGE_KINDS,
|
|
73534
73832
|
CANONICAL_MESH_TOOL_COUNT: () => CANONICAL_MESH_TOOL_COUNT,
|
|
73535
73833
|
CANONICAL_MESH_TOOL_NAMES: () => CANONICAL_MESH_TOOL_NAMES,
|
|
@@ -73579,6 +73877,7 @@ ${lastSnapshot}`;
|
|
|
73579
73877
|
GOAL_PREVIEW_MAX: () => GOAL_PREVIEW_MAX,
|
|
73580
73878
|
GitCommandError: () => GitCommandError,
|
|
73581
73879
|
GitWorkspaceMonitor: () => GitWorkspaceMonitor,
|
|
73880
|
+
IDENTITY: () => IDENTITY,
|
|
73582
73881
|
IDLE_REMINDER_DEBOUNCE_MS: () => IDLE_REMINDER_DEBOUNCE_MS,
|
|
73583
73882
|
IdeProviderInstance: () => IdeProviderInstance,
|
|
73584
73883
|
InMemoryGitSnapshotStore: () => InMemoryGitSnapshotStore,
|
|
@@ -73634,6 +73933,7 @@ ${lastSnapshot}`;
|
|
|
73634
73933
|
STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS2,
|
|
73635
73934
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory2,
|
|
73636
73935
|
StatuslineInstallError: () => StatuslineInstallError2,
|
|
73936
|
+
TRACK: () => TRACK,
|
|
73637
73937
|
TREE_DIGEST_ALGORITHM: () => TREE_DIGEST_ALGORITHM,
|
|
73638
73938
|
TerminalAdapter: () => TerminalAdapter,
|
|
73639
73939
|
TurnSnapshotTracker: () => TurnSnapshotTracker,
|
|
@@ -73795,6 +74095,7 @@ ${lastSnapshot}`;
|
|
|
73795
74095
|
getSessionHostRecoveryLabel: () => import_session_host_core4.getSessionHostRecoveryLabel,
|
|
73796
74096
|
getSessionHostSurfaceKind: () => import_session_host_core4.getSessionHostSurfaceKind,
|
|
73797
74097
|
getSessionRecoveryContext: () => getSessionRecoveryContext,
|
|
74098
|
+
getTrackIdentity: () => getTrackIdentity,
|
|
73798
74099
|
getTurnPresentationMetrics: () => getTurnPresentationMetrics,
|
|
73799
74100
|
getUsageDir: () => getUsageDir,
|
|
73800
74101
|
getWorkspaceState: () => getWorkspaceState2,
|
|
@@ -73953,6 +74254,7 @@ ${lastSnapshot}`;
|
|
|
73953
74254
|
resolveAllowSendKeysDestructive: () => resolveAllowSendKeysDestructive,
|
|
73954
74255
|
resolveAutoConvergeCodeChange: () => resolveAutoConvergeCodeChange,
|
|
73955
74256
|
resolveBackoffMs: () => resolveBackoffMs,
|
|
74257
|
+
resolveBuildTrack: () => resolveBuildTrack,
|
|
73956
74258
|
resolveChatMessageKind: () => resolveChatMessageKind,
|
|
73957
74259
|
resolveConvergeRequiredTags: () => resolveConvergeRequiredTags,
|
|
73958
74260
|
resolveCurrentGlobalInstallSurface: () => resolveCurrentGlobalInstallSurface,
|
|
@@ -75314,9 +75616,10 @@ ${lastSnapshot}`;
|
|
|
75314
75616
|
};
|
|
75315
75617
|
init_git_worktree();
|
|
75316
75618
|
init_config();
|
|
75317
|
-
var
|
|
75619
|
+
var os62 = __toESM2(require("os"));
|
|
75318
75620
|
var path12 = __toESM2(require("path"));
|
|
75319
75621
|
var import_session_host_core22 = require_dist();
|
|
75622
|
+
init_config_dir();
|
|
75320
75623
|
var DEFAULT_SESSION_HOST_APP_NAME = "adhdev";
|
|
75321
75624
|
var DEFAULT_STANDALONE_SESSION_HOST_APP_NAME = "adhdev-standalone";
|
|
75322
75625
|
function getReservedStandaloneNamespaceWarning() {
|
|
@@ -75355,7 +75658,7 @@ ${lastSnapshot}`;
|
|
|
75355
75658
|
var cached22 = null;
|
|
75356
75659
|
function resolveInstanceContext(options = {}) {
|
|
75357
75660
|
const env2 = options.env ?? process.env;
|
|
75358
|
-
const homeDir = options.homeDir ??
|
|
75661
|
+
const homeDir = options.homeDir ?? os62.homedir();
|
|
75359
75662
|
const envDir = typeof env2.ADHDEV_CONFIG_DIR === "string" ? env2.ADHDEV_CONFIG_DIR.trim() : "";
|
|
75360
75663
|
const explicitDir = typeof options.configDir === "string" ? options.configDir.trim() : "";
|
|
75361
75664
|
if (explicitDir && envDir && (0, import_session_host_core22.canonicalizeInstancePath)(explicitDir) !== (0, import_session_host_core22.canonicalizeInstancePath)(envDir)) {
|
|
@@ -75363,7 +75666,7 @@ ${lastSnapshot}`;
|
|
|
75363
75666
|
`Conflicting instance identity: explicit configDir "${explicitDir}" vs ADHDEV_CONFIG_DIR "${envDir}". Refusing to merge mutable namespaces \u2014 fix the caller or unset one of the two.`
|
|
75364
75667
|
);
|
|
75365
75668
|
}
|
|
75366
|
-
const configDir = explicitDir ||
|
|
75669
|
+
const configDir = explicitDir || resolveConfigDir(env2, homeDir);
|
|
75367
75670
|
const trimmed = configDir.replace(/[\\/]+$/, "");
|
|
75368
75671
|
return {
|
|
75369
75672
|
configDir,
|
|
@@ -75376,7 +75679,7 @@ ${lastSnapshot}`;
|
|
|
75376
75679
|
}
|
|
75377
75680
|
function getProcessInstanceContext(options = {}) {
|
|
75378
75681
|
const envDir = typeof process.env.ADHDEV_CONFIG_DIR === "string" ? process.env.ADHDEV_CONFIG_DIR.trim() : "";
|
|
75379
|
-
const key2 = `${envDir}|${
|
|
75682
|
+
const key2 = `${envDir}|${os62.homedir()}|${options.standalone ? "standalone" : "daemon"}`;
|
|
75380
75683
|
if (!cached22 || cached22.key !== key2) {
|
|
75381
75684
|
cached22 = { key: key2, context: resolveInstanceContext({ standalone: options.standalone }) };
|
|
75382
75685
|
}
|
|
@@ -75454,7 +75757,7 @@ ${lastSnapshot}`;
|
|
|
75454
75757
|
var import_node_util4 = require("util");
|
|
75455
75758
|
init_mesh_config();
|
|
75456
75759
|
var import_fs12 = require("fs");
|
|
75457
|
-
var
|
|
75760
|
+
var import_path11 = require("path");
|
|
75458
75761
|
init_refine_config();
|
|
75459
75762
|
init_worktree_bootstrap_config();
|
|
75460
75763
|
init_change_impact_config();
|
|
@@ -75473,22 +75776,22 @@ ${lastSnapshot}`;
|
|
|
75473
75776
|
"requirements.txt"
|
|
75474
75777
|
];
|
|
75475
75778
|
function writeConfigFile(workspace, relativePath, config2) {
|
|
75476
|
-
const target = (0,
|
|
75477
|
-
(0, import_fs12.mkdirSync)((0,
|
|
75779
|
+
const target = (0, import_path11.join)(workspace, relativePath);
|
|
75780
|
+
(0, import_fs12.mkdirSync)((0, import_path11.dirname)(target), { recursive: true });
|
|
75478
75781
|
(0, import_fs12.writeFileSync)(target, `${JSON.stringify(config2, null, 2)}
|
|
75479
75782
|
`, "utf-8");
|
|
75480
75783
|
return target;
|
|
75481
75784
|
}
|
|
75482
75785
|
function suggestMeshWorktreeBootstrapConfig(workspace) {
|
|
75483
75786
|
const commands = [];
|
|
75484
|
-
const hasPackageJson = (0, import_fs12.existsSync)((0,
|
|
75485
|
-
const hasNpmLock = (0, import_fs12.existsSync)((0,
|
|
75787
|
+
const hasPackageJson = (0, import_fs12.existsSync)((0, import_path11.join)(workspace, "package.json"));
|
|
75788
|
+
const hasNpmLock = (0, import_fs12.existsSync)((0, import_path11.join)(workspace, "package-lock.json"));
|
|
75486
75789
|
if (hasPackageJson) {
|
|
75487
75790
|
commands.push(
|
|
75488
75791
|
hasNpmLock ? { command: "npm", args: ["ci"] } : { command: "npm", args: ["install"] }
|
|
75489
75792
|
);
|
|
75490
75793
|
}
|
|
75491
|
-
const staleInputs = CANDIDATE_STALE_INPUTS.filter((relative8) => (0, import_fs12.existsSync)((0,
|
|
75794
|
+
const staleInputs = CANDIDATE_STALE_INPUTS.filter((relative8) => (0, import_fs12.existsSync)((0, import_path11.join)(workspace, relative8)));
|
|
75492
75795
|
if (!commands.length) {
|
|
75493
75796
|
return { commands, staleInputs };
|
|
75494
75797
|
}
|
|
@@ -75587,7 +75890,7 @@ ${lastSnapshot}`;
|
|
|
75587
75890
|
}
|
|
75588
75891
|
function applyConfigSuggestion(input) {
|
|
75589
75892
|
const { workspace, relativePath, existing, suggestedConfig, validate, write, overwrite } = input;
|
|
75590
|
-
const absolute = (0,
|
|
75893
|
+
const absolute = (0, import_path11.join)(workspace, relativePath);
|
|
75591
75894
|
if (existing !== void 0 && !overwrite) {
|
|
75592
75895
|
return { path: absolute, relativePath, written: false, skippedReason: "already_exists", config: existing };
|
|
75593
75896
|
}
|
|
@@ -76104,7 +76407,7 @@ ${lastSnapshot}`;
|
|
|
76104
76407
|
}
|
|
76105
76408
|
init_mesh_ledger();
|
|
76106
76409
|
var import_fs14 = require("fs");
|
|
76107
|
-
var
|
|
76410
|
+
var import_path13 = require("path");
|
|
76108
76411
|
init_config();
|
|
76109
76412
|
init_usage_normalize();
|
|
76110
76413
|
var USAGE_DIR_NAME = "mesh-usage";
|
|
@@ -76119,13 +76422,13 @@ ${lastSnapshot}`;
|
|
|
76119
76422
|
lastEvictedAt: 0
|
|
76120
76423
|
};
|
|
76121
76424
|
function getUsageDir() {
|
|
76122
|
-
const dir = (0,
|
|
76425
|
+
const dir = (0, import_path13.join)(getConfigDir2(), USAGE_DIR_NAME);
|
|
76123
76426
|
if (!(0, import_fs14.existsSync)(dir)) (0, import_fs14.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
76124
76427
|
return dir;
|
|
76125
76428
|
}
|
|
76126
76429
|
function getUsagePath(meshId) {
|
|
76127
76430
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
76128
|
-
return (0,
|
|
76431
|
+
return (0, import_path13.join)(getUsageDir(), `${safe}.json`);
|
|
76129
76432
|
}
|
|
76130
76433
|
function emptyFile(meshId) {
|
|
76131
76434
|
return { version: 1, meshId, sessions: {} };
|
|
@@ -76668,17 +76971,17 @@ ${lastSnapshot}`;
|
|
|
76668
76971
|
return null;
|
|
76669
76972
|
}
|
|
76670
76973
|
async function detectIDEs(providerLoader) {
|
|
76671
|
-
const
|
|
76974
|
+
const os30 = (0, import_os3.platform)();
|
|
76672
76975
|
const results = [];
|
|
76673
76976
|
for (const def of getMergedDefinitions()) {
|
|
76674
76977
|
const cliPath = findCliCommand(providerLoader?.getIdeCliCommand(def.id, def.cli) || def.cli);
|
|
76675
|
-
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[
|
|
76978
|
+
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os30] || []) || []);
|
|
76676
76979
|
let resolvedCli = cliPath;
|
|
76677
|
-
if (!resolvedCli && appPath &&
|
|
76980
|
+
if (!resolvedCli && appPath && os30 === "darwin") {
|
|
76678
76981
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
76679
76982
|
if ((0, import_fs18.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
76680
76983
|
}
|
|
76681
|
-
if (!resolvedCli && appPath &&
|
|
76984
|
+
if (!resolvedCli && appPath && os30 === "win32") {
|
|
76682
76985
|
const { dirname: dirname22 } = await import("path");
|
|
76683
76986
|
const appDir = dirname22(appPath);
|
|
76684
76987
|
const candidates = [
|
|
@@ -76695,7 +76998,7 @@ ${lastSnapshot}`;
|
|
|
76695
76998
|
}
|
|
76696
76999
|
}
|
|
76697
77000
|
}
|
|
76698
|
-
const installed =
|
|
77001
|
+
const installed = os30 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
|
|
76699
77002
|
const version2 = null;
|
|
76700
77003
|
results.push({
|
|
76701
77004
|
id: def.id,
|
|
@@ -83403,7 +83706,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
83403
83706
|
}
|
|
83404
83707
|
var fs15 = __toESM2(require("fs"));
|
|
83405
83708
|
var path232 = __toESM2(require("path"));
|
|
83406
|
-
var
|
|
83709
|
+
var os11 = __toESM2(require("os"));
|
|
83407
83710
|
var KEY_TO_VK = {
|
|
83408
83711
|
Backspace: 8,
|
|
83409
83712
|
Tab: 9,
|
|
@@ -83657,7 +83960,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
83657
83960
|
function resolveSafePath(requestedPath) {
|
|
83658
83961
|
const rawPath = typeof requestedPath === "string" ? requestedPath.trim() : "";
|
|
83659
83962
|
const inputPath = rawPath || ".";
|
|
83660
|
-
const home =
|
|
83963
|
+
const home = os11.homedir();
|
|
83661
83964
|
if (inputPath.startsWith("~")) {
|
|
83662
83965
|
return path232.resolve(path232.join(home, inputPath.slice(1)));
|
|
83663
83966
|
}
|
|
@@ -86573,10 +86876,11 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
86573
86876
|
}
|
|
86574
86877
|
};
|
|
86575
86878
|
init_config();
|
|
86879
|
+
init_install();
|
|
86576
86880
|
var import_child_process8 = require("child_process");
|
|
86577
86881
|
var import_child_process9 = require("child_process");
|
|
86578
86882
|
var fs20 = __toESM2(require("fs"));
|
|
86579
|
-
var
|
|
86883
|
+
var os12 = __toESM2(require("os"));
|
|
86580
86884
|
var path26 = __toESM2(require("path"));
|
|
86581
86885
|
var import_child_process7 = require("child_process");
|
|
86582
86886
|
var fs19 = __toESM2(require("fs"));
|
|
@@ -87328,31 +87632,31 @@ exec "${portableNode}" "${cliEntry}" "$@"
|
|
|
87328
87632
|
resolvedPath = fs20.realpathSync.native(currentCliPath);
|
|
87329
87633
|
} catch {
|
|
87330
87634
|
}
|
|
87331
|
-
let
|
|
87635
|
+
let currentDir2 = resolvedPath;
|
|
87332
87636
|
try {
|
|
87333
87637
|
if (fs20.statSync(resolvedPath).isFile()) {
|
|
87334
|
-
|
|
87638
|
+
currentDir2 = path26.dirname(resolvedPath);
|
|
87335
87639
|
}
|
|
87336
87640
|
} catch {
|
|
87337
|
-
|
|
87641
|
+
currentDir2 = path26.dirname(resolvedPath);
|
|
87338
87642
|
}
|
|
87339
87643
|
while (true) {
|
|
87340
|
-
const packageJsonPath = path26.join(
|
|
87644
|
+
const packageJsonPath = path26.join(currentDir2, "package.json");
|
|
87341
87645
|
try {
|
|
87342
87646
|
if (fs20.existsSync(packageJsonPath)) {
|
|
87343
87647
|
const parsed = JSON.parse(fs20.readFileSync(packageJsonPath, "utf8"));
|
|
87344
87648
|
if (parsed?.name === packageName) {
|
|
87345
|
-
const normalized =
|
|
87346
|
-
return normalized.includes("/node_modules/") ?
|
|
87649
|
+
const normalized = currentDir2.replace(/\\/g, "/");
|
|
87650
|
+
return normalized.includes("/node_modules/") ? currentDir2 : null;
|
|
87347
87651
|
}
|
|
87348
87652
|
}
|
|
87349
87653
|
} catch {
|
|
87350
87654
|
}
|
|
87351
|
-
const parentDir = path26.dirname(
|
|
87352
|
-
if (parentDir ===
|
|
87655
|
+
const parentDir = path26.dirname(currentDir2);
|
|
87656
|
+
if (parentDir === currentDir2) {
|
|
87353
87657
|
return null;
|
|
87354
87658
|
}
|
|
87355
|
-
|
|
87659
|
+
currentDir2 = parentDir;
|
|
87356
87660
|
}
|
|
87357
87661
|
}
|
|
87358
87662
|
function resolveInstallPrefixFromPackageRoot(packageRoot, packageName) {
|
|
@@ -87387,7 +87691,7 @@ exec "${portableNode}" "${cliEntry}" "$@"
|
|
|
87387
87691
|
const packageRoot = findCurrentPackageRoot(options.currentCliPath || process.argv[1], options.packageName);
|
|
87388
87692
|
const npmInvocation = resolveSiblingNpmInvocation(options.nodeExecutable || process.execPath, options.platform);
|
|
87389
87693
|
const platform10 = options.platform || process.platform;
|
|
87390
|
-
const homeDir = options.homeDir ||
|
|
87694
|
+
const homeDir = options.homeDir || os12.homedir();
|
|
87391
87695
|
const instanceDir = options.instanceDir || resolveInstanceDir();
|
|
87392
87696
|
let installPrefix = packageRoot ? resolveInstallPrefixFromPackageRoot(packageRoot, options.packageName) : null;
|
|
87393
87697
|
if (platform10 === "win32" && isPortableNode22Prefix(installPrefix, homeDir, instanceDir)) {
|
|
@@ -87665,12 +87969,12 @@ ${body}
|
|
|
87665
87969
|
}
|
|
87666
87970
|
const instanceDir = resolveInstanceDir();
|
|
87667
87971
|
const windowsInstallerLayout = resolveWindowsInstallerLayout({
|
|
87668
|
-
homeDir:
|
|
87972
|
+
homeDir: os12.homedir(),
|
|
87669
87973
|
installPrefix: installCommand.surface.installPrefix,
|
|
87670
87974
|
instanceDir
|
|
87671
87975
|
});
|
|
87672
87976
|
if (windowsInstallerLayout) {
|
|
87673
|
-
const portableNode = findPortableNode22(
|
|
87977
|
+
const portableNode = findPortableNode22(os12.homedir(), process.execPath, instanceDir);
|
|
87674
87978
|
if (!portableNode) {
|
|
87675
87979
|
throw new Error("installer-managed Windows update requires the portable Node.js 22 runtime");
|
|
87676
87980
|
}
|
|
@@ -87844,22 +88148,7 @@ ${body}
|
|
|
87844
88148
|
}
|
|
87845
88149
|
}
|
|
87846
88150
|
init_logger();
|
|
87847
|
-
|
|
87848
|
-
var CHANNEL_SERVER_URL = {
|
|
87849
|
-
stable: "https://api.adhf.dev",
|
|
87850
|
-
preview: "https://api-preview.adhf.dev"
|
|
87851
|
-
};
|
|
87852
|
-
var VENDOR_SERVER_URLS = new Set(Object.values(CHANNEL_SERVER_URL));
|
|
87853
|
-
function normalizeReleaseChannel(value) {
|
|
87854
|
-
if (typeof value !== "string") return null;
|
|
87855
|
-
const normalized = value.trim().toLowerCase();
|
|
87856
|
-
if (normalized === "stable" || normalized === "latest") return "stable";
|
|
87857
|
-
if (normalized === "preview" || normalized === "next") return "preview";
|
|
87858
|
-
return null;
|
|
87859
|
-
}
|
|
87860
|
-
function resolveUpgradeChannel(args) {
|
|
87861
|
-
return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig2().updateChannel) || "stable";
|
|
87862
|
-
}
|
|
88151
|
+
init_track_identity();
|
|
87863
88152
|
var daemonLifecycleHandlers = {
|
|
87864
88153
|
daemon_upgrade: async (ctx, args) => {
|
|
87865
88154
|
LOG2.info("Upgrade", "Remote upgrade requested from dashboard");
|
|
@@ -87867,15 +88156,12 @@ ${body}
|
|
|
87867
88156
|
const isStandalone = ctx.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
|
|
87868
88157
|
const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
|
|
87869
88158
|
const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
|
|
87870
|
-
|
|
87871
|
-
|
|
88159
|
+
if (args?.channel || args?.updatePolicy?.channel || args?.npmTag) {
|
|
88160
|
+
LOG2.info("Upgrade", "Ignoring deprecated channel hint \u2014 upgrade target is the build track");
|
|
88161
|
+
}
|
|
88162
|
+
const npmTag = IDENTITY.npmTag;
|
|
87872
88163
|
const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
|
|
87873
88164
|
LOG2.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
|
|
87874
|
-
const currentServerUrl = typeof loadConfig2().serverUrl === "string" ? loadConfig2().serverUrl.trim() : "";
|
|
87875
|
-
const useVendorServerUrl = currentServerUrl === "" || VENDOR_SERVER_URLS.has(currentServerUrl);
|
|
87876
|
-
updateConfig(
|
|
87877
|
-
useVendorServerUrl ? { updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] } : { updateChannel: channel }
|
|
87878
|
-
);
|
|
87879
88165
|
let currentInstalled = null;
|
|
87880
88166
|
try {
|
|
87881
88167
|
const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
|
|
@@ -87889,8 +88175,8 @@ ${body}
|
|
|
87889
88175
|
}
|
|
87890
88176
|
const runningVersion = typeof ctx.deps.statusVersion === "string" ? ctx.deps.statusVersion.trim().replace(/^v/, "") : null;
|
|
87891
88177
|
if (currentInstalled === latest && runningVersion === latest) {
|
|
87892
|
-
LOG2.info("Upgrade", `Already on ${
|
|
87893
|
-
return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
|
|
88178
|
+
LOG2.info("Upgrade", `Already on ${TRACK} track version v${latest}; skipping install`);
|
|
88179
|
+
return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel: TRACK, npmTag };
|
|
87894
88180
|
}
|
|
87895
88181
|
if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
|
|
87896
88182
|
LOG2.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
|
|
@@ -87903,12 +88189,12 @@ ${body}
|
|
|
87903
88189
|
cwd: process.cwd(),
|
|
87904
88190
|
sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
|
|
87905
88191
|
});
|
|
87906
|
-
LOG2.info("Upgrade", `Scheduled detached ${
|
|
88192
|
+
LOG2.info("Upgrade", `Scheduled detached ${TRACK} upgrade to v${latest}`);
|
|
87907
88193
|
setTimeout(() => {
|
|
87908
88194
|
LOG2.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
|
|
87909
88195
|
process.exit(0);
|
|
87910
88196
|
}, 3e3);
|
|
87911
|
-
return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
|
|
88197
|
+
return { success: true, upgraded: true, version: latest, restarting: true, channel: TRACK, npmTag };
|
|
87912
88198
|
} catch (e) {
|
|
87913
88199
|
LOG2.error("Upgrade", `Failed: ${e.message}`);
|
|
87914
88200
|
return { success: false, error: e.message };
|
|
@@ -87976,6 +88262,65 @@ ${body}
|
|
|
87976
88262
|
}
|
|
87977
88263
|
setQuotaShowAccountEmail(args.enabled);
|
|
87978
88264
|
return { success: true, enabled: args.enabled };
|
|
88265
|
+
},
|
|
88266
|
+
/**
|
|
88267
|
+
* Read the per-provider quota probe switch for the machine page toggle.
|
|
88268
|
+
* Independent of the machine-use flag (`enabled`), which gates launching
|
|
88269
|
+
* and mesh claims: a machine can use a provider and still not want its
|
|
88270
|
+
* quota read here. Absent = enabled.
|
|
88271
|
+
*/
|
|
88272
|
+
get_quota_provider_enabled: async (_ctx, args) => {
|
|
88273
|
+
const providerType = args?.providerType;
|
|
88274
|
+
if (typeof providerType !== "string" || !providerType) {
|
|
88275
|
+
return { success: false, error: "providerType (string) is required" };
|
|
88276
|
+
}
|
|
88277
|
+
return { success: true, enabled: loadConfig2().machineProviders?.[providerType]?.quotaEnabled !== false };
|
|
88278
|
+
},
|
|
88279
|
+
/**
|
|
88280
|
+
* Set it. Takes effect on the next quota tick with no restart: the refresh
|
|
88281
|
+
* predicate re-reads the config through the loader on every probe.
|
|
88282
|
+
*
|
|
88283
|
+
* Enabling CLAUDE installs the statusline wrapper FIRST. Claude Code has
|
|
88284
|
+
* no quota API — the statusLine wrapper is the only collection path, so
|
|
88285
|
+
* enabling without installing it would silently collect nothing. The
|
|
88286
|
+
* install runs here (not on any daemon boot path, which may never call
|
|
88287
|
+
* install — see quota/statusline/install.ts) because this is a
|
|
88288
|
+
* human-triggered command handler: the UI has already shown the user the
|
|
88289
|
+
* confirm dialog before calling. If the install throws, the config is NOT
|
|
88290
|
+
* written, so the toggle never claims a probe that cannot deliver.
|
|
88291
|
+
*
|
|
88292
|
+
* DISABLING does not uninstall the wrapper: uninstalling destroys the
|
|
88293
|
+
* backup of the user's original statusLine, which nothing here was asked
|
|
88294
|
+
* to do. It stays removable via `adhdev quota claude:uninstall`.
|
|
88295
|
+
*
|
|
88296
|
+
* codex-cli and kimi need nothing extra (codex spawns `codex app-server`,
|
|
88297
|
+
* kimi reads a token — no user-file side effects), so their toggle applies
|
|
88298
|
+
* immediately.
|
|
88299
|
+
*/
|
|
88300
|
+
set_quota_provider_enabled: async (_ctx, args) => {
|
|
88301
|
+
const providerType = args?.providerType;
|
|
88302
|
+
if (typeof providerType !== "string" || !providerType) {
|
|
88303
|
+
return { success: false, error: "providerType (string) is required" };
|
|
88304
|
+
}
|
|
88305
|
+
if (typeof args?.enabled !== "boolean") {
|
|
88306
|
+
return { success: false, error: "enabled (boolean) is required" };
|
|
88307
|
+
}
|
|
88308
|
+
const enabled = args.enabled;
|
|
88309
|
+
let statusline;
|
|
88310
|
+
if (providerType === "claude-cli" && enabled) {
|
|
88311
|
+
try {
|
|
88312
|
+
statusline = installClaudeStatusline2().outcome;
|
|
88313
|
+
} catch (e) {
|
|
88314
|
+
LOG2.error("Quota", `Claude statusline install failed: ${e?.message || e}`);
|
|
88315
|
+
return { success: false, error: e?.message || String(e) };
|
|
88316
|
+
}
|
|
88317
|
+
}
|
|
88318
|
+
const config2 = loadConfig2();
|
|
88319
|
+
const entry = { ...config2.machineProviders?.[providerType] ?? {} };
|
|
88320
|
+
if (enabled) delete entry.quotaEnabled;
|
|
88321
|
+
else entry.quotaEnabled = false;
|
|
88322
|
+
updateConfig({ machineProviders: { ...config2.machineProviders ?? {}, [providerType]: entry } });
|
|
88323
|
+
return { success: true, enabled, ...statusline ? { statusline } : {} };
|
|
87979
88324
|
}
|
|
87980
88325
|
};
|
|
87981
88326
|
var meshLedgerHandlers = {
|
|
@@ -88433,7 +88778,7 @@ ${body}
|
|
|
88433
88778
|
})
|
|
88434
88779
|
);
|
|
88435
88780
|
init_dist();
|
|
88436
|
-
var
|
|
88781
|
+
var os21 = __toESM2(require("os"));
|
|
88437
88782
|
var path35 = __toESM2(require("path"));
|
|
88438
88783
|
var crypto6 = __toESM2(require("crypto"));
|
|
88439
88784
|
var import_fs19 = require("fs");
|
|
@@ -88527,7 +88872,7 @@ ${body}
|
|
|
88527
88872
|
}
|
|
88528
88873
|
}
|
|
88529
88874
|
init_summary_metadata();
|
|
88530
|
-
var
|
|
88875
|
+
var os20 = __toESM2(require("os"));
|
|
88531
88876
|
var crypto5 = __toESM2(require("crypto"));
|
|
88532
88877
|
var fs29 = __toESM2(require("fs"));
|
|
88533
88878
|
init_contracts2();
|
|
@@ -88665,7 +89010,7 @@ ${body}
|
|
|
88665
89010
|
var path31 = __toESM2(require("path"));
|
|
88666
89011
|
init_provider_cli_adapter();
|
|
88667
89012
|
var fs25 = __toESM2(require("fs"));
|
|
88668
|
-
var
|
|
89013
|
+
var os18 = __toESM2(require("os"));
|
|
88669
89014
|
var path30 = __toESM2(require("path"));
|
|
88670
89015
|
init_terminal_screen();
|
|
88671
89016
|
var import_session_host_core9 = require_dist();
|
|
@@ -88844,12 +89189,12 @@ ${body}
|
|
|
88844
89189
|
init_fsm_types();
|
|
88845
89190
|
init_fsm_loader();
|
|
88846
89191
|
var fs24 = __toESM2(require("fs"));
|
|
88847
|
-
var
|
|
89192
|
+
var os17 = __toESM2(require("os"));
|
|
88848
89193
|
var path29 = __toESM2(require("path"));
|
|
88849
89194
|
init_logger();
|
|
88850
89195
|
function expandHome2(p) {
|
|
88851
|
-
if (p === "~") return
|
|
88852
|
-
if (p.startsWith("~/")) return path29.join(
|
|
89196
|
+
if (p === "~") return os17.homedir();
|
|
89197
|
+
if (p.startsWith("~/")) return path29.join(os17.homedir(), p.slice(2));
|
|
88853
89198
|
return p;
|
|
88854
89199
|
}
|
|
88855
89200
|
function realWorkspacePath(workingDir) {
|
|
@@ -89659,7 +90004,7 @@ ${body}
|
|
|
89659
90004
|
}
|
|
89660
90005
|
fireDelegate(d) {
|
|
89661
90006
|
const ev = this.currentEval;
|
|
89662
|
-
const task = d.task_template.replace(/\{node\}/g,
|
|
90007
|
+
const task = d.task_template.replace(/\{node\}/g, os18.hostname()).replace(/\{state\.label\}/g, ev?.state.label ?? "").replace(/\{state\.title\}/g, ev?.state.title ?? "").replace(/\{duration_ms\}/g, String(d.after_duration_ms ?? 0));
|
|
89663
90008
|
this.emit({ kind: "delegate", id: d.id, task });
|
|
89664
90009
|
}
|
|
89665
90010
|
// ────────────────────────────────────────────────────────────────────
|
|
@@ -89957,7 +90302,7 @@ ${body}
|
|
|
89957
90302
|
const ctl = (this.spec.control_bar ?? []).find((c) => c.action.type === "attach_image");
|
|
89958
90303
|
if (!ctl || ctl.action.type !== "attach_image") return;
|
|
89959
90304
|
const ext = guessExt(mime);
|
|
89960
|
-
const tmp = path30.join(
|
|
90305
|
+
const tmp = path30.join(os18.tmpdir(), `adhdev-attach-${Date.now()}${ext}`);
|
|
89961
90306
|
try {
|
|
89962
90307
|
fs25.writeFileSync(tmp, Buffer.from(blob, "base64"));
|
|
89963
90308
|
} catch {
|
|
@@ -91258,7 +91603,7 @@ ${body}
|
|
|
91258
91603
|
init_transcript_claim_registry();
|
|
91259
91604
|
init_chat_message_normalization();
|
|
91260
91605
|
init_working_dir();
|
|
91261
|
-
var
|
|
91606
|
+
var os19 = __toESM2(require("os"));
|
|
91262
91607
|
var path322 = __toESM2(require("path"));
|
|
91263
91608
|
var crypto4 = __toESM2(require("crypto"));
|
|
91264
91609
|
var fs28 = __toESM2(require("fs"));
|
|
@@ -91329,7 +91674,7 @@ ${body}
|
|
|
91329
91674
|
const promptParts = [];
|
|
91330
91675
|
const imageRefs = [];
|
|
91331
91676
|
const resourceRefs = [];
|
|
91332
|
-
const materializeDir = options.materializeDir || path322.join(
|
|
91677
|
+
const materializeDir = options.materializeDir || path322.join(os19.tmpdir(), "adhdev-input-media");
|
|
91333
91678
|
input.parts.forEach((part, index) => {
|
|
91334
91679
|
if (part.type === "text" && part.text.trim()) {
|
|
91335
91680
|
promptParts.push(part.text.trim());
|
|
@@ -92068,7 +92413,7 @@ ${body}
|
|
|
92068
92413
|
* Replaces the previously duplicated probeOpenCode/Codex/Goose functions.
|
|
92069
92414
|
*/
|
|
92070
92415
|
probeSessionIdFromConfig(probe) {
|
|
92071
|
-
const resolvedDbPath = probe.dbPath.replace(/^~/,
|
|
92416
|
+
const resolvedDbPath = probe.dbPath.replace(/^~/, os20.homedir());
|
|
92072
92417
|
const now = Date.now();
|
|
92073
92418
|
if (this.cachedSqliteDbMissingUntil > now) return null;
|
|
92074
92419
|
if (!fs29.existsSync(resolvedDbPath)) {
|
|
@@ -96863,7 +97208,7 @@ ${rawInput}` : rawInput;
|
|
|
96863
97208
|
}
|
|
96864
97209
|
function expandExecutable(command) {
|
|
96865
97210
|
const trimmed = command.trim();
|
|
96866
|
-
return trimmed.startsWith("~") ? path35.join(
|
|
97211
|
+
return trimmed.startsWith("~") ? path35.join(os21.homedir(), trimmed.slice(1)) : trimmed;
|
|
96867
97212
|
}
|
|
96868
97213
|
function commandExists(command) {
|
|
96869
97214
|
const trimmed = command.trim();
|
|
@@ -97013,9 +97358,9 @@ ${rawInput}` : rawInput;
|
|
|
97013
97358
|
return false;
|
|
97014
97359
|
}
|
|
97015
97360
|
function ensureEmptyDelegatedMcpConfig(workspace) {
|
|
97016
|
-
const baseDir = path35.join(
|
|
97361
|
+
const baseDir = path35.join(os21.tmpdir(), "adhdev-delegated-agent-empty-mcp");
|
|
97017
97362
|
(0, import_fs19.mkdirSync)(baseDir, { recursive: true });
|
|
97018
|
-
const workspaceHash = shortHash(path35.resolve(workspace ||
|
|
97363
|
+
const workspaceHash = shortHash(path35.resolve(workspace || os21.tmpdir()));
|
|
97019
97364
|
const filePath = path35.join(baseDir, `${workspaceHash}.json`);
|
|
97020
97365
|
(0, import_fs19.writeFileSync)(filePath, JSON.stringify({ mcpServers: {} }, null, 2), "utf-8");
|
|
97021
97366
|
return filePath;
|
|
@@ -97410,7 +97755,7 @@ ${rawInput}` : rawInput;
|
|
|
97410
97755
|
async startSession(cliType, workingDir, cliArgs, initialModel, options) {
|
|
97411
97756
|
const trimmed = (workingDir || "").trim();
|
|
97412
97757
|
if (!trimmed) throw new Error("working directory required");
|
|
97413
|
-
const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/,
|
|
97758
|
+
const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os21.homedir()) : path35.resolve(trimmed);
|
|
97414
97759
|
const normalizedType = this.providerLoader.resolveAlias(cliType);
|
|
97415
97760
|
const rawProvider = this.providerLoader.getByAlias(cliType);
|
|
97416
97761
|
const provider = rawProvider ? this.providerLoader.resolve(normalizedType) || rawProvider : void 0;
|
|
@@ -98437,11 +98782,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
98437
98782
|
};
|
|
98438
98783
|
var import_child_process12 = require("child_process");
|
|
98439
98784
|
var net3 = __toESM2(require("net"));
|
|
98440
|
-
var
|
|
98785
|
+
var os26 = __toESM2(require("os"));
|
|
98441
98786
|
var path46 = __toESM2(require("path"));
|
|
98442
98787
|
var fs38 = __toESM2(require("fs"));
|
|
98443
98788
|
var path45 = __toESM2(require("path"));
|
|
98444
|
-
var
|
|
98789
|
+
var os25 = __toESM2(require("os"));
|
|
98445
98790
|
var chokidar = __toESM2(require_chokidar());
|
|
98446
98791
|
init_hash();
|
|
98447
98792
|
init_logger();
|
|
@@ -98909,7 +99254,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
98909
99254
|
init_config();
|
|
98910
99255
|
init_native_history_executor();
|
|
98911
99256
|
var fs34 = __toESM2(require("fs"));
|
|
98912
|
-
var
|
|
99257
|
+
var os24 = __toESM2(require("os"));
|
|
98913
99258
|
var path40 = __toESM2(require("path"));
|
|
98914
99259
|
var fs30 = __toESM2(require("fs"));
|
|
98915
99260
|
var path36 = __toESM2(require("path"));
|
|
@@ -99415,7 +99760,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
99415
99760
|
}
|
|
99416
99761
|
var fs322 = __toESM2(require("fs"));
|
|
99417
99762
|
var path38 = __toESM2(require("path"));
|
|
99418
|
-
var
|
|
99763
|
+
var os222 = __toESM2(require("os"));
|
|
99419
99764
|
init_load_better_sqlite3();
|
|
99420
99765
|
init_logger();
|
|
99421
99766
|
function extractTimestampValue3(value) {
|
|
@@ -99439,7 +99784,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
99439
99784
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
99440
99785
|
}
|
|
99441
99786
|
function antigravityRoot() {
|
|
99442
|
-
return path38.join(
|
|
99787
|
+
return path38.join(os222.homedir(), ".gemini", "antigravity-cli");
|
|
99443
99788
|
}
|
|
99444
99789
|
function historyJsonlPath() {
|
|
99445
99790
|
return path38.join(antigravityRoot(), "history.jsonl");
|
|
@@ -100026,11 +100371,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
100026
100371
|
}
|
|
100027
100372
|
var fs33 = __toESM2(require("fs"));
|
|
100028
100373
|
var path39 = __toESM2(require("path"));
|
|
100029
|
-
var
|
|
100374
|
+
var os23 = __toESM2(require("os"));
|
|
100030
100375
|
init_load_better_sqlite3();
|
|
100031
100376
|
init_usage_normalize();
|
|
100032
|
-
var HERMES_STATE_DB = path39.join(
|
|
100033
|
-
var HERMES_LEGACY_SESSIONS_DIR = path39.join(
|
|
100377
|
+
var HERMES_STATE_DB = path39.join(os23.homedir(), ".hermes", "state.db");
|
|
100378
|
+
var HERMES_LEGACY_SESSIONS_DIR = path39.join(os23.homedir(), ".hermes", "sessions");
|
|
100034
100379
|
function statMtimeMs4(p) {
|
|
100035
100380
|
try {
|
|
100036
100381
|
return Math.floor(fs33.statSync(p).mtimeMs);
|
|
@@ -100315,7 +100660,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
100315
100660
|
}
|
|
100316
100661
|
}
|
|
100317
100662
|
function resolveClaudePath(workspace, sessionId) {
|
|
100318
|
-
const dir = path40.join(
|
|
100663
|
+
const dir = path40.join(os24.homedir(), ".claude", "projects", cwdAsDashes(workspace));
|
|
100319
100664
|
if (!fs34.existsSync(dir)) return null;
|
|
100320
100665
|
if (sessionId) {
|
|
100321
100666
|
const candidate = path40.join(dir, `${sessionId}.jsonl`);
|
|
@@ -100437,7 +100782,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
100437
100782
|
}
|
|
100438
100783
|
var AGY_SPAWN_CLAIM_GRACE_MS = 2e3;
|
|
100439
100784
|
function resolveAntigravityPath(workspace, sessionId, sessionStartedAtMs, instanceId) {
|
|
100440
|
-
const agyRoot = path40.join(
|
|
100785
|
+
const agyRoot = path40.join(os24.homedir(), ".gemini", "antigravity-cli");
|
|
100441
100786
|
const owner = antigravityOwnerToken(workspace, sessionStartedAtMs, instanceId);
|
|
100442
100787
|
if (sessionId && isUuidLikeSessionId2(sessionId)) {
|
|
100443
100788
|
const dbPath = path40.join(agyRoot, "conversations", `${sessionId}.db`);
|
|
@@ -100521,9 +100866,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
100521
100866
|
function resolveHermesPath(workspace, sessionId) {
|
|
100522
100867
|
void workspace;
|
|
100523
100868
|
void sessionId;
|
|
100524
|
-
const dbPath = path40.join(
|
|
100869
|
+
const dbPath = path40.join(os24.homedir(), ".hermes", "state.db");
|
|
100525
100870
|
if (fs34.existsSync(dbPath)) return dbPath;
|
|
100526
|
-
const dir = path40.join(
|
|
100871
|
+
const dir = path40.join(os24.homedir(), ".hermes", "sessions");
|
|
100527
100872
|
if (!fs34.existsSync(dir)) return null;
|
|
100528
100873
|
return newestRecentFile2(dir, /^session_.*\.json$/);
|
|
100529
100874
|
}
|
|
@@ -100549,7 +100894,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
100549
100894
|
return cwd.replace(/\//g, "-");
|
|
100550
100895
|
}
|
|
100551
100896
|
function codexSessionsRoot() {
|
|
100552
|
-
return path40.join(
|
|
100897
|
+
return path40.join(os24.homedir(), ".codex", "sessions");
|
|
100553
100898
|
}
|
|
100554
100899
|
function isUuidLikeSessionId2(sessionId) {
|
|
100555
100900
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(sessionId);
|
|
@@ -100597,6 +100942,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
100597
100942
|
if (s2 === "tool" || s2 === "tool_result" || s2 === "function") return "assistant";
|
|
100598
100943
|
return "system";
|
|
100599
100944
|
}
|
|
100945
|
+
init_track_identity();
|
|
100600
100946
|
var DEFAULT_PROVIDER_CHANNEL = "stable";
|
|
100601
100947
|
var PROVIDER_CHANNEL_ENV_VAR = "ADHDEV_PROVIDER_CHANNEL";
|
|
100602
100948
|
var KNOWN_DIGEST_ALGORITHMS = /* @__PURE__ */ new Set([
|
|
@@ -100621,7 +100967,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
100621
100967
|
function resolveProviderChannel(configured, env2 = process.env, releaseChannel) {
|
|
100622
100968
|
const raw = configured && configured.trim() || (env2[PROVIDER_CHANNEL_ENV_VAR] ?? "").trim();
|
|
100623
100969
|
if (raw) return raw === "preview" ? "preview" : "stable";
|
|
100624
|
-
|
|
100970
|
+
const previewByBuildTrack = resolveBuildTrack(env2) === "preview";
|
|
100971
|
+
return previewByBuildTrack || isPreviewReleaseChannel(releaseChannel) ? "preview" : DEFAULT_PROVIDER_CHANNEL;
|
|
100625
100972
|
}
|
|
100626
100973
|
function partitionChannelEntries(entries) {
|
|
100627
100974
|
const activatable = [];
|
|
@@ -102121,6 +102468,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
102121
102468
|
const config2 = this.readConfig();
|
|
102122
102469
|
return config2?.machineProviders?.[providerType]?.enabled === true;
|
|
102123
102470
|
}
|
|
102471
|
+
/**
|
|
102472
|
+
* Whether this provider's quota is probed on this machine. An INDEPENDENT
|
|
102473
|
+
* axis from isMachineProviderEnabled (which gates launching and mesh
|
|
102474
|
+
* claims): a machine can use a provider and still opt out of quota reads.
|
|
102475
|
+
* Absent = enabled, so configs written before this axis existed keep
|
|
102476
|
+
* probing; only an explicit `false` stops the probe.
|
|
102477
|
+
*/
|
|
102478
|
+
isMachineQuotaEnabled(type2) {
|
|
102479
|
+
const providerType = this.resolveAlias(type2);
|
|
102480
|
+
return this.readConfig()?.machineProviders?.[providerType]?.quotaEnabled !== false;
|
|
102481
|
+
}
|
|
102124
102482
|
getMachineProviderConfig(type2) {
|
|
102125
102483
|
const providerType = this.resolveAlias(type2);
|
|
102126
102484
|
const raw = this.readConfig()?.machineProviders?.[providerType];
|
|
@@ -102128,6 +102486,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
102128
102486
|
const executable = typeof raw.executable === "string" && raw.executable.trim() ? raw.executable.trim() : void 0;
|
|
102129
102487
|
return {
|
|
102130
102488
|
...raw.enabled === true ? { enabled: true } : {},
|
|
102489
|
+
...typeof raw.quotaEnabled === "boolean" ? { quotaEnabled: raw.quotaEnabled } : {},
|
|
102131
102490
|
...executable ? { executable } : {},
|
|
102132
102491
|
...Array.isArray(raw.args) ? { args: raw.args.filter((arg) => typeof arg === "string") } : {},
|
|
102133
102492
|
...raw.lastDetection && typeof raw.lastDetection === "object" ? { lastDetection: raw.lastDetection } : {},
|
|
@@ -102156,6 +102515,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
102156
102515
|
if (Array.isArray(patch.args)) next.args = patch.args.filter((arg) => typeof arg === "string");
|
|
102157
102516
|
else delete next.args;
|
|
102158
102517
|
}
|
|
102518
|
+
if ("quotaEnabled" in patch) {
|
|
102519
|
+
if (patch.quotaEnabled === false) next.quotaEnabled = false;
|
|
102520
|
+
else delete next.quotaEnabled;
|
|
102521
|
+
}
|
|
102159
102522
|
if (enabledChanged || executableChanged || argsChanged) {
|
|
102160
102523
|
delete next.lastDetection;
|
|
102161
102524
|
delete next.lastVerification;
|
|
@@ -102183,6 +102546,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
102183
102546
|
setMachineProviderEnabled(type2, enabled) {
|
|
102184
102547
|
return this.setMachineProviderConfig(type2, { enabled });
|
|
102185
102548
|
}
|
|
102549
|
+
setMachineQuotaEnabled(type2, enabled) {
|
|
102550
|
+
return this.setMachineProviderConfig(type2, { quotaEnabled: enabled });
|
|
102551
|
+
}
|
|
102186
102552
|
getEffectiveProviderAvailability(type2) {
|
|
102187
102553
|
const providerType = this.resolveAlias(type2);
|
|
102188
102554
|
const availability = this.providerAvailability.get(providerType);
|
|
@@ -102906,8 +103272,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
102906
103272
|
return { updated: false };
|
|
102907
103273
|
}
|
|
102908
103274
|
this.log("Downloading latest providers from GitHub...");
|
|
102909
|
-
const tmpTar = path45.join(
|
|
102910
|
-
const tmpExtract = path45.join(
|
|
103275
|
+
const tmpTar = path45.join(os25.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
|
|
103276
|
+
const tmpExtract = path45.join(os25.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
|
|
102911
103277
|
await this.downloadFile(tarballTarget.url, tmpTar);
|
|
102912
103278
|
fs38.mkdirSync(tmpExtract, { recursive: true });
|
|
102913
103279
|
await execAsync5(`tar -xzf "${tmpTar}" -C "${tmpExtract}"`, { timeout: 3e4 });
|
|
@@ -103662,7 +104028,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
103662
104028
|
});
|
|
103663
104029
|
}
|
|
103664
104030
|
async function killIdeProcess(ideId) {
|
|
103665
|
-
const plat =
|
|
104031
|
+
const plat = os26.platform();
|
|
103666
104032
|
const appName = getMacAppIdentifiers()[ideId];
|
|
103667
104033
|
const winProcesses = getWinProcessNames()[ideId];
|
|
103668
104034
|
try {
|
|
@@ -103723,7 +104089,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
103723
104089
|
}
|
|
103724
104090
|
}
|
|
103725
104091
|
async function isIdeRunning(ideId) {
|
|
103726
|
-
const plat =
|
|
104092
|
+
const plat = os26.platform();
|
|
103727
104093
|
try {
|
|
103728
104094
|
if (plat === "darwin") {
|
|
103729
104095
|
const appName = getMacAppIdentifiers()[ideId];
|
|
@@ -103778,7 +104144,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
103778
104144
|
}
|
|
103779
104145
|
}
|
|
103780
104146
|
async function detectCurrentWorkspace(ideId) {
|
|
103781
|
-
const plat =
|
|
104147
|
+
const plat = os26.platform();
|
|
103782
104148
|
if (plat === "darwin") {
|
|
103783
104149
|
try {
|
|
103784
104150
|
const appName = getMacAppIdentifiers()[ideId];
|
|
@@ -103798,7 +104164,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
103798
104164
|
const appName = appNameMap[ideId];
|
|
103799
104165
|
if (appName) {
|
|
103800
104166
|
const storagePath = path46.join(
|
|
103801
|
-
process.env.APPDATA || path46.join(
|
|
104167
|
+
process.env.APPDATA || path46.join(os26.homedir(), "AppData", "Roaming"),
|
|
103802
104168
|
appName,
|
|
103803
104169
|
"storage.json"
|
|
103804
104170
|
);
|
|
@@ -103820,7 +104186,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
103820
104186
|
return void 0;
|
|
103821
104187
|
}
|
|
103822
104188
|
async function launchWithCdp(options = {}) {
|
|
103823
|
-
const platform10 =
|
|
104189
|
+
const platform10 = os26.platform();
|
|
103824
104190
|
let targetIde;
|
|
103825
104191
|
const ides = await detectIDEs(getProviderLoader());
|
|
103826
104192
|
if (options.ideId) {
|
|
@@ -106240,7 +106606,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
106240
106606
|
return { success: true };
|
|
106241
106607
|
}
|
|
106242
106608
|
};
|
|
106243
|
-
var
|
|
106609
|
+
var import_path17 = require("path");
|
|
106244
106610
|
var fs39 = __toESM2(require("fs"));
|
|
106245
106611
|
init_logger();
|
|
106246
106612
|
init_mesh_host_ownership();
|
|
@@ -106518,7 +106884,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
106518
106884
|
};
|
|
106519
106885
|
}
|
|
106520
106886
|
if (cliType === "codex-cli") {
|
|
106521
|
-
const repoMcpConfigPath = (0,
|
|
106887
|
+
const repoMcpConfigPath = (0, import_path17.join)(workspace, ".mcp.json");
|
|
106522
106888
|
if (fs39.existsSync(repoMcpConfigPath)) {
|
|
106523
106889
|
try {
|
|
106524
106890
|
const repoMcpConfig = parseMeshCoordinatorMcpConfig(
|
|
@@ -107555,15 +107921,9 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
107555
107921
|
init_logger();
|
|
107556
107922
|
var fs41 = __toESM2(require("fs"));
|
|
107557
107923
|
var path47 = __toESM2(require("path"));
|
|
107558
|
-
|
|
107559
|
-
var ADHDEV_HOME = process.env.ADHDEV_CONFIG_DIR && process.env.ADHDEV_CONFIG_DIR.trim() ? process.env.ADHDEV_CONFIG_DIR.trim() : path47.join(os28.homedir(), ".adhdev");
|
|
107560
|
-
var LOG_DIR = path47.join(ADHDEV_HOME, "logs");
|
|
107924
|
+
init_config_dir();
|
|
107561
107925
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
107562
107926
|
var MAX_DAYS = 7;
|
|
107563
|
-
try {
|
|
107564
|
-
fs41.mkdirSync(LOG_DIR, { recursive: true });
|
|
107565
|
-
} catch {
|
|
107566
|
-
}
|
|
107567
107927
|
var SENSITIVE_KEYS = /* @__PURE__ */ new Set([
|
|
107568
107928
|
"token",
|
|
107569
107929
|
"password",
|
|
@@ -107594,20 +107954,29 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
107594
107954
|
function getDateStr2() {
|
|
107595
107955
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
107596
107956
|
}
|
|
107597
|
-
var currentDate2 =
|
|
107598
|
-
var
|
|
107957
|
+
var currentDate2 = "";
|
|
107958
|
+
var currentDir = "";
|
|
107959
|
+
var currentFile = "";
|
|
107599
107960
|
var writeCount2 = 0;
|
|
107600
|
-
function
|
|
107961
|
+
function refreshCurrentFile() {
|
|
107601
107962
|
const today = getDateStr2();
|
|
107602
|
-
|
|
107603
|
-
|
|
107604
|
-
|
|
107963
|
+
const dir = resolveConfigLogsDir();
|
|
107964
|
+
if (today === currentDate2 && dir === currentDir) return;
|
|
107965
|
+
const dirChanged = dir !== currentDir;
|
|
107966
|
+
currentDate2 = today;
|
|
107967
|
+
currentDir = dir;
|
|
107968
|
+
currentFile = path47.join(dir, `commands-${today}.jsonl`);
|
|
107969
|
+
if (dirChanged) {
|
|
107970
|
+
try {
|
|
107971
|
+
fs41.mkdirSync(dir, { recursive: true });
|
|
107972
|
+
} catch {
|
|
107973
|
+
}
|
|
107605
107974
|
cleanOldFiles();
|
|
107606
107975
|
}
|
|
107607
107976
|
}
|
|
107608
107977
|
function cleanOldFiles() {
|
|
107609
107978
|
try {
|
|
107610
|
-
const files = fs41.readdirSync(
|
|
107979
|
+
const files = fs41.readdirSync(currentDir).filter((f) => f.startsWith("commands-") && f.endsWith(".jsonl"));
|
|
107611
107980
|
const cutoff = /* @__PURE__ */ new Date();
|
|
107612
107981
|
cutoff.setDate(cutoff.getDate() - MAX_DAYS);
|
|
107613
107982
|
const cutoffStr = cutoff.toISOString().slice(0, 10);
|
|
@@ -107615,7 +107984,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
107615
107984
|
const dateMatch = file2.match(/commands-(\d{4}-\d{2}-\d{2})/);
|
|
107616
107985
|
if (dateMatch && dateMatch[1] < cutoffStr) {
|
|
107617
107986
|
try {
|
|
107618
|
-
fs41.unlinkSync(path47.join(
|
|
107987
|
+
fs41.unlinkSync(path47.join(currentDir, file2));
|
|
107619
107988
|
} catch {
|
|
107620
107989
|
}
|
|
107621
107990
|
}
|
|
@@ -107651,8 +108020,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
107651
108020
|
function logCommand(entry) {
|
|
107652
108021
|
if (!shouldLogCommand(entry.cmd)) return;
|
|
107653
108022
|
try {
|
|
108023
|
+
refreshCurrentFile();
|
|
107654
108024
|
if (++writeCount2 % 500 === 0) {
|
|
107655
|
-
checkRotation();
|
|
107656
108025
|
checkSize();
|
|
107657
108026
|
}
|
|
107658
108027
|
const line = JSON.stringify({
|
|
@@ -107671,6 +108040,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
107671
108040
|
}
|
|
107672
108041
|
function getRecentCommands(count = 50) {
|
|
107673
108042
|
try {
|
|
108043
|
+
refreshCurrentFile();
|
|
107674
108044
|
if (!fs41.existsSync(currentFile)) return [];
|
|
107675
108045
|
const content = fs41.readFileSync(currentFile, "utf-8");
|
|
107676
108046
|
const lines = content.trim().split("\n").filter(Boolean);
|
|
@@ -107695,7 +108065,6 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
107695
108065
|
return [];
|
|
107696
108066
|
}
|
|
107697
108067
|
}
|
|
107698
|
-
cleanOldFiles();
|
|
107699
108068
|
init_debug_trace();
|
|
107700
108069
|
init_mesh_host_ownership();
|
|
107701
108070
|
var fs45 = __toESM2(require("fs"));
|
|
@@ -107916,7 +108285,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
107916
108285
|
init_git_status();
|
|
107917
108286
|
init_refine_config();
|
|
107918
108287
|
init_worktree_bootstrap_config();
|
|
107919
|
-
var
|
|
108288
|
+
var import_path18 = require("path");
|
|
107920
108289
|
var fs422 = __toESM2(require("fs"));
|
|
107921
108290
|
var import_node_child_process9 = require("child_process");
|
|
107922
108291
|
init_resolve_executable();
|
|
@@ -108158,7 +108527,7 @@ ${e?.stderr || ""}`
|
|
|
108158
108527
|
} catch {
|
|
108159
108528
|
continue;
|
|
108160
108529
|
}
|
|
108161
|
-
const submoduleRepo = (0,
|
|
108530
|
+
const submoduleRepo = (0, import_path18.join)(repoRoot, p);
|
|
108162
108531
|
let fastForward;
|
|
108163
108532
|
let reachableFromOriginMain;
|
|
108164
108533
|
if (branchCommit) {
|
|
@@ -108465,7 +108834,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108465
108834
|
const baseCommit = readTreeObject(repoRoot, baseHead, path54);
|
|
108466
108835
|
const branchCommit = readTreeObject(repoRoot, branchHead, path54);
|
|
108467
108836
|
if (!baseCommit || !branchCommit) return false;
|
|
108468
|
-
return isSubmoduleFastForward((0,
|
|
108837
|
+
return isSubmoduleFastForward((0, import_path18.resolve)(repoRoot, path54), baseCommit, branchCommit);
|
|
108469
108838
|
});
|
|
108470
108839
|
}
|
|
108471
108840
|
function collectTrivialFastForwardGitlinkResolutions(worktreeRoot, baseRepoRoot, baseHead, branchHead) {
|
|
@@ -108474,8 +108843,8 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108474
108843
|
const baseCommit = readTreeObject(baseRepoRoot, baseHead, path54);
|
|
108475
108844
|
const branchCommit = readTreeObject(worktreeRoot, branchHead, path54);
|
|
108476
108845
|
if (!baseCommit || !branchCommit) continue;
|
|
108477
|
-
const submoduleRepoPath = (0,
|
|
108478
|
-
ensureSubmoduleCommitLocal(submoduleRepoPath, (0,
|
|
108846
|
+
const submoduleRepoPath = (0, import_path18.resolve)(worktreeRoot, path54);
|
|
108847
|
+
ensureSubmoduleCommitLocal(submoduleRepoPath, (0, import_path18.resolve)(baseRepoRoot, path54), baseCommit);
|
|
108479
108848
|
if (baseCommit === branchCommit) {
|
|
108480
108849
|
continue;
|
|
108481
108850
|
}
|
|
@@ -108540,9 +108909,9 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108540
108909
|
for (const path54 of changed) {
|
|
108541
108910
|
const baseCommit = readTreeObject(baseRepoRoot, baseHead, path54);
|
|
108542
108911
|
const branchCommit = readTreeObject(worktreeRoot, branchHead, path54);
|
|
108543
|
-
const submoduleRepoPath = (0,
|
|
108912
|
+
const submoduleRepoPath = (0, import_path18.resolve)(worktreeRoot, path54);
|
|
108544
108913
|
if (baseCommit) {
|
|
108545
|
-
ensureSubmoduleCommitLocal(submoduleRepoPath, (0,
|
|
108914
|
+
ensureSubmoduleCommitLocal(submoduleRepoPath, (0, import_path18.resolve)(baseRepoRoot, path54), baseCommit);
|
|
108546
108915
|
}
|
|
108547
108916
|
if (!baseCommit || !branchCommit || !isSubmoduleDivergedSibling(submoduleRepoPath, baseCommit, branchCommit)) {
|
|
108548
108917
|
gitlinks.push({ path: path54, baseCommit, branchCommit, action: "skipped_not_diverged" });
|
|
@@ -108656,7 +109025,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108656
109025
|
for (const p of conflicts) {
|
|
108657
109026
|
const commit = resolveByPath.get(p);
|
|
108658
109027
|
try {
|
|
108659
|
-
(0, import_node_child_process9.execFileSync)(GIT3, ["checkout", "-q", "--detach", commit], { cwd: (0,
|
|
109028
|
+
(0, import_node_child_process9.execFileSync)(GIT3, ["checkout", "-q", "--detach", commit], { cwd: (0, import_path18.resolve)(worktreeRoot, p), stdio: "ignore" });
|
|
108660
109029
|
} catch {
|
|
108661
109030
|
}
|
|
108662
109031
|
try {
|
|
@@ -108678,7 +109047,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108678
109047
|
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path54) => {
|
|
108679
109048
|
const baseCommit = readTreeObject(repoRoot, baseHead, path54);
|
|
108680
109049
|
const branchCommit = readTreeObject(repoRoot, branchHead, path54);
|
|
108681
|
-
const submoduleRepoPath = (0,
|
|
109050
|
+
const submoduleRepoPath = (0, import_path18.resolve)(repoRoot, path54);
|
|
108682
109051
|
const fastForward = !!baseCommit && !!branchCommit && isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit);
|
|
108683
109052
|
return { path: path54, baseCommit, branchCommit, fastForward };
|
|
108684
109053
|
});
|
|
@@ -108733,7 +109102,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108733
109102
|
if (!tree) return void 0;
|
|
108734
109103
|
const updates = paths.map((path54) => `160000 commit ${placeholderCommit} ${path54}`).join("\n");
|
|
108735
109104
|
if (!updates) return tree;
|
|
108736
|
-
const tmpIndex = (0,
|
|
109105
|
+
const tmpIndex = (0, import_path18.join)(resolveGitDir(repoRoot), `adhdev-refine-eq-${commitish.slice(0, 12)}.index`);
|
|
108737
109106
|
const env2 = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
108738
109107
|
try {
|
|
108739
109108
|
(0, import_node_child_process9.execFileSync)(GIT3, ["read-tree", tree], { cwd: repoRoot, env: env2, stdio: "ignore" });
|
|
@@ -108808,7 +109177,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108808
109177
|
if (!contentTree) return void 0;
|
|
108809
109178
|
const updates = branchGitlinks.map((entry) => `160000 commit ${entry.branchCommit} ${entry.path}`).join("\n");
|
|
108810
109179
|
if (!updates) return contentTree;
|
|
108811
|
-
const tmpIndex = (0,
|
|
109180
|
+
const tmpIndex = (0, import_path18.join)(resolveGitDir(repoRoot), `adhdev-refine-ff-${baseHead.slice(0, 12)}-${branchHead.slice(0, 12)}.index`);
|
|
108812
109181
|
const env2 = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
108813
109182
|
try {
|
|
108814
109183
|
(0, import_node_child_process9.execFileSync)(GIT3, ["read-tree", contentTree], { cwd: repoRoot, env: env2, stdio: "ignore" });
|
|
@@ -108952,7 +109321,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108952
109321
|
return match ? { commit: match[1], path: match[2] } : null;
|
|
108953
109322
|
}).filter((entry) => !!entry);
|
|
108954
109323
|
for (const gitlink of gitlinks) {
|
|
108955
|
-
const submodulePath = (0,
|
|
109324
|
+
const submodulePath = (0, import_path18.resolve)(repoRoot, gitlink.path);
|
|
108956
109325
|
const entry = {
|
|
108957
109326
|
path: gitlink.path,
|
|
108958
109327
|
commit: gitlink.commit,
|
|
@@ -108981,7 +109350,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
108981
109350
|
try {
|
|
108982
109351
|
const imported = await importCommitFromWorktreeSubmodule(
|
|
108983
109352
|
submodulePath,
|
|
108984
|
-
(0,
|
|
109353
|
+
(0, import_path18.resolve)(options.worktreeRoot, gitlink.path),
|
|
108985
109354
|
gitlink.commit
|
|
108986
109355
|
);
|
|
108987
109356
|
if (imported) {
|
|
@@ -109201,13 +109570,13 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
109201
109570
|
...extras
|
|
109202
109571
|
});
|
|
109203
109572
|
const isPackageManagerValidation = (candidate) => {
|
|
109204
|
-
const command = (0,
|
|
109573
|
+
const command = (0, import_path18.basename)(candidate.command).replace(/\.(?:cmd|exe)$/i, "");
|
|
109205
109574
|
return ["npm", "pnpm", "yarn", "bun"].includes(command) && candidate.args.some((arg) => arg === "run" || arg === "test" || arg === "exec");
|
|
109206
109575
|
};
|
|
109207
109576
|
const dependenciesLikelyMissing = (cwd) => {
|
|
109208
|
-
if (!fs422.existsSync((0,
|
|
109209
|
-
if (fs422.existsSync((0,
|
|
109210
|
-
return ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "bun.lock"].some((lock) => fs422.existsSync((0,
|
|
109577
|
+
if (!fs422.existsSync((0, import_path18.join)(cwd, "package.json"))) return false;
|
|
109578
|
+
if (fs422.existsSync((0, import_path18.join)(cwd, "node_modules"))) return false;
|
|
109579
|
+
return ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "bun.lock"].some((lock) => fs422.existsSync((0, import_path18.join)(cwd, lock)));
|
|
109211
109580
|
};
|
|
109212
109581
|
const needsNodeModules = (candidate, cwd) => isPackageManagerValidation(candidate) && dependenciesLikelyMissing(cwd);
|
|
109213
109582
|
const isDaemonScopedCommand = (candidate) => {
|
|
@@ -109274,7 +109643,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
109274
109643
|
summary.bootstrap = { stage: "legacy" };
|
|
109275
109644
|
for (const candidate of selection.bootstrapCommands) {
|
|
109276
109645
|
const startedAt = Date.now();
|
|
109277
|
-
const cwd = candidate.cwd ? (0,
|
|
109646
|
+
const cwd = candidate.cwd ? (0, import_path18.resolve)(workspace, candidate.cwd) : workspace;
|
|
109278
109647
|
const timeout = candidate.timeoutMs || REFINE_VALIDATION_TIMEOUT_MS;
|
|
109279
109648
|
const resolvedCommand = resolveWin32Executable(candidate.command);
|
|
109280
109649
|
const spawn7 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
|
|
@@ -109307,7 +109676,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
109307
109676
|
let missingDepsBlocked = false;
|
|
109308
109677
|
for (const candidate of commandsToRun) {
|
|
109309
109678
|
const startedAt = Date.now();
|
|
109310
|
-
const cwd = candidate.cwd ? (0,
|
|
109679
|
+
const cwd = candidate.cwd ? (0, import_path18.resolve)(workspace, candidate.cwd) : workspace;
|
|
109311
109680
|
const timeout = candidate.timeoutMs || REFINE_VALIDATION_TIMEOUT_MS;
|
|
109312
109681
|
const bootstrapProvidedDependencies = summary.bootstrap?.stage === "cached" || summary.bootstrap?.stage === "ran" || summary.bootstrap?.stage === "legacy";
|
|
109313
109682
|
if (!bootstrapProvidedDependencies && needsNodeModules(candidate, cwd)) {
|
|
@@ -111301,7 +111670,7 @@ ${e?.stderr || ""}`;
|
|
|
111301
111670
|
return handle;
|
|
111302
111671
|
}
|
|
111303
111672
|
var fs43 = __toESM2(require("fs"));
|
|
111304
|
-
var
|
|
111673
|
+
var import_path19 = require("path");
|
|
111305
111674
|
init_logger();
|
|
111306
111675
|
init_dist();
|
|
111307
111676
|
init_mesh_node_identity();
|
|
@@ -111311,7 +111680,7 @@ ${e?.stderr || ""}`;
|
|
|
111311
111680
|
function acceptableManagedWorktreePaths(resolveWorktreePath2, normalizePath2, repoRoot, meshName, branch, worktreeBaseDir) {
|
|
111312
111681
|
const safeBranch = branch.replace(/[/\\:*?"<>|]/g, "-").replace(/^\.+|\.+$/g, "");
|
|
111313
111682
|
const safeMeshName = meshName.replace(/[/\\:*?"<>|]/g, "-").replace(/^\.+|\.+$/g, "");
|
|
111314
|
-
const legacyPath = (0,
|
|
111683
|
+
const legacyPath = (0, import_path19.join)((0, import_path19.dirname)(repoRoot), LEGACY_WORKTREE_DIR_NAME, safeMeshName, safeBranch);
|
|
111315
111684
|
const candidates = [
|
|
111316
111685
|
resolveWorktreePath2(repoRoot, meshName, branch, worktreeBaseDir),
|
|
111317
111686
|
legacyPath
|
|
@@ -111393,7 +111762,7 @@ ${e?.stderr || ""}`;
|
|
|
111393
111762
|
}
|
|
111394
111763
|
const { resolveWorktreePath: resolveWorktreePath2, listWorktrees: listWorktrees2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
|
|
111395
111764
|
const normalizePath2 = (value) => {
|
|
111396
|
-
const resolved = (0,
|
|
111765
|
+
const resolved = (0, import_path19.resolve)(value);
|
|
111397
111766
|
try {
|
|
111398
111767
|
return fs43.realpathSync(resolved);
|
|
111399
111768
|
} catch {
|
|
@@ -111489,7 +111858,7 @@ ${e?.stderr || ""}`;
|
|
|
111489
111858
|
}
|
|
111490
111859
|
const { resolveWorktreePath: resolveWorktreePath2, listWorktrees: listWorktrees2, removeWorktree: removeWorktree2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
|
|
111491
111860
|
const normalizePath2 = (value) => {
|
|
111492
|
-
const resolved = (0,
|
|
111861
|
+
const resolved = (0, import_path19.resolve)(value);
|
|
111493
111862
|
try {
|
|
111494
111863
|
return fs43.realpathSync(resolved);
|
|
111495
111864
|
} catch {
|
|
@@ -112129,7 +112498,7 @@ ${e?.stderr || ""}`;
|
|
|
112129
112498
|
init_logger();
|
|
112130
112499
|
var yaml5 = __toESM2(require_js_yaml());
|
|
112131
112500
|
var import_os5 = require("os");
|
|
112132
|
-
var
|
|
112501
|
+
var import_path20 = require("path");
|
|
112133
112502
|
var fs44 = __toESM2(require("fs"));
|
|
112134
112503
|
function loadYamlModule() {
|
|
112135
112504
|
return yaml5;
|
|
@@ -112149,13 +112518,13 @@ ${e?.stderr || ""}`;
|
|
|
112149
112518
|
}
|
|
112150
112519
|
function resolveHermesUserHome() {
|
|
112151
112520
|
const explicitHome = process.env.HERMES_HOME?.trim();
|
|
112152
|
-
return explicitHome || (0,
|
|
112521
|
+
return explicitHome || (0, import_path20.join)((0, import_os5.homedir)(), ".hermes");
|
|
112153
112522
|
}
|
|
112154
112523
|
function loadHermesCoordinatorBaseConfig(targetConfigPath) {
|
|
112155
112524
|
const sourceHome = resolveHermesUserHome();
|
|
112156
|
-
const sourceConfigPath = (0,
|
|
112525
|
+
const sourceConfigPath = (0, import_path20.join)(sourceHome, "config.yaml");
|
|
112157
112526
|
if (!fs44.existsSync(sourceConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
|
|
112158
|
-
if ((0,
|
|
112527
|
+
if ((0, import_path20.resolve)(sourceConfigPath) === (0, import_path20.resolve)(targetConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
|
|
112159
112528
|
const parsed = parseMeshCoordinatorMcpConfig(fs44.readFileSync(sourceConfigPath, "utf-8"), "hermes_config_yaml");
|
|
112160
112529
|
const { mcp_servers: _mcpServers, ...baseConfig } = parsed;
|
|
112161
112530
|
return { config: baseConfig, sourceHome, sourceConfigPath };
|
|
@@ -112189,10 +112558,10 @@ ${e?.stderr || ""}`;
|
|
|
112189
112558
|
return sanitized;
|
|
112190
112559
|
}
|
|
112191
112560
|
function copyHermesCoordinatorCredentialFiles(sourceHome, targetHome) {
|
|
112192
|
-
if ((0,
|
|
112561
|
+
if ((0, import_path20.resolve)(sourceHome) === (0, import_path20.resolve)(targetHome)) return;
|
|
112193
112562
|
for (const fileName of [".env", "auth.json"]) {
|
|
112194
|
-
const sourcePath = (0,
|
|
112195
|
-
const targetPath = (0,
|
|
112563
|
+
const sourcePath = (0, import_path20.join)(sourceHome, fileName);
|
|
112564
|
+
const targetPath = (0, import_path20.join)(targetHome, fileName);
|
|
112196
112565
|
if (!fs44.existsSync(sourcePath)) continue;
|
|
112197
112566
|
try {
|
|
112198
112567
|
fs44.copyFileSync(sourcePath, targetPath);
|
|
@@ -113180,6 +113549,7 @@ ${e?.stderr || ""}`;
|
|
|
113180
113549
|
init_builders();
|
|
113181
113550
|
init_snapshot2();
|
|
113182
113551
|
init_build_info();
|
|
113552
|
+
init_track_identity();
|
|
113183
113553
|
init_normalize();
|
|
113184
113554
|
init_logger();
|
|
113185
113555
|
init_debug_config();
|
|
@@ -114618,7 +114988,7 @@ ${e?.stderr || ""}`;
|
|
|
114618
114988
|
init_chat_message_normalization();
|
|
114619
114989
|
var fs46 = __toESM2(require("fs"));
|
|
114620
114990
|
var path48 = __toESM2(require("path"));
|
|
114621
|
-
var
|
|
114991
|
+
var os27 = __toESM2(require("os"));
|
|
114622
114992
|
var import_os6 = require("os");
|
|
114623
114993
|
init_config();
|
|
114624
114994
|
var import_child_process13 = require("child_process");
|
|
@@ -114743,7 +115113,7 @@ ${e?.stderr || ""}`;
|
|
|
114743
115113
|
function checkPathExists2(paths) {
|
|
114744
115114
|
for (const p of paths) {
|
|
114745
115115
|
if (p.includes("*")) {
|
|
114746
|
-
const home =
|
|
115116
|
+
const home = os27.homedir();
|
|
114747
115117
|
const resolved = p.replace(/\*/g, home.split(path48.sep).pop() || "");
|
|
114748
115118
|
if (fs46.existsSync(resolved)) return resolved;
|
|
114749
115119
|
} else {
|
|
@@ -117140,7 +117510,7 @@ async (params) => {
|
|
|
117140
117510
|
}
|
|
117141
117511
|
var fs49 = __toESM2(require("fs"));
|
|
117142
117512
|
var path51 = __toESM2(require("path"));
|
|
117143
|
-
var
|
|
117513
|
+
var os28 = __toESM2(require("os"));
|
|
117144
117514
|
var import_session_host_core11 = require_dist();
|
|
117145
117515
|
function getAutoImplPid(ctx) {
|
|
117146
117516
|
const pid = ctx.autoImplProcess?.pid;
|
|
@@ -117342,7 +117712,7 @@ async (params) => {
|
|
|
117342
117712
|
});
|
|
117343
117713
|
const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
|
|
117344
117714
|
const prompt = buildAutoImplPrompt(ctx, type2, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
|
|
117345
|
-
const tmpDir = path51.join(
|
|
117715
|
+
const tmpDir = path51.join(os28.tmpdir(), "adhdev-autoimpl");
|
|
117346
117716
|
if (!fs49.existsSync(tmpDir)) fs49.mkdirSync(tmpDir, { recursive: true });
|
|
117347
117717
|
const promptFile = path51.join(tmpDir, `prompt-${type2}-${Date.now()}.md`);
|
|
117348
117718
|
fs49.writeFileSync(promptFile, prompt, "utf-8");
|
|
@@ -117497,7 +117867,7 @@ async (params) => {
|
|
|
117497
117867
|
const interactiveFlags = ["--yolo", "--interactive", "-i"];
|
|
117498
117868
|
const baseArgs = [...spawn7.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
117499
117869
|
let shellCmd;
|
|
117500
|
-
const isWin =
|
|
117870
|
+
const isWin = os28.platform() === "win32";
|
|
117501
117871
|
const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
|
|
117502
117872
|
const promptMode = autoImpl?.promptMode ?? "stdin";
|
|
117503
117873
|
const extraArgs = autoImpl?.extraArgs ?? [];
|
|
@@ -117536,7 +117906,7 @@ async (params) => {
|
|
|
117536
117906
|
try {
|
|
117537
117907
|
const pty = require("node-pty");
|
|
117538
117908
|
ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
|
|
117539
|
-
const isWin2 =
|
|
117909
|
+
const isWin2 = os28.platform() === "win32";
|
|
117540
117910
|
child = pty.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
|
|
117541
117911
|
name: "xterm-256color",
|
|
117542
117912
|
cols: import_session_host_core11.DEFAULT_SESSION_HOST_COLS,
|
|
@@ -120191,7 +120561,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
120191
120561
|
}
|
|
120192
120562
|
var import_child_process14 = require("child_process");
|
|
120193
120563
|
var fs51 = __toESM2(require("fs"));
|
|
120194
|
-
var
|
|
120564
|
+
var os29 = __toESM2(require("os"));
|
|
120195
120565
|
var path53 = __toESM2(require("path"));
|
|
120196
120566
|
var import_session_host_core15 = require_dist();
|
|
120197
120567
|
init_logger();
|
|
@@ -120263,7 +120633,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
120263
120633
|
}
|
|
120264
120634
|
let portableNode = null;
|
|
120265
120635
|
try {
|
|
120266
|
-
portableNode = findPortableNode22(
|
|
120636
|
+
portableNode = findPortableNode22(os29.homedir(), process.execPath, resolveInstanceDir());
|
|
120267
120637
|
} catch (error48) {
|
|
120268
120638
|
LOG2.warn(
|
|
120269
120639
|
"SessionHost",
|