@adhdev/daemon-core 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/cli-adapter-types.d.ts +23 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +9 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +279 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +278 -30
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +22 -0
- package/dist/repo-mesh-types.d.ts +68 -0
- package/package.json +2 -2
- package/src/cli-adapter-types.ts +25 -0
- package/src/cli-adapters/provider-cli-adapter.ts +36 -1
- package/src/cli-adapters/provider-cli-shared.ts +19 -2
- package/src/commands/router.ts +10 -1
- package/src/config/mesh-config.ts +72 -1
- package/src/index.ts +7 -1
- package/src/mesh/mesh-work-queue.ts +89 -11
- package/src/providers/spec/native-history-executor.ts +104 -3
- package/src/repo-mesh-types.ts +112 -0
package/dist/index.mjs
CHANGED
|
@@ -35,6 +35,35 @@ function resolveNodeSchedulingPriority(nodePolicy) {
|
|
|
35
35
|
const raw = Number(nodePolicy?.schedulingPriority);
|
|
36
36
|
return Number.isFinite(raw) ? raw : 0;
|
|
37
37
|
}
|
|
38
|
+
function resolveTaskAffinityRole(taskMode, policy) {
|
|
39
|
+
if (!taskMode) return null;
|
|
40
|
+
if (policy?.enabled === false) return null;
|
|
41
|
+
const override = policy?.byTaskMode && Object.prototype.hasOwnProperty.call(policy.byTaskMode, taskMode) ? policy.byTaskMode[taskMode] : void 0;
|
|
42
|
+
if (typeof override === "string") {
|
|
43
|
+
const trimmed = override.trim().toLowerCase();
|
|
44
|
+
return trimmed ? trimmed : null;
|
|
45
|
+
}
|
|
46
|
+
const fallback = DEFAULT_TASKMODE_ROLE_MAP[taskMode];
|
|
47
|
+
return fallback ?? null;
|
|
48
|
+
}
|
|
49
|
+
function resolveMeshRoleOptions(policy) {
|
|
50
|
+
const out = [...STANDARD_MESH_ROLES];
|
|
51
|
+
const seen = new Set(out);
|
|
52
|
+
const add = (raw) => {
|
|
53
|
+
if (typeof raw !== "string") return;
|
|
54
|
+
const role = raw.trim().toLowerCase();
|
|
55
|
+
if (!role || seen.has(role)) return;
|
|
56
|
+
seen.add(role);
|
|
57
|
+
out.push(role);
|
|
58
|
+
};
|
|
59
|
+
if (policy?.byTaskMode) {
|
|
60
|
+
for (const value of Object.values(policy.byTaskMode)) add(value);
|
|
61
|
+
}
|
|
62
|
+
if (Array.isArray(policy?.customRoles)) {
|
|
63
|
+
for (const value of policy.customRoles) add(value);
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
38
67
|
function resolveAutoConvergeCodeChange(policy) {
|
|
39
68
|
return policy?.autoConvergeCodeChange === true;
|
|
40
69
|
}
|
|
@@ -65,7 +94,7 @@ function resolveProviderMaxParallel(nodePolicy, providerType) {
|
|
|
65
94
|
if (!Number.isFinite(raw) || raw < 0) return void 0;
|
|
66
95
|
return Math.floor(raw);
|
|
67
96
|
}
|
|
68
|
-
var MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, DEFAULT_MESH_POLICY;
|
|
97
|
+
var MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, STANDARD_MESH_ROLES, DEFAULT_TASKMODE_ROLE_MAP, DEFAULT_MESH_POLICY;
|
|
69
98
|
var init_repo_mesh_types = __esm({
|
|
70
99
|
"src/repo-mesh-types.ts"() {
|
|
71
100
|
"use strict";
|
|
@@ -78,6 +107,14 @@ var init_repo_mesh_types = __esm({
|
|
|
78
107
|
DEFAULT_MESH_SCHEDULING_STRATEGY = "first_eligible";
|
|
79
108
|
MESH_CONVERGE_REFINE_TAG = "converge=refine";
|
|
80
109
|
MESH_CONVERGE_FAST_FORWARD_TAG = "converge=fast_forward";
|
|
110
|
+
STANDARD_MESH_ROLES = ["investigator", "coder", "validator", "converger"];
|
|
111
|
+
DEFAULT_TASKMODE_ROLE_MAP = {
|
|
112
|
+
live_debug_readonly: "investigator",
|
|
113
|
+
code_change: "coder",
|
|
114
|
+
launch_app: "coder",
|
|
115
|
+
validation: "validator",
|
|
116
|
+
convergence: "converger"
|
|
117
|
+
};
|
|
81
118
|
DEFAULT_MESH_POLICY = {
|
|
82
119
|
requirePreTaskCheckpoint: false,
|
|
83
120
|
requirePostTaskCheckpoint: true,
|
|
@@ -311,10 +348,10 @@ function readInjected(value) {
|
|
|
311
348
|
}
|
|
312
349
|
function getDaemonBuildInfo() {
|
|
313
350
|
if (cached) return cached;
|
|
314
|
-
const commit = readInjected(true ? "
|
|
315
|
-
const commitShort = readInjected(true ? "
|
|
316
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
317
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
351
|
+
const commit = readInjected(true ? "930909642b3f28668483159d3a8f39d0a796c61a" : void 0) ?? "unknown";
|
|
352
|
+
const commitShort = readInjected(true ? "93090964" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
353
|
+
const version = readInjected(true ? "0.9.82-rc.316" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
354
|
+
const builtAt = readInjected(true ? "2026-06-18T07:23:07.242Z" : void 0);
|
|
318
355
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
319
356
|
return cached;
|
|
320
357
|
}
|
|
@@ -1575,8 +1612,61 @@ function mergeMeshPolicy(base, patch) {
|
|
|
1575
1612
|
} else {
|
|
1576
1613
|
delete policy.autoConvergeCodeChange;
|
|
1577
1614
|
}
|
|
1615
|
+
const normalizedAffinity = normalizeTaskAffinityPolicy(policy.taskAffinity);
|
|
1616
|
+
if (normalizedAffinity) {
|
|
1617
|
+
policy.taskAffinity = normalizedAffinity;
|
|
1618
|
+
} else {
|
|
1619
|
+
delete policy.taskAffinity;
|
|
1620
|
+
}
|
|
1578
1621
|
return policy;
|
|
1579
1622
|
}
|
|
1623
|
+
function normalizeTaskAffinityPolicy(value) {
|
|
1624
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
1625
|
+
const record = value;
|
|
1626
|
+
const out = {};
|
|
1627
|
+
let hasContent = false;
|
|
1628
|
+
if (typeof record.enabled === "boolean") {
|
|
1629
|
+
out.enabled = record.enabled;
|
|
1630
|
+
if (record.enabled === false) hasContent = true;
|
|
1631
|
+
else delete out.enabled;
|
|
1632
|
+
}
|
|
1633
|
+
if (record.byTaskMode && typeof record.byTaskMode === "object" && !Array.isArray(record.byTaskMode)) {
|
|
1634
|
+
const byTaskMode = {};
|
|
1635
|
+
for (const [mode, raw] of Object.entries(record.byTaskMode)) {
|
|
1636
|
+
const modeKey = mode.trim();
|
|
1637
|
+
if (!modeKey) continue;
|
|
1638
|
+
if (typeof raw !== "string") continue;
|
|
1639
|
+
const role = raw.trim().toLowerCase();
|
|
1640
|
+
byTaskMode[modeKey] = role;
|
|
1641
|
+
if (role && !STANDARD_MESH_ROLES.includes(role)) {
|
|
1642
|
+
try {
|
|
1643
|
+
console.warn(`[mesh] task_affinity.byTaskMode.${modeKey}: custom role "${role}" is not a standard mesh role (${STANDARD_MESH_ROLES.join("/")}); routing still applies`);
|
|
1644
|
+
} catch {
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
if (Object.keys(byTaskMode).length > 0) {
|
|
1649
|
+
out.byTaskMode = byTaskMode;
|
|
1650
|
+
hasContent = true;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
if (Array.isArray(record.customRoles)) {
|
|
1654
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1655
|
+
const customRoles = [];
|
|
1656
|
+
for (const raw of record.customRoles) {
|
|
1657
|
+
if (typeof raw !== "string") continue;
|
|
1658
|
+
const role = raw.trim().toLowerCase();
|
|
1659
|
+
if (!role || seen.has(role)) continue;
|
|
1660
|
+
seen.add(role);
|
|
1661
|
+
customRoles.push(role);
|
|
1662
|
+
}
|
|
1663
|
+
if (customRoles.length > 0) {
|
|
1664
|
+
out.customRoles = customRoles;
|
|
1665
|
+
hasContent = true;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
return hasContent ? out : void 0;
|
|
1669
|
+
}
|
|
1580
1670
|
function normalizeAutoFastForwardPolicy(value) {
|
|
1581
1671
|
const record = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
1582
1672
|
const maxBehind = Number(record.maxBehind);
|
|
@@ -2867,6 +2957,7 @@ __export(mesh_work_queue_exports, {
|
|
|
2867
2957
|
recordTaskAutoLaunch: () => recordTaskAutoLaunch,
|
|
2868
2958
|
requeueTask: () => requeueTask,
|
|
2869
2959
|
resolveConvergeRequiredTags: () => resolveConvergeRequiredTags,
|
|
2960
|
+
resolveTaskAffinityRequiredTags: () => resolveTaskAffinityRequiredTags,
|
|
2870
2961
|
updateDirectDispatchStatus: () => updateDirectDispatchStatus,
|
|
2871
2962
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
2872
2963
|
updateTaskStatus: () => updateTaskStatus,
|
|
@@ -3006,6 +3097,31 @@ function resolveConvergeRequiredTags(meshId, taskMode, explicitRequiredTags, opt
|
|
|
3006
3097
|
if (!optedIn) return explicitRequiredTags;
|
|
3007
3098
|
return normalizeMeshCapabilityTags([...explicitRequiredTags, MESH_CONVERGE_REFINE_TAG]);
|
|
3008
3099
|
}
|
|
3100
|
+
function meshHasNodeAdvertisingRole(nodes, role) {
|
|
3101
|
+
if (!Array.isArray(nodes) || nodes.length === 0) return false;
|
|
3102
|
+
const wanted = `role=${role}`;
|
|
3103
|
+
return nodes.some((node) => buildMeshNodeCapabilityTags(node).includes(wanted));
|
|
3104
|
+
}
|
|
3105
|
+
function resolveTaskAffinityRequiredTags(meshId, taskMode, explicitRequiredTags, opts) {
|
|
3106
|
+
if (typeof opts?.targetNodeId === "string" && opts.targetNodeId.trim()) return explicitRequiredTags;
|
|
3107
|
+
if (opts?.callerSpecifiedRequiredTags === true) return explicitRequiredTags;
|
|
3108
|
+
let mesh;
|
|
3109
|
+
try {
|
|
3110
|
+
mesh = getMesh(meshId);
|
|
3111
|
+
} catch {
|
|
3112
|
+
return explicitRequiredTags;
|
|
3113
|
+
}
|
|
3114
|
+
const role = resolveTaskAffinityRole(taskMode, mesh?.policy?.taskAffinity);
|
|
3115
|
+
if (!role) return explicitRequiredTags;
|
|
3116
|
+
if (!meshHasNodeAdvertisingRole(mesh?.nodes, role)) {
|
|
3117
|
+
try {
|
|
3118
|
+
console.warn(`[mesh] task_affinity: no node advertises role=${role} for taskMode=${taskMode} in mesh ${meshId}; skipping injection (least_loaded fallback)`);
|
|
3119
|
+
} catch {
|
|
3120
|
+
}
|
|
3121
|
+
return explicitRequiredTags;
|
|
3122
|
+
}
|
|
3123
|
+
return normalizeMeshCapabilityTags([...explicitRequiredTags, `role=${role}`]);
|
|
3124
|
+
}
|
|
3009
3125
|
function withQueueLock(_meshId, fn) {
|
|
3010
3126
|
return MeshRuntimeStore.getInstance().transaction(fn);
|
|
3011
3127
|
}
|
|
@@ -3056,6 +3172,20 @@ function enqueueTask(meshId, message, opts) {
|
|
|
3056
3172
|
throw new Error(`duplicate_task_id: task '${id}' already exists in mesh '${meshId}'`);
|
|
3057
3173
|
}
|
|
3058
3174
|
assertNoDependencyCycle(meshId, id, dependsOn);
|
|
3175
|
+
const callerTags = normalizeMeshCapabilityTags(opts?.requiredTags);
|
|
3176
|
+
const callerSpecifiedRequiredTags = callerTags.length > 0;
|
|
3177
|
+
let resolvedRequiredTags = resolveConvergeRequiredTags(
|
|
3178
|
+
meshId,
|
|
3179
|
+
modeValidation.taskMode,
|
|
3180
|
+
callerTags,
|
|
3181
|
+
{ targetNodeId: opts?.targetNodeId }
|
|
3182
|
+
);
|
|
3183
|
+
resolvedRequiredTags = resolveTaskAffinityRequiredTags(
|
|
3184
|
+
meshId,
|
|
3185
|
+
modeValidation.taskMode,
|
|
3186
|
+
resolvedRequiredTags,
|
|
3187
|
+
{ targetNodeId: opts?.targetNodeId, callerSpecifiedRequiredTags }
|
|
3188
|
+
);
|
|
3059
3189
|
const entry = {
|
|
3060
3190
|
id,
|
|
3061
3191
|
meshId,
|
|
@@ -3064,15 +3194,7 @@ function enqueueTask(meshId, message, opts) {
|
|
|
3064
3194
|
taskMode: modeValidation.taskMode,
|
|
3065
3195
|
targetNodeId: opts?.targetNodeId,
|
|
3066
3196
|
targetSessionId: opts?.targetSessionId,
|
|
3067
|
-
|
|
3068
|
-
// tasks so they hard-filter onto refine-capable worktree nodes. No-op unless
|
|
3069
|
-
// the mesh opts in; explicit target_node_id / required_tags are preserved.
|
|
3070
|
-
requiredTags: resolveConvergeRequiredTags(
|
|
3071
|
-
meshId,
|
|
3072
|
-
modeValidation.taskMode,
|
|
3073
|
-
normalizeMeshCapabilityTags(opts?.requiredTags),
|
|
3074
|
-
{ targetNodeId: opts?.targetNodeId }
|
|
3075
|
-
),
|
|
3197
|
+
requiredTags: resolvedRequiredTags,
|
|
3076
3198
|
...dependsOn.length > 0 ? { dependsOn } : {},
|
|
3077
3199
|
...typeof opts?.missionId === "string" && opts.missionId.trim() ? { missionId: opts.missionId.trim() } : {},
|
|
3078
3200
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -10959,8 +11081,24 @@ function findBinary(name) {
|
|
|
10959
11081
|
}
|
|
10960
11082
|
const isWin = os12.platform() === "win32";
|
|
10961
11083
|
const paths = (process.env.PATH || "").split(path17.delimiter);
|
|
11084
|
+
const extraDirs = [];
|
|
11085
|
+
if (isWin) {
|
|
11086
|
+
if (process.env.APPDATA) extraDirs.push(path17.join(process.env.APPDATA, "npm"));
|
|
11087
|
+
try {
|
|
11088
|
+
extraDirs.push(path17.dirname(process.execPath));
|
|
11089
|
+
} catch {
|
|
11090
|
+
}
|
|
11091
|
+
} else {
|
|
11092
|
+
extraDirs.push(path17.join(os12.homedir(), ".npm-global", "bin"));
|
|
11093
|
+
extraDirs.push("/usr/local/bin", "/opt/homebrew/bin");
|
|
11094
|
+
try {
|
|
11095
|
+
extraDirs.push(path17.dirname(process.execPath));
|
|
11096
|
+
} catch {
|
|
11097
|
+
}
|
|
11098
|
+
}
|
|
11099
|
+
const searchDirs = [...paths, ...extraDirs];
|
|
10962
11100
|
const exes = isWin ? [".exe", ".cmd", ".bat", ""] : [""];
|
|
10963
|
-
for (const p of
|
|
11101
|
+
for (const p of searchDirs) {
|
|
10964
11102
|
if (!p) continue;
|
|
10965
11103
|
for (const ext of exes) {
|
|
10966
11104
|
const fullPath = path17.join(p, trimmed + ext);
|
|
@@ -14357,6 +14495,37 @@ ${lastSnapshot}`;
|
|
|
14357
14495
|
if (!this.ptyProcess || typeof this.ptyProcess.getMetadata !== "function") return null;
|
|
14358
14496
|
return this.ptyProcess.getMetadata();
|
|
14359
14497
|
}
|
|
14498
|
+
/**
|
|
14499
|
+
* Launch metadata for the dashboard Session info panel. Re-derives the spawn plan
|
|
14500
|
+
* (pure — same inputs the live PTY was spawned with) so the dashboard sees the
|
|
14501
|
+
* resolved binary, full arg vector, and cwd without us having to persist it.
|
|
14502
|
+
* extraEnv values are intentionally dropped (keys only) so secrets passed at
|
|
14503
|
+
* launch time never reach the dashboard.
|
|
14504
|
+
*/
|
|
14505
|
+
getLaunchInfo() {
|
|
14506
|
+
let command;
|
|
14507
|
+
let args = [...this.extraArgs];
|
|
14508
|
+
try {
|
|
14509
|
+
const plan = resolveCliSpawnPlan({
|
|
14510
|
+
provider: this.provider,
|
|
14511
|
+
runtimeSettings: this.runtimeSettings,
|
|
14512
|
+
workingDir: this.workingDir,
|
|
14513
|
+
extraArgs: this.extraArgs,
|
|
14514
|
+
extraEnv: this.extraEnv
|
|
14515
|
+
});
|
|
14516
|
+
command = plan.binaryPath;
|
|
14517
|
+
args = plan.allArgs;
|
|
14518
|
+
} catch {
|
|
14519
|
+
}
|
|
14520
|
+
return {
|
|
14521
|
+
command,
|
|
14522
|
+
args,
|
|
14523
|
+
extraArgs: [...this.extraArgs],
|
|
14524
|
+
cwd: this.workingDir,
|
|
14525
|
+
extraEnvKeys: Object.keys(this.extraEnv || {}),
|
|
14526
|
+
providerSessionId: this.providerSessionId || void 0
|
|
14527
|
+
};
|
|
14528
|
+
}
|
|
14360
14529
|
updateRuntimeMeta(meta, replace = false) {
|
|
14361
14530
|
const nextProviderSessionId = typeof meta?.providerSessionId === "string" ? meta.providerSessionId.trim() : "";
|
|
14362
14531
|
if (nextProviderSessionId) {
|
|
@@ -18588,8 +18757,8 @@ async function detectIDEs(providerLoader) {
|
|
|
18588
18757
|
if (existsSync16(bundledCli)) resolvedCli = bundledCli;
|
|
18589
18758
|
}
|
|
18590
18759
|
if (!resolvedCli && appPath && os30 === "win32") {
|
|
18591
|
-
const { dirname:
|
|
18592
|
-
const appDir =
|
|
18760
|
+
const { dirname: dirname15 } = await import("path");
|
|
18761
|
+
const appDir = dirname15(appPath);
|
|
18593
18762
|
const candidates = [
|
|
18594
18763
|
`${appDir}\\\\bin\\\\${def.cli}.cmd`,
|
|
18595
18764
|
`${appDir}\\\\bin\\\\${def.cli}`,
|
|
@@ -31044,6 +31213,7 @@ function collectStableSizes(when, sizes) {
|
|
|
31044
31213
|
}
|
|
31045
31214
|
|
|
31046
31215
|
// src/providers/spec/native-history-executor.ts
|
|
31216
|
+
init_logger();
|
|
31047
31217
|
import * as fs12 from "fs";
|
|
31048
31218
|
import * as os17 from "os";
|
|
31049
31219
|
import * as path21 from "path";
|
|
@@ -31079,8 +31249,33 @@ function executeJsonl(src, input) {
|
|
|
31079
31249
|
if (!sourcePath && hasDateTemplateSegment(src.path)) {
|
|
31080
31250
|
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));
|
|
31081
31251
|
}
|
|
31252
|
+
if (!sourcePath && !hasDateTemplateSegment(src.path)) {
|
|
31253
|
+
const resolvedRaw = expandPath2(src.path, input, { skipWorkspaceRealpath: true });
|
|
31254
|
+
if (resolvedRaw && resolvedRaw !== resolved) {
|
|
31255
|
+
try {
|
|
31256
|
+
const rawStat = fs12.statSync(resolvedRaw);
|
|
31257
|
+
if (rawStat.isFile()) sourcePath = resolvedRaw;
|
|
31258
|
+
else if (rawStat.isDirectory()) {
|
|
31259
|
+
sourcePath = pickExactSessionFile(resolvedRaw, filePat, requestedSessionId) || (requestedSessionId ? null : newestRecentFile(resolvedRaw, filePat, windowMs, sessionFloor));
|
|
31260
|
+
}
|
|
31261
|
+
} catch {
|
|
31262
|
+
}
|
|
31263
|
+
}
|
|
31264
|
+
}
|
|
31265
|
+
if (!sourcePath && requestedSessionId) {
|
|
31266
|
+
sourcePath = scanProjectsRootForSessionFile(src.path, input, requestedSessionId);
|
|
31267
|
+
}
|
|
31268
|
+
}
|
|
31269
|
+
if (!sourcePath) {
|
|
31270
|
+
const wsRaw = typeof input.workspace === "string" ? input.workspace : "";
|
|
31271
|
+
let wsReal = wsRaw;
|
|
31272
|
+
try {
|
|
31273
|
+
if (wsRaw) wsReal = fs12.realpathSync(wsRaw);
|
|
31274
|
+
} catch {
|
|
31275
|
+
}
|
|
31276
|
+
LOG.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)`);
|
|
31277
|
+
return null;
|
|
31082
31278
|
}
|
|
31083
|
-
if (!sourcePath) return null;
|
|
31084
31279
|
const mtime = safeMtimeMs(sourcePath);
|
|
31085
31280
|
const lines = readJsonlLines(sourcePath);
|
|
31086
31281
|
if (lines.length === 0) return null;
|
|
@@ -31199,7 +31394,7 @@ function executeSqlite(src, input) {
|
|
|
31199
31394
|
}
|
|
31200
31395
|
}
|
|
31201
31396
|
}
|
|
31202
|
-
function expandPath2(template, input) {
|
|
31397
|
+
function expandPath2(template, input, opts) {
|
|
31203
31398
|
if (!template) return null;
|
|
31204
31399
|
let out = template;
|
|
31205
31400
|
if (out.startsWith("~/") || out === "~") {
|
|
@@ -31213,7 +31408,7 @@ function expandPath2(template, input) {
|
|
|
31213
31408
|
const now = /* @__PURE__ */ new Date();
|
|
31214
31409
|
const workspaceRaw = input.workspace ?? "";
|
|
31215
31410
|
let workspaceResolved = workspaceRaw;
|
|
31216
|
-
if (workspaceRaw) {
|
|
31411
|
+
if (workspaceRaw && !opts?.skipWorkspaceRealpath) {
|
|
31217
31412
|
try {
|
|
31218
31413
|
workspaceResolved = fs12.realpathSync(workspaceRaw);
|
|
31219
31414
|
} catch {
|
|
@@ -31240,6 +31435,50 @@ function expandPath2(template, input) {
|
|
|
31240
31435
|
function claudeProjectDirName(workspace) {
|
|
31241
31436
|
return workspace.replace(/[^A-Za-z0-9_-]/g, "-");
|
|
31242
31437
|
}
|
|
31438
|
+
function scanProjectsRootForSessionFile(template, input, requestedSessionId) {
|
|
31439
|
+
if (!requestedSessionId) return null;
|
|
31440
|
+
let head = template;
|
|
31441
|
+
if (head.startsWith("~/") || head === "~") head = path21.join(os17.homedir(), head.slice(2));
|
|
31442
|
+
const segs = head.split("/");
|
|
31443
|
+
const baseParts = [];
|
|
31444
|
+
for (const seg of segs) {
|
|
31445
|
+
if (/[{}*?]/.test(seg)) break;
|
|
31446
|
+
baseParts.push(seg);
|
|
31447
|
+
}
|
|
31448
|
+
const base = baseParts.join("/");
|
|
31449
|
+
if (!base) return null;
|
|
31450
|
+
let baseStat = null;
|
|
31451
|
+
try {
|
|
31452
|
+
baseStat = fs12.statSync(base);
|
|
31453
|
+
} catch {
|
|
31454
|
+
return null;
|
|
31455
|
+
}
|
|
31456
|
+
if (!baseStat.isDirectory()) return null;
|
|
31457
|
+
const needle = `${requestedSessionId.toLowerCase()}.jsonl`;
|
|
31458
|
+
const dirsToScan = [base];
|
|
31459
|
+
try {
|
|
31460
|
+
for (const entry of fs12.readdirSync(base, { withFileTypes: true })) {
|
|
31461
|
+
if (entry.isDirectory()) dirsToScan.push(path21.join(base, entry.name));
|
|
31462
|
+
}
|
|
31463
|
+
} catch {
|
|
31464
|
+
}
|
|
31465
|
+
for (const dir of dirsToScan) {
|
|
31466
|
+
let entries;
|
|
31467
|
+
try {
|
|
31468
|
+
entries = fs12.readdirSync(dir, { withFileTypes: true });
|
|
31469
|
+
} catch {
|
|
31470
|
+
continue;
|
|
31471
|
+
}
|
|
31472
|
+
for (const entry of entries) {
|
|
31473
|
+
if (!entry.isFile()) continue;
|
|
31474
|
+
if (entry.name.toLowerCase() !== needle) continue;
|
|
31475
|
+
const found = path21.join(dir, entry.name);
|
|
31476
|
+
LOG.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)`);
|
|
31477
|
+
return found;
|
|
31478
|
+
}
|
|
31479
|
+
}
|
|
31480
|
+
return null;
|
|
31481
|
+
}
|
|
31243
31482
|
function globToRegex(pattern) {
|
|
31244
31483
|
const re = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]");
|
|
31245
31484
|
return new RegExp(`^${re}$`);
|
|
@@ -41127,7 +41366,7 @@ init_mesh_refine_status();
|
|
|
41127
41366
|
|
|
41128
41367
|
// src/mesh/mesh-init.ts
|
|
41129
41368
|
import { existsSync as existsSync35, mkdirSync as mkdirSync15, writeFileSync as writeFileSync17 } from "fs";
|
|
41130
|
-
import { dirname as
|
|
41369
|
+
import { dirname as dirname8, join as join37 } from "path";
|
|
41131
41370
|
var MESH_INIT_REFINE_CONFIG_PATH = MESH_REFINE_CONFIG_LOCATIONS[0];
|
|
41132
41371
|
var MESH_INIT_WORKTREE_BOOTSTRAP_CONFIG_PATH = MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS[0];
|
|
41133
41372
|
var CANDIDATE_STALE_INPUTS = [
|
|
@@ -41142,7 +41381,7 @@ var CANDIDATE_STALE_INPUTS = [
|
|
|
41142
41381
|
];
|
|
41143
41382
|
function writeConfigFile(workspace, relativePath, config) {
|
|
41144
41383
|
const target = join37(workspace, relativePath);
|
|
41145
|
-
mkdirSync15(
|
|
41384
|
+
mkdirSync15(dirname8(target), { recursive: true });
|
|
41146
41385
|
writeFileSync17(target, `${JSON.stringify(config, null, 2)}
|
|
41147
41386
|
`, "utf-8");
|
|
41148
41387
|
return target;
|
|
@@ -46687,6 +46926,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
46687
46926
|
if (!target && !coord) return { success: false, error: "Session not found", sessionId };
|
|
46688
46927
|
const adapter = target ? this.deps.cliManager.findAdapter(target.providerType, { instanceKey: sessionId })?.adapter : void 0;
|
|
46689
46928
|
const runtimeMeta = adapter && typeof adapter.getRuntimeMetadata === "function" ? adapter.getRuntimeMetadata() : void 0;
|
|
46929
|
+
const launchInfo = adapter && typeof adapter.getLaunchInfo === "function" ? adapter.getLaunchInfo() : void 0;
|
|
46690
46930
|
const providerType = target?.providerType || coord?.cliType || "";
|
|
46691
46931
|
const providerMetaForSession = providerType ? this.deps.providerLoader.resolve?.(providerType) || this.deps.providerLoader.getMeta(providerType) : void 0;
|
|
46692
46932
|
return {
|
|
@@ -46698,8 +46938,11 @@ ${hintLines.join("\n")}` : "",
|
|
|
46698
46938
|
transport: target?.transport,
|
|
46699
46939
|
workspace: target?.workspace || coord?.workspace,
|
|
46700
46940
|
spawnedAtMs: target?.spawnedAtMs || coord?.startedAt,
|
|
46701
|
-
providerSessionId
|
|
46702
|
-
|
|
46941
|
+
// providerSessionId now comes from the live adapter's launch info
|
|
46942
|
+
// (the registry target never carried it — it was always undefined).
|
|
46943
|
+
providerSessionId: launchInfo?.providerSessionId || target?.providerSessionId,
|
|
46944
|
+
runtimeMetadata: runtimeMeta,
|
|
46945
|
+
launch: launchInfo
|
|
46703
46946
|
},
|
|
46704
46947
|
coordinator: coord ? {
|
|
46705
46948
|
meshId: coord.meshId,
|
|
@@ -48540,7 +48783,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48540
48783
|
};
|
|
48541
48784
|
}
|
|
48542
48785
|
const { existsSync: existsSync44, readFileSync: readFileSync35, writeFileSync: writeFileSync23, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
|
|
48543
|
-
const { dirname:
|
|
48786
|
+
const { dirname: dirname15 } = await import("path");
|
|
48544
48787
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
48545
48788
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
48546
48789
|
let hermesBaseConfig = null;
|
|
@@ -48575,7 +48818,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48575
48818
|
};
|
|
48576
48819
|
}
|
|
48577
48820
|
try {
|
|
48578
|
-
mkdirSync21(
|
|
48821
|
+
mkdirSync21(dirname15(mcpConfigPath), { recursive: true });
|
|
48579
48822
|
} catch (error) {
|
|
48580
48823
|
const message = `Could not prepare MCP config path for automatic setup: ${error?.message || error}`;
|
|
48581
48824
|
LOG.error("MeshCoordinator", message);
|
|
@@ -48585,7 +48828,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48585
48828
|
const hadExistingMcpConfig = existsSync44(mcpConfigPath);
|
|
48586
48829
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
48587
48830
|
if (hermesBaseConfig) {
|
|
48588
|
-
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome,
|
|
48831
|
+
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname15(mcpConfigPath));
|
|
48589
48832
|
}
|
|
48590
48833
|
if (hadExistingMcpConfig) {
|
|
48591
48834
|
try {
|
|
@@ -48623,7 +48866,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48623
48866
|
const cliArgs = [];
|
|
48624
48867
|
const launchEnv = {};
|
|
48625
48868
|
if (configFormat === "hermes_config_yaml") {
|
|
48626
|
-
launchEnv.HERMES_HOME =
|
|
48869
|
+
launchEnv.HERMES_HOME = dirname15(mcpConfigPath);
|
|
48627
48870
|
launchEnv.HERMES_IGNORE_USER_CONFIG = "";
|
|
48628
48871
|
}
|
|
48629
48872
|
let autoImportContextFilePath;
|
|
@@ -57648,11 +57891,11 @@ init_parse_session();
|
|
|
57648
57891
|
// src/providers/sdk/v1/fixture-tooling/replay.ts
|
|
57649
57892
|
init_provider_cli_shared();
|
|
57650
57893
|
import { readFileSync as readFileSync33 } from "fs";
|
|
57651
|
-
import { dirname as
|
|
57894
|
+
import { dirname as dirname13, resolve as resolve22 } from "path";
|
|
57652
57895
|
|
|
57653
57896
|
// src/providers/sdk/v1/validators/taint.ts
|
|
57654
57897
|
import { readFileSync as readFileSync34, existsSync as existsSync43 } from "fs";
|
|
57655
|
-
import { resolve as resolve23, dirname as
|
|
57898
|
+
import { resolve as resolve23, dirname as dirname14, join as join44 } from "path";
|
|
57656
57899
|
|
|
57657
57900
|
// src/providers/sdk/v1/validators/index.ts
|
|
57658
57901
|
init_manifest();
|
|
@@ -57757,6 +58000,7 @@ export {
|
|
|
57757
58000
|
DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
|
|
57758
58001
|
DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
|
|
57759
58002
|
DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
|
|
58003
|
+
DEFAULT_TASKMODE_ROLE_MAP,
|
|
57760
58004
|
DEV_SERVER_PORT,
|
|
57761
58005
|
DaemonAgentStreamManager,
|
|
57762
58006
|
DaemonCdpInitializer,
|
|
@@ -57796,6 +58040,7 @@ export {
|
|
|
57796
58040
|
RawTerminalAttachment,
|
|
57797
58041
|
STALE_TERMINAL_REFINE_WINDOW_MS,
|
|
57798
58042
|
STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
58043
|
+
STANDARD_MESH_ROLES,
|
|
57799
58044
|
SessionHostPtyTransportFactory,
|
|
57800
58045
|
TerminalAdapter,
|
|
57801
58046
|
TurnSnapshotTracker,
|
|
@@ -58029,9 +58274,12 @@ export {
|
|
|
58029
58274
|
resolveGitRepository,
|
|
58030
58275
|
resolveMeshHostStatus,
|
|
58031
58276
|
resolveMeshRefineValidationPlan,
|
|
58277
|
+
resolveMeshRoleOptions,
|
|
58032
58278
|
resolveNodeSchedulingPriority,
|
|
58033
58279
|
resolveSessionHostAppName,
|
|
58034
58280
|
resolveSessionHostAppNameResolution,
|
|
58281
|
+
resolveTaskAffinityRequiredTags,
|
|
58282
|
+
resolveTaskAffinityRole,
|
|
58035
58283
|
resolveWorktreePath,
|
|
58036
58284
|
runAsyncBatch,
|
|
58037
58285
|
runGit,
|