@adhdev/daemon-standalone 0.9.82-rc.412 → 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/index.js +446 -387
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +3 -2
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -29727,9 +29727,9 @@ var require_dist3 = __commonJS({
|
|
|
29727
29727
|
};
|
|
29728
29728
|
var __copyProps2 = (to, from, except, desc) => {
|
|
29729
29729
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
29730
|
-
for (let
|
|
29731
|
-
if (!__hasOwnProp2.call(to,
|
|
29732
|
-
__defProp2(to,
|
|
29730
|
+
for (let key2 of __getOwnPropNames2(from))
|
|
29731
|
+
if (!__hasOwnProp2.call(to, key2) && key2 !== except)
|
|
29732
|
+
__defProp2(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc2(from, key2)) || desc.enumerable });
|
|
29733
29733
|
}
|
|
29734
29734
|
return to;
|
|
29735
29735
|
};
|
|
@@ -30115,10 +30115,10 @@ var require_dist3 = __commonJS({
|
|
|
30115
30115
|
}
|
|
30116
30116
|
function getDaemonBuildInfo() {
|
|
30117
30117
|
if (cached2) return cached2;
|
|
30118
|
-
const commit = readInjected(true ? "
|
|
30119
|
-
const commitShort = readInjected(true ? "
|
|
30120
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30121
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30118
|
+
const commit = readInjected(true ? "7a774e95a82354f5357197b3c84f63e68b5f7a5d" : void 0) ?? "unknown";
|
|
30119
|
+
const commitShort = readInjected(true ? "7a774e95" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30120
|
+
const version2 = readInjected(true ? "0.9.82-rc.413" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30121
|
+
const builtAt = readInjected(true ? "2026-06-28T11:49:09.563Z" : void 0);
|
|
30122
30122
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30123
30123
|
return cached2;
|
|
30124
30124
|
}
|
|
@@ -30134,18 +30134,18 @@ var require_dist3 = __commonJS({
|
|
|
30134
30134
|
function isStringArray(value) {
|
|
30135
30135
|
return Array.isArray(value) && value.every((v) => typeof v === "string" && v.length > 0);
|
|
30136
30136
|
}
|
|
30137
|
-
function validateTarget(value,
|
|
30137
|
+
function validateTarget(value, key2, errors) {
|
|
30138
30138
|
if (!isRecord(value)) {
|
|
30139
|
-
errors.push(`impactTargets.${
|
|
30139
|
+
errors.push(`impactTargets.${key2} must be an object`);
|
|
30140
30140
|
return void 0;
|
|
30141
30141
|
}
|
|
30142
30142
|
const { recommendedCommand } = value;
|
|
30143
30143
|
if (typeof recommendedCommand !== "string" || !recommendedCommand.length) {
|
|
30144
|
-
errors.push(`impactTargets.${
|
|
30144
|
+
errors.push(`impactTargets.${key2}.recommendedCommand must be a non-empty string`);
|
|
30145
30145
|
return void 0;
|
|
30146
30146
|
}
|
|
30147
30147
|
for (const k of Object.keys(value)) {
|
|
30148
|
-
if (k !== "recommendedCommand") errors.push(`impactTargets.${
|
|
30148
|
+
if (k !== "recommendedCommand") errors.push(`impactTargets.${key2}.${k} is not a recognized field (only recommendedCommand)`);
|
|
30149
30149
|
}
|
|
30150
30150
|
return { recommendedCommand };
|
|
30151
30151
|
}
|
|
@@ -30172,20 +30172,20 @@ var require_dist3 = __commonJS({
|
|
|
30172
30172
|
errors.push("impactTargets must be an object");
|
|
30173
30173
|
} else {
|
|
30174
30174
|
const targets = {};
|
|
30175
|
-
for (const
|
|
30176
|
-
if (
|
|
30177
|
-
errors.push(`impactTargets.${
|
|
30175
|
+
for (const key2 of Object.keys(raw.impactTargets)) {
|
|
30176
|
+
if (key2 !== "daemon" && key2 !== "web" && key2 !== "none") {
|
|
30177
|
+
errors.push(`impactTargets.${key2} is not a recognized impact kind (daemon|web|none)`);
|
|
30178
30178
|
continue;
|
|
30179
30179
|
}
|
|
30180
|
-
const target = validateTarget(raw.impactTargets[
|
|
30181
|
-
if (target) targets[
|
|
30180
|
+
const target = validateTarget(raw.impactTargets[key2], key2, errors);
|
|
30181
|
+
if (target) targets[key2] = target;
|
|
30182
30182
|
}
|
|
30183
30183
|
if (Object.keys(targets).length) config2.impactTargets = targets;
|
|
30184
30184
|
}
|
|
30185
30185
|
}
|
|
30186
|
-
for (const
|
|
30187
|
-
if (!["daemonRuntimePackages", "webOnlyPackages", "nonRuntimeRootFilePatterns", "impactTargets"].includes(
|
|
30188
|
-
errors.push(`unknown config key '${
|
|
30186
|
+
for (const key2 of Object.keys(raw)) {
|
|
30187
|
+
if (!["daemonRuntimePackages", "webOnlyPackages", "nonRuntimeRootFilePatterns", "impactTargets"].includes(key2)) {
|
|
30188
|
+
errors.push(`unknown config key '${key2}'`);
|
|
30189
30189
|
}
|
|
30190
30190
|
}
|
|
30191
30191
|
return { valid: errors.length === 0, errors, config: errors.length === 0 ? config2 : void 0 };
|
|
@@ -30519,12 +30519,12 @@ var require_dist3 = __commonJS({
|
|
|
30519
30519
|
return { config: null, sourceKey: "forced-default" };
|
|
30520
30520
|
}
|
|
30521
30521
|
if (options.changeImpactConfig !== void 0) {
|
|
30522
|
-
let
|
|
30522
|
+
let key2 = "injected";
|
|
30523
30523
|
try {
|
|
30524
|
-
|
|
30524
|
+
key2 = `injected:${JSON.stringify(options.changeImpactConfig)}`;
|
|
30525
30525
|
} catch {
|
|
30526
30526
|
}
|
|
30527
|
-
return { config: options.changeImpactConfig, sourceKey:
|
|
30527
|
+
return { config: options.changeImpactConfig, sourceKey: key2 };
|
|
30528
30528
|
}
|
|
30529
30529
|
if (!repoRoot) {
|
|
30530
30530
|
return { config: null, sourceKey: "no-repo-root" };
|
|
@@ -32103,9 +32103,9 @@ ${error48.message || ""}`;
|
|
|
32103
32103
|
].filter(Boolean)));
|
|
32104
32104
|
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
32105
32105
|
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
32106
|
-
for (const
|
|
32107
|
-
nextSessionNotificationDismissals[
|
|
32108
|
-
delete nextSessionNotificationUnreadOverrides[
|
|
32106
|
+
for (const key2 of dismissalKeys) {
|
|
32107
|
+
nextSessionNotificationDismissals[key2] = dismissalId;
|
|
32108
|
+
delete nextSessionNotificationUnreadOverrides[key2];
|
|
32109
32109
|
}
|
|
32110
32110
|
return {
|
|
32111
32111
|
...state,
|
|
@@ -32122,9 +32122,9 @@ ${error48.message || ""}`;
|
|
|
32122
32122
|
].filter(Boolean)));
|
|
32123
32123
|
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
32124
32124
|
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
32125
|
-
for (const
|
|
32126
|
-
nextSessionNotificationUnreadOverrides[
|
|
32127
|
-
delete nextSessionNotificationDismissals[
|
|
32125
|
+
for (const key2 of unreadKeys) {
|
|
32126
|
+
nextSessionNotificationUnreadOverrides[key2] = unreadId;
|
|
32127
|
+
delete nextSessionNotificationDismissals[key2];
|
|
32128
32128
|
}
|
|
32129
32129
|
return {
|
|
32130
32130
|
...state,
|
|
@@ -32188,11 +32188,11 @@ ${error48.message || ""}`;
|
|
|
32188
32188
|
const nextSessionReadMarkers = { ...prevMarkers };
|
|
32189
32189
|
const nextSessionNotificationDismissals = { ...state.sessionNotificationDismissals || {} };
|
|
32190
32190
|
const nextSessionNotificationUnreadOverrides = { ...state.sessionNotificationUnreadOverrides || {} };
|
|
32191
|
-
for (const
|
|
32192
|
-
nextSessionReads[
|
|
32193
|
-
if (nextMarker) nextSessionReadMarkers[
|
|
32194
|
-
delete nextSessionNotificationDismissals[
|
|
32195
|
-
delete nextSessionNotificationUnreadOverrides[
|
|
32191
|
+
for (const key2 of readKeys) {
|
|
32192
|
+
nextSessionReads[key2] = Math.max(prev[key2] || 0, seenAt);
|
|
32193
|
+
if (nextMarker) nextSessionReadMarkers[key2] = nextMarker;
|
|
32194
|
+
delete nextSessionNotificationDismissals[key2];
|
|
32195
|
+
delete nextSessionNotificationUnreadOverrides[key2];
|
|
32196
32196
|
}
|
|
32197
32197
|
return {
|
|
32198
32198
|
...state,
|
|
@@ -32893,6 +32893,12 @@ ${error48.message || ""}`;
|
|
|
32893
32893
|
}
|
|
32894
32894
|
return trimmed;
|
|
32895
32895
|
}
|
|
32896
|
+
function canonicalDaemonId(id) {
|
|
32897
|
+
const core = machineCoreFromDaemonId(id);
|
|
32898
|
+
if (!core) return void 0;
|
|
32899
|
+
if (!core.startsWith("mach_")) return core;
|
|
32900
|
+
return `daemon_${core}`;
|
|
32901
|
+
}
|
|
32896
32902
|
function daemonIdsEquivalent(a, b) {
|
|
32897
32903
|
const coreA = machineCoreFromDaemonId(a);
|
|
32898
32904
|
const coreB = machineCoreFromDaemonId(b);
|
|
@@ -33052,8 +33058,8 @@ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
|
|
|
33052
33058
|
rules: buildRulesSection(coordinatorCliType),
|
|
33053
33059
|
toolExposurePreflight: TOOL_EXPOSURE_PREFLIGHT_SECTION
|
|
33054
33060
|
};
|
|
33055
|
-
return template.replace(/\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g, (m,
|
|
33056
|
-
return Object.prototype.hasOwnProperty.call(replacements,
|
|
33061
|
+
return template.replace(/\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g, (m, key2) => {
|
|
33062
|
+
return Object.prototype.hasOwnProperty.call(replacements, key2) ? replacements[key2] : m;
|
|
33057
33063
|
});
|
|
33058
33064
|
}
|
|
33059
33065
|
function buildNodeStatusSection(nodes) {
|
|
@@ -34493,6 +34499,31 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34493
34499
|
]);
|
|
34494
34500
|
}
|
|
34495
34501
|
});
|
|
34502
|
+
function key(meshId, taskId) {
|
|
34503
|
+
return `${meshId}::${taskId}`;
|
|
34504
|
+
}
|
|
34505
|
+
function beginTaskDispatchInFlight(meshId, taskId) {
|
|
34506
|
+
if (!meshId || !taskId) return false;
|
|
34507
|
+
const k = key(meshId, taskId);
|
|
34508
|
+
if (inFlight.has(k)) return false;
|
|
34509
|
+
inFlight.add(k);
|
|
34510
|
+
return true;
|
|
34511
|
+
}
|
|
34512
|
+
function isTaskDispatchInFlight(meshId, taskId) {
|
|
34513
|
+
if (!meshId || !taskId) return false;
|
|
34514
|
+
return inFlight.has(key(meshId, taskId));
|
|
34515
|
+
}
|
|
34516
|
+
function endTaskDispatchInFlight(meshId, taskId) {
|
|
34517
|
+
if (!meshId || !taskId) return;
|
|
34518
|
+
inFlight.delete(key(meshId, taskId));
|
|
34519
|
+
}
|
|
34520
|
+
var inFlight;
|
|
34521
|
+
var init_mesh_task_inflight = __esm2({
|
|
34522
|
+
"src/mesh/mesh-task-inflight.ts"() {
|
|
34523
|
+
"use strict";
|
|
34524
|
+
inFlight = /* @__PURE__ */ new Set();
|
|
34525
|
+
}
|
|
34526
|
+
});
|
|
34496
34527
|
var mesh_work_queue_exports = {};
|
|
34497
34528
|
__export2(mesh_work_queue_exports, {
|
|
34498
34529
|
ACTIVE_MESH_QUEUE_STATUSES: () => ACTIVE_MESH_QUEUE_STATUSES,
|
|
@@ -34758,14 +34789,14 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34758
34789
|
if (!Array.isArray(raw)) return void 0;
|
|
34759
34790
|
return raw.find((type) => typeof type === "string" && type.trim())?.trim();
|
|
34760
34791
|
}
|
|
34761
|
-
function readNodeOverride(node,
|
|
34792
|
+
function readNodeOverride(node, key2) {
|
|
34762
34793
|
const overrides = node?.userOverrides;
|
|
34763
34794
|
if (!overrides || typeof overrides !== "object" || Array.isArray(overrides)) return null;
|
|
34764
|
-
const value = overrides[
|
|
34795
|
+
const value = overrides[key2];
|
|
34765
34796
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
34766
34797
|
}
|
|
34767
|
-
function readNodeReporter(node,
|
|
34768
|
-
const value =
|
|
34798
|
+
function readNodeReporter(node, key2) {
|
|
34799
|
+
const value = key2 === "platform" ? node?.reportedPlatform : node?.reportedArch;
|
|
34769
34800
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
34770
34801
|
}
|
|
34771
34802
|
function buildMeshNodeCapabilityTags(node, providerType) {
|
|
@@ -34984,6 +35015,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34984
35015
|
if (!entry) return null;
|
|
34985
35016
|
entry.status = status;
|
|
34986
35017
|
MeshRuntimeStore.getInstance().updateQueueEntry(entry);
|
|
35018
|
+
if (status !== "assigned") endTaskDispatchInFlight(meshId, taskId);
|
|
34987
35019
|
if (DEPENDENCY_FAILURE_TERMINALS.has(status)) propagateDependencyFailure(meshId, taskId);
|
|
34988
35020
|
return entry;
|
|
34989
35021
|
});
|
|
@@ -35008,6 +35040,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35008
35040
|
entry.cancelledAt = now;
|
|
35009
35041
|
if (opts?.reason) entry.cancelReason = opts.reason;
|
|
35010
35042
|
MeshRuntimeStore.getInstance().updateQueueEntry(entry);
|
|
35043
|
+
endTaskDispatchInFlight(meshId, taskId);
|
|
35011
35044
|
propagateDependencyFailure(meshId, taskId);
|
|
35012
35045
|
return entry;
|
|
35013
35046
|
});
|
|
@@ -35017,6 +35050,11 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35017
35050
|
return withQueueLock(meshId, () => {
|
|
35018
35051
|
const entry = MeshRuntimeStore.getInstance().findQueueEntryById(meshId, taskId);
|
|
35019
35052
|
if (!entry) return null;
|
|
35053
|
+
if (!opts?.force && isTaskDispatchInFlight(meshId, taskId)) {
|
|
35054
|
+
LOG2.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.`);
|
|
35055
|
+
return entry;
|
|
35056
|
+
}
|
|
35057
|
+
endTaskDispatchInFlight(meshId, taskId);
|
|
35020
35058
|
const currentCount = entry.requeueCount || 0;
|
|
35021
35059
|
const maxRetries = opts?.maxRetries ?? entry.maxRetries ?? 1;
|
|
35022
35060
|
if (!opts?.force && currentCount >= maxRetries) {
|
|
@@ -35061,6 +35099,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35061
35099
|
delete entry.dispatchTimestamp;
|
|
35062
35100
|
entry.strandedReclaimCount = reclaims;
|
|
35063
35101
|
entry.updatedAt = now;
|
|
35102
|
+
endTaskDispatchInFlight(meshId, taskId);
|
|
35064
35103
|
if (reclaims > MAX_STRANDED_RECLAIMS) {
|
|
35065
35104
|
entry.status = "failed";
|
|
35066
35105
|
entry.cancelReason = `stranded_dispatch_unrecovered: reclaimed ${reclaims - 1} time(s) without a confirmed dispatch`;
|
|
@@ -35104,6 +35143,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35104
35143
|
}
|
|
35105
35144
|
entry.status = status;
|
|
35106
35145
|
store.updateQueueEntry(entry);
|
|
35146
|
+
if (status !== "assigned") endTaskDispatchInFlight(meshId, entry.id);
|
|
35107
35147
|
if (DEPENDENCY_FAILURE_TERMINALS.has(status)) propagateDependencyFailure(meshId, entry.id);
|
|
35108
35148
|
return entry;
|
|
35109
35149
|
});
|
|
@@ -35228,6 +35268,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35228
35268
|
init_logger();
|
|
35229
35269
|
init_mesh_ledger();
|
|
35230
35270
|
init_mesh_delivery_policy();
|
|
35271
|
+
init_mesh_task_inflight();
|
|
35231
35272
|
ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
|
|
35232
35273
|
HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
|
|
35233
35274
|
MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
@@ -37293,7 +37334,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
37293
37334
|
timestamp: entry.timestamp,
|
|
37294
37335
|
...entry.sessionId ? { sessionId: entry.sessionId } : {},
|
|
37295
37336
|
bootstrap: readRecord3(validationSummary?.bootstrap),
|
|
37296
|
-
validation: validationSummary ? Object.fromEntries(Object.entries(validationSummary).filter(([
|
|
37337
|
+
validation: validationSummary ? Object.fromEntries(Object.entries(validationSummary).filter(([key2]) => key2 !== "bootstrap")) : null,
|
|
37297
37338
|
checkpoint: readRecord3(result?.checkpoint),
|
|
37298
37339
|
worker: null,
|
|
37299
37340
|
...readRecord3(payload.finalBranchConvergenceState) ?? readRecord3(result?.finalBranchConvergenceState) ? { finalBranchConvergenceState: readRecord3(payload.finalBranchConvergenceState) ?? readRecord3(result?.finalBranchConvergenceState) } : {},
|
|
@@ -37556,7 +37597,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
37556
37597
|
};
|
|
37557
37598
|
}
|
|
37558
37599
|
function renderMeshCoordinatorTemplate(template, values) {
|
|
37559
|
-
return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand|adhdevMcpArgs)\s*\}\}/g, (_,
|
|
37600
|
+
return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand|adhdevMcpArgs)\s*\}\}/g, (_, key2) => values[key2] || "");
|
|
37560
37601
|
}
|
|
37561
37602
|
function replaceLegacyCliCommandMcpArgs(command, args) {
|
|
37562
37603
|
return command.replace(
|
|
@@ -37565,9 +37606,9 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
37565
37606
|
);
|
|
37566
37607
|
}
|
|
37567
37608
|
function resolveHermesCoordinatorHome(meshId, workspace) {
|
|
37568
|
-
const
|
|
37609
|
+
const key2 = `${meshId || "mesh"}
|
|
37569
37610
|
${(0, import_node_path.resolve)(workspace || os42.tmpdir())}`;
|
|
37570
|
-
const hash2 = shortHash(
|
|
37611
|
+
const hash2 = shortHash(key2);
|
|
37571
37612
|
return (0, import_node_path.join)(os42.tmpdir(), `adhdev-hermes-mesh-coordinator-${hash2}`);
|
|
37572
37613
|
}
|
|
37573
37614
|
function resolveMcpConfigPath(configPath, workspace) {
|
|
@@ -38043,9 +38084,9 @@ ${rendered}`, "utf-8");
|
|
|
38043
38084
|
const seen = /* @__PURE__ */ new Set();
|
|
38044
38085
|
const suggestions = [];
|
|
38045
38086
|
for (const entry of [...collectProjectContextSuggestions(mesh), ...collectPackageScriptSuggestions(workspace)]) {
|
|
38046
|
-
const
|
|
38047
|
-
if (seen.has(
|
|
38048
|
-
seen.add(
|
|
38087
|
+
const key2 = `${entry.command} ${(entry.args || []).join(" ")}`.trim();
|
|
38088
|
+
if (seen.has(key2)) continue;
|
|
38089
|
+
seen.add(key2);
|
|
38049
38090
|
suggestions.push(entry);
|
|
38050
38091
|
}
|
|
38051
38092
|
return {
|
|
@@ -41563,6 +41604,9 @@ Next step: ${nextStep}`;
|
|
|
41563
41604
|
"use strict";
|
|
41564
41605
|
}
|
|
41565
41606
|
});
|
|
41607
|
+
function localCoordinatorDaemonId() {
|
|
41608
|
+
return canonicalDaemonId(readNonEmptyString2(loadConfig2().machineId));
|
|
41609
|
+
}
|
|
41566
41610
|
function __resetIdleAutoFastForwardForTests() {
|
|
41567
41611
|
idleAutoFastForwardLastAttempt.clear();
|
|
41568
41612
|
}
|
|
@@ -41648,6 +41692,7 @@ Next step: ${nextStep}`;
|
|
|
41648
41692
|
if (timer) clearTimeout(timer);
|
|
41649
41693
|
LOG2.error("MeshQueue", `Failed to dispatch task via ${ctx.transport} to node ${ctx.nodeId}: ${e?.message}`);
|
|
41650
41694
|
updateSessionDeliveryStatus(delivery.id, "failed", { lastError: e?.message, incrementAttempt: true });
|
|
41695
|
+
endTaskDispatchInFlight(ctx.meshId, ctx.task.id);
|
|
41651
41696
|
updateTaskStatus(ctx.meshId, ctx.task.id, "pending");
|
|
41652
41697
|
try {
|
|
41653
41698
|
appendLedgerEntry(ctx.meshId, {
|
|
@@ -41721,10 +41766,11 @@ Next step: ${nextStep}`;
|
|
|
41721
41766
|
return false;
|
|
41722
41767
|
}
|
|
41723
41768
|
LOG2.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
|
|
41769
|
+
beginTaskDispatchInFlight(meshId, task.id);
|
|
41724
41770
|
if (node?.daemonId && components.dispatchMeshCommand) {
|
|
41725
41771
|
const isLocalNode = components.cliManager.adapters.has(sessionId);
|
|
41726
41772
|
if (!isLocalNode) {
|
|
41727
|
-
const localDaemonIdForDispatch =
|
|
41773
|
+
const localDaemonIdForDispatch = localCoordinatorDaemonId();
|
|
41728
41774
|
const sourceCoordinatorSessionId = readNonEmptyString2(task.sourceCoordinatorSessionId) || void 0;
|
|
41729
41775
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
41730
41776
|
const remoteDaemonId = node.daemonId;
|
|
@@ -41763,7 +41809,7 @@ Next step: ${nextStep}`;
|
|
|
41763
41809
|
try {
|
|
41764
41810
|
const inst = components.instanceManager.getInstance(sessionId);
|
|
41765
41811
|
if (inst && typeof inst.updateSettings === "function") {
|
|
41766
|
-
const localDaemonId =
|
|
41812
|
+
const localDaemonId = localCoordinatorDaemonId();
|
|
41767
41813
|
const localSourceCoordinatorSessionId = readNonEmptyString2(task.sourceCoordinatorSessionId);
|
|
41768
41814
|
inst.updateSettings({
|
|
41769
41815
|
meshNodeFor: meshId,
|
|
@@ -41788,7 +41834,7 @@ Next step: ${nextStep}`;
|
|
|
41788
41834
|
meshId,
|
|
41789
41835
|
nodeId,
|
|
41790
41836
|
taskId: task.id,
|
|
41791
|
-
...
|
|
41837
|
+
...localCoordinatorDaemonId() ? { coordinatorDaemonId: localCoordinatorDaemonId() } : {},
|
|
41792
41838
|
...readNonEmptyString2(task.sourceCoordinatorSessionId) ? { coordinatorSessionId: readNonEmptyString2(task.sourceCoordinatorSessionId) } : {}
|
|
41793
41839
|
}
|
|
41794
41840
|
}),
|
|
@@ -41800,7 +41846,7 @@ Next step: ${nextStep}`;
|
|
|
41800
41846
|
task,
|
|
41801
41847
|
transport: "local",
|
|
41802
41848
|
...readNonEmptyString2(task.sourceCoordinatorSessionId) ? { sourceCoordinatorSessionId: readNonEmptyString2(task.sourceCoordinatorSessionId) } : {},
|
|
41803
|
-
...
|
|
41849
|
+
...localCoordinatorDaemonId() ? { sourceCoordinatorDaemonId: localCoordinatorDaemonId() } : {}
|
|
41804
41850
|
}
|
|
41805
41851
|
);
|
|
41806
41852
|
return true;
|
|
@@ -41882,8 +41928,8 @@ Next step: ${nextStep}`;
|
|
|
41882
41928
|
}
|
|
41883
41929
|
function sweepExpiredCooldowns() {
|
|
41884
41930
|
const now = Date.now();
|
|
41885
|
-
for (const [
|
|
41886
|
-
if (now >= until) autoLaunchCooldownUntil.delete(
|
|
41931
|
+
for (const [key2, until] of autoLaunchCooldownUntil) {
|
|
41932
|
+
if (now >= until) autoLaunchCooldownUntil.delete(key2);
|
|
41887
41933
|
}
|
|
41888
41934
|
}
|
|
41889
41935
|
function normalizeProviderPriority(policy) {
|
|
@@ -41929,7 +41975,7 @@ Next step: ${nextStep}`;
|
|
|
41929
41975
|
const settings = state.settings || {};
|
|
41930
41976
|
if (readNonEmptyString2(settings.meshNodeFor) !== meshId) return false;
|
|
41931
41977
|
const instNodeId = readNonEmptyString2(settings.meshNodeId) || readNonEmptyString2(settings.nodeId);
|
|
41932
|
-
if (instNodeId
|
|
41978
|
+
if (!daemonIdsEquivalent(instNodeId, nodeId)) return false;
|
|
41933
41979
|
const sessionId = readNonEmptyString2(state.instanceId);
|
|
41934
41980
|
if (currentSessionId && sessionId === currentSessionId && isIdleSessionState(state)) return false;
|
|
41935
41981
|
return sessionStateLooksActive(state);
|
|
@@ -41961,7 +42007,7 @@ Next step: ${nextStep}`;
|
|
|
41961
42007
|
const daemonId = readNonEmptyString2(node?.daemonId);
|
|
41962
42008
|
if (!daemonId) return { mode: "skip", reason: "remote_auto_launch_unsupported" };
|
|
41963
42009
|
if (!components.dispatchMeshCommand) return { mode: "skip", reason: "remote_auto_launch_unsupported" };
|
|
41964
|
-
const coordinatorDaemonId =
|
|
42010
|
+
const coordinatorDaemonId = localCoordinatorDaemonId();
|
|
41965
42011
|
if (!coordinatorDaemonId) return { mode: "skip", reason: "remote_auto_launch_no_coordinator_daemon_id" };
|
|
41966
42012
|
return { mode: "remote", daemonId, coordinatorDaemonId };
|
|
41967
42013
|
}
|
|
@@ -41972,7 +42018,7 @@ Next step: ${nextStep}`;
|
|
|
41972
42018
|
return getQueue(meshId, { status: ["assigned"] }).filter(isTaskReadonly).length;
|
|
41973
42019
|
}
|
|
41974
42020
|
function nodeHasActiveAssignment(meshId, nodeId) {
|
|
41975
|
-
return getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedNodeId
|
|
42021
|
+
return getQueue(meshId, { status: ["assigned"] }).some((task) => daemonIdsEquivalent(task.assignedNodeId, nodeId));
|
|
41976
42022
|
}
|
|
41977
42023
|
function nodeActiveLoad(meshId, nodeId) {
|
|
41978
42024
|
return MeshRuntimeStore.getInstance().nodeActiveAssignmentCount(meshId, nodeId);
|
|
@@ -42002,7 +42048,7 @@ Next step: ${nextStep}`;
|
|
|
42002
42048
|
});
|
|
42003
42049
|
}
|
|
42004
42050
|
function activeProviderAssignedCount(meshId, nodeId, providerType) {
|
|
42005
|
-
return getQueue(meshId, { status: ["assigned"] }).filter((task) => task.assignedNodeId
|
|
42051
|
+
return getQueue(meshId, { status: ["assigned"] }).filter((task) => daemonIdsEquivalent(task.assignedNodeId, nodeId) && task.assignedProviderType === providerType).length;
|
|
42006
42052
|
}
|
|
42007
42053
|
function sessionHasActiveAssignment(meshId, sessionId) {
|
|
42008
42054
|
if (getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedSessionId === sessionId)) {
|
|
@@ -42021,7 +42067,7 @@ Next step: ${nextStep}`;
|
|
|
42021
42067
|
const settings = state.settings || {};
|
|
42022
42068
|
if (readNonEmptyString2(settings.meshNodeFor) !== meshId) return false;
|
|
42023
42069
|
const instNodeId = readNonEmptyString2(settings.meshNodeId) || readNonEmptyString2(settings.nodeId);
|
|
42024
|
-
if (instNodeId
|
|
42070
|
+
if (!daemonIdsEquivalent(instNodeId, nodeId)) return false;
|
|
42025
42071
|
const status = readNonEmptyString2(state.status).toLowerCase();
|
|
42026
42072
|
return !isTerminalSessionStatus(status);
|
|
42027
42073
|
}).length;
|
|
@@ -42555,6 +42601,7 @@ Next step: ${nextStep}`;
|
|
|
42555
42601
|
init_mesh_events_utils();
|
|
42556
42602
|
init_mesh_events_pending();
|
|
42557
42603
|
init_worktree_bootstrap_config();
|
|
42604
|
+
init_mesh_task_inflight();
|
|
42558
42605
|
IDLE_AUTO_FAST_FORWARD_THROTTLE_MS = 30 * 60 * 1e3;
|
|
42559
42606
|
idleAutoFastForwardLastAttempt = /* @__PURE__ */ new Map();
|
|
42560
42607
|
DISPATCH_CONFIRM_TIMEOUT_MS = 12e4;
|
|
@@ -42653,8 +42700,8 @@ Next step: ${nextStep}`;
|
|
|
42653
42700
|
if (last !== void 0 && now - last < UNROUTABLE_DIAGNOSTIC_DEDUP_MS) return false;
|
|
42654
42701
|
recentUnroutableDiagnostics.set(dedupKey, now);
|
|
42655
42702
|
if (recentUnroutableDiagnostics.size > 256) {
|
|
42656
|
-
for (const [
|
|
42657
|
-
if (now - ts2 >= UNROUTABLE_DIAGNOSTIC_DEDUP_MS) recentUnroutableDiagnostics.delete(
|
|
42703
|
+
for (const [key2, ts2] of recentUnroutableDiagnostics) {
|
|
42704
|
+
if (now - ts2 >= UNROUTABLE_DIAGNOSTIC_DEDUP_MS) recentUnroutableDiagnostics.delete(key2);
|
|
42658
42705
|
}
|
|
42659
42706
|
}
|
|
42660
42707
|
try {
|
|
@@ -42916,9 +42963,9 @@ Next step: ${nextStep}`;
|
|
|
42916
42963
|
for (const line of stdout.split("\n")) {
|
|
42917
42964
|
const m = line.match(/^\s*Pages\s+([^:]+):\s+([\d,]+)\s*\.?/);
|
|
42918
42965
|
if (!m) continue;
|
|
42919
|
-
const
|
|
42966
|
+
const key2 = m[1].trim().toLowerCase().replace(/\s+/g, "_");
|
|
42920
42967
|
const n = parseInt(m[2].replace(/,/g, ""), 10);
|
|
42921
|
-
if (!Number.isNaN(n)) counts[
|
|
42968
|
+
if (!Number.isNaN(n)) counts[key2] = n;
|
|
42922
42969
|
}
|
|
42923
42970
|
const free = counts["free"] ?? 0;
|
|
42924
42971
|
const inactive = counts["inactive"] ?? 0;
|
|
@@ -43149,7 +43196,7 @@ Next step: ${nextStep}`;
|
|
|
43149
43196
|
if (Array.isArray(value)) return value.map((item) => trimStructuredStrings(item, maxChars));
|
|
43150
43197
|
if (!value || typeof value !== "object") return value;
|
|
43151
43198
|
return Object.fromEntries(
|
|
43152
|
-
Object.entries(value).map(([
|
|
43199
|
+
Object.entries(value).map(([key2, nested]) => [key2, trimStructuredStrings(nested, maxChars)])
|
|
43153
43200
|
);
|
|
43154
43201
|
}
|
|
43155
43202
|
function estimateBytes(value) {
|
|
@@ -43738,9 +43785,9 @@ Next step: ${nextStep}`;
|
|
|
43738
43785
|
function readStringField(value) {
|
|
43739
43786
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
43740
43787
|
}
|
|
43741
|
-
function readRecordField(message, meta3,
|
|
43788
|
+
function readRecordField(message, meta3, key2) {
|
|
43742
43789
|
const record2 = message;
|
|
43743
|
-
return record2[
|
|
43790
|
+
return record2[key2] ?? meta3?.[key2];
|
|
43744
43791
|
}
|
|
43745
43792
|
function readVisibilityField(message, meta3) {
|
|
43746
43793
|
return readStringField(readRecordField(message, meta3, "visibility"));
|
|
@@ -43751,7 +43798,7 @@ Next step: ${nextStep}`;
|
|
|
43751
43798
|
}
|
|
43752
43799
|
function hasBooleanMarker(message, meta3, keys) {
|
|
43753
43800
|
const record2 = message;
|
|
43754
|
-
return keys.some((
|
|
43801
|
+
return keys.some((key2) => record2[key2] === true || meta3?.[key2] === true);
|
|
43755
43802
|
}
|
|
43756
43803
|
function isActivityKind(kind) {
|
|
43757
43804
|
return kind === "thought" || kind === "tool" || kind === "terminal";
|
|
@@ -43955,9 +44002,9 @@ Next step: ${nextStep}`;
|
|
|
43955
44002
|
const values = {};
|
|
43956
44003
|
const explicit = data.controlValues;
|
|
43957
44004
|
if (explicit && typeof explicit === "object") {
|
|
43958
|
-
for (const [
|
|
44005
|
+
for (const [key2, value] of Object.entries(explicit)) {
|
|
43959
44006
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
43960
|
-
values[
|
|
44007
|
+
values[key2] = value;
|
|
43961
44008
|
}
|
|
43962
44009
|
}
|
|
43963
44010
|
}
|
|
@@ -44416,26 +44463,26 @@ ${cleanBody}`;
|
|
|
44416
44463
|
if (!workspace) return void 0;
|
|
44417
44464
|
return options.getGitSummaryForWorkspace?.(workspace) || void 0;
|
|
44418
44465
|
}
|
|
44419
|
-
function findCdpManager(cdpManagers,
|
|
44420
|
-
const exact = cdpManagers.get(
|
|
44466
|
+
function findCdpManager(cdpManagers, key2) {
|
|
44467
|
+
const exact = cdpManagers.get(key2);
|
|
44421
44468
|
if (exact) return exact.isConnected ? exact : null;
|
|
44422
|
-
const prefix =
|
|
44469
|
+
const prefix = key2 + "_";
|
|
44423
44470
|
const matches = [...cdpManagers.entries()].filter(([k, m]) => m.isConnected && k.startsWith(prefix));
|
|
44424
44471
|
if (matches.length === 1) return matches[0][1];
|
|
44425
44472
|
return null;
|
|
44426
44473
|
}
|
|
44427
|
-
function hasCdpManager(cdpManagers,
|
|
44428
|
-
if (cdpManagers.has(
|
|
44429
|
-
const prefix =
|
|
44474
|
+
function hasCdpManager(cdpManagers, key2) {
|
|
44475
|
+
if (cdpManagers.has(key2)) return true;
|
|
44476
|
+
const prefix = key2 + "_";
|
|
44430
44477
|
for (const k of cdpManagers.keys()) {
|
|
44431
44478
|
if (k.startsWith(prefix)) return true;
|
|
44432
44479
|
}
|
|
44433
44480
|
return false;
|
|
44434
44481
|
}
|
|
44435
|
-
function isCdpConnected(cdpManagers,
|
|
44436
|
-
const exact = cdpManagers.get(
|
|
44482
|
+
function isCdpConnected(cdpManagers, key2) {
|
|
44483
|
+
const exact = cdpManagers.get(key2);
|
|
44437
44484
|
if (exact?.isConnected) return true;
|
|
44438
|
-
const prefix =
|
|
44485
|
+
const prefix = key2 + "_";
|
|
44439
44486
|
for (const [k, m] of cdpManagers.entries()) {
|
|
44440
44487
|
if (m.isConnected && k.startsWith(prefix)) return true;
|
|
44441
44488
|
}
|
|
@@ -46333,9 +46380,9 @@ ${cleanBody}`;
|
|
|
46333
46380
|
for (const event of pending) {
|
|
46334
46381
|
if (!shouldForceInjectMeshEvent(event.event)) continue;
|
|
46335
46382
|
const fingerprint = buildPendingEventFingerprint(event);
|
|
46336
|
-
const
|
|
46337
|
-
if (heldEventLedgerRecorded.has(
|
|
46338
|
-
heldEventLedgerRecorded.add(
|
|
46383
|
+
const key2 = `${meshId}::${fingerprint || `${event.event}::${event.nodeId || ""}::${event.queuedAt}`}`;
|
|
46384
|
+
if (heldEventLedgerRecorded.has(key2)) continue;
|
|
46385
|
+
heldEventLedgerRecorded.add(key2);
|
|
46339
46386
|
const finalSummary = readMeshCompletionSummary(event.metadataEvent);
|
|
46340
46387
|
try {
|
|
46341
46388
|
appendLedgerEntry(meshId, {
|
|
@@ -46356,7 +46403,7 @@ ${cleanBody}`;
|
|
|
46356
46403
|
});
|
|
46357
46404
|
LOG2.info("MeshReconcile", `Ledger-recorded held ${event.event} for mesh ${meshId} (reason ${reason}) \u2014 recoverable from ledger`);
|
|
46358
46405
|
} catch (e) {
|
|
46359
|
-
heldEventLedgerRecorded.delete(
|
|
46406
|
+
heldEventLedgerRecorded.delete(key2);
|
|
46360
46407
|
LOG2.warn("MeshReconcile", `Failed to ledger-record held ${event.event} for mesh ${meshId}: ${e?.message || e}`);
|
|
46361
46408
|
}
|
|
46362
46409
|
}
|
|
@@ -46821,9 +46868,9 @@ ${cleanBody}`;
|
|
|
46821
46868
|
const activeTaskKeys = new Set(
|
|
46822
46869
|
dispatches.map((d) => readNonEmptyString2(d.taskId)).filter(Boolean).map((taskId) => inFlightSynthKey(mesh.id, taskId))
|
|
46823
46870
|
);
|
|
46824
|
-
for (const
|
|
46825
|
-
if (
|
|
46826
|
-
inFlightAckedHoldState.delete(
|
|
46871
|
+
for (const key2 of inFlightAckedHoldState.keys()) {
|
|
46872
|
+
if (key2.startsWith(`${mesh.id}::`) && !activeTaskKeys.has(key2)) {
|
|
46873
|
+
inFlightAckedHoldState.delete(key2);
|
|
46827
46874
|
}
|
|
46828
46875
|
}
|
|
46829
46876
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
@@ -48411,8 +48458,8 @@ ${cleanBody}`;
|
|
|
48411
48458
|
label += " " + next.trim();
|
|
48412
48459
|
j += 1;
|
|
48413
48460
|
}
|
|
48414
|
-
const
|
|
48415
|
-
buttons.push({ index: idx, label, key, current });
|
|
48461
|
+
const key2 = keyTemplate.replace(/\{index\}/g, String(idx));
|
|
48462
|
+
buttons.push({ index: idx, label, key: key2, current });
|
|
48416
48463
|
i = j - 1;
|
|
48417
48464
|
}
|
|
48418
48465
|
} else {
|
|
@@ -48422,8 +48469,8 @@ ${cleanBody}`;
|
|
|
48422
48469
|
const idx = Number(m[1]);
|
|
48423
48470
|
const label = String(m[2] ?? "").trim();
|
|
48424
48471
|
if (!Number.isFinite(idx) || idx <= 0 || !label) continue;
|
|
48425
|
-
const
|
|
48426
|
-
buttons.push({ index: idx, label, key, current: hasCursorMarker(m[0]) });
|
|
48472
|
+
const key2 = keyTemplate.replace(/\{index\}/g, String(idx));
|
|
48473
|
+
buttons.push({ index: idx, label, key: key2, current: hasCursorMarker(m[0]) });
|
|
48427
48474
|
}
|
|
48428
48475
|
}
|
|
48429
48476
|
const block2 = lastContiguousNumberedBlock(buttons);
|
|
@@ -48501,12 +48548,12 @@ ${cleanBody}`;
|
|
|
48501
48548
|
return { kind: "elapsed", result, detail: `elapsed ${age}ms / ${cond.elapsed_ms}ms`, remainingMs };
|
|
48502
48549
|
}
|
|
48503
48550
|
if (isStable(cond)) {
|
|
48504
|
-
const
|
|
48505
|
-
const lastChanged = clock.regionLastChangedAt.get(
|
|
48551
|
+
const key2 = regionKey(cond.cursor_above);
|
|
48552
|
+
const lastChanged = clock.regionLastChangedAt.get(key2) ?? clock.stateEnteredAt;
|
|
48506
48553
|
const stableFor = clock.now - lastChanged;
|
|
48507
48554
|
const result = stableFor >= cond.stable_ms;
|
|
48508
48555
|
const remainingMs = result ? 0 : cond.stable_ms - stableFor;
|
|
48509
|
-
const where =
|
|
48556
|
+
const where = key2 === WHOLE_SCREEN ? "screen" : `cursor_above=${cond.cursor_above}`;
|
|
48510
48557
|
return { kind: "stable", result, detail: `stable ${where} ${stableFor}ms / ${cond.stable_ms}ms`, remainingMs };
|
|
48511
48558
|
}
|
|
48512
48559
|
if (isRegex(cond) || isChanged(cond)) {
|
|
@@ -52441,16 +52488,16 @@ ${lastSnapshot}`;
|
|
|
52441
52488
|
}
|
|
52442
52489
|
function buildFsShim() {
|
|
52443
52490
|
const shim = {};
|
|
52444
|
-
for (const
|
|
52445
|
-
if (
|
|
52446
|
-
const real = nodeFs[
|
|
52447
|
-
if (real !== void 0) shim[
|
|
52491
|
+
for (const key2 of FS_READ_ONLY_MEMBERS) {
|
|
52492
|
+
if (key2 === "promises") continue;
|
|
52493
|
+
const real = nodeFs[key2];
|
|
52494
|
+
if (real !== void 0) shim[key2] = real;
|
|
52448
52495
|
}
|
|
52449
52496
|
const realPromises = nodeFs.promises || {};
|
|
52450
52497
|
const promisesShim = {};
|
|
52451
|
-
for (const
|
|
52452
|
-
const real = realPromises[
|
|
52453
|
-
if (real !== void 0) promisesShim[
|
|
52498
|
+
for (const key2 of FS_PROMISES_READ_ONLY_MEMBERS) {
|
|
52499
|
+
const real = realPromises[key2];
|
|
52500
|
+
if (real !== void 0) promisesShim[key2] = real;
|
|
52454
52501
|
}
|
|
52455
52502
|
shim.promises = promisesShim;
|
|
52456
52503
|
return shim;
|
|
@@ -52533,10 +52580,10 @@ ${lastSnapshot}`;
|
|
|
52533
52580
|
function buildProcessShim() {
|
|
52534
52581
|
const real = globalThis.process;
|
|
52535
52582
|
const shim = /* @__PURE__ */ Object.create(null);
|
|
52536
|
-
for (const
|
|
52537
|
-
if (DANGEROUS_PROCESS_METHODS.has(String(
|
|
52583
|
+
for (const key2 of Object.keys(real)) {
|
|
52584
|
+
if (DANGEROUS_PROCESS_METHODS.has(String(key2))) continue;
|
|
52538
52585
|
try {
|
|
52539
|
-
shim[
|
|
52586
|
+
shim[key2] = real[key2];
|
|
52540
52587
|
} catch {
|
|
52541
52588
|
}
|
|
52542
52589
|
}
|
|
@@ -52872,6 +52919,7 @@ ${lastSnapshot}`;
|
|
|
52872
52919
|
buildToolChatMessage: () => buildToolChatMessage,
|
|
52873
52920
|
buildUserChatMessage: () => buildUserChatMessage,
|
|
52874
52921
|
cancelTask: () => cancelTask,
|
|
52922
|
+
canonicalDaemonId: () => canonicalDaemonId,
|
|
52875
52923
|
claimNextTask: () => claimNextTask,
|
|
52876
52924
|
classifyChatMessageVisibility: () => classifyChatMessageVisibility,
|
|
52877
52925
|
classifyHotChatSessionsForSubscriptionFlush: () => classifyHotChatSessionsForSubscriptionFlush2,
|
|
@@ -53724,10 +53772,10 @@ ${lastSnapshot}`;
|
|
|
53724
53772
|
const compactSummary = createGitCompactSummary(status, diffSummary);
|
|
53725
53773
|
const timestamp = this.now();
|
|
53726
53774
|
const seq = ++this.seq;
|
|
53727
|
-
const
|
|
53775
|
+
const key2 = this.keyForWorkspace(normalized.workspace);
|
|
53728
53776
|
const update = {
|
|
53729
53777
|
topic: "workspace.git",
|
|
53730
|
-
key,
|
|
53778
|
+
key: key2,
|
|
53731
53779
|
workspace: normalized.workspace,
|
|
53732
53780
|
status,
|
|
53733
53781
|
diffSummary,
|
|
@@ -53735,7 +53783,7 @@ ${lastSnapshot}`;
|
|
|
53735
53783
|
timestamp
|
|
53736
53784
|
};
|
|
53737
53785
|
const cacheEntry = {
|
|
53738
|
-
key,
|
|
53786
|
+
key: key2,
|
|
53739
53787
|
workspace: normalized.workspace,
|
|
53740
53788
|
status,
|
|
53741
53789
|
diffSummary,
|
|
@@ -53877,11 +53925,11 @@ ${lastSnapshot}`;
|
|
|
53877
53925
|
}
|
|
53878
53926
|
return { path: args.path.trim() };
|
|
53879
53927
|
}
|
|
53880
|
-
function validateSnapshotId(args,
|
|
53881
|
-
if (typeof args?.[
|
|
53882
|
-
return failure("invalid_args", `${
|
|
53928
|
+
function validateSnapshotId(args, key2) {
|
|
53929
|
+
if (typeof args?.[key2] !== "string" || !args[key2].trim()) {
|
|
53930
|
+
return failure("invalid_args", `${key2} must be a non-empty string`);
|
|
53883
53931
|
}
|
|
53884
|
-
return args[
|
|
53932
|
+
return args[key2].trim();
|
|
53885
53933
|
}
|
|
53886
53934
|
function parseSnapshotReason(args) {
|
|
53887
53935
|
if (args?.reason === void 0 || args?.reason === null || args?.reason === "") {
|
|
@@ -56249,10 +56297,10 @@ ${lastSnapshot}`;
|
|
|
56249
56297
|
return events;
|
|
56250
56298
|
}
|
|
56251
56299
|
/** Cooldown check — prevent sending the same notification too frequently */
|
|
56252
|
-
shouldAlert(
|
|
56253
|
-
const last = this.lastAlertTime.get(
|
|
56300
|
+
shouldAlert(key2, now) {
|
|
56301
|
+
const last = this.lastAlertTime.get(key2) || 0;
|
|
56254
56302
|
if (now - last > this.config.alertCooldownSec * 1e3) {
|
|
56255
|
-
this.lastAlertTime.set(
|
|
56303
|
+
this.lastAlertTime.set(key2, now);
|
|
56256
56304
|
return true;
|
|
56257
56305
|
}
|
|
56258
56306
|
return false;
|
|
@@ -56296,16 +56344,16 @@ ${lastSnapshot}`;
|
|
|
56296
56344
|
var savedHistoryRollupInFlight = /* @__PURE__ */ new Set();
|
|
56297
56345
|
var BOUNDED_TAIL_CACHE_MAX_ENTRIES = 64;
|
|
56298
56346
|
var boundedTailReadCache = /* @__PURE__ */ new Map();
|
|
56299
|
-
function readBoundedTailCache(
|
|
56300
|
-
const cached3 = boundedTailReadCache.get(
|
|
56347
|
+
function readBoundedTailCache(key2, signature) {
|
|
56348
|
+
const cached3 = boundedTailReadCache.get(key2);
|
|
56301
56349
|
if (!cached3 || cached3.signature !== signature) return null;
|
|
56302
|
-
boundedTailReadCache.delete(
|
|
56303
|
-
boundedTailReadCache.set(
|
|
56350
|
+
boundedTailReadCache.delete(key2);
|
|
56351
|
+
boundedTailReadCache.set(key2, cached3);
|
|
56304
56352
|
return cached3.result;
|
|
56305
56353
|
}
|
|
56306
|
-
function writeBoundedTailCache(
|
|
56307
|
-
boundedTailReadCache.delete(
|
|
56308
|
-
boundedTailReadCache.set(
|
|
56354
|
+
function writeBoundedTailCache(key2, signature, result) {
|
|
56355
|
+
boundedTailReadCache.delete(key2);
|
|
56356
|
+
boundedTailReadCache.set(key2, { signature, result });
|
|
56309
56357
|
while (boundedTailReadCache.size > BOUNDED_TAIL_CACHE_MAX_ENTRIES) {
|
|
56310
56358
|
const oldest = boundedTailReadCache.keys().next().value;
|
|
56311
56359
|
if (oldest === void 0) break;
|
|
@@ -56741,21 +56789,21 @@ ${lastSnapshot}`;
|
|
|
56741
56789
|
return shouldScheduleSavedHistoryRollup(size);
|
|
56742
56790
|
}
|
|
56743
56791
|
function scheduleSavedHistoryRollup(agentType, historySessionId) {
|
|
56744
|
-
const
|
|
56745
|
-
if (!historySessionId || savedHistoryRollupInFlight.has(
|
|
56746
|
-
savedHistoryRollupInFlight.add(
|
|
56792
|
+
const key2 = `${agentType}:${historySessionId}`;
|
|
56793
|
+
if (!historySessionId || savedHistoryRollupInFlight.has(key2)) return;
|
|
56794
|
+
savedHistoryRollupInFlight.add(key2);
|
|
56747
56795
|
setTimeout(() => {
|
|
56748
56796
|
try {
|
|
56749
56797
|
new ChatHistoryWriter().compactHistorySession(agentType, historySessionId);
|
|
56750
56798
|
} finally {
|
|
56751
|
-
savedHistoryRollupInFlight.delete(
|
|
56799
|
+
savedHistoryRollupInFlight.delete(key2);
|
|
56752
56800
|
}
|
|
56753
56801
|
}, 0);
|
|
56754
56802
|
}
|
|
56755
56803
|
function scheduleSavedHistoryBackgroundRefresh(agentType, dir) {
|
|
56756
|
-
const
|
|
56757
|
-
if (savedHistoryBackgroundRefresh.has(
|
|
56758
|
-
savedHistoryBackgroundRefresh.add(
|
|
56804
|
+
const key2 = `${agentType}:${dir}`;
|
|
56805
|
+
if (savedHistoryBackgroundRefresh.has(key2)) return;
|
|
56806
|
+
savedHistoryBackgroundRefresh.add(key2);
|
|
56759
56807
|
setTimeout(() => {
|
|
56760
56808
|
try {
|
|
56761
56809
|
if (!fs6.existsSync(dir)) return;
|
|
@@ -56775,7 +56823,7 @@ ${lastSnapshot}`;
|
|
|
56775
56823
|
}
|
|
56776
56824
|
} catch {
|
|
56777
56825
|
} finally {
|
|
56778
|
-
savedHistoryBackgroundRefresh.delete(
|
|
56826
|
+
savedHistoryBackgroundRefresh.delete(key2);
|
|
56779
56827
|
}
|
|
56780
56828
|
}, 0);
|
|
56781
56829
|
}
|
|
@@ -57541,14 +57589,14 @@ ${lastSnapshot}`;
|
|
|
57541
57589
|
return false;
|
|
57542
57590
|
}
|
|
57543
57591
|
}
|
|
57544
|
-
function getNativeHistoryScriptName(canonicalHistory,
|
|
57545
|
-
const configured = canonicalHistory?.scripts?.[
|
|
57592
|
+
function getNativeHistoryScriptName(canonicalHistory, key2) {
|
|
57593
|
+
const configured = canonicalHistory?.scripts?.[key2];
|
|
57546
57594
|
if (typeof configured === "string" && configured.trim()) return configured.trim();
|
|
57547
|
-
return
|
|
57595
|
+
return key2 === "readSession" ? "readNativeHistory" : "listNativeHistory";
|
|
57548
57596
|
}
|
|
57549
|
-
function getProviderNativeHistoryScript(scripts, canonicalHistory,
|
|
57597
|
+
function getProviderNativeHistoryScript(scripts, canonicalHistory, key2) {
|
|
57550
57598
|
if (!canonicalHistory?.scripts) return null;
|
|
57551
|
-
const fn = scripts?.[getNativeHistoryScriptName(canonicalHistory,
|
|
57599
|
+
const fn = scripts?.[getNativeHistoryScriptName(canonicalHistory, key2)];
|
|
57552
57600
|
return typeof fn === "function" ? fn : null;
|
|
57553
57601
|
}
|
|
57554
57602
|
function normalizeProviderNativeHistoryRecords(agentType, historySessionId, records) {
|
|
@@ -58272,11 +58320,11 @@ ${effect.notification.body || ""}`.trim();
|
|
|
58272
58320
|
throw new Error(`${source}: controlValues must be an object when provided`);
|
|
58273
58321
|
}
|
|
58274
58322
|
const normalized = {};
|
|
58275
|
-
for (const [
|
|
58323
|
+
for (const [key2, value] of Object.entries(controlValues)) {
|
|
58276
58324
|
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
58277
|
-
throw new Error(`${source}: controlValues.${
|
|
58325
|
+
throw new Error(`${source}: controlValues.${key2} must be string, number, or boolean`);
|
|
58278
58326
|
}
|
|
58279
|
-
normalized[
|
|
58327
|
+
normalized[key2] = value;
|
|
58280
58328
|
}
|
|
58281
58329
|
return normalized;
|
|
58282
58330
|
}
|
|
@@ -59023,7 +59071,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59023
59071
|
for (const [ide, ports] of Object.entries(portMap)) {
|
|
59024
59072
|
const primaryPort = ports[0];
|
|
59025
59073
|
const alreadyConnected = [...this.ctx.cdpManagers.entries()].some(
|
|
59026
|
-
([
|
|
59074
|
+
([key2, m]) => m.isConnected && (key2 === ide || key2.startsWith(ide + "_"))
|
|
59027
59075
|
);
|
|
59028
59076
|
if (alreadyConnected) continue;
|
|
59029
59077
|
if (this.opts.multiWindow) {
|
|
@@ -59195,8 +59243,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59195
59243
|
for (let i = 0; i < targets.length; i++) {
|
|
59196
59244
|
const target = targets[i];
|
|
59197
59245
|
let alreadyTracked = false;
|
|
59198
|
-
for (const [
|
|
59199
|
-
if ((
|
|
59246
|
+
for (const [key2, m] of cdpManagers.entries()) {
|
|
59247
|
+
if ((key2 === ide || key2.startsWith(`${ide}_`)) && m.targetId === target.id) {
|
|
59200
59248
|
alreadyTracked = true;
|
|
59201
59249
|
break;
|
|
59202
59250
|
}
|
|
@@ -59228,29 +59276,29 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59228
59276
|
async pruneStaleManagers(port, ide, targets) {
|
|
59229
59277
|
const trackedTargetIds = new Set(targets.map((target) => target.id));
|
|
59230
59278
|
const removals = [];
|
|
59231
|
-
for (const [
|
|
59232
|
-
if (!(
|
|
59279
|
+
for (const [key2, manager] of this.config.cdpManagers.entries()) {
|
|
59280
|
+
if (!(key2 === ide || key2.startsWith(`${ide}_`))) continue;
|
|
59233
59281
|
if (manager.getPort() !== port) continue;
|
|
59234
59282
|
if (targets.length === 0) {
|
|
59235
|
-
removals.push({ key, manager, reason: "ide_closed" });
|
|
59283
|
+
removals.push({ key: key2, manager, reason: "ide_closed" });
|
|
59236
59284
|
continue;
|
|
59237
59285
|
}
|
|
59238
59286
|
if (manager.targetId && !trackedTargetIds.has(manager.targetId)) {
|
|
59239
|
-
removals.push({ key, manager, reason: "target_closed" });
|
|
59287
|
+
removals.push({ key: key2, manager, reason: "target_closed" });
|
|
59240
59288
|
continue;
|
|
59241
59289
|
}
|
|
59242
|
-
if (
|
|
59243
|
-
removals.push({ key, manager, reason: "target_rekeyed" });
|
|
59290
|
+
if (key2 === ide && !manager.targetId && targets.length > 1) {
|
|
59291
|
+
removals.push({ key: key2, manager, reason: "target_rekeyed" });
|
|
59244
59292
|
}
|
|
59245
59293
|
}
|
|
59246
|
-
for (const { key, manager, reason } of removals) {
|
|
59294
|
+
for (const { key: key2, manager, reason } of removals) {
|
|
59247
59295
|
try {
|
|
59248
59296
|
manager.disconnect();
|
|
59249
59297
|
} catch {
|
|
59250
59298
|
}
|
|
59251
|
-
this.config.cdpManagers.delete(
|
|
59252
|
-
LOG2.info("IDE", `Detached window: ${
|
|
59253
|
-
await this.config.onDisconnected?.(ide, manager,
|
|
59299
|
+
this.config.cdpManagers.delete(key2);
|
|
59300
|
+
LOG2.info("IDE", `Detached window: ${key2} (${reason})`);
|
|
59301
|
+
await this.config.onDisconnected?.(ide, manager, key2, reason);
|
|
59254
59302
|
}
|
|
59255
59303
|
}
|
|
59256
59304
|
// ─── Periodic scanning ───
|
|
@@ -59554,7 +59602,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59554
59602
|
if (Array.isArray(value)) return value.map((entry) => sanitizeTraceValue(entry, traceContent));
|
|
59555
59603
|
if (value && typeof value === "object") {
|
|
59556
59604
|
return Object.fromEntries(
|
|
59557
|
-
Object.entries(value).map(([
|
|
59605
|
+
Object.entries(value).map(([key2, nested]) => [key2, sanitizeTraceValue(nested, traceContent)])
|
|
59558
59606
|
);
|
|
59559
59607
|
}
|
|
59560
59608
|
return value;
|
|
@@ -59563,7 +59611,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59563
59611
|
if (Array.isArray(value)) return value.map((entry) => sanitizeTraceValue(entry, traceContent));
|
|
59564
59612
|
if (value && typeof value === "object") {
|
|
59565
59613
|
return Object.fromEntries(
|
|
59566
|
-
Object.entries(value).map(([
|
|
59614
|
+
Object.entries(value).map(([key2, nested]) => [key2, sanitizeTraceValue(nested, traceContent)])
|
|
59567
59615
|
);
|
|
59568
59616
|
}
|
|
59569
59617
|
return value;
|
|
@@ -59867,8 +59915,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59867
59915
|
}
|
|
59868
59916
|
function isSupersetOf(candidate, required2) {
|
|
59869
59917
|
if (required2.size === 0) return true;
|
|
59870
|
-
for (const
|
|
59871
|
-
if (!candidate.has(
|
|
59918
|
+
for (const key2 of required2) {
|
|
59919
|
+
if (!candidate.has(key2)) return false;
|
|
59872
59920
|
}
|
|
59873
59921
|
return true;
|
|
59874
59922
|
}
|
|
@@ -59879,17 +59927,17 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59879
59927
|
var ChatSourceRegistry = class {
|
|
59880
59928
|
records = /* @__PURE__ */ new Map();
|
|
59881
59929
|
/** Snapshot of current state for diagnostics. Does not mutate. */
|
|
59882
|
-
getState(
|
|
59883
|
-
return this.records.get(
|
|
59930
|
+
getState(key2) {
|
|
59931
|
+
return this.records.get(key2)?.state ?? INITIAL_CHAT_SOURCE_STATE;
|
|
59884
59932
|
}
|
|
59885
59933
|
/** Recent transitions, newest last. Empty array when nothing has happened. */
|
|
59886
|
-
getTransitions(
|
|
59887
|
-
return this.records.get(
|
|
59934
|
+
getTransitions(key2) {
|
|
59935
|
+
return this.records.get(key2)?.transitions ?? [];
|
|
59888
59936
|
}
|
|
59889
59937
|
/** Drop a session. Caller should invoke this when the session is destroyed
|
|
59890
59938
|
* to avoid unbounded growth across long-lived daemons. */
|
|
59891
|
-
clear(
|
|
59892
|
-
this.records.delete(
|
|
59939
|
+
clear(key2) {
|
|
59940
|
+
this.records.delete(key2);
|
|
59893
59941
|
}
|
|
59894
59942
|
/** Drop all sessions. Test helper. */
|
|
59895
59943
|
clearAll() {
|
|
@@ -59901,15 +59949,15 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59901
59949
|
* under `key`; callers may treat the decision as authoritative without
|
|
59902
59950
|
* re-reading.
|
|
59903
59951
|
*/
|
|
59904
|
-
observe(
|
|
59905
|
-
const prev = this.records.get(
|
|
59952
|
+
observe(key2, observation, at = Date.now()) {
|
|
59953
|
+
const prev = this.records.get(key2);
|
|
59906
59954
|
const prevState = prev?.state ?? INITIAL_CHAT_SOURCE_STATE;
|
|
59907
59955
|
const prevLockedSince = prev?.lockedSince;
|
|
59908
59956
|
const result = transitionChatSourceState(prevState, observation, at, prevLockedSince);
|
|
59909
59957
|
const transitions = prev?.transitions ?? [];
|
|
59910
59958
|
const nextTransitions = appendTransition(transitions, result.transition);
|
|
59911
59959
|
const lockedSince = result.lockState.lockedSince;
|
|
59912
|
-
this.records.set(
|
|
59960
|
+
this.records.set(key2, {
|
|
59913
59961
|
state: result.next,
|
|
59914
59962
|
lockedSince,
|
|
59915
59963
|
transitions: nextTransitions
|
|
@@ -60590,8 +60638,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
60590
60638
|
});
|
|
60591
60639
|
return { ...history, lookup: "workspace" };
|
|
60592
60640
|
}
|
|
60593
|
-
function shouldPreserveReadChatPayloadField(
|
|
60594
|
-
return
|
|
60641
|
+
function shouldPreserveReadChatPayloadField(key2) {
|
|
60642
|
+
return key2 === "messageSource" || key2 === "transcriptProvenance";
|
|
60595
60643
|
}
|
|
60596
60644
|
function updateMessageSourceReturnedCount(value, returnedMessageCount) {
|
|
60597
60645
|
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
@@ -60761,7 +60809,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
60761
60809
|
const visibleMessages = includeActivity ? filteredMessages.filter((m) => isUserFacingChatMessage(m) || isActivityChatMessage(m)) : filterUserFacingChatMessages(filteredMessages);
|
|
60762
60810
|
const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
|
|
60763
60811
|
const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
|
|
60764
|
-
const preservedPayloadFields = Object.fromEntries(Object.entries(payload).filter(([
|
|
60812
|
+
const preservedPayloadFields = Object.fromEntries(Object.entries(payload).filter(([key2]) => shouldPreserveReadChatPayloadField(key2)));
|
|
60765
60813
|
if (preservedPayloadFields.messageSource) {
|
|
60766
60814
|
preservedPayloadFields.messageSource = updateMessageSourceReturnedCount(preservedPayloadFields.messageSource, sync.messages.length);
|
|
60767
60815
|
}
|
|
@@ -61511,8 +61559,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
61511
61559
|
const record2 = value;
|
|
61512
61560
|
const result = {};
|
|
61513
61561
|
const entries = Object.entries(record2).slice(0, normalizedOptions.maxObjectKeys);
|
|
61514
|
-
for (const [
|
|
61515
|
-
result[
|
|
61562
|
+
for (const [key2, item] of entries) {
|
|
61563
|
+
result[key2] = sanitizeDebugBundleValue(item, normalizedOptions, depth + 1, key2);
|
|
61516
61564
|
}
|
|
61517
61565
|
const remaining = Object.keys(record2).length - entries.length;
|
|
61518
61566
|
if (remaining > 0) result.__truncatedKeys = remaining;
|
|
@@ -61836,14 +61884,14 @@ ${effect.notification.body || ""}`.trim();
|
|
|
61836
61884
|
if (typeof script !== "function") return null;
|
|
61837
61885
|
return script(text);
|
|
61838
61886
|
}
|
|
61839
|
-
function isRecentDuplicateSend(
|
|
61887
|
+
function isRecentDuplicateSend(key2) {
|
|
61840
61888
|
const now = Date.now();
|
|
61841
61889
|
for (const [candidate, ts2] of recentSendByTarget.entries()) {
|
|
61842
61890
|
if (now - ts2 > RECENT_SEND_WINDOW_MS) recentSendByTarget.delete(candidate);
|
|
61843
61891
|
}
|
|
61844
|
-
const previous = recentSendByTarget.get(
|
|
61892
|
+
const previous = recentSendByTarget.get(key2);
|
|
61845
61893
|
if (previous && now - previous <= RECENT_SEND_WINDOW_MS) return true;
|
|
61846
|
-
recentSendByTarget.set(
|
|
61894
|
+
recentSendByTarget.set(key2, now);
|
|
61847
61895
|
return false;
|
|
61848
61896
|
}
|
|
61849
61897
|
function didProviderConfirmSend(result) {
|
|
@@ -62704,23 +62752,23 @@ ${effect.notification.body || ""}`.trim();
|
|
|
62704
62752
|
try {
|
|
62705
62753
|
switch (action) {
|
|
62706
62754
|
case "input_key": {
|
|
62707
|
-
const { type: evType, key, code, text, unmodifiedText, modifiers } = params;
|
|
62755
|
+
const { type: evType, key: key2, code, text, unmodifiedText, modifiers } = params;
|
|
62708
62756
|
const mod = typeof modifiers === "number" ? modifiers : 0;
|
|
62709
|
-
const vk = KEY_TO_VK[
|
|
62757
|
+
const vk = KEY_TO_VK[key2] || (key2.length === 1 ? key2.charCodeAt(0) : 0);
|
|
62710
62758
|
if (evType === "char") {
|
|
62711
62759
|
await h.getCdp().send("Input.dispatchKeyEvent", {
|
|
62712
62760
|
type: "char",
|
|
62713
|
-
key,
|
|
62761
|
+
key: key2,
|
|
62714
62762
|
code,
|
|
62715
|
-
text: text ||
|
|
62716
|
-
unmodifiedText: unmodifiedText || text ||
|
|
62763
|
+
text: text || key2,
|
|
62764
|
+
unmodifiedText: unmodifiedText || text || key2,
|
|
62717
62765
|
...vk ? { windowsVirtualKeyCode: vk, nativeVirtualKeyCode: vk } : {},
|
|
62718
62766
|
...mod ? { modifiers: mod } : {}
|
|
62719
62767
|
});
|
|
62720
62768
|
} else {
|
|
62721
62769
|
await h.getCdp().send("Input.dispatchKeyEvent", {
|
|
62722
62770
|
type: "rawKeyDown",
|
|
62723
|
-
key,
|
|
62771
|
+
key: key2,
|
|
62724
62772
|
code,
|
|
62725
62773
|
...text ? { text } : {},
|
|
62726
62774
|
...vk ? { windowsVirtualKeyCode: vk, nativeVirtualKeyCode: vk } : {},
|
|
@@ -62728,7 +62776,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
62728
62776
|
});
|
|
62729
62777
|
await h.getCdp().send("Input.dispatchKeyEvent", {
|
|
62730
62778
|
type: "keyUp",
|
|
62731
|
-
key,
|
|
62779
|
+
key: key2,
|
|
62732
62780
|
code,
|
|
62733
62781
|
...vk ? { windowsVirtualKeyCode: vk, nativeVirtualKeyCode: vk } : {},
|
|
62734
62782
|
...mod ? { modifiers: mod } : {}
|
|
@@ -63119,21 +63167,21 @@ ${effect.notification.body || ""}`.trim();
|
|
|
63119
63167
|
}
|
|
63120
63168
|
async function handleSetProviderSetting(h, args) {
|
|
63121
63169
|
const loader = h.ctx.providerLoader;
|
|
63122
|
-
const { providerType, key, value } = args || {};
|
|
63123
|
-
if (!providerType || !
|
|
63170
|
+
const { providerType, key: key2, value } = args || {};
|
|
63171
|
+
if (!providerType || !key2 || value === void 0) {
|
|
63124
63172
|
return { success: false, error: "providerType, key, and value are required" };
|
|
63125
63173
|
}
|
|
63126
|
-
const result = loader?.setSetting(providerType,
|
|
63174
|
+
const result = loader?.setSetting(providerType, key2, value);
|
|
63127
63175
|
if (result) {
|
|
63128
63176
|
if (h.ctx.instanceManager) {
|
|
63129
63177
|
const allSettings = loader?.getSettings(providerType) || {};
|
|
63130
63178
|
const updated = h.ctx.instanceManager.updateInstanceSettings(providerType, allSettings);
|
|
63131
|
-
LOG2.info("Command", `[set_provider_setting] ${providerType}.${
|
|
63179
|
+
LOG2.info("Command", `[set_provider_setting] ${providerType}.${key2}=${JSON.stringify(value)} \u2192 ${updated} instance(s) updated`);
|
|
63132
63180
|
}
|
|
63133
|
-
await h.ctx.onProviderSettingChanged?.(providerType,
|
|
63134
|
-
return { success: true, providerType, key, value };
|
|
63181
|
+
await h.ctx.onProviderSettingChanged?.(providerType, key2, value);
|
|
63182
|
+
return { success: true, providerType, key: key2, value };
|
|
63135
63183
|
}
|
|
63136
|
-
return { success: false, error: `Failed to set ${providerType}.${
|
|
63184
|
+
return { success: false, error: `Failed to set ${providerType}.${key2} \u2014 invalid key, value, or not a public setting` };
|
|
63137
63185
|
}
|
|
63138
63186
|
function handleGetProviderSourceConfig(h, _args) {
|
|
63139
63187
|
const loader = h.ctx.providerLoader;
|
|
@@ -63179,9 +63227,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
63179
63227
|
normalizedArgs.mode = normalizedArgs.value;
|
|
63180
63228
|
}
|
|
63181
63229
|
}
|
|
63182
|
-
for (const
|
|
63183
|
-
if (
|
|
63184
|
-
normalizedArgs[
|
|
63230
|
+
for (const key2 of ["mode", "model", "message", "action", "button", "text", "sessionId", "value"]) {
|
|
63231
|
+
if (key2 in normalizedArgs && !(key2.toUpperCase() in normalizedArgs)) {
|
|
63232
|
+
normalizedArgs[key2.toUpperCase()] = normalizedArgs[key2];
|
|
63185
63233
|
}
|
|
63186
63234
|
}
|
|
63187
63235
|
return normalizedArgs;
|
|
@@ -63577,10 +63625,10 @@ ${effect.notification.body || ""}`.trim();
|
|
|
63577
63625
|
"value"
|
|
63578
63626
|
];
|
|
63579
63627
|
const entries = [];
|
|
63580
|
-
for (const
|
|
63581
|
-
if (!(
|
|
63582
|
-
const value =
|
|
63583
|
-
entries.push(`${
|
|
63628
|
+
for (const key2 of preferredKeys) {
|
|
63629
|
+
if (!(key2 in args) || args[key2] === void 0) continue;
|
|
63630
|
+
const value = key2 === "text" || key2 === "message" ? `${String(args[key2] || "").length} chars` : key2 === "data" ? `${String(args[key2] || "").length} chars` : summarizeLogValue(args[key2]);
|
|
63631
|
+
entries.push(`${key2}=${value}`);
|
|
63584
63632
|
}
|
|
63585
63633
|
return entries.length ? entries.join(" ") : "{...}";
|
|
63586
63634
|
}
|
|
@@ -63632,12 +63680,12 @@ ${effect.notification.body || ""}`.trim();
|
|
|
63632
63680
|
* Get provider module — _currentProviderType (agentType priority) use.
|
|
63633
63681
|
*/
|
|
63634
63682
|
getProvider(overrideType) {
|
|
63635
|
-
const
|
|
63636
|
-
if (!
|
|
63637
|
-
const result = this._ctx.providerLoader.resolve(
|
|
63683
|
+
const key2 = overrideType || this._currentRoute.providerType || this._currentRoute.session?.providerType || this._currentRoute.managerKey;
|
|
63684
|
+
if (!key2 || !this._ctx.providerLoader) return void 0;
|
|
63685
|
+
const result = this._ctx.providerLoader.resolve(key2);
|
|
63638
63686
|
if (result) return result;
|
|
63639
|
-
const baseType =
|
|
63640
|
-
if (baseType !==
|
|
63687
|
+
const baseType = key2.split("_")[0];
|
|
63688
|
+
if (baseType !== key2) return this._ctx.providerLoader.resolve(baseType);
|
|
63641
63689
|
return void 0;
|
|
63642
63690
|
}
|
|
63643
63691
|
/** Get a provider script by name from ProviderLoader. */
|
|
@@ -63695,11 +63743,11 @@ ${effect.notification.body || ""}`.trim();
|
|
|
63695
63743
|
return this._ctx.adapters.get(target) || null;
|
|
63696
63744
|
}
|
|
63697
63745
|
// ─── Private helpers ──────────────────────────────
|
|
63698
|
-
inferProviderType(
|
|
63699
|
-
if (!
|
|
63700
|
-
const session = this._ctx.sessionRegistry?.get(
|
|
63746
|
+
inferProviderType(key2) {
|
|
63747
|
+
if (!key2) return void 0;
|
|
63748
|
+
const session = this._ctx.sessionRegistry?.get(key2);
|
|
63701
63749
|
if (session?.providerType) return session.providerType;
|
|
63702
|
-
return
|
|
63750
|
+
return key2.split("_")[0];
|
|
63703
63751
|
}
|
|
63704
63752
|
resolveRoute(args) {
|
|
63705
63753
|
const targetSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
@@ -65385,16 +65433,16 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
65385
65433
|
const m = matchAppend || matchOverride;
|
|
65386
65434
|
if (!m) continue;
|
|
65387
65435
|
const isAppend = !!matchAppend;
|
|
65388
|
-
const
|
|
65436
|
+
const key2 = m[1];
|
|
65389
65437
|
const full = path43.join(dir, name);
|
|
65390
65438
|
let content = "";
|
|
65391
65439
|
try {
|
|
65392
65440
|
content = fs38.readFileSync(full, "utf8");
|
|
65393
65441
|
} catch {
|
|
65394
65442
|
}
|
|
65395
|
-
if (!entries[
|
|
65396
|
-
if (isAppend) entries[
|
|
65397
|
-
else entries[
|
|
65443
|
+
if (!entries[key2]) entries[key2] = { override: "", append: "" };
|
|
65444
|
+
if (isAppend) entries[key2].append = content;
|
|
65445
|
+
else entries[key2].override = content;
|
|
65398
65446
|
}
|
|
65399
65447
|
}
|
|
65400
65448
|
} catch (error48) {
|
|
@@ -65406,14 +65454,14 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
65406
65454
|
const fs38 = await import("fs");
|
|
65407
65455
|
const path43 = await import("path");
|
|
65408
65456
|
const os30 = await import("os");
|
|
65409
|
-
const
|
|
65457
|
+
const key2 = typeof args?.key === "string" ? args.key.trim() : "";
|
|
65410
65458
|
const kind = args?.kind === "append" ? "append" : "override";
|
|
65411
65459
|
const content = typeof args?.content === "string" ? args.content : "";
|
|
65412
|
-
if (!
|
|
65460
|
+
if (!key2 || !/^[a-zA-Z0-9_.-]+$/.test(key2)) {
|
|
65413
65461
|
return { success: false, error: "key must match [a-zA-Z0-9_.-]+" };
|
|
65414
65462
|
}
|
|
65415
65463
|
const dir = path43.join(os30.homedir(), ".adhdev", "coordinator-prompts");
|
|
65416
|
-
const filename = kind === "append" ? `${
|
|
65464
|
+
const filename = kind === "append" ? `${key2}.append.md` : `${key2}.md`;
|
|
65417
65465
|
const full = path43.join(dir, filename);
|
|
65418
65466
|
try {
|
|
65419
65467
|
fs38.mkdirSync(dir, { recursive: true });
|
|
@@ -65422,7 +65470,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
65422
65470
|
} else if (fs38.existsSync(full)) {
|
|
65423
65471
|
fs38.unlinkSync(full);
|
|
65424
65472
|
}
|
|
65425
|
-
return { success: true, path: full, kind, key };
|
|
65473
|
+
return { success: true, path: full, kind, key: key2 };
|
|
65426
65474
|
} catch (error48) {
|
|
65427
65475
|
return { success: false, error: error48?.message || String(error48) };
|
|
65428
65476
|
}
|
|
@@ -66351,7 +66399,7 @@ ${body}
|
|
|
66351
66399
|
{
|
|
66352
66400
|
name: "key_value_secret",
|
|
66353
66401
|
pattern: /\b([A-Z0-9_]*(?:SECRET|TOKEN|API[_-]?KEY|PASSWORD|PASSWD|PRIVATE[_-]?KEY|CREDENTIAL|CLIENT[_-]?SECRET)[A-Z0-9_]*)(\s*[:=]\s*)(["']?)([^\s"',;]+)\3/gi,
|
|
66354
|
-
replace: (_m,
|
|
66402
|
+
replace: (_m, key2, delim, quote) => `${key2}${delim}${quote}${MASK}${quote}`
|
|
66355
66403
|
},
|
|
66356
66404
|
// Authorization: Bearer <token>
|
|
66357
66405
|
{
|
|
@@ -66681,7 +66729,7 @@ ${body}
|
|
|
66681
66729
|
}
|
|
66682
66730
|
function applyPreLaunchTrust(trust, workingDir) {
|
|
66683
66731
|
const settingsPath = expandHome2(trust.settings_path);
|
|
66684
|
-
const
|
|
66732
|
+
const key2 = trust.key;
|
|
66685
66733
|
const real = realWorkspacePath(workingDir);
|
|
66686
66734
|
try {
|
|
66687
66735
|
let parsed = {};
|
|
@@ -66694,18 +66742,18 @@ ${body}
|
|
|
66694
66742
|
}
|
|
66695
66743
|
}
|
|
66696
66744
|
}
|
|
66697
|
-
const existing = parsed[
|
|
66745
|
+
const existing = parsed[key2];
|
|
66698
66746
|
const list = Array.isArray(existing) ? existing.filter((v) => typeof v === "string") : [];
|
|
66699
66747
|
if (list.includes(real)) {
|
|
66700
66748
|
LOG2.debug("pre-launch-trust", `[${trust.settings_path}] ${real} already trusted \u2014 no change`);
|
|
66701
66749
|
return null;
|
|
66702
66750
|
}
|
|
66703
66751
|
list.push(real);
|
|
66704
|
-
parsed[
|
|
66752
|
+
parsed[key2] = list;
|
|
66705
66753
|
fs14.mkdirSync(path222.dirname(settingsPath), { recursive: true });
|
|
66706
66754
|
fs14.writeFileSync(settingsPath, `${JSON.stringify(parsed, null, 2)}
|
|
66707
66755
|
`, "utf8");
|
|
66708
|
-
LOG2.info("pre-launch-trust", `pre-trusted workspace in ${trust.settings_path} (key="${
|
|
66756
|
+
LOG2.info("pre-launch-trust", `pre-trusted workspace in ${trust.settings_path} (key="${key2}")`);
|
|
66709
66757
|
return real;
|
|
66710
66758
|
} catch (err) {
|
|
66711
66759
|
LOG2.warn("pre-launch-trust", `failed to pre-trust workspace in ${trust.settings_path}: ${err.message}`);
|
|
@@ -68306,8 +68354,8 @@ ${body}
|
|
|
68306
68354
|
}
|
|
68307
68355
|
let end = i;
|
|
68308
68356
|
while (end < expr.length && expr[end] !== "." && expr[end] !== "[") end += 1;
|
|
68309
|
-
const
|
|
68310
|
-
cur = cur[
|
|
68357
|
+
const key2 = expr.slice(i, end);
|
|
68358
|
+
cur = cur[key2];
|
|
68311
68359
|
i = end;
|
|
68312
68360
|
}
|
|
68313
68361
|
return cur;
|
|
@@ -70268,8 +70316,8 @@ ${body}
|
|
|
70268
70316
|
/** Drop user-input ack entries older than the dedup window so the map can't grow unbounded. */
|
|
70269
70317
|
pruneRecentUserInputAcks(now) {
|
|
70270
70318
|
if (this.recentUserInputAcks.size <= 1) return;
|
|
70271
|
-
for (const [
|
|
70272
|
-
if (now - at > USER_INPUT_ACK_DEDUP_WINDOW_MS) this.recentUserInputAcks.delete(
|
|
70319
|
+
for (const [key2, at] of this.recentUserInputAcks) {
|
|
70320
|
+
if (now - at > USER_INPUT_ACK_DEDUP_WINDOW_MS) this.recentUserInputAcks.delete(key2);
|
|
70273
70321
|
}
|
|
70274
70322
|
}
|
|
70275
70323
|
dispose() {
|
|
@@ -71473,8 +71521,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
71473
71521
|
};
|
|
71474
71522
|
const isRuntimeOverlay = (entry) => {
|
|
71475
71523
|
if (entry.source !== "runtime") return false;
|
|
71476
|
-
const
|
|
71477
|
-
if (
|
|
71524
|
+
const key2 = typeof entry.runtimeKey === "string" ? entry.runtimeKey.trim().toLowerCase() : "";
|
|
71525
|
+
if (key2.startsWith("auto_approval:")) return true;
|
|
71478
71526
|
return !isUserFacingChatMessage(entry.message);
|
|
71479
71527
|
};
|
|
71480
71528
|
const shouldKeepParsedBeforeUntimedRuntime = (message) => {
|
|
@@ -73071,16 +73119,16 @@ ${rawInput}` : rawInput;
|
|
|
73071
73119
|
function hasCliArg(args, flag) {
|
|
73072
73120
|
return args.some((arg) => arg === flag || arg.startsWith(`${flag}=`));
|
|
73073
73121
|
}
|
|
73074
|
-
function hasConfigOverride(args,
|
|
73122
|
+
function hasConfigOverride(args, key2) {
|
|
73075
73123
|
for (let index = 0; index < args.length; index += 1) {
|
|
73076
73124
|
const arg = args[index];
|
|
73077
73125
|
const next = args[index + 1];
|
|
73078
73126
|
if ((arg === "-c" || arg === "--config") && typeof next === "string") {
|
|
73079
|
-
if (next ===
|
|
73127
|
+
if (next === key2 || next.startsWith(`${key2}=`) || next.startsWith(`${key2}.`)) return true;
|
|
73080
73128
|
}
|
|
73081
73129
|
if (arg.startsWith("--config=")) {
|
|
73082
73130
|
const value = arg.slice("--config=".length);
|
|
73083
|
-
if (value ===
|
|
73131
|
+
if (value === key2 || value.startsWith(`${key2}=`) || value.startsWith(`${key2}.`)) return true;
|
|
73084
73132
|
}
|
|
73085
73133
|
}
|
|
73086
73134
|
return false;
|
|
@@ -73097,10 +73145,10 @@ ${rawInput}` : rawInput;
|
|
|
73097
73145
|
const cliArgs = Array.isArray(input.cliArgs) ? [...input.cliArgs] : [];
|
|
73098
73146
|
const env2 = { ...input.env || {} };
|
|
73099
73147
|
const envUnsets = new Set(DEFAULT_COORDINATOR_DELEGATED_ENV_UNSETS);
|
|
73100
|
-
for (const
|
|
73101
|
-
if (typeof
|
|
73148
|
+
for (const key2 of input.isolation?.env?.unset || []) {
|
|
73149
|
+
if (typeof key2 === "string" && key2.trim()) envUnsets.add(key2.trim());
|
|
73102
73150
|
}
|
|
73103
|
-
for (const
|
|
73151
|
+
for (const key2 of envUnsets) env2[key2] = "";
|
|
73104
73152
|
for (const rule of input.isolation?.args || []) {
|
|
73105
73153
|
if (!rule || typeof rule !== "object") continue;
|
|
73106
73154
|
if (rule.mode === "empty_mcp_config") {
|
|
@@ -73113,9 +73161,9 @@ ${rawInput}` : rawInput;
|
|
|
73113
73161
|
continue;
|
|
73114
73162
|
}
|
|
73115
73163
|
if (rule.mode === "config_override") {
|
|
73116
|
-
const
|
|
73164
|
+
const key2 = String(rule.dedupeKey || rule.key || "").trim();
|
|
73117
73165
|
const flag = String(rule.flag || "").trim();
|
|
73118
|
-
if (!
|
|
73166
|
+
if (!key2 || !flag || hasConfigOverride(cliArgs, key2)) continue;
|
|
73119
73167
|
cliArgs.unshift(flag, `${rule.key}=${rule.value}`);
|
|
73120
73168
|
}
|
|
73121
73169
|
}
|
|
@@ -73321,12 +73369,12 @@ ${rawInput}` : rawInput;
|
|
|
73321
73369
|
}
|
|
73322
73370
|
throw new Error(`No CLI provider found for '${cliType}'. Create a provider.js in providers/cli/${cliType}/`);
|
|
73323
73371
|
}
|
|
73324
|
-
startCliExitMonitor(
|
|
73372
|
+
startCliExitMonitor(key2, cliType) {
|
|
73325
73373
|
const sessionRegistry = this.deps.getSessionRegistry?.() || null;
|
|
73326
73374
|
const instanceManager = this.deps.getInstanceManager();
|
|
73327
73375
|
const checkStopped = setInterval(() => {
|
|
73328
73376
|
try {
|
|
73329
|
-
const adapter = this.adapters.get(
|
|
73377
|
+
const adapter = this.adapters.get(key2);
|
|
73330
73378
|
if (!adapter) {
|
|
73331
73379
|
clearInterval(checkStopped);
|
|
73332
73380
|
return;
|
|
@@ -73335,12 +73383,12 @@ ${rawInput}` : rawInput;
|
|
|
73335
73383
|
if (status?.status === "stopped" || status?.status === "error") {
|
|
73336
73384
|
clearInterval(checkStopped);
|
|
73337
73385
|
setTimeout(() => {
|
|
73338
|
-
if (this.adapters.has(
|
|
73339
|
-
this.adapters.delete(
|
|
73340
|
-
this.deps.removeAgentTracking(
|
|
73341
|
-
sessionRegistry?.unregisterByInstanceKey(
|
|
73342
|
-
instanceManager?.removeInstance(
|
|
73343
|
-
unregisterMeshCoordinator(
|
|
73386
|
+
if (this.adapters.has(key2)) {
|
|
73387
|
+
this.adapters.delete(key2);
|
|
73388
|
+
this.deps.removeAgentTracking(key2);
|
|
73389
|
+
sessionRegistry?.unregisterByInstanceKey(key2);
|
|
73390
|
+
instanceManager?.removeInstance(key2);
|
|
73391
|
+
unregisterMeshCoordinator(key2);
|
|
73344
73392
|
LOG2.info("CLI", `\u{1F9F9} Auto-cleaned ${status.status} CLI: ${cliType}`);
|
|
73345
73393
|
this.deps.onStatusChange();
|
|
73346
73394
|
}
|
|
@@ -73350,21 +73398,21 @@ ${rawInput}` : rawInput;
|
|
|
73350
73398
|
}
|
|
73351
73399
|
}, 3e3);
|
|
73352
73400
|
}
|
|
73353
|
-
async registerCliInstance(
|
|
73401
|
+
async registerCliInstance(key2, normalizedType, cliType, resolvedDir, cliArgs, provider, settings, attachExisting = false, options) {
|
|
73354
73402
|
const instanceManager = this.deps.getInstanceManager();
|
|
73355
73403
|
const sessionRegistry = this.deps.getSessionRegistry?.() || null;
|
|
73356
73404
|
if (!instanceManager) throw new Error("InstanceManager not available");
|
|
73357
73405
|
const transportFactory = this.getTransportFactory(
|
|
73358
|
-
|
|
73406
|
+
key2,
|
|
73359
73407
|
normalizedType,
|
|
73360
73408
|
resolvedDir,
|
|
73361
73409
|
cliArgs,
|
|
73362
73410
|
options?.providerSessionId,
|
|
73363
73411
|
attachExisting
|
|
73364
73412
|
);
|
|
73365
|
-
const cliInstance = new CliProviderInstance(provider, resolvedDir, cliArgs,
|
|
73413
|
+
const cliInstance = new CliProviderInstance(provider, resolvedDir, cliArgs, key2, transportFactory, options);
|
|
73366
73414
|
try {
|
|
73367
|
-
await instanceManager.addInstance(
|
|
73415
|
+
await instanceManager.addInstance(key2, cliInstance, {
|
|
73368
73416
|
serverConn: this.deps.getServerConn(),
|
|
73369
73417
|
settings,
|
|
73370
73418
|
onPtyData: (data) => {
|
|
@@ -73376,8 +73424,8 @@ ${rawInput}` : rawInput;
|
|
|
73376
73424
|
parentSessionId: null,
|
|
73377
73425
|
providerType: normalizedType,
|
|
73378
73426
|
transport: "pty",
|
|
73379
|
-
adapterKey:
|
|
73380
|
-
instanceKey:
|
|
73427
|
+
adapterKey: key2,
|
|
73428
|
+
instanceKey: key2,
|
|
73381
73429
|
workspace: resolvedDir,
|
|
73382
73430
|
// attachExisting === true means we're restoring an already-spawned
|
|
73383
73431
|
// hosted runtime after a daemon restart, not starting a fresh PTY.
|
|
@@ -73393,10 +73441,10 @@ ${rawInput}` : rawInput;
|
|
|
73393
73441
|
});
|
|
73394
73442
|
} catch (spawnErr) {
|
|
73395
73443
|
LOG2.error("CLI", `[${cliType}] Spawn failed: ${spawnErr?.message}`);
|
|
73396
|
-
instanceManager.removeInstance(
|
|
73444
|
+
instanceManager.removeInstance(key2);
|
|
73397
73445
|
throw new Error(`Failed to start ${provider.displayName || provider.name || cliType}: ${spawnErr?.message}`);
|
|
73398
73446
|
}
|
|
73399
|
-
this.adapters.set(
|
|
73447
|
+
this.adapters.set(key2, cliInstance.getAdapter());
|
|
73400
73448
|
const launchMeshNodeId = typeof settings?.meshNodeId === "string" ? settings.meshNodeId.trim() : "";
|
|
73401
73449
|
const launchMeshNodeFor = typeof settings?.meshNodeFor === "string" ? settings.meshNodeFor.trim() : "";
|
|
73402
73450
|
if (launchMeshNodeId || launchMeshNodeFor) {
|
|
@@ -73409,7 +73457,7 @@ ${rawInput}` : rawInput;
|
|
|
73409
73457
|
} catch {
|
|
73410
73458
|
}
|
|
73411
73459
|
}
|
|
73412
|
-
this.startCliExitMonitor(
|
|
73460
|
+
this.startCliExitMonitor(key2, cliType);
|
|
73413
73461
|
}
|
|
73414
73462
|
// ─── Session start/management ──────────────────────────────
|
|
73415
73463
|
async startSession(cliType, workingDir, cliArgs, initialModel, options) {
|
|
@@ -73426,11 +73474,11 @@ ${rawInput}` : rawInput;
|
|
|
73426
73474
|
Enable and detect this provider from the Machine Providers page before starting a runtime.`
|
|
73427
73475
|
);
|
|
73428
73476
|
}
|
|
73429
|
-
const
|
|
73477
|
+
const key2 = crypto5.randomUUID();
|
|
73430
73478
|
{
|
|
73431
73479
|
const coordinatorMeshId = options?.settingsOverride?.meshCoordinatorFor;
|
|
73432
73480
|
if (typeof coordinatorMeshId === "string" && coordinatorMeshId.trim()) {
|
|
73433
|
-
options = { ...options, extraEnv: { ...options?.extraEnv || {}, ADHDEV_COORDINATOR_SESSION_ID:
|
|
73481
|
+
options = { ...options, extraEnv: { ...options?.extraEnv || {}, ADHDEV_COORDINATOR_SESSION_ID: key2 } };
|
|
73434
73482
|
}
|
|
73435
73483
|
}
|
|
73436
73484
|
const sessionRegistry = this.deps.getSessionRegistry?.() || null;
|
|
@@ -73450,7 +73498,7 @@ ${installInfo}`
|
|
|
73450
73498
|
}
|
|
73451
73499
|
console.log(colorize("cyan", ` \u{1F50C} Starting ACP agent: ${provider.name} (${provider.type}) in ${resolvedDir}`));
|
|
73452
73500
|
const acpInstance = new AcpProviderInstance(resolvedProvider, resolvedDir, cliArgs);
|
|
73453
|
-
await instanceManager2.addInstance(
|
|
73501
|
+
await instanceManager2.addInstance(key2, acpInstance, {
|
|
73454
73502
|
settings: this.providerLoader.getSettings(normalizedType)
|
|
73455
73503
|
});
|
|
73456
73504
|
const sessionId = acpInstance.getInstanceId();
|
|
@@ -73459,11 +73507,11 @@ ${installInfo}`
|
|
|
73459
73507
|
parentSessionId: null,
|
|
73460
73508
|
providerType: normalizedType,
|
|
73461
73509
|
transport: "acp",
|
|
73462
|
-
adapterKey:
|
|
73463
|
-
instanceKey:
|
|
73510
|
+
adapterKey: key2,
|
|
73511
|
+
instanceKey: key2,
|
|
73464
73512
|
workspace: resolvedDir
|
|
73465
73513
|
});
|
|
73466
|
-
this.adapters.set(
|
|
73514
|
+
this.adapters.set(key2, {
|
|
73467
73515
|
cliType: normalizedType,
|
|
73468
73516
|
cliName: provider.name,
|
|
73469
73517
|
workingDir: resolvedDir,
|
|
@@ -73471,7 +73519,7 @@ ${installInfo}`
|
|
|
73471
73519
|
spawn: async () => {
|
|
73472
73520
|
},
|
|
73473
73521
|
shutdown: () => {
|
|
73474
|
-
instanceManager2.removeInstance(
|
|
73522
|
+
instanceManager2.removeInstance(key2);
|
|
73475
73523
|
},
|
|
73476
73524
|
sendMessage: async (text) => {
|
|
73477
73525
|
const input = normalizeInputEnvelope(text);
|
|
@@ -73487,7 +73535,7 @@ ${installInfo}`
|
|
|
73487
73535
|
},
|
|
73488
73536
|
getPartialResponse: () => "",
|
|
73489
73537
|
cancel: () => {
|
|
73490
|
-
instanceManager2.removeInstance(
|
|
73538
|
+
instanceManager2.removeInstance(key2);
|
|
73491
73539
|
},
|
|
73492
73540
|
isProcessing: () => false,
|
|
73493
73541
|
isReady: () => true,
|
|
@@ -73541,7 +73589,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
73541
73589
|
if (provider && instanceManager) {
|
|
73542
73590
|
const resolvedProvider = this.providerLoader.resolve(cliType, { version: cliInfo.version }) || provider;
|
|
73543
73591
|
await this.registerCliInstance(
|
|
73544
|
-
|
|
73592
|
+
key2,
|
|
73545
73593
|
normalizedType,
|
|
73546
73594
|
cliType,
|
|
73547
73595
|
resolvedDir,
|
|
@@ -73571,7 +73619,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
73571
73619
|
cliType,
|
|
73572
73620
|
resolvedDir,
|
|
73573
73621
|
resolvedCliArgs,
|
|
73574
|
-
|
|
73622
|
+
key2,
|
|
73575
73623
|
sessionBinding.providerSessionId,
|
|
73576
73624
|
false,
|
|
73577
73625
|
options?.extraEnv
|
|
@@ -73591,9 +73639,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
73591
73639
|
const status = adapter.getStatus?.();
|
|
73592
73640
|
if (status?.status === "stopped" || status?.status === "error") {
|
|
73593
73641
|
setTimeout(() => {
|
|
73594
|
-
if (this.adapters.get(
|
|
73595
|
-
this.adapters.delete(
|
|
73596
|
-
this.deps.removeAgentTracking(
|
|
73642
|
+
if (this.adapters.get(key2) === adapter) {
|
|
73643
|
+
this.adapters.delete(key2);
|
|
73644
|
+
this.deps.removeAgentTracking(key2);
|
|
73597
73645
|
LOG2.info("CLI", `\u{1F9F9} Auto-cleaned ${status.status} CLI: ${adapter.cliType}`);
|
|
73598
73646
|
this.deps.onStatusChange();
|
|
73599
73647
|
}
|
|
@@ -73602,10 +73650,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
73602
73650
|
});
|
|
73603
73651
|
if (typeof adapter.setOnPtyData === "function") {
|
|
73604
73652
|
adapter.setOnPtyData((data) => {
|
|
73605
|
-
this.deps.getP2p()?.broadcastSessionOutput(
|
|
73653
|
+
this.deps.getP2p()?.broadcastSessionOutput(key2, data);
|
|
73606
73654
|
});
|
|
73607
73655
|
}
|
|
73608
|
-
this.adapters.set(
|
|
73656
|
+
this.adapters.set(key2, adapter);
|
|
73609
73657
|
console.log(colorize("green", ` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
|
|
73610
73658
|
}
|
|
73611
73659
|
this.persistRecentActivity({
|
|
@@ -73615,20 +73663,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
73615
73663
|
providerSessionId: sessionBinding.providerSessionId,
|
|
73616
73664
|
workspace: resolvedDir,
|
|
73617
73665
|
summaryMetadata: buildLegacyModelModeSummaryMetadata({ model: initialModel }),
|
|
73618
|
-
sessionId:
|
|
73666
|
+
sessionId: key2,
|
|
73619
73667
|
title: provider?.displayName || provider?.name || normalizedType
|
|
73620
73668
|
});
|
|
73621
73669
|
this.deps.onStatusChange();
|
|
73622
73670
|
return {
|
|
73623
|
-
runtimeSessionId:
|
|
73671
|
+
runtimeSessionId: key2,
|
|
73624
73672
|
providerSessionId: sessionBinding.providerSessionId
|
|
73625
73673
|
};
|
|
73626
73674
|
}
|
|
73627
|
-
async stopSession(
|
|
73628
|
-
return this.stopSessionWithMode(
|
|
73675
|
+
async stopSession(key2) {
|
|
73676
|
+
return this.stopSessionWithMode(key2, "hard");
|
|
73629
73677
|
}
|
|
73630
|
-
async stopSessionWithMode(
|
|
73631
|
-
const adapter = this.adapters.get(
|
|
73678
|
+
async stopSessionWithMode(key2, mode) {
|
|
73679
|
+
const adapter = this.adapters.get(key2);
|
|
73632
73680
|
if (adapter) {
|
|
73633
73681
|
try {
|
|
73634
73682
|
if (mode === "save" && typeof adapter.saveAndStop === "function") {
|
|
@@ -73639,21 +73687,21 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
73639
73687
|
} catch (e) {
|
|
73640
73688
|
LOG2.warn("CLI", `Shutdown error for ${adapter.cliType}: ${e?.message} (force-cleaning)`);
|
|
73641
73689
|
}
|
|
73642
|
-
this.adapters.delete(
|
|
73643
|
-
this.deps.removeAgentTracking(
|
|
73644
|
-
this.deps.getSessionRegistry?.()?.unregisterByInstanceKey(
|
|
73645
|
-
this.deps.getInstanceManager()?.removeInstance(
|
|
73646
|
-
unregisterMeshCoordinator(
|
|
73690
|
+
this.adapters.delete(key2);
|
|
73691
|
+
this.deps.removeAgentTracking(key2);
|
|
73692
|
+
this.deps.getSessionRegistry?.()?.unregisterByInstanceKey(key2);
|
|
73693
|
+
this.deps.getInstanceManager()?.removeInstance(key2);
|
|
73694
|
+
unregisterMeshCoordinator(key2);
|
|
73647
73695
|
LOG2.info("CLI", `\u{1F6D1} Agent stopped: ${adapter.cliType} in ${adapter.workingDir}`);
|
|
73648
73696
|
this.deps.onStatusChange();
|
|
73649
73697
|
} else {
|
|
73650
73698
|
const im = this.deps.getInstanceManager();
|
|
73651
73699
|
if (im) {
|
|
73652
|
-
this.deps.getSessionRegistry?.()?.unregisterByInstanceKey(
|
|
73653
|
-
im.removeInstance(
|
|
73654
|
-
this.deps.removeAgentTracking(
|
|
73655
|
-
unregisterMeshCoordinator(
|
|
73656
|
-
LOG2.warn("CLI", `\u{1F9F9} Force-removed orphan entry: ${
|
|
73700
|
+
this.deps.getSessionRegistry?.()?.unregisterByInstanceKey(key2);
|
|
73701
|
+
im.removeInstance(key2);
|
|
73702
|
+
this.deps.removeAgentTracking(key2);
|
|
73703
|
+
unregisterMeshCoordinator(key2);
|
|
73704
|
+
LOG2.warn("CLI", `\u{1F9F9} Force-removed orphan entry: ${key2}`);
|
|
73657
73705
|
this.deps.onStatusChange();
|
|
73658
73706
|
}
|
|
73659
73707
|
}
|
|
@@ -73681,8 +73729,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
73681
73729
|
for (const r of sessions) {
|
|
73682
73730
|
if (!r?.runtimeId || !r?.cliType || !r?.workspace) continue;
|
|
73683
73731
|
restoredRuntimeIds.add(r.runtimeId);
|
|
73684
|
-
const
|
|
73685
|
-
workspaceTypeCounts.set(
|
|
73732
|
+
const key2 = `${r.workspace}::${r.cliType}`;
|
|
73733
|
+
workspaceTypeCounts.set(key2, (workspaceTypeCounts.get(key2) || 0) + 1);
|
|
73686
73734
|
}
|
|
73687
73735
|
for (const record2 of sessions) {
|
|
73688
73736
|
if (!record2?.runtimeId || !record2?.cliType || !record2?.workspace) continue;
|
|
@@ -74036,7 +74084,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74036
74084
|
});
|
|
74037
74085
|
}
|
|
74038
74086
|
if (!found) throw new Error(`CLI agent not running: ${agentType}`);
|
|
74039
|
-
const { adapter, key } = found;
|
|
74087
|
+
const { adapter, key: key2 } = found;
|
|
74040
74088
|
if (action === "send_chat") {
|
|
74041
74089
|
let currentStatus = getEffectiveAgentSendStatus(adapter);
|
|
74042
74090
|
if (currentStatus === "starting" && await waitForZeroMessageStartingLaunch(adapter)) {
|
|
@@ -74046,7 +74094,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74046
74094
|
}
|
|
74047
74095
|
const meshContext = args?.meshContext;
|
|
74048
74096
|
if (meshContext && typeof meshContext === "object" && typeof meshContext.meshId === "string" && meshContext.meshId) {
|
|
74049
|
-
const targetInstanceId =
|
|
74097
|
+
const targetInstanceId = key2;
|
|
74050
74098
|
try {
|
|
74051
74099
|
this.deps.getInstanceManager()?.attachMeshAssignmentToInstance(targetInstanceId, {
|
|
74052
74100
|
meshId: meshContext.meshId,
|
|
@@ -74078,7 +74126,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74078
74126
|
} else {
|
|
74079
74127
|
await adapter.sendMessage(message);
|
|
74080
74128
|
}
|
|
74081
|
-
const targetInstance = this.deps.getInstanceManager()?.getInstance(
|
|
74129
|
+
const targetInstance = this.deps.getInstanceManager()?.getInstance(key2);
|
|
74082
74130
|
targetInstance?.recordAcknowledgedUserInput?.(input);
|
|
74083
74131
|
return {
|
|
74084
74132
|
success: true,
|
|
@@ -74090,7 +74138,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74090
74138
|
if (typeof adapter.clearHistory === "function") adapter.clearHistory();
|
|
74091
74139
|
return { success: true, cleared: true };
|
|
74092
74140
|
} else if (action === "stop") {
|
|
74093
|
-
await this.stopSession(
|
|
74141
|
+
await this.stopSession(key2);
|
|
74094
74142
|
return { success: true, stopped: true };
|
|
74095
74143
|
}
|
|
74096
74144
|
throw new Error(`Unknown action: ${action}`);
|
|
@@ -74354,9 +74402,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74354
74402
|
} else if (!["ide", "extension", "cli", "acp"].includes(String(provider.category))) {
|
|
74355
74403
|
errors.push(`Invalid category: ${String(provider.category)}`);
|
|
74356
74404
|
}
|
|
74357
|
-
for (const
|
|
74358
|
-
if (!KNOWN_PROVIDER_FIELDS.has(
|
|
74359
|
-
warnings.push(`Unknown provider field: ${
|
|
74405
|
+
for (const key2 of Object.keys(provider)) {
|
|
74406
|
+
if (!KNOWN_PROVIDER_FIELDS.has(key2)) {
|
|
74407
|
+
warnings.push(`Unknown provider field: ${key2}`);
|
|
74360
74408
|
}
|
|
74361
74409
|
}
|
|
74362
74410
|
if (provider.disableUpstream !== void 0) {
|
|
@@ -74501,10 +74549,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74501
74549
|
return;
|
|
74502
74550
|
}
|
|
74503
74551
|
const scriptConfig = scripts;
|
|
74504
|
-
for (const
|
|
74505
|
-
const value = scriptConfig[
|
|
74552
|
+
for (const key2 of ["readSession", "listSessions"]) {
|
|
74553
|
+
const value = scriptConfig[key2];
|
|
74506
74554
|
if (typeof value !== "string" || !value.trim()) {
|
|
74507
|
-
errors.push(`nativeHistory.scripts.${
|
|
74555
|
+
errors.push(`nativeHistory.scripts.${key2} must be a non-empty string`);
|
|
74508
74556
|
}
|
|
74509
74557
|
}
|
|
74510
74558
|
}
|
|
@@ -74539,10 +74587,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74539
74587
|
if (format !== void 0 && !["claude_mcp_json", "hermes_config_yaml"].includes(String(format))) {
|
|
74540
74588
|
errors.push("meshCoordinator.mcpConfig.format must be one of: claude_mcp_json, hermes_config_yaml");
|
|
74541
74589
|
}
|
|
74542
|
-
for (const
|
|
74543
|
-
const value = config2[
|
|
74590
|
+
for (const key2 of ["path", "serverName", "configPathCommand", "instructions", "template"]) {
|
|
74591
|
+
const value = config2[key2];
|
|
74544
74592
|
if (value !== void 0 && (typeof value !== "string" || !value.trim())) {
|
|
74545
|
-
errors.push(`meshCoordinator.mcpConfig.${
|
|
74593
|
+
errors.push(`meshCoordinator.mcpConfig.${key2} must be a non-empty string when provided`);
|
|
74546
74594
|
}
|
|
74547
74595
|
}
|
|
74548
74596
|
if (config2.requiresRestart !== void 0 && typeof config2.requiresRestart !== "boolean") {
|
|
@@ -74578,7 +74626,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74578
74626
|
errors.push("meshCoordinator.delegatedWorkerIsolation.env must be an object");
|
|
74579
74627
|
} else {
|
|
74580
74628
|
const unset = env2.unset;
|
|
74581
|
-
if (unset !== void 0 && (!Array.isArray(unset) || unset.some((
|
|
74629
|
+
if (unset !== void 0 && (!Array.isArray(unset) || unset.some((key2) => typeof key2 !== "string" || !key2.trim()))) {
|
|
74582
74630
|
errors.push("meshCoordinator.delegatedWorkerIsolation.env.unset must be an array of non-empty strings");
|
|
74583
74631
|
}
|
|
74584
74632
|
}
|
|
@@ -74601,16 +74649,16 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
74601
74649
|
errors.push(`${prefix}.mode must be one of: empty_mcp_config, config_override`);
|
|
74602
74650
|
continue;
|
|
74603
74651
|
}
|
|
74604
|
-
for (const
|
|
74605
|
-
const value = item[
|
|
74652
|
+
for (const key2 of mode === "empty_mcp_config" ? ["flag"] : ["flag", "key", "value"]) {
|
|
74653
|
+
const value = item[key2];
|
|
74606
74654
|
if (typeof value !== "string" || !value.trim()) {
|
|
74607
|
-
errors.push(`${prefix}.${
|
|
74655
|
+
errors.push(`${prefix}.${key2} must be a non-empty string`);
|
|
74608
74656
|
}
|
|
74609
74657
|
}
|
|
74610
|
-
for (const
|
|
74611
|
-
const value = item[
|
|
74658
|
+
for (const key2 of ["strictFlag", "dedupeKey"]) {
|
|
74659
|
+
const value = item[key2];
|
|
74612
74660
|
if (value !== void 0 && (typeof value !== "string" || !value.trim())) {
|
|
74613
|
-
errors.push(`${prefix}.${
|
|
74661
|
+
errors.push(`${prefix}.${key2} must be a non-empty string when provided`);
|
|
74614
74662
|
}
|
|
74615
74663
|
}
|
|
74616
74664
|
}
|
|
@@ -76817,9 +76865,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
76817
76865
|
reload() {
|
|
76818
76866
|
this.log("Reloading all providers...");
|
|
76819
76867
|
this.scriptsCache.clear();
|
|
76820
|
-
for (const
|
|
76821
|
-
if (
|
|
76822
|
-
delete require.cache[
|
|
76868
|
+
for (const key2 of Object.keys(require.cache)) {
|
|
76869
|
+
if (key2.includes("providers") && (key2.endsWith(".js") || key2.endsWith(".json"))) {
|
|
76870
|
+
delete require.cache[key2];
|
|
76823
76871
|
}
|
|
76824
76872
|
}
|
|
76825
76873
|
this.loadAll();
|
|
@@ -77127,7 +77175,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
77127
77175
|
*/
|
|
77128
77176
|
getPublicSettings(type) {
|
|
77129
77177
|
const settings = this.getSettingsSchema(type);
|
|
77130
|
-
return Object.entries(settings).filter(([, def]) => def.public === true).map(([
|
|
77178
|
+
return Object.entries(settings).filter(([, def]) => def.public === true).map(([key2, def]) => ({ key: key2, ...def }));
|
|
77131
77179
|
}
|
|
77132
77180
|
/**
|
|
77133
77181
|
* Get public settings schema for all providers
|
|
@@ -77143,23 +77191,23 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
77143
77191
|
/**
|
|
77144
77192
|
* Resolved setting value for a provider (default + user override)
|
|
77145
77193
|
*/
|
|
77146
|
-
getSettingValue(type,
|
|
77194
|
+
getSettingValue(type, key2) {
|
|
77147
77195
|
const providerType = this.resolveAlias(type);
|
|
77148
77196
|
const machineConfig = this.getMachineProviderConfig(providerType);
|
|
77149
|
-
if (
|
|
77197
|
+
if (key2 === "enabled") {
|
|
77150
77198
|
return machineConfig.enabled === true;
|
|
77151
77199
|
}
|
|
77152
|
-
if (
|
|
77200
|
+
if (key2 === "executablePath") {
|
|
77153
77201
|
return machineConfig.executable || "";
|
|
77154
77202
|
}
|
|
77155
|
-
if (
|
|
77203
|
+
if (key2 === "executableArgs") {
|
|
77156
77204
|
const args = machineConfig.args;
|
|
77157
77205
|
return args ? args.map((arg) => /\s/.test(arg) ? JSON.stringify(arg) : arg).join(" ") : "";
|
|
77158
77206
|
}
|
|
77159
|
-
const schemaDef = this.getSettingsSchema(providerType)[
|
|
77207
|
+
const schemaDef = this.getSettingsSchema(providerType)[key2];
|
|
77160
77208
|
const defaultVal = schemaDef ? schemaDef.default : void 0;
|
|
77161
77209
|
const config2 = this.readConfig();
|
|
77162
|
-
const userVal = config2?.providerSettings?.[providerType]?.[
|
|
77210
|
+
const userVal = config2?.providerSettings?.[providerType]?.[key2];
|
|
77163
77211
|
return userVal !== void 0 ? userVal : defaultVal;
|
|
77164
77212
|
}
|
|
77165
77213
|
/**
|
|
@@ -77169,17 +77217,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
77169
77217
|
const providerType = this.resolveAlias(type);
|
|
77170
77218
|
const settings = this.getSettingsSchema(providerType);
|
|
77171
77219
|
const result = {};
|
|
77172
|
-
for (const [
|
|
77173
|
-
result[
|
|
77220
|
+
for (const [key2] of Object.entries(settings)) {
|
|
77221
|
+
result[key2] = this.getSettingValue(providerType, key2);
|
|
77174
77222
|
}
|
|
77175
77223
|
return result;
|
|
77176
77224
|
}
|
|
77177
77225
|
/**
|
|
77178
77226
|
* Save provider setting value (writes to config.json)
|
|
77179
77227
|
*/
|
|
77180
|
-
setSetting(type,
|
|
77228
|
+
setSetting(type, key2, value) {
|
|
77181
77229
|
const providerType = this.resolveAlias(type);
|
|
77182
|
-
const schemaDef = this.getSettingsSchema(providerType)[
|
|
77230
|
+
const schemaDef = this.getSettingsSchema(providerType)[key2];
|
|
77183
77231
|
if (!schemaDef) return false;
|
|
77184
77232
|
if (!schemaDef.public) return false;
|
|
77185
77233
|
if (schemaDef.type === "boolean" && typeof value !== "boolean") return false;
|
|
@@ -77190,13 +77238,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
77190
77238
|
if (schemaDef.max !== void 0 && value > schemaDef.max) return false;
|
|
77191
77239
|
}
|
|
77192
77240
|
if (schemaDef.type === "select" && schemaDef.options && !schemaDef.options.includes(value)) return false;
|
|
77193
|
-
if (
|
|
77241
|
+
if (key2 === "enabled") {
|
|
77194
77242
|
return this.setMachineProviderEnabled(providerType, value);
|
|
77195
77243
|
}
|
|
77196
|
-
if (
|
|
77244
|
+
if (key2 === "executablePath") {
|
|
77197
77245
|
return this.setMachineProviderConfig(providerType, { executable: value });
|
|
77198
77246
|
}
|
|
77199
|
-
if (
|
|
77247
|
+
if (key2 === "executableArgs") {
|
|
77200
77248
|
return this.setMachineProviderConfig(providerType, {
|
|
77201
77249
|
args: value.trim() ? this.parseArgsSetting(value) : void 0
|
|
77202
77250
|
});
|
|
@@ -77206,17 +77254,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
77206
77254
|
try {
|
|
77207
77255
|
if (!config2.providerSettings) config2.providerSettings = {};
|
|
77208
77256
|
if (!config2.providerSettings[providerType]) config2.providerSettings[providerType] = {};
|
|
77209
|
-
config2.providerSettings[providerType][
|
|
77257
|
+
config2.providerSettings[providerType][key2] = value;
|
|
77210
77258
|
this.writeConfig(config2);
|
|
77211
|
-
this.log(`Setting updated: ${providerType}.${
|
|
77259
|
+
this.log(`Setting updated: ${providerType}.${key2} = ${JSON.stringify(value)}`);
|
|
77212
77260
|
return true;
|
|
77213
77261
|
} catch (e) {
|
|
77214
77262
|
this.log(`Failed to save setting: ${e.message}`);
|
|
77215
77263
|
return false;
|
|
77216
77264
|
}
|
|
77217
77265
|
}
|
|
77218
|
-
getOptionalStringSetting(type,
|
|
77219
|
-
const value = this.getSettingValue(type,
|
|
77266
|
+
getOptionalStringSetting(type, key2) {
|
|
77267
|
+
const value = this.getSettingValue(type, key2);
|
|
77220
77268
|
if (typeof value !== "string") return null;
|
|
77221
77269
|
const trimmed = value.trim();
|
|
77222
77270
|
return trimmed ? trimmed : null;
|
|
@@ -77396,7 +77444,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
77396
77444
|
try {
|
|
77397
77445
|
let content = fs25.readFileSync(filePath, "utf-8");
|
|
77398
77446
|
if (args[0] && typeof args[0] === "object") {
|
|
77399
|
-
for (const [
|
|
77447
|
+
for (const [key2, val] of Object.entries(args[0])) {
|
|
77400
77448
|
let v = val;
|
|
77401
77449
|
if (typeof v === "string") {
|
|
77402
77450
|
if (!v.startsWith('"') && !v.startsWith("'") && !v.startsWith("`")) {
|
|
@@ -77405,7 +77453,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
77405
77453
|
} else {
|
|
77406
77454
|
v = JSON.stringify(v);
|
|
77407
77455
|
}
|
|
77408
|
-
const re = new RegExp(`\\$\\{\\s*${
|
|
77456
|
+
const re = new RegExp(`\\$\\{\\s*${key2}\\s*\\}`, "g");
|
|
77409
77457
|
content = content.replace(re, String(v));
|
|
77410
77458
|
}
|
|
77411
77459
|
} else if (typeof args[0] === "string") {
|
|
@@ -79145,9 +79193,20 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
79145
79193
|
targetNodeId: typeof args?.targetNodeId === "string" ? args.targetNodeId.trim() : void 0,
|
|
79146
79194
|
targetSessionId: typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : void 0,
|
|
79147
79195
|
clearTargetNode: args?.clearTargetNode === true,
|
|
79148
|
-
clearTargetSession: args?.clearTargetSession !== false
|
|
79196
|
+
clearTargetSession: args?.clearTargetSession !== false,
|
|
79197
|
+
// CANON-IDENTITY: an in-flight (actively-generating) task is refused by
|
|
79198
|
+
// default to avoid a duplicate second dispatch; an explicit operator
|
|
79199
|
+
// force overrides that guard (and the retry cap).
|
|
79200
|
+
force: args?.force === true
|
|
79149
79201
|
});
|
|
79150
79202
|
if (!task) return { success: false, error: `Queue task '${taskId}' not found` };
|
|
79203
|
+
if (task.status === "assigned" && args?.force !== true) {
|
|
79204
|
+
return {
|
|
79205
|
+
success: false,
|
|
79206
|
+
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.`,
|
|
79207
|
+
task
|
|
79208
|
+
};
|
|
79209
|
+
}
|
|
79151
79210
|
return { success: true, task };
|
|
79152
79211
|
} catch (e) {
|
|
79153
79212
|
return { success: false, error: e.message };
|
|
@@ -80652,15 +80711,15 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
80652
80711
|
function maskArgs(args) {
|
|
80653
80712
|
if (!args || typeof args !== "object") return void 0;
|
|
80654
80713
|
const masked = {};
|
|
80655
|
-
for (const [
|
|
80656
|
-
if (SENSITIVE_KEYS.has(
|
|
80657
|
-
masked[
|
|
80658
|
-
} else if (
|
|
80659
|
-
masked[
|
|
80714
|
+
for (const [key2, value] of Object.entries(args)) {
|
|
80715
|
+
if (SENSITIVE_KEYS.has(key2)) {
|
|
80716
|
+
masked[key2] = typeof value === "string" ? `[${value.length} chars]` : "[masked]";
|
|
80717
|
+
} else if (key2.startsWith("_")) {
|
|
80718
|
+
masked[key2] = value;
|
|
80660
80719
|
} else if (typeof value === "object" && value !== null) {
|
|
80661
|
-
masked[
|
|
80720
|
+
masked[key2] = Array.isArray(value) ? `[Array(${value.length})]` : `[Object]`;
|
|
80662
80721
|
} else {
|
|
80663
|
-
masked[
|
|
80722
|
+
masked[key2] = value;
|
|
80664
80723
|
}
|
|
80665
80724
|
}
|
|
80666
80725
|
return masked;
|
|
@@ -81749,23 +81808,23 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
81749
81808
|
* neither gate is satisfied.
|
|
81750
81809
|
*/
|
|
81751
81810
|
async probe(daemonId, workspace, probe) {
|
|
81752
|
-
const
|
|
81753
|
-
const cached3 = this.recent.get(
|
|
81811
|
+
const key2 = this.key(daemonId, workspace);
|
|
81812
|
+
const cached3 = this.recent.get(key2);
|
|
81754
81813
|
if (cached3 && this.now() - cached3.at < this.reuseMs) {
|
|
81755
81814
|
return cached3.value;
|
|
81756
81815
|
}
|
|
81757
|
-
const existing = this.inflight.get(
|
|
81816
|
+
const existing = this.inflight.get(key2);
|
|
81758
81817
|
if (existing) return existing;
|
|
81759
81818
|
const pending = (async () => {
|
|
81760
81819
|
const result = await probe();
|
|
81761
|
-
if (result) this.recent.set(
|
|
81820
|
+
if (result) this.recent.set(key2, { at: this.now(), value: result });
|
|
81762
81821
|
return result;
|
|
81763
81822
|
})();
|
|
81764
|
-
this.inflight.set(
|
|
81823
|
+
this.inflight.set(key2, pending);
|
|
81765
81824
|
try {
|
|
81766
81825
|
return await pending;
|
|
81767
81826
|
} finally {
|
|
81768
|
-
if (this.inflight.get(
|
|
81827
|
+
if (this.inflight.get(key2) === pending) this.inflight.delete(key2);
|
|
81769
81828
|
}
|
|
81770
81829
|
}
|
|
81771
81830
|
};
|
|
@@ -84457,8 +84516,8 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
84457
84516
|
if (source !== "refine_mesh_node_async_job") continue;
|
|
84458
84517
|
const jobId = e.payload?.refineJob?.jobId;
|
|
84459
84518
|
if (!jobId || terminal.has(`${e.nodeId}:${jobId}`)) continue;
|
|
84460
|
-
const
|
|
84461
|
-
if (this.runningRefineJobs.has(
|
|
84519
|
+
const key2 = this.buildRefineJobKey(meshId, e.nodeId);
|
|
84520
|
+
if (this.runningRefineJobs.has(key2)) continue;
|
|
84462
84521
|
const coordinatorDaemonId = e.payload?.refineJob?.targetCoordinatorDaemonId;
|
|
84463
84522
|
LOG2.info("Mesh", `[Refinery] Auto-resuming interrupted refine job for node ${e.nodeId} (jobId=${jobId})`);
|
|
84464
84523
|
void this.startMeshRefineJob(meshId, e.nodeId, {
|
|
@@ -85541,7 +85600,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
85541
85600
|
}
|
|
85542
85601
|
}
|
|
85543
85602
|
async finishMeshRefineBatchJob(handle, orderedNodes, ordering, args) {
|
|
85544
|
-
const
|
|
85603
|
+
const key2 = this.buildRefineBatchJobKey(handle.meshId);
|
|
85545
85604
|
let result;
|
|
85546
85605
|
try {
|
|
85547
85606
|
result = await this.runMeshRefineBatchConvergence(handle.meshId, orderedNodes, ordering, args);
|
|
@@ -85573,8 +85632,8 @@ ${hintLines.join("\n")}` : "",
|
|
|
85573
85632
|
coordinatorDaemonId: handle.targetCoordinatorDaemonId
|
|
85574
85633
|
});
|
|
85575
85634
|
const terminal = { ...terminalHandle, result: normalizedResult };
|
|
85576
|
-
this.terminalRefineBatchJobs.set(
|
|
85577
|
-
this.runningRefineBatchJobs.delete(
|
|
85635
|
+
this.terminalRefineBatchJobs.set(key2, terminal);
|
|
85636
|
+
this.runningRefineBatchJobs.delete(key2);
|
|
85578
85637
|
this.invalidateAggregateMeshStatus(handle.meshId);
|
|
85579
85638
|
await this.appendRefineBatchJobLedger(isTerminalSuccess ? "task_completed" : "task_failed", terminalHandle, normalizedResult);
|
|
85580
85639
|
this.queueRefineBatchJobEvent(isTerminalSuccess ? "refine:completed" : "refine:failed", terminalHandle, normalizedResult);
|
|
@@ -85598,8 +85657,8 @@ ${hintLines.join("\n")}` : "",
|
|
|
85598
85657
|
if (nodeIds.length === 0) {
|
|
85599
85658
|
return { ...planRecord, success: true, batch: true, dryRun: false, async: false };
|
|
85600
85659
|
}
|
|
85601
|
-
const
|
|
85602
|
-
const running = this.runningRefineBatchJobs.get(
|
|
85660
|
+
const key2 = this.buildRefineBatchJobKey(meshId);
|
|
85661
|
+
const running = this.runningRefineBatchJobs.get(key2);
|
|
85603
85662
|
if (running) return { ...running, duplicate: true };
|
|
85604
85663
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
85605
85664
|
const mesh = meshRecord?.mesh;
|
|
@@ -85614,7 +85673,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
85614
85673
|
};
|
|
85615
85674
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : this.deps.statusInstanceId || void 0;
|
|
85616
85675
|
const handle = this.buildRefineBatchJobHandle({ meshId, nodeIds, order, coordinatorDaemonId });
|
|
85617
|
-
this.runningRefineBatchJobs.set(
|
|
85676
|
+
this.runningRefineBatchJobs.set(key2, handle);
|
|
85618
85677
|
await this.appendRefineBatchJobLedger("task_dispatched", handle);
|
|
85619
85678
|
this.queueRefineBatchJobEvent("refine:accepted", handle);
|
|
85620
85679
|
setImmediate(() => {
|
|
@@ -85629,7 +85688,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
85629
85688
|
};
|
|
85630
85689
|
}
|
|
85631
85690
|
async finishMeshRefineJob(handle, args) {
|
|
85632
|
-
const
|
|
85691
|
+
const key2 = this.buildRefineJobKey(handle.meshId, handle.targetNodeId);
|
|
85633
85692
|
let result;
|
|
85634
85693
|
try {
|
|
85635
85694
|
result = await this.executeMeshRefineNodeSynchronously(handle.meshId, handle.targetNodeId, args);
|
|
@@ -85697,17 +85756,17 @@ ${hintLines.join("\n")}` : "",
|
|
|
85697
85756
|
coordinatorDaemonId: handle.targetCoordinatorDaemonId
|
|
85698
85757
|
});
|
|
85699
85758
|
const terminal = { ...terminalHandle, result: normalizedResult };
|
|
85700
|
-
this.terminalRefineJobs.set(
|
|
85701
|
-
this.runningRefineJobs.delete(
|
|
85759
|
+
this.terminalRefineJobs.set(key2, terminal);
|
|
85760
|
+
this.runningRefineJobs.delete(key2);
|
|
85702
85761
|
this.invalidateAggregateMeshStatus(handle.meshId);
|
|
85703
85762
|
await this.appendRefineJobLedger(isTerminalSuccess ? "task_completed" : "task_failed", terminalHandle, normalizedResult);
|
|
85704
85763
|
this.queueRefineJobEvent(isTerminalSuccess ? "refine:completed" : "refine:failed", terminalHandle, normalizedResult);
|
|
85705
85764
|
}
|
|
85706
85765
|
async startMeshRefineJob(meshId, nodeId, args) {
|
|
85707
|
-
const
|
|
85708
|
-
const running = this.runningRefineJobs.get(
|
|
85766
|
+
const key2 = this.buildRefineJobKey(meshId, nodeId);
|
|
85767
|
+
const running = this.runningRefineJobs.get(key2);
|
|
85709
85768
|
if (running) return { ...running, duplicate: true };
|
|
85710
|
-
const terminal = this.terminalRefineJobs.get(
|
|
85769
|
+
const terminal = this.terminalRefineJobs.get(key2);
|
|
85711
85770
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
85712
85771
|
const mesh = meshRecord?.mesh;
|
|
85713
85772
|
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
@@ -85715,7 +85774,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
85715
85774
|
if (!node.isLocalWorktree || !node.workspace) return { success: false, error: `Refinery requires a local worktree node` };
|
|
85716
85775
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : this.deps.statusInstanceId || void 0;
|
|
85717
85776
|
const handle = this.buildRefineJobHandle({ meshId, nodeId, node, retryOfJobId: terminal?.jobId, coordinatorDaemonId });
|
|
85718
|
-
this.runningRefineJobs.set(
|
|
85777
|
+
this.runningRefineJobs.set(key2, handle);
|
|
85719
85778
|
await this.appendRefineJobLedger("task_dispatched", handle);
|
|
85720
85779
|
this.queueRefineJobEvent("refine:accepted", handle);
|
|
85721
85780
|
setImmediate(() => {
|
|
@@ -85771,27 +85830,27 @@ ${hintLines.join("\n")}` : "",
|
|
|
85771
85830
|
*/
|
|
85772
85831
|
async stopIde(ideType, killProcess = false) {
|
|
85773
85832
|
const cdpKeysToRemove = [];
|
|
85774
|
-
for (const
|
|
85775
|
-
if (
|
|
85776
|
-
cdpKeysToRemove.push(
|
|
85833
|
+
for (const key2 of this.deps.cdpManagers.keys()) {
|
|
85834
|
+
if (key2 === ideType || key2.startsWith(`${ideType}_`)) {
|
|
85835
|
+
cdpKeysToRemove.push(key2);
|
|
85777
85836
|
}
|
|
85778
85837
|
}
|
|
85779
|
-
for (const
|
|
85780
|
-
const cdp = this.deps.cdpManagers.get(
|
|
85838
|
+
for (const key2 of cdpKeysToRemove) {
|
|
85839
|
+
const cdp = this.deps.cdpManagers.get(key2);
|
|
85781
85840
|
if (cdp) {
|
|
85782
85841
|
try {
|
|
85783
85842
|
cdp.disconnect();
|
|
85784
85843
|
} catch {
|
|
85785
85844
|
}
|
|
85786
|
-
this.deps.cdpManagers.delete(
|
|
85787
|
-
this.deps.sessionRegistry.unregisterByManagerKey(
|
|
85788
|
-
LOG2.info("StopIDE", `CDP disconnected: ${
|
|
85845
|
+
this.deps.cdpManagers.delete(key2);
|
|
85846
|
+
this.deps.sessionRegistry.unregisterByManagerKey(key2);
|
|
85847
|
+
LOG2.info("StopIDE", `CDP disconnected: ${key2}`);
|
|
85789
85848
|
}
|
|
85790
85849
|
}
|
|
85791
85850
|
const keysToRemove = [];
|
|
85792
|
-
for (const
|
|
85793
|
-
if (
|
|
85794
|
-
keysToRemove.push(
|
|
85851
|
+
for (const key2 of this.deps.instanceManager.listInstanceIds()) {
|
|
85852
|
+
if (key2 === `ide:${ideType}` || typeof key2 === "string" && key2.startsWith(`ide:${ideType}_`)) {
|
|
85853
|
+
keysToRemove.push(key2);
|
|
85795
85854
|
}
|
|
85796
85855
|
}
|
|
85797
85856
|
for (const instanceKey of keysToRemove) {
|
|
@@ -90446,9 +90505,9 @@ async (params) => {
|
|
|
90446
90505
|
}
|
|
90447
90506
|
if (Date.now() - lastApprovalTime < 2e3) return;
|
|
90448
90507
|
if (approvalPatterns.some((p) => p.test(approvalBuffer))) {
|
|
90449
|
-
const
|
|
90450
|
-
writeFn(
|
|
90451
|
-
ctx.log(`Auto-Implement auto-approved prompt! Sending: ${JSON.stringify(
|
|
90508
|
+
const key2 = approvalKeys[1] || approvalKeys[0] || "a\r";
|
|
90509
|
+
writeFn(key2);
|
|
90510
|
+
ctx.log(`Auto-Implement auto-approved prompt! Sending: ${JSON.stringify(key2)}`);
|
|
90452
90511
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk: `
|
|
90453
90512
|
[\u{1F916} ADHDev Auto-Approve] CLI Action Approved
|
|
90454
90513
|
`, stream: "stdout" } });
|
|
@@ -91698,8 +91757,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
91698
91757
|
category: p.category
|
|
91699
91758
|
}));
|
|
91700
91759
|
const cdpStatus = {};
|
|
91701
|
-
for (const [
|
|
91702
|
-
cdpStatus[
|
|
91760
|
+
for (const [key2, cdp] of this.cdpManagers.entries()) {
|
|
91761
|
+
cdpStatus[key2] = { connected: cdp.isConnected };
|
|
91703
91762
|
}
|
|
91704
91763
|
this.json(res, 200, {
|
|
91705
91764
|
devMode: true,
|
|
@@ -92019,16 +92078,16 @@ data: ${JSON.stringify(msg.data)}
|
|
|
92019
92078
|
errors.push(...validation.errors);
|
|
92020
92079
|
warnings.push(...validation.warnings);
|
|
92021
92080
|
if (config2.settings) {
|
|
92022
|
-
for (const [
|
|
92081
|
+
for (const [key2, val] of Object.entries(config2.settings)) {
|
|
92023
92082
|
const s2 = val;
|
|
92024
|
-
if (!s2.type) errors.push(`settings.${
|
|
92083
|
+
if (!s2.type) errors.push(`settings.${key2}: missing type`);
|
|
92025
92084
|
else if (!["boolean", "number", "string", "select"].includes(s2.type))
|
|
92026
|
-
errors.push(`settings.${
|
|
92027
|
-
if (s2.default === void 0) warnings.push(`settings.${
|
|
92085
|
+
errors.push(`settings.${key2}: invalid type '${s2.type}'`);
|
|
92086
|
+
if (s2.default === void 0) warnings.push(`settings.${key2}: no default value`);
|
|
92028
92087
|
if (s2.type === "number" && s2.min !== void 0 && s2.max !== void 0 && s2.min > s2.max)
|
|
92029
|
-
errors.push(`settings.${
|
|
92088
|
+
errors.push(`settings.${key2}: min (${s2.min}) > max (${s2.max})`);
|
|
92030
92089
|
if (s2.type === "select" && (!s2.options || !Array.isArray(s2.options) || s2.options.length === 0))
|
|
92031
|
-
errors.push(`settings.${
|
|
92090
|
+
errors.push(`settings.${key2}: select type requires options[]`);
|
|
92032
92091
|
}
|
|
92033
92092
|
}
|
|
92034
92093
|
if (config2.cdpPorts && Array.isArray(config2.cdpPorts)) {
|
|
@@ -92806,21 +92865,21 @@ data: ${JSON.stringify(msg.data)}
|
|
|
92806
92865
|
function encodeControlLetter(letter) {
|
|
92807
92866
|
return String.fromCharCode(letter.charCodeAt(0) - 96);
|
|
92808
92867
|
}
|
|
92809
|
-
function encodeShiftedKey(
|
|
92810
|
-
if (isLowercaseLetter(
|
|
92811
|
-
if (
|
|
92812
|
-
return encodeControlLetter(
|
|
92868
|
+
function encodeShiftedKey(key2) {
|
|
92869
|
+
if (isLowercaseLetter(key2)) return key2.toUpperCase();
|
|
92870
|
+
if (key2.startsWith("ctrl+") && isLowercaseLetter(key2.slice(5))) {
|
|
92871
|
+
return encodeControlLetter(key2.slice(5));
|
|
92813
92872
|
}
|
|
92814
|
-
if (
|
|
92815
|
-
return `\x1B${
|
|
92873
|
+
if (key2.startsWith("alt+") && isLowercaseLetter(key2.slice(4))) {
|
|
92874
|
+
return `\x1B${key2.slice(4).toUpperCase()}`;
|
|
92816
92875
|
}
|
|
92817
|
-
if (
|
|
92818
|
-
if (
|
|
92819
|
-
if (
|
|
92820
|
-
throw new Error(`Unsupported named key: shift+${
|
|
92876
|
+
if (key2 === "tab") return "\x1B[Z";
|
|
92877
|
+
if (key2 in SHIFTED_CSI_KEYS) return SHIFTED_CSI_KEYS[key2];
|
|
92878
|
+
if (key2 in BASE_KEY_SEQUENCES) return BASE_KEY_SEQUENCES[key2];
|
|
92879
|
+
throw new Error(`Unsupported named key: shift+${key2}`);
|
|
92821
92880
|
}
|
|
92822
|
-
function namedKeyToAnsi(
|
|
92823
|
-
const normalized = String(
|
|
92881
|
+
function namedKeyToAnsi(key2) {
|
|
92882
|
+
const normalized = String(key2 || "").trim().toLowerCase();
|
|
92824
92883
|
if (normalized in BASE_KEY_SEQUENCES) return BASE_KEY_SEQUENCES[normalized];
|
|
92825
92884
|
if (normalized.startsWith("ctrl+") && isLowercaseLetter(normalized.slice(5))) {
|
|
92826
92885
|
return encodeControlLetter(normalized.slice(5));
|
|
@@ -92829,7 +92888,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
92829
92888
|
return `\x1B${normalized.slice(4)}`;
|
|
92830
92889
|
}
|
|
92831
92890
|
if (normalized.startsWith("shift+")) return encodeShiftedKey(normalized.slice(6));
|
|
92832
|
-
throw new Error(`Unsupported named key: ${
|
|
92891
|
+
throw new Error(`Unsupported named key: ${key2}`);
|
|
92833
92892
|
}
|
|
92834
92893
|
function namedKeysToAnsi(keys) {
|
|
92835
92894
|
if (!Array.isArray(keys)) throw new Error("keys must be an array");
|
|
@@ -93295,19 +93354,19 @@ data: ${JSON.stringify(msg.data)}
|
|
|
93295
93354
|
if (!ids) return [];
|
|
93296
93355
|
return [...ids].map((id) => this.bySessionId.get(id)).filter(Boolean);
|
|
93297
93356
|
}
|
|
93298
|
-
addIndex(index,
|
|
93299
|
-
let set2 = index.get(
|
|
93357
|
+
addIndex(index, key2, sessionId) {
|
|
93358
|
+
let set2 = index.get(key2);
|
|
93300
93359
|
if (!set2) {
|
|
93301
93360
|
set2 = /* @__PURE__ */ new Set();
|
|
93302
|
-
index.set(
|
|
93361
|
+
index.set(key2, set2);
|
|
93303
93362
|
}
|
|
93304
93363
|
set2.add(sessionId);
|
|
93305
93364
|
}
|
|
93306
|
-
removeIndex(index,
|
|
93307
|
-
const set2 = index.get(
|
|
93365
|
+
removeIndex(index, key2, sessionId) {
|
|
93366
|
+
const set2 = index.get(key2);
|
|
93308
93367
|
if (!set2) return;
|
|
93309
93368
|
set2.delete(sessionId);
|
|
93310
|
-
if (set2.size === 0) index.delete(
|
|
93369
|
+
if (set2.size === 0) index.delete(key2);
|
|
93311
93370
|
}
|
|
93312
93371
|
};
|
|
93313
93372
|
init_logger();
|