@adhdev/daemon-standalone 1.0.58-rc.44 → 1.0.58-rc.46
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 +370 -118
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -31672,9 +31672,9 @@ var require_streamx = __commonJS({
|
|
|
31672
31672
|
}
|
|
31673
31673
|
});
|
|
31674
31674
|
|
|
31675
|
-
//
|
|
31675
|
+
// ../daemon-core/node_modules/b4a/index.js
|
|
31676
31676
|
var require_b4a2 = __commonJS({
|
|
31677
|
-
"
|
|
31677
|
+
"../daemon-core/node_modules/b4a/index.js"(exports2, module2) {
|
|
31678
31678
|
"use strict";
|
|
31679
31679
|
function isBuffer(value) {
|
|
31680
31680
|
return Buffer.isBuffer(value) || value instanceof Uint8Array;
|
|
@@ -31830,9 +31830,9 @@ var require_b4a2 = __commonJS({
|
|
|
31830
31830
|
}
|
|
31831
31831
|
});
|
|
31832
31832
|
|
|
31833
|
-
//
|
|
31833
|
+
// ../daemon-core/node_modules/tar-stream/headers.js
|
|
31834
31834
|
var require_headers = __commonJS({
|
|
31835
|
-
"
|
|
31835
|
+
"../daemon-core/node_modules/tar-stream/headers.js"(exports2) {
|
|
31836
31836
|
"use strict";
|
|
31837
31837
|
var b4a = require_b4a2();
|
|
31838
31838
|
var ZEROS = "0000000000000000000";
|
|
@@ -32093,9 +32093,9 @@ var require_headers = __commonJS({
|
|
|
32093
32093
|
}
|
|
32094
32094
|
});
|
|
32095
32095
|
|
|
32096
|
-
//
|
|
32096
|
+
// ../daemon-core/node_modules/tar-stream/extract.js
|
|
32097
32097
|
var require_extract = __commonJS({
|
|
32098
|
-
"
|
|
32098
|
+
"../daemon-core/node_modules/tar-stream/extract.js"(exports2, module2) {
|
|
32099
32099
|
"use strict";
|
|
32100
32100
|
var { Writable, Readable, getStreamError } = require_streamx();
|
|
32101
32101
|
var FIFO = require_fast_fifo();
|
|
@@ -32438,9 +32438,9 @@ var require_extract = __commonJS({
|
|
|
32438
32438
|
}
|
|
32439
32439
|
});
|
|
32440
32440
|
|
|
32441
|
-
//
|
|
32441
|
+
// ../daemon-core/node_modules/tar-stream/constants.js
|
|
32442
32442
|
var require_constants = __commonJS({
|
|
32443
|
-
"
|
|
32443
|
+
"../daemon-core/node_modules/tar-stream/constants.js"(exports2, module2) {
|
|
32444
32444
|
"use strict";
|
|
32445
32445
|
var constants = {
|
|
32446
32446
|
// just for envs without fs
|
|
@@ -32459,9 +32459,9 @@ var require_constants = __commonJS({
|
|
|
32459
32459
|
}
|
|
32460
32460
|
});
|
|
32461
32461
|
|
|
32462
|
-
//
|
|
32462
|
+
// ../daemon-core/node_modules/tar-stream/pack.js
|
|
32463
32463
|
var require_pack = __commonJS({
|
|
32464
|
-
"
|
|
32464
|
+
"../daemon-core/node_modules/tar-stream/pack.js"(exports2, module2) {
|
|
32465
32465
|
"use strict";
|
|
32466
32466
|
var { Readable, Writable, getStreamError } = require_streamx();
|
|
32467
32467
|
var b4a = require_b4a2();
|
|
@@ -32694,9 +32694,9 @@ var require_pack = __commonJS({
|
|
|
32694
32694
|
}
|
|
32695
32695
|
});
|
|
32696
32696
|
|
|
32697
|
-
//
|
|
32697
|
+
// ../daemon-core/node_modules/tar-stream/index.js
|
|
32698
32698
|
var require_tar_stream = __commonJS({
|
|
32699
|
-
"
|
|
32699
|
+
"../daemon-core/node_modules/tar-stream/index.js"(exports2) {
|
|
32700
32700
|
"use strict";
|
|
32701
32701
|
exports2.extract = require_extract();
|
|
32702
32702
|
exports2.pack = require_pack();
|
|
@@ -32939,9 +32939,9 @@ var require_pump = __commonJS({
|
|
|
32939
32939
|
}
|
|
32940
32940
|
});
|
|
32941
32941
|
|
|
32942
|
-
//
|
|
32942
|
+
// ../daemon-core/node_modules/tar-fs/index.js
|
|
32943
32943
|
var require_tar_fs = __commonJS({
|
|
32944
|
-
"
|
|
32944
|
+
"../daemon-core/node_modules/tar-fs/index.js"(exports2) {
|
|
32945
32945
|
"use strict";
|
|
32946
32946
|
var tar = require_tar_stream();
|
|
32947
32947
|
var pump = require_pump();
|
|
@@ -36911,10 +36911,10 @@ var require_dist3 = __commonJS({
|
|
|
36911
36911
|
}
|
|
36912
36912
|
function getDaemonBuildInfo() {
|
|
36913
36913
|
if (cached2) return cached2;
|
|
36914
|
-
const commit = readInjected(true ? "
|
|
36915
|
-
const commitShort = readInjected(true ? "
|
|
36916
|
-
const version2 = readInjected(true ? "1.0.58-rc.
|
|
36917
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
36914
|
+
const commit = readInjected(true ? "a03baab8130d59d9dfaca9173cddefd7f052d6a4" : void 0) ?? "unknown";
|
|
36915
|
+
const commitShort = readInjected(true ? "a03baab8" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
36916
|
+
const version2 = readInjected(true ? "1.0.58-rc.46" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
36917
|
+
const builtAt = readInjected(true ? "2026-08-30T06:41:16.415Z" : void 0);
|
|
36918
36918
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
36919
36919
|
return cached2;
|
|
36920
36920
|
}
|
|
@@ -41531,12 +41531,57 @@ child.on('exit', () => process.exit(0));
|
|
|
41531
41531
|
const override = env2.KIMI_CODE_HOME?.trim();
|
|
41532
41532
|
return override ? override : path11.join(os8.homedir(), ".kimi-code");
|
|
41533
41533
|
}
|
|
41534
|
-
function
|
|
41535
|
-
|
|
41534
|
+
function tomlStringValue(line, key2) {
|
|
41535
|
+
const escapedKey = key2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
41536
|
+
const basic = line.match(new RegExp(`^\\s*${escapedKey}\\s*=\\s*("(?:\\\\.|[^"\\\\])*")\\s*(?:#.*)?$`));
|
|
41537
|
+
if (basic?.[1]) {
|
|
41538
|
+
try {
|
|
41539
|
+
const value = JSON.parse(basic[1]);
|
|
41540
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
41541
|
+
} catch {
|
|
41542
|
+
return void 0;
|
|
41543
|
+
}
|
|
41544
|
+
}
|
|
41545
|
+
const literal2 = line.match(new RegExp(`^\\s*${escapedKey}\\s*=\\s*'([^']*)'\\s*(?:#.*)?$`));
|
|
41546
|
+
return literal2?.[1]?.trim() || void 0;
|
|
41536
41547
|
}
|
|
41537
|
-
function
|
|
41548
|
+
function readManagedKimiSettings(env2) {
|
|
41549
|
+
let raw;
|
|
41550
|
+
try {
|
|
41551
|
+
raw = fs9.readFileSync(path11.join(kimiHome(env2), "config.toml"), "utf-8");
|
|
41552
|
+
} catch {
|
|
41553
|
+
return {};
|
|
41554
|
+
}
|
|
41555
|
+
let section = null;
|
|
41556
|
+
const settings = {};
|
|
41557
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
41558
|
+
const header = line.trim().match(/^\[\s*(.*?)\s*\](?:\s*#.*)?$/)?.[1];
|
|
41559
|
+
if (header !== void 0) {
|
|
41560
|
+
if (/^providers\s*\.\s*["']managed:kimi-code["']\s*$/.test(header)) {
|
|
41561
|
+
section = "provider";
|
|
41562
|
+
} else if (/^providers\s*\.\s*["']managed:kimi-code["']\s*\.\s*oauth\s*$/.test(header)) {
|
|
41563
|
+
section = "oauth";
|
|
41564
|
+
} else {
|
|
41565
|
+
section = null;
|
|
41566
|
+
}
|
|
41567
|
+
continue;
|
|
41568
|
+
}
|
|
41569
|
+
if (section === "provider") {
|
|
41570
|
+
settings.baseUrl = tomlStringValue(line, "base_url") ?? settings.baseUrl;
|
|
41571
|
+
} else if (section === "oauth") {
|
|
41572
|
+
settings.oauthKey = tomlStringValue(line, "key") ?? settings.oauthKey;
|
|
41573
|
+
}
|
|
41574
|
+
}
|
|
41575
|
+
return settings;
|
|
41576
|
+
}
|
|
41577
|
+
function credentialsPath(env2, oauthKey) {
|
|
41578
|
+
const configuredName = oauthKey?.replace(/^oauth\//, "").split("/").at(-1)?.trim();
|
|
41579
|
+
const name = configuredName && configuredName !== "." && configuredName !== ".." && path11.basename(configuredName) === configuredName ? configuredName : "kimi-code";
|
|
41580
|
+
return path11.join(kimiHome(env2), "credentials", `${name}.json`);
|
|
41581
|
+
}
|
|
41582
|
+
function baseUrl4(env2, configured) {
|
|
41538
41583
|
const override = env2.KIMI_CODE_BASE_URL?.trim();
|
|
41539
|
-
return (override
|
|
41584
|
+
return (override || configured || DEFAULT_BASE_URL4).replace(/\/+$/, "");
|
|
41540
41585
|
}
|
|
41541
41586
|
function parseCredentials3(raw) {
|
|
41542
41587
|
let parsed;
|
|
@@ -41557,8 +41602,8 @@ child.on('exit', () => process.exit(0));
|
|
|
41557
41602
|
const expiresAt = typeof expiresAtRaw === "number" && Number.isFinite(expiresAtRaw) ? expiresAtRaw : null;
|
|
41558
41603
|
return { kind: "ok", credentials: { accessToken, expiresAt } };
|
|
41559
41604
|
}
|
|
41560
|
-
function readCredentials4(deps) {
|
|
41561
|
-
const file2 = credentialsPath(deps.env);
|
|
41605
|
+
function readCredentials4(deps, oauthKey) {
|
|
41606
|
+
const file2 = credentialsPath(deps.env, oauthKey);
|
|
41562
41607
|
let raw;
|
|
41563
41608
|
try {
|
|
41564
41609
|
raw = fs9.readFileSync(file2, "utf-8");
|
|
@@ -41683,7 +41728,8 @@ child.on('exit', () => process.exit(0));
|
|
|
41683
41728
|
async function fetchKimiQuota2(overrides = {}) {
|
|
41684
41729
|
assertInjectedNetworkFetchInTest(overrides, "fetchKimiQuota");
|
|
41685
41730
|
const deps = resolveDeps(overrides);
|
|
41686
|
-
const
|
|
41731
|
+
const settings = readManagedKimiSettings(deps.env);
|
|
41732
|
+
const credentialsResult = readCredentials4(deps, settings.oauthKey);
|
|
41687
41733
|
if (credentialsResult.kind === "missing") {
|
|
41688
41734
|
return quotaFailure("kimi", "unavailable", "Not signed in to Kimi Code", {
|
|
41689
41735
|
source: "oauth",
|
|
@@ -41706,7 +41752,7 @@ child.on('exit', () => process.exit(0));
|
|
|
41706
41752
|
);
|
|
41707
41753
|
}
|
|
41708
41754
|
try {
|
|
41709
|
-
const response = await deps.fetch(`${baseUrl4(deps.env)}/usages`, {
|
|
41755
|
+
const response = await deps.fetch(`${baseUrl4(deps.env, settings.baseUrl)}/usages`, {
|
|
41710
41756
|
headers: {
|
|
41711
41757
|
Authorization: `Bearer ${credentials.accessToken}`,
|
|
41712
41758
|
Accept: "application/json"
|
|
@@ -51080,7 +51126,8 @@ ${lines.join("\n")}
|
|
|
51080
51126
|
});
|
|
51081
51127
|
if (!stamp2) return event;
|
|
51082
51128
|
const dispatchedBySelfFallback = selfFallback && stamp2.scope === "broadcast";
|
|
51083
|
-
const
|
|
51129
|
+
const isWorktreeBootstrapEvent = event.event === "worktree_bootstrap_complete" || event.event === "worktree_bootstrap_failed";
|
|
51130
|
+
const selfFallbackTarget = dispatchedBySelfFallback && !isWorktreeBootstrapEvent && !readNonEmptyString(event.targetCoordinatorDaemonId) && !readNonEmptyString(event.targetCoordinatorSessionId) ? readNonEmptyString(stamp2.dispatchedBy.daemonId) : void 0;
|
|
51084
51131
|
return {
|
|
51085
51132
|
...event,
|
|
51086
51133
|
protocolVersion: stamp2.protocolVersion,
|
|
@@ -51819,7 +51866,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
|
|
|
51819
51866
|
}
|
|
51820
51867
|
});
|
|
51821
51868
|
var require_canonicalize = __commonJS2({
|
|
51822
|
-
"../../
|
|
51869
|
+
"../../node_modules/canonicalize/lib/canonicalize.js"(exports22, module22) {
|
|
51823
51870
|
"use strict";
|
|
51824
51871
|
module22.exports = function serialize(object2) {
|
|
51825
51872
|
if (typeof object2 === "number" && isNaN(object2)) {
|
|
@@ -51929,7 +51976,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
|
|
|
51929
51976
|
var hexes;
|
|
51930
51977
|
var Hash;
|
|
51931
51978
|
var init_utils = __esm2({
|
|
51932
|
-
"../../
|
|
51979
|
+
"../../node_modules/@noble/hashes/esm/utils.js"() {
|
|
51933
51980
|
"use strict";
|
|
51934
51981
|
hasHexBuiltin = /* @__PURE__ */ (() => (
|
|
51935
51982
|
// @ts-ignore
|
|
@@ -51961,7 +52008,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
|
|
|
51961
52008
|
var HashMD;
|
|
51962
52009
|
var SHA256_IV;
|
|
51963
52010
|
var init_md = __esm2({
|
|
51964
|
-
"../../
|
|
52011
|
+
"../../node_modules/@noble/hashes/esm/_md.js"() {
|
|
51965
52012
|
"use strict";
|
|
51966
52013
|
init_utils();
|
|
51967
52014
|
HashMD = class extends Hash {
|
|
@@ -52071,7 +52118,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
|
|
|
52071
52118
|
var SHA256;
|
|
52072
52119
|
var sha256;
|
|
52073
52120
|
var init_sha2 = __esm2({
|
|
52074
|
-
"../../
|
|
52121
|
+
"../../node_modules/@noble/hashes/esm/sha2.js"() {
|
|
52075
52122
|
"use strict";
|
|
52076
52123
|
init_md();
|
|
52077
52124
|
init_utils();
|
|
@@ -52217,7 +52264,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
|
|
|
52217
52264
|
});
|
|
52218
52265
|
var sha2562;
|
|
52219
52266
|
var init_sha256 = __esm2({
|
|
52220
|
-
"../../
|
|
52267
|
+
"../../node_modules/@noble/hashes/esm/sha256.js"() {
|
|
52221
52268
|
"use strict";
|
|
52222
52269
|
init_sha2();
|
|
52223
52270
|
sha2562 = sha256;
|
|
@@ -52956,7 +53003,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
|
|
|
52956
53003
|
var HMAC;
|
|
52957
53004
|
var hmac;
|
|
52958
53005
|
var init_hmac = __esm2({
|
|
52959
|
-
"../../
|
|
53006
|
+
"../../node_modules/@noble/hashes/esm/hmac.js"() {
|
|
52960
53007
|
"use strict";
|
|
52961
53008
|
init_utils();
|
|
52962
53009
|
HMAC = class extends Hash {
|
|
@@ -63591,8 +63638,8 @@ CREATE TABLE IF NOT EXISTS sq_archive (
|
|
|
63591
63638
|
const branch = readStringValue(node.worktreeBranch, node.worktree_branch);
|
|
63592
63639
|
if (branch) return `\u2387 ${branch}`;
|
|
63593
63640
|
const workspace = readStringValue(node.workspace, node.repoRoot, node.repo_root);
|
|
63594
|
-
const
|
|
63595
|
-
return
|
|
63641
|
+
const basename22 = workspace ? workingDirBasename(workspace) : void 0;
|
|
63642
|
+
return basename22 || (nodeId ? nodeId.slice(0, 8) : "node");
|
|
63596
63643
|
}
|
|
63597
63644
|
function buildMeshNodeDisplayLabel(node, nodeId, _providerPriority) {
|
|
63598
63645
|
return buildMeshNodeMachineLabel(node, nodeId);
|
|
@@ -82141,6 +82188,25 @@ ${block2.text}`,
|
|
|
82141
82188
|
launchedByCoordinator: true,
|
|
82142
82189
|
autoLaunchedForQueueTaskId: task.id
|
|
82143
82190
|
};
|
|
82191
|
+
const requiredTags = Array.isArray(task.requiredTags) ? task.requiredTags.filter((t) => !!t) : [];
|
|
82192
|
+
const buildRoutingDecision = () => buildAutoLaunchRoutingDecision({
|
|
82193
|
+
node,
|
|
82194
|
+
meshId,
|
|
82195
|
+
task: { difficulty: task.difficulty, requiredTags: task.requiredTags },
|
|
82196
|
+
resolved,
|
|
82197
|
+
quotaRouting: mesh?.policy?.quotaRouting ?? null,
|
|
82198
|
+
quotaFactsContext: quotaFactsContextForLiveRouting(mesh, isLocalAutoLaunchNode, components.providerLoader),
|
|
82199
|
+
skippedCandidates,
|
|
82200
|
+
requiredTagsResult: {
|
|
82201
|
+
required: requiredTags,
|
|
82202
|
+
satisfied: !requiredTags.length || nodeSatisfiesRequiredTags(requiredTags, buildMeshNodeCapabilityTags(node, effectiveProviderType)),
|
|
82203
|
+
missing: requiredTags.filter((t) => !buildMeshNodeCapabilityTags(node, effectiveProviderType).includes(t))
|
|
82204
|
+
},
|
|
82205
|
+
effectiveModel,
|
|
82206
|
+
effectiveThinkingLevel,
|
|
82207
|
+
executedSlot: slotDecision.slot,
|
|
82208
|
+
demotionReason
|
|
82209
|
+
});
|
|
82144
82210
|
if (launchTarget.mode === "remote") {
|
|
82145
82211
|
const remoteSettings = {
|
|
82146
82212
|
...launchSettings,
|
|
@@ -82184,7 +82250,15 @@ ${block2.text}`,
|
|
|
82184
82250
|
await waitForRemoteSessionReady(meshId, nodeId, remoteSessionId, {
|
|
82185
82251
|
isReady: remoteSessionReadyProbe(meshId, nodeId, remoteSessionId)
|
|
82186
82252
|
}).catch(() => false);
|
|
82187
|
-
|
|
82253
|
+
const routingDecision2 = buildRoutingDecision();
|
|
82254
|
+
claimAfterRemoteAutoLaunch(
|
|
82255
|
+
components,
|
|
82256
|
+
meshId,
|
|
82257
|
+
nodeId,
|
|
82258
|
+
remoteSessionId,
|
|
82259
|
+
effectiveProviderType,
|
|
82260
|
+
(c, m, n, s2, p) => tryAssignQueueTask(c, m, n, s2, p, routingDecision2, void 0, "auto_launch")
|
|
82261
|
+
);
|
|
82188
82262
|
}
|
|
82189
82263
|
return true;
|
|
82190
82264
|
}
|
|
@@ -82216,25 +82290,7 @@ ${block2.text}`,
|
|
|
82216
82290
|
markAutoLaunch(meshId, task.id, { status: "completed", nodeId, providerType: effectiveProviderType, sessionId, ...effectiveModel ? { model: effectiveModel } : {}, ...effectiveThinkingLevel ? { thinkingLevel: effectiveThinkingLevel } : {} });
|
|
82217
82291
|
logAutoLaunchQuotaFallbackSuccess(resolved, task.id, nodeId, sessionId);
|
|
82218
82292
|
await waitForLocalSessionReady(components, sessionId);
|
|
82219
|
-
const
|
|
82220
|
-
const routingDecision = buildAutoLaunchRoutingDecision({
|
|
82221
|
-
node,
|
|
82222
|
-
meshId,
|
|
82223
|
-
task: { difficulty: task.difficulty, requiredTags: task.requiredTags },
|
|
82224
|
-
resolved,
|
|
82225
|
-
quotaRouting: mesh?.policy?.quotaRouting ?? null,
|
|
82226
|
-
quotaFactsContext: quotaFactsContextForLiveRouting(mesh, isLocalAutoLaunchNode, components.providerLoader),
|
|
82227
|
-
skippedCandidates,
|
|
82228
|
-
requiredTagsResult: {
|
|
82229
|
-
required: requiredTags,
|
|
82230
|
-
satisfied: !requiredTags.length || nodeSatisfiesRequiredTags(requiredTags, buildMeshNodeCapabilityTags(node, effectiveProviderType)),
|
|
82231
|
-
missing: requiredTags.filter((t) => !buildMeshNodeCapabilityTags(node, effectiveProviderType).includes(t))
|
|
82232
|
-
},
|
|
82233
|
-
effectiveModel,
|
|
82234
|
-
effectiveThinkingLevel,
|
|
82235
|
-
executedSlot: slotDecision.slot,
|
|
82236
|
-
demotionReason
|
|
82237
|
-
});
|
|
82293
|
+
const routingDecision = buildRoutingDecision();
|
|
82238
82294
|
tryAssignQueueTask(components, meshId, nodeId, sessionId, effectiveProviderType, routingDecision, void 0, "auto_launch");
|
|
82239
82295
|
return true;
|
|
82240
82296
|
} catch (e) {
|
|
@@ -86254,11 +86310,17 @@ ${cleanBody}`;
|
|
|
86254
86310
|
if (bootstrapNodeId) {
|
|
86255
86311
|
try {
|
|
86256
86312
|
const bootstrapWorkspace = readNonEmptyString(args.metadataEvent.worktreePath) || readNonEmptyString(args.metadataEvent.workspace);
|
|
86313
|
+
const originDaemonId = readNonEmptyString(args.metadataEvent.originDaemonId) || readNonEmptyString(args.metadataEvent.daemonId);
|
|
86314
|
+
const originMachineId = readNonEmptyString(args.metadataEvent.originMachineId) || readNonEmptyString(args.metadataEvent.machineId);
|
|
86257
86315
|
components.router.markWorktreeBootstrapTerminalState(
|
|
86258
86316
|
args.meshId,
|
|
86259
86317
|
bootstrapNodeId,
|
|
86260
86318
|
args.event === "worktree_bootstrap_failed" ? "failed" : "complete",
|
|
86261
|
-
bootstrapWorkspace
|
|
86319
|
+
bootstrapWorkspace || originDaemonId || originMachineId ? {
|
|
86320
|
+
...bootstrapWorkspace ? { workspace: bootstrapWorkspace } : {},
|
|
86321
|
+
...originDaemonId ? { daemonId: originDaemonId } : {},
|
|
86322
|
+
...originMachineId ? { machineId: originMachineId } : {}
|
|
86323
|
+
} : void 0
|
|
86262
86324
|
);
|
|
86263
86325
|
} catch (e) {
|
|
86264
86326
|
LOG2.error("MeshQueue", `Failed to stamp terminal bootstrap state for ${bootstrapNodeId} (mesh ${args.meshId}): ${e?.message || e}`);
|
|
@@ -86587,6 +86649,10 @@ ${cleanBody}`;
|
|
|
86587
86649
|
interactionId: readNonEmptyString(payload.interactionId),
|
|
86588
86650
|
status: readNonEmptyString(payload.status),
|
|
86589
86651
|
targetDaemonId: readNonEmptyString(payload.targetDaemonId),
|
|
86652
|
+
// Worker origin identity for a remotely cloned worktree's bootstrap event
|
|
86653
|
+
// so the coordinator's hydrate-on-miss upsert is P2P-addressable.
|
|
86654
|
+
originDaemonId: readNonEmptyString(payload.originDaemonId) || readNonEmptyString(payload.daemonId) || readNonEmptyString(payload.metadataEvent?.originDaemonId),
|
|
86655
|
+
originMachineId: readNonEmptyString(payload.originMachineId) || readNonEmptyString(payload.machineId) || readNonEmptyString(payload.metadataEvent?.originMachineId),
|
|
86590
86656
|
startedAt: readNonEmptyString(payload.startedAt),
|
|
86591
86657
|
completedAt: readNonEmptyString(payload.completedAt),
|
|
86592
86658
|
retryOfJobId: readNonEmptyString(payload.retryOfJobId),
|
|
@@ -86996,25 +87062,76 @@ ${cleanBody}`;
|
|
|
86996
87062
|
DEFAULT_PENDING_HELD_DRAIN_ESCALATE_MS = 12e3;
|
|
86997
87063
|
}
|
|
86998
87064
|
});
|
|
87065
|
+
function resolveRemotePullBackoffMs(backoffRound) {
|
|
87066
|
+
const shift = Math.max(0, Math.min(backoffRound - 1, 8));
|
|
87067
|
+
return Math.min(REMOTE_PULL_BACKOFF_MAX_MS, REMOTE_PULL_BACKOFF_BASE_MS * 2 ** shift);
|
|
87068
|
+
}
|
|
87069
|
+
function pullBackoffKey(meshId, daemonId) {
|
|
87070
|
+
return `${meshId}::${canonicalDaemonId(daemonId) ?? daemonId}`;
|
|
87071
|
+
}
|
|
87072
|
+
function isRemotePullBackedOff(meshId, daemonId, nowMs) {
|
|
87073
|
+
const state = remotePullBackoffByDaemon.get(pullBackoffKey(meshId, daemonId));
|
|
87074
|
+
return !!state && nowMs < state.nextPullAtMs;
|
|
87075
|
+
}
|
|
87076
|
+
function noteRemotePullResult(meshId, daemonId, result, nowMs) {
|
|
87077
|
+
const key2 = pullBackoffKey(meshId, daemonId);
|
|
87078
|
+
if (result.received > 0) {
|
|
87079
|
+
remotePullBackoffByDaemon.delete(key2);
|
|
87080
|
+
return;
|
|
87081
|
+
}
|
|
87082
|
+
if (!result.reached) return;
|
|
87083
|
+
const prev = remotePullBackoffByDaemon.get(key2);
|
|
87084
|
+
const emptyRounds = (prev?.emptyRounds ?? 0) + 1;
|
|
87085
|
+
const backoffRound = emptyRounds - REMOTE_PULL_EMPTY_ROUNDS_BEFORE_BACKOFF + 1;
|
|
87086
|
+
remotePullBackoffByDaemon.set(key2, {
|
|
87087
|
+
emptyRounds,
|
|
87088
|
+
nextPullAtMs: emptyRounds >= REMOTE_PULL_EMPTY_ROUNDS_BEFORE_BACKOFF ? nowMs + resolveRemotePullBackoffMs(backoffRound) : 0
|
|
87089
|
+
});
|
|
87090
|
+
}
|
|
86999
87091
|
async function pullRemoteNodeQueues(components, mesh, localDaemonId, candidateDaemonIds) {
|
|
87000
87092
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
87001
87093
|
if (!dispatchMeshCommand) return;
|
|
87002
87094
|
const meshId = mesh.id;
|
|
87003
87095
|
const pulls = candidateDaemonIds.length > 0 ? candidateDaemonIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }];
|
|
87004
|
-
|
|
87096
|
+
const uniqueNodes = [];
|
|
87097
|
+
const seenDaemonIds = /* @__PURE__ */ new Set();
|
|
87098
|
+
for (const node of mesh.nodes) {
|
|
87099
|
+
const nodeDaemonId = readNonEmptyString(node.daemonId);
|
|
87100
|
+
if (!nodeDaemonId) continue;
|
|
87101
|
+
const daemonKey = canonicalDaemonId(nodeDaemonId) ?? nodeDaemonId;
|
|
87102
|
+
if (seenDaemonIds.has(daemonKey)) continue;
|
|
87103
|
+
seenDaemonIds.add(daemonKey);
|
|
87104
|
+
uniqueNodes.push(node);
|
|
87105
|
+
}
|
|
87106
|
+
await Promise.allSettled(uniqueNodes.map((node) => (async () => {
|
|
87107
|
+
const nodeDaemonId = readNonEmptyString(node.daemonId);
|
|
87108
|
+
if (nodeDaemonId && isRemotePullBackedOff(meshId, nodeDaemonId, Date.now())) return;
|
|
87109
|
+
const result = await pullPendingEventsFromNode(components, meshId, node, localDaemonId, candidateDaemonIds, pulls);
|
|
87110
|
+
if (nodeDaemonId) noteRemotePullResult(meshId, nodeDaemonId, result, Date.now());
|
|
87111
|
+
})()));
|
|
87005
87112
|
}
|
|
87006
|
-
async function pullPendingEventsFromNode(components, meshId, node, localDaemonId, candidateDaemonIds, pulls) {
|
|
87113
|
+
async function pullPendingEventsFromNode(components, meshId, node, localDaemonId, candidateDaemonIds, pulls, opts) {
|
|
87007
87114
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
87008
|
-
if (!dispatchMeshCommand) return;
|
|
87115
|
+
if (!dispatchMeshCommand) return NOT_REACHED;
|
|
87009
87116
|
const nodeDaemonId = readNonEmptyString(node.daemonId);
|
|
87010
|
-
if (!nodeDaemonId) return;
|
|
87011
|
-
if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) return;
|
|
87012
|
-
if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) return;
|
|
87117
|
+
if (!nodeDaemonId) return NOT_REACHED;
|
|
87118
|
+
if (daemonIdsEquivalent(nodeDaemonId, localDaemonId)) return NOT_REACHED;
|
|
87119
|
+
if (daemonIdListIncludes(candidateDaemonIds, nodeDaemonId)) return NOT_REACHED;
|
|
87013
87120
|
const getPeerStatus = components.getMeshPeerConnectionStatus;
|
|
87014
87121
|
if (getPeerStatus) {
|
|
87015
87122
|
const peerSnapshot = getPeerStatus(nodeDaemonId);
|
|
87016
|
-
if (!peerSnapshot || String(peerSnapshot.state) !== "connected") return;
|
|
87123
|
+
if (!peerSnapshot || String(peerSnapshot.state) !== "connected") return NOT_REACHED;
|
|
87124
|
+
}
|
|
87125
|
+
const throttleKey = pullBackoffKey(meshId, nodeDaemonId);
|
|
87126
|
+
if (opts?.minIntervalSinceLastPullMs) {
|
|
87127
|
+
const lastPullAt = lastRedrivePullAtMs.get(throttleKey);
|
|
87128
|
+
if (lastPullAt !== void 0 && Date.now() - lastPullAt < opts.minIntervalSinceLastPullMs) {
|
|
87129
|
+
return NOT_REACHED;
|
|
87130
|
+
}
|
|
87017
87131
|
}
|
|
87132
|
+
let received = 0;
|
|
87133
|
+
let completedPulls = 0;
|
|
87134
|
+
if (opts?.minIntervalSinceLastPullMs) lastRedrivePullAtMs.set(throttleKey, Date.now());
|
|
87018
87135
|
for (const pendingEventArgs of pulls) {
|
|
87019
87136
|
let events;
|
|
87020
87137
|
try {
|
|
@@ -87022,7 +87139,11 @@ ${cleanBody}`;
|
|
|
87022
87139
|
} catch {
|
|
87023
87140
|
break;
|
|
87024
87141
|
}
|
|
87025
|
-
const
|
|
87142
|
+
const extracted = extractPendingEventsResult(events);
|
|
87143
|
+
if (!extracted.confirmed) break;
|
|
87144
|
+
completedPulls++;
|
|
87145
|
+
received += extracted.events.length;
|
|
87146
|
+
const list = extracted.events.filter((e) => readNonEmptyString(e?.meshId) === meshId);
|
|
87026
87147
|
for (const event of list) {
|
|
87027
87148
|
const payload = buildForwardPayloadFromPending(event);
|
|
87028
87149
|
if (!payload.event || !payload.meshId) continue;
|
|
@@ -87032,6 +87153,7 @@ ${cleanBody}`;
|
|
|
87032
87153
|
}
|
|
87033
87154
|
}
|
|
87034
87155
|
}
|
|
87156
|
+
return { received, reached: completedPulls === pulls.length };
|
|
87035
87157
|
}
|
|
87036
87158
|
function unwrapReadChatPayload(raw) {
|
|
87037
87159
|
let cursor = raw;
|
|
@@ -87139,13 +87261,28 @@ ${cleanBody}`;
|
|
|
87139
87261
|
}
|
|
87140
87262
|
return [];
|
|
87141
87263
|
}
|
|
87142
|
-
function
|
|
87143
|
-
|
|
87144
|
-
|
|
87145
|
-
|
|
87146
|
-
|
|
87264
|
+
function extractPendingEventsResult(raw) {
|
|
87265
|
+
let cursor = raw;
|
|
87266
|
+
for (let depth = 0; depth < 4 && cursor && typeof cursor === "object"; depth++) {
|
|
87267
|
+
if (Array.isArray(cursor)) return { events: cursor, confirmed: true };
|
|
87268
|
+
const record2 = cursor;
|
|
87269
|
+
if (record2.success === false) return { events: [], confirmed: false };
|
|
87270
|
+
if (Array.isArray(record2.events)) return { events: record2.events, confirmed: true };
|
|
87271
|
+
if (record2.payload && typeof record2.payload === "object") {
|
|
87272
|
+
cursor = record2.payload;
|
|
87273
|
+
continue;
|
|
87274
|
+
}
|
|
87275
|
+
if (record2.result && typeof record2.result === "object") {
|
|
87276
|
+
cursor = record2.result;
|
|
87277
|
+
continue;
|
|
87278
|
+
}
|
|
87279
|
+
if (record2.data && typeof record2.data === "object") {
|
|
87280
|
+
cursor = record2.data;
|
|
87281
|
+
continue;
|
|
87282
|
+
}
|
|
87283
|
+
break;
|
|
87147
87284
|
}
|
|
87148
|
-
return [];
|
|
87285
|
+
return { events: [], confirmed: false };
|
|
87149
87286
|
}
|
|
87150
87287
|
function buildForwardPayloadFromPending(event) {
|
|
87151
87288
|
const metadata = event?.metadataEvent && typeof event.metadataEvent === "object" ? event.metadataEvent : {};
|
|
@@ -87185,6 +87322,13 @@ ${cleanBody}`;
|
|
|
87185
87322
|
...serializeV2EnvelopeToWire(event)
|
|
87186
87323
|
};
|
|
87187
87324
|
}
|
|
87325
|
+
var REMOTE_PULL_EMPTY_ROUNDS_BEFORE_BACKOFF;
|
|
87326
|
+
var REMOTE_PULL_BACKOFF_BASE_MS;
|
|
87327
|
+
var REMOTE_PULL_BACKOFF_MAX_MS;
|
|
87328
|
+
var REDRIVE_PULL_MIN_INTERVAL_MS;
|
|
87329
|
+
var remotePullBackoffByDaemon;
|
|
87330
|
+
var lastRedrivePullAtMs;
|
|
87331
|
+
var NOT_REACHED;
|
|
87188
87332
|
var init_mesh_remote_event_pull = __esm2({
|
|
87189
87333
|
"src/mesh/mesh-remote-event-pull.ts"() {
|
|
87190
87334
|
"use strict";
|
|
@@ -87193,6 +87337,13 @@ ${cleanBody}`;
|
|
|
87193
87337
|
init_mesh_events_utils();
|
|
87194
87338
|
init_dist();
|
|
87195
87339
|
init_mesh_reconcile_identity();
|
|
87340
|
+
REMOTE_PULL_EMPTY_ROUNDS_BEFORE_BACKOFF = 3;
|
|
87341
|
+
REMOTE_PULL_BACKOFF_BASE_MS = 8e3;
|
|
87342
|
+
REMOTE_PULL_BACKOFF_MAX_MS = 3e4;
|
|
87343
|
+
REDRIVE_PULL_MIN_INTERVAL_MS = 2e3;
|
|
87344
|
+
remotePullBackoffByDaemon = /* @__PURE__ */ new Map();
|
|
87345
|
+
lastRedrivePullAtMs = /* @__PURE__ */ new Map();
|
|
87346
|
+
NOT_REACHED = { received: 0, reached: false };
|
|
87196
87347
|
}
|
|
87197
87348
|
});
|
|
87198
87349
|
function formatBytes(bytes) {
|
|
@@ -90614,7 +90765,8 @@ ${cleanBody}`;
|
|
|
90614
90765
|
assignedNode,
|
|
90615
90766
|
localDaemonId,
|
|
90616
90767
|
selfIds,
|
|
90617
|
-
selfIds.length > 0 ? selfIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }]
|
|
90768
|
+
selfIds.length > 0 ? selfIds.map((id) => ({ meshId, coordinatorDaemonId: id })) : [{ meshId }],
|
|
90769
|
+
{ minIntervalSinceLastPullMs: REDRIVE_PULL_MIN_INTERVAL_MS }
|
|
90618
90770
|
);
|
|
90619
90771
|
} catch {
|
|
90620
90772
|
}
|
|
@@ -93772,6 +93924,14 @@ ${cleanBody}`;
|
|
|
93772
93924
|
},
|
|
93773
93925
|
description: "Template for expanding an initialModel selection into launch args. '{{model}}' is substituted with the model string (e.g. ['--model', '{{model}}'] \u2192 --model opus). Applied at launch when a model is requested for this CLI provider (MAGI kind-panel model axis). Absent \u2192 no launch-time model selection."
|
|
93774
93926
|
},
|
|
93927
|
+
modelLaunchValueMap: {
|
|
93928
|
+
type: "object",
|
|
93929
|
+
additionalProperties: {
|
|
93930
|
+
type: "string",
|
|
93931
|
+
minLength: 1
|
|
93932
|
+
},
|
|
93933
|
+
description: "Optional map from user-facing model labels to provider-specific CLI values used to fill {{model}} in modelLaunchArgs. A model absent from the map passes through unchanged."
|
|
93934
|
+
},
|
|
93775
93935
|
modelOptions: {
|
|
93776
93936
|
type: "array",
|
|
93777
93937
|
items: {
|
|
@@ -95712,6 +95872,23 @@ ${tail}`;
|
|
|
95712
95872
|
DEFAULT_REFINE_VITEST_MAX_WORKERS = 2;
|
|
95713
95873
|
}
|
|
95714
95874
|
});
|
|
95875
|
+
function sanitizeRefineGateChildEnv(env2 = process.env) {
|
|
95876
|
+
const sanitized = {};
|
|
95877
|
+
for (const [key2, value] of Object.entries(env2)) {
|
|
95878
|
+
if (key2.startsWith(ADHDEV_ENV_PREFIX) && !REFINE_GATE_ENV_ALLOWLIST.has(key2)) continue;
|
|
95879
|
+
sanitized[key2] = value;
|
|
95880
|
+
}
|
|
95881
|
+
return sanitized;
|
|
95882
|
+
}
|
|
95883
|
+
var ADHDEV_ENV_PREFIX;
|
|
95884
|
+
var REFINE_GATE_ENV_ALLOWLIST;
|
|
95885
|
+
var init_mesh_refine_env_sanitize = __esm2({
|
|
95886
|
+
"src/mesh/mesh-refine-env-sanitize.ts"() {
|
|
95887
|
+
"use strict";
|
|
95888
|
+
ADHDEV_ENV_PREFIX = "ADHDEV_";
|
|
95889
|
+
REFINE_GATE_ENV_ALLOWLIST = /* @__PURE__ */ new Set([]);
|
|
95890
|
+
}
|
|
95891
|
+
});
|
|
95715
95892
|
function classifySubmoduleDivergence(submoduleRepoPath, baseCommit, branchCommit) {
|
|
95716
95893
|
if (!baseCommit || !branchCommit) return "undeterminable";
|
|
95717
95894
|
if (baseCommit === branchCommit) return "not_diverged";
|
|
@@ -97021,7 +97198,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97021
97198
|
windowsHide: true,
|
|
97022
97199
|
timeout,
|
|
97023
97200
|
maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
|
|
97024
|
-
env: { ...
|
|
97201
|
+
env: { ...sanitizeRefineGateChildEnv(), CI: process.env.CI || "1", ...refineGateChildEnv(), ...candidate.env || {} },
|
|
97025
97202
|
...spawn7.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
97026
97203
|
});
|
|
97027
97204
|
summary.bootstrapCommandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
|
|
@@ -97067,7 +97244,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97067
97244
|
windowsHide: true,
|
|
97068
97245
|
timeout,
|
|
97069
97246
|
maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
|
|
97070
|
-
env: { ...
|
|
97247
|
+
env: { ...sanitizeRefineGateChildEnv(), CI: process.env.CI || "1", ...refineGateChildEnv(), ...candidate.env || {} },
|
|
97071
97248
|
...spawn7.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
97072
97249
|
});
|
|
97073
97250
|
summary.commandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
|
|
@@ -97129,6 +97306,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97129
97306
|
import_node_child_process11 = require("child_process");
|
|
97130
97307
|
init_resolve_executable();
|
|
97131
97308
|
init_mesh_refine_worker_cap();
|
|
97309
|
+
init_mesh_refine_env_sanitize();
|
|
97132
97310
|
init_mesh_refine_gitlink_utils();
|
|
97133
97311
|
init_mesh_refine_submodule_converge();
|
|
97134
97312
|
init_mesh_refine_gitlink_utils();
|
|
@@ -97324,12 +97502,38 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97324
97502
|
};
|
|
97325
97503
|
}
|
|
97326
97504
|
});
|
|
97505
|
+
async function execChangeAreaGit(callSite, gitArgs, cwd, inputs) {
|
|
97506
|
+
try {
|
|
97507
|
+
return await execFileAsync6(GIT3, gitArgs, { cwd, encoding: "utf8" });
|
|
97508
|
+
} catch (error48) {
|
|
97509
|
+
LOG2.warn("Mesh", `[Refinery] Change-area git call failed: ${JSON.stringify({
|
|
97510
|
+
callSite,
|
|
97511
|
+
gitArgs,
|
|
97512
|
+
cwd,
|
|
97513
|
+
cwdExists: (0, import_node_fs7.existsSync)(cwd),
|
|
97514
|
+
code: error48?.code ?? null,
|
|
97515
|
+
syscall: error48?.syscall ?? null,
|
|
97516
|
+
path: error48?.path ?? null,
|
|
97517
|
+
inputs
|
|
97518
|
+
})}`);
|
|
97519
|
+
throw error48;
|
|
97520
|
+
}
|
|
97521
|
+
}
|
|
97327
97522
|
function topLevel(path64) {
|
|
97328
97523
|
const slash = path64.indexOf("/");
|
|
97329
97524
|
return slash === -1 ? path64 : path64.slice(0, slash);
|
|
97330
97525
|
}
|
|
97331
97526
|
async function analyzeMeshRefineNodeChangeArea(args) {
|
|
97332
|
-
const { nodeId, workspace, branch, baseRef, branchRef, diffCwd, submodulePaths } = args;
|
|
97527
|
+
const { nodeId, workspace, branch, baseRef, branchRef, diffCwd, repoRoot, submodulePaths } = args;
|
|
97528
|
+
const diagnosticInputs = {
|
|
97529
|
+
nodeId,
|
|
97530
|
+
workspace,
|
|
97531
|
+
repoRoot: repoRoot ?? null,
|
|
97532
|
+
branch,
|
|
97533
|
+
baseRef,
|
|
97534
|
+
branchRef,
|
|
97535
|
+
submodulePaths: [...submodulePaths]
|
|
97536
|
+
};
|
|
97333
97537
|
const base = {
|
|
97334
97538
|
nodeId,
|
|
97335
97539
|
workspace,
|
|
@@ -97343,21 +97547,28 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97343
97547
|
try {
|
|
97344
97548
|
let mergeBase = baseRef;
|
|
97345
97549
|
try {
|
|
97346
|
-
const { stdout } = await
|
|
97550
|
+
const { stdout } = await execChangeAreaGit(
|
|
97551
|
+
"analyzeMeshRefineNodeChangeArea.mergeBase",
|
|
97552
|
+
["merge-base", baseRef, branchRef],
|
|
97553
|
+
diffCwd,
|
|
97554
|
+
diagnosticInputs
|
|
97555
|
+
);
|
|
97347
97556
|
const resolved = stdout.trim();
|
|
97348
97557
|
if (resolved) mergeBase = resolved;
|
|
97349
97558
|
} catch {
|
|
97350
97559
|
}
|
|
97351
|
-
const { stdout: countStdout } = await
|
|
97352
|
-
|
|
97560
|
+
const { stdout: countStdout } = await execChangeAreaGit(
|
|
97561
|
+
"analyzeMeshRefineNodeChangeArea.aheadCount",
|
|
97353
97562
|
["rev-list", "--count", `${mergeBase}..${branchRef}`],
|
|
97354
|
-
|
|
97563
|
+
diffCwd,
|
|
97564
|
+
{ ...diagnosticInputs, mergeBase }
|
|
97355
97565
|
);
|
|
97356
97566
|
base.aheadCount = Number.parseInt(countStdout.trim(), 10) || 0;
|
|
97357
|
-
const { stdout: nameStdout } = await
|
|
97358
|
-
|
|
97567
|
+
const { stdout: nameStdout } = await execChangeAreaGit(
|
|
97568
|
+
"analyzeMeshRefineNodeChangeArea.changedFiles",
|
|
97359
97569
|
["diff", "--name-only", `${mergeBase}..${branchRef}`],
|
|
97360
|
-
|
|
97570
|
+
diffCwd,
|
|
97571
|
+
{ ...diagnosticInputs, mergeBase }
|
|
97361
97572
|
);
|
|
97362
97573
|
const files = nameStdout.split("\n").map((line) => line.trim()).filter(Boolean).slice(0, MAX_CHANGED_FILES2);
|
|
97363
97574
|
base.changedFiles = files;
|
|
@@ -97406,6 +97617,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97406
97617
|
return { order: ranked.map((a) => a.nodeId), changeAreas: areaById, rationale };
|
|
97407
97618
|
}
|
|
97408
97619
|
var import_node_child_process14;
|
|
97620
|
+
var import_node_fs7;
|
|
97409
97621
|
var import_node_util7;
|
|
97410
97622
|
var execFileAsync6;
|
|
97411
97623
|
var GIT3;
|
|
@@ -97414,8 +97626,10 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97414
97626
|
"src/mesh/mesh-refine-batch.ts"() {
|
|
97415
97627
|
"use strict";
|
|
97416
97628
|
import_node_child_process14 = require("child_process");
|
|
97629
|
+
import_node_fs7 = require("fs");
|
|
97417
97630
|
import_node_util7 = require("util");
|
|
97418
97631
|
init_resolve_executable();
|
|
97632
|
+
init_logger();
|
|
97419
97633
|
execFileAsync6 = (0, import_node_util7.promisify)(import_node_child_process14.execFile);
|
|
97420
97634
|
GIT3 = process.platform === "win32" ? resolveWin32Executable("git") : "git";
|
|
97421
97635
|
MAX_CHANGED_FILES2 = 500;
|
|
@@ -97440,7 +97654,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97440
97654
|
}
|
|
97441
97655
|
async function assessScope(cwd, path64, baseRef, branchRef) {
|
|
97442
97656
|
try {
|
|
97443
|
-
if (!(0,
|
|
97657
|
+
if (!(0, import_node_fs8.existsSync)(cwd)) return { path: path64, verdict: "unknown", error: `path does not exist: ${cwd}` };
|
|
97444
97658
|
const liveBaseHead = await git2(cwd, ["rev-parse", baseRef]);
|
|
97445
97659
|
const branchHead = await git2(cwd, ["rev-parse", branchRef]);
|
|
97446
97660
|
if (!liveBaseHead || !branchHead) {
|
|
@@ -97533,7 +97747,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97533
97747
|
var import_node_child_process15;
|
|
97534
97748
|
var import_node_util8;
|
|
97535
97749
|
var import_node_path5;
|
|
97536
|
-
var
|
|
97750
|
+
var import_node_fs8;
|
|
97537
97751
|
var execFileAsync7;
|
|
97538
97752
|
var GIT4;
|
|
97539
97753
|
var init_mesh_refine_base_divergence = __esm2({
|
|
@@ -97542,7 +97756,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97542
97756
|
import_node_child_process15 = require("child_process");
|
|
97543
97757
|
import_node_util8 = require("util");
|
|
97544
97758
|
import_node_path5 = require("path");
|
|
97545
|
-
|
|
97759
|
+
import_node_fs8 = require("fs");
|
|
97546
97760
|
init_resolve_executable();
|
|
97547
97761
|
init_mesh_refine_batch();
|
|
97548
97762
|
execFileAsync7 = (0, import_node_util8.promisify)(import_node_child_process15.execFile);
|
|
@@ -97767,7 +97981,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97767
97981
|
function refineWorktreeVanishedOutcome(ctx, nextStage) {
|
|
97768
97982
|
const workspace = ctx?.node?.workspace;
|
|
97769
97983
|
if (typeof workspace !== "string" || !workspace) return null;
|
|
97770
|
-
if ((0,
|
|
97984
|
+
if ((0, import_node_fs9.existsSync)(workspace)) return null;
|
|
97771
97985
|
recordMeshRefineStage(ctx.refineStages, nextStage, "failed", Date.now(), {
|
|
97772
97986
|
workspace,
|
|
97773
97987
|
workspaceMissing: true,
|
|
@@ -97787,12 +98001,12 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
97787
98001
|
}
|
|
97788
98002
|
};
|
|
97789
98003
|
}
|
|
97790
|
-
var
|
|
98004
|
+
var import_node_fs9;
|
|
97791
98005
|
var REFINE_INFLIGHT_FRESHNESS_MS;
|
|
97792
98006
|
var init_mesh_refine_inflight = __esm2({
|
|
97793
98007
|
"src/mesh/mesh-refine-inflight.ts"() {
|
|
97794
98008
|
"use strict";
|
|
97795
|
-
|
|
98009
|
+
import_node_fs9 = require("fs");
|
|
97796
98010
|
init_mesh_refine_zombie_sweep();
|
|
97797
98011
|
init_mesh_refine_landing();
|
|
97798
98012
|
init_mesh_refine_gates();
|
|
@@ -98619,7 +98833,7 @@ ${excerpt}` : "\n--- git output ---\n(none captured)");
|
|
|
98619
98833
|
if (!node.isLocalWorktree || !node.workspace) {
|
|
98620
98834
|
return { kind: "terminal", result: { success: false, error: `Refinery requires a local worktree node`, refineStages } };
|
|
98621
98835
|
}
|
|
98622
|
-
if (!(0,
|
|
98836
|
+
if (!(0, import_node_fs10.existsSync)(node.workspace)) {
|
|
98623
98837
|
recordMeshRefineStage(refineStages, "resolve_refs", "failed", Date.now(), {
|
|
98624
98838
|
workspace: node.workspace,
|
|
98625
98839
|
workspaceMissing: true
|
|
@@ -99851,6 +100065,7 @@ ${e?.stderr || ""}`;
|
|
|
99851
100065
|
baseRef,
|
|
99852
100066
|
branchRef,
|
|
99853
100067
|
diffCwd: node.workspace,
|
|
100068
|
+
repoRoot,
|
|
99854
100069
|
submodulePaths: submodulePathsByRepoRoot.get(repoRoot)
|
|
99855
100070
|
}));
|
|
99856
100071
|
}
|
|
@@ -100324,13 +100539,13 @@ ${e?.stderr || ""}`;
|
|
|
100324
100539
|
return handle;
|
|
100325
100540
|
}
|
|
100326
100541
|
var import_node_child_process16;
|
|
100327
|
-
var
|
|
100542
|
+
var import_node_fs10;
|
|
100328
100543
|
var RETRYABLE_BASE_MOVEMENT_CODES;
|
|
100329
100544
|
var init_router_refine = __esm2({
|
|
100330
100545
|
"src/commands/router-refine.ts"() {
|
|
100331
100546
|
"use strict";
|
|
100332
100547
|
import_node_child_process16 = require("child_process");
|
|
100333
|
-
|
|
100548
|
+
import_node_fs10 = require("fs");
|
|
100334
100549
|
init_logger();
|
|
100335
100550
|
init_debug_trace();
|
|
100336
100551
|
init_dist();
|
|
@@ -117699,17 +117914,17 @@ ${marker}`,
|
|
|
117699
117914
|
this.logShadowDivergence(ev);
|
|
117700
117915
|
if (ev.fired) {
|
|
117701
117916
|
this.commitTransition(ev.fired, now, ev);
|
|
117917
|
+
this.maybeMarkReady();
|
|
117702
117918
|
this.emitStateChanged(forceEmit);
|
|
117703
117919
|
this.scheduleWakeForState();
|
|
117704
117920
|
this.scheduleStallWatchdog();
|
|
117705
|
-
this.maybeMarkReady();
|
|
117706
117921
|
this.drainPendingSends();
|
|
117707
117922
|
return;
|
|
117708
117923
|
}
|
|
117924
|
+
this.maybeMarkReady();
|
|
117709
117925
|
this.emitStateChanged(forceEmit);
|
|
117710
117926
|
this.scheduleWakeForState();
|
|
117711
117927
|
this.scheduleStallWatchdog();
|
|
117712
|
-
this.maybeMarkReady();
|
|
117713
117928
|
this.drainPendingSends();
|
|
117714
117929
|
}
|
|
117715
117930
|
commitTransition(fired, now, ev) {
|
|
@@ -117980,7 +118195,6 @@ ${marker}`,
|
|
|
117980
118195
|
if (!st) return;
|
|
117981
118196
|
if (!st.initial && statusForState(st) === "idle") {
|
|
117982
118197
|
this.readySeenOnce = true;
|
|
117983
|
-
this.drainPendingSends();
|
|
117984
118198
|
}
|
|
117985
118199
|
}
|
|
117986
118200
|
// ────────────────────────────────────────────────────────────────────
|
|
@@ -120215,17 +120429,17 @@ ${marker}`,
|
|
|
120215
120429
|
}
|
|
120216
120430
|
function readSession(sessionPath) {
|
|
120217
120431
|
if (!sessionPath || !path40.isAbsolute(sessionPath)) return null;
|
|
120218
|
-
const
|
|
120219
|
-
if (!isSafeSessionId(
|
|
120432
|
+
const basename22 = path40.basename(sessionPath, ".jsonl");
|
|
120433
|
+
if (!isSafeSessionId(basename22)) return null;
|
|
120220
120434
|
if (!fs33.existsSync(sessionPath)) return null;
|
|
120221
120435
|
const sourceMtimeMs = statMtimeMs(sessionPath);
|
|
120222
|
-
const { messages, usageRecords } = parseTranscriptFile(sessionPath,
|
|
120436
|
+
const { messages, usageRecords } = parseTranscriptFile(sessionPath, basename22);
|
|
120223
120437
|
if (messages.length === 0) return null;
|
|
120224
120438
|
const firstSystem = messages.find((m) => m.kind === "session_start");
|
|
120225
120439
|
const workspace = firstSystem?.workspace || firstSystem?.content || void 0;
|
|
120226
120440
|
const session = {
|
|
120227
120441
|
messages,
|
|
120228
|
-
providerSessionId:
|
|
120442
|
+
providerSessionId: basename22,
|
|
120229
120443
|
source: "provider-native",
|
|
120230
120444
|
sourcePath: sessionPath,
|
|
120231
120445
|
sourceMtimeMs,
|
|
@@ -120234,7 +120448,7 @@ ${marker}`,
|
|
|
120234
120448
|
};
|
|
120235
120449
|
if (usageRecords.length > 0) {
|
|
120236
120450
|
session.usage = foldUsageRecords(usageRecords, {
|
|
120237
|
-
providerSessionId:
|
|
120451
|
+
providerSessionId: basename22,
|
|
120238
120452
|
agent: "claude-cli"
|
|
120239
120453
|
});
|
|
120240
120454
|
}
|
|
@@ -120528,8 +120742,8 @@ ${marker}`,
|
|
|
120528
120742
|
if (!fs34.existsSync(sessionPath)) return null;
|
|
120529
120743
|
const meta3 = readSessionMeta(sessionPath);
|
|
120530
120744
|
const metaId = String(meta3?.id ?? "").trim();
|
|
120531
|
-
const
|
|
120532
|
-
const uuidMatch =
|
|
120745
|
+
const basename22 = path41.basename(sessionPath, ".jsonl");
|
|
120746
|
+
const uuidMatch = basename22.match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);
|
|
120533
120747
|
const filenameUuid2 = uuidMatch ? uuidMatch[1] : "";
|
|
120534
120748
|
if (metaId && filenameUuid2 && metaId !== filenameUuid2) return null;
|
|
120535
120749
|
const sessionId = metaId || filenameUuid2;
|
|
@@ -122990,10 +123204,21 @@ ${text}` : text;
|
|
|
122990
123204
|
...sessionFields
|
|
122991
123205
|
};
|
|
122992
123206
|
}
|
|
123207
|
+
const readySeen = this.driver.hasSeenReady?.();
|
|
123208
|
+
if (readySeen === false) {
|
|
123209
|
+
return {
|
|
123210
|
+
status: "starting",
|
|
123211
|
+
messages: [],
|
|
123212
|
+
activeModal: null,
|
|
123213
|
+
activeInteractivePrompt: this.activeInteractivePrompt,
|
|
123214
|
+
fsmReadySeen: false,
|
|
123215
|
+
...sessionFields
|
|
123216
|
+
};
|
|
123217
|
+
}
|
|
122993
123218
|
if (state.status === "generating") {
|
|
122994
123219
|
return { status: "generating", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, ...sessionFields };
|
|
122995
123220
|
}
|
|
122996
|
-
return { status: "idle", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, fsmReadySeen:
|
|
123221
|
+
return { status: "idle", messages: [], activeModal: null, activeInteractivePrompt: this.activeInteractivePrompt, fsmReadySeen: readySeen === true, ...sessionFields };
|
|
122997
123222
|
}
|
|
122998
123223
|
maybeRefreshNativeHistory() {
|
|
122999
123224
|
}
|
|
@@ -126386,7 +126611,9 @@ ${buttons.join("\n")}`;
|
|
|
126386
126611
|
host.scheduleCompletedDebounceFlush(flushDelay);
|
|
126387
126612
|
}
|
|
126388
126613
|
} else if (newStatus === "idle" && host.lastStatus === "starting") {
|
|
126389
|
-
|
|
126614
|
+
if (adapterStatus.fsmReadySeen !== false) {
|
|
126615
|
+
host.emitAgentReadyOnce(chatTitle, now);
|
|
126616
|
+
}
|
|
126390
126617
|
if (host.startupGraceCollapseAt === null) host.startupGraceCollapseAt = now;
|
|
126391
126618
|
host.maybeSynthesizeStartupGraceCollapse(chatTitle, now, "startup_grace_fast_collapse");
|
|
126392
126619
|
} else if (newStatus === "error") {
|
|
@@ -130728,6 +130955,12 @@ ${rawInput}` : rawInput;
|
|
|
130728
130955
|
return managedBy === managerTag;
|
|
130729
130956
|
}
|
|
130730
130957
|
init_auto_approve_modes();
|
|
130958
|
+
function expandModelLaunchArgs(template, model, valueMap = void 0) {
|
|
130959
|
+
const requested = typeof model === "string" ? model.trim() : "";
|
|
130960
|
+
if (!requested || !Array.isArray(template) || template.length === 0) return void 0;
|
|
130961
|
+
const mapped = typeof valueMap?.[requested] === "string" && valueMap[requested].trim() ? valueMap[requested].trim() : requested;
|
|
130962
|
+
return template.map((part) => part.includes("{{model}}") ? part.split("{{model}}").join(mapped) : part);
|
|
130963
|
+
}
|
|
130731
130964
|
function isExplicitCommand(command) {
|
|
130732
130965
|
const trimmed = command.trim();
|
|
130733
130966
|
return path50.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~");
|
|
@@ -130980,11 +131213,6 @@ ${rawInput}` : rawInput;
|
|
|
130980
131213
|
return expanded;
|
|
130981
131214
|
});
|
|
130982
131215
|
}
|
|
130983
|
-
function expandModelLaunchArgs(template, model) {
|
|
130984
|
-
const m = typeof model === "string" ? model.trim() : "";
|
|
130985
|
-
if (!m || !Array.isArray(template) || template.length === 0) return void 0;
|
|
130986
|
-
return template.map((part) => part.includes("{{model}}") ? part.split("{{model}}").join(m) : part);
|
|
130987
|
-
}
|
|
130988
131216
|
function expandThinkingLaunchArgs(template, level, levelMap) {
|
|
130989
131217
|
const raw = typeof level === "string" ? level.trim() : "";
|
|
130990
131218
|
if (!raw || !Array.isArray(template) || template.length === 0) return void 0;
|
|
@@ -131481,7 +131709,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
131481
131709
|
const autoApproveLaunch = applyAutoApproveModeLaunchArgs(versionResolvedProvider, cliArgs, launchSettings);
|
|
131482
131710
|
const launchProvider = autoApproveLaunch.provider || provider;
|
|
131483
131711
|
const cliArgsWithAutoApprove = autoApproveLaunch.cliArgs;
|
|
131484
|
-
const modelLaunchArgs = expandModelLaunchArgs(
|
|
131712
|
+
const modelLaunchArgs = expandModelLaunchArgs(
|
|
131713
|
+
launchProvider?.modelLaunchArgs,
|
|
131714
|
+
initialModel,
|
|
131715
|
+
launchProvider?.modelLaunchValueMap
|
|
131716
|
+
);
|
|
131485
131717
|
const cliArgsWithModel = modelLaunchArgs ? [...modelLaunchArgs, ...cliArgsWithAutoApprove || []] : cliArgsWithAutoApprove;
|
|
131486
131718
|
if (initialModel && !modelLaunchArgs) {
|
|
131487
131719
|
LOG2.warn("CLI", `[${normalizedType}] initialModel='${initialModel}' requested but provider declares no modelLaunchArgs template \u2014 launching without model selection.`);
|
|
@@ -132558,6 +132790,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
132558
132790
|
"details",
|
|
132559
132791
|
"autoApproveModes",
|
|
132560
132792
|
"modelLaunchArgs",
|
|
132793
|
+
"modelLaunchValueMap",
|
|
132561
132794
|
"modelOptions",
|
|
132562
132795
|
"thinkingLaunchArgs",
|
|
132563
132796
|
"thinkingLevelMap",
|
|
@@ -136803,7 +137036,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
136803
137036
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
136804
137037
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
136805
137038
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
136806
|
-
const { existsSync:
|
|
137039
|
+
const { existsSync: existsSync76, readFileSync: readFileSync59, mkdirSync: mkdirSync35, writeFileSync: writeFileSync33 } = await import("fs");
|
|
136807
137040
|
const { dirname: dirname26, join: join75 } = await import("path");
|
|
136808
137041
|
const yaml6 = await Promise.resolve().then(() => (init_js_yaml(), js_yaml_exports));
|
|
136809
137042
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
@@ -136812,7 +137045,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
136812
137045
|
let existedAsYaml = false;
|
|
136813
137046
|
for (const relative8 of MESH_JSON_CONFIG_LOCATIONS2) {
|
|
136814
137047
|
const candidate = join75(workspace, relative8);
|
|
136815
|
-
if (!
|
|
137048
|
+
if (!existsSync76(candidate)) continue;
|
|
136816
137049
|
try {
|
|
136817
137050
|
const text = readFileSync59(candidate, "utf-8");
|
|
136818
137051
|
const parsed = /\.json$/i.test(candidate) ? JSON.parse(text) : yaml6.load(text);
|
|
@@ -137601,6 +137834,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
137601
137834
|
try {
|
|
137602
137835
|
const durationMs = Date.now() - startedAtMs;
|
|
137603
137836
|
const event = `worktree_${eventStatus2}`;
|
|
137837
|
+
const hostDaemonId = readNonEmptyString(mesh?.meshHost?.hostDaemonId);
|
|
137604
137838
|
const metadataEvent = {
|
|
137605
137839
|
source: "clone_mesh_node_bootstrap",
|
|
137606
137840
|
nodeId: node.id,
|
|
@@ -137608,6 +137842,9 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
137608
137842
|
worktreePath: result.worktreePath,
|
|
137609
137843
|
durationMs,
|
|
137610
137844
|
bootstrapStatus: bootstrapState2.status,
|
|
137845
|
+
...hostDaemonId ? { targetCoordinatorDaemonId: hostDaemonId } : {},
|
|
137846
|
+
...effectiveDaemonId ? { originDaemonId: effectiveDaemonId } : {},
|
|
137847
|
+
...effectiveMachineId ? { originMachineId: effectiveMachineId } : {},
|
|
137611
137848
|
...bootstrapState2.error ? { error: bootstrapState2.error } : {},
|
|
137612
137849
|
...bootstrapState2.exitCode !== void 0 ? { exitCode: bootstrapState2.exitCode } : {},
|
|
137613
137850
|
...extraPayload || {}
|
|
@@ -137622,7 +137859,16 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
137622
137859
|
getCachedInlineMesh: ctx.getCachedInlineMesh
|
|
137623
137860
|
}
|
|
137624
137861
|
},
|
|
137625
|
-
{
|
|
137862
|
+
{
|
|
137863
|
+
event,
|
|
137864
|
+
meshId,
|
|
137865
|
+
nodeId: node.id,
|
|
137866
|
+
workspace: result.worktreePath,
|
|
137867
|
+
metadataEvent,
|
|
137868
|
+
...hostDaemonId ? { targetCoordinatorDaemonId: hostDaemonId } : {},
|
|
137869
|
+
...effectiveDaemonId ? { originDaemonId: effectiveDaemonId } : {},
|
|
137870
|
+
...effectiveMachineId ? { originMachineId: effectiveMachineId } : {}
|
|
137871
|
+
}
|
|
137626
137872
|
);
|
|
137627
137873
|
if (forwarded?.success === true) return;
|
|
137628
137874
|
} catch {
|
|
@@ -137635,7 +137881,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
137635
137881
|
nodeId: node.id,
|
|
137636
137882
|
workspace: result.worktreePath,
|
|
137637
137883
|
metadataEvent,
|
|
137638
|
-
queuedAt: Date.now()
|
|
137884
|
+
queuedAt: Date.now(),
|
|
137885
|
+
...hostDaemonId ? { targetCoordinatorDaemonId: hostDaemonId } : {}
|
|
137639
137886
|
});
|
|
137640
137887
|
} catch {
|
|
137641
137888
|
}
|
|
@@ -139371,7 +139618,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
139371
139618
|
workspace
|
|
139372
139619
|
};
|
|
139373
139620
|
}
|
|
139374
|
-
const { existsSync:
|
|
139621
|
+
const { existsSync: existsSync76, readFileSync: readFileSync59, writeFileSync: writeFileSync33, copyFileSync: copyFileSync4, mkdirSync: mkdirSync35 } = await import("fs");
|
|
139375
139622
|
const { dirname: dirname26 } = await import("path");
|
|
139376
139623
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
139377
139624
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -139416,7 +139663,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
139416
139663
|
if (hermesManualFallback) return returnManualFallback(message);
|
|
139417
139664
|
return { success: false, code: "mesh_coordinator_config_write_failed", error: message, meshId, cliType, workspace };
|
|
139418
139665
|
}
|
|
139419
|
-
const hadExistingMcpConfig =
|
|
139666
|
+
const hadExistingMcpConfig = existsSync76(mcpConfigPath);
|
|
139420
139667
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
139421
139668
|
if (hermesBaseConfig) {
|
|
139422
139669
|
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname26(mcpConfigPath));
|
|
@@ -140234,7 +140481,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
140234
140481
|
const { deriveMeshReviewInboxItems: deriveMeshReviewInboxItems2 } = await Promise.resolve().then(() => (init_mesh_review_inbox(), mesh_review_inbox_exports));
|
|
140235
140482
|
const { readLedgerEntries: readLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
140236
140483
|
const { getGitDiffSummary: getGitDiffSummary2 } = await Promise.resolve().then(() => (init_git_diff(), git_diff_exports));
|
|
140237
|
-
const { existsSync:
|
|
140484
|
+
const { existsSync: existsSync76 } = await import("fs");
|
|
140238
140485
|
const meshRecord = await ctx.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
140239
140486
|
const mesh = meshRecord?.mesh;
|
|
140240
140487
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
@@ -140253,7 +140500,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
140253
140500
|
const derivation = deriveMeshReviewInboxItems2({ nodes: nodeStatuses, ledgerEntries });
|
|
140254
140501
|
for (const item of derivation.items) {
|
|
140255
140502
|
const workspace = item.workspace;
|
|
140256
|
-
if (!workspace || !
|
|
140503
|
+
if (!workspace || !existsSync76(workspace)) continue;
|
|
140257
140504
|
const baseRef = item.defaultBranch ? `origin/${item.defaultBranch}` : "origin/main";
|
|
140258
140505
|
try {
|
|
140259
140506
|
const diffResult = await getGitDiffSummary2(workspace, { baseRef, maxFiles: 100 });
|
|
@@ -141904,6 +142151,11 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
141904
142151
|
nodeId,
|
|
141905
142152
|
isLocalWorktree: true,
|
|
141906
142153
|
...opts?.workspace ? { workspace: opts.workspace } : {},
|
|
142154
|
+
// Origin identity from the worker's bootstrap event: without
|
|
142155
|
+
// these, isLocalAutoLaunchNode treats the shell as LOCAL and the
|
|
142156
|
+
// coordinator tries to spawn the remote worktree on itself.
|
|
142157
|
+
...opts?.daemonId ? { daemonId: opts.daemonId } : {},
|
|
142158
|
+
...opts?.machineId ? { machineId: opts.machineId } : {},
|
|
141907
142159
|
worktreeBootstrap: terminalBootstrap()
|
|
141908
142160
|
};
|
|
141909
142161
|
this.updateInlineMeshNode(meshId, shell, hydratedNode);
|
|
@@ -153902,10 +154154,10 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
|
|
|
153902
154154
|
init_fsm_evaluator();
|
|
153903
154155
|
init_fsm_loader();
|
|
153904
154156
|
var crypto9 = __toESM2(require("crypto"));
|
|
153905
|
-
var
|
|
154157
|
+
var import_node_fs11 = require("fs");
|
|
153906
154158
|
var import_node_path6 = require("path");
|
|
153907
154159
|
init_provider_cli_shared();
|
|
153908
|
-
var
|
|
154160
|
+
var import_node_fs12 = require("fs");
|
|
153909
154161
|
var import_node_path7 = require("path");
|
|
153910
154162
|
init_manifest();
|
|
153911
154163
|
var V1_PRIMITIVE_CATALOG = Object.freeze({
|