@adhdev/daemon-standalone 0.9.82-rc.314 → 0.9.82-rc.316
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 +289 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-BgoSEH_z.js +613 -0
- package/public/assets/index-C6hDLm-5.js +613 -0
- package/public/assets/terminal-BU39etVi.js +143 -0
- package/public/assets/vendor-CETaSQ-b.js +2821 -0
- package/public/index.html +2 -2
package/dist/index.js
CHANGED
|
@@ -707,6 +707,13 @@ var require_dist = __commonJS({
|
|
|
707
707
|
delete env2.CODEX_SANDBOX_NETWORK_DISABLED;
|
|
708
708
|
delete env2.NO_COLOR;
|
|
709
709
|
delete env2.COLOR;
|
|
710
|
+
if (process.platform === "win32") {
|
|
711
|
+
delete env2.CLAUDECODE;
|
|
712
|
+
delete env2.CLAUDE_CODE_CHILD_SESSION;
|
|
713
|
+
delete env2.CLAUDE_CODE_ENTRYPOINT;
|
|
714
|
+
delete env2.CLAUDE_CODE_SESSION_ID;
|
|
715
|
+
delete env2.CLAUDE_CODE_EXECPATH;
|
|
716
|
+
}
|
|
710
717
|
applyTerminalColorEnv2(env2);
|
|
711
718
|
return env2;
|
|
712
719
|
}
|
|
@@ -29744,6 +29751,35 @@ var require_dist3 = __commonJS({
|
|
|
29744
29751
|
const raw = Number(nodePolicy?.schedulingPriority);
|
|
29745
29752
|
return Number.isFinite(raw) ? raw : 0;
|
|
29746
29753
|
}
|
|
29754
|
+
function resolveTaskAffinityRole(taskMode, policy) {
|
|
29755
|
+
if (!taskMode) return null;
|
|
29756
|
+
if (policy?.enabled === false) return null;
|
|
29757
|
+
const override = policy?.byTaskMode && Object.prototype.hasOwnProperty.call(policy.byTaskMode, taskMode) ? policy.byTaskMode[taskMode] : void 0;
|
|
29758
|
+
if (typeof override === "string") {
|
|
29759
|
+
const trimmed = override.trim().toLowerCase();
|
|
29760
|
+
return trimmed ? trimmed : null;
|
|
29761
|
+
}
|
|
29762
|
+
const fallback = DEFAULT_TASKMODE_ROLE_MAP[taskMode];
|
|
29763
|
+
return fallback ?? null;
|
|
29764
|
+
}
|
|
29765
|
+
function resolveMeshRoleOptions(policy) {
|
|
29766
|
+
const out = [...STANDARD_MESH_ROLES];
|
|
29767
|
+
const seen = new Set(out);
|
|
29768
|
+
const add = (raw) => {
|
|
29769
|
+
if (typeof raw !== "string") return;
|
|
29770
|
+
const role = raw.trim().toLowerCase();
|
|
29771
|
+
if (!role || seen.has(role)) return;
|
|
29772
|
+
seen.add(role);
|
|
29773
|
+
out.push(role);
|
|
29774
|
+
};
|
|
29775
|
+
if (policy?.byTaskMode) {
|
|
29776
|
+
for (const value of Object.values(policy.byTaskMode)) add(value);
|
|
29777
|
+
}
|
|
29778
|
+
if (Array.isArray(policy?.customRoles)) {
|
|
29779
|
+
for (const value of policy.customRoles) add(value);
|
|
29780
|
+
}
|
|
29781
|
+
return out;
|
|
29782
|
+
}
|
|
29747
29783
|
function resolveAutoConvergeCodeChange(policy) {
|
|
29748
29784
|
return policy?.autoConvergeCodeChange === true;
|
|
29749
29785
|
}
|
|
@@ -29778,6 +29814,8 @@ var require_dist3 = __commonJS({
|
|
|
29778
29814
|
var DEFAULT_MESH_SCHEDULING_STRATEGY;
|
|
29779
29815
|
var MESH_CONVERGE_REFINE_TAG;
|
|
29780
29816
|
var MESH_CONVERGE_FAST_FORWARD_TAG;
|
|
29817
|
+
var STANDARD_MESH_ROLES;
|
|
29818
|
+
var DEFAULT_TASKMODE_ROLE_MAP;
|
|
29781
29819
|
var DEFAULT_MESH_POLICY;
|
|
29782
29820
|
var init_repo_mesh_types = __esm2({
|
|
29783
29821
|
"src/repo-mesh-types.ts"() {
|
|
@@ -29791,6 +29829,14 @@ var require_dist3 = __commonJS({
|
|
|
29791
29829
|
DEFAULT_MESH_SCHEDULING_STRATEGY = "first_eligible";
|
|
29792
29830
|
MESH_CONVERGE_REFINE_TAG = "converge=refine";
|
|
29793
29831
|
MESH_CONVERGE_FAST_FORWARD_TAG = "converge=fast_forward";
|
|
29832
|
+
STANDARD_MESH_ROLES = ["investigator", "coder", "validator", "converger"];
|
|
29833
|
+
DEFAULT_TASKMODE_ROLE_MAP = {
|
|
29834
|
+
live_debug_readonly: "investigator",
|
|
29835
|
+
code_change: "coder",
|
|
29836
|
+
launch_app: "coder",
|
|
29837
|
+
validation: "validator",
|
|
29838
|
+
convergence: "converger"
|
|
29839
|
+
};
|
|
29794
29840
|
DEFAULT_MESH_POLICY = {
|
|
29795
29841
|
requirePreTaskCheckpoint: false,
|
|
29796
29842
|
requirePostTaskCheckpoint: true,
|
|
@@ -30029,10 +30075,10 @@ var require_dist3 = __commonJS({
|
|
|
30029
30075
|
}
|
|
30030
30076
|
function getDaemonBuildInfo() {
|
|
30031
30077
|
if (cached2) return cached2;
|
|
30032
|
-
const commit = readInjected(true ? "
|
|
30033
|
-
const commitShort = readInjected(true ? "
|
|
30034
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30035
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30078
|
+
const commit = readInjected(true ? "930909642b3f28668483159d3a8f39d0a796c61a" : void 0) ?? "unknown";
|
|
30079
|
+
const commitShort = readInjected(true ? "93090964" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30080
|
+
const version2 = readInjected(true ? "0.9.82-rc.316" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30081
|
+
const builtAt = readInjected(true ? "2026-06-18T07:23:33.672Z" : void 0);
|
|
30036
30082
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30037
30083
|
return cached2;
|
|
30038
30084
|
}
|
|
@@ -31297,8 +31343,61 @@ ${error48.message || ""}`;
|
|
|
31297
31343
|
} else {
|
|
31298
31344
|
delete policy.autoConvergeCodeChange;
|
|
31299
31345
|
}
|
|
31346
|
+
const normalizedAffinity = normalizeTaskAffinityPolicy(policy.taskAffinity);
|
|
31347
|
+
if (normalizedAffinity) {
|
|
31348
|
+
policy.taskAffinity = normalizedAffinity;
|
|
31349
|
+
} else {
|
|
31350
|
+
delete policy.taskAffinity;
|
|
31351
|
+
}
|
|
31300
31352
|
return policy;
|
|
31301
31353
|
}
|
|
31354
|
+
function normalizeTaskAffinityPolicy(value) {
|
|
31355
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
31356
|
+
const record2 = value;
|
|
31357
|
+
const out = {};
|
|
31358
|
+
let hasContent = false;
|
|
31359
|
+
if (typeof record2.enabled === "boolean") {
|
|
31360
|
+
out.enabled = record2.enabled;
|
|
31361
|
+
if (record2.enabled === false) hasContent = true;
|
|
31362
|
+
else delete out.enabled;
|
|
31363
|
+
}
|
|
31364
|
+
if (record2.byTaskMode && typeof record2.byTaskMode === "object" && !Array.isArray(record2.byTaskMode)) {
|
|
31365
|
+
const byTaskMode = {};
|
|
31366
|
+
for (const [mode, raw] of Object.entries(record2.byTaskMode)) {
|
|
31367
|
+
const modeKey = mode.trim();
|
|
31368
|
+
if (!modeKey) continue;
|
|
31369
|
+
if (typeof raw !== "string") continue;
|
|
31370
|
+
const role = raw.trim().toLowerCase();
|
|
31371
|
+
byTaskMode[modeKey] = role;
|
|
31372
|
+
if (role && !STANDARD_MESH_ROLES.includes(role)) {
|
|
31373
|
+
try {
|
|
31374
|
+
console.warn(`[mesh] task_affinity.byTaskMode.${modeKey}: custom role "${role}" is not a standard mesh role (${STANDARD_MESH_ROLES.join("/")}); routing still applies`);
|
|
31375
|
+
} catch {
|
|
31376
|
+
}
|
|
31377
|
+
}
|
|
31378
|
+
}
|
|
31379
|
+
if (Object.keys(byTaskMode).length > 0) {
|
|
31380
|
+
out.byTaskMode = byTaskMode;
|
|
31381
|
+
hasContent = true;
|
|
31382
|
+
}
|
|
31383
|
+
}
|
|
31384
|
+
if (Array.isArray(record2.customRoles)) {
|
|
31385
|
+
const seen = /* @__PURE__ */ new Set();
|
|
31386
|
+
const customRoles = [];
|
|
31387
|
+
for (const raw of record2.customRoles) {
|
|
31388
|
+
if (typeof raw !== "string") continue;
|
|
31389
|
+
const role = raw.trim().toLowerCase();
|
|
31390
|
+
if (!role || seen.has(role)) continue;
|
|
31391
|
+
seen.add(role);
|
|
31392
|
+
customRoles.push(role);
|
|
31393
|
+
}
|
|
31394
|
+
if (customRoles.length > 0) {
|
|
31395
|
+
out.customRoles = customRoles;
|
|
31396
|
+
hasContent = true;
|
|
31397
|
+
}
|
|
31398
|
+
}
|
|
31399
|
+
return hasContent ? out : void 0;
|
|
31400
|
+
}
|
|
31302
31401
|
function normalizeAutoFastForwardPolicy(value) {
|
|
31303
31402
|
const record2 = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
31304
31403
|
const maxBehind = Number(record2.maxBehind);
|
|
@@ -32611,6 +32710,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
32611
32710
|
recordTaskAutoLaunch: () => recordTaskAutoLaunch,
|
|
32612
32711
|
requeueTask: () => requeueTask,
|
|
32613
32712
|
resolveConvergeRequiredTags: () => resolveConvergeRequiredTags,
|
|
32713
|
+
resolveTaskAffinityRequiredTags: () => resolveTaskAffinityRequiredTags,
|
|
32614
32714
|
updateDirectDispatchStatus: () => updateDirectDispatchStatus,
|
|
32615
32715
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
32616
32716
|
updateTaskStatus: () => updateTaskStatus,
|
|
@@ -32749,6 +32849,31 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
32749
32849
|
if (!optedIn) return explicitRequiredTags;
|
|
32750
32850
|
return normalizeMeshCapabilityTags([...explicitRequiredTags, MESH_CONVERGE_REFINE_TAG]);
|
|
32751
32851
|
}
|
|
32852
|
+
function meshHasNodeAdvertisingRole(nodes, role) {
|
|
32853
|
+
if (!Array.isArray(nodes) || nodes.length === 0) return false;
|
|
32854
|
+
const wanted = `role=${role}`;
|
|
32855
|
+
return nodes.some((node) => buildMeshNodeCapabilityTags(node).includes(wanted));
|
|
32856
|
+
}
|
|
32857
|
+
function resolveTaskAffinityRequiredTags(meshId, taskMode, explicitRequiredTags, opts) {
|
|
32858
|
+
if (typeof opts?.targetNodeId === "string" && opts.targetNodeId.trim()) return explicitRequiredTags;
|
|
32859
|
+
if (opts?.callerSpecifiedRequiredTags === true) return explicitRequiredTags;
|
|
32860
|
+
let mesh;
|
|
32861
|
+
try {
|
|
32862
|
+
mesh = getMesh(meshId);
|
|
32863
|
+
} catch {
|
|
32864
|
+
return explicitRequiredTags;
|
|
32865
|
+
}
|
|
32866
|
+
const role = resolveTaskAffinityRole(taskMode, mesh?.policy?.taskAffinity);
|
|
32867
|
+
if (!role) return explicitRequiredTags;
|
|
32868
|
+
if (!meshHasNodeAdvertisingRole(mesh?.nodes, role)) {
|
|
32869
|
+
try {
|
|
32870
|
+
console.warn(`[mesh] task_affinity: no node advertises role=${role} for taskMode=${taskMode} in mesh ${meshId}; skipping injection (least_loaded fallback)`);
|
|
32871
|
+
} catch {
|
|
32872
|
+
}
|
|
32873
|
+
return explicitRequiredTags;
|
|
32874
|
+
}
|
|
32875
|
+
return normalizeMeshCapabilityTags([...explicitRequiredTags, `role=${role}`]);
|
|
32876
|
+
}
|
|
32752
32877
|
function withQueueLock(_meshId, fn) {
|
|
32753
32878
|
return MeshRuntimeStore.getInstance().transaction(fn);
|
|
32754
32879
|
}
|
|
@@ -32799,6 +32924,20 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
32799
32924
|
throw new Error(`duplicate_task_id: task '${id}' already exists in mesh '${meshId}'`);
|
|
32800
32925
|
}
|
|
32801
32926
|
assertNoDependencyCycle(meshId, id, dependsOn);
|
|
32927
|
+
const callerTags = normalizeMeshCapabilityTags(opts?.requiredTags);
|
|
32928
|
+
const callerSpecifiedRequiredTags = callerTags.length > 0;
|
|
32929
|
+
let resolvedRequiredTags = resolveConvergeRequiredTags(
|
|
32930
|
+
meshId,
|
|
32931
|
+
modeValidation.taskMode,
|
|
32932
|
+
callerTags,
|
|
32933
|
+
{ targetNodeId: opts?.targetNodeId }
|
|
32934
|
+
);
|
|
32935
|
+
resolvedRequiredTags = resolveTaskAffinityRequiredTags(
|
|
32936
|
+
meshId,
|
|
32937
|
+
modeValidation.taskMode,
|
|
32938
|
+
resolvedRequiredTags,
|
|
32939
|
+
{ targetNodeId: opts?.targetNodeId, callerSpecifiedRequiredTags }
|
|
32940
|
+
);
|
|
32802
32941
|
const entry = {
|
|
32803
32942
|
id,
|
|
32804
32943
|
meshId,
|
|
@@ -32807,15 +32946,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
32807
32946
|
taskMode: modeValidation.taskMode,
|
|
32808
32947
|
targetNodeId: opts?.targetNodeId,
|
|
32809
32948
|
targetSessionId: opts?.targetSessionId,
|
|
32810
|
-
|
|
32811
|
-
// tasks so they hard-filter onto refine-capable worktree nodes. No-op unless
|
|
32812
|
-
// the mesh opts in; explicit target_node_id / required_tags are preserved.
|
|
32813
|
-
requiredTags: resolveConvergeRequiredTags(
|
|
32814
|
-
meshId,
|
|
32815
|
-
modeValidation.taskMode,
|
|
32816
|
-
normalizeMeshCapabilityTags(opts?.requiredTags),
|
|
32817
|
-
{ targetNodeId: opts?.targetNodeId }
|
|
32818
|
-
),
|
|
32949
|
+
requiredTags: resolvedRequiredTags,
|
|
32819
32950
|
...dependsOn.length > 0 ? { dependsOn } : {},
|
|
32820
32951
|
...typeof opts?.missionId === "string" && opts.missionId.trim() ? { missionId: opts.missionId.trim() } : {},
|
|
32821
32952
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -40732,8 +40863,24 @@ Next step: ${nextStep}`;
|
|
|
40732
40863
|
}
|
|
40733
40864
|
const isWin = os12.platform() === "win32";
|
|
40734
40865
|
const paths = (process.env.PATH || "").split(path17.delimiter);
|
|
40866
|
+
const extraDirs = [];
|
|
40867
|
+
if (isWin) {
|
|
40868
|
+
if (process.env.APPDATA) extraDirs.push(path17.join(process.env.APPDATA, "npm"));
|
|
40869
|
+
try {
|
|
40870
|
+
extraDirs.push(path17.dirname(process.execPath));
|
|
40871
|
+
} catch {
|
|
40872
|
+
}
|
|
40873
|
+
} else {
|
|
40874
|
+
extraDirs.push(path17.join(os12.homedir(), ".npm-global", "bin"));
|
|
40875
|
+
extraDirs.push("/usr/local/bin", "/opt/homebrew/bin");
|
|
40876
|
+
try {
|
|
40877
|
+
extraDirs.push(path17.dirname(process.execPath));
|
|
40878
|
+
} catch {
|
|
40879
|
+
}
|
|
40880
|
+
}
|
|
40881
|
+
const searchDirs = [...paths, ...extraDirs];
|
|
40735
40882
|
const exes = isWin ? [".exe", ".cmd", ".bat", ""] : [""];
|
|
40736
|
-
for (const p of
|
|
40883
|
+
for (const p of searchDirs) {
|
|
40737
40884
|
if (!p) continue;
|
|
40738
40885
|
for (const ext of exes) {
|
|
40739
40886
|
const fullPath = path17.join(p, trimmed + ext);
|
|
@@ -44131,6 +44278,37 @@ ${lastSnapshot}`;
|
|
|
44131
44278
|
if (!this.ptyProcess || typeof this.ptyProcess.getMetadata !== "function") return null;
|
|
44132
44279
|
return this.ptyProcess.getMetadata();
|
|
44133
44280
|
}
|
|
44281
|
+
/**
|
|
44282
|
+
* Launch metadata for the dashboard Session info panel. Re-derives the spawn plan
|
|
44283
|
+
* (pure — same inputs the live PTY was spawned with) so the dashboard sees the
|
|
44284
|
+
* resolved binary, full arg vector, and cwd without us having to persist it.
|
|
44285
|
+
* extraEnv values are intentionally dropped (keys only) so secrets passed at
|
|
44286
|
+
* launch time never reach the dashboard.
|
|
44287
|
+
*/
|
|
44288
|
+
getLaunchInfo() {
|
|
44289
|
+
let command;
|
|
44290
|
+
let args = [...this.extraArgs];
|
|
44291
|
+
try {
|
|
44292
|
+
const plan = resolveCliSpawnPlan({
|
|
44293
|
+
provider: this.provider,
|
|
44294
|
+
runtimeSettings: this.runtimeSettings,
|
|
44295
|
+
workingDir: this.workingDir,
|
|
44296
|
+
extraArgs: this.extraArgs,
|
|
44297
|
+
extraEnv: this.extraEnv
|
|
44298
|
+
});
|
|
44299
|
+
command = plan.binaryPath;
|
|
44300
|
+
args = plan.allArgs;
|
|
44301
|
+
} catch {
|
|
44302
|
+
}
|
|
44303
|
+
return {
|
|
44304
|
+
command,
|
|
44305
|
+
args,
|
|
44306
|
+
extraArgs: [...this.extraArgs],
|
|
44307
|
+
cwd: this.workingDir,
|
|
44308
|
+
extraEnvKeys: Object.keys(this.extraEnv || {}),
|
|
44309
|
+
providerSessionId: this.providerSessionId || void 0
|
|
44310
|
+
};
|
|
44311
|
+
}
|
|
44134
44312
|
updateRuntimeMeta(meta3, replace = false) {
|
|
44135
44313
|
const nextProviderSessionId = typeof meta3?.providerSessionId === "string" ? meta3.providerSessionId.trim() : "";
|
|
44136
44314
|
if (nextProviderSessionId) {
|
|
@@ -45478,6 +45656,7 @@ ${lastSnapshot}`;
|
|
|
45478
45656
|
DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS: () => DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
|
|
45479
45657
|
DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
|
|
45480
45658
|
DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
|
|
45659
|
+
DEFAULT_TASKMODE_ROLE_MAP: () => DEFAULT_TASKMODE_ROLE_MAP,
|
|
45481
45660
|
DEV_SERVER_PORT: () => DEV_SERVER_PORT,
|
|
45482
45661
|
DaemonAgentStreamManager: () => DaemonAgentStreamManager,
|
|
45483
45662
|
DaemonCdpInitializer: () => DaemonCdpInitializer,
|
|
@@ -45517,6 +45696,7 @@ ${lastSnapshot}`;
|
|
|
45517
45696
|
RawTerminalAttachment: () => RawTerminalAttachment,
|
|
45518
45697
|
STALE_TERMINAL_REFINE_WINDOW_MS: () => STALE_TERMINAL_REFINE_WINDOW_MS,
|
|
45519
45698
|
STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS2,
|
|
45699
|
+
STANDARD_MESH_ROLES: () => STANDARD_MESH_ROLES,
|
|
45520
45700
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory2,
|
|
45521
45701
|
TerminalAdapter: () => TerminalAdapter,
|
|
45522
45702
|
TurnSnapshotTracker: () => TurnSnapshotTracker,
|
|
@@ -45750,9 +45930,12 @@ ${lastSnapshot}`;
|
|
|
45750
45930
|
resolveGitRepository: () => resolveGitRepository,
|
|
45751
45931
|
resolveMeshHostStatus: () => resolveMeshHostStatus,
|
|
45752
45932
|
resolveMeshRefineValidationPlan: () => resolveMeshRefineValidationPlan,
|
|
45933
|
+
resolveMeshRoleOptions: () => resolveMeshRoleOptions,
|
|
45753
45934
|
resolveNodeSchedulingPriority: () => resolveNodeSchedulingPriority,
|
|
45754
45935
|
resolveSessionHostAppName: () => resolveSessionHostAppName,
|
|
45755
45936
|
resolveSessionHostAppNameResolution: () => resolveSessionHostAppNameResolution2,
|
|
45937
|
+
resolveTaskAffinityRequiredTags: () => resolveTaskAffinityRequiredTags,
|
|
45938
|
+
resolveTaskAffinityRole: () => resolveTaskAffinityRole,
|
|
45756
45939
|
resolveWorktreePath: () => resolveWorktreePath,
|
|
45757
45940
|
runAsyncBatch: () => runAsyncBatch2,
|
|
45758
45941
|
runGit: () => runGit,
|
|
@@ -48660,8 +48843,8 @@ ${lastSnapshot}`;
|
|
|
48660
48843
|
if ((0, import_fs12.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
48661
48844
|
}
|
|
48662
48845
|
if (!resolvedCli && appPath && os30 === "win32") {
|
|
48663
|
-
const { dirname:
|
|
48664
|
-
const appDir =
|
|
48846
|
+
const { dirname: dirname15 } = await import("path");
|
|
48847
|
+
const appDir = dirname15(appPath);
|
|
48665
48848
|
const candidates = [
|
|
48666
48849
|
`${appDir}\\\\bin\\\\${def.cli}.cmd`,
|
|
48667
48850
|
`${appDir}\\\\bin\\\\${def.cli}`,
|
|
@@ -61009,6 +61192,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61009
61192
|
var fs12 = __toESM2(require("fs"));
|
|
61010
61193
|
var os17 = __toESM2(require("os"));
|
|
61011
61194
|
var path21 = __toESM2(require("path"));
|
|
61195
|
+
init_logger();
|
|
61012
61196
|
var UUID_RE = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
|
|
61013
61197
|
function executeNativeHistory(cfg, input) {
|
|
61014
61198
|
if (!cfg?.source) return null;
|
|
@@ -61041,8 +61225,33 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61041
61225
|
if (!sourcePath && hasDateTemplateSegment(src.path)) {
|
|
61042
61226
|
sourcePath = pickExactSessionFileAcrossDateWindow(src.path, input, filePat, requestedSessionId) || (requestedSessionId ? null : pickSessionBoundFileAcrossDateWindow(src.path, input, filePat, windowMs, sessionFloor, workspaceHint)) || (requestedSessionId ? null : newestRecentFileAcrossDateWindow(src.path, input, filePat, windowMs, sessionFloor));
|
|
61043
61227
|
}
|
|
61228
|
+
if (!sourcePath && !hasDateTemplateSegment(src.path)) {
|
|
61229
|
+
const resolvedRaw = expandPath2(src.path, input, { skipWorkspaceRealpath: true });
|
|
61230
|
+
if (resolvedRaw && resolvedRaw !== resolved) {
|
|
61231
|
+
try {
|
|
61232
|
+
const rawStat = fs12.statSync(resolvedRaw);
|
|
61233
|
+
if (rawStat.isFile()) sourcePath = resolvedRaw;
|
|
61234
|
+
else if (rawStat.isDirectory()) {
|
|
61235
|
+
sourcePath = pickExactSessionFile(resolvedRaw, filePat, requestedSessionId) || (requestedSessionId ? null : newestRecentFile(resolvedRaw, filePat, windowMs, sessionFloor));
|
|
61236
|
+
}
|
|
61237
|
+
} catch {
|
|
61238
|
+
}
|
|
61239
|
+
}
|
|
61240
|
+
}
|
|
61241
|
+
if (!sourcePath && requestedSessionId) {
|
|
61242
|
+
sourcePath = scanProjectsRootForSessionFile(src.path, input, requestedSessionId);
|
|
61243
|
+
}
|
|
61244
|
+
}
|
|
61245
|
+
if (!sourcePath) {
|
|
61246
|
+
const wsRaw = typeof input.workspace === "string" ? input.workspace : "";
|
|
61247
|
+
let wsReal = wsRaw;
|
|
61248
|
+
try {
|
|
61249
|
+
if (wsRaw) wsReal = fs12.realpathSync(wsRaw);
|
|
61250
|
+
} catch {
|
|
61251
|
+
}
|
|
61252
|
+
LOG2.debug("NativeHistory", `jsonl unresolved: tried=${JSON.stringify(resolved)} sessionId=${requestedSessionId || "(none)"} wsRaw=${JSON.stringify(wsRaw)} wsReal=${JSON.stringify(wsReal)} rawSlug=${JSON.stringify(claudeProjectDirName(wsRaw))} realSlug=${JSON.stringify(claudeProjectDirName(wsReal))} (concrete miss + raw-slug retry + projects scan all failed)`);
|
|
61253
|
+
return null;
|
|
61044
61254
|
}
|
|
61045
|
-
if (!sourcePath) return null;
|
|
61046
61255
|
const mtime = safeMtimeMs(sourcePath);
|
|
61047
61256
|
const lines = readJsonlLines(sourcePath);
|
|
61048
61257
|
if (lines.length === 0) return null;
|
|
@@ -61161,7 +61370,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61161
61370
|
}
|
|
61162
61371
|
}
|
|
61163
61372
|
}
|
|
61164
|
-
function expandPath2(template, input) {
|
|
61373
|
+
function expandPath2(template, input, opts) {
|
|
61165
61374
|
if (!template) return null;
|
|
61166
61375
|
let out = template;
|
|
61167
61376
|
if (out.startsWith("~/") || out === "~") {
|
|
@@ -61175,7 +61384,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61175
61384
|
const now = /* @__PURE__ */ new Date();
|
|
61176
61385
|
const workspaceRaw = input.workspace ?? "";
|
|
61177
61386
|
let workspaceResolved = workspaceRaw;
|
|
61178
|
-
if (workspaceRaw) {
|
|
61387
|
+
if (workspaceRaw && !opts?.skipWorkspaceRealpath) {
|
|
61179
61388
|
try {
|
|
61180
61389
|
workspaceResolved = fs12.realpathSync(workspaceRaw);
|
|
61181
61390
|
} catch {
|
|
@@ -61202,6 +61411,50 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61202
61411
|
function claudeProjectDirName(workspace) {
|
|
61203
61412
|
return workspace.replace(/[^A-Za-z0-9_-]/g, "-");
|
|
61204
61413
|
}
|
|
61414
|
+
function scanProjectsRootForSessionFile(template, input, requestedSessionId) {
|
|
61415
|
+
if (!requestedSessionId) return null;
|
|
61416
|
+
let head = template;
|
|
61417
|
+
if (head.startsWith("~/") || head === "~") head = path21.join(os17.homedir(), head.slice(2));
|
|
61418
|
+
const segs = head.split("/");
|
|
61419
|
+
const baseParts = [];
|
|
61420
|
+
for (const seg of segs) {
|
|
61421
|
+
if (/[{}*?]/.test(seg)) break;
|
|
61422
|
+
baseParts.push(seg);
|
|
61423
|
+
}
|
|
61424
|
+
const base = baseParts.join("/");
|
|
61425
|
+
if (!base) return null;
|
|
61426
|
+
let baseStat = null;
|
|
61427
|
+
try {
|
|
61428
|
+
baseStat = fs12.statSync(base);
|
|
61429
|
+
} catch {
|
|
61430
|
+
return null;
|
|
61431
|
+
}
|
|
61432
|
+
if (!baseStat.isDirectory()) return null;
|
|
61433
|
+
const needle = `${requestedSessionId.toLowerCase()}.jsonl`;
|
|
61434
|
+
const dirsToScan = [base];
|
|
61435
|
+
try {
|
|
61436
|
+
for (const entry of fs12.readdirSync(base, { withFileTypes: true })) {
|
|
61437
|
+
if (entry.isDirectory()) dirsToScan.push(path21.join(base, entry.name));
|
|
61438
|
+
}
|
|
61439
|
+
} catch {
|
|
61440
|
+
}
|
|
61441
|
+
for (const dir of dirsToScan) {
|
|
61442
|
+
let entries;
|
|
61443
|
+
try {
|
|
61444
|
+
entries = fs12.readdirSync(dir, { withFileTypes: true });
|
|
61445
|
+
} catch {
|
|
61446
|
+
continue;
|
|
61447
|
+
}
|
|
61448
|
+
for (const entry of entries) {
|
|
61449
|
+
if (!entry.isFile()) continue;
|
|
61450
|
+
if (entry.name.toLowerCase() !== needle) continue;
|
|
61451
|
+
const found = path21.join(dir, entry.name);
|
|
61452
|
+
LOG2.debug("NativeHistory", `jsonl scan-fallback hit: sessionId=${requestedSessionId} resolved via projects-root scan \u2192 ${JSON.stringify(found)} (slug-derived path missed; likely realpath/slug divergence)`);
|
|
61453
|
+
return found;
|
|
61454
|
+
}
|
|
61455
|
+
}
|
|
61456
|
+
return null;
|
|
61457
|
+
}
|
|
61205
61458
|
function globToRegex(pattern) {
|
|
61206
61459
|
const re = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]");
|
|
61207
61460
|
return new RegExp(`^${re}$`);
|
|
@@ -76572,6 +76825,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
76572
76825
|
if (!target && !coord) return { success: false, error: "Session not found", sessionId };
|
|
76573
76826
|
const adapter = target ? this.deps.cliManager.findAdapter(target.providerType, { instanceKey: sessionId })?.adapter : void 0;
|
|
76574
76827
|
const runtimeMeta = adapter && typeof adapter.getRuntimeMetadata === "function" ? adapter.getRuntimeMetadata() : void 0;
|
|
76828
|
+
const launchInfo = adapter && typeof adapter.getLaunchInfo === "function" ? adapter.getLaunchInfo() : void 0;
|
|
76575
76829
|
const providerType = target?.providerType || coord?.cliType || "";
|
|
76576
76830
|
const providerMetaForSession = providerType ? this.deps.providerLoader.resolve?.(providerType) || this.deps.providerLoader.getMeta(providerType) : void 0;
|
|
76577
76831
|
return {
|
|
@@ -76583,8 +76837,11 @@ ${hintLines.join("\n")}` : "",
|
|
|
76583
76837
|
transport: target?.transport,
|
|
76584
76838
|
workspace: target?.workspace || coord?.workspace,
|
|
76585
76839
|
spawnedAtMs: target?.spawnedAtMs || coord?.startedAt,
|
|
76586
|
-
providerSessionId
|
|
76587
|
-
|
|
76840
|
+
// providerSessionId now comes from the live adapter's launch info
|
|
76841
|
+
// (the registry target never carried it — it was always undefined).
|
|
76842
|
+
providerSessionId: launchInfo?.providerSessionId || target?.providerSessionId,
|
|
76843
|
+
runtimeMetadata: runtimeMeta,
|
|
76844
|
+
launch: launchInfo
|
|
76588
76845
|
},
|
|
76589
76846
|
coordinator: coord ? {
|
|
76590
76847
|
meshId: coord.meshId,
|
|
@@ -78425,7 +78682,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78425
78682
|
};
|
|
78426
78683
|
}
|
|
78427
78684
|
const { existsSync: existsSync44, readFileSync: readFileSync35, writeFileSync: writeFileSync23, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
|
|
78428
|
-
const { dirname:
|
|
78685
|
+
const { dirname: dirname15 } = await import("path");
|
|
78429
78686
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
78430
78687
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
78431
78688
|
let hermesBaseConfig = null;
|
|
@@ -78460,7 +78717,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78460
78717
|
};
|
|
78461
78718
|
}
|
|
78462
78719
|
try {
|
|
78463
|
-
mkdirSync21(
|
|
78720
|
+
mkdirSync21(dirname15(mcpConfigPath), { recursive: true });
|
|
78464
78721
|
} catch (error48) {
|
|
78465
78722
|
const message = `Could not prepare MCP config path for automatic setup: ${error48?.message || error48}`;
|
|
78466
78723
|
LOG2.error("MeshCoordinator", message);
|
|
@@ -78470,7 +78727,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78470
78727
|
const hadExistingMcpConfig = existsSync44(mcpConfigPath);
|
|
78471
78728
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
78472
78729
|
if (hermesBaseConfig) {
|
|
78473
|
-
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome,
|
|
78730
|
+
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname15(mcpConfigPath));
|
|
78474
78731
|
}
|
|
78475
78732
|
if (hadExistingMcpConfig) {
|
|
78476
78733
|
try {
|
|
@@ -78508,7 +78765,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78508
78765
|
const cliArgs = [];
|
|
78509
78766
|
const launchEnv = {};
|
|
78510
78767
|
if (configFormat === "hermes_config_yaml") {
|
|
78511
|
-
launchEnv.HERMES_HOME =
|
|
78768
|
+
launchEnv.HERMES_HOME = dirname15(mcpConfigPath);
|
|
78512
78769
|
launchEnv.HERMES_IGNORE_USER_CONFIG = "";
|
|
78513
78770
|
}
|
|
78514
78771
|
let autoImportContextFilePath;
|
|
@@ -87796,6 +88053,13 @@ function sanitizeSpawnEnv(baseEnv, overrides) {
|
|
|
87796
88053
|
delete env2.CODEX_SANDBOX_NETWORK_DISABLED;
|
|
87797
88054
|
delete env2.NO_COLOR;
|
|
87798
88055
|
delete env2.COLOR;
|
|
88056
|
+
if (process.platform === "win32") {
|
|
88057
|
+
delete env2.CLAUDECODE;
|
|
88058
|
+
delete env2.CLAUDE_CODE_CHILD_SESSION;
|
|
88059
|
+
delete env2.CLAUDE_CODE_ENTRYPOINT;
|
|
88060
|
+
delete env2.CLAUDE_CODE_SESSION_ID;
|
|
88061
|
+
delete env2.CLAUDE_CODE_EXECPATH;
|
|
88062
|
+
}
|
|
87799
88063
|
applyTerminalColorEnv(env2);
|
|
87800
88064
|
return env2;
|
|
87801
88065
|
}
|