@adhdev/daemon-core 0.9.82-rc.414 → 0.9.82-rc.416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-adapters/resolve-executable.d.ts +55 -0
- package/dist/config/mesh-config.d.ts +23 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +354 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +343 -47
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events-coordinator.d.ts +1 -1
- package/dist/mesh/mesh-events.d.ts +1 -1
- package/dist/mesh/mesh-ledger.d.ts +1 -1
- package/dist/mesh/mesh-magi-status.d.ts +63 -0
- package/dist/mesh/mesh-queue-assignment.d.ts +18 -0
- package/dist/mesh/mesh-work-queue.d.ts +9 -0
- package/dist/repo-mesh-types.d.ts +8 -0
- package/package.json +2 -2
- package/src/cli-adapters/resolve-executable.ts +117 -3
- package/src/commands/med-family/mesh-queue.ts +23 -1
- package/src/config/mesh-config.ts +116 -0
- package/src/index.ts +12 -0
- package/src/mesh/mesh-event-forwarding.ts +23 -7
- package/src/mesh/mesh-events-coordinator.ts +1 -0
- package/src/mesh/mesh-events-pending.ts +15 -0
- package/src/mesh/mesh-events.ts +1 -0
- package/src/mesh/mesh-ledger.ts +7 -0
- package/src/mesh/mesh-magi-status.ts +223 -0
- package/src/mesh/mesh-queue-assignment.ts +24 -0
- package/src/mesh/mesh-refine-gates.ts +12 -5
- package/src/mesh/mesh-work-queue.ts +13 -0
- package/src/mesh/worktree-bootstrap-config.ts +6 -2
- package/src/repo-mesh-types.ts +8 -0
package/dist/index.js
CHANGED
|
@@ -389,10 +389,10 @@ function readInjected(value) {
|
|
|
389
389
|
}
|
|
390
390
|
function getDaemonBuildInfo() {
|
|
391
391
|
if (cached) return cached;
|
|
392
|
-
const commit = readInjected(true ? "
|
|
393
|
-
const commitShort = readInjected(true ? "
|
|
394
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
395
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
392
|
+
const commit = readInjected(true ? "b1b80482f0ae678be7cd54c6861ec8134eb2ffd0" : void 0) ?? "unknown";
|
|
393
|
+
const commitShort = readInjected(true ? "b1b80482" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
394
|
+
const version = readInjected(true ? "0.9.82-rc.416" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
395
|
+
const builtAt = readInjected(true ? "2026-06-28T15:54:36.726Z" : void 0);
|
|
396
396
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
397
397
|
return cached;
|
|
398
398
|
}
|
|
@@ -2562,15 +2562,20 @@ __export(mesh_config_exports, {
|
|
|
2562
2562
|
createMesh: () => createMesh,
|
|
2563
2563
|
createMeshHostPairingToken: () => createMeshHostPairingToken,
|
|
2564
2564
|
deleteMesh: () => deleteMesh,
|
|
2565
|
+
getMagiPanel: () => getMagiPanel,
|
|
2565
2566
|
getMesh: () => getMesh,
|
|
2566
2567
|
getMeshByRepo: () => getMeshByRepo,
|
|
2568
|
+
listMagiPanels: () => listMagiPanels,
|
|
2567
2569
|
listMeshes: () => listMeshes,
|
|
2568
2570
|
markMeshHostPairingJoined: () => markMeshHostPairingJoined,
|
|
2571
|
+
normalizeMagiPanel: () => normalizeMagiPanel,
|
|
2569
2572
|
normalizeRepoIdentity: () => normalizeRepoIdentity,
|
|
2573
|
+
removeMagiPanel: () => removeMagiPanel,
|
|
2570
2574
|
removeNode: () => removeNode,
|
|
2571
2575
|
tokenIdForManualPairing: () => tokenIdForManualPairing,
|
|
2572
2576
|
updateMesh: () => updateMesh,
|
|
2573
|
-
updateNode: () => updateNode
|
|
2577
|
+
updateNode: () => updateNode,
|
|
2578
|
+
upsertMagiPanel: () => upsertMagiPanel
|
|
2574
2579
|
});
|
|
2575
2580
|
function getMeshConfigPath() {
|
|
2576
2581
|
return (0, import_path3.join)(getConfigDir(), "meshes.json");
|
|
@@ -2943,7 +2948,89 @@ function updateNode(meshId, nodeId, opts) {
|
|
|
2943
2948
|
saveMeshConfig(config);
|
|
2944
2949
|
return node;
|
|
2945
2950
|
}
|
|
2946
|
-
|
|
2951
|
+
function normalizeReplicaCount(value) {
|
|
2952
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
2953
|
+
const n = Math.floor(value);
|
|
2954
|
+
return n >= 1 ? n : void 0;
|
|
2955
|
+
}
|
|
2956
|
+
function normalizeMagiPanel(config) {
|
|
2957
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
2958
|
+
throw new Error("invalid_magi_panel: config must be an object");
|
|
2959
|
+
}
|
|
2960
|
+
const raw = config;
|
|
2961
|
+
const rawMembers = raw.members;
|
|
2962
|
+
if (!Array.isArray(rawMembers) || rawMembers.length === 0) {
|
|
2963
|
+
throw new Error("invalid_magi_panel: members must be a non-empty array");
|
|
2964
|
+
}
|
|
2965
|
+
if (rawMembers.length > MAX_MAGI_PANEL_MEMBERS) {
|
|
2966
|
+
throw new Error(`invalid_magi_panel: too many members (max ${MAX_MAGI_PANEL_MEMBERS})`);
|
|
2967
|
+
}
|
|
2968
|
+
const members = rawMembers.map((entry, idx) => {
|
|
2969
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
2970
|
+
throw new Error(`invalid_magi_panel: member[${idx}] must be an object`);
|
|
2971
|
+
}
|
|
2972
|
+
const m = entry;
|
|
2973
|
+
const provider = typeof m.provider === "string" ? m.provider.trim() : "";
|
|
2974
|
+
if (!provider) {
|
|
2975
|
+
throw new Error(`invalid_magi_panel: member[${idx}].provider is required`);
|
|
2976
|
+
}
|
|
2977
|
+
const nodeId = typeof m.nodeId === "string" && m.nodeId.trim() ? m.nodeId.trim() : void 0;
|
|
2978
|
+
const capabilityTags = normalizeCapabilityTags(m.capabilityTags);
|
|
2979
|
+
const n = normalizeReplicaCount(m.n);
|
|
2980
|
+
return {
|
|
2981
|
+
provider,
|
|
2982
|
+
...nodeId ? { nodeId } : {},
|
|
2983
|
+
...capabilityTags ? { capabilityTags } : {},
|
|
2984
|
+
...n !== void 0 ? { n } : {}
|
|
2985
|
+
};
|
|
2986
|
+
});
|
|
2987
|
+
const description = typeof raw.description === "string" && raw.description.trim() ? raw.description.trim().slice(0, 200) : void 0;
|
|
2988
|
+
const defaultN = normalizeReplicaCount(raw.defaultN);
|
|
2989
|
+
return {
|
|
2990
|
+
...description ? { description } : {},
|
|
2991
|
+
members,
|
|
2992
|
+
...defaultN !== void 0 ? { defaultN } : {},
|
|
2993
|
+
// dedupExempt is always meaningful for a MAGI panel (intentional same-prompt
|
|
2994
|
+
// fan-out). Persist it true unless the caller explicitly disables it.
|
|
2995
|
+
dedupExempt: raw.dedupExempt === false ? false : true
|
|
2996
|
+
};
|
|
2997
|
+
}
|
|
2998
|
+
function normalizePanelName(name) {
|
|
2999
|
+
const trimmed = typeof name === "string" ? name.trim() : "";
|
|
3000
|
+
if (!trimmed) throw new Error("invalid_magi_panel: panel name is required");
|
|
3001
|
+
return trimmed.slice(0, 100);
|
|
3002
|
+
}
|
|
3003
|
+
function listMagiPanels() {
|
|
3004
|
+
return loadMeshConfig().magiPanels ?? {};
|
|
3005
|
+
}
|
|
3006
|
+
function getMagiPanel(name) {
|
|
3007
|
+
const key2 = typeof name === "string" ? name.trim() : "";
|
|
3008
|
+
if (!key2) return void 0;
|
|
3009
|
+
return loadMeshConfig().magiPanels?.[key2];
|
|
3010
|
+
}
|
|
3011
|
+
function upsertMagiPanel(name, config, opts = {}) {
|
|
3012
|
+
const key2 = normalizePanelName(name);
|
|
3013
|
+
const panel = normalizeMagiPanel(config);
|
|
3014
|
+
const stored = loadMeshConfig();
|
|
3015
|
+
const panels = stored.magiPanels ?? {};
|
|
3016
|
+
if (panels[key2] && opts.overwrite !== true) {
|
|
3017
|
+
throw new Error(`magi_panel_exists: panel '${key2}' already exists \u2014 pass overwrite=true to replace it`);
|
|
3018
|
+
}
|
|
3019
|
+
panels[key2] = panel;
|
|
3020
|
+
stored.magiPanels = panels;
|
|
3021
|
+
saveMeshConfig(stored);
|
|
3022
|
+
return panel;
|
|
3023
|
+
}
|
|
3024
|
+
function removeMagiPanel(name) {
|
|
3025
|
+
const key2 = typeof name === "string" ? name.trim() : "";
|
|
3026
|
+
if (!key2) return false;
|
|
3027
|
+
const stored = loadMeshConfig();
|
|
3028
|
+
if (!stored.magiPanels || !stored.magiPanels[key2]) return false;
|
|
3029
|
+
delete stored.magiPanels[key2];
|
|
3030
|
+
saveMeshConfig(stored);
|
|
3031
|
+
return true;
|
|
3032
|
+
}
|
|
3033
|
+
var import_fs3, import_path3, import_crypto3, mergeMeshPolicy, MAX_MAGI_PANEL_MEMBERS;
|
|
2947
3034
|
var init_mesh_config = __esm({
|
|
2948
3035
|
"src/config/mesh-config.ts"() {
|
|
2949
3036
|
"use strict";
|
|
@@ -2955,6 +3042,7 @@ var init_mesh_config = __esm({
|
|
|
2955
3042
|
init_repo_mesh_types();
|
|
2956
3043
|
init_mesh_host_ownership();
|
|
2957
3044
|
mergeMeshPolicy = mergeAndNormalizePolicy;
|
|
3045
|
+
MAX_MAGI_PANEL_MEMBERS = 24;
|
|
2958
3046
|
}
|
|
2959
3047
|
});
|
|
2960
3048
|
|
|
@@ -5142,6 +5230,7 @@ function enqueueTask(meshId, message, opts) {
|
|
|
5142
5230
|
requiredTags: resolvedRequiredTags,
|
|
5143
5231
|
...dependsOn.length > 0 ? { dependsOn } : {},
|
|
5144
5232
|
...typeof opts?.missionId === "string" && opts.missionId.trim() ? { missionId: opts.missionId.trim() } : {},
|
|
5233
|
+
...typeof opts?.consensusGroupId === "string" && opts.consensusGroupId.trim() ? { consensusGroupId: opts.consensusGroupId.trim() } : {},
|
|
5145
5234
|
...typeof opts?.sourceCoordinatorSessionId === "string" && opts.sourceCoordinatorSessionId.trim() ? { sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId.trim() } : {},
|
|
5146
5235
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5147
5236
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -8451,6 +8540,14 @@ function resolveWin32GlobalBin(trimmed) {
|
|
|
8451
8540
|
}
|
|
8452
8541
|
return null;
|
|
8453
8542
|
}
|
|
8543
|
+
function selectWin32ExecutableMatch(matches) {
|
|
8544
|
+
const cleaned = matches.map((m) => m.trim()).filter(Boolean);
|
|
8545
|
+
const direct = cleaned.find((m) => DIRECT_EXEC_EXT.has(path10.extname(m).toLowerCase()));
|
|
8546
|
+
if (direct) return direct;
|
|
8547
|
+
const shim = cleaned.find((m) => SHIM_EXEC_EXT.has(path10.extname(m).toLowerCase()));
|
|
8548
|
+
if (shim) return shim;
|
|
8549
|
+
return null;
|
|
8550
|
+
}
|
|
8454
8551
|
function resolveWin32Executable(command) {
|
|
8455
8552
|
if (process.platform !== "win32") return command;
|
|
8456
8553
|
const trimmed = (command || "").trim();
|
|
@@ -8463,8 +8560,8 @@ function resolveWin32Executable(command) {
|
|
|
8463
8560
|
}).trim();
|
|
8464
8561
|
if (out) {
|
|
8465
8562
|
const matches = out.split(/\r?\n/).map((s2) => s2.trim()).filter(Boolean);
|
|
8466
|
-
const
|
|
8467
|
-
|
|
8563
|
+
const selected = selectWin32ExecutableMatch(matches);
|
|
8564
|
+
if (selected) return selected;
|
|
8468
8565
|
}
|
|
8469
8566
|
} catch {
|
|
8470
8567
|
}
|
|
@@ -8472,7 +8569,38 @@ function resolveWin32Executable(command) {
|
|
|
8472
8569
|
if (globalBin) return globalBin;
|
|
8473
8570
|
return command;
|
|
8474
8571
|
}
|
|
8475
|
-
|
|
8572
|
+
function quoteWin32CmdArg(arg) {
|
|
8573
|
+
if (arg.length > 0 && !/[ \t"]/.test(arg)) return arg;
|
|
8574
|
+
let result = '"';
|
|
8575
|
+
let backslashes = 0;
|
|
8576
|
+
for (const ch of arg) {
|
|
8577
|
+
if (ch === "\\") {
|
|
8578
|
+
backslashes += 1;
|
|
8579
|
+
continue;
|
|
8580
|
+
}
|
|
8581
|
+
if (ch === '"') {
|
|
8582
|
+
result += "\\".repeat(backslashes * 2 + 1) + '"';
|
|
8583
|
+
backslashes = 0;
|
|
8584
|
+
continue;
|
|
8585
|
+
}
|
|
8586
|
+
result += "\\".repeat(backslashes) + ch;
|
|
8587
|
+
backslashes = 0;
|
|
8588
|
+
}
|
|
8589
|
+
result += "\\".repeat(backslashes * 2) + '"';
|
|
8590
|
+
return result;
|
|
8591
|
+
}
|
|
8592
|
+
function buildWin32ExecFileSpawn(resolvedCommand, args) {
|
|
8593
|
+
if (process.platform !== "win32") return { file: resolvedCommand, args };
|
|
8594
|
+
const ext = path10.extname(resolvedCommand).toLowerCase();
|
|
8595
|
+
if (!SHIM_EXEC_EXT.has(ext)) return { file: resolvedCommand, args };
|
|
8596
|
+
const commandLine = [resolvedCommand, ...args].map(quoteWin32CmdArg).join(" ");
|
|
8597
|
+
return {
|
|
8598
|
+
file: process.env.ComSpec || "cmd.exe",
|
|
8599
|
+
args: ["/d", "/s", "/c", `"${commandLine}"`],
|
|
8600
|
+
windowsVerbatimArguments: true
|
|
8601
|
+
};
|
|
8602
|
+
}
|
|
8603
|
+
var import_child_process, import_fs8, path10, DIRECT_EXEC_EXT, SHIM_EXEC_EXT, WIN_EXEC_EXT;
|
|
8476
8604
|
var init_resolve_executable = __esm({
|
|
8477
8605
|
"src/cli-adapters/resolve-executable.ts"() {
|
|
8478
8606
|
"use strict";
|
|
@@ -8480,6 +8608,7 @@ var init_resolve_executable = __esm({
|
|
|
8480
8608
|
import_fs8 = require("fs");
|
|
8481
8609
|
path10 = __toESM(require("path"));
|
|
8482
8610
|
DIRECT_EXEC_EXT = /* @__PURE__ */ new Set([".exe", ".com"]);
|
|
8611
|
+
SHIM_EXEC_EXT = /* @__PURE__ */ new Set([".cmd", ".bat"]);
|
|
8483
8612
|
WIN_EXEC_EXT = [".exe", ".com", ".cmd", ".bat"];
|
|
8484
8613
|
}
|
|
8485
8614
|
});
|
|
@@ -8664,14 +8793,16 @@ async function runMeshWorktreeBootstrap(mesh, workspace) {
|
|
|
8664
8793
|
const startedAt = Date.now();
|
|
8665
8794
|
state.lastCommand = command.displayCommand;
|
|
8666
8795
|
const resolvedCommand = resolveWin32Executable(command.command);
|
|
8796
|
+
const spawn4 = buildWin32ExecFileSpawn(resolvedCommand, command.args);
|
|
8667
8797
|
try {
|
|
8668
|
-
const result = await execFileAsync4(
|
|
8798
|
+
const result = await execFileAsync4(spawn4.file, spawn4.args, {
|
|
8669
8799
|
cwd,
|
|
8670
8800
|
encoding: "utf8",
|
|
8671
8801
|
timeout: command.timeoutMs || DEFAULT_TIMEOUT_MS2,
|
|
8672
8802
|
maxBuffer: command.outputLimitBytes || DEFAULT_OUTPUT_LIMIT_BYTES,
|
|
8673
8803
|
env: { ...process.env, CI: process.env.CI || "1", ...command.env || {} },
|
|
8674
|
-
windowsHide: true
|
|
8804
|
+
windowsHide: true,
|
|
8805
|
+
...spawn4.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
8675
8806
|
});
|
|
8676
8807
|
state.commandsRun?.push({
|
|
8677
8808
|
command: command.command,
|
|
@@ -10145,7 +10276,7 @@ var init_mesh_scheduling_runtime = __esm({
|
|
|
10145
10276
|
function readNonEmptyString2(value) {
|
|
10146
10277
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
10147
10278
|
}
|
|
10148
|
-
function
|
|
10279
|
+
function readRecord5(value) {
|
|
10149
10280
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
10150
10281
|
}
|
|
10151
10282
|
function buildMeshWorkerRelayStamp(currentSettings, meshContext) {
|
|
@@ -10173,17 +10304,17 @@ function resolveEventSessionId(event, fallback) {
|
|
|
10173
10304
|
return readNonEmptyString2(event.targetSessionId) || readNonEmptyString2(event.sessionId) || readNonEmptyString2(event.instanceId) || readNonEmptyString2(fallback);
|
|
10174
10305
|
}
|
|
10175
10306
|
function readRefineJobId(event) {
|
|
10176
|
-
const metadata =
|
|
10177
|
-
const result =
|
|
10178
|
-
const refineJob =
|
|
10307
|
+
const metadata = readRecord5(event.metadataEvent) || event;
|
|
10308
|
+
const result = readRecord5(metadata.result);
|
|
10309
|
+
const refineJob = readRecord5(result?.refineJob);
|
|
10179
10310
|
return readNonEmptyString2(metadata.jobId) || readNonEmptyString2(refineJob?.jobId);
|
|
10180
10311
|
}
|
|
10181
10312
|
function readWorkerResultMetadata(event) {
|
|
10182
|
-
return
|
|
10313
|
+
return readRecord5(event.workerResult) || readRecord5(event.meshWorkerResult) || readRecord5(event.structuredResult);
|
|
10183
10314
|
}
|
|
10184
10315
|
function readMeshCompletionSummary(metadataEvent) {
|
|
10185
10316
|
const workerResult = readWorkerResultMetadata(metadataEvent);
|
|
10186
|
-
const resultRecord =
|
|
10317
|
+
const resultRecord = readRecord5(metadataEvent.result);
|
|
10187
10318
|
return readNonEmptyString2(metadataEvent.finalSummary) || readNonEmptyString2(workerResult?.summary) || readNonEmptyString2(workerResult?.finalSummary) || readNonEmptyString2(resultRecord?.summary) || readNonEmptyString2(resultRecord?.finalSummary);
|
|
10188
10319
|
}
|
|
10189
10320
|
function truncateSurfacedPreview(text) {
|
|
@@ -10221,7 +10352,7 @@ function readEventTimestampValue(value) {
|
|
|
10221
10352
|
return 0;
|
|
10222
10353
|
}
|
|
10223
10354
|
function isMissingFinalAssistantDiagnostic(record) {
|
|
10224
|
-
const diag =
|
|
10355
|
+
const diag = readRecord5(record?.completionDiagnostic);
|
|
10225
10356
|
return diag?.finalAssistantPresent === false || diag?.blockReason === "missing_final_assistant";
|
|
10226
10357
|
}
|
|
10227
10358
|
function isFalseIdleCompletion(record) {
|
|
@@ -10330,10 +10461,10 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
10330
10461
|
}
|
|
10331
10462
|
if (args.event === "refine:completed") {
|
|
10332
10463
|
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
10333
|
-
const result =
|
|
10334
|
-
const validationSummary =
|
|
10335
|
-
const patchEquivalence =
|
|
10336
|
-
const finalConvergence =
|
|
10464
|
+
const result = readRecord5(args.metadataEvent.result);
|
|
10465
|
+
const validationSummary = readRecord5(result?.validationSummary);
|
|
10466
|
+
const patchEquivalence = readRecord5(result?.patchEquivalence);
|
|
10467
|
+
const finalConvergence = readRecord5(result?.finalBranchConvergenceState);
|
|
10337
10468
|
const validationStatus = readNonEmptyString2(validationSummary?.status);
|
|
10338
10469
|
const patchStatus = readNonEmptyString2(patchEquivalence?.status) || (patchEquivalence?.equivalent === true ? "passed" : "");
|
|
10339
10470
|
const into = readNonEmptyString2(result?.into);
|
|
@@ -10354,10 +10485,10 @@ Next step: ${nextStep}`;
|
|
|
10354
10485
|
}
|
|
10355
10486
|
if (args.event === "refine:failed") {
|
|
10356
10487
|
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
10357
|
-
const result =
|
|
10358
|
-
const validationSummary =
|
|
10359
|
-
const patchEquivalence =
|
|
10360
|
-
const finalConvergence =
|
|
10488
|
+
const result = readRecord5(args.metadataEvent.result);
|
|
10489
|
+
const validationSummary = readRecord5(result?.validationSummary);
|
|
10490
|
+
const patchEquivalence = readRecord5(result?.patchEquivalence);
|
|
10491
|
+
const finalConvergence = readRecord5(result?.finalBranchConvergenceState);
|
|
10361
10492
|
const code = readNonEmptyString2(result?.code);
|
|
10362
10493
|
const error = readNonEmptyString2(result?.error);
|
|
10363
10494
|
const validationStatus = readNonEmptyString2(validationSummary?.status);
|
|
@@ -10397,9 +10528,9 @@ function normalizeCoordinatorDaemonIds(coordinatorDaemonId) {
|
|
|
10397
10528
|
return expandDaemonIdForms(coordinatorDaemonId);
|
|
10398
10529
|
}
|
|
10399
10530
|
function readRefineJobId2(event) {
|
|
10400
|
-
const metadata =
|
|
10401
|
-
const result =
|
|
10402
|
-
const refineJob =
|
|
10531
|
+
const metadata = readRecord5(event.metadataEvent) || event;
|
|
10532
|
+
const result = readRecord5(metadata.result);
|
|
10533
|
+
const refineJob = readRecord5(result?.refineJob);
|
|
10403
10534
|
return readNonEmptyString2(metadata.jobId) || readNonEmptyString2(refineJob?.jobId);
|
|
10404
10535
|
}
|
|
10405
10536
|
function hasPendingRefineTerminalEventDuplicate(event) {
|
|
@@ -10411,12 +10542,12 @@ function hasPendingRefineTerminalEventDuplicate(event) {
|
|
|
10411
10542
|
);
|
|
10412
10543
|
}
|
|
10413
10544
|
function buildPendingEventFingerprint(event) {
|
|
10414
|
-
const metadata =
|
|
10545
|
+
const metadata = readRecord5(event.metadataEvent) || {};
|
|
10415
10546
|
if (event.event === "worktree_bootstrap_complete" || event.event === "worktree_bootstrap_failed") {
|
|
10416
10547
|
return [event.meshId, event.event, event.nodeId || ""].join("::");
|
|
10417
10548
|
}
|
|
10418
10549
|
if (TERMINAL_COMPLETION_EVENTS.has(event.event)) {
|
|
10419
|
-
const terminalTaskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(
|
|
10550
|
+
const terminalTaskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(readRecord5(metadata.payload)?.taskId);
|
|
10420
10551
|
if (terminalTaskId) {
|
|
10421
10552
|
return [
|
|
10422
10553
|
event.meshId,
|
|
@@ -10426,9 +10557,14 @@ function buildPendingEventFingerprint(event) {
|
|
|
10426
10557
|
].join("::");
|
|
10427
10558
|
}
|
|
10428
10559
|
}
|
|
10560
|
+
const consensusGroupId = readNonEmptyString2(metadata.consensusGroupId) || readNonEmptyString2(readRecord5(metadata.payload)?.consensusGroupId);
|
|
10561
|
+
if (consensusGroupId) {
|
|
10562
|
+
const groupTaskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(readRecord5(metadata.payload)?.taskId);
|
|
10563
|
+
return [event.meshId, event.event, groupTaskId || "", consensusGroupId, "group"].join("::");
|
|
10564
|
+
}
|
|
10429
10565
|
const sessionId = resolveEventSessionId(metadata);
|
|
10430
10566
|
const providerSessionId = readNonEmptyString2(metadata.providerSessionId);
|
|
10431
|
-
const taskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(
|
|
10567
|
+
const taskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(readRecord5(metadata.payload)?.taskId);
|
|
10432
10568
|
const jobId = readRefineJobId2(event);
|
|
10433
10569
|
const timestamp = metadata.timestamp !== void 0 && metadata.timestamp !== null ? String(metadata.timestamp) : "";
|
|
10434
10570
|
return [
|
|
@@ -10496,15 +10632,15 @@ function refineTerminalEventFromLedger(meshId, pending) {
|
|
|
10496
10632
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
10497
10633
|
const entry = entries[i];
|
|
10498
10634
|
if (entry.kind !== "task_completed" && entry.kind !== "task_failed") continue;
|
|
10499
|
-
const payload =
|
|
10635
|
+
const payload = readRecord5(entry.payload);
|
|
10500
10636
|
if (payload?.source !== "refine_mesh_node_async_job") continue;
|
|
10501
|
-
const refineJob =
|
|
10637
|
+
const refineJob = readRecord5(payload.refineJob);
|
|
10502
10638
|
const jobId = readNonEmptyString2(refineJob?.jobId);
|
|
10503
10639
|
if (!jobId || !acceptedJobIds.has(jobId)) continue;
|
|
10504
10640
|
const eventName = entry.kind === "task_completed" ? "refine:completed" : "refine:failed";
|
|
10505
10641
|
if (existingTerminalJobIds.has(`${eventName}:${jobId}`)) continue;
|
|
10506
10642
|
existingTerminalJobIds.add(`${eventName}:${jobId}`);
|
|
10507
|
-
const result =
|
|
10643
|
+
const result = readRecord5(payload.result);
|
|
10508
10644
|
const metadataEvent = {
|
|
10509
10645
|
source: "refine_mesh_node_async_job",
|
|
10510
10646
|
jobId,
|
|
@@ -11012,7 +11148,7 @@ function buildNoProgressCompletionReconciliation(args) {
|
|
|
11012
11148
|
const providerType = readNonEmptyString2(args.metadataEvent.providerType);
|
|
11013
11149
|
const providerSessionId = readNonEmptyString2(args.metadataEvent.providerSessionId);
|
|
11014
11150
|
const workerResult = readWorkerResultMetadata(args.metadataEvent);
|
|
11015
|
-
const completionDiagnostic =
|
|
11151
|
+
const completionDiagnostic = readRecord5(args.metadataEvent.completionDiagnostic);
|
|
11016
11152
|
const finalSummary = readNonEmptyString2(args.metadataEvent.finalSummary);
|
|
11017
11153
|
const status = readNonEmptyString2(args.metadataEvent.status).toLowerCase();
|
|
11018
11154
|
const explicitCompletionEvidence = Boolean(
|
|
@@ -12252,6 +12388,12 @@ function sessionHasActiveAssignment(meshId, sessionId) {
|
|
|
12252
12388
|
}
|
|
12253
12389
|
return false;
|
|
12254
12390
|
}
|
|
12391
|
+
function isSessionActivelyGenerating(components, sessionId) {
|
|
12392
|
+
if (!sessionId) return false;
|
|
12393
|
+
const state = components.instanceManager?.getInstance?.(sessionId)?.getState?.();
|
|
12394
|
+
if (!state) return false;
|
|
12395
|
+
return sessionStateLooksActive(state);
|
|
12396
|
+
}
|
|
12255
12397
|
function liveSessionCountForNode(components, meshId, nodeId) {
|
|
12256
12398
|
return components.instanceManager.getByCategory("cli").filter((inst) => {
|
|
12257
12399
|
const state = inst.getState();
|
|
@@ -15696,13 +15838,22 @@ function injectMeshSystemMessage(components, args) {
|
|
|
15696
15838
|
) || readNonEmptyString2(args.metadataEvent.meshCoordinatorSessionId);
|
|
15697
15839
|
const enrichedMetadataEvent = (() => {
|
|
15698
15840
|
const last = sourceSession ? getLastDisplayMessage(sourceSession.getState()) : null;
|
|
15699
|
-
|
|
15700
|
-
return {
|
|
15841
|
+
const base = !last || !last.preview ? args.metadataEvent : {
|
|
15701
15842
|
...args.metadataEvent,
|
|
15702
15843
|
lastMessagePreview: last.preview,
|
|
15703
15844
|
lastMessageRole: last.role,
|
|
15704
15845
|
...last.receivedAt > 0 ? { lastMessageAt: last.receivedAt } : {}
|
|
15705
15846
|
};
|
|
15847
|
+
if (readNonEmptyString2(base.consensusGroupId)) return base;
|
|
15848
|
+
const eventTaskId = readNonEmptyString2(args.metadataEvent.taskId);
|
|
15849
|
+
if (!eventTaskId) return base;
|
|
15850
|
+
try {
|
|
15851
|
+
const entry = MeshRuntimeStore.getInstance().findQueueEntryById(args.meshId, eventTaskId);
|
|
15852
|
+
const consensusGroupId = readNonEmptyString2(entry?.consensusGroupId);
|
|
15853
|
+
if (consensusGroupId) return { ...base, consensusGroupId };
|
|
15854
|
+
} catch {
|
|
15855
|
+
}
|
|
15856
|
+
return base;
|
|
15706
15857
|
})();
|
|
15707
15858
|
if (components.onMeshCoordinatorEventForwarded) {
|
|
15708
15859
|
try {
|
|
@@ -17319,6 +17470,7 @@ __export(mesh_events_exports, {
|
|
|
17319
17470
|
getPendingMeshCoordinatorEvents: () => getPendingMeshCoordinatorEvents,
|
|
17320
17471
|
handleMeshForwardEvent: () => handleMeshForwardEvent,
|
|
17321
17472
|
isMeshCoordinatorEvent: () => isMeshCoordinatorEvent,
|
|
17473
|
+
isSessionActivelyGenerating: () => isSessionActivelyGenerating,
|
|
17322
17474
|
queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
|
|
17323
17475
|
reconcileDirectDispatchCompletionFromTranscript: () => reconcileDirectDispatchCompletionFromTranscript,
|
|
17324
17476
|
resolveCoordinatorDrainDeliverability: () => resolveCoordinatorDrainDeliverability,
|
|
@@ -23008,6 +23160,7 @@ __export(index_exports, {
|
|
|
23008
23160
|
IdeProviderInstance: () => IdeProviderInstance,
|
|
23009
23161
|
InMemoryGitSnapshotStore: () => InMemoryGitSnapshotStore,
|
|
23010
23162
|
LOG: () => LOG,
|
|
23163
|
+
MAGI_NEEDS_VERIFICATION_PREVIEW_CAP: () => MAGI_NEEDS_VERIFICATION_PREVIEW_CAP,
|
|
23011
23164
|
MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
|
|
23012
23165
|
MESH_CONVERGE_FAST_FORWARD_TAG: () => MESH_CONVERGE_FAST_FORWARD_TAG,
|
|
23013
23166
|
MESH_CONVERGE_REFINE_TAG: () => MESH_CONVERGE_REFINE_TAG,
|
|
@@ -23029,8 +23182,10 @@ __export(index_exports, {
|
|
|
23029
23182
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
23030
23183
|
ProviderInstanceManager: () => ProviderInstanceManager,
|
|
23031
23184
|
ProviderLoader: () => ProviderLoader,
|
|
23185
|
+
RECENT_MAGI_CAP: () => RECENT_MAGI_CAP,
|
|
23032
23186
|
RECENT_TERMINAL_REFINE_CAP: () => RECENT_TERMINAL_REFINE_CAP,
|
|
23033
23187
|
RawTerminalAttachment: () => RawTerminalAttachment,
|
|
23188
|
+
STALE_MAGI_WINDOW_MS: () => STALE_MAGI_WINDOW_MS,
|
|
23034
23189
|
STALE_TERMINAL_REFINE_WINDOW_MS: () => STALE_TERMINAL_REFINE_WINDOW_MS,
|
|
23035
23190
|
STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
23036
23191
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
|
|
@@ -23060,6 +23215,7 @@ __export(index_exports, {
|
|
|
23060
23215
|
buildMeshHostRequiredFailure: () => buildMeshHostRequiredFailure,
|
|
23061
23216
|
buildMeshLedgerReconciliationEvidence: () => buildMeshLedgerReconciliationEvidence,
|
|
23062
23217
|
buildMeshLedgerReplicaEvidence: () => buildMeshLedgerReplicaEvidence,
|
|
23218
|
+
buildMeshMagiActivity: () => buildMeshMagiActivity,
|
|
23063
23219
|
buildMeshNodeCapabilityTags: () => buildMeshNodeCapabilityTags,
|
|
23064
23220
|
buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
|
|
23065
23221
|
buildMeshNodeProbeFreshness: () => buildMeshNodeProbeFreshness,
|
|
@@ -23146,8 +23302,10 @@ __export(index_exports, {
|
|
|
23146
23302
|
getLedgerDir: () => getLedgerDir,
|
|
23147
23303
|
getLedgerSummary: () => getLedgerSummary,
|
|
23148
23304
|
getLogLevel: () => getLogLevel,
|
|
23305
|
+
getMagiPanel: () => getMagiPanel,
|
|
23149
23306
|
getMesh: () => getMesh,
|
|
23150
23307
|
getMeshByRepo: () => getMeshByRepo,
|
|
23308
|
+
getMeshMagiActivityByGroup: () => getMeshMagiActivityByGroup,
|
|
23151
23309
|
getMeshMission: () => getMeshMission,
|
|
23152
23310
|
getMeshMissions: () => getMeshMissions,
|
|
23153
23311
|
getMeshQueueRevision: () => getMeshQueueRevision,
|
|
@@ -23199,6 +23357,7 @@ __export(index_exports, {
|
|
|
23199
23357
|
launchWithCdp: () => launchWithCdp,
|
|
23200
23358
|
listCoordinatorsForWorkspace: () => listCoordinatorsForWorkspace,
|
|
23201
23359
|
listHostedCliRuntimes: () => listHostedCliRuntimes,
|
|
23360
|
+
listMagiPanels: () => listMagiPanels,
|
|
23202
23361
|
listMeshMissionSummaries: () => listMeshMissionSummaries,
|
|
23203
23362
|
listMeshes: () => listMeshes,
|
|
23204
23363
|
listWorktrees: () => listWorktrees,
|
|
@@ -23231,6 +23390,7 @@ __export(index_exports, {
|
|
|
23231
23390
|
normalizeInputEnvelope: () => normalizeInputEnvelope,
|
|
23232
23391
|
normalizeInteractivePrompt: () => normalizeInteractivePrompt,
|
|
23233
23392
|
normalizeInteractivePromptResponse: () => normalizeInteractivePromptResponse,
|
|
23393
|
+
normalizeMagiPanel: () => normalizeMagiPanel,
|
|
23234
23394
|
normalizeManagedStatus: () => normalizeManagedStatus,
|
|
23235
23395
|
normalizeMeshCapabilityTags: () => normalizeMeshCapabilityTags,
|
|
23236
23396
|
normalizeMeshDaemonRole: () => normalizeMeshDaemonRole,
|
|
@@ -23268,6 +23428,7 @@ __export(index_exports, {
|
|
|
23268
23428
|
recordMeshToolCall: () => recordMeshToolCall,
|
|
23269
23429
|
registerExtensionProviders: () => registerExtensionProviders,
|
|
23270
23430
|
registerMeshCoordinator: () => registerMeshCoordinator,
|
|
23431
|
+
removeMagiPanel: () => removeMagiPanel,
|
|
23271
23432
|
removeNode: () => removeNode,
|
|
23272
23433
|
removeWorktree: () => removeWorktree,
|
|
23273
23434
|
requeueTask: () => requeueTask,
|
|
@@ -23311,6 +23472,7 @@ __export(index_exports, {
|
|
|
23311
23472
|
suggestMeshRefineConfig: () => suggestMeshRefineConfig,
|
|
23312
23473
|
summarizeGitStatus: () => summarizeGitStatus,
|
|
23313
23474
|
summarizeMeshAsyncRefineJobs: () => summarizeMeshAsyncRefineJobs,
|
|
23475
|
+
summarizeMeshMagiActivity: () => summarizeMeshMagiActivity,
|
|
23314
23476
|
summarizeMeshMission: () => summarizeMeshMission,
|
|
23315
23477
|
summarizeMissionTasks: () => summarizeMissionTasks,
|
|
23316
23478
|
triggerMeshQueue: () => triggerMeshQueue,
|
|
@@ -23322,6 +23484,7 @@ __export(index_exports, {
|
|
|
23322
23484
|
updateSessionDeliveryStatus: () => updateSessionDeliveryStatus,
|
|
23323
23485
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
23324
23486
|
updateTaskStatus: () => updateTaskStatus,
|
|
23487
|
+
upsertMagiPanel: () => upsertMagiPanel,
|
|
23325
23488
|
upsertMeshMission: () => upsertMeshMission,
|
|
23326
23489
|
upsertSavedProviderSession: () => upsertSavedProviderSession,
|
|
23327
23490
|
validateChangeImpactConfig: () => validateChangeImpactConfig,
|
|
@@ -24671,6 +24834,124 @@ function buildMeshLedgerReconciliationEvidence(meshId, replicas) {
|
|
|
24671
24834
|
init_mesh_work_queue();
|
|
24672
24835
|
init_mesh_active_work();
|
|
24673
24836
|
init_mesh_refine_status();
|
|
24837
|
+
|
|
24838
|
+
// src/mesh/mesh-magi-status.ts
|
|
24839
|
+
function readString7(value) {
|
|
24840
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
24841
|
+
}
|
|
24842
|
+
function readRecord4(value) {
|
|
24843
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
24844
|
+
}
|
|
24845
|
+
function readNumber2(value) {
|
|
24846
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
24847
|
+
}
|
|
24848
|
+
var MAGI_NEEDS_VERIFICATION_PREVIEW_CAP = 8;
|
|
24849
|
+
function summarizeNeedsVerification(synthesis) {
|
|
24850
|
+
const list = Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification : void 0;
|
|
24851
|
+
if (!list) return void 0;
|
|
24852
|
+
const items = [];
|
|
24853
|
+
for (const raw of list.slice(0, MAGI_NEEDS_VERIFICATION_PREVIEW_CAP)) {
|
|
24854
|
+
const r = readRecord4(raw);
|
|
24855
|
+
const claim = readString7(r?.claim);
|
|
24856
|
+
if (!claim) continue;
|
|
24857
|
+
items.push({ claim, category: readString7(r?.category) || "needs_verification" });
|
|
24858
|
+
}
|
|
24859
|
+
return items;
|
|
24860
|
+
}
|
|
24861
|
+
function mergeGroup(groups, patch) {
|
|
24862
|
+
const consensusGroupId = readString7(patch.consensusGroupId);
|
|
24863
|
+
if (!consensusGroupId) return;
|
|
24864
|
+
const previous = groups.get(consensusGroupId);
|
|
24865
|
+
const status = patch.status === "synthesized" || previous?.status === "synthesized" ? "synthesized" : "running";
|
|
24866
|
+
const definedPatch = Object.fromEntries(
|
|
24867
|
+
Object.entries(patch).filter(([, v]) => v !== void 0)
|
|
24868
|
+
);
|
|
24869
|
+
groups.set(consensusGroupId, { ...previous, ...definedPatch, consensusGroupId, status });
|
|
24870
|
+
}
|
|
24871
|
+
function buildMeshMagiActivity(args) {
|
|
24872
|
+
const groups = /* @__PURE__ */ new Map();
|
|
24873
|
+
for (const entry of args.ledgerEntries || []) {
|
|
24874
|
+
const payload = readRecord4(entry.payload);
|
|
24875
|
+
if (payload?.source !== "magi") continue;
|
|
24876
|
+
const consensusGroupId = readString7(payload.consensusGroupId);
|
|
24877
|
+
if (!consensusGroupId) continue;
|
|
24878
|
+
if (entry.kind === "magi_synthesis") {
|
|
24879
|
+
const synthesis = readRecord4(payload.synthesis);
|
|
24880
|
+
mergeGroup(groups, {
|
|
24881
|
+
consensusGroupId,
|
|
24882
|
+
status: "synthesized",
|
|
24883
|
+
missionId: readString7(payload.missionId),
|
|
24884
|
+
panel: readString7(payload.panel),
|
|
24885
|
+
question: readString7(payload.question),
|
|
24886
|
+
replicaCount: readNumber2(synthesis?.replicasExpected) ?? readNumber2(payload.replicaCount),
|
|
24887
|
+
answered: readNumber2(synthesis?.replicasAnswered),
|
|
24888
|
+
missing: readNumber2(synthesis?.replicasMissing),
|
|
24889
|
+
staleReplicas: readNumber2(payload.staleReplicas) ?? readNumber2(synthesis?.staleReplicas),
|
|
24890
|
+
needsVerificationCount: Array.isArray(synthesis?.needsVerification) ? synthesis.needsVerification.length : void 0,
|
|
24891
|
+
agreedCount: Array.isArray(synthesis?.agreed) ? synthesis.agreed.length : void 0,
|
|
24892
|
+
independenceBanner: synthesis && "independenceBanner" in synthesis ? synthesis.independenceBanner : void 0,
|
|
24893
|
+
gitSkew: readRecord4(synthesis?.gitSkew),
|
|
24894
|
+
needsVerification: summarizeNeedsVerification(synthesis),
|
|
24895
|
+
openQuestions: Array.isArray(synthesis?.openQuestions) ? synthesis.openQuestions.slice(0, 10) : void 0,
|
|
24896
|
+
lastLedgerKind: entry.kind,
|
|
24897
|
+
lastUpdatedAt: entry.timestamp
|
|
24898
|
+
});
|
|
24899
|
+
} else if (entry.kind === "magi_dispatched") {
|
|
24900
|
+
mergeGroup(groups, {
|
|
24901
|
+
consensusGroupId,
|
|
24902
|
+
status: "running",
|
|
24903
|
+
missionId: readString7(payload.missionId),
|
|
24904
|
+
panel: readString7(payload.panel),
|
|
24905
|
+
question: readString7(payload.question),
|
|
24906
|
+
replicaCount: readNumber2(payload.replicaCount),
|
|
24907
|
+
lastLedgerKind: entry.kind,
|
|
24908
|
+
lastUpdatedAt: entry.timestamp
|
|
24909
|
+
});
|
|
24910
|
+
}
|
|
24911
|
+
}
|
|
24912
|
+
return Array.from(groups.values()).sort((a, b) => {
|
|
24913
|
+
const at = new Date(a.lastUpdatedAt || "").getTime();
|
|
24914
|
+
const bt = new Date(b.lastUpdatedAt || "").getTime();
|
|
24915
|
+
return (Number.isFinite(bt) ? bt : 0) - (Number.isFinite(at) ? at : 0);
|
|
24916
|
+
});
|
|
24917
|
+
}
|
|
24918
|
+
var STALE_MAGI_WINDOW_MS = 6 * 60 * 60 * 1e3;
|
|
24919
|
+
var RECENT_MAGI_CAP = 6;
|
|
24920
|
+
function activityTime(g) {
|
|
24921
|
+
const t = new Date(g.lastUpdatedAt || "").getTime();
|
|
24922
|
+
return Number.isFinite(t) ? t : 0;
|
|
24923
|
+
}
|
|
24924
|
+
function summarizeMeshMagiActivity(activity) {
|
|
24925
|
+
const running = [];
|
|
24926
|
+
const synthesized = [];
|
|
24927
|
+
for (const g of activity) {
|
|
24928
|
+
if (g.status === "synthesized") synthesized.push(g);
|
|
24929
|
+
else running.push(g);
|
|
24930
|
+
}
|
|
24931
|
+
let newest = 0;
|
|
24932
|
+
for (const g of activity) newest = Math.max(newest, activityTime(g));
|
|
24933
|
+
const cutoff = newest - STALE_MAGI_WINDOW_MS;
|
|
24934
|
+
const synthesizedByRecency = [...synthesized].sort((a, b) => activityTime(b) - activityTime(a));
|
|
24935
|
+
const freshSynthesized = synthesizedByRecency.filter((g) => activityTime(g) >= cutoff).slice(0, RECENT_MAGI_CAP);
|
|
24936
|
+
const byStatus = {};
|
|
24937
|
+
for (const g of [...running, ...freshSynthesized]) {
|
|
24938
|
+
byStatus[g.status] = (byStatus[g.status] ?? 0) + 1;
|
|
24939
|
+
}
|
|
24940
|
+
const runningByRecency = [...running].sort((a, b) => activityTime(b) - activityTime(a));
|
|
24941
|
+
return {
|
|
24942
|
+
total: running.length + freshSynthesized.length,
|
|
24943
|
+
byStatus,
|
|
24944
|
+
staleSynthesized: synthesized.length - freshSynthesized.length,
|
|
24945
|
+
groups: [...runningByRecency, ...freshSynthesized]
|
|
24946
|
+
};
|
|
24947
|
+
}
|
|
24948
|
+
function getMeshMagiActivityByGroup(ledgerEntries, consensusGroupId) {
|
|
24949
|
+
const key2 = readString7(consensusGroupId);
|
|
24950
|
+
if (!key2) return void 0;
|
|
24951
|
+
return buildMeshMagiActivity({ ledgerEntries }).find((g) => g.consensusGroupId === key2);
|
|
24952
|
+
}
|
|
24953
|
+
|
|
24954
|
+
// src/index.ts
|
|
24674
24955
|
init_mesh_scheduling_runtime();
|
|
24675
24956
|
init_mesh_host_ownership();
|
|
24676
24957
|
init_mesh_events();
|
|
@@ -49590,7 +49871,18 @@ var meshQueueHandlers = {
|
|
|
49590
49871
|
const ownerFailure = await ctx.requireMeshHostMutationOwner(meshId, args?.inlineMesh, "queue requeue");
|
|
49591
49872
|
if (ownerFailure) return ownerFailure;
|
|
49592
49873
|
try {
|
|
49593
|
-
const { requeueTask: requeueTask2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
49874
|
+
const { requeueTask: requeueTask2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
49875
|
+
if (args?.force !== true) {
|
|
49876
|
+
const { isSessionActivelyGenerating: isSessionActivelyGenerating2 } = await Promise.resolve().then(() => (init_mesh_events(), mesh_events_exports));
|
|
49877
|
+
const existing = getQueue2(meshId).find((t) => t?.id === taskId);
|
|
49878
|
+
if (existing?.status === "assigned" && existing.assignedSessionId && isSessionActivelyGenerating2(ctx.deps, existing.assignedSessionId)) {
|
|
49879
|
+
return {
|
|
49880
|
+
success: false,
|
|
49881
|
+
error: `Task '${taskId}' is actively dispatched/generating (live session ${existing.assignedSessionId}); requeue refused to avoid a duplicate second dispatch. Pass force:true to override, or cancel and re-enqueue.`,
|
|
49882
|
+
task: existing
|
|
49883
|
+
};
|
|
49884
|
+
}
|
|
49885
|
+
}
|
|
49594
49886
|
const task = requeueTask2(meshId, taskId, {
|
|
49595
49887
|
reason: typeof args?.reason === "string" ? args.reason : void 0,
|
|
49596
49888
|
targetNodeId: typeof args?.targetNodeId === "string" ? args.targetNodeId.trim() : void 0,
|
|
@@ -50567,7 +50859,7 @@ function runGit2(repoRoot, args) {
|
|
|
50567
50859
|
return "";
|
|
50568
50860
|
}
|
|
50569
50861
|
}
|
|
50570
|
-
function
|
|
50862
|
+
function readRecord6(repoRoot) {
|
|
50571
50863
|
const path43 = (0, import_node_path2.resolve)(repoRoot, PREVIEW_DEPLOY_RECORD);
|
|
50572
50864
|
if (!(0, import_node_fs4.existsSync)(path43)) return null;
|
|
50573
50865
|
try {
|
|
@@ -50607,7 +50899,7 @@ function readCurrentMainCommit(repoRoot) {
|
|
|
50607
50899
|
}
|
|
50608
50900
|
function buildPreviewFreshness(repoRoot) {
|
|
50609
50901
|
const current = readCurrentMainCommit(repoRoot);
|
|
50610
|
-
const record =
|
|
50902
|
+
const record = readRecord6(repoRoot);
|
|
50611
50903
|
const lastPreviewCommit = normalizeCommit(record?.lastPreviewCommit);
|
|
50612
50904
|
const targets = readTargetFreshness(record, current.currentMainCommit);
|
|
50613
50905
|
let status = "unknown";
|
|
@@ -53526,13 +53818,15 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
|
|
|
53526
53818
|
const cwd = candidate.cwd ? (0, import_path14.resolve)(workspace, candidate.cwd) : workspace;
|
|
53527
53819
|
const timeout = candidate.timeoutMs || REFINE_VALIDATION_TIMEOUT_MS;
|
|
53528
53820
|
const resolvedCommand = resolveWin32Executable(candidate.command);
|
|
53821
|
+
const spawn4 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
|
|
53529
53822
|
try {
|
|
53530
|
-
const result = await execFileAsync4(
|
|
53823
|
+
const result = await execFileAsync4(spawn4.file, spawn4.args, {
|
|
53531
53824
|
cwd,
|
|
53532
53825
|
encoding: "utf8",
|
|
53533
53826
|
timeout,
|
|
53534
53827
|
maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
|
|
53535
|
-
env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} }
|
|
53828
|
+
env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} },
|
|
53829
|
+
...spawn4.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
53536
53830
|
});
|
|
53537
53831
|
summary.bootstrapCommandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
|
|
53538
53832
|
} catch (error) {
|
|
@@ -53543,7 +53837,7 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
|
|
|
53543
53837
|
timedOut: error?.killed === true || /timed out/i.test(String(error?.message || "")),
|
|
53544
53838
|
...spawnResolutionFailed ? { failureKind: "spawn_resolution_failed", resolvedCommand } : { failureKind: "dependency_bootstrap_failed" }
|
|
53545
53839
|
}));
|
|
53546
|
-
summary.bootstrap = { stage: "failed", error: describeSpawnError(error,
|
|
53840
|
+
summary.bootstrap = { stage: "failed", error: describeSpawnError(error, resolvedCommand, spawnResolutionFailed) };
|
|
53547
53841
|
summary.status = "failed";
|
|
53548
53842
|
summary.failureKind = spawnResolutionFailed ? "spawn_resolution_failed" : "dependency_bootstrap_failed";
|
|
53549
53843
|
summary.failureCode = spawnResolutionFailed ? "spawn_resolution_failed" : "dependency_bootstrap_failed";
|
|
@@ -53570,13 +53864,15 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
|
|
|
53570
53864
|
return summary;
|
|
53571
53865
|
}
|
|
53572
53866
|
const resolvedCommand = resolveWin32Executable(candidate.command);
|
|
53867
|
+
const spawn4 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
|
|
53573
53868
|
try {
|
|
53574
|
-
const result = await execFileAsync4(
|
|
53869
|
+
const result = await execFileAsync4(spawn4.file, spawn4.args, {
|
|
53575
53870
|
cwd,
|
|
53576
53871
|
encoding: "utf8",
|
|
53577
53872
|
timeout,
|
|
53578
53873
|
maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
|
|
53579
|
-
env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} }
|
|
53874
|
+
env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} },
|
|
53875
|
+
...spawn4.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
53580
53876
|
});
|
|
53581
53877
|
summary.commandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
|
|
53582
53878
|
} catch (error) {
|
|
@@ -53593,7 +53889,7 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
|
|
|
53593
53889
|
if (spawnResolutionFailed) {
|
|
53594
53890
|
summary.failureKind = "spawn_resolution_failed";
|
|
53595
53891
|
summary.failureCode = "spawn_resolution_failed";
|
|
53596
|
-
summary.spawnResolutionError = describeSpawnError(error,
|
|
53892
|
+
summary.spawnResolutionError = describeSpawnError(error, resolvedCommand, true);
|
|
53597
53893
|
} else if (missingDependencyFailure) {
|
|
53598
53894
|
summary.failureKind = "missing_dependencies";
|
|
53599
53895
|
summary.failureCode = "missing_dependencies";
|
|
@@ -64458,6 +64754,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64458
64754
|
IdeProviderInstance,
|
|
64459
64755
|
InMemoryGitSnapshotStore,
|
|
64460
64756
|
LOG,
|
|
64757
|
+
MAGI_NEEDS_VERIFICATION_PREVIEW_CAP,
|
|
64461
64758
|
MAX_LEDGER_SLICE_LIMIT,
|
|
64462
64759
|
MESH_CONVERGE_FAST_FORWARD_TAG,
|
|
64463
64760
|
MESH_CONVERGE_REFINE_TAG,
|
|
@@ -64479,8 +64776,10 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64479
64776
|
ProviderCliAdapter,
|
|
64480
64777
|
ProviderInstanceManager,
|
|
64481
64778
|
ProviderLoader,
|
|
64779
|
+
RECENT_MAGI_CAP,
|
|
64482
64780
|
RECENT_TERMINAL_REFINE_CAP,
|
|
64483
64781
|
RawTerminalAttachment,
|
|
64782
|
+
STALE_MAGI_WINDOW_MS,
|
|
64484
64783
|
STALE_TERMINAL_REFINE_WINDOW_MS,
|
|
64485
64784
|
STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
64486
64785
|
SessionHostPtyTransportFactory,
|
|
@@ -64510,6 +64809,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64510
64809
|
buildMeshHostRequiredFailure,
|
|
64511
64810
|
buildMeshLedgerReconciliationEvidence,
|
|
64512
64811
|
buildMeshLedgerReplicaEvidence,
|
|
64812
|
+
buildMeshMagiActivity,
|
|
64513
64813
|
buildMeshNodeCapabilityTags,
|
|
64514
64814
|
buildMeshNodeDataFreshness,
|
|
64515
64815
|
buildMeshNodeProbeFreshness,
|
|
@@ -64596,8 +64896,10 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64596
64896
|
getLedgerDir,
|
|
64597
64897
|
getLedgerSummary,
|
|
64598
64898
|
getLogLevel,
|
|
64899
|
+
getMagiPanel,
|
|
64599
64900
|
getMesh,
|
|
64600
64901
|
getMeshByRepo,
|
|
64902
|
+
getMeshMagiActivityByGroup,
|
|
64601
64903
|
getMeshMission,
|
|
64602
64904
|
getMeshMissions,
|
|
64603
64905
|
getMeshQueueRevision,
|
|
@@ -64649,6 +64951,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64649
64951
|
launchWithCdp,
|
|
64650
64952
|
listCoordinatorsForWorkspace,
|
|
64651
64953
|
listHostedCliRuntimes,
|
|
64954
|
+
listMagiPanels,
|
|
64652
64955
|
listMeshMissionSummaries,
|
|
64653
64956
|
listMeshes,
|
|
64654
64957
|
listWorktrees,
|
|
@@ -64681,6 +64984,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64681
64984
|
normalizeInputEnvelope,
|
|
64682
64985
|
normalizeInteractivePrompt,
|
|
64683
64986
|
normalizeInteractivePromptResponse,
|
|
64987
|
+
normalizeMagiPanel,
|
|
64684
64988
|
normalizeManagedStatus,
|
|
64685
64989
|
normalizeMeshCapabilityTags,
|
|
64686
64990
|
normalizeMeshDaemonRole,
|
|
@@ -64718,6 +65022,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64718
65022
|
recordMeshToolCall,
|
|
64719
65023
|
registerExtensionProviders,
|
|
64720
65024
|
registerMeshCoordinator,
|
|
65025
|
+
removeMagiPanel,
|
|
64721
65026
|
removeNode,
|
|
64722
65027
|
removeWorktree,
|
|
64723
65028
|
requeueTask,
|
|
@@ -64761,6 +65066,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64761
65066
|
suggestMeshRefineConfig,
|
|
64762
65067
|
summarizeGitStatus,
|
|
64763
65068
|
summarizeMeshAsyncRefineJobs,
|
|
65069
|
+
summarizeMeshMagiActivity,
|
|
64764
65070
|
summarizeMeshMission,
|
|
64765
65071
|
summarizeMissionTasks,
|
|
64766
65072
|
triggerMeshQueue,
|
|
@@ -64772,6 +65078,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
64772
65078
|
updateSessionDeliveryStatus,
|
|
64773
65079
|
updateSessionTaskStatus,
|
|
64774
65080
|
updateTaskStatus,
|
|
65081
|
+
upsertMagiPanel,
|
|
64775
65082
|
upsertMeshMission,
|
|
64776
65083
|
upsertSavedProviderSession,
|
|
64777
65084
|
validateChangeImpactConfig,
|