@adhdev/daemon-core 0.9.82-rc.411 → 0.9.82-rc.413
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/commands/med-family/mesh-crud.d.ts +27 -0
- package/dist/config/mesh-json-config.d.ts +31 -131
- package/dist/config/repo-settings.d.ts +77 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +817 -802
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +804 -791
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-ledger.d.ts +1 -1
- package/dist/mesh/mesh-task-inflight.d.ts +46 -0
- package/package.json +2 -2
- package/src/commands/high-family/mesh-coordinator-launch.ts +9 -4
- package/src/commands/med-family/mesh-crud.ts +85 -8
- package/src/commands/med-family/mesh-queue.ts +14 -0
- package/src/config/mesh-json-config.ts +40 -281
- package/src/config/repo-settings.ts +111 -0
- package/src/index.ts +6 -1
- package/src/mesh/mesh-ledger.ts +10 -0
- package/src/mesh/mesh-missions.ts +86 -1
- package/src/mesh/mesh-queue-assignment.ts +69 -61
- package/src/mesh/mesh-task-inflight.ts +70 -0
- package/src/mesh/mesh-work-queue.ts +25 -0
package/dist/index.js
CHANGED
|
@@ -14,9 +14,9 @@ var __export = (target, all) => {
|
|
|
14
14
|
};
|
|
15
15
|
var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let
|
|
18
|
-
if (!__hasOwnProp.call(to,
|
|
19
|
-
__defProp(to,
|
|
17
|
+
for (let key2 of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
19
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
@@ -36,14 +36,6 @@ function normalizeMeshSchedulingStrategy(value) {
|
|
|
36
36
|
const trimmed = value.trim();
|
|
37
37
|
return MESH_SCHEDULING_STRATEGIES.includes(trimmed) ? trimmed : DEFAULT_MESH_SCHEDULING_STRATEGY;
|
|
38
38
|
}
|
|
39
|
-
function normalizeMeshDistribution(value) {
|
|
40
|
-
if (typeof value !== "string") return DEFAULT_MESH_DISTRIBUTION;
|
|
41
|
-
const trimmed = value.trim();
|
|
42
|
-
return MESH_DISTRIBUTIONS.includes(trimmed) ? trimmed : DEFAULT_MESH_DISTRIBUTION;
|
|
43
|
-
}
|
|
44
|
-
function distributionToStrategy(distribution) {
|
|
45
|
-
return distribution === "spread" ? "least_loaded" : "first_eligible";
|
|
46
|
-
}
|
|
47
39
|
function resolveNodeSchedulingPriority(nodePolicy) {
|
|
48
40
|
const raw = Number(nodePolicy?.schedulingPriority);
|
|
49
41
|
return Number.isFinite(raw) ? raw : 0;
|
|
@@ -130,7 +122,7 @@ function resolveProviderMaxParallel(nodePolicy, providerType) {
|
|
|
130
122
|
}
|
|
131
123
|
return void 0;
|
|
132
124
|
}
|
|
133
|
-
var MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY,
|
|
125
|
+
var MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, DEFAULT_MESH_POLICY, SESSION_CLEANUP_MODES, SPAWNED_SESSION_VISIBILITY_MODES, DIRTY_WORKSPACE_BEHAVIORS, MESH_MAX_PARALLEL_TASKS_MIN, MESH_MAX_PARALLEL_TASKS_MAX, DEFAULT_MESH_READONLY_MULTIPLIER;
|
|
134
126
|
var init_repo_mesh_types = __esm({
|
|
135
127
|
"src/repo-mesh-types.ts"() {
|
|
136
128
|
"use strict";
|
|
@@ -141,8 +133,6 @@ var init_repo_mesh_types = __esm({
|
|
|
141
133
|
"priority_only"
|
|
142
134
|
];
|
|
143
135
|
DEFAULT_MESH_SCHEDULING_STRATEGY = "first_eligible";
|
|
144
|
-
MESH_DISTRIBUTIONS = ["spread", "in_order"];
|
|
145
|
-
DEFAULT_MESH_DISTRIBUTION = "spread";
|
|
146
136
|
MESH_CONVERGE_REFINE_TAG = "converge=refine";
|
|
147
137
|
MESH_CONVERGE_FAST_FORWARD_TAG = "converge=fast_forward";
|
|
148
138
|
DEFAULT_MESH_POLICY = {
|
|
@@ -399,10 +389,10 @@ function readInjected(value) {
|
|
|
399
389
|
}
|
|
400
390
|
function getDaemonBuildInfo() {
|
|
401
391
|
if (cached) return cached;
|
|
402
|
-
const commit = readInjected(true ? "
|
|
403
|
-
const commitShort = readInjected(true ? "
|
|
404
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
405
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
392
|
+
const commit = readInjected(true ? "7a774e95a82354f5357197b3c84f63e68b5f7a5d" : void 0) ?? "unknown";
|
|
393
|
+
const commitShort = readInjected(true ? "7a774e95" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
394
|
+
const version = readInjected(true ? "0.9.82-rc.413" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
395
|
+
const builtAt = readInjected(true ? "2026-06-28T11:48:26.300Z" : void 0);
|
|
406
396
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
407
397
|
return cached;
|
|
408
398
|
}
|
|
@@ -420,18 +410,18 @@ function isRecord(value) {
|
|
|
420
410
|
function isStringArray(value) {
|
|
421
411
|
return Array.isArray(value) && value.every((v) => typeof v === "string" && v.length > 0);
|
|
422
412
|
}
|
|
423
|
-
function validateTarget(value,
|
|
413
|
+
function validateTarget(value, key2, errors) {
|
|
424
414
|
if (!isRecord(value)) {
|
|
425
|
-
errors.push(`impactTargets.${
|
|
415
|
+
errors.push(`impactTargets.${key2} must be an object`);
|
|
426
416
|
return void 0;
|
|
427
417
|
}
|
|
428
418
|
const { recommendedCommand } = value;
|
|
429
419
|
if (typeof recommendedCommand !== "string" || !recommendedCommand.length) {
|
|
430
|
-
errors.push(`impactTargets.${
|
|
420
|
+
errors.push(`impactTargets.${key2}.recommendedCommand must be a non-empty string`);
|
|
431
421
|
return void 0;
|
|
432
422
|
}
|
|
433
423
|
for (const k of Object.keys(value)) {
|
|
434
|
-
if (k !== "recommendedCommand") errors.push(`impactTargets.${
|
|
424
|
+
if (k !== "recommendedCommand") errors.push(`impactTargets.${key2}.${k} is not a recognized field (only recommendedCommand)`);
|
|
435
425
|
}
|
|
436
426
|
return { recommendedCommand };
|
|
437
427
|
}
|
|
@@ -458,20 +448,20 @@ function validateChangeImpactConfig(raw, source = "inline") {
|
|
|
458
448
|
errors.push("impactTargets must be an object");
|
|
459
449
|
} else {
|
|
460
450
|
const targets = {};
|
|
461
|
-
for (const
|
|
462
|
-
if (
|
|
463
|
-
errors.push(`impactTargets.${
|
|
451
|
+
for (const key2 of Object.keys(raw.impactTargets)) {
|
|
452
|
+
if (key2 !== "daemon" && key2 !== "web" && key2 !== "none") {
|
|
453
|
+
errors.push(`impactTargets.${key2} is not a recognized impact kind (daemon|web|none)`);
|
|
464
454
|
continue;
|
|
465
455
|
}
|
|
466
|
-
const target = validateTarget(raw.impactTargets[
|
|
467
|
-
if (target) targets[
|
|
456
|
+
const target = validateTarget(raw.impactTargets[key2], key2, errors);
|
|
457
|
+
if (target) targets[key2] = target;
|
|
468
458
|
}
|
|
469
459
|
if (Object.keys(targets).length) config.impactTargets = targets;
|
|
470
460
|
}
|
|
471
461
|
}
|
|
472
|
-
for (const
|
|
473
|
-
if (!["daemonRuntimePackages", "webOnlyPackages", "nonRuntimeRootFilePatterns", "impactTargets"].includes(
|
|
474
|
-
errors.push(`unknown config key '${
|
|
462
|
+
for (const key2 of Object.keys(raw)) {
|
|
463
|
+
if (!["daemonRuntimePackages", "webOnlyPackages", "nonRuntimeRootFilePatterns", "impactTargets"].includes(key2)) {
|
|
464
|
+
errors.push(`unknown config key '${key2}'`);
|
|
475
465
|
}
|
|
476
466
|
}
|
|
477
467
|
return { valid: errors.length === 0, errors, config: errors.length === 0 ? config : void 0 };
|
|
@@ -803,12 +793,12 @@ function resolveChangeImpactConfigForRepo(repoRoot, options) {
|
|
|
803
793
|
return { config: null, sourceKey: "forced-default" };
|
|
804
794
|
}
|
|
805
795
|
if (options.changeImpactConfig !== void 0) {
|
|
806
|
-
let
|
|
796
|
+
let key2 = "injected";
|
|
807
797
|
try {
|
|
808
|
-
|
|
798
|
+
key2 = `injected:${JSON.stringify(options.changeImpactConfig)}`;
|
|
809
799
|
} catch {
|
|
810
800
|
}
|
|
811
|
-
return { config: options.changeImpactConfig, sourceKey:
|
|
801
|
+
return { config: options.changeImpactConfig, sourceKey: key2 };
|
|
812
802
|
}
|
|
813
803
|
if (!repoRoot) {
|
|
814
804
|
return { config: null, sourceKey: "no-repo-root" };
|
|
@@ -2369,9 +2359,9 @@ function dismissSessionNotification(state, sessionId, notificationId, providerSe
|
|
|
2369
2359
|
].filter(Boolean)));
|
|
2370
2360
|
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
2371
2361
|
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
2372
|
-
for (const
|
|
2373
|
-
nextSessionNotificationDismissals[
|
|
2374
|
-
delete nextSessionNotificationUnreadOverrides[
|
|
2362
|
+
for (const key2 of dismissalKeys) {
|
|
2363
|
+
nextSessionNotificationDismissals[key2] = dismissalId;
|
|
2364
|
+
delete nextSessionNotificationUnreadOverrides[key2];
|
|
2375
2365
|
}
|
|
2376
2366
|
return {
|
|
2377
2367
|
...state,
|
|
@@ -2388,9 +2378,9 @@ function markSessionNotificationUnread(state, sessionId, notificationId, provide
|
|
|
2388
2378
|
].filter(Boolean)));
|
|
2389
2379
|
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
2390
2380
|
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
2391
|
-
for (const
|
|
2392
|
-
nextSessionNotificationUnreadOverrides[
|
|
2393
|
-
delete nextSessionNotificationDismissals[
|
|
2381
|
+
for (const key2 of unreadKeys) {
|
|
2382
|
+
nextSessionNotificationUnreadOverrides[key2] = unreadId;
|
|
2383
|
+
delete nextSessionNotificationDismissals[key2];
|
|
2394
2384
|
}
|
|
2395
2385
|
return {
|
|
2396
2386
|
...state,
|
|
@@ -2454,11 +2444,11 @@ function markSessionSeen(state, sessionId, seenAt = Date.now(), completionMarker
|
|
|
2454
2444
|
const nextSessionReadMarkers = { ...prevMarkers };
|
|
2455
2445
|
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
2456
2446
|
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
2457
|
-
for (const
|
|
2458
|
-
nextSessionReads[
|
|
2459
|
-
if (nextMarker) nextSessionReadMarkers[
|
|
2460
|
-
delete nextSessionNotificationDismissals[
|
|
2461
|
-
delete nextSessionNotificationUnreadOverrides[
|
|
2447
|
+
for (const key2 of readKeys) {
|
|
2448
|
+
nextSessionReads[key2] = Math.max(prev[key2] || 0, seenAt);
|
|
2449
|
+
if (nextMarker) nextSessionReadMarkers[key2] = nextMarker;
|
|
2450
|
+
delete nextSessionNotificationDismissals[key2];
|
|
2451
|
+
delete nextSessionNotificationUnreadOverrides[key2];
|
|
2462
2452
|
}
|
|
2463
2453
|
return {
|
|
2464
2454
|
...state,
|
|
@@ -3163,6 +3153,12 @@ function machineCoreFromDaemonId(id) {
|
|
|
3163
3153
|
}
|
|
3164
3154
|
return trimmed;
|
|
3165
3155
|
}
|
|
3156
|
+
function canonicalDaemonId(id) {
|
|
3157
|
+
const core = machineCoreFromDaemonId(id);
|
|
3158
|
+
if (!core) return void 0;
|
|
3159
|
+
if (!core.startsWith("mach_")) return core;
|
|
3160
|
+
return `daemon_${core}`;
|
|
3161
|
+
}
|
|
3166
3162
|
function daemonIdsEquivalent(a, b) {
|
|
3167
3163
|
const coreA = machineCoreFromDaemonId(a);
|
|
3168
3164
|
const coreB = machineCoreFromDaemonId(b);
|
|
@@ -3324,8 +3320,8 @@ function expandPromptPlaceholders(template, ctx) {
|
|
|
3324
3320
|
rules: buildRulesSection(coordinatorCliType),
|
|
3325
3321
|
toolExposurePreflight: TOOL_EXPOSURE_PREFLIGHT_SECTION
|
|
3326
3322
|
};
|
|
3327
|
-
return template.replace(/\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g, (m,
|
|
3328
|
-
return Object.prototype.hasOwnProperty.call(replacements,
|
|
3323
|
+
return template.replace(/\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g, (m, key2) => {
|
|
3324
|
+
return Object.prototype.hasOwnProperty.call(replacements, key2) ? replacements[key2] : m;
|
|
3329
3325
|
});
|
|
3330
3326
|
}
|
|
3331
3327
|
function buildNodeStatusSection(nodes) {
|
|
@@ -4728,6 +4724,33 @@ var init_mesh_delivery_policy = __esm({
|
|
|
4728
4724
|
}
|
|
4729
4725
|
});
|
|
4730
4726
|
|
|
4727
|
+
// src/mesh/mesh-task-inflight.ts
|
|
4728
|
+
function key(meshId, taskId) {
|
|
4729
|
+
return `${meshId}::${taskId}`;
|
|
4730
|
+
}
|
|
4731
|
+
function beginTaskDispatchInFlight(meshId, taskId) {
|
|
4732
|
+
if (!meshId || !taskId) return false;
|
|
4733
|
+
const k = key(meshId, taskId);
|
|
4734
|
+
if (inFlight.has(k)) return false;
|
|
4735
|
+
inFlight.add(k);
|
|
4736
|
+
return true;
|
|
4737
|
+
}
|
|
4738
|
+
function isTaskDispatchInFlight(meshId, taskId) {
|
|
4739
|
+
if (!meshId || !taskId) return false;
|
|
4740
|
+
return inFlight.has(key(meshId, taskId));
|
|
4741
|
+
}
|
|
4742
|
+
function endTaskDispatchInFlight(meshId, taskId) {
|
|
4743
|
+
if (!meshId || !taskId) return;
|
|
4744
|
+
inFlight.delete(key(meshId, taskId));
|
|
4745
|
+
}
|
|
4746
|
+
var inFlight;
|
|
4747
|
+
var init_mesh_task_inflight = __esm({
|
|
4748
|
+
"src/mesh/mesh-task-inflight.ts"() {
|
|
4749
|
+
"use strict";
|
|
4750
|
+
inFlight = /* @__PURE__ */ new Set();
|
|
4751
|
+
}
|
|
4752
|
+
});
|
|
4753
|
+
|
|
4731
4754
|
// src/mesh/mesh-work-queue.ts
|
|
4732
4755
|
var mesh_work_queue_exports = {};
|
|
4733
4756
|
__export(mesh_work_queue_exports, {
|
|
@@ -4994,14 +5017,14 @@ function firstProviderPriority(policy) {
|
|
|
4994
5017
|
if (!Array.isArray(raw)) return void 0;
|
|
4995
5018
|
return raw.find((type) => typeof type === "string" && type.trim())?.trim();
|
|
4996
5019
|
}
|
|
4997
|
-
function readNodeOverride(node,
|
|
5020
|
+
function readNodeOverride(node, key2) {
|
|
4998
5021
|
const overrides = node?.userOverrides;
|
|
4999
5022
|
if (!overrides || typeof overrides !== "object" || Array.isArray(overrides)) return null;
|
|
5000
|
-
const value = overrides[
|
|
5023
|
+
const value = overrides[key2];
|
|
5001
5024
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
5002
5025
|
}
|
|
5003
|
-
function readNodeReporter(node,
|
|
5004
|
-
const value =
|
|
5026
|
+
function readNodeReporter(node, key2) {
|
|
5027
|
+
const value = key2 === "platform" ? node?.reportedPlatform : node?.reportedArch;
|
|
5005
5028
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
5006
5029
|
}
|
|
5007
5030
|
function buildMeshNodeCapabilityTags(node, providerType) {
|
|
@@ -5220,6 +5243,7 @@ function updateTaskStatus(meshId, taskId, status, opts) {
|
|
|
5220
5243
|
if (!entry) return null;
|
|
5221
5244
|
entry.status = status;
|
|
5222
5245
|
MeshRuntimeStore.getInstance().updateQueueEntry(entry);
|
|
5246
|
+
if (status !== "assigned") endTaskDispatchInFlight(meshId, taskId);
|
|
5223
5247
|
if (DEPENDENCY_FAILURE_TERMINALS.has(status)) propagateDependencyFailure(meshId, taskId);
|
|
5224
5248
|
return entry;
|
|
5225
5249
|
});
|
|
@@ -5244,6 +5268,7 @@ function cancelTask(meshId, taskId, opts) {
|
|
|
5244
5268
|
entry.cancelledAt = now;
|
|
5245
5269
|
if (opts?.reason) entry.cancelReason = opts.reason;
|
|
5246
5270
|
MeshRuntimeStore.getInstance().updateQueueEntry(entry);
|
|
5271
|
+
endTaskDispatchInFlight(meshId, taskId);
|
|
5247
5272
|
propagateDependencyFailure(meshId, taskId);
|
|
5248
5273
|
return entry;
|
|
5249
5274
|
});
|
|
@@ -5253,6 +5278,11 @@ function requeueTask(meshId, taskId, opts) {
|
|
|
5253
5278
|
return withQueueLock(meshId, () => {
|
|
5254
5279
|
const entry = MeshRuntimeStore.getInstance().findQueueEntryById(meshId, taskId);
|
|
5255
5280
|
if (!entry) return null;
|
|
5281
|
+
if (!opts?.force && isTaskDispatchInFlight(meshId, taskId)) {
|
|
5282
|
+
LOG.warn("MeshQueue", `Refusing to requeue task ${taskId} on mesh ${meshId}: it is actively dispatched/generating (single-flight in-flight). Requeueing now would open a duplicate second dispatch into another session. Pass force to override.`);
|
|
5283
|
+
return entry;
|
|
5284
|
+
}
|
|
5285
|
+
endTaskDispatchInFlight(meshId, taskId);
|
|
5256
5286
|
const currentCount = entry.requeueCount || 0;
|
|
5257
5287
|
const maxRetries = opts?.maxRetries ?? entry.maxRetries ?? 1;
|
|
5258
5288
|
if (!opts?.force && currentCount >= maxRetries) {
|
|
@@ -5297,6 +5327,7 @@ function reclaimStrandedAssignedTask(meshId, taskId, opts) {
|
|
|
5297
5327
|
delete entry.dispatchTimestamp;
|
|
5298
5328
|
entry.strandedReclaimCount = reclaims;
|
|
5299
5329
|
entry.updatedAt = now;
|
|
5330
|
+
endTaskDispatchInFlight(meshId, taskId);
|
|
5300
5331
|
if (reclaims > MAX_STRANDED_RECLAIMS) {
|
|
5301
5332
|
entry.status = "failed";
|
|
5302
5333
|
entry.cancelReason = `stranded_dispatch_unrecovered: reclaimed ${reclaims - 1} time(s) without a confirmed dispatch`;
|
|
@@ -5340,6 +5371,7 @@ function updateSessionTaskStatus(meshId, sessionId, status, opts) {
|
|
|
5340
5371
|
}
|
|
5341
5372
|
entry.status = status;
|
|
5342
5373
|
store.updateQueueEntry(entry);
|
|
5374
|
+
if (status !== "assigned") endTaskDispatchInFlight(meshId, entry.id);
|
|
5343
5375
|
if (DEPENDENCY_FAILURE_TERMINALS.has(status)) propagateDependencyFailure(meshId, entry.id);
|
|
5344
5376
|
return entry;
|
|
5345
5377
|
});
|
|
@@ -5454,6 +5486,7 @@ var init_mesh_work_queue = __esm({
|
|
|
5454
5486
|
init_logger();
|
|
5455
5487
|
init_mesh_ledger();
|
|
5456
5488
|
init_mesh_delivery_policy();
|
|
5489
|
+
init_mesh_task_inflight();
|
|
5457
5490
|
ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
|
|
5458
5491
|
HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
|
|
5459
5492
|
MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
@@ -7098,6 +7131,9 @@ __export(mesh_missions_exports, {
|
|
|
7098
7131
|
summarizeMissionTasks: () => summarizeMissionTasks,
|
|
7099
7132
|
upsertMeshMission: () => upsertMeshMission
|
|
7100
7133
|
});
|
|
7134
|
+
function summarizeGoalForLedger(goal) {
|
|
7135
|
+
return goal.length > LEDGER_GOAL_SUMMARY_MAX ? goal.slice(0, LEDGER_GOAL_SUMMARY_MAX) : goal;
|
|
7136
|
+
}
|
|
7101
7137
|
function normalizeMissionStatus(value) {
|
|
7102
7138
|
return MESH_MISSION_STATUSES.includes(value) ? value : "active";
|
|
7103
7139
|
}
|
|
@@ -7110,6 +7146,8 @@ function upsertMeshMission(meshId, input) {
|
|
|
7110
7146
|
const id = typeof input.id === "string" && input.id.trim() ? input.id.trim() : (0, import_crypto7.randomUUID)();
|
|
7111
7147
|
const store = MeshRuntimeStore.getInstance();
|
|
7112
7148
|
const existing = store.getMission(meshId, id);
|
|
7149
|
+
const prevStatus = existing ? normalizeMissionStatus(existing.status) : null;
|
|
7150
|
+
const prevGoal = existing?.goal ?? "";
|
|
7113
7151
|
const record = {
|
|
7114
7152
|
id,
|
|
7115
7153
|
meshId,
|
|
@@ -7119,7 +7157,61 @@ function upsertMeshMission(meshId, input) {
|
|
|
7119
7157
|
};
|
|
7120
7158
|
store.upsertMission(record);
|
|
7121
7159
|
const saved = store.getMission(meshId, id);
|
|
7122
|
-
|
|
7160
|
+
const result = { ...saved, status: normalizeMissionStatus(saved.status) };
|
|
7161
|
+
appendMissionLedgerEntries(meshId, {
|
|
7162
|
+
isCreate: !existing,
|
|
7163
|
+
record: result,
|
|
7164
|
+
prevStatus,
|
|
7165
|
+
prevGoal
|
|
7166
|
+
});
|
|
7167
|
+
return result;
|
|
7168
|
+
}
|
|
7169
|
+
function appendMissionLedgerEntries(meshId, args) {
|
|
7170
|
+
const { isCreate, record, prevStatus, prevGoal } = args;
|
|
7171
|
+
try {
|
|
7172
|
+
if (isCreate) {
|
|
7173
|
+
const goal = record.goal ?? "";
|
|
7174
|
+
appendLedgerEntry(meshId, {
|
|
7175
|
+
kind: "mission_created",
|
|
7176
|
+
payload: {
|
|
7177
|
+
missionId: record.id,
|
|
7178
|
+
title: record.title,
|
|
7179
|
+
goalSummary: summarizeGoalForLedger(goal),
|
|
7180
|
+
goalLength: goal.length,
|
|
7181
|
+
goalTruncated: goal.length > LEDGER_GOAL_SUMMARY_MAX,
|
|
7182
|
+
status: record.status
|
|
7183
|
+
}
|
|
7184
|
+
});
|
|
7185
|
+
return;
|
|
7186
|
+
}
|
|
7187
|
+
if (prevStatus !== null && prevStatus !== record.status) {
|
|
7188
|
+
appendLedgerEntry(meshId, {
|
|
7189
|
+
kind: "mission_status_changed",
|
|
7190
|
+
payload: {
|
|
7191
|
+
missionId: record.id,
|
|
7192
|
+
title: record.title,
|
|
7193
|
+
fromStatus: prevStatus,
|
|
7194
|
+
toStatus: record.status
|
|
7195
|
+
}
|
|
7196
|
+
});
|
|
7197
|
+
}
|
|
7198
|
+
const nextGoal = record.goal ?? "";
|
|
7199
|
+
if (nextGoal !== prevGoal) {
|
|
7200
|
+
appendLedgerEntry(meshId, {
|
|
7201
|
+
kind: "mission_goal_updated",
|
|
7202
|
+
payload: {
|
|
7203
|
+
missionId: record.id,
|
|
7204
|
+
title: record.title,
|
|
7205
|
+
prevGoalSummary: summarizeGoalForLedger(prevGoal),
|
|
7206
|
+
nextGoalSummary: summarizeGoalForLedger(nextGoal),
|
|
7207
|
+
prevGoalLength: prevGoal.length,
|
|
7208
|
+
nextGoalLength: nextGoal.length,
|
|
7209
|
+
goalTruncated: prevGoal.length > LEDGER_GOAL_SUMMARY_MAX || nextGoal.length > LEDGER_GOAL_SUMMARY_MAX
|
|
7210
|
+
}
|
|
7211
|
+
});
|
|
7212
|
+
}
|
|
7213
|
+
} catch {
|
|
7214
|
+
}
|
|
7123
7215
|
}
|
|
7124
7216
|
function getMeshMissions(meshId, statuses) {
|
|
7125
7217
|
return MeshRuntimeStore.getInstance().getMissions(meshId, statuses).map((m) => ({ ...m, status: normalizeMissionStatus(m.status) }));
|
|
@@ -7223,7 +7315,7 @@ function buildMissionPromptSection(meshId) {
|
|
|
7223
7315
|
);
|
|
7224
7316
|
return lines.join("\n");
|
|
7225
7317
|
}
|
|
7226
|
-
var import_crypto7, MESH_MISSION_STATUSES, GOAL_PREVIEW_MAX, COMPACT_STATUS_GOAL_PREVIEW_MAX;
|
|
7318
|
+
var import_crypto7, LEDGER_GOAL_SUMMARY_MAX, MESH_MISSION_STATUSES, GOAL_PREVIEW_MAX, COMPACT_STATUS_GOAL_PREVIEW_MAX;
|
|
7227
7319
|
var init_mesh_missions = __esm({
|
|
7228
7320
|
"src/mesh/mesh-missions.ts"() {
|
|
7229
7321
|
"use strict";
|
|
@@ -7231,6 +7323,8 @@ var init_mesh_missions = __esm({
|
|
|
7231
7323
|
init_mesh_runtime_store();
|
|
7232
7324
|
init_mesh_work_queue();
|
|
7233
7325
|
init_mesh_task_stats();
|
|
7326
|
+
init_mesh_ledger();
|
|
7327
|
+
LEDGER_GOAL_SUMMARY_MAX = 200;
|
|
7234
7328
|
MESH_MISSION_STATUSES = ["active", "paused", "completed", "abandoned"];
|
|
7235
7329
|
GOAL_PREVIEW_MAX = 120;
|
|
7236
7330
|
COMPACT_STATUS_GOAL_PREVIEW_MAX = 80;
|
|
@@ -7458,7 +7552,7 @@ function resolveNodeEvidence(nodeId, ledgerEntries) {
|
|
|
7458
7552
|
timestamp: entry.timestamp,
|
|
7459
7553
|
...entry.sessionId ? { sessionId: entry.sessionId } : {},
|
|
7460
7554
|
bootstrap: readRecord3(validationSummary?.bootstrap),
|
|
7461
|
-
validation: validationSummary ? Object.fromEntries(Object.entries(validationSummary).filter(([
|
|
7555
|
+
validation: validationSummary ? Object.fromEntries(Object.entries(validationSummary).filter(([key2]) => key2 !== "bootstrap")) : null,
|
|
7462
7556
|
checkpoint: readRecord3(result?.checkpoint),
|
|
7463
7557
|
worker: null,
|
|
7464
7558
|
...readRecord3(payload.finalBranchConvergenceState) ?? readRecord3(result?.finalBranchConvergenceState) ? { finalBranchConvergenceState: readRecord3(payload.finalBranchConvergenceState) ?? readRecord3(result?.finalBranchConvergenceState) } : {},
|
|
@@ -7723,7 +7817,7 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
7723
7817
|
};
|
|
7724
7818
|
}
|
|
7725
7819
|
function renderMeshCoordinatorTemplate(template, values) {
|
|
7726
|
-
return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand|adhdevMcpArgs)\s*\}\}/g, (_,
|
|
7820
|
+
return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand|adhdevMcpArgs)\s*\}\}/g, (_, key2) => values[key2] || "");
|
|
7727
7821
|
}
|
|
7728
7822
|
function replaceLegacyCliCommandMcpArgs(command, args) {
|
|
7729
7823
|
return command.replace(
|
|
@@ -7732,9 +7826,9 @@ function replaceLegacyCliCommandMcpArgs(command, args) {
|
|
|
7732
7826
|
);
|
|
7733
7827
|
}
|
|
7734
7828
|
function resolveHermesCoordinatorHome(meshId, workspace) {
|
|
7735
|
-
const
|
|
7829
|
+
const key2 = `${meshId || "mesh"}
|
|
7736
7830
|
${(0, import_node_path.resolve)(workspace || os4.tmpdir())}`;
|
|
7737
|
-
const hash = shortHash(
|
|
7831
|
+
const hash = shortHash(key2);
|
|
7738
7832
|
return (0, import_node_path.join)(os4.tmpdir(), `adhdev-hermes-mesh-coordinator-${hash}`);
|
|
7739
7833
|
}
|
|
7740
7834
|
function resolveMcpConfigPath(configPath, workspace) {
|
|
@@ -8205,9 +8299,9 @@ function suggestMeshRefineConfig(mesh, workspace) {
|
|
|
8205
8299
|
const seen = /* @__PURE__ */ new Set();
|
|
8206
8300
|
const suggestions = [];
|
|
8207
8301
|
for (const entry of [...collectProjectContextSuggestions(mesh), ...collectPackageScriptSuggestions(workspace)]) {
|
|
8208
|
-
const
|
|
8209
|
-
if (seen.has(
|
|
8210
|
-
seen.add(
|
|
8302
|
+
const key2 = `${entry.command} ${(entry.args || []).join(" ")}`.trim();
|
|
8303
|
+
if (seen.has(key2)) continue;
|
|
8304
|
+
seen.add(key2);
|
|
8211
8305
|
suggestions.push(entry);
|
|
8212
8306
|
}
|
|
8213
8307
|
return {
|
|
@@ -8684,6 +8778,216 @@ var init_worktree_bootstrap_config = __esm({
|
|
|
8684
8778
|
}
|
|
8685
8779
|
});
|
|
8686
8780
|
|
|
8781
|
+
// src/config/mesh-json-config.ts
|
|
8782
|
+
var mesh_json_config_exports = {};
|
|
8783
|
+
__export(mesh_json_config_exports, {
|
|
8784
|
+
MESH_JSON_CONFIG_LOCATIONS: () => MESH_JSON_CONFIG_LOCATIONS,
|
|
8785
|
+
MESH_JSON_CONFIG_SCHEMA: () => MESH_JSON_CONFIG_SCHEMA,
|
|
8786
|
+
applyRepoMeshConfig: () => applyRepoMeshConfig,
|
|
8787
|
+
buildMeshJsonConfigScaffold: () => buildMeshJsonConfigScaffold,
|
|
8788
|
+
loadRepoMeshJsonConfig: () => loadRepoMeshJsonConfig,
|
|
8789
|
+
mergeEffectiveCoordinatorConfig: () => mergeEffectiveCoordinatorConfig,
|
|
8790
|
+
mergeEffectiveOperatingNotes: () => mergeEffectiveOperatingNotes,
|
|
8791
|
+
normalizeRepoMeshDeclarativeConfig: () => normalizeRepoMeshDeclarativeConfig,
|
|
8792
|
+
serializeMeshJsonConfigScaffold: () => serializeMeshJsonConfigScaffold
|
|
8793
|
+
});
|
|
8794
|
+
function isRecord3(value) {
|
|
8795
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
8796
|
+
}
|
|
8797
|
+
function parseConfigText4(path43, text) {
|
|
8798
|
+
if (/\.json$/i.test(path43)) return JSON.parse(text);
|
|
8799
|
+
return yaml4.load(text);
|
|
8800
|
+
}
|
|
8801
|
+
function normalizeOperatingNote(value) {
|
|
8802
|
+
if (!isRecord3(value)) return null;
|
|
8803
|
+
const text = typeof value.text === "string" ? value.text.trim() : "";
|
|
8804
|
+
if (!text) return null;
|
|
8805
|
+
const category = value.category === "provider_quirk" || value.category === "pattern_to_avoid" || value.category === "recovery_lesson" ? value.category : void 0;
|
|
8806
|
+
return {
|
|
8807
|
+
text,
|
|
8808
|
+
...category ? { category } : {},
|
|
8809
|
+
...typeof value.createdAt === "string" ? { createdAt: value.createdAt } : {},
|
|
8810
|
+
...typeof value.sourceCoordinator === "string" ? { sourceCoordinator: value.sourceCoordinator } : {}
|
|
8811
|
+
};
|
|
8812
|
+
}
|
|
8813
|
+
function normalizeRepoMeshDeclarativeConfig(parsed) {
|
|
8814
|
+
const errors = [];
|
|
8815
|
+
if (!isRecord3(parsed)) return { valid: false, errors: ["config must be an object"] };
|
|
8816
|
+
if (parsed.version !== 1) {
|
|
8817
|
+
return { valid: false, errors: [`version must be 1 (got ${JSON.stringify(parsed.version)})`] };
|
|
8818
|
+
}
|
|
8819
|
+
const config = { version: 1 };
|
|
8820
|
+
if (parsed.coordinator !== void 0) {
|
|
8821
|
+
if (isRecord3(parsed.coordinator)) {
|
|
8822
|
+
const coord = {};
|
|
8823
|
+
const c = parsed.coordinator;
|
|
8824
|
+
if (typeof c.systemPromptOverride === "string") coord.systemPromptOverride = c.systemPromptOverride;
|
|
8825
|
+
if (typeof c.systemPromptAppend === "string") coord.systemPromptAppend = c.systemPromptAppend;
|
|
8826
|
+
if (Number.isFinite(Number(c.maxPromptChars))) coord.maxPromptChars = Number(c.maxPromptChars);
|
|
8827
|
+
config.coordinator = coord;
|
|
8828
|
+
} else {
|
|
8829
|
+
errors.push("coordinator must be an object when provided");
|
|
8830
|
+
}
|
|
8831
|
+
}
|
|
8832
|
+
if (parsed.operatingNotes !== void 0) {
|
|
8833
|
+
if (Array.isArray(parsed.operatingNotes)) {
|
|
8834
|
+
const notes = parsed.operatingNotes.map(normalizeOperatingNote).filter((n) => n !== null);
|
|
8835
|
+
if (notes.length) config.operatingNotes = notes;
|
|
8836
|
+
} else {
|
|
8837
|
+
errors.push("operatingNotes must be an array when provided");
|
|
8838
|
+
}
|
|
8839
|
+
}
|
|
8840
|
+
if (parsed.limits !== void 0) {
|
|
8841
|
+
if (isRecord3(parsed.limits)) {
|
|
8842
|
+
const limits = {};
|
|
8843
|
+
if (Number.isFinite(Number(parsed.limits.maxNoteChars))) limits.maxNoteChars = Number(parsed.limits.maxNoteChars);
|
|
8844
|
+
if (Number.isFinite(Number(parsed.limits.maxNotes))) limits.maxNotes = Number(parsed.limits.maxNotes);
|
|
8845
|
+
if (Object.keys(limits).length) config.limits = limits;
|
|
8846
|
+
} else {
|
|
8847
|
+
errors.push("limits must be an object when provided");
|
|
8848
|
+
}
|
|
8849
|
+
}
|
|
8850
|
+
return { valid: true, config, errors };
|
|
8851
|
+
}
|
|
8852
|
+
function loadRepoMeshJsonConfig(workspace) {
|
|
8853
|
+
const bases = [];
|
|
8854
|
+
const ws = typeof workspace === "string" ? workspace.trim() : "";
|
|
8855
|
+
if (ws) bases.push(ws);
|
|
8856
|
+
let cwd = "";
|
|
8857
|
+
try {
|
|
8858
|
+
cwd = process.cwd();
|
|
8859
|
+
} catch {
|
|
8860
|
+
}
|
|
8861
|
+
if (cwd && cwd !== ws) bases.push(cwd);
|
|
8862
|
+
for (const base of bases) {
|
|
8863
|
+
for (const relative5 of MESH_JSON_CONFIG_LOCATIONS) {
|
|
8864
|
+
const configPath = (0, import_path9.join)(base, relative5);
|
|
8865
|
+
if (!(0, import_fs10.existsSync)(configPath)) continue;
|
|
8866
|
+
try {
|
|
8867
|
+
const parsed = parseConfigText4(configPath, (0, import_fs10.readFileSync)(configPath, "utf-8"));
|
|
8868
|
+
const result = normalizeRepoMeshDeclarativeConfig(parsed);
|
|
8869
|
+
if (!result.valid || !result.config) {
|
|
8870
|
+
return { source: relative5, sourceType: "invalid", path: configPath, error: result.errors.join("; ") };
|
|
8871
|
+
}
|
|
8872
|
+
return { config: result.config, source: relative5, sourceType: "repo_file", path: configPath };
|
|
8873
|
+
} catch (error) {
|
|
8874
|
+
return { source: relative5, sourceType: "invalid", path: configPath, error: error?.message || String(error) };
|
|
8875
|
+
}
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8878
|
+
return {
|
|
8879
|
+
source: "unavailable",
|
|
8880
|
+
sourceType: "unavailable",
|
|
8881
|
+
error: `No repo mesh config found. Checked: ${MESH_JSON_CONFIG_LOCATIONS.join(", ")}`
|
|
8882
|
+
};
|
|
8883
|
+
}
|
|
8884
|
+
function mergeEffectiveCoordinatorConfig(repoCoord, localCoord) {
|
|
8885
|
+
const out = { ...localCoord || {} };
|
|
8886
|
+
const localOverride = localCoord?.systemPromptOverride?.trim();
|
|
8887
|
+
const repoOverride = repoCoord?.systemPromptOverride?.trim();
|
|
8888
|
+
if (localOverride) {
|
|
8889
|
+
out.systemPromptOverride = localCoord.systemPromptOverride;
|
|
8890
|
+
} else if (repoOverride) {
|
|
8891
|
+
out.systemPromptOverride = repoCoord.systemPromptOverride;
|
|
8892
|
+
} else {
|
|
8893
|
+
delete out.systemPromptOverride;
|
|
8894
|
+
}
|
|
8895
|
+
const repoAppend = repoCoord?.systemPromptAppend?.trim() ? repoCoord.systemPromptAppend.trim() : "";
|
|
8896
|
+
const localAppendRaw = localCoord?.systemPromptAppend ?? localCoord?.systemPromptSuffix;
|
|
8897
|
+
const localAppend = localAppendRaw?.trim() ? localAppendRaw.trim() : "";
|
|
8898
|
+
const stacked = [repoAppend, localAppend].filter(Boolean).join("\n\n");
|
|
8899
|
+
if (stacked) {
|
|
8900
|
+
out.systemPromptAppend = stacked;
|
|
8901
|
+
delete out.systemPromptSuffix;
|
|
8902
|
+
}
|
|
8903
|
+
return out;
|
|
8904
|
+
}
|
|
8905
|
+
function mergeEffectiveOperatingNotes(repoNotes, ledgerNotes) {
|
|
8906
|
+
const usable = (notes) => Array.isArray(notes) ? notes.filter((n) => n && typeof n.text === "string" && n.text.trim()) : [];
|
|
8907
|
+
const repo = usable(repoNotes);
|
|
8908
|
+
const ledger = usable(ledgerNotes);
|
|
8909
|
+
const ledgerTexts = new Set(ledger.map((n) => n.text.trim()));
|
|
8910
|
+
const repoKept = repo.filter((n) => !ledgerTexts.has(n.text.trim()));
|
|
8911
|
+
const merged = [...repoKept, ...ledger];
|
|
8912
|
+
return merged.length ? merged : void 0;
|
|
8913
|
+
}
|
|
8914
|
+
function applyRepoMeshConfig(mesh, repoConfig) {
|
|
8915
|
+
if (!repoConfig) return mesh;
|
|
8916
|
+
return {
|
|
8917
|
+
...mesh,
|
|
8918
|
+
coordinator: mergeEffectiveCoordinatorConfig(repoConfig.coordinator, mesh.coordinator)
|
|
8919
|
+
};
|
|
8920
|
+
}
|
|
8921
|
+
function buildMeshJsonConfigScaffold(mesh) {
|
|
8922
|
+
const scaffold = { version: 1 };
|
|
8923
|
+
const coord = {};
|
|
8924
|
+
const override = mesh.coordinator?.systemPromptOverride;
|
|
8925
|
+
if (typeof override === "string" && override.trim()) coord.systemPromptOverride = override;
|
|
8926
|
+
const append = mesh.coordinator?.systemPromptAppend ?? mesh.coordinator?.systemPromptSuffix;
|
|
8927
|
+
if (typeof append === "string" && append.trim()) coord.systemPromptAppend = append;
|
|
8928
|
+
if (Object.keys(coord).length) scaffold.coordinator = coord;
|
|
8929
|
+
return scaffold;
|
|
8930
|
+
}
|
|
8931
|
+
function serializeMeshJsonConfigScaffold(config) {
|
|
8932
|
+
return JSON.stringify(config, null, 2);
|
|
8933
|
+
}
|
|
8934
|
+
var import_fs10, import_path9, yaml4, MESH_JSON_CONFIG_LOCATIONS, MESH_JSON_CONFIG_SCHEMA;
|
|
8935
|
+
var init_mesh_json_config = __esm({
|
|
8936
|
+
"src/config/mesh-json-config.ts"() {
|
|
8937
|
+
"use strict";
|
|
8938
|
+
import_fs10 = require("fs");
|
|
8939
|
+
import_path9 = require("path");
|
|
8940
|
+
yaml4 = __toESM(require("js-yaml"));
|
|
8941
|
+
MESH_JSON_CONFIG_LOCATIONS = [
|
|
8942
|
+
".adhdev/mesh.json",
|
|
8943
|
+
".adhdev/mesh.yaml",
|
|
8944
|
+
".adhdev/mesh.yml"
|
|
8945
|
+
];
|
|
8946
|
+
MESH_JSON_CONFIG_SCHEMA = {
|
|
8947
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
8948
|
+
title: "ADHDev Repo Mesh Declarative Config",
|
|
8949
|
+
type: "object",
|
|
8950
|
+
additionalProperties: false,
|
|
8951
|
+
required: ["version"],
|
|
8952
|
+
properties: {
|
|
8953
|
+
version: { const: 1 },
|
|
8954
|
+
coordinator: {
|
|
8955
|
+
type: "object",
|
|
8956
|
+
additionalProperties: false,
|
|
8957
|
+
properties: {
|
|
8958
|
+
systemPromptOverride: { type: "string" },
|
|
8959
|
+
systemPromptAppend: { type: "string" },
|
|
8960
|
+
maxPromptChars: { type: "number", minimum: 1 }
|
|
8961
|
+
}
|
|
8962
|
+
},
|
|
8963
|
+
operatingNotes: {
|
|
8964
|
+
type: "array",
|
|
8965
|
+
maxItems: 200,
|
|
8966
|
+
items: {
|
|
8967
|
+
type: "object",
|
|
8968
|
+
additionalProperties: false,
|
|
8969
|
+
required: ["text"],
|
|
8970
|
+
properties: {
|
|
8971
|
+
text: { type: "string", minLength: 1 },
|
|
8972
|
+
category: { enum: ["provider_quirk", "pattern_to_avoid", "recovery_lesson"] },
|
|
8973
|
+
createdAt: { type: "string" },
|
|
8974
|
+
sourceCoordinator: { type: "string" }
|
|
8975
|
+
}
|
|
8976
|
+
}
|
|
8977
|
+
},
|
|
8978
|
+
limits: {
|
|
8979
|
+
type: "object",
|
|
8980
|
+
additionalProperties: false,
|
|
8981
|
+
properties: {
|
|
8982
|
+
maxNoteChars: { type: "number", minimum: 1 },
|
|
8983
|
+
maxNotes: { type: "number", minimum: 1 }
|
|
8984
|
+
}
|
|
8985
|
+
}
|
|
8986
|
+
}
|
|
8987
|
+
};
|
|
8988
|
+
}
|
|
8989
|
+
});
|
|
8990
|
+
|
|
8687
8991
|
// src/mesh/mesh-fast-forward.ts
|
|
8688
8992
|
async function fastForwardMeshNode(args) {
|
|
8689
8993
|
const workspace = typeof args.workspace === "string" ? args.workspace.trim() : "";
|
|
@@ -10151,9 +10455,9 @@ function getPendingEventsPath(meshId, coordinatorDaemonId) {
|
|
|
10151
10455
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
10152
10456
|
if (coordinatorDaemonId) {
|
|
10153
10457
|
const safeDaemon = coordinatorDaemonId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
10154
|
-
return (0,
|
|
10458
|
+
return (0, import_path10.join)(getLedgerDir(), `${safe}-${safeDaemon}.pending-events.jsonl`);
|
|
10155
10459
|
}
|
|
10156
|
-
return (0,
|
|
10460
|
+
return (0, import_path10.join)(getLedgerDir(), `${safe}.pending-events.jsonl`);
|
|
10157
10461
|
}
|
|
10158
10462
|
function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
|
|
10159
10463
|
if (!meshId) return [];
|
|
@@ -10162,9 +10466,9 @@ function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
|
|
|
10162
10466
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
10163
10467
|
const events = [];
|
|
10164
10468
|
for (const path43 of paths) {
|
|
10165
|
-
if (!(0,
|
|
10469
|
+
if (!(0, import_fs11.existsSync)(path43)) continue;
|
|
10166
10470
|
try {
|
|
10167
|
-
const raw = (0,
|
|
10471
|
+
const raw = (0, import_fs11.readFileSync)(path43, "utf-8");
|
|
10168
10472
|
const parsed = raw.split("\n").filter(Boolean).flatMap((line) => {
|
|
10169
10473
|
try {
|
|
10170
10474
|
return [JSON.parse(line)];
|
|
@@ -10239,9 +10543,9 @@ function reconcilePendingMeshCoordinatorEvents(meshId, events) {
|
|
|
10239
10543
|
}
|
|
10240
10544
|
function trimPendingEventsIfNeeded(path43) {
|
|
10241
10545
|
try {
|
|
10242
|
-
if (!(0,
|
|
10243
|
-
if ((0,
|
|
10244
|
-
const lines = (0,
|
|
10546
|
+
if (!(0, import_fs11.existsSync)(path43)) return;
|
|
10547
|
+
if ((0, import_fs11.statSync)(path43).size <= MAX_PENDING_EVENTS_BYTES) return;
|
|
10548
|
+
const lines = (0, import_fs11.readFileSync)(path43, "utf-8").split("\n").filter(Boolean);
|
|
10245
10549
|
if (lines.length <= MAX_PENDING_EVENTS_KEEP) return;
|
|
10246
10550
|
const dropped = lines.slice(0, lines.length - MAX_PENDING_EVENTS_KEEP);
|
|
10247
10551
|
for (const line of dropped) {
|
|
@@ -10274,7 +10578,7 @@ function trimPendingEventsIfNeeded(path43) {
|
|
|
10274
10578
|
LOG.warn("MeshEvents", `Failed to ledger-record trim-dropped ${event.event} for mesh ${event.meshId}: ${e?.message || e}`);
|
|
10275
10579
|
}
|
|
10276
10580
|
}
|
|
10277
|
-
(0,
|
|
10581
|
+
(0, import_fs11.writeFileSync)(path43, lines.slice(-MAX_PENDING_EVENTS_KEEP).join("\n") + "\n", "utf-8");
|
|
10278
10582
|
} catch {
|
|
10279
10583
|
}
|
|
10280
10584
|
}
|
|
@@ -10306,7 +10610,7 @@ function queuePendingMeshCoordinatorEvent(event) {
|
|
|
10306
10610
|
try {
|
|
10307
10611
|
const path43 = getPendingEventsPath(event.meshId, event.targetCoordinatorDaemonId);
|
|
10308
10612
|
trimPendingEventsIfNeeded(path43);
|
|
10309
|
-
(0,
|
|
10613
|
+
(0, import_fs11.appendFileSync)(path43, JSON.stringify(event) + "\n", "utf-8");
|
|
10310
10614
|
} catch (e) {
|
|
10311
10615
|
if (!sqliteOk) throw e;
|
|
10312
10616
|
LOG.warn("MeshEvents", `JSONL append failed for mesh ${event.meshId}; SQLite holds the event: ${e?.message || e}`);
|
|
@@ -10320,20 +10624,20 @@ function queuePendingMeshCoordinatorEvent(event) {
|
|
|
10320
10624
|
function atomicDrainFile(path43) {
|
|
10321
10625
|
const tmpPath = `${path43}.draining`;
|
|
10322
10626
|
try {
|
|
10323
|
-
(0,
|
|
10627
|
+
(0, import_fs11.renameSync)(path43, tmpPath);
|
|
10324
10628
|
} catch {
|
|
10325
10629
|
return null;
|
|
10326
10630
|
}
|
|
10327
10631
|
try {
|
|
10328
|
-
const content = (0,
|
|
10632
|
+
const content = (0, import_fs11.readFileSync)(tmpPath, "utf-8");
|
|
10329
10633
|
try {
|
|
10330
|
-
(0,
|
|
10634
|
+
(0, import_fs11.unlinkSync)(tmpPath);
|
|
10331
10635
|
} catch {
|
|
10332
10636
|
}
|
|
10333
10637
|
return content;
|
|
10334
10638
|
} catch {
|
|
10335
10639
|
try {
|
|
10336
|
-
(0,
|
|
10640
|
+
(0, import_fs11.unlinkSync)(tmpPath);
|
|
10337
10641
|
} catch {
|
|
10338
10642
|
}
|
|
10339
10643
|
return null;
|
|
@@ -10342,16 +10646,16 @@ function atomicDrainFile(path43) {
|
|
|
10342
10646
|
function selectiveDrainFile(path43, predicate) {
|
|
10343
10647
|
const tmpPath = `${path43}.draining`;
|
|
10344
10648
|
try {
|
|
10345
|
-
(0,
|
|
10649
|
+
(0, import_fs11.renameSync)(path43, tmpPath);
|
|
10346
10650
|
} catch {
|
|
10347
10651
|
return [];
|
|
10348
10652
|
}
|
|
10349
10653
|
let content;
|
|
10350
10654
|
try {
|
|
10351
|
-
content = (0,
|
|
10655
|
+
content = (0, import_fs11.readFileSync)(tmpPath, "utf-8");
|
|
10352
10656
|
} catch {
|
|
10353
10657
|
try {
|
|
10354
|
-
(0,
|
|
10658
|
+
(0, import_fs11.unlinkSync)(tmpPath);
|
|
10355
10659
|
} catch {
|
|
10356
10660
|
}
|
|
10357
10661
|
return [];
|
|
@@ -10374,12 +10678,12 @@ function selectiveDrainFile(path43, predicate) {
|
|
|
10374
10678
|
}
|
|
10375
10679
|
try {
|
|
10376
10680
|
if (keptLines.length > 0) {
|
|
10377
|
-
(0,
|
|
10681
|
+
(0, import_fs11.writeFileSync)(path43, keptLines.join("\n") + "\n", "utf-8");
|
|
10378
10682
|
}
|
|
10379
|
-
(0,
|
|
10683
|
+
(0, import_fs11.unlinkSync)(tmpPath);
|
|
10380
10684
|
} catch {
|
|
10381
10685
|
try {
|
|
10382
|
-
if ((0,
|
|
10686
|
+
if ((0, import_fs11.existsSync)(tmpPath) && !(0, import_fs11.existsSync)(path43)) (0, import_fs11.renameSync)(tmpPath, path43);
|
|
10383
10687
|
} catch {
|
|
10384
10688
|
}
|
|
10385
10689
|
return [];
|
|
@@ -10474,18 +10778,18 @@ function clearPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId) {
|
|
|
10474
10778
|
}
|
|
10475
10779
|
const paths = coordinatorDaemonId ? [getPendingEventsPath(meshId, coordinatorDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
10476
10780
|
for (const path43 of paths) {
|
|
10477
|
-
if ((0,
|
|
10478
|
-
(0,
|
|
10781
|
+
if ((0, import_fs11.existsSync)(path43)) try {
|
|
10782
|
+
(0, import_fs11.unlinkSync)(path43);
|
|
10479
10783
|
} catch {
|
|
10480
10784
|
}
|
|
10481
10785
|
}
|
|
10482
10786
|
}
|
|
10483
|
-
var
|
|
10787
|
+
var import_fs11, import_path10, import_crypto8, REFINE_TERMINAL_EVENTS, TERMINAL_COMPLETION_EVENTS, MAX_PENDING_EVENTS_BYTES, MAX_PENDING_EVENTS_KEEP;
|
|
10484
10788
|
var init_mesh_events_pending = __esm({
|
|
10485
10789
|
"src/mesh/mesh-events-pending.ts"() {
|
|
10486
10790
|
"use strict";
|
|
10487
|
-
|
|
10488
|
-
|
|
10791
|
+
import_fs11 = require("fs");
|
|
10792
|
+
import_path10 = require("path");
|
|
10489
10793
|
import_crypto8 = require("crypto");
|
|
10490
10794
|
init_logger();
|
|
10491
10795
|
init_mesh_ledger();
|
|
@@ -11257,7 +11561,7 @@ function resolveCommandPath(command) {
|
|
|
11257
11561
|
if (isExplicitCommandPath(trimmed)) {
|
|
11258
11562
|
const expanded = expandHome(trimmed);
|
|
11259
11563
|
const candidate = path12.isAbsolute(expanded) ? expanded : path12.resolve(expanded);
|
|
11260
|
-
return (0,
|
|
11564
|
+
return (0, import_fs12.existsSync)(candidate) ? candidate : null;
|
|
11261
11565
|
}
|
|
11262
11566
|
return null;
|
|
11263
11567
|
}
|
|
@@ -11267,7 +11571,7 @@ async function resolveDetectionPath(command, whichCmd) {
|
|
|
11267
11571
|
const whichResult = await execAsync(`${whichCmd} ${shellQuote(command)}`);
|
|
11268
11572
|
if (whichResult) return whichResult.split("\n")[0];
|
|
11269
11573
|
const resolved = findBinary(command);
|
|
11270
|
-
if (path12.isAbsolute(resolved) && (0,
|
|
11574
|
+
if (path12.isAbsolute(resolved) && (0, import_fs12.existsSync)(resolved)) return resolved;
|
|
11271
11575
|
return null;
|
|
11272
11576
|
}
|
|
11273
11577
|
function execAsync(cmd, timeoutMs = 5e3) {
|
|
@@ -11362,14 +11666,14 @@ async function detectCLI(cliId, providerLoader, options) {
|
|
|
11362
11666
|
const all = await detectCLIs(providerLoader, options);
|
|
11363
11667
|
return all.find((c) => c.id === resolvedId && c.installed) || null;
|
|
11364
11668
|
}
|
|
11365
|
-
var import_child_process2, os6, path12,
|
|
11669
|
+
var import_child_process2, os6, path12, import_fs12;
|
|
11366
11670
|
var init_cli_detector = __esm({
|
|
11367
11671
|
"src/detection/cli-detector.ts"() {
|
|
11368
11672
|
"use strict";
|
|
11369
11673
|
import_child_process2 = require("child_process");
|
|
11370
11674
|
os6 = __toESM(require("os"));
|
|
11371
11675
|
path12 = __toESM(require("path"));
|
|
11372
|
-
|
|
11676
|
+
import_fs12 = require("fs");
|
|
11373
11677
|
init_provider_cli_shared();
|
|
11374
11678
|
}
|
|
11375
11679
|
});
|
|
@@ -11490,346 +11794,10 @@ var init_mesh_warmup_deadline = __esm({
|
|
|
11490
11794
|
}
|
|
11491
11795
|
});
|
|
11492
11796
|
|
|
11493
|
-
// src/config/mesh-json-config.ts
|
|
11494
|
-
var mesh_json_config_exports = {};
|
|
11495
|
-
__export(mesh_json_config_exports, {
|
|
11496
|
-
MESH_JSON_CONFIG_LOCATIONS: () => MESH_JSON_CONFIG_LOCATIONS,
|
|
11497
|
-
MESH_JSON_CONFIG_SCHEMA: () => MESH_JSON_CONFIG_SCHEMA,
|
|
11498
|
-
__resetMeshJsonConfigCacheForTests: () => __resetMeshJsonConfigCacheForTests,
|
|
11499
|
-
applyRepoMeshConfig: () => applyRepoMeshConfig,
|
|
11500
|
-
buildMeshJsonConfigScaffold: () => buildMeshJsonConfigScaffold,
|
|
11501
|
-
diffPolicyFromDefault: () => diffPolicyFromDefault,
|
|
11502
|
-
loadMeshJsonConfig: () => loadMeshJsonConfig,
|
|
11503
|
-
loadRepoMeshJsonConfig: () => loadRepoMeshJsonConfig,
|
|
11504
|
-
mergeEffectiveCoordinatorConfig: () => mergeEffectiveCoordinatorConfig,
|
|
11505
|
-
mergeEffectiveMeshPolicy: () => mergeEffectiveMeshPolicy,
|
|
11506
|
-
mergeEffectiveOperatingNotes: () => mergeEffectiveOperatingNotes,
|
|
11507
|
-
normalizeRepoMeshDeclarativeConfig: () => normalizeRepoMeshDeclarativeConfig,
|
|
11508
|
-
serializeMeshJsonConfigScaffold: () => serializeMeshJsonConfigScaffold,
|
|
11509
|
-
validateMeshJsonConfig: () => validateMeshJsonConfig
|
|
11510
|
-
});
|
|
11511
|
-
function isRecord3(value) {
|
|
11512
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
11513
|
-
}
|
|
11514
|
-
function parseConfigText4(path43, text) {
|
|
11515
|
-
if (/\.json$/i.test(path43)) return JSON.parse(text);
|
|
11516
|
-
return yaml4.load(text);
|
|
11517
|
-
}
|
|
11518
|
-
function normalizeOperatingNote(value) {
|
|
11519
|
-
if (!isRecord3(value)) return null;
|
|
11520
|
-
const text = typeof value.text === "string" ? value.text.trim() : "";
|
|
11521
|
-
if (!text) return null;
|
|
11522
|
-
const category = value.category === "provider_quirk" || value.category === "pattern_to_avoid" || value.category === "recovery_lesson" ? value.category : void 0;
|
|
11523
|
-
return {
|
|
11524
|
-
text,
|
|
11525
|
-
...category ? { category } : {},
|
|
11526
|
-
...typeof value.createdAt === "string" ? { createdAt: value.createdAt } : {},
|
|
11527
|
-
...typeof value.sourceCoordinator === "string" ? { sourceCoordinator: value.sourceCoordinator } : {}
|
|
11528
|
-
};
|
|
11529
|
-
}
|
|
11530
|
-
function normalizeRepoMeshDeclarativeConfig(parsed) {
|
|
11531
|
-
const errors = [];
|
|
11532
|
-
if (!isRecord3(parsed)) return { valid: false, errors: ["config must be an object"] };
|
|
11533
|
-
if (parsed.version !== 1) {
|
|
11534
|
-
return { valid: false, errors: [`version must be 1 (got ${JSON.stringify(parsed.version)})`] };
|
|
11535
|
-
}
|
|
11536
|
-
const config = { version: 1 };
|
|
11537
|
-
if (parsed.policy !== void 0) {
|
|
11538
|
-
if (isRecord3(parsed.policy)) {
|
|
11539
|
-
config.policy = parsed.policy;
|
|
11540
|
-
} else {
|
|
11541
|
-
errors.push("policy must be an object when provided");
|
|
11542
|
-
}
|
|
11543
|
-
}
|
|
11544
|
-
if (parsed.coordinator !== void 0) {
|
|
11545
|
-
if (isRecord3(parsed.coordinator)) {
|
|
11546
|
-
const coord = {};
|
|
11547
|
-
const c = parsed.coordinator;
|
|
11548
|
-
if (typeof c.systemPromptOverride === "string") coord.systemPromptOverride = c.systemPromptOverride;
|
|
11549
|
-
if (typeof c.systemPromptAppend === "string") coord.systemPromptAppend = c.systemPromptAppend;
|
|
11550
|
-
if (Number.isFinite(Number(c.maxPromptChars))) coord.maxPromptChars = Number(c.maxPromptChars);
|
|
11551
|
-
config.coordinator = coord;
|
|
11552
|
-
} else {
|
|
11553
|
-
errors.push("coordinator must be an object when provided");
|
|
11554
|
-
}
|
|
11555
|
-
}
|
|
11556
|
-
if (parsed.operatingNotes !== void 0) {
|
|
11557
|
-
if (Array.isArray(parsed.operatingNotes)) {
|
|
11558
|
-
const notes = parsed.operatingNotes.map(normalizeOperatingNote).filter((n) => n !== null);
|
|
11559
|
-
if (notes.length) config.operatingNotes = notes;
|
|
11560
|
-
} else {
|
|
11561
|
-
errors.push("operatingNotes must be an array when provided");
|
|
11562
|
-
}
|
|
11563
|
-
}
|
|
11564
|
-
if (parsed.limits !== void 0) {
|
|
11565
|
-
if (isRecord3(parsed.limits)) {
|
|
11566
|
-
const limits = {};
|
|
11567
|
-
if (Number.isFinite(Number(parsed.limits.maxNoteChars))) limits.maxNoteChars = Number(parsed.limits.maxNoteChars);
|
|
11568
|
-
if (Number.isFinite(Number(parsed.limits.maxNotes))) limits.maxNotes = Number(parsed.limits.maxNotes);
|
|
11569
|
-
if (Object.keys(limits).length) config.limits = limits;
|
|
11570
|
-
} else {
|
|
11571
|
-
errors.push("limits must be an object when provided");
|
|
11572
|
-
}
|
|
11573
|
-
}
|
|
11574
|
-
return { valid: true, config, errors };
|
|
11575
|
-
}
|
|
11576
|
-
function loadRepoMeshJsonConfig(workspace) {
|
|
11577
|
-
const bases = [];
|
|
11578
|
-
const ws = typeof workspace === "string" ? workspace.trim() : "";
|
|
11579
|
-
if (ws) bases.push(ws);
|
|
11580
|
-
let cwd = "";
|
|
11581
|
-
try {
|
|
11582
|
-
cwd = process.cwd();
|
|
11583
|
-
} catch {
|
|
11584
|
-
}
|
|
11585
|
-
if (cwd && cwd !== ws) bases.push(cwd);
|
|
11586
|
-
for (const base of bases) {
|
|
11587
|
-
for (const relative5 of MESH_JSON_CONFIG_LOCATIONS) {
|
|
11588
|
-
const configPath = (0, import_path10.join)(base, relative5);
|
|
11589
|
-
if (!(0, import_fs12.existsSync)(configPath)) continue;
|
|
11590
|
-
try {
|
|
11591
|
-
const parsed = parseConfigText4(configPath, (0, import_fs12.readFileSync)(configPath, "utf-8"));
|
|
11592
|
-
const result = normalizeRepoMeshDeclarativeConfig(parsed);
|
|
11593
|
-
if (!result.valid || !result.config) {
|
|
11594
|
-
return { source: relative5, sourceType: "invalid", path: configPath, error: result.errors.join("; ") };
|
|
11595
|
-
}
|
|
11596
|
-
return { config: result.config, source: relative5, sourceType: "repo_file", path: configPath };
|
|
11597
|
-
} catch (error) {
|
|
11598
|
-
return { source: relative5, sourceType: "invalid", path: configPath, error: error?.message || String(error) };
|
|
11599
|
-
}
|
|
11600
|
-
}
|
|
11601
|
-
}
|
|
11602
|
-
return {
|
|
11603
|
-
source: "unavailable",
|
|
11604
|
-
sourceType: "unavailable",
|
|
11605
|
-
error: `No repo mesh config found. Checked: ${MESH_JSON_CONFIG_LOCATIONS.join(", ")}`
|
|
11606
|
-
};
|
|
11607
|
-
}
|
|
11608
|
-
function deepEqual(a, b) {
|
|
11609
|
-
if (a === b) return true;
|
|
11610
|
-
try {
|
|
11611
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
11612
|
-
} catch {
|
|
11613
|
-
return false;
|
|
11614
|
-
}
|
|
11615
|
-
}
|
|
11616
|
-
function diffPolicyFromDefault(local) {
|
|
11617
|
-
if (!local || typeof local !== "object") return {};
|
|
11618
|
-
const out = {};
|
|
11619
|
-
const def = mergeAndNormalizePolicy(void 0, void 0);
|
|
11620
|
-
for (const [key, value] of Object.entries(local)) {
|
|
11621
|
-
if (value === void 0) continue;
|
|
11622
|
-
if (!deepEqual(value, def[key])) out[key] = value;
|
|
11623
|
-
}
|
|
11624
|
-
return out;
|
|
11625
|
-
}
|
|
11626
|
-
function mergeEffectiveMeshPolicy(repoPolicy, localPolicy) {
|
|
11627
|
-
const repoMerged = mergeAndNormalizePolicy(void 0, repoPolicy);
|
|
11628
|
-
const localOverrides = diffPolicyFromDefault(localPolicy);
|
|
11629
|
-
return mergeAndNormalizePolicy(repoMerged, localOverrides);
|
|
11630
|
-
}
|
|
11631
|
-
function mergeEffectiveCoordinatorConfig(repoCoord, localCoord) {
|
|
11632
|
-
const out = { ...localCoord || {} };
|
|
11633
|
-
const localOverride = localCoord?.systemPromptOverride?.trim();
|
|
11634
|
-
const repoOverride = repoCoord?.systemPromptOverride?.trim();
|
|
11635
|
-
if (localOverride) {
|
|
11636
|
-
out.systemPromptOverride = localCoord.systemPromptOverride;
|
|
11637
|
-
} else if (repoOverride) {
|
|
11638
|
-
out.systemPromptOverride = repoCoord.systemPromptOverride;
|
|
11639
|
-
} else {
|
|
11640
|
-
delete out.systemPromptOverride;
|
|
11641
|
-
}
|
|
11642
|
-
const repoAppend = repoCoord?.systemPromptAppend?.trim() ? repoCoord.systemPromptAppend.trim() : "";
|
|
11643
|
-
const localAppendRaw = localCoord?.systemPromptAppend ?? localCoord?.systemPromptSuffix;
|
|
11644
|
-
const localAppend = localAppendRaw?.trim() ? localAppendRaw.trim() : "";
|
|
11645
|
-
const stacked = [repoAppend, localAppend].filter(Boolean).join("\n\n");
|
|
11646
|
-
if (stacked) {
|
|
11647
|
-
out.systemPromptAppend = stacked;
|
|
11648
|
-
delete out.systemPromptSuffix;
|
|
11649
|
-
}
|
|
11650
|
-
return out;
|
|
11651
|
-
}
|
|
11652
|
-
function mergeEffectiveOperatingNotes(repoNotes, ledgerNotes) {
|
|
11653
|
-
const usable = (notes) => Array.isArray(notes) ? notes.filter((n) => n && typeof n.text === "string" && n.text.trim()) : [];
|
|
11654
|
-
const repo = usable(repoNotes);
|
|
11655
|
-
const ledger = usable(ledgerNotes);
|
|
11656
|
-
const ledgerTexts = new Set(ledger.map((n) => n.text.trim()));
|
|
11657
|
-
const repoKept = repo.filter((n) => !ledgerTexts.has(n.text.trim()));
|
|
11658
|
-
const merged = [...repoKept, ...ledger];
|
|
11659
|
-
return merged.length ? merged : void 0;
|
|
11660
|
-
}
|
|
11661
|
-
function applyRepoMeshConfig(mesh, repoConfig) {
|
|
11662
|
-
if (!repoConfig) return mesh;
|
|
11663
|
-
return {
|
|
11664
|
-
...mesh,
|
|
11665
|
-
policy: mergeEffectiveMeshPolicy(repoConfig.policy, mesh.policy),
|
|
11666
|
-
coordinator: mergeEffectiveCoordinatorConfig(repoConfig.coordinator, mesh.coordinator)
|
|
11667
|
-
};
|
|
11668
|
-
}
|
|
11669
|
-
function buildMeshJsonConfigScaffold(mesh) {
|
|
11670
|
-
const scaffold = {
|
|
11671
|
-
version: 1,
|
|
11672
|
-
policy: mergeAndNormalizePolicy(void 0, mesh.policy)
|
|
11673
|
-
};
|
|
11674
|
-
const coord = {};
|
|
11675
|
-
const override = mesh.coordinator?.systemPromptOverride;
|
|
11676
|
-
if (typeof override === "string" && override.trim()) coord.systemPromptOverride = override;
|
|
11677
|
-
const append = mesh.coordinator?.systemPromptAppend ?? mesh.coordinator?.systemPromptSuffix;
|
|
11678
|
-
if (typeof append === "string" && append.trim()) coord.systemPromptAppend = append;
|
|
11679
|
-
if (Object.keys(coord).length) scaffold.coordinator = coord;
|
|
11680
|
-
return scaffold;
|
|
11681
|
-
}
|
|
11682
|
-
function serializeMeshJsonConfigScaffold(config) {
|
|
11683
|
-
return JSON.stringify(config, null, 2);
|
|
11684
|
-
}
|
|
11685
|
-
function validateMeshJsonConfig(raw, source = "inline") {
|
|
11686
|
-
const errors = [];
|
|
11687
|
-
if (!isRecord3(raw)) {
|
|
11688
|
-
return { valid: false, errors: [`${source}: config must be an object`] };
|
|
11689
|
-
}
|
|
11690
|
-
const config = {};
|
|
11691
|
-
const policy = raw.policy;
|
|
11692
|
-
const schedulingRaw = isRecord3(policy) ? policy.scheduling : void 0;
|
|
11693
|
-
if (schedulingRaw !== void 0) {
|
|
11694
|
-
if (!isRecord3(schedulingRaw)) {
|
|
11695
|
-
errors.push("policy.scheduling must be an object");
|
|
11696
|
-
} else {
|
|
11697
|
-
const scheduling = {};
|
|
11698
|
-
if (schedulingRaw.distribution !== void 0) {
|
|
11699
|
-
if (typeof schedulingRaw.distribution !== "string" || !["spread", "in_order"].includes(schedulingRaw.distribution.trim())) {
|
|
11700
|
-
errors.push("policy.scheduling.distribution must be 'spread' or 'in_order'");
|
|
11701
|
-
} else {
|
|
11702
|
-
scheduling.distribution = normalizeMeshDistribution(schedulingRaw.distribution);
|
|
11703
|
-
}
|
|
11704
|
-
}
|
|
11705
|
-
if (schedulingRaw.maxParallel !== void 0) {
|
|
11706
|
-
const n = Number(schedulingRaw.maxParallel);
|
|
11707
|
-
if (!Number.isFinite(n) || n < MESH_MAX_PARALLEL_TASKS_MIN || n > MESH_MAX_PARALLEL_TASKS_MAX) {
|
|
11708
|
-
errors.push(`policy.scheduling.maxParallel must be a number in [${MESH_MAX_PARALLEL_TASKS_MIN}, ${MESH_MAX_PARALLEL_TASKS_MAX}]`);
|
|
11709
|
-
} else {
|
|
11710
|
-
scheduling.maxParallel = Math.floor(n);
|
|
11711
|
-
}
|
|
11712
|
-
}
|
|
11713
|
-
if (schedulingRaw.readonlyMultiplier !== void 0) {
|
|
11714
|
-
const n = Number(schedulingRaw.readonlyMultiplier);
|
|
11715
|
-
if (!Number.isFinite(n) || n < 1) {
|
|
11716
|
-
errors.push("policy.scheduling.readonlyMultiplier must be a number >= 1");
|
|
11717
|
-
} else {
|
|
11718
|
-
scheduling.readonlyMultiplier = Math.floor(n);
|
|
11719
|
-
}
|
|
11720
|
-
}
|
|
11721
|
-
for (const key of Object.keys(schedulingRaw)) {
|
|
11722
|
-
if (!["distribution", "maxParallel", "readonlyMultiplier"].includes(key)) {
|
|
11723
|
-
errors.push(`policy.scheduling.${key} is not a recognized field`);
|
|
11724
|
-
}
|
|
11725
|
-
}
|
|
11726
|
-
if (Object.keys(scheduling).length) config.scheduling = scheduling;
|
|
11727
|
-
}
|
|
11728
|
-
}
|
|
11729
|
-
return { valid: errors.length === 0, errors, config: errors.length === 0 ? config : void 0 };
|
|
11730
|
-
}
|
|
11731
|
-
function loadMeshJsonConfig(repoRoot) {
|
|
11732
|
-
if (!repoRoot) {
|
|
11733
|
-
return { source: "unavailable", sourceType: "unavailable", error: "no repo root", sourceKey: "unavailable" };
|
|
11734
|
-
}
|
|
11735
|
-
for (const relative5 of MESH_JSON_CONFIG_LOCATIONS) {
|
|
11736
|
-
const configPath = (0, import_path10.join)(repoRoot, relative5);
|
|
11737
|
-
if (!(0, import_fs12.existsSync)(configPath)) continue;
|
|
11738
|
-
let mtimeMs = 0;
|
|
11739
|
-
try {
|
|
11740
|
-
mtimeMs = (0, import_fs12.statSync)(configPath).mtimeMs;
|
|
11741
|
-
} catch {
|
|
11742
|
-
mtimeMs = 0;
|
|
11743
|
-
}
|
|
11744
|
-
const cacheKey = configPath;
|
|
11745
|
-
const sourceKey = `file:${configPath}:${mtimeMs}`;
|
|
11746
|
-
const cached3 = cache.get(cacheKey);
|
|
11747
|
-
if (cached3 && cached3.sourceKey === sourceKey) return cached3.result;
|
|
11748
|
-
let result;
|
|
11749
|
-
try {
|
|
11750
|
-
const text = (0, import_fs12.readFileSync)(configPath, "utf-8");
|
|
11751
|
-
const parsed = parseConfigText4(configPath, text);
|
|
11752
|
-
const validation = validateMeshJsonConfig(parsed, relative5);
|
|
11753
|
-
result = validation.valid ? { config: validation.config, source: relative5, sourceType: "repo_file", path: configPath, sourceKey } : { source: relative5, sourceType: "invalid", path: configPath, error: validation.errors.join("; "), sourceKey: `invalid:${configPath}:${mtimeMs}` };
|
|
11754
|
-
} catch (error) {
|
|
11755
|
-
result = { source: relative5, sourceType: "invalid", path: configPath, error: error?.message || String(error), sourceKey: `error:${configPath}` };
|
|
11756
|
-
}
|
|
11757
|
-
cache.set(cacheKey, { sourceKey: result.sourceKey, result });
|
|
11758
|
-
return result;
|
|
11759
|
-
}
|
|
11760
|
-
return {
|
|
11761
|
-
source: "unavailable",
|
|
11762
|
-
sourceType: "unavailable",
|
|
11763
|
-
error: `No .adhdev/mesh config found. Checked: ${MESH_JSON_CONFIG_LOCATIONS.join(", ")}`,
|
|
11764
|
-
sourceKey: "unavailable"
|
|
11765
|
-
};
|
|
11766
|
-
}
|
|
11767
|
-
function __resetMeshJsonConfigCacheForTests() {
|
|
11768
|
-
cache.clear();
|
|
11769
|
-
}
|
|
11770
|
-
var import_fs12, import_path10, yaml4, MESH_JSON_CONFIG_LOCATIONS, MESH_JSON_CONFIG_SCHEMA, cache;
|
|
11771
|
-
var init_mesh_json_config = __esm({
|
|
11772
|
-
"src/config/mesh-json-config.ts"() {
|
|
11773
|
-
"use strict";
|
|
11774
|
-
import_fs12 = require("fs");
|
|
11775
|
-
import_path10 = require("path");
|
|
11776
|
-
yaml4 = __toESM(require("js-yaml"));
|
|
11777
|
-
init_repo_mesh_types();
|
|
11778
|
-
MESH_JSON_CONFIG_LOCATIONS = [
|
|
11779
|
-
".adhdev/mesh.json",
|
|
11780
|
-
".adhdev/mesh.yaml",
|
|
11781
|
-
".adhdev/mesh.yml"
|
|
11782
|
-
];
|
|
11783
|
-
MESH_JSON_CONFIG_SCHEMA = {
|
|
11784
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
11785
|
-
title: "ADHDev Repo Mesh Declarative Config",
|
|
11786
|
-
type: "object",
|
|
11787
|
-
additionalProperties: false,
|
|
11788
|
-
required: ["version"],
|
|
11789
|
-
properties: {
|
|
11790
|
-
version: { const: 1 },
|
|
11791
|
-
// policy is validated/normalized through mergeAndNormalizePolicy at merge
|
|
11792
|
-
// time; the schema here only asserts it is an object.
|
|
11793
|
-
policy: { type: "object" },
|
|
11794
|
-
coordinator: {
|
|
11795
|
-
type: "object",
|
|
11796
|
-
additionalProperties: false,
|
|
11797
|
-
properties: {
|
|
11798
|
-
systemPromptOverride: { type: "string" },
|
|
11799
|
-
systemPromptAppend: { type: "string" },
|
|
11800
|
-
maxPromptChars: { type: "number", minimum: 1 }
|
|
11801
|
-
}
|
|
11802
|
-
},
|
|
11803
|
-
operatingNotes: {
|
|
11804
|
-
type: "array",
|
|
11805
|
-
maxItems: 200,
|
|
11806
|
-
items: {
|
|
11807
|
-
type: "object",
|
|
11808
|
-
additionalProperties: false,
|
|
11809
|
-
required: ["text"],
|
|
11810
|
-
properties: {
|
|
11811
|
-
text: { type: "string", minLength: 1 },
|
|
11812
|
-
category: { enum: ["provider_quirk", "pattern_to_avoid", "recovery_lesson"] },
|
|
11813
|
-
createdAt: { type: "string" },
|
|
11814
|
-
sourceCoordinator: { type: "string" }
|
|
11815
|
-
}
|
|
11816
|
-
}
|
|
11817
|
-
},
|
|
11818
|
-
limits: {
|
|
11819
|
-
type: "object",
|
|
11820
|
-
additionalProperties: false,
|
|
11821
|
-
properties: {
|
|
11822
|
-
maxNoteChars: { type: "number", minimum: 1 },
|
|
11823
|
-
maxNotes: { type: "number", minimum: 1 }
|
|
11824
|
-
}
|
|
11825
|
-
}
|
|
11826
|
-
}
|
|
11827
|
-
};
|
|
11828
|
-
cache = /* @__PURE__ */ new Map();
|
|
11829
|
-
}
|
|
11830
|
-
});
|
|
11831
|
-
|
|
11832
11797
|
// src/mesh/mesh-queue-assignment.ts
|
|
11798
|
+
function localCoordinatorDaemonId() {
|
|
11799
|
+
return canonicalDaemonId(readNonEmptyString2(loadConfig().machineId));
|
|
11800
|
+
}
|
|
11833
11801
|
function __resetIdleAutoFastForwardForTests() {
|
|
11834
11802
|
idleAutoFastForwardLastAttempt.clear();
|
|
11835
11803
|
}
|
|
@@ -11915,6 +11883,7 @@ function deliverTaskToSession(dispatchThunk, ctx, warmup) {
|
|
|
11915
11883
|
if (timer) clearTimeout(timer);
|
|
11916
11884
|
LOG.error("MeshQueue", `Failed to dispatch task via ${ctx.transport} to node ${ctx.nodeId}: ${e?.message}`);
|
|
11917
11885
|
updateSessionDeliveryStatus(delivery.id, "failed", { lastError: e?.message, incrementAttempt: true });
|
|
11886
|
+
endTaskDispatchInFlight(ctx.meshId, ctx.task.id);
|
|
11918
11887
|
updateTaskStatus(ctx.meshId, ctx.task.id, "pending");
|
|
11919
11888
|
try {
|
|
11920
11889
|
appendLedgerEntry(ctx.meshId, {
|
|
@@ -11988,10 +11957,11 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
|
|
|
11988
11957
|
return false;
|
|
11989
11958
|
}
|
|
11990
11959
|
LOG.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
|
|
11960
|
+
beginTaskDispatchInFlight(meshId, task.id);
|
|
11991
11961
|
if (node?.daemonId && components.dispatchMeshCommand) {
|
|
11992
11962
|
const isLocalNode = components.cliManager.adapters.has(sessionId);
|
|
11993
11963
|
if (!isLocalNode) {
|
|
11994
|
-
const localDaemonIdForDispatch =
|
|
11964
|
+
const localDaemonIdForDispatch = localCoordinatorDaemonId();
|
|
11995
11965
|
const sourceCoordinatorSessionId = readNonEmptyString2(task.sourceCoordinatorSessionId) || void 0;
|
|
11996
11966
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
11997
11967
|
const remoteDaemonId = node.daemonId;
|
|
@@ -12030,7 +12000,7 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
|
|
|
12030
12000
|
try {
|
|
12031
12001
|
const inst = components.instanceManager.getInstance(sessionId);
|
|
12032
12002
|
if (inst && typeof inst.updateSettings === "function") {
|
|
12033
|
-
const localDaemonId =
|
|
12003
|
+
const localDaemonId = localCoordinatorDaemonId();
|
|
12034
12004
|
const localSourceCoordinatorSessionId = readNonEmptyString2(task.sourceCoordinatorSessionId);
|
|
12035
12005
|
inst.updateSettings({
|
|
12036
12006
|
meshNodeFor: meshId,
|
|
@@ -12055,7 +12025,7 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
|
|
|
12055
12025
|
meshId,
|
|
12056
12026
|
nodeId,
|
|
12057
12027
|
taskId: task.id,
|
|
12058
|
-
...
|
|
12028
|
+
...localCoordinatorDaemonId() ? { coordinatorDaemonId: localCoordinatorDaemonId() } : {},
|
|
12059
12029
|
...readNonEmptyString2(task.sourceCoordinatorSessionId) ? { coordinatorSessionId: readNonEmptyString2(task.sourceCoordinatorSessionId) } : {}
|
|
12060
12030
|
}
|
|
12061
12031
|
}),
|
|
@@ -12067,7 +12037,7 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
|
|
|
12067
12037
|
task,
|
|
12068
12038
|
transport: "local",
|
|
12069
12039
|
...readNonEmptyString2(task.sourceCoordinatorSessionId) ? { sourceCoordinatorSessionId: readNonEmptyString2(task.sourceCoordinatorSessionId) } : {},
|
|
12070
|
-
...
|
|
12040
|
+
...localCoordinatorDaemonId() ? { sourceCoordinatorDaemonId: localCoordinatorDaemonId() } : {}
|
|
12071
12041
|
}
|
|
12072
12042
|
);
|
|
12073
12043
|
return true;
|
|
@@ -12149,8 +12119,8 @@ function notifyCoordinatorOfActionableSkip(meshId, taskId, reason, nodeId) {
|
|
|
12149
12119
|
}
|
|
12150
12120
|
function sweepExpiredCooldowns() {
|
|
12151
12121
|
const now = Date.now();
|
|
12152
|
-
for (const [
|
|
12153
|
-
if (now >= until) autoLaunchCooldownUntil.delete(
|
|
12122
|
+
for (const [key2, until] of autoLaunchCooldownUntil) {
|
|
12123
|
+
if (now >= until) autoLaunchCooldownUntil.delete(key2);
|
|
12154
12124
|
}
|
|
12155
12125
|
}
|
|
12156
12126
|
function normalizeProviderPriority(policy) {
|
|
@@ -12196,7 +12166,7 @@ function nodeHasActiveMeshWork(components, meshId, nodeId, currentSessionId) {
|
|
|
12196
12166
|
const settings = state.settings || {};
|
|
12197
12167
|
if (readNonEmptyString2(settings.meshNodeFor) !== meshId) return false;
|
|
12198
12168
|
const instNodeId = readNonEmptyString2(settings.meshNodeId) || readNonEmptyString2(settings.nodeId);
|
|
12199
|
-
if (instNodeId
|
|
12169
|
+
if (!daemonIdsEquivalent(instNodeId, nodeId)) return false;
|
|
12200
12170
|
const sessionId = readNonEmptyString2(state.instanceId);
|
|
12201
12171
|
if (currentSessionId && sessionId === currentSessionId && isIdleSessionState(state)) return false;
|
|
12202
12172
|
return sessionStateLooksActive(state);
|
|
@@ -12228,7 +12198,7 @@ function resolveAutoLaunchTarget(components, node) {
|
|
|
12228
12198
|
const daemonId = readNonEmptyString2(node?.daemonId);
|
|
12229
12199
|
if (!daemonId) return { mode: "skip", reason: "remote_auto_launch_unsupported" };
|
|
12230
12200
|
if (!components.dispatchMeshCommand) return { mode: "skip", reason: "remote_auto_launch_unsupported" };
|
|
12231
|
-
const coordinatorDaemonId =
|
|
12201
|
+
const coordinatorDaemonId = localCoordinatorDaemonId();
|
|
12232
12202
|
if (!coordinatorDaemonId) return { mode: "skip", reason: "remote_auto_launch_no_coordinator_daemon_id" };
|
|
12233
12203
|
return { mode: "remote", daemonId, coordinatorDaemonId };
|
|
12234
12204
|
}
|
|
@@ -12239,31 +12209,12 @@ function activeReadonlyAssignedCount(meshId) {
|
|
|
12239
12209
|
return getQueue(meshId, { status: ["assigned"] }).filter(isTaskReadonly).length;
|
|
12240
12210
|
}
|
|
12241
12211
|
function nodeHasActiveAssignment(meshId, nodeId) {
|
|
12242
|
-
return getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedNodeId
|
|
12212
|
+
return getQueue(meshId, { status: ["assigned"] }).some((task) => daemonIdsEquivalent(task.assignedNodeId, nodeId));
|
|
12243
12213
|
}
|
|
12244
12214
|
function nodeActiveLoad(meshId, nodeId) {
|
|
12245
12215
|
return MeshRuntimeStore.getInstance().nodeActiveAssignmentCount(meshId, nodeId);
|
|
12246
12216
|
}
|
|
12247
|
-
function resolveMeshRepoRootForScheduling(mesh) {
|
|
12248
|
-
const nodes = Array.isArray(mesh?.nodes) ? mesh.nodes : [];
|
|
12249
|
-
const pickRoot = (n) => readNonEmptyString2(n?.repoRoot) || readNonEmptyString2(n?.workspace);
|
|
12250
|
-
const base = nodes.find((n) => n?.isLocalWorktree !== true && pickRoot(n));
|
|
12251
|
-
if (base) return pickRoot(base);
|
|
12252
|
-
const anyNode = nodes.find((n) => pickRoot(n));
|
|
12253
|
-
return anyNode ? pickRoot(anyNode) : "";
|
|
12254
|
-
}
|
|
12255
|
-
function resolveMeshSchedulingOverride(mesh) {
|
|
12256
|
-
const repoRoot = resolveMeshRepoRootForScheduling(mesh);
|
|
12257
|
-
if (!repoRoot) return void 0;
|
|
12258
|
-
try {
|
|
12259
|
-
return loadMeshJsonConfig(repoRoot).config?.scheduling;
|
|
12260
|
-
} catch {
|
|
12261
|
-
return void 0;
|
|
12262
|
-
}
|
|
12263
|
-
}
|
|
12264
12217
|
function resolveSchedulingStrategy(mesh) {
|
|
12265
|
-
const override = resolveMeshSchedulingOverride(mesh);
|
|
12266
|
-
if (override?.distribution) return distributionToStrategy(override.distribution);
|
|
12267
12218
|
return normalizeMeshSchedulingStrategy(mesh?.policy?.schedulingStrategy);
|
|
12268
12219
|
}
|
|
12269
12220
|
function orderEligibleNodes(meshId, strategy, nodes, opts) {
|
|
@@ -12288,7 +12239,7 @@ function orderEligibleNodes(meshId, strategy, nodes, opts) {
|
|
|
12288
12239
|
});
|
|
12289
12240
|
}
|
|
12290
12241
|
function activeProviderAssignedCount(meshId, nodeId, providerType) {
|
|
12291
|
-
return getQueue(meshId, { status: ["assigned"] }).filter((task) => task.assignedNodeId
|
|
12242
|
+
return getQueue(meshId, { status: ["assigned"] }).filter((task) => daemonIdsEquivalent(task.assignedNodeId, nodeId) && task.assignedProviderType === providerType).length;
|
|
12292
12243
|
}
|
|
12293
12244
|
function sessionHasActiveAssignment(meshId, sessionId) {
|
|
12294
12245
|
if (getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedSessionId === sessionId)) {
|
|
@@ -12307,7 +12258,7 @@ function liveSessionCountForNode(components, meshId, nodeId) {
|
|
|
12307
12258
|
const settings = state.settings || {};
|
|
12308
12259
|
if (readNonEmptyString2(settings.meshNodeFor) !== meshId) return false;
|
|
12309
12260
|
const instNodeId = readNonEmptyString2(settings.meshNodeId) || readNonEmptyString2(settings.nodeId);
|
|
12310
|
-
if (instNodeId
|
|
12261
|
+
if (!daemonIdsEquivalent(instNodeId, nodeId)) return false;
|
|
12311
12262
|
const status = readNonEmptyString2(state.status).toLowerCase();
|
|
12312
12263
|
return !isTerminalSessionStatus(status);
|
|
12313
12264
|
}).length;
|
|
@@ -12406,11 +12357,8 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
12406
12357
|
const queue = getQueue(meshId);
|
|
12407
12358
|
const pending = queue.filter((task) => task.status === "pending");
|
|
12408
12359
|
if (!pending.length) return false;
|
|
12409
|
-
const
|
|
12410
|
-
const
|
|
12411
|
-
schedulingOverride?.maxParallel ?? mesh?.policy?.maxParallelTasks
|
|
12412
|
-
);
|
|
12413
|
-
const maxReadonlyParallelTasks = resolveMaxReadonlyParallelTasks(maxParallelTasks, schedulingOverride?.readonlyMultiplier);
|
|
12360
|
+
const maxParallelTasks = resolveMaxParallelTasks(mesh?.policy?.maxParallelTasks);
|
|
12361
|
+
const maxReadonlyParallelTasks = resolveMaxReadonlyParallelTasks(maxParallelTasks);
|
|
12414
12362
|
for (const task of pending) {
|
|
12415
12363
|
const isReadonly = isTaskReadonly(task);
|
|
12416
12364
|
if (isReadonly) {
|
|
@@ -12824,12 +12772,12 @@ var init_mesh_queue_assignment = __esm({
|
|
|
12824
12772
|
init_mesh_event_trace();
|
|
12825
12773
|
init_mesh_warmup_deadline();
|
|
12826
12774
|
init_repo_mesh_types();
|
|
12827
|
-
init_mesh_json_config();
|
|
12828
12775
|
init_dist();
|
|
12829
12776
|
init_mesh_events_stale();
|
|
12830
12777
|
init_mesh_events_utils();
|
|
12831
12778
|
init_mesh_events_pending();
|
|
12832
12779
|
init_worktree_bootstrap_config();
|
|
12780
|
+
init_mesh_task_inflight();
|
|
12833
12781
|
IDLE_AUTO_FAST_FORWARD_THROTTLE_MS = 30 * 60 * 1e3;
|
|
12834
12782
|
idleAutoFastForwardLastAttempt = /* @__PURE__ */ new Map();
|
|
12835
12783
|
DISPATCH_CONFIRM_TIMEOUT_MS = 12e4;
|
|
@@ -12930,8 +12878,8 @@ function recordUnroutableDelegateEvent(routing, eventName) {
|
|
|
12930
12878
|
if (last !== void 0 && now - last < UNROUTABLE_DIAGNOSTIC_DEDUP_MS) return false;
|
|
12931
12879
|
recentUnroutableDiagnostics.set(dedupKey, now);
|
|
12932
12880
|
if (recentUnroutableDiagnostics.size > 256) {
|
|
12933
|
-
for (const [
|
|
12934
|
-
if (now - ts2 >= UNROUTABLE_DIAGNOSTIC_DEDUP_MS) recentUnroutableDiagnostics.delete(
|
|
12881
|
+
for (const [key2, ts2] of recentUnroutableDiagnostics) {
|
|
12882
|
+
if (now - ts2 >= UNROUTABLE_DIAGNOSTIC_DEDUP_MS) recentUnroutableDiagnostics.delete(key2);
|
|
12935
12883
|
}
|
|
12936
12884
|
}
|
|
12937
12885
|
try {
|
|
@@ -13193,9 +13141,9 @@ async function updateDarwinMemoryCache() {
|
|
|
13193
13141
|
for (const line of stdout.split("\n")) {
|
|
13194
13142
|
const m = line.match(/^\s*Pages\s+([^:]+):\s+([\d,]+)\s*\.?/);
|
|
13195
13143
|
if (!m) continue;
|
|
13196
|
-
const
|
|
13144
|
+
const key2 = m[1].trim().toLowerCase().replace(/\s+/g, "_");
|
|
13197
13145
|
const n = parseInt(m[2].replace(/,/g, ""), 10);
|
|
13198
|
-
if (!Number.isNaN(n)) counts[
|
|
13146
|
+
if (!Number.isNaN(n)) counts[key2] = n;
|
|
13199
13147
|
}
|
|
13200
13148
|
const free = counts["free"] ?? 0;
|
|
13201
13149
|
const inactive = counts["inactive"] ?? 0;
|
|
@@ -13422,7 +13370,7 @@ function trimStructuredStrings(value, maxChars) {
|
|
|
13422
13370
|
if (Array.isArray(value)) return value.map((item) => trimStructuredStrings(item, maxChars));
|
|
13423
13371
|
if (!value || typeof value !== "object") return value;
|
|
13424
13372
|
return Object.fromEntries(
|
|
13425
|
-
Object.entries(value).map(([
|
|
13373
|
+
Object.entries(value).map(([key2, nested]) => [key2, trimStructuredStrings(nested, maxChars)])
|
|
13426
13374
|
);
|
|
13427
13375
|
}
|
|
13428
13376
|
function estimateBytes(value) {
|
|
@@ -14013,9 +13961,9 @@ function readMessageMeta(message) {
|
|
|
14013
13961
|
function readStringField(value) {
|
|
14014
13962
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
14015
13963
|
}
|
|
14016
|
-
function readRecordField(message, meta,
|
|
13964
|
+
function readRecordField(message, meta, key2) {
|
|
14017
13965
|
const record = message;
|
|
14018
|
-
return record[
|
|
13966
|
+
return record[key2] ?? meta?.[key2];
|
|
14019
13967
|
}
|
|
14020
13968
|
function readVisibilityField(message, meta) {
|
|
14021
13969
|
return readStringField(readRecordField(message, meta, "visibility"));
|
|
@@ -14026,7 +13974,7 @@ function readTranscriptVisibilityField(message, meta) {
|
|
|
14026
13974
|
}
|
|
14027
13975
|
function hasBooleanMarker(message, meta, keys) {
|
|
14028
13976
|
const record = message;
|
|
14029
|
-
return keys.some((
|
|
13977
|
+
return keys.some((key2) => record[key2] === true || meta?.[key2] === true);
|
|
14030
13978
|
}
|
|
14031
13979
|
function isActivityKind(kind) {
|
|
14032
13980
|
return kind === "thought" || kind === "tool" || kind === "terminal";
|
|
@@ -14218,9 +14166,9 @@ function extractProviderControlValues(controls, data) {
|
|
|
14218
14166
|
const values = {};
|
|
14219
14167
|
const explicit = data.controlValues;
|
|
14220
14168
|
if (explicit && typeof explicit === "object") {
|
|
14221
|
-
for (const [
|
|
14169
|
+
for (const [key2, value] of Object.entries(explicit)) {
|
|
14222
14170
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
14223
|
-
values[
|
|
14171
|
+
values[key2] = value;
|
|
14224
14172
|
}
|
|
14225
14173
|
}
|
|
14226
14174
|
}
|
|
@@ -14684,26 +14632,26 @@ function getGitSummaryForWorkspace(workspace, options) {
|
|
|
14684
14632
|
if (!workspace) return void 0;
|
|
14685
14633
|
return options.getGitSummaryForWorkspace?.(workspace) || void 0;
|
|
14686
14634
|
}
|
|
14687
|
-
function findCdpManager(cdpManagers,
|
|
14688
|
-
const exact = cdpManagers.get(
|
|
14635
|
+
function findCdpManager(cdpManagers, key2) {
|
|
14636
|
+
const exact = cdpManagers.get(key2);
|
|
14689
14637
|
if (exact) return exact.isConnected ? exact : null;
|
|
14690
|
-
const prefix =
|
|
14638
|
+
const prefix = key2 + "_";
|
|
14691
14639
|
const matches = [...cdpManagers.entries()].filter(([k, m]) => m.isConnected && k.startsWith(prefix));
|
|
14692
14640
|
if (matches.length === 1) return matches[0][1];
|
|
14693
14641
|
return null;
|
|
14694
14642
|
}
|
|
14695
|
-
function hasCdpManager(cdpManagers,
|
|
14696
|
-
if (cdpManagers.has(
|
|
14697
|
-
const prefix =
|
|
14643
|
+
function hasCdpManager(cdpManagers, key2) {
|
|
14644
|
+
if (cdpManagers.has(key2)) return true;
|
|
14645
|
+
const prefix = key2 + "_";
|
|
14698
14646
|
for (const k of cdpManagers.keys()) {
|
|
14699
14647
|
if (k.startsWith(prefix)) return true;
|
|
14700
14648
|
}
|
|
14701
14649
|
return false;
|
|
14702
14650
|
}
|
|
14703
|
-
function isCdpConnected(cdpManagers,
|
|
14704
|
-
const exact = cdpManagers.get(
|
|
14651
|
+
function isCdpConnected(cdpManagers, key2) {
|
|
14652
|
+
const exact = cdpManagers.get(key2);
|
|
14705
14653
|
if (exact?.isConnected) return true;
|
|
14706
|
-
const prefix =
|
|
14654
|
+
const prefix = key2 + "_";
|
|
14707
14655
|
for (const [k, m] of cdpManagers.entries()) {
|
|
14708
14656
|
if (m.isConnected && k.startsWith(prefix)) return true;
|
|
14709
14657
|
}
|
|
@@ -15039,11 +14987,11 @@ function buildRecentReadDebugSignature(snapshot) {
|
|
|
15039
14987
|
String(snapshot.messageUpdatedAt)
|
|
15040
14988
|
].join("|");
|
|
15041
14989
|
}
|
|
15042
|
-
function shouldEmitRecentReadDebugLog(
|
|
14990
|
+
function shouldEmitRecentReadDebugLog(cache, snapshot) {
|
|
15043
14991
|
const nextSignature = buildRecentReadDebugSignature(snapshot);
|
|
15044
|
-
const previousSignature =
|
|
14992
|
+
const previousSignature = cache.get(snapshot.sessionId);
|
|
15045
14993
|
if (previousSignature === nextSignature) return false;
|
|
15046
|
-
|
|
14994
|
+
cache.set(snapshot.sessionId, nextSignature);
|
|
15047
14995
|
return true;
|
|
15048
14996
|
}
|
|
15049
14997
|
function buildDetectedIdeInfos(detectedIdes, cdpManagers) {
|
|
@@ -16599,9 +16547,9 @@ function recordHeldTerminalEventsToLedger(meshId, drainDaemonIds, reason, heldFo
|
|
|
16599
16547
|
for (const event of pending) {
|
|
16600
16548
|
if (!shouldForceInjectMeshEvent(event.event)) continue;
|
|
16601
16549
|
const fingerprint = buildPendingEventFingerprint(event);
|
|
16602
|
-
const
|
|
16603
|
-
if (heldEventLedgerRecorded.has(
|
|
16604
|
-
heldEventLedgerRecorded.add(
|
|
16550
|
+
const key2 = `${meshId}::${fingerprint || `${event.event}::${event.nodeId || ""}::${event.queuedAt}`}`;
|
|
16551
|
+
if (heldEventLedgerRecorded.has(key2)) continue;
|
|
16552
|
+
heldEventLedgerRecorded.add(key2);
|
|
16605
16553
|
const finalSummary = readMeshCompletionSummary(event.metadataEvent);
|
|
16606
16554
|
try {
|
|
16607
16555
|
appendLedgerEntry(meshId, {
|
|
@@ -16622,7 +16570,7 @@ function recordHeldTerminalEventsToLedger(meshId, drainDaemonIds, reason, heldFo
|
|
|
16622
16570
|
});
|
|
16623
16571
|
LOG.info("MeshReconcile", `Ledger-recorded held ${event.event} for mesh ${meshId} (reason ${reason}) \u2014 recoverable from ledger`);
|
|
16624
16572
|
} catch (e) {
|
|
16625
|
-
heldEventLedgerRecorded.delete(
|
|
16573
|
+
heldEventLedgerRecorded.delete(key2);
|
|
16626
16574
|
LOG.warn("MeshReconcile", `Failed to ledger-record held ${event.event} for mesh ${meshId}: ${e?.message || e}`);
|
|
16627
16575
|
}
|
|
16628
16576
|
}
|
|
@@ -17087,9 +17035,9 @@ async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds,
|
|
|
17087
17035
|
const activeTaskKeys = new Set(
|
|
17088
17036
|
dispatches.map((d) => readNonEmptyString2(d.taskId)).filter(Boolean).map((taskId) => inFlightSynthKey(mesh.id, taskId))
|
|
17089
17037
|
);
|
|
17090
|
-
for (const
|
|
17091
|
-
if (
|
|
17092
|
-
inFlightAckedHoldState.delete(
|
|
17038
|
+
for (const key2 of inFlightAckedHoldState.keys()) {
|
|
17039
|
+
if (key2.startsWith(`${mesh.id}::`) && !activeTaskKeys.has(key2)) {
|
|
17040
|
+
inFlightAckedHoldState.delete(key2);
|
|
17093
17041
|
}
|
|
17094
17042
|
}
|
|
17095
17043
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
@@ -18676,8 +18624,8 @@ function extractButtonsFromRule(rule, hay) {
|
|
|
18676
18624
|
label += " " + next.trim();
|
|
18677
18625
|
j += 1;
|
|
18678
18626
|
}
|
|
18679
|
-
const
|
|
18680
|
-
buttons.push({ index: idx, label, key, current });
|
|
18627
|
+
const key2 = keyTemplate.replace(/\{index\}/g, String(idx));
|
|
18628
|
+
buttons.push({ index: idx, label, key: key2, current });
|
|
18681
18629
|
i = j - 1;
|
|
18682
18630
|
}
|
|
18683
18631
|
} else {
|
|
@@ -18687,8 +18635,8 @@ function extractButtonsFromRule(rule, hay) {
|
|
|
18687
18635
|
const idx = Number(m[1]);
|
|
18688
18636
|
const label = String(m[2] ?? "").trim();
|
|
18689
18637
|
if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
|
|
18690
|
-
const
|
|
18691
|
-
buttons.push({ index: idx, label, key, current: hasCursorMarker(m[0]) });
|
|
18638
|
+
const key2 = keyTemplate.replace(/\{index\}/g, String(idx));
|
|
18639
|
+
buttons.push({ index: idx, label, key: key2, current: hasCursorMarker(m[0]) });
|
|
18692
18640
|
}
|
|
18693
18641
|
}
|
|
18694
18642
|
const block2 = lastContiguousNumberedBlock(buttons);
|
|
@@ -18768,12 +18716,12 @@ function evalCond(cond, sections, fullScreen, cursor, prevLines, clock, legacyTr
|
|
|
18768
18716
|
return { kind: "elapsed", result, detail: `elapsed ${age}ms / ${cond.elapsed_ms}ms`, remainingMs };
|
|
18769
18717
|
}
|
|
18770
18718
|
if (isStable(cond)) {
|
|
18771
|
-
const
|
|
18772
|
-
const lastChanged = clock.regionLastChangedAt.get(
|
|
18719
|
+
const key2 = regionKey(cond.cursor_above);
|
|
18720
|
+
const lastChanged = clock.regionLastChangedAt.get(key2) ?? clock.stateEnteredAt;
|
|
18773
18721
|
const stableFor = clock.now - lastChanged;
|
|
18774
18722
|
const result = stableFor >= cond.stable_ms;
|
|
18775
18723
|
const remainingMs = result ? 0 : cond.stable_ms - stableFor;
|
|
18776
|
-
const where =
|
|
18724
|
+
const where = key2 === WHOLE_SCREEN ? "screen" : `cursor_above=${cond.cursor_above}`;
|
|
18777
18725
|
return { kind: "stable", result, detail: `stable ${where} ${stableFor}ms / ${cond.stable_ms}ms`, remainingMs };
|
|
18778
18726
|
}
|
|
18779
18727
|
if (isRegex(cond) || isChanged(cond)) {
|
|
@@ -22714,16 +22662,16 @@ function normalizeModuleName(request) {
|
|
|
22714
22662
|
}
|
|
22715
22663
|
function buildFsShim() {
|
|
22716
22664
|
const shim = {};
|
|
22717
|
-
for (const
|
|
22718
|
-
if (
|
|
22719
|
-
const real = nodeFs[
|
|
22720
|
-
if (real !== void 0) shim[
|
|
22665
|
+
for (const key2 of FS_READ_ONLY_MEMBERS) {
|
|
22666
|
+
if (key2 === "promises") continue;
|
|
22667
|
+
const real = nodeFs[key2];
|
|
22668
|
+
if (real !== void 0) shim[key2] = real;
|
|
22721
22669
|
}
|
|
22722
22670
|
const realPromises = nodeFs.promises || {};
|
|
22723
22671
|
const promisesShim = {};
|
|
22724
|
-
for (const
|
|
22725
|
-
const real = realPromises[
|
|
22726
|
-
if (real !== void 0) promisesShim[
|
|
22672
|
+
for (const key2 of FS_PROMISES_READ_ONLY_MEMBERS) {
|
|
22673
|
+
const real = realPromises[key2];
|
|
22674
|
+
if (real !== void 0) promisesShim[key2] = real;
|
|
22727
22675
|
}
|
|
22728
22676
|
shim.promises = promisesShim;
|
|
22729
22677
|
return shim;
|
|
@@ -22806,10 +22754,10 @@ function _uninstallProviderProcessShimForTest() {
|
|
|
22806
22754
|
function buildProcessShim() {
|
|
22807
22755
|
const real = globalThis.process;
|
|
22808
22756
|
const shim = /* @__PURE__ */ Object.create(null);
|
|
22809
|
-
for (const
|
|
22810
|
-
if (DANGEROUS_PROCESS_METHODS.has(String(
|
|
22757
|
+
for (const key2 of Object.keys(real)) {
|
|
22758
|
+
if (DANGEROUS_PROCESS_METHODS.has(String(key2))) continue;
|
|
22811
22759
|
try {
|
|
22812
|
-
shim[
|
|
22760
|
+
shim[key2] = real[key2];
|
|
22813
22761
|
} catch {
|
|
22814
22762
|
}
|
|
22815
22763
|
}
|
|
@@ -23130,6 +23078,7 @@ __export(index_exports, {
|
|
|
23130
23078
|
buildToolChatMessage: () => buildToolChatMessage,
|
|
23131
23079
|
buildUserChatMessage: () => buildUserChatMessage,
|
|
23132
23080
|
cancelTask: () => cancelTask,
|
|
23081
|
+
canonicalDaemonId: () => canonicalDaemonId,
|
|
23133
23082
|
claimNextTask: () => claimNextTask,
|
|
23134
23083
|
classifyChatMessageVisibility: () => classifyChatMessageVisibility,
|
|
23135
23084
|
classifyHotChatSessionsForSubscriptionFlush: () => classifyHotChatSessionsForSubscriptionFlush,
|
|
@@ -23258,6 +23207,7 @@ __export(index_exports, {
|
|
|
23258
23207
|
loadMeshCoordinatorRegistry: () => loadMeshCoordinatorRegistry,
|
|
23259
23208
|
loadMeshRefineConfig: () => loadMeshRefineConfig,
|
|
23260
23209
|
loadMeshWorktreeBootstrapConfig: () => loadMeshWorktreeBootstrapConfig,
|
|
23210
|
+
loadRepoSettings: () => loadRepoSettings,
|
|
23261
23211
|
loadState: () => loadState,
|
|
23262
23212
|
logCommand: () => logCommand,
|
|
23263
23213
|
machineCoreFromDaemonId: () => machineCoreFromDaemonId,
|
|
@@ -23993,10 +23943,10 @@ var GitWorkspaceMonitor = class {
|
|
|
23993
23943
|
const compactSummary = createGitCompactSummary(status, diffSummary);
|
|
23994
23944
|
const timestamp = this.now();
|
|
23995
23945
|
const seq = ++this.seq;
|
|
23996
|
-
const
|
|
23946
|
+
const key2 = this.keyForWorkspace(normalized.workspace);
|
|
23997
23947
|
const update = {
|
|
23998
23948
|
topic: "workspace.git",
|
|
23999
|
-
key,
|
|
23949
|
+
key: key2,
|
|
24000
23950
|
workspace: normalized.workspace,
|
|
24001
23951
|
status,
|
|
24002
23952
|
diffSummary,
|
|
@@ -24004,7 +23954,7 @@ var GitWorkspaceMonitor = class {
|
|
|
24004
23954
|
timestamp
|
|
24005
23955
|
};
|
|
24006
23956
|
const cacheEntry = {
|
|
24007
|
-
key,
|
|
23957
|
+
key: key2,
|
|
24008
23958
|
workspace: normalized.workspace,
|
|
24009
23959
|
status,
|
|
24010
23960
|
diffSummary,
|
|
@@ -24148,11 +24098,11 @@ function validateRepoPath(args) {
|
|
|
24148
24098
|
}
|
|
24149
24099
|
return { path: args.path.trim() };
|
|
24150
24100
|
}
|
|
24151
|
-
function validateSnapshotId(args,
|
|
24152
|
-
if (typeof args?.[
|
|
24153
|
-
return failure("invalid_args", `${
|
|
24101
|
+
function validateSnapshotId(args, key2) {
|
|
24102
|
+
if (typeof args?.[key2] !== "string" || !args[key2].trim()) {
|
|
24103
|
+
return failure("invalid_args", `${key2} must be a non-empty string`);
|
|
24154
24104
|
}
|
|
24155
|
-
return args[
|
|
24105
|
+
return args[key2].trim();
|
|
24156
24106
|
}
|
|
24157
24107
|
function parseSnapshotReason(args) {
|
|
24158
24108
|
if (args?.reason === void 0 || args?.reason === null || args?.reason === "") {
|
|
@@ -24634,6 +24584,29 @@ init_mesh_review_inbox();
|
|
|
24634
24584
|
init_coordinator_registry();
|
|
24635
24585
|
init_refine_config();
|
|
24636
24586
|
init_worktree_bootstrap_config();
|
|
24587
|
+
|
|
24588
|
+
// src/config/repo-settings.ts
|
|
24589
|
+
init_mesh_json_config();
|
|
24590
|
+
init_refine_config();
|
|
24591
|
+
init_worktree_bootstrap_config();
|
|
24592
|
+
init_change_impact_config();
|
|
24593
|
+
function loadRepoSettings(opts) {
|
|
24594
|
+
const workspace = typeof opts.workspace === "string" ? opts.workspace : "";
|
|
24595
|
+
const mesh = opts.mesh;
|
|
24596
|
+
const repoRoot = typeof opts.repoRoot === "string" && opts.repoRoot ? opts.repoRoot : workspace;
|
|
24597
|
+
const meshJson = loadRepoMeshJsonConfig(workspace);
|
|
24598
|
+
return {
|
|
24599
|
+
coordinator: meshJson.config?.coordinator,
|
|
24600
|
+
operatingNotes: meshJson.config?.operatingNotes,
|
|
24601
|
+
limits: meshJson.config?.limits,
|
|
24602
|
+
meshJson,
|
|
24603
|
+
refine: loadMeshRefineConfig(mesh, workspace),
|
|
24604
|
+
worktreeBootstrap: loadMeshWorktreeBootstrapConfig(mesh, workspace),
|
|
24605
|
+
changeImpact: loadChangeImpactConfig(repoRoot)
|
|
24606
|
+
};
|
|
24607
|
+
}
|
|
24608
|
+
|
|
24609
|
+
// src/index.ts
|
|
24637
24610
|
init_mesh_ledger();
|
|
24638
24611
|
init_mesh_fast_forward();
|
|
24639
24612
|
|
|
@@ -26541,10 +26514,10 @@ var StatusMonitor = class {
|
|
|
26541
26514
|
return events;
|
|
26542
26515
|
}
|
|
26543
26516
|
/** Cooldown check — prevent sending the same notification too frequently */
|
|
26544
|
-
shouldAlert(
|
|
26545
|
-
const last = this.lastAlertTime.get(
|
|
26517
|
+
shouldAlert(key2, now) {
|
|
26518
|
+
const last = this.lastAlertTime.get(key2) || 0;
|
|
26546
26519
|
if (now - last > this.config.alertCooldownSec * 1e3) {
|
|
26547
|
-
this.lastAlertTime.set(
|
|
26520
|
+
this.lastAlertTime.set(key2, now);
|
|
26548
26521
|
return true;
|
|
26549
26522
|
}
|
|
26550
26523
|
return false;
|
|
@@ -26592,16 +26565,16 @@ var savedHistoryBackgroundRefresh = /* @__PURE__ */ new Set();
|
|
|
26592
26565
|
var savedHistoryRollupInFlight = /* @__PURE__ */ new Set();
|
|
26593
26566
|
var BOUNDED_TAIL_CACHE_MAX_ENTRIES = 64;
|
|
26594
26567
|
var boundedTailReadCache = /* @__PURE__ */ new Map();
|
|
26595
|
-
function readBoundedTailCache(
|
|
26596
|
-
const cached3 = boundedTailReadCache.get(
|
|
26568
|
+
function readBoundedTailCache(key2, signature) {
|
|
26569
|
+
const cached3 = boundedTailReadCache.get(key2);
|
|
26597
26570
|
if (!cached3 || cached3.signature !== signature) return null;
|
|
26598
|
-
boundedTailReadCache.delete(
|
|
26599
|
-
boundedTailReadCache.set(
|
|
26571
|
+
boundedTailReadCache.delete(key2);
|
|
26572
|
+
boundedTailReadCache.set(key2, cached3);
|
|
26600
26573
|
return cached3.result;
|
|
26601
26574
|
}
|
|
26602
|
-
function writeBoundedTailCache(
|
|
26603
|
-
boundedTailReadCache.delete(
|
|
26604
|
-
boundedTailReadCache.set(
|
|
26575
|
+
function writeBoundedTailCache(key2, signature, result) {
|
|
26576
|
+
boundedTailReadCache.delete(key2);
|
|
26577
|
+
boundedTailReadCache.set(key2, { signature, result });
|
|
26605
26578
|
while (boundedTailReadCache.size > BOUNDED_TAIL_CACHE_MAX_ENTRIES) {
|
|
26606
26579
|
const oldest = boundedTailReadCache.keys().next().value;
|
|
26607
26580
|
if (oldest === void 0) break;
|
|
@@ -27037,21 +27010,21 @@ function shouldScheduleSavedHistoryRollupForSignature(signature) {
|
|
|
27037
27010
|
return shouldScheduleSavedHistoryRollup(size);
|
|
27038
27011
|
}
|
|
27039
27012
|
function scheduleSavedHistoryRollup(agentType, historySessionId) {
|
|
27040
|
-
const
|
|
27041
|
-
if (!historySessionId || savedHistoryRollupInFlight.has(
|
|
27042
|
-
savedHistoryRollupInFlight.add(
|
|
27013
|
+
const key2 = `${agentType}:${historySessionId}`;
|
|
27014
|
+
if (!historySessionId || savedHistoryRollupInFlight.has(key2)) return;
|
|
27015
|
+
savedHistoryRollupInFlight.add(key2);
|
|
27043
27016
|
setTimeout(() => {
|
|
27044
27017
|
try {
|
|
27045
27018
|
new ChatHistoryWriter().compactHistorySession(agentType, historySessionId);
|
|
27046
27019
|
} finally {
|
|
27047
|
-
savedHistoryRollupInFlight.delete(
|
|
27020
|
+
savedHistoryRollupInFlight.delete(key2);
|
|
27048
27021
|
}
|
|
27049
27022
|
}, 0);
|
|
27050
27023
|
}
|
|
27051
27024
|
function scheduleSavedHistoryBackgroundRefresh(agentType, dir) {
|
|
27052
|
-
const
|
|
27053
|
-
if (savedHistoryBackgroundRefresh.has(
|
|
27054
|
-
savedHistoryBackgroundRefresh.add(
|
|
27025
|
+
const key2 = `${agentType}:${dir}`;
|
|
27026
|
+
if (savedHistoryBackgroundRefresh.has(key2)) return;
|
|
27027
|
+
savedHistoryBackgroundRefresh.add(key2);
|
|
27055
27028
|
setTimeout(() => {
|
|
27056
27029
|
try {
|
|
27057
27030
|
if (!fs6.existsSync(dir)) return;
|
|
@@ -27071,7 +27044,7 @@ function scheduleSavedHistoryBackgroundRefresh(agentType, dir) {
|
|
|
27071
27044
|
}
|
|
27072
27045
|
} catch {
|
|
27073
27046
|
} finally {
|
|
27074
|
-
savedHistoryBackgroundRefresh.delete(
|
|
27047
|
+
savedHistoryBackgroundRefresh.delete(key2);
|
|
27075
27048
|
}
|
|
27076
27049
|
}, 0);
|
|
27077
27050
|
}
|
|
@@ -27837,14 +27810,14 @@ function rewriteCanonicalSavedHistory(agentType, historySessionId, records) {
|
|
|
27837
27810
|
return false;
|
|
27838
27811
|
}
|
|
27839
27812
|
}
|
|
27840
|
-
function getNativeHistoryScriptName(canonicalHistory,
|
|
27841
|
-
const configured = canonicalHistory?.scripts?.[
|
|
27813
|
+
function getNativeHistoryScriptName(canonicalHistory, key2) {
|
|
27814
|
+
const configured = canonicalHistory?.scripts?.[key2];
|
|
27842
27815
|
if (typeof configured === "string" && configured.trim()) return configured.trim();
|
|
27843
|
-
return
|
|
27816
|
+
return key2 === "readSession" ? "readNativeHistory" : "listNativeHistory";
|
|
27844
27817
|
}
|
|
27845
|
-
function getProviderNativeHistoryScript(scripts, canonicalHistory,
|
|
27818
|
+
function getProviderNativeHistoryScript(scripts, canonicalHistory, key2) {
|
|
27846
27819
|
if (!canonicalHistory?.scripts) return null;
|
|
27847
|
-
const fn = scripts?.[getNativeHistoryScriptName(canonicalHistory,
|
|
27820
|
+
const fn = scripts?.[getNativeHistoryScriptName(canonicalHistory, key2)];
|
|
27848
27821
|
return typeof fn === "function" ? fn : null;
|
|
27849
27822
|
}
|
|
27850
27823
|
function normalizeProviderNativeHistoryRecords(agentType, historySessionId, records) {
|
|
@@ -28578,11 +28551,11 @@ function validateControlValues(controlValues, source) {
|
|
|
28578
28551
|
throw new Error(`${source}: controlValues must be an object when provided`);
|
|
28579
28552
|
}
|
|
28580
28553
|
const normalized = {};
|
|
28581
|
-
for (const [
|
|
28554
|
+
for (const [key2, value] of Object.entries(controlValues)) {
|
|
28582
28555
|
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
28583
|
-
throw new Error(`${source}: controlValues.${
|
|
28556
|
+
throw new Error(`${source}: controlValues.${key2} must be string, number, or boolean`);
|
|
28584
28557
|
}
|
|
28585
|
-
normalized[
|
|
28558
|
+
normalized[key2] = value;
|
|
28586
28559
|
}
|
|
28587
28560
|
return normalized;
|
|
28588
28561
|
}
|
|
@@ -29335,7 +29308,7 @@ var DaemonCdpScanner = class {
|
|
|
29335
29308
|
for (const [ide, ports] of Object.entries(portMap)) {
|
|
29336
29309
|
const primaryPort = ports[0];
|
|
29337
29310
|
const alreadyConnected = [...this.ctx.cdpManagers.entries()].some(
|
|
29338
|
-
([
|
|
29311
|
+
([key2, m]) => m.isConnected && (key2 === ide || key2.startsWith(ide + "_"))
|
|
29339
29312
|
);
|
|
29340
29313
|
if (alreadyConnected) continue;
|
|
29341
29314
|
if (this.opts.multiWindow) {
|
|
@@ -29509,8 +29482,8 @@ var DaemonCdpInitializer = class {
|
|
|
29509
29482
|
for (let i = 0; i < targets.length; i++) {
|
|
29510
29483
|
const target = targets[i];
|
|
29511
29484
|
let alreadyTracked = false;
|
|
29512
|
-
for (const [
|
|
29513
|
-
if ((
|
|
29485
|
+
for (const [key2, m] of cdpManagers.entries()) {
|
|
29486
|
+
if ((key2 === ide || key2.startsWith(`${ide}_`)) && m.targetId === target.id) {
|
|
29514
29487
|
alreadyTracked = true;
|
|
29515
29488
|
break;
|
|
29516
29489
|
}
|
|
@@ -29542,29 +29515,29 @@ var DaemonCdpInitializer = class {
|
|
|
29542
29515
|
async pruneStaleManagers(port, ide, targets) {
|
|
29543
29516
|
const trackedTargetIds = new Set(targets.map((target) => target.id));
|
|
29544
29517
|
const removals = [];
|
|
29545
|
-
for (const [
|
|
29546
|
-
if (!(
|
|
29518
|
+
for (const [key2, manager] of this.config.cdpManagers.entries()) {
|
|
29519
|
+
if (!(key2 === ide || key2.startsWith(`${ide}_`))) continue;
|
|
29547
29520
|
if (manager.getPort() !== port) continue;
|
|
29548
29521
|
if (targets.length === 0) {
|
|
29549
|
-
removals.push({ key, manager, reason: "ide_closed" });
|
|
29522
|
+
removals.push({ key: key2, manager, reason: "ide_closed" });
|
|
29550
29523
|
continue;
|
|
29551
29524
|
}
|
|
29552
29525
|
if (manager.targetId && !trackedTargetIds.has(manager.targetId)) {
|
|
29553
|
-
removals.push({ key, manager, reason: "target_closed" });
|
|
29526
|
+
removals.push({ key: key2, manager, reason: "target_closed" });
|
|
29554
29527
|
continue;
|
|
29555
29528
|
}
|
|
29556
|
-
if (
|
|
29557
|
-
removals.push({ key, manager, reason: "target_rekeyed" });
|
|
29529
|
+
if (key2 === ide && !manager.targetId && targets.length > 1) {
|
|
29530
|
+
removals.push({ key: key2, manager, reason: "target_rekeyed" });
|
|
29558
29531
|
}
|
|
29559
29532
|
}
|
|
29560
|
-
for (const { key, manager, reason } of removals) {
|
|
29533
|
+
for (const { key: key2, manager, reason } of removals) {
|
|
29561
29534
|
try {
|
|
29562
29535
|
manager.disconnect();
|
|
29563
29536
|
} catch {
|
|
29564
29537
|
}
|
|
29565
|
-
this.config.cdpManagers.delete(
|
|
29566
|
-
LOG.info("IDE", `Detached window: ${
|
|
29567
|
-
await this.config.onDisconnected?.(ide, manager,
|
|
29538
|
+
this.config.cdpManagers.delete(key2);
|
|
29539
|
+
LOG.info("IDE", `Detached window: ${key2} (${reason})`);
|
|
29540
|
+
await this.config.onDisconnected?.(ide, manager, key2, reason);
|
|
29568
29541
|
}
|
|
29569
29542
|
}
|
|
29570
29543
|
// ─── Periodic scanning ───
|
|
@@ -29890,7 +29863,7 @@ function sanitizeTraceValue(value, traceContent) {
|
|
|
29890
29863
|
if (Array.isArray(value)) return value.map((entry) => sanitizeTraceValue(entry, traceContent));
|
|
29891
29864
|
if (value && typeof value === "object") {
|
|
29892
29865
|
return Object.fromEntries(
|
|
29893
|
-
Object.entries(value).map(([
|
|
29866
|
+
Object.entries(value).map(([key2, nested]) => [key2, sanitizeTraceValue(nested, traceContent)])
|
|
29894
29867
|
);
|
|
29895
29868
|
}
|
|
29896
29869
|
return value;
|
|
@@ -29899,7 +29872,7 @@ function sanitizeTraceValue(value, traceContent) {
|
|
|
29899
29872
|
if (Array.isArray(value)) return value.map((entry) => sanitizeTraceValue(entry, traceContent));
|
|
29900
29873
|
if (value && typeof value === "object") {
|
|
29901
29874
|
return Object.fromEntries(
|
|
29902
|
-
Object.entries(value).map(([
|
|
29875
|
+
Object.entries(value).map(([key2, nested]) => [key2, sanitizeTraceValue(nested, traceContent)])
|
|
29903
29876
|
);
|
|
29904
29877
|
}
|
|
29905
29878
|
return value;
|
|
@@ -30207,8 +30180,8 @@ function maxSequence(messages) {
|
|
|
30207
30180
|
}
|
|
30208
30181
|
function isSupersetOf(candidate, required) {
|
|
30209
30182
|
if (required.size === 0) return true;
|
|
30210
|
-
for (const
|
|
30211
|
-
if (!candidate.has(
|
|
30183
|
+
for (const key2 of required) {
|
|
30184
|
+
if (!candidate.has(key2)) return false;
|
|
30212
30185
|
}
|
|
30213
30186
|
return true;
|
|
30214
30187
|
}
|
|
@@ -30221,17 +30194,17 @@ function chatSourceSessionKey(providerType, sessionId) {
|
|
|
30221
30194
|
var ChatSourceRegistry = class {
|
|
30222
30195
|
records = /* @__PURE__ */ new Map();
|
|
30223
30196
|
/** Snapshot of current state for diagnostics. Does not mutate. */
|
|
30224
|
-
getState(
|
|
30225
|
-
return this.records.get(
|
|
30197
|
+
getState(key2) {
|
|
30198
|
+
return this.records.get(key2)?.state ?? INITIAL_CHAT_SOURCE_STATE;
|
|
30226
30199
|
}
|
|
30227
30200
|
/** Recent transitions, newest last. Empty array when nothing has happened. */
|
|
30228
|
-
getTransitions(
|
|
30229
|
-
return this.records.get(
|
|
30201
|
+
getTransitions(key2) {
|
|
30202
|
+
return this.records.get(key2)?.transitions ?? [];
|
|
30230
30203
|
}
|
|
30231
30204
|
/** Drop a session. Caller should invoke this when the session is destroyed
|
|
30232
30205
|
* to avoid unbounded growth across long-lived daemons. */
|
|
30233
|
-
clear(
|
|
30234
|
-
this.records.delete(
|
|
30206
|
+
clear(key2) {
|
|
30207
|
+
this.records.delete(key2);
|
|
30235
30208
|
}
|
|
30236
30209
|
/** Drop all sessions. Test helper. */
|
|
30237
30210
|
clearAll() {
|
|
@@ -30243,15 +30216,15 @@ var ChatSourceRegistry = class {
|
|
|
30243
30216
|
* under `key`; callers may treat the decision as authoritative without
|
|
30244
30217
|
* re-reading.
|
|
30245
30218
|
*/
|
|
30246
|
-
observe(
|
|
30247
|
-
const prev = this.records.get(
|
|
30219
|
+
observe(key2, observation, at = Date.now()) {
|
|
30220
|
+
const prev = this.records.get(key2);
|
|
30248
30221
|
const prevState = prev?.state ?? INITIAL_CHAT_SOURCE_STATE;
|
|
30249
30222
|
const prevLockedSince = prev?.lockedSince;
|
|
30250
30223
|
const result = transitionChatSourceState(prevState, observation, at, prevLockedSince);
|
|
30251
30224
|
const transitions = prev?.transitions ?? [];
|
|
30252
30225
|
const nextTransitions = appendTransition(transitions, result.transition);
|
|
30253
30226
|
const lockedSince = result.lockState.lockedSince;
|
|
30254
|
-
this.records.set(
|
|
30227
|
+
this.records.set(key2, {
|
|
30255
30228
|
state: result.next,
|
|
30256
30229
|
lockedSince,
|
|
30257
30230
|
transitions: nextTransitions
|
|
@@ -30934,8 +30907,8 @@ function readLiveCodexWorkspaceNativeHistory(agentStr, args) {
|
|
|
30934
30907
|
});
|
|
30935
30908
|
return { ...history, lookup: "workspace" };
|
|
30936
30909
|
}
|
|
30937
|
-
function shouldPreserveReadChatPayloadField(
|
|
30938
|
-
return
|
|
30910
|
+
function shouldPreserveReadChatPayloadField(key2) {
|
|
30911
|
+
return key2 === "messageSource" || key2 === "transcriptProvenance";
|
|
30939
30912
|
}
|
|
30940
30913
|
function updateMessageSourceReturnedCount(value, returnedMessageCount) {
|
|
30941
30914
|
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
@@ -31105,7 +31078,7 @@ function buildReadChatCommandResult(payload, args, h) {
|
|
|
31105
31078
|
const visibleMessages = includeActivity ? filteredMessages.filter((m) => isUserFacingChatMessage(m) || isActivityChatMessage(m)) : filterUserFacingChatMessages(filteredMessages);
|
|
31106
31079
|
const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
|
|
31107
31080
|
const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
|
|
31108
|
-
const preservedPayloadFields = Object.fromEntries(Object.entries(payload).filter(([
|
|
31081
|
+
const preservedPayloadFields = Object.fromEntries(Object.entries(payload).filter(([key2]) => shouldPreserveReadChatPayloadField(key2)));
|
|
31109
31082
|
if (preservedPayloadFields.messageSource) {
|
|
31110
31083
|
preservedPayloadFields.messageSource = updateMessageSourceReturnedCount(preservedPayloadFields.messageSource, sync.messages.length);
|
|
31111
31084
|
}
|
|
@@ -31857,8 +31830,8 @@ function sanitizeDebugBundleValue(value, options = {}, depth = 0, keyHint = "")
|
|
|
31857
31830
|
const record = value;
|
|
31858
31831
|
const result = {};
|
|
31859
31832
|
const entries = Object.entries(record).slice(0, normalizedOptions.maxObjectKeys);
|
|
31860
|
-
for (const [
|
|
31861
|
-
result[
|
|
31833
|
+
for (const [key2, item] of entries) {
|
|
31834
|
+
result[key2] = sanitizeDebugBundleValue(item, normalizedOptions, depth + 1, key2);
|
|
31862
31835
|
}
|
|
31863
31836
|
const remaining = Object.keys(record).length - entries.length;
|
|
31864
31837
|
if (remaining > 0) result.__truncatedKeys = remaining;
|
|
@@ -32184,14 +32157,14 @@ function callLegacyTextScript(script, text) {
|
|
|
32184
32157
|
if (typeof script !== "function") return null;
|
|
32185
32158
|
return script(text);
|
|
32186
32159
|
}
|
|
32187
|
-
function isRecentDuplicateSend(
|
|
32160
|
+
function isRecentDuplicateSend(key2) {
|
|
32188
32161
|
const now = Date.now();
|
|
32189
32162
|
for (const [candidate, ts2] of recentSendByTarget.entries()) {
|
|
32190
32163
|
if (now - ts2 > RECENT_SEND_WINDOW_MS) recentSendByTarget.delete(candidate);
|
|
32191
32164
|
}
|
|
32192
|
-
const previous = recentSendByTarget.get(
|
|
32165
|
+
const previous = recentSendByTarget.get(key2);
|
|
32193
32166
|
if (previous && now - previous <= RECENT_SEND_WINDOW_MS) return true;
|
|
32194
|
-
recentSendByTarget.set(
|
|
32167
|
+
recentSendByTarget.set(key2, now);
|
|
32195
32168
|
return false;
|
|
32196
32169
|
}
|
|
32197
32170
|
function didProviderConfirmSend(result) {
|
|
@@ -33054,23 +33027,23 @@ async function handleCdpRemoteAction(h, args) {
|
|
|
33054
33027
|
try {
|
|
33055
33028
|
switch (action) {
|
|
33056
33029
|
case "input_key": {
|
|
33057
|
-
const { type: evType, key, code, text, unmodifiedText, modifiers } = params;
|
|
33030
|
+
const { type: evType, key: key2, code, text, unmodifiedText, modifiers } = params;
|
|
33058
33031
|
const mod = typeof modifiers === "number" ? modifiers : 0;
|
|
33059
|
-
const vk = KEY_TO_VK[
|
|
33032
|
+
const vk = KEY_TO_VK[key2] || (key2.length === 1 ? key2.charCodeAt(0) : 0);
|
|
33060
33033
|
if (evType === "char") {
|
|
33061
33034
|
await h.getCdp().send("Input.dispatchKeyEvent", {
|
|
33062
33035
|
type: "char",
|
|
33063
|
-
key,
|
|
33036
|
+
key: key2,
|
|
33064
33037
|
code,
|
|
33065
|
-
text: text ||
|
|
33066
|
-
unmodifiedText: unmodifiedText || text ||
|
|
33038
|
+
text: text || key2,
|
|
33039
|
+
unmodifiedText: unmodifiedText || text || key2,
|
|
33067
33040
|
...vk ? { windowsVirtualKeyCode: vk, nativeVirtualKeyCode: vk } : {},
|
|
33068
33041
|
...mod ? { modifiers: mod } : {}
|
|
33069
33042
|
});
|
|
33070
33043
|
} else {
|
|
33071
33044
|
await h.getCdp().send("Input.dispatchKeyEvent", {
|
|
33072
33045
|
type: "rawKeyDown",
|
|
33073
|
-
key,
|
|
33046
|
+
key: key2,
|
|
33074
33047
|
code,
|
|
33075
33048
|
...text ? { text } : {},
|
|
33076
33049
|
...vk ? { windowsVirtualKeyCode: vk, nativeVirtualKeyCode: vk } : {},
|
|
@@ -33078,7 +33051,7 @@ async function handleCdpRemoteAction(h, args) {
|
|
|
33078
33051
|
});
|
|
33079
33052
|
await h.getCdp().send("Input.dispatchKeyEvent", {
|
|
33080
33053
|
type: "keyUp",
|
|
33081
|
-
key,
|
|
33054
|
+
key: key2,
|
|
33082
33055
|
code,
|
|
33083
33056
|
...vk ? { windowsVirtualKeyCode: vk, nativeVirtualKeyCode: vk } : {},
|
|
33084
33057
|
...mod ? { modifiers: mod } : {}
|
|
@@ -33477,21 +33450,21 @@ function handleGetProviderSettings(h, args) {
|
|
|
33477
33450
|
}
|
|
33478
33451
|
async function handleSetProviderSetting(h, args) {
|
|
33479
33452
|
const loader = h.ctx.providerLoader;
|
|
33480
|
-
const { providerType, key, value } = args || {};
|
|
33481
|
-
if (!providerType || !
|
|
33453
|
+
const { providerType, key: key2, value } = args || {};
|
|
33454
|
+
if (!providerType || !key2 || value === void 0) {
|
|
33482
33455
|
return { success: false, error: "providerType, key, and value are required" };
|
|
33483
33456
|
}
|
|
33484
|
-
const result = loader?.setSetting(providerType,
|
|
33457
|
+
const result = loader?.setSetting(providerType, key2, value);
|
|
33485
33458
|
if (result) {
|
|
33486
33459
|
if (h.ctx.instanceManager) {
|
|
33487
33460
|
const allSettings = loader?.getSettings(providerType) || {};
|
|
33488
33461
|
const updated = h.ctx.instanceManager.updateInstanceSettings(providerType, allSettings);
|
|
33489
|
-
LOG.info("Command", `[set_provider_setting] ${providerType}.${
|
|
33462
|
+
LOG.info("Command", `[set_provider_setting] ${providerType}.${key2}=${JSON.stringify(value)} \u2192 ${updated} instance(s) updated`);
|
|
33490
33463
|
}
|
|
33491
|
-
await h.ctx.onProviderSettingChanged?.(providerType,
|
|
33492
|
-
return { success: true, providerType, key, value };
|
|
33464
|
+
await h.ctx.onProviderSettingChanged?.(providerType, key2, value);
|
|
33465
|
+
return { success: true, providerType, key: key2, value };
|
|
33493
33466
|
}
|
|
33494
|
-
return { success: false, error: `Failed to set ${providerType}.${
|
|
33467
|
+
return { success: false, error: `Failed to set ${providerType}.${key2} \u2014 invalid key, value, or not a public setting` };
|
|
33495
33468
|
}
|
|
33496
33469
|
function handleGetProviderSourceConfig(h, _args) {
|
|
33497
33470
|
const loader = h.ctx.providerLoader;
|
|
@@ -33537,9 +33510,9 @@ function normalizeProviderScriptArgs(args, scriptName) {
|
|
|
33537
33510
|
normalizedArgs.mode = normalizedArgs.value;
|
|
33538
33511
|
}
|
|
33539
33512
|
}
|
|
33540
|
-
for (const
|
|
33541
|
-
if (
|
|
33542
|
-
normalizedArgs[
|
|
33513
|
+
for (const key2 of ["mode", "model", "message", "action", "button", "text", "sessionId", "value"]) {
|
|
33514
|
+
if (key2 in normalizedArgs && !(key2.toUpperCase() in normalizedArgs)) {
|
|
33515
|
+
normalizedArgs[key2.toUpperCase()] = normalizedArgs[key2];
|
|
33543
33516
|
}
|
|
33544
33517
|
}
|
|
33545
33518
|
return normalizedArgs;
|
|
@@ -33939,10 +33912,10 @@ function summarizeCommandArgs(args) {
|
|
|
33939
33912
|
"value"
|
|
33940
33913
|
];
|
|
33941
33914
|
const entries = [];
|
|
33942
|
-
for (const
|
|
33943
|
-
if (!(
|
|
33944
|
-
const value =
|
|
33945
|
-
entries.push(`${
|
|
33915
|
+
for (const key2 of preferredKeys) {
|
|
33916
|
+
if (!(key2 in args) || args[key2] === void 0) continue;
|
|
33917
|
+
const value = key2 === "text" || key2 === "message" ? `${String(args[key2] || "").length} chars` : key2 === "data" ? `${String(args[key2] || "").length} chars` : summarizeLogValue(args[key2]);
|
|
33918
|
+
entries.push(`${key2}=${value}`);
|
|
33946
33919
|
}
|
|
33947
33920
|
return entries.length ? entries.join(" ") : "{...}";
|
|
33948
33921
|
}
|
|
@@ -33994,12 +33967,12 @@ var DaemonCommandHandler = class {
|
|
|
33994
33967
|
* Get provider module — _currentProviderType (agentType priority) use.
|
|
33995
33968
|
*/
|
|
33996
33969
|
getProvider(overrideType) {
|
|
33997
|
-
const
|
|
33998
|
-
if (!
|
|
33999
|
-
const result = this._ctx.providerLoader.resolve(
|
|
33970
|
+
const key2 = overrideType || this._currentRoute.providerType || this._currentRoute.session?.providerType || this._currentRoute.managerKey;
|
|
33971
|
+
if (!key2 || !this._ctx.providerLoader) return void 0;
|
|
33972
|
+
const result = this._ctx.providerLoader.resolve(key2);
|
|
34000
33973
|
if (result) return result;
|
|
34001
|
-
const baseType =
|
|
34002
|
-
if (baseType !==
|
|
33974
|
+
const baseType = key2.split("_")[0];
|
|
33975
|
+
if (baseType !== key2) return this._ctx.providerLoader.resolve(baseType);
|
|
34003
33976
|
return void 0;
|
|
34004
33977
|
}
|
|
34005
33978
|
/** Get a provider script by name from ProviderLoader. */
|
|
@@ -34057,11 +34030,11 @@ var DaemonCommandHandler = class {
|
|
|
34057
34030
|
return this._ctx.adapters.get(target) || null;
|
|
34058
34031
|
}
|
|
34059
34032
|
// ─── Private helpers ──────────────────────────────
|
|
34060
|
-
inferProviderType(
|
|
34061
|
-
if (!
|
|
34062
|
-
const session = this._ctx.sessionRegistry?.get(
|
|
34033
|
+
inferProviderType(key2) {
|
|
34034
|
+
if (!key2) return void 0;
|
|
34035
|
+
const session = this._ctx.sessionRegistry?.get(key2);
|
|
34063
34036
|
if (session?.providerType) return session.providerType;
|
|
34064
|
-
return
|
|
34037
|
+
return key2.split("_")[0];
|
|
34065
34038
|
}
|
|
34066
34039
|
resolveRoute(args) {
|
|
34067
34040
|
const targetSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
@@ -35759,16 +35732,16 @@ var coordinatorPromptHandlers = {
|
|
|
35759
35732
|
const m = matchAppend || matchOverride;
|
|
35760
35733
|
if (!m) continue;
|
|
35761
35734
|
const isAppend = !!matchAppend;
|
|
35762
|
-
const
|
|
35735
|
+
const key2 = m[1];
|
|
35763
35736
|
const full = path43.join(dir, name);
|
|
35764
35737
|
let content = "";
|
|
35765
35738
|
try {
|
|
35766
35739
|
content = fs38.readFileSync(full, "utf8");
|
|
35767
35740
|
} catch {
|
|
35768
35741
|
}
|
|
35769
|
-
if (!entries[
|
|
35770
|
-
if (isAppend) entries[
|
|
35771
|
-
else entries[
|
|
35742
|
+
if (!entries[key2]) entries[key2] = { override: "", append: "" };
|
|
35743
|
+
if (isAppend) entries[key2].append = content;
|
|
35744
|
+
else entries[key2].override = content;
|
|
35772
35745
|
}
|
|
35773
35746
|
}
|
|
35774
35747
|
} catch (error) {
|
|
@@ -35780,14 +35753,14 @@ var coordinatorPromptHandlers = {
|
|
|
35780
35753
|
const fs38 = await import("fs");
|
|
35781
35754
|
const path43 = await import("path");
|
|
35782
35755
|
const os30 = await import("os");
|
|
35783
|
-
const
|
|
35756
|
+
const key2 = typeof args?.key === "string" ? args.key.trim() : "";
|
|
35784
35757
|
const kind = args?.kind === "append" ? "append" : "override";
|
|
35785
35758
|
const content = typeof args?.content === "string" ? args.content : "";
|
|
35786
|
-
if (!
|
|
35759
|
+
if (!key2 || !/^[a-zA-Z0-9_.-]+$/.test(key2)) {
|
|
35787
35760
|
return { success: false, error: "key must match [a-zA-Z0-9_.-]+" };
|
|
35788
35761
|
}
|
|
35789
35762
|
const dir = path43.join(os30.homedir(), ".adhdev", "coordinator-prompts");
|
|
35790
|
-
const filename = kind === "append" ? `${
|
|
35763
|
+
const filename = kind === "append" ? `${key2}.append.md` : `${key2}.md`;
|
|
35791
35764
|
const full = path43.join(dir, filename);
|
|
35792
35765
|
try {
|
|
35793
35766
|
fs38.mkdirSync(dir, { recursive: true });
|
|
@@ -35796,7 +35769,7 @@ var coordinatorPromptHandlers = {
|
|
|
35796
35769
|
} else if (fs38.existsSync(full)) {
|
|
35797
35770
|
fs38.unlinkSync(full);
|
|
35798
35771
|
}
|
|
35799
|
-
return { success: true, path: full, kind, key };
|
|
35772
|
+
return { success: true, path: full, kind, key: key2 };
|
|
35800
35773
|
} catch (error) {
|
|
35801
35774
|
return { success: false, error: error?.message || String(error) };
|
|
35802
35775
|
}
|
|
@@ -36741,7 +36714,7 @@ var RULES = [
|
|
|
36741
36714
|
{
|
|
36742
36715
|
name: "key_value_secret",
|
|
36743
36716
|
pattern: /\b([A-Z0-9_]*(?:SECRET|TOKEN|API[_-]?KEY|PASSWORD|PASSWD|PRIVATE[_-]?KEY|CREDENTIAL|CLIENT[_-]?SECRET)[A-Z0-9_]*)(\s*[:=]\s*)(["']?)([^\s"',;]+)\3/gi,
|
|
36744
|
-
replace: (_m,
|
|
36717
|
+
replace: (_m, key2, delim, quote) => `${key2}${delim}${quote}${MASK}${quote}`
|
|
36745
36718
|
},
|
|
36746
36719
|
// Authorization: Bearer <token>
|
|
36747
36720
|
{
|
|
@@ -37091,7 +37064,7 @@ function realWorkspacePath(workingDir) {
|
|
|
37091
37064
|
}
|
|
37092
37065
|
function applyPreLaunchTrust(trust, workingDir) {
|
|
37093
37066
|
const settingsPath = expandHome2(trust.settings_path);
|
|
37094
|
-
const
|
|
37067
|
+
const key2 = trust.key;
|
|
37095
37068
|
const real = realWorkspacePath(workingDir);
|
|
37096
37069
|
try {
|
|
37097
37070
|
let parsed = {};
|
|
@@ -37104,18 +37077,18 @@ function applyPreLaunchTrust(trust, workingDir) {
|
|
|
37104
37077
|
}
|
|
37105
37078
|
}
|
|
37106
37079
|
}
|
|
37107
|
-
const existing = parsed[
|
|
37080
|
+
const existing = parsed[key2];
|
|
37108
37081
|
const list = Array.isArray(existing) ? existing.filter((v) => typeof v === "string") : [];
|
|
37109
37082
|
if (list.includes(real)) {
|
|
37110
37083
|
LOG.debug("pre-launch-trust", `[${trust.settings_path}] ${real} already trusted \u2014 no change`);
|
|
37111
37084
|
return null;
|
|
37112
37085
|
}
|
|
37113
37086
|
list.push(real);
|
|
37114
|
-
parsed[
|
|
37087
|
+
parsed[key2] = list;
|
|
37115
37088
|
fs14.mkdirSync(path22.dirname(settingsPath), { recursive: true });
|
|
37116
37089
|
fs14.writeFileSync(settingsPath, `${JSON.stringify(parsed, null, 2)}
|
|
37117
37090
|
`, "utf8");
|
|
37118
|
-
LOG.info("pre-launch-trust", `pre-trusted workspace in ${trust.settings_path} (key="${
|
|
37091
|
+
LOG.info("pre-launch-trust", `pre-trusted workspace in ${trust.settings_path} (key="${key2}")`);
|
|
37119
37092
|
return real;
|
|
37120
37093
|
} catch (err) {
|
|
37121
37094
|
LOG.warn("pre-launch-trust", `failed to pre-trust workspace in ${trust.settings_path}: ${err.message}`);
|
|
@@ -38726,8 +38699,8 @@ function jsonPathGet(record, expr) {
|
|
|
38726
38699
|
}
|
|
38727
38700
|
let end = i;
|
|
38728
38701
|
while (end < expr.length && expr[end] !== "." && expr[end] !== "[") end += 1;
|
|
38729
|
-
const
|
|
38730
|
-
cur = cur[
|
|
38702
|
+
const key2 = expr.slice(i, end);
|
|
38703
|
+
cur = cur[key2];
|
|
38731
38704
|
i = end;
|
|
38732
38705
|
}
|
|
38733
38706
|
return cur;
|
|
@@ -40702,8 +40675,8 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
40702
40675
|
/** Drop user-input ack entries older than the dedup window so the map can't grow unbounded. */
|
|
40703
40676
|
pruneRecentUserInputAcks(now) {
|
|
40704
40677
|
if (this.recentUserInputAcks.size <= 1) return;
|
|
40705
|
-
for (const [
|
|
40706
|
-
if (now - at > USER_INPUT_ACK_DEDUP_WINDOW_MS) this.recentUserInputAcks.delete(
|
|
40678
|
+
for (const [key2, at] of this.recentUserInputAcks) {
|
|
40679
|
+
if (now - at > USER_INPUT_ACK_DEDUP_WINDOW_MS) this.recentUserInputAcks.delete(key2);
|
|
40707
40680
|
}
|
|
40708
40681
|
}
|
|
40709
40682
|
dispose() {
|
|
@@ -41907,8 +41880,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
41907
41880
|
};
|
|
41908
41881
|
const isRuntimeOverlay = (entry) => {
|
|
41909
41882
|
if (entry.source !== "runtime") return false;
|
|
41910
|
-
const
|
|
41911
|
-
if (
|
|
41883
|
+
const key2 = typeof entry.runtimeKey === "string" ? entry.runtimeKey.trim().toLowerCase() : "";
|
|
41884
|
+
if (key2.startsWith("auto_approval:")) return true;
|
|
41912
41885
|
return !isUserFacingChatMessage(entry.message);
|
|
41913
41886
|
};
|
|
41914
41887
|
const shouldKeepParsedBeforeUntimedRuntime = (message) => {
|
|
@@ -43513,16 +43486,16 @@ var DEFAULT_COORDINATOR_DELEGATED_ENV_UNSETS = [
|
|
|
43513
43486
|
function hasCliArg(args, flag) {
|
|
43514
43487
|
return args.some((arg) => arg === flag || arg.startsWith(`${flag}=`));
|
|
43515
43488
|
}
|
|
43516
|
-
function hasConfigOverride(args,
|
|
43489
|
+
function hasConfigOverride(args, key2) {
|
|
43517
43490
|
for (let index = 0; index < args.length; index += 1) {
|
|
43518
43491
|
const arg = args[index];
|
|
43519
43492
|
const next = args[index + 1];
|
|
43520
43493
|
if ((arg === "-c" || arg === "--config") && typeof next === "string") {
|
|
43521
|
-
if (next ===
|
|
43494
|
+
if (next === key2 || next.startsWith(`${key2}=`) || next.startsWith(`${key2}.`)) return true;
|
|
43522
43495
|
}
|
|
43523
43496
|
if (arg.startsWith("--config=")) {
|
|
43524
43497
|
const value = arg.slice("--config=".length);
|
|
43525
|
-
if (value ===
|
|
43498
|
+
if (value === key2 || value.startsWith(`${key2}=`) || value.startsWith(`${key2}.`)) return true;
|
|
43526
43499
|
}
|
|
43527
43500
|
}
|
|
43528
43501
|
return false;
|
|
@@ -43539,10 +43512,10 @@ function buildCoordinatorDelegatedCliLaunchOptions(input) {
|
|
|
43539
43512
|
const cliArgs = Array.isArray(input.cliArgs) ? [...input.cliArgs] : [];
|
|
43540
43513
|
const env = { ...input.env || {} };
|
|
43541
43514
|
const envUnsets = new Set(DEFAULT_COORDINATOR_DELEGATED_ENV_UNSETS);
|
|
43542
|
-
for (const
|
|
43543
|
-
if (typeof
|
|
43515
|
+
for (const key2 of input.isolation?.env?.unset || []) {
|
|
43516
|
+
if (typeof key2 === "string" && key2.trim()) envUnsets.add(key2.trim());
|
|
43544
43517
|
}
|
|
43545
|
-
for (const
|
|
43518
|
+
for (const key2 of envUnsets) env[key2] = "";
|
|
43546
43519
|
for (const rule of input.isolation?.args || []) {
|
|
43547
43520
|
if (!rule || typeof rule !== "object") continue;
|
|
43548
43521
|
if (rule.mode === "empty_mcp_config") {
|
|
@@ -43555,9 +43528,9 @@ function buildCoordinatorDelegatedCliLaunchOptions(input) {
|
|
|
43555
43528
|
continue;
|
|
43556
43529
|
}
|
|
43557
43530
|
if (rule.mode === "config_override") {
|
|
43558
|
-
const
|
|
43531
|
+
const key2 = String(rule.dedupeKey || rule.key || "").trim();
|
|
43559
43532
|
const flag = String(rule.flag || "").trim();
|
|
43560
|
-
if (!
|
|
43533
|
+
if (!key2 || !flag || hasConfigOverride(cliArgs, key2)) continue;
|
|
43561
43534
|
cliArgs.unshift(flag, `${rule.key}=${rule.value}`);
|
|
43562
43535
|
}
|
|
43563
43536
|
}
|
|
@@ -43763,12 +43736,12 @@ var DaemonCliManager = class {
|
|
|
43763
43736
|
}
|
|
43764
43737
|
throw new Error(`No CLI provider found for '${cliType}'. Create a provider.js in providers/cli/${cliType}/`);
|
|
43765
43738
|
}
|
|
43766
|
-
startCliExitMonitor(
|
|
43739
|
+
startCliExitMonitor(key2, cliType) {
|
|
43767
43740
|
const sessionRegistry = this.deps.getSessionRegistry?.() || null;
|
|
43768
43741
|
const instanceManager = this.deps.getInstanceManager();
|
|
43769
43742
|
const checkStopped = setInterval(() => {
|
|
43770
43743
|
try {
|
|
43771
|
-
const adapter = this.adapters.get(
|
|
43744
|
+
const adapter = this.adapters.get(key2);
|
|
43772
43745
|
if (!adapter) {
|
|
43773
43746
|
clearInterval(checkStopped);
|
|
43774
43747
|
return;
|
|
@@ -43777,12 +43750,12 @@ var DaemonCliManager = class {
|
|
|
43777
43750
|
if (status?.status === "stopped" || status?.status === "error") {
|
|
43778
43751
|
clearInterval(checkStopped);
|
|
43779
43752
|
setTimeout(() => {
|
|
43780
|
-
if (this.adapters.has(
|
|
43781
|
-
this.adapters.delete(
|
|
43782
|
-
this.deps.removeAgentTracking(
|
|
43783
|
-
sessionRegistry?.unregisterByInstanceKey(
|
|
43784
|
-
instanceManager?.removeInstance(
|
|
43785
|
-
unregisterMeshCoordinator(
|
|
43753
|
+
if (this.adapters.has(key2)) {
|
|
43754
|
+
this.adapters.delete(key2);
|
|
43755
|
+
this.deps.removeAgentTracking(key2);
|
|
43756
|
+
sessionRegistry?.unregisterByInstanceKey(key2);
|
|
43757
|
+
instanceManager?.removeInstance(key2);
|
|
43758
|
+
unregisterMeshCoordinator(key2);
|
|
43786
43759
|
LOG.info("CLI", `\u{1F9F9} Auto-cleaned ${status.status} CLI: ${cliType}`);
|
|
43787
43760
|
this.deps.onStatusChange();
|
|
43788
43761
|
}
|
|
@@ -43792,21 +43765,21 @@ var DaemonCliManager = class {
|
|
|
43792
43765
|
}
|
|
43793
43766
|
}, 3e3);
|
|
43794
43767
|
}
|
|
43795
|
-
async registerCliInstance(
|
|
43768
|
+
async registerCliInstance(key2, normalizedType, cliType, resolvedDir, cliArgs, provider, settings, attachExisting = false, options) {
|
|
43796
43769
|
const instanceManager = this.deps.getInstanceManager();
|
|
43797
43770
|
const sessionRegistry = this.deps.getSessionRegistry?.() || null;
|
|
43798
43771
|
if (!instanceManager) throw new Error("InstanceManager not available");
|
|
43799
43772
|
const transportFactory = this.getTransportFactory(
|
|
43800
|
-
|
|
43773
|
+
key2,
|
|
43801
43774
|
normalizedType,
|
|
43802
43775
|
resolvedDir,
|
|
43803
43776
|
cliArgs,
|
|
43804
43777
|
options?.providerSessionId,
|
|
43805
43778
|
attachExisting
|
|
43806
43779
|
);
|
|
43807
|
-
const cliInstance = new CliProviderInstance(provider, resolvedDir, cliArgs,
|
|
43780
|
+
const cliInstance = new CliProviderInstance(provider, resolvedDir, cliArgs, key2, transportFactory, options);
|
|
43808
43781
|
try {
|
|
43809
|
-
await instanceManager.addInstance(
|
|
43782
|
+
await instanceManager.addInstance(key2, cliInstance, {
|
|
43810
43783
|
serverConn: this.deps.getServerConn(),
|
|
43811
43784
|
settings,
|
|
43812
43785
|
onPtyData: (data) => {
|
|
@@ -43818,8 +43791,8 @@ var DaemonCliManager = class {
|
|
|
43818
43791
|
parentSessionId: null,
|
|
43819
43792
|
providerType: normalizedType,
|
|
43820
43793
|
transport: "pty",
|
|
43821
|
-
adapterKey:
|
|
43822
|
-
instanceKey:
|
|
43794
|
+
adapterKey: key2,
|
|
43795
|
+
instanceKey: key2,
|
|
43823
43796
|
workspace: resolvedDir,
|
|
43824
43797
|
// attachExisting === true means we're restoring an already-spawned
|
|
43825
43798
|
// hosted runtime after a daemon restart, not starting a fresh PTY.
|
|
@@ -43835,10 +43808,10 @@ var DaemonCliManager = class {
|
|
|
43835
43808
|
});
|
|
43836
43809
|
} catch (spawnErr) {
|
|
43837
43810
|
LOG.error("CLI", `[${cliType}] Spawn failed: ${spawnErr?.message}`);
|
|
43838
|
-
instanceManager.removeInstance(
|
|
43811
|
+
instanceManager.removeInstance(key2);
|
|
43839
43812
|
throw new Error(`Failed to start ${provider.displayName || provider.name || cliType}: ${spawnErr?.message}`);
|
|
43840
43813
|
}
|
|
43841
|
-
this.adapters.set(
|
|
43814
|
+
this.adapters.set(key2, cliInstance.getAdapter());
|
|
43842
43815
|
const launchMeshNodeId = typeof settings?.meshNodeId === "string" ? settings.meshNodeId.trim() : "";
|
|
43843
43816
|
const launchMeshNodeFor = typeof settings?.meshNodeFor === "string" ? settings.meshNodeFor.trim() : "";
|
|
43844
43817
|
if (launchMeshNodeId || launchMeshNodeFor) {
|
|
@@ -43851,7 +43824,7 @@ var DaemonCliManager = class {
|
|
|
43851
43824
|
} catch {
|
|
43852
43825
|
}
|
|
43853
43826
|
}
|
|
43854
|
-
this.startCliExitMonitor(
|
|
43827
|
+
this.startCliExitMonitor(key2, cliType);
|
|
43855
43828
|
}
|
|
43856
43829
|
// ─── Session start/management ──────────────────────────────
|
|
43857
43830
|
async startSession(cliType, workingDir, cliArgs, initialModel, options) {
|
|
@@ -43868,11 +43841,11 @@ var DaemonCliManager = class {
|
|
|
43868
43841
|
Enable and detect this provider from the Machine Providers page before starting a runtime.`
|
|
43869
43842
|
);
|
|
43870
43843
|
}
|
|
43871
|
-
const
|
|
43844
|
+
const key2 = crypto5.randomUUID();
|
|
43872
43845
|
{
|
|
43873
43846
|
const coordinatorMeshId = options?.settingsOverride?.meshCoordinatorFor;
|
|
43874
43847
|
if (typeof coordinatorMeshId === "string" && coordinatorMeshId.trim()) {
|
|
43875
|
-
options = { ...options, extraEnv: { ...options?.extraEnv || {}, ADHDEV_COORDINATOR_SESSION_ID:
|
|
43848
|
+
options = { ...options, extraEnv: { ...options?.extraEnv || {}, ADHDEV_COORDINATOR_SESSION_ID: key2 } };
|
|
43876
43849
|
}
|
|
43877
43850
|
}
|
|
43878
43851
|
const sessionRegistry = this.deps.getSessionRegistry?.() || null;
|
|
@@ -43892,7 +43865,7 @@ ${installInfo}`
|
|
|
43892
43865
|
}
|
|
43893
43866
|
console.log(colorize("cyan", ` \u{1F50C} Starting ACP agent: ${provider.name} (${provider.type}) in ${resolvedDir}`));
|
|
43894
43867
|
const acpInstance = new AcpProviderInstance(resolvedProvider, resolvedDir, cliArgs);
|
|
43895
|
-
await instanceManager2.addInstance(
|
|
43868
|
+
await instanceManager2.addInstance(key2, acpInstance, {
|
|
43896
43869
|
settings: this.providerLoader.getSettings(normalizedType)
|
|
43897
43870
|
});
|
|
43898
43871
|
const sessionId = acpInstance.getInstanceId();
|
|
@@ -43901,11 +43874,11 @@ ${installInfo}`
|
|
|
43901
43874
|
parentSessionId: null,
|
|
43902
43875
|
providerType: normalizedType,
|
|
43903
43876
|
transport: "acp",
|
|
43904
|
-
adapterKey:
|
|
43905
|
-
instanceKey:
|
|
43877
|
+
adapterKey: key2,
|
|
43878
|
+
instanceKey: key2,
|
|
43906
43879
|
workspace: resolvedDir
|
|
43907
43880
|
});
|
|
43908
|
-
this.adapters.set(
|
|
43881
|
+
this.adapters.set(key2, {
|
|
43909
43882
|
cliType: normalizedType,
|
|
43910
43883
|
cliName: provider.name,
|
|
43911
43884
|
workingDir: resolvedDir,
|
|
@@ -43913,7 +43886,7 @@ ${installInfo}`
|
|
|
43913
43886
|
spawn: async () => {
|
|
43914
43887
|
},
|
|
43915
43888
|
shutdown: () => {
|
|
43916
|
-
instanceManager2.removeInstance(
|
|
43889
|
+
instanceManager2.removeInstance(key2);
|
|
43917
43890
|
},
|
|
43918
43891
|
sendMessage: async (text) => {
|
|
43919
43892
|
const input = normalizeInputEnvelope(text);
|
|
@@ -43929,7 +43902,7 @@ ${installInfo}`
|
|
|
43929
43902
|
},
|
|
43930
43903
|
getPartialResponse: () => "",
|
|
43931
43904
|
cancel: () => {
|
|
43932
|
-
instanceManager2.removeInstance(
|
|
43905
|
+
instanceManager2.removeInstance(key2);
|
|
43933
43906
|
},
|
|
43934
43907
|
isProcessing: () => false,
|
|
43935
43908
|
isReady: () => true,
|
|
@@ -43983,7 +43956,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
43983
43956
|
if (provider && instanceManager) {
|
|
43984
43957
|
const resolvedProvider = this.providerLoader.resolve(cliType, { version: cliInfo.version }) || provider;
|
|
43985
43958
|
await this.registerCliInstance(
|
|
43986
|
-
|
|
43959
|
+
key2,
|
|
43987
43960
|
normalizedType,
|
|
43988
43961
|
cliType,
|
|
43989
43962
|
resolvedDir,
|
|
@@ -44013,7 +43986,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44013
43986
|
cliType,
|
|
44014
43987
|
resolvedDir,
|
|
44015
43988
|
resolvedCliArgs,
|
|
44016
|
-
|
|
43989
|
+
key2,
|
|
44017
43990
|
sessionBinding.providerSessionId,
|
|
44018
43991
|
false,
|
|
44019
43992
|
options?.extraEnv
|
|
@@ -44033,9 +44006,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44033
44006
|
const status = adapter.getStatus?.();
|
|
44034
44007
|
if (status?.status === "stopped" || status?.status === "error") {
|
|
44035
44008
|
setTimeout(() => {
|
|
44036
|
-
if (this.adapters.get(
|
|
44037
|
-
this.adapters.delete(
|
|
44038
|
-
this.deps.removeAgentTracking(
|
|
44009
|
+
if (this.adapters.get(key2) === adapter) {
|
|
44010
|
+
this.adapters.delete(key2);
|
|
44011
|
+
this.deps.removeAgentTracking(key2);
|
|
44039
44012
|
LOG.info("CLI", `\u{1F9F9} Auto-cleaned ${status.status} CLI: ${adapter.cliType}`);
|
|
44040
44013
|
this.deps.onStatusChange();
|
|
44041
44014
|
}
|
|
@@ -44044,10 +44017,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44044
44017
|
});
|
|
44045
44018
|
if (typeof adapter.setOnPtyData === "function") {
|
|
44046
44019
|
adapter.setOnPtyData((data) => {
|
|
44047
|
-
this.deps.getP2p()?.broadcastSessionOutput(
|
|
44020
|
+
this.deps.getP2p()?.broadcastSessionOutput(key2, data);
|
|
44048
44021
|
});
|
|
44049
44022
|
}
|
|
44050
|
-
this.adapters.set(
|
|
44023
|
+
this.adapters.set(key2, adapter);
|
|
44051
44024
|
console.log(colorize("green", ` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
|
|
44052
44025
|
}
|
|
44053
44026
|
this.persistRecentActivity({
|
|
@@ -44057,20 +44030,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44057
44030
|
providerSessionId: sessionBinding.providerSessionId,
|
|
44058
44031
|
workspace: resolvedDir,
|
|
44059
44032
|
summaryMetadata: buildLegacyModelModeSummaryMetadata({ model: initialModel }),
|
|
44060
|
-
sessionId:
|
|
44033
|
+
sessionId: key2,
|
|
44061
44034
|
title: provider?.displayName || provider?.name || normalizedType
|
|
44062
44035
|
});
|
|
44063
44036
|
this.deps.onStatusChange();
|
|
44064
44037
|
return {
|
|
44065
|
-
runtimeSessionId:
|
|
44038
|
+
runtimeSessionId: key2,
|
|
44066
44039
|
providerSessionId: sessionBinding.providerSessionId
|
|
44067
44040
|
};
|
|
44068
44041
|
}
|
|
44069
|
-
async stopSession(
|
|
44070
|
-
return this.stopSessionWithMode(
|
|
44042
|
+
async stopSession(key2) {
|
|
44043
|
+
return this.stopSessionWithMode(key2, "hard");
|
|
44071
44044
|
}
|
|
44072
|
-
async stopSessionWithMode(
|
|
44073
|
-
const adapter = this.adapters.get(
|
|
44045
|
+
async stopSessionWithMode(key2, mode) {
|
|
44046
|
+
const adapter = this.adapters.get(key2);
|
|
44074
44047
|
if (adapter) {
|
|
44075
44048
|
try {
|
|
44076
44049
|
if (mode === "save" && typeof adapter.saveAndStop === "function") {
|
|
@@ -44081,21 +44054,21 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44081
44054
|
} catch (e) {
|
|
44082
44055
|
LOG.warn("CLI", `Shutdown error for ${adapter.cliType}: ${e?.message} (force-cleaning)`);
|
|
44083
44056
|
}
|
|
44084
|
-
this.adapters.delete(
|
|
44085
|
-
this.deps.removeAgentTracking(
|
|
44086
|
-
this.deps.getSessionRegistry?.()?.unregisterByInstanceKey(
|
|
44087
|
-
this.deps.getInstanceManager()?.removeInstance(
|
|
44088
|
-
unregisterMeshCoordinator(
|
|
44057
|
+
this.adapters.delete(key2);
|
|
44058
|
+
this.deps.removeAgentTracking(key2);
|
|
44059
|
+
this.deps.getSessionRegistry?.()?.unregisterByInstanceKey(key2);
|
|
44060
|
+
this.deps.getInstanceManager()?.removeInstance(key2);
|
|
44061
|
+
unregisterMeshCoordinator(key2);
|
|
44089
44062
|
LOG.info("CLI", `\u{1F6D1} Agent stopped: ${adapter.cliType} in ${adapter.workingDir}`);
|
|
44090
44063
|
this.deps.onStatusChange();
|
|
44091
44064
|
} else {
|
|
44092
44065
|
const im = this.deps.getInstanceManager();
|
|
44093
44066
|
if (im) {
|
|
44094
|
-
this.deps.getSessionRegistry?.()?.unregisterByInstanceKey(
|
|
44095
|
-
im.removeInstance(
|
|
44096
|
-
this.deps.removeAgentTracking(
|
|
44097
|
-
unregisterMeshCoordinator(
|
|
44098
|
-
LOG.warn("CLI", `\u{1F9F9} Force-removed orphan entry: ${
|
|
44067
|
+
this.deps.getSessionRegistry?.()?.unregisterByInstanceKey(key2);
|
|
44068
|
+
im.removeInstance(key2);
|
|
44069
|
+
this.deps.removeAgentTracking(key2);
|
|
44070
|
+
unregisterMeshCoordinator(key2);
|
|
44071
|
+
LOG.warn("CLI", `\u{1F9F9} Force-removed orphan entry: ${key2}`);
|
|
44099
44072
|
this.deps.onStatusChange();
|
|
44100
44073
|
}
|
|
44101
44074
|
}
|
|
@@ -44123,8 +44096,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44123
44096
|
for (const r of sessions) {
|
|
44124
44097
|
if (!r?.runtimeId || !r?.cliType || !r?.workspace) continue;
|
|
44125
44098
|
restoredRuntimeIds.add(r.runtimeId);
|
|
44126
|
-
const
|
|
44127
|
-
workspaceTypeCounts.set(
|
|
44099
|
+
const key2 = `${r.workspace}::${r.cliType}`;
|
|
44100
|
+
workspaceTypeCounts.set(key2, (workspaceTypeCounts.get(key2) || 0) + 1);
|
|
44128
44101
|
}
|
|
44129
44102
|
for (const record of sessions) {
|
|
44130
44103
|
if (!record?.runtimeId || !record?.cliType || !record?.workspace) continue;
|
|
@@ -44478,7 +44451,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44478
44451
|
});
|
|
44479
44452
|
}
|
|
44480
44453
|
if (!found) throw new Error(`CLI agent not running: ${agentType}`);
|
|
44481
|
-
const { adapter, key } = found;
|
|
44454
|
+
const { adapter, key: key2 } = found;
|
|
44482
44455
|
if (action === "send_chat") {
|
|
44483
44456
|
let currentStatus = getEffectiveAgentSendStatus(adapter);
|
|
44484
44457
|
if (currentStatus === "starting" && await waitForZeroMessageStartingLaunch(adapter)) {
|
|
@@ -44488,7 +44461,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44488
44461
|
}
|
|
44489
44462
|
const meshContext = args?.meshContext;
|
|
44490
44463
|
if (meshContext && typeof meshContext === "object" && typeof meshContext.meshId === "string" && meshContext.meshId) {
|
|
44491
|
-
const targetInstanceId =
|
|
44464
|
+
const targetInstanceId = key2;
|
|
44492
44465
|
try {
|
|
44493
44466
|
this.deps.getInstanceManager()?.attachMeshAssignmentToInstance(targetInstanceId, {
|
|
44494
44467
|
meshId: meshContext.meshId,
|
|
@@ -44520,7 +44493,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44520
44493
|
} else {
|
|
44521
44494
|
await adapter.sendMessage(message);
|
|
44522
44495
|
}
|
|
44523
|
-
const targetInstance = this.deps.getInstanceManager()?.getInstance(
|
|
44496
|
+
const targetInstance = this.deps.getInstanceManager()?.getInstance(key2);
|
|
44524
44497
|
targetInstance?.recordAcknowledgedUserInput?.(input);
|
|
44525
44498
|
return {
|
|
44526
44499
|
success: true,
|
|
@@ -44532,7 +44505,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
44532
44505
|
if (typeof adapter.clearHistory === "function") adapter.clearHistory();
|
|
44533
44506
|
return { success: true, cleared: true };
|
|
44534
44507
|
} else if (action === "stop") {
|
|
44535
|
-
await this.stopSession(
|
|
44508
|
+
await this.stopSession(key2);
|
|
44536
44509
|
return { success: true, stopped: true };
|
|
44537
44510
|
}
|
|
44538
44511
|
throw new Error(`Unknown action: ${action}`);
|
|
@@ -44804,9 +44777,9 @@ function validateProviderDefinition(raw) {
|
|
|
44804
44777
|
} else if (!["ide", "extension", "cli", "acp"].includes(String(provider.category))) {
|
|
44805
44778
|
errors.push(`Invalid category: ${String(provider.category)}`);
|
|
44806
44779
|
}
|
|
44807
|
-
for (const
|
|
44808
|
-
if (!KNOWN_PROVIDER_FIELDS.has(
|
|
44809
|
-
warnings.push(`Unknown provider field: ${
|
|
44780
|
+
for (const key2 of Object.keys(provider)) {
|
|
44781
|
+
if (!KNOWN_PROVIDER_FIELDS.has(key2)) {
|
|
44782
|
+
warnings.push(`Unknown provider field: ${key2}`);
|
|
44810
44783
|
}
|
|
44811
44784
|
}
|
|
44812
44785
|
if (provider.disableUpstream !== void 0) {
|
|
@@ -44951,10 +44924,10 @@ function validateNativeHistory(raw, errors) {
|
|
|
44951
44924
|
return;
|
|
44952
44925
|
}
|
|
44953
44926
|
const scriptConfig = scripts;
|
|
44954
|
-
for (const
|
|
44955
|
-
const value = scriptConfig[
|
|
44927
|
+
for (const key2 of ["readSession", "listSessions"]) {
|
|
44928
|
+
const value = scriptConfig[key2];
|
|
44956
44929
|
if (typeof value !== "string" || !value.trim()) {
|
|
44957
|
-
errors.push(`nativeHistory.scripts.${
|
|
44930
|
+
errors.push(`nativeHistory.scripts.${key2} must be a non-empty string`);
|
|
44958
44931
|
}
|
|
44959
44932
|
}
|
|
44960
44933
|
}
|
|
@@ -44989,10 +44962,10 @@ function validateMeshCoordinatorMcpConfig(mcpConfig, errors) {
|
|
|
44989
44962
|
if (format !== void 0 && !["claude_mcp_json", "hermes_config_yaml"].includes(String(format))) {
|
|
44990
44963
|
errors.push("meshCoordinator.mcpConfig.format must be one of: claude_mcp_json, hermes_config_yaml");
|
|
44991
44964
|
}
|
|
44992
|
-
for (const
|
|
44993
|
-
const value = config[
|
|
44965
|
+
for (const key2 of ["path", "serverName", "configPathCommand", "instructions", "template"]) {
|
|
44966
|
+
const value = config[key2];
|
|
44994
44967
|
if (value !== void 0 && (typeof value !== "string" || !value.trim())) {
|
|
44995
|
-
errors.push(`meshCoordinator.mcpConfig.${
|
|
44968
|
+
errors.push(`meshCoordinator.mcpConfig.${key2} must be a non-empty string when provided`);
|
|
44996
44969
|
}
|
|
44997
44970
|
}
|
|
44998
44971
|
if (config.requiresRestart !== void 0 && typeof config.requiresRestart !== "boolean") {
|
|
@@ -45028,7 +45001,7 @@ function validateMeshCoordinatorDelegatedWorkerIsolation(raw, errors) {
|
|
|
45028
45001
|
errors.push("meshCoordinator.delegatedWorkerIsolation.env must be an object");
|
|
45029
45002
|
} else {
|
|
45030
45003
|
const unset = env.unset;
|
|
45031
|
-
if (unset !== void 0 && (!Array.isArray(unset) || unset.some((
|
|
45004
|
+
if (unset !== void 0 && (!Array.isArray(unset) || unset.some((key2) => typeof key2 !== "string" || !key2.trim()))) {
|
|
45032
45005
|
errors.push("meshCoordinator.delegatedWorkerIsolation.env.unset must be an array of non-empty strings");
|
|
45033
45006
|
}
|
|
45034
45007
|
}
|
|
@@ -45051,16 +45024,16 @@ function validateMeshCoordinatorDelegatedWorkerIsolation(raw, errors) {
|
|
|
45051
45024
|
errors.push(`${prefix}.mode must be one of: empty_mcp_config, config_override`);
|
|
45052
45025
|
continue;
|
|
45053
45026
|
}
|
|
45054
|
-
for (const
|
|
45055
|
-
const value = item[
|
|
45027
|
+
for (const key2 of mode === "empty_mcp_config" ? ["flag"] : ["flag", "key", "value"]) {
|
|
45028
|
+
const value = item[key2];
|
|
45056
45029
|
if (typeof value !== "string" || !value.trim()) {
|
|
45057
|
-
errors.push(`${prefix}.${
|
|
45030
|
+
errors.push(`${prefix}.${key2} must be a non-empty string`);
|
|
45058
45031
|
}
|
|
45059
45032
|
}
|
|
45060
|
-
for (const
|
|
45061
|
-
const value = item[
|
|
45033
|
+
for (const key2 of ["strictFlag", "dedupeKey"]) {
|
|
45034
|
+
const value = item[key2];
|
|
45062
45035
|
if (value !== void 0 && (typeof value !== "string" || !value.trim())) {
|
|
45063
|
-
errors.push(`${prefix}.${
|
|
45036
|
+
errors.push(`${prefix}.${key2} must be a non-empty string when provided`);
|
|
45064
45037
|
}
|
|
45065
45038
|
}
|
|
45066
45039
|
}
|
|
@@ -47283,9 +47256,9 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
47283
47256
|
reload() {
|
|
47284
47257
|
this.log("Reloading all providers...");
|
|
47285
47258
|
this.scriptsCache.clear();
|
|
47286
|
-
for (const
|
|
47287
|
-
if (
|
|
47288
|
-
delete require.cache[
|
|
47259
|
+
for (const key2 of Object.keys(require.cache)) {
|
|
47260
|
+
if (key2.includes("providers") && (key2.endsWith(".js") || key2.endsWith(".json"))) {
|
|
47261
|
+
delete require.cache[key2];
|
|
47289
47262
|
}
|
|
47290
47263
|
}
|
|
47291
47264
|
this.loadAll();
|
|
@@ -47593,7 +47566,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
47593
47566
|
*/
|
|
47594
47567
|
getPublicSettings(type) {
|
|
47595
47568
|
const settings = this.getSettingsSchema(type);
|
|
47596
|
-
return Object.entries(settings).filter(([, def]) => def.public === true).map(([
|
|
47569
|
+
return Object.entries(settings).filter(([, def]) => def.public === true).map(([key2, def]) => ({ key: key2, ...def }));
|
|
47597
47570
|
}
|
|
47598
47571
|
/**
|
|
47599
47572
|
* Get public settings schema for all providers
|
|
@@ -47609,23 +47582,23 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
47609
47582
|
/**
|
|
47610
47583
|
* Resolved setting value for a provider (default + user override)
|
|
47611
47584
|
*/
|
|
47612
|
-
getSettingValue(type,
|
|
47585
|
+
getSettingValue(type, key2) {
|
|
47613
47586
|
const providerType = this.resolveAlias(type);
|
|
47614
47587
|
const machineConfig = this.getMachineProviderConfig(providerType);
|
|
47615
|
-
if (
|
|
47588
|
+
if (key2 === "enabled") {
|
|
47616
47589
|
return machineConfig.enabled === true;
|
|
47617
47590
|
}
|
|
47618
|
-
if (
|
|
47591
|
+
if (key2 === "executablePath") {
|
|
47619
47592
|
return machineConfig.executable || "";
|
|
47620
47593
|
}
|
|
47621
|
-
if (
|
|
47594
|
+
if (key2 === "executableArgs") {
|
|
47622
47595
|
const args = machineConfig.args;
|
|
47623
47596
|
return args ? args.map((arg) => /\s/.test(arg) ? JSON.stringify(arg) : arg).join(" ") : "";
|
|
47624
47597
|
}
|
|
47625
|
-
const schemaDef = this.getSettingsSchema(providerType)[
|
|
47598
|
+
const schemaDef = this.getSettingsSchema(providerType)[key2];
|
|
47626
47599
|
const defaultVal = schemaDef ? schemaDef.default : void 0;
|
|
47627
47600
|
const config = this.readConfig();
|
|
47628
|
-
const userVal = config?.providerSettings?.[providerType]?.[
|
|
47601
|
+
const userVal = config?.providerSettings?.[providerType]?.[key2];
|
|
47629
47602
|
return userVal !== void 0 ? userVal : defaultVal;
|
|
47630
47603
|
}
|
|
47631
47604
|
/**
|
|
@@ -47635,17 +47608,17 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
47635
47608
|
const providerType = this.resolveAlias(type);
|
|
47636
47609
|
const settings = this.getSettingsSchema(providerType);
|
|
47637
47610
|
const result = {};
|
|
47638
|
-
for (const [
|
|
47639
|
-
result[
|
|
47611
|
+
for (const [key2] of Object.entries(settings)) {
|
|
47612
|
+
result[key2] = this.getSettingValue(providerType, key2);
|
|
47640
47613
|
}
|
|
47641
47614
|
return result;
|
|
47642
47615
|
}
|
|
47643
47616
|
/**
|
|
47644
47617
|
* Save provider setting value (writes to config.json)
|
|
47645
47618
|
*/
|
|
47646
|
-
setSetting(type,
|
|
47619
|
+
setSetting(type, key2, value) {
|
|
47647
47620
|
const providerType = this.resolveAlias(type);
|
|
47648
|
-
const schemaDef = this.getSettingsSchema(providerType)[
|
|
47621
|
+
const schemaDef = this.getSettingsSchema(providerType)[key2];
|
|
47649
47622
|
if (!schemaDef) return false;
|
|
47650
47623
|
if (!schemaDef.public) return false;
|
|
47651
47624
|
if (schemaDef.type === "boolean" && typeof value !== "boolean") return false;
|
|
@@ -47656,13 +47629,13 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
47656
47629
|
if (schemaDef.max !== void 0 && value > schemaDef.max) return false;
|
|
47657
47630
|
}
|
|
47658
47631
|
if (schemaDef.type === "select" && schemaDef.options && !schemaDef.options.includes(value)) return false;
|
|
47659
|
-
if (
|
|
47632
|
+
if (key2 === "enabled") {
|
|
47660
47633
|
return this.setMachineProviderEnabled(providerType, value);
|
|
47661
47634
|
}
|
|
47662
|
-
if (
|
|
47635
|
+
if (key2 === "executablePath") {
|
|
47663
47636
|
return this.setMachineProviderConfig(providerType, { executable: value });
|
|
47664
47637
|
}
|
|
47665
|
-
if (
|
|
47638
|
+
if (key2 === "executableArgs") {
|
|
47666
47639
|
return this.setMachineProviderConfig(providerType, {
|
|
47667
47640
|
args: value.trim() ? this.parseArgsSetting(value) : void 0
|
|
47668
47641
|
});
|
|
@@ -47672,17 +47645,17 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
47672
47645
|
try {
|
|
47673
47646
|
if (!config.providerSettings) config.providerSettings = {};
|
|
47674
47647
|
if (!config.providerSettings[providerType]) config.providerSettings[providerType] = {};
|
|
47675
|
-
config.providerSettings[providerType][
|
|
47648
|
+
config.providerSettings[providerType][key2] = value;
|
|
47676
47649
|
this.writeConfig(config);
|
|
47677
|
-
this.log(`Setting updated: ${providerType}.${
|
|
47650
|
+
this.log(`Setting updated: ${providerType}.${key2} = ${JSON.stringify(value)}`);
|
|
47678
47651
|
return true;
|
|
47679
47652
|
} catch (e) {
|
|
47680
47653
|
this.log(`Failed to save setting: ${e.message}`);
|
|
47681
47654
|
return false;
|
|
47682
47655
|
}
|
|
47683
47656
|
}
|
|
47684
|
-
getOptionalStringSetting(type,
|
|
47685
|
-
const value = this.getSettingValue(type,
|
|
47657
|
+
getOptionalStringSetting(type, key2) {
|
|
47658
|
+
const value = this.getSettingValue(type, key2);
|
|
47686
47659
|
if (typeof value !== "string") return null;
|
|
47687
47660
|
const trimmed = value.trim();
|
|
47688
47661
|
return trimmed ? trimmed : null;
|
|
@@ -47862,7 +47835,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
47862
47835
|
try {
|
|
47863
47836
|
let content = fs25.readFileSync(filePath, "utf-8");
|
|
47864
47837
|
if (args[0] && typeof args[0] === "object") {
|
|
47865
|
-
for (const [
|
|
47838
|
+
for (const [key2, val] of Object.entries(args[0])) {
|
|
47866
47839
|
let v = val;
|
|
47867
47840
|
if (typeof v === "string") {
|
|
47868
47841
|
if (!v.startsWith('"') && !v.startsWith("'") && !v.startsWith("`")) {
|
|
@@ -47871,7 +47844,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
47871
47844
|
} else {
|
|
47872
47845
|
v = JSON.stringify(v);
|
|
47873
47846
|
}
|
|
47874
|
-
const re = new RegExp(`\\$\\{\\s*${
|
|
47847
|
+
const re = new RegExp(`\\$\\{\\s*${key2}\\s*\\}`, "g");
|
|
47875
47848
|
content = content.replace(re, String(v));
|
|
47876
47849
|
}
|
|
47877
47850
|
} else if (typeof args[0] === "string") {
|
|
@@ -48660,6 +48633,21 @@ init_mesh_host_ownership();
|
|
|
48660
48633
|
init_worktree_bootstrap_config();
|
|
48661
48634
|
init_mesh_events();
|
|
48662
48635
|
init_config();
|
|
48636
|
+
async function decideOssCloneSync(ossCtx, worktreeOssSha, sourceSha, rg) {
|
|
48637
|
+
if (!worktreeOssSha || !sourceSha || worktreeOssSha === sourceSha) return "noop";
|
|
48638
|
+
const isAncestor = async (ancestor, descendant) => {
|
|
48639
|
+
try {
|
|
48640
|
+
await rg(ossCtx, ["merge-base", "--is-ancestor", ancestor, descendant], { timeoutMs: 1e4 });
|
|
48641
|
+
return true;
|
|
48642
|
+
} catch (err) {
|
|
48643
|
+
if (err?.exitCode === 1 || err?.code === 1) return false;
|
|
48644
|
+
throw err;
|
|
48645
|
+
}
|
|
48646
|
+
};
|
|
48647
|
+
if (await isAncestor(sourceSha, worktreeOssSha)) return "skip_rewind";
|
|
48648
|
+
if (await isAncestor(worktreeOssSha, sourceSha)) return "advance";
|
|
48649
|
+
return "skip_diverged";
|
|
48650
|
+
}
|
|
48663
48651
|
var meshCrudHandlers = {
|
|
48664
48652
|
list_meshes: async (_ctx, _args) => {
|
|
48665
48653
|
try {
|
|
@@ -48750,7 +48738,8 @@ var meshCrudHandlers = {
|
|
|
48750
48738
|
// entry. This is an export scaffold for the operator to review and commit to
|
|
48751
48739
|
// the repo, NOT an automatic data migration: nothing is written to disk and
|
|
48752
48740
|
// meshes.json is untouched. The returned `scaffold` (object) + `scaffoldJson`
|
|
48753
|
-
// (2-space text) capture the
|
|
48741
|
+
// (2-space text) capture the coordinator prompt override/append (policy is
|
|
48742
|
+
// machine-local and is intentionally NOT exported into mesh.json).
|
|
48754
48743
|
export_mesh_json_config: async (_ctx, args) => {
|
|
48755
48744
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
48756
48745
|
if (!meshId) return { success: false, error: "meshId required" };
|
|
@@ -49121,7 +49110,7 @@ var meshCrudHandlers = {
|
|
|
49121
49110
|
}
|
|
49122
49111
|
};
|
|
49123
49112
|
const initSubmodules = sourceNode.policy?.initSubmodulesOnClone !== false;
|
|
49124
|
-
const loadedBootstrap =
|
|
49113
|
+
const loadedBootstrap = loadRepoSettings({ workspace: result.worktreePath, mesh }).worktreeBootstrap;
|
|
49125
49114
|
const runningBootstrapState = {
|
|
49126
49115
|
status: "running",
|
|
49127
49116
|
required: loadedBootstrap.config?.required !== false,
|
|
@@ -49155,12 +49144,25 @@ var meshCrudHandlers = {
|
|
|
49155
49144
|
const ossCtx = { workspace: `${result.worktreePath}/oss`, repoRoot: `${result.worktreePath}/oss`, isGitRepo: true };
|
|
49156
49145
|
const worktreeOssHeadOut = await rg(ossCtx, ["rev-parse", "HEAD"], { timeoutMs: 1e4 });
|
|
49157
49146
|
const worktreeOssSha = (typeof worktreeOssHeadOut === "string" ? worktreeOssHeadOut : worktreeOssHeadOut?.stdout ?? "").trim();
|
|
49158
|
-
if (worktreeOssSha !== sourceSha) {
|
|
49147
|
+
if (worktreeOssSha && worktreeOssSha !== sourceSha) {
|
|
49159
49148
|
await rg(ossCtx, ["fetch", `${sourceWorkspace}/oss`, "HEAD"], { timeoutMs: 6e4 });
|
|
49160
|
-
|
|
49161
|
-
|
|
49162
|
-
|
|
49163
|
-
|
|
49149
|
+
let ossAction;
|
|
49150
|
+
try {
|
|
49151
|
+
ossAction = await decideOssCloneSync(ossCtx, worktreeOssSha, sourceSha, rg);
|
|
49152
|
+
} catch (decideErr) {
|
|
49153
|
+
ossAction = "skip_diverged";
|
|
49154
|
+
console.warn(`[mesh] oss submodule sync guard could not resolve ancestry (kept fresh worktree HEAD): ${decideErr?.message ?? decideErr}`);
|
|
49155
|
+
}
|
|
49156
|
+
if (ossAction === "advance") {
|
|
49157
|
+
await rg(ossCtx, ["checkout", sourceSha], { timeoutMs: 1e4 });
|
|
49158
|
+
await rg(worktreeCtx, ["add", "oss"], { timeoutMs: 1e4 });
|
|
49159
|
+
await rg(worktreeCtx, ["commit", "-m", "chore: sync oss to source node HEAD on clone"], { timeoutMs: 1e4 });
|
|
49160
|
+
console.log(`[mesh] Advanced oss submodule to newer source HEAD ${sourceSha.slice(0, 8)} in worktree`);
|
|
49161
|
+
} else if (ossAction === "skip_rewind") {
|
|
49162
|
+
console.warn(`[mesh] Skipped oss submodule rewind on clone: source node oss ${sourceSha.slice(0, 8)} is an ancestor of the fresh worktree oss ${worktreeOssSha.slice(0, 8)} \u2014 kept fresher worktree HEAD`);
|
|
49163
|
+
} else if (ossAction === "skip_diverged") {
|
|
49164
|
+
console.warn(`[mesh] Skipped oss submodule sync on clone: source node oss ${sourceSha.slice(0, 8)} diverged from the fresh worktree oss ${worktreeOssSha.slice(0, 8)} \u2014 kept worktree HEAD (coordinator reconciles)`);
|
|
49165
|
+
}
|
|
49164
49166
|
}
|
|
49165
49167
|
}
|
|
49166
49168
|
} catch (ossErr) {
|
|
@@ -49594,9 +49596,20 @@ var meshQueueHandlers = {
|
|
|
49594
49596
|
targetNodeId: typeof args?.targetNodeId === "string" ? args.targetNodeId.trim() : void 0,
|
|
49595
49597
|
targetSessionId: typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : void 0,
|
|
49596
49598
|
clearTargetNode: args?.clearTargetNode === true,
|
|
49597
|
-
clearTargetSession: args?.clearTargetSession !== false
|
|
49599
|
+
clearTargetSession: args?.clearTargetSession !== false,
|
|
49600
|
+
// CANON-IDENTITY: an in-flight (actively-generating) task is refused by
|
|
49601
|
+
// default to avoid a duplicate second dispatch; an explicit operator
|
|
49602
|
+
// force overrides that guard (and the retry cap).
|
|
49603
|
+
force: args?.force === true
|
|
49598
49604
|
});
|
|
49599
49605
|
if (!task) return { success: false, error: `Queue task '${taskId}' not found` };
|
|
49606
|
+
if (task.status === "assigned" && args?.force !== true) {
|
|
49607
|
+
return {
|
|
49608
|
+
success: false,
|
|
49609
|
+
error: `Task '${taskId}' is actively dispatched/generating; requeue refused to avoid a duplicate second dispatch. Pass force:true to override, or cancel and re-enqueue.`,
|
|
49610
|
+
task
|
|
49611
|
+
};
|
|
49612
|
+
}
|
|
49600
49613
|
return { success: true, task };
|
|
49601
49614
|
} catch (e) {
|
|
49602
49615
|
return { success: false, error: e.message };
|
|
@@ -51127,15 +51140,15 @@ var SENSITIVE_KEYS = /* @__PURE__ */ new Set([
|
|
|
51127
51140
|
function maskArgs(args) {
|
|
51128
51141
|
if (!args || typeof args !== "object") return void 0;
|
|
51129
51142
|
const masked = {};
|
|
51130
|
-
for (const [
|
|
51131
|
-
if (SENSITIVE_KEYS.has(
|
|
51132
|
-
masked[
|
|
51133
|
-
} else if (
|
|
51134
|
-
masked[
|
|
51143
|
+
for (const [key2, value] of Object.entries(args)) {
|
|
51144
|
+
if (SENSITIVE_KEYS.has(key2)) {
|
|
51145
|
+
masked[key2] = typeof value === "string" ? `[${value.length} chars]` : "[masked]";
|
|
51146
|
+
} else if (key2.startsWith("_")) {
|
|
51147
|
+
masked[key2] = value;
|
|
51135
51148
|
} else if (typeof value === "object" && value !== null) {
|
|
51136
|
-
masked[
|
|
51149
|
+
masked[key2] = Array.isArray(value) ? `[Array(${value.length})]` : `[Object]`;
|
|
51137
51150
|
} else {
|
|
51138
|
-
masked[
|
|
51151
|
+
masked[key2] = value;
|
|
51139
51152
|
}
|
|
51140
51153
|
}
|
|
51141
51154
|
return masked;
|
|
@@ -52232,23 +52245,23 @@ var MeshGitProbeCache = class {
|
|
|
52232
52245
|
* neither gate is satisfied.
|
|
52233
52246
|
*/
|
|
52234
52247
|
async probe(daemonId, workspace, probe) {
|
|
52235
|
-
const
|
|
52236
|
-
const cached3 = this.recent.get(
|
|
52248
|
+
const key2 = this.key(daemonId, workspace);
|
|
52249
|
+
const cached3 = this.recent.get(key2);
|
|
52237
52250
|
if (cached3 && this.now() - cached3.at < this.reuseMs) {
|
|
52238
52251
|
return cached3.value;
|
|
52239
52252
|
}
|
|
52240
|
-
const existing = this.inflight.get(
|
|
52253
|
+
const existing = this.inflight.get(key2);
|
|
52241
52254
|
if (existing) return existing;
|
|
52242
52255
|
const pending = (async () => {
|
|
52243
52256
|
const result = await probe();
|
|
52244
|
-
if (result) this.recent.set(
|
|
52257
|
+
if (result) this.recent.set(key2, { at: this.now(), value: result });
|
|
52245
52258
|
return result;
|
|
52246
52259
|
})();
|
|
52247
|
-
this.inflight.set(
|
|
52260
|
+
this.inflight.set(key2, pending);
|
|
52248
52261
|
try {
|
|
52249
52262
|
return await pending;
|
|
52250
52263
|
} finally {
|
|
52251
|
-
if (this.inflight.get(
|
|
52264
|
+
if (this.inflight.get(key2) === pending) this.inflight.delete(key2);
|
|
52252
52265
|
}
|
|
52253
52266
|
}
|
|
52254
52267
|
};
|
|
@@ -54946,8 +54959,8 @@ var DaemonCommandRouter = class {
|
|
|
54946
54959
|
if (source !== "refine_mesh_node_async_job") continue;
|
|
54947
54960
|
const jobId = e.payload?.refineJob?.jobId;
|
|
54948
54961
|
if (!jobId || terminal.has(`${e.nodeId}:${jobId}`)) continue;
|
|
54949
|
-
const
|
|
54950
|
-
if (this.runningRefineJobs.has(
|
|
54962
|
+
const key2 = this.buildRefineJobKey(meshId, e.nodeId);
|
|
54963
|
+
if (this.runningRefineJobs.has(key2)) continue;
|
|
54951
54964
|
const coordinatorDaemonId = e.payload?.refineJob?.targetCoordinatorDaemonId;
|
|
54952
54965
|
LOG.info("Mesh", `[Refinery] Auto-resuming interrupted refine job for node ${e.nodeId} (jobId=${jobId})`);
|
|
54953
54966
|
void this.startMeshRefineJob(meshId, e.nodeId, {
|
|
@@ -56030,7 +56043,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
56030
56043
|
}
|
|
56031
56044
|
}
|
|
56032
56045
|
async finishMeshRefineBatchJob(handle, orderedNodes, ordering, args) {
|
|
56033
|
-
const
|
|
56046
|
+
const key2 = this.buildRefineBatchJobKey(handle.meshId);
|
|
56034
56047
|
let result;
|
|
56035
56048
|
try {
|
|
56036
56049
|
result = await this.runMeshRefineBatchConvergence(handle.meshId, orderedNodes, ordering, args);
|
|
@@ -56062,8 +56075,8 @@ ${hintLines.join("\n")}` : "",
|
|
|
56062
56075
|
coordinatorDaemonId: handle.targetCoordinatorDaemonId
|
|
56063
56076
|
});
|
|
56064
56077
|
const terminal = { ...terminalHandle, result: normalizedResult };
|
|
56065
|
-
this.terminalRefineBatchJobs.set(
|
|
56066
|
-
this.runningRefineBatchJobs.delete(
|
|
56078
|
+
this.terminalRefineBatchJobs.set(key2, terminal);
|
|
56079
|
+
this.runningRefineBatchJobs.delete(key2);
|
|
56067
56080
|
this.invalidateAggregateMeshStatus(handle.meshId);
|
|
56068
56081
|
await this.appendRefineBatchJobLedger(isTerminalSuccess ? "task_completed" : "task_failed", terminalHandle, normalizedResult);
|
|
56069
56082
|
this.queueRefineBatchJobEvent(isTerminalSuccess ? "refine:completed" : "refine:failed", terminalHandle, normalizedResult);
|
|
@@ -56087,8 +56100,8 @@ ${hintLines.join("\n")}` : "",
|
|
|
56087
56100
|
if (nodeIds.length === 0) {
|
|
56088
56101
|
return { ...planRecord, success: true, batch: true, dryRun: false, async: false };
|
|
56089
56102
|
}
|
|
56090
|
-
const
|
|
56091
|
-
const running = this.runningRefineBatchJobs.get(
|
|
56103
|
+
const key2 = this.buildRefineBatchJobKey(meshId);
|
|
56104
|
+
const running = this.runningRefineBatchJobs.get(key2);
|
|
56092
56105
|
if (running) return { ...running, duplicate: true };
|
|
56093
56106
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
56094
56107
|
const mesh = meshRecord?.mesh;
|
|
@@ -56103,7 +56116,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
56103
56116
|
};
|
|
56104
56117
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : this.deps.statusInstanceId || void 0;
|
|
56105
56118
|
const handle = this.buildRefineBatchJobHandle({ meshId, nodeIds, order, coordinatorDaemonId });
|
|
56106
|
-
this.runningRefineBatchJobs.set(
|
|
56119
|
+
this.runningRefineBatchJobs.set(key2, handle);
|
|
56107
56120
|
await this.appendRefineBatchJobLedger("task_dispatched", handle);
|
|
56108
56121
|
this.queueRefineBatchJobEvent("refine:accepted", handle);
|
|
56109
56122
|
setImmediate(() => {
|
|
@@ -56118,7 +56131,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
56118
56131
|
};
|
|
56119
56132
|
}
|
|
56120
56133
|
async finishMeshRefineJob(handle, args) {
|
|
56121
|
-
const
|
|
56134
|
+
const key2 = this.buildRefineJobKey(handle.meshId, handle.targetNodeId);
|
|
56122
56135
|
let result;
|
|
56123
56136
|
try {
|
|
56124
56137
|
result = await this.executeMeshRefineNodeSynchronously(handle.meshId, handle.targetNodeId, args);
|
|
@@ -56186,17 +56199,17 @@ ${hintLines.join("\n")}` : "",
|
|
|
56186
56199
|
coordinatorDaemonId: handle.targetCoordinatorDaemonId
|
|
56187
56200
|
});
|
|
56188
56201
|
const terminal = { ...terminalHandle, result: normalizedResult };
|
|
56189
|
-
this.terminalRefineJobs.set(
|
|
56190
|
-
this.runningRefineJobs.delete(
|
|
56202
|
+
this.terminalRefineJobs.set(key2, terminal);
|
|
56203
|
+
this.runningRefineJobs.delete(key2);
|
|
56191
56204
|
this.invalidateAggregateMeshStatus(handle.meshId);
|
|
56192
56205
|
await this.appendRefineJobLedger(isTerminalSuccess ? "task_completed" : "task_failed", terminalHandle, normalizedResult);
|
|
56193
56206
|
this.queueRefineJobEvent(isTerminalSuccess ? "refine:completed" : "refine:failed", terminalHandle, normalizedResult);
|
|
56194
56207
|
}
|
|
56195
56208
|
async startMeshRefineJob(meshId, nodeId, args) {
|
|
56196
|
-
const
|
|
56197
|
-
const running = this.runningRefineJobs.get(
|
|
56209
|
+
const key2 = this.buildRefineJobKey(meshId, nodeId);
|
|
56210
|
+
const running = this.runningRefineJobs.get(key2);
|
|
56198
56211
|
if (running) return { ...running, duplicate: true };
|
|
56199
|
-
const terminal = this.terminalRefineJobs.get(
|
|
56212
|
+
const terminal = this.terminalRefineJobs.get(key2);
|
|
56200
56213
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
56201
56214
|
const mesh = meshRecord?.mesh;
|
|
56202
56215
|
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
@@ -56204,7 +56217,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
56204
56217
|
if (!node.isLocalWorktree || !node.workspace) return { success: false, error: `Refinery requires a local worktree node` };
|
|
56205
56218
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : this.deps.statusInstanceId || void 0;
|
|
56206
56219
|
const handle = this.buildRefineJobHandle({ meshId, nodeId, node, retryOfJobId: terminal?.jobId, coordinatorDaemonId });
|
|
56207
|
-
this.runningRefineJobs.set(
|
|
56220
|
+
this.runningRefineJobs.set(key2, handle);
|
|
56208
56221
|
await this.appendRefineJobLedger("task_dispatched", handle);
|
|
56209
56222
|
this.queueRefineJobEvent("refine:accepted", handle);
|
|
56210
56223
|
setImmediate(() => {
|
|
@@ -56260,27 +56273,27 @@ ${hintLines.join("\n")}` : "",
|
|
|
56260
56273
|
*/
|
|
56261
56274
|
async stopIde(ideType, killProcess = false) {
|
|
56262
56275
|
const cdpKeysToRemove = [];
|
|
56263
|
-
for (const
|
|
56264
|
-
if (
|
|
56265
|
-
cdpKeysToRemove.push(
|
|
56276
|
+
for (const key2 of this.deps.cdpManagers.keys()) {
|
|
56277
|
+
if (key2 === ideType || key2.startsWith(`${ideType}_`)) {
|
|
56278
|
+
cdpKeysToRemove.push(key2);
|
|
56266
56279
|
}
|
|
56267
56280
|
}
|
|
56268
|
-
for (const
|
|
56269
|
-
const cdp = this.deps.cdpManagers.get(
|
|
56281
|
+
for (const key2 of cdpKeysToRemove) {
|
|
56282
|
+
const cdp = this.deps.cdpManagers.get(key2);
|
|
56270
56283
|
if (cdp) {
|
|
56271
56284
|
try {
|
|
56272
56285
|
cdp.disconnect();
|
|
56273
56286
|
} catch {
|
|
56274
56287
|
}
|
|
56275
|
-
this.deps.cdpManagers.delete(
|
|
56276
|
-
this.deps.sessionRegistry.unregisterByManagerKey(
|
|
56277
|
-
LOG.info("StopIDE", `CDP disconnected: ${
|
|
56288
|
+
this.deps.cdpManagers.delete(key2);
|
|
56289
|
+
this.deps.sessionRegistry.unregisterByManagerKey(key2);
|
|
56290
|
+
LOG.info("StopIDE", `CDP disconnected: ${key2}`);
|
|
56278
56291
|
}
|
|
56279
56292
|
}
|
|
56280
56293
|
const keysToRemove = [];
|
|
56281
|
-
for (const
|
|
56282
|
-
if (
|
|
56283
|
-
keysToRemove.push(
|
|
56294
|
+
for (const key2 of this.deps.instanceManager.listInstanceIds()) {
|
|
56295
|
+
if (key2 === `ide:${ideType}` || typeof key2 === "string" && key2.startsWith(`ide:${ideType}_`)) {
|
|
56296
|
+
keysToRemove.push(key2);
|
|
56284
56297
|
}
|
|
56285
56298
|
}
|
|
56286
56299
|
for (const instanceKey of keysToRemove) {
|
|
@@ -60973,9 +60986,9 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
60973
60986
|
}
|
|
60974
60987
|
if (Date.now() - lastApprovalTime < 2e3) return;
|
|
60975
60988
|
if (approvalPatterns.some((p) => p.test(approvalBuffer))) {
|
|
60976
|
-
const
|
|
60977
|
-
writeFn(
|
|
60978
|
-
ctx.log(`Auto-Implement auto-approved prompt! Sending: ${JSON.stringify(
|
|
60989
|
+
const key2 = approvalKeys[1] || approvalKeys[0] || "a\r";
|
|
60990
|
+
writeFn(key2);
|
|
60991
|
+
ctx.log(`Auto-Implement auto-approved prompt! Sending: ${JSON.stringify(key2)}`);
|
|
60979
60992
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk: `
|
|
60980
60993
|
[\u{1F916} ADHDev Auto-Approve] CLI Action Approved
|
|
60981
60994
|
`, stream: "stdout" } });
|
|
@@ -62227,8 +62240,8 @@ var DevServer = class _DevServer {
|
|
|
62227
62240
|
category: p.category
|
|
62228
62241
|
}));
|
|
62229
62242
|
const cdpStatus = {};
|
|
62230
|
-
for (const [
|
|
62231
|
-
cdpStatus[
|
|
62243
|
+
for (const [key2, cdp] of this.cdpManagers.entries()) {
|
|
62244
|
+
cdpStatus[key2] = { connected: cdp.isConnected };
|
|
62232
62245
|
}
|
|
62233
62246
|
this.json(res, 200, {
|
|
62234
62247
|
devMode: true,
|
|
@@ -62548,16 +62561,16 @@ var DevServer = class _DevServer {
|
|
|
62548
62561
|
errors.push(...validation.errors);
|
|
62549
62562
|
warnings.push(...validation.warnings);
|
|
62550
62563
|
if (config.settings) {
|
|
62551
|
-
for (const [
|
|
62564
|
+
for (const [key2, val] of Object.entries(config.settings)) {
|
|
62552
62565
|
const s2 = val;
|
|
62553
|
-
if (!s2.type) errors.push(`settings.${
|
|
62566
|
+
if (!s2.type) errors.push(`settings.${key2}: missing type`);
|
|
62554
62567
|
else if (!["boolean", "number", "string", "select"].includes(s2.type))
|
|
62555
|
-
errors.push(`settings.${
|
|
62556
|
-
if (s2.default === void 0) warnings.push(`settings.${
|
|
62568
|
+
errors.push(`settings.${key2}: invalid type '${s2.type}'`);
|
|
62569
|
+
if (s2.default === void 0) warnings.push(`settings.${key2}: no default value`);
|
|
62557
62570
|
if (s2.type === "number" && s2.min !== void 0 && s2.max !== void 0 && s2.min > s2.max)
|
|
62558
|
-
errors.push(`settings.${
|
|
62571
|
+
errors.push(`settings.${key2}: min (${s2.min}) > max (${s2.max})`);
|
|
62559
62572
|
if (s2.type === "select" && (!s2.options || !Array.isArray(s2.options) || s2.options.length === 0))
|
|
62560
|
-
errors.push(`settings.${
|
|
62573
|
+
errors.push(`settings.${key2}: select type requires options[]`);
|
|
62561
62574
|
}
|
|
62562
62575
|
}
|
|
62563
62576
|
if (config.cdpPorts && Array.isArray(config.cdpPorts)) {
|
|
@@ -63341,21 +63354,21 @@ function isLowercaseLetter(value) {
|
|
|
63341
63354
|
function encodeControlLetter(letter) {
|
|
63342
63355
|
return String.fromCharCode(letter.charCodeAt(0) - 96);
|
|
63343
63356
|
}
|
|
63344
|
-
function encodeShiftedKey(
|
|
63345
|
-
if (isLowercaseLetter(
|
|
63346
|
-
if (
|
|
63347
|
-
return encodeControlLetter(
|
|
63357
|
+
function encodeShiftedKey(key2) {
|
|
63358
|
+
if (isLowercaseLetter(key2)) return key2.toUpperCase();
|
|
63359
|
+
if (key2.startsWith("ctrl+") && isLowercaseLetter(key2.slice(5))) {
|
|
63360
|
+
return encodeControlLetter(key2.slice(5));
|
|
63348
63361
|
}
|
|
63349
|
-
if (
|
|
63350
|
-
return `\x1B${
|
|
63362
|
+
if (key2.startsWith("alt+") && isLowercaseLetter(key2.slice(4))) {
|
|
63363
|
+
return `\x1B${key2.slice(4).toUpperCase()}`;
|
|
63351
63364
|
}
|
|
63352
|
-
if (
|
|
63353
|
-
if (
|
|
63354
|
-
if (
|
|
63355
|
-
throw new Error(`Unsupported named key: shift+${
|
|
63365
|
+
if (key2 === "tab") return "\x1B[Z";
|
|
63366
|
+
if (key2 in SHIFTED_CSI_KEYS) return SHIFTED_CSI_KEYS[key2];
|
|
63367
|
+
if (key2 in BASE_KEY_SEQUENCES) return BASE_KEY_SEQUENCES[key2];
|
|
63368
|
+
throw new Error(`Unsupported named key: shift+${key2}`);
|
|
63356
63369
|
}
|
|
63357
|
-
function namedKeyToAnsi(
|
|
63358
|
-
const normalized = String(
|
|
63370
|
+
function namedKeyToAnsi(key2) {
|
|
63371
|
+
const normalized = String(key2 || "").trim().toLowerCase();
|
|
63359
63372
|
if (normalized in BASE_KEY_SEQUENCES) return BASE_KEY_SEQUENCES[normalized];
|
|
63360
63373
|
if (normalized.startsWith("ctrl+") && isLowercaseLetter(normalized.slice(5))) {
|
|
63361
63374
|
return encodeControlLetter(normalized.slice(5));
|
|
@@ -63364,7 +63377,7 @@ function namedKeyToAnsi(key) {
|
|
|
63364
63377
|
return `\x1B${normalized.slice(4)}`;
|
|
63365
63378
|
}
|
|
63366
63379
|
if (normalized.startsWith("shift+")) return encodeShiftedKey(normalized.slice(6));
|
|
63367
|
-
throw new Error(`Unsupported named key: ${
|
|
63380
|
+
throw new Error(`Unsupported named key: ${key2}`);
|
|
63368
63381
|
}
|
|
63369
63382
|
function namedKeysToAnsi(keys) {
|
|
63370
63383
|
if (!Array.isArray(keys)) throw new Error("keys must be an array");
|
|
@@ -63842,19 +63855,19 @@ var SessionRegistry = class {
|
|
|
63842
63855
|
if (!ids) return [];
|
|
63843
63856
|
return [...ids].map((id) => this.bySessionId.get(id)).filter(Boolean);
|
|
63844
63857
|
}
|
|
63845
|
-
addIndex(index,
|
|
63846
|
-
let set = index.get(
|
|
63858
|
+
addIndex(index, key2, sessionId) {
|
|
63859
|
+
let set = index.get(key2);
|
|
63847
63860
|
if (!set) {
|
|
63848
63861
|
set = /* @__PURE__ */ new Set();
|
|
63849
|
-
index.set(
|
|
63862
|
+
index.set(key2, set);
|
|
63850
63863
|
}
|
|
63851
63864
|
set.add(sessionId);
|
|
63852
63865
|
}
|
|
63853
|
-
removeIndex(index,
|
|
63854
|
-
const set = index.get(
|
|
63866
|
+
removeIndex(index, key2, sessionId) {
|
|
63867
|
+
const set = index.get(key2);
|
|
63855
63868
|
if (!set) return;
|
|
63856
63869
|
set.delete(sessionId);
|
|
63857
|
-
if (set.size === 0) index.delete(
|
|
63870
|
+
if (set.size === 0) index.delete(key2);
|
|
63858
63871
|
}
|
|
63859
63872
|
};
|
|
63860
63873
|
|
|
@@ -64515,6 +64528,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64515
64528
|
buildToolChatMessage,
|
|
64516
64529
|
buildUserChatMessage,
|
|
64517
64530
|
cancelTask,
|
|
64531
|
+
canonicalDaemonId,
|
|
64518
64532
|
claimNextTask,
|
|
64519
64533
|
classifyChatMessageVisibility,
|
|
64520
64534
|
classifyHotChatSessionsForSubscriptionFlush,
|
|
@@ -64643,6 +64657,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64643
64657
|
loadMeshCoordinatorRegistry,
|
|
64644
64658
|
loadMeshRefineConfig,
|
|
64645
64659
|
loadMeshWorktreeBootstrapConfig,
|
|
64660
|
+
loadRepoSettings,
|
|
64646
64661
|
loadState,
|
|
64647
64662
|
logCommand,
|
|
64648
64663
|
machineCoreFromDaemonId,
|