@adhdev/daemon-core 0.9.82-rc.414 → 0.9.82-rc.415

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.
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Pick the best launch target from `where`'s match list on win32.
3
+ *
4
+ * `where npm` on a typical install returns BOTH the extensionless Unix wrapper
5
+ * (e.g. `C:\Program Files\nodejs\npm`, a bash shell script) AND the `npm.cmd`
6
+ * shim. The extensionless wrapper is NOT a win32 executable — handing it to a
7
+ * spawn boundary ENOENTs (errno -4058). So:
8
+ * 1. Prefer a directly-launchable `.exe`/`.com`.
9
+ * 2. Otherwise take a `.cmd`/`.bat` shim (absolute → works for ConPTY, and for
10
+ * execFile once wrapped via buildWin32ExecFileSpawn).
11
+ * 3. NEVER fall back to an extensionless match — return null so the caller can
12
+ * try other resolution strategies (global-bin scan) rather than emit a
13
+ * path that cannot be exec'd.
14
+ */
15
+ export declare function selectWin32ExecutableMatch(matches: string[]): string | null;
1
16
  /**
2
17
  * Resolve a launch command to an absolute executable path on Windows.
3
18
  *
@@ -12,3 +27,43 @@
12
27
  * or cannot be resolved (caller keeps the original behaviour).
13
28
  */
14
29
  export declare function resolveWin32Executable(command: string): string;
30
+ /**
31
+ * Quote one argument for a cmd.exe command line using the standard
32
+ * CommandLineToArgvW rules (the same algorithm Node uses internally): wrap in
33
+ * double quotes only when needed, double up the backslashes that precede a
34
+ * quote, and escape embedded quotes. We do per-argument quoting ourselves
35
+ * (rather than `{ shell: true }`) because Node's shell mode joins argv with bare
36
+ * spaces and applies NO quoting — any argument containing a space (a path, a
37
+ * test name) would split. Inputs here are repo-mesh validation/bootstrap command
38
+ * tokens (trusted config, not network data), so argv-quoting for spaces/quotes
39
+ * is sufficient; we deliberately do not attempt full cmd.exe metacharacter
40
+ * (& | < > ^ %) escaping.
41
+ */
42
+ export declare function quoteWin32CmdArg(arg: string): string;
43
+ export interface Win32ExecFileSpawn {
44
+ file: string;
45
+ args: string[];
46
+ /** Set when the args are pre-quoted for cmd.exe and must not be re-quoted. */
47
+ windowsVerbatimArguments?: boolean;
48
+ }
49
+ /**
50
+ * Build child_process.execFile/spawn parameters for an already-resolved command.
51
+ *
52
+ * On win32 a `.cmd`/`.bat` shim (what `npm`/`npx`/`tsc`/`vitest` resolve to)
53
+ * cannot be launched by execFile directly — modern Node refuses it (CVE-2024-27980
54
+ * mitigation) and CreateProcess cannot exec a batch file. So wrap it in
55
+ * `cmd.exe /d /s /c "<quoted command line>"` with `windowsVerbatimArguments` so
56
+ * our own per-argument quoting is preserved. `.exe`/`.com` (and every non-win32
57
+ * platform, and any already-cmd.exe target) pass through unchanged — this is a
58
+ * strict no-op off win32, guarding against regressions on linux/macOS.
59
+ */
60
+ export declare function buildWin32ExecFileSpawn(resolvedCommand: string, args: string[]): Win32ExecFileSpawn;
61
+ /**
62
+ * Convenience: resolve a bare command to an absolute win32 path AND build the
63
+ * execFile spawn parameters (cmd.exe-wrapping a .cmd/.bat shim). Returns the
64
+ * resolved command alongside the spawn spec so callers can still surface the
65
+ * resolved path in diagnostics.
66
+ */
67
+ export declare function resolveWin32ExecFileSpawn(command: string, args: string[]): Win32ExecFileSpawn & {
68
+ resolvedCommand: string;
69
+ };
@@ -6,6 +6,7 @@
6
6
  * uses this file as the single source of truth.
7
7
  */
8
8
  import type { LocalMeshEntry, LocalMeshNodeEntry, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshNodeCapabilities, RepoMeshCoordinatorConfig, RepoMeshHostMetadata, RepoMeshDaemonRole } from '../repo-mesh-types.js';
9
+ import type { MagiPanel } from '@adhdev/mesh-shared';
9
10
  /**
10
11
  * Normalize a Git remote URL into a stable identity string.
11
12
  * e.g. "git@github.com:user/repo.git" → "github.com/user/repo"
@@ -125,3 +126,17 @@ export declare function updateNode(meshId: string, nodeId: string, opts: {
125
126
  reportedPlatform?: string;
126
127
  reportedArch?: string;
127
128
  }): LocalMeshNodeEntry | undefined;
129
+ /** All configured MAGI panels (machine-local), keyed by name. Empty when none. */
130
+ export declare function listMagiPanels(): Record<string, MagiPanel>;
131
+ /** A single panel by name, or undefined when not configured. */
132
+ export declare function getMagiPanel(name: string): MagiPanel | undefined;
133
+ /**
134
+ * Upsert a named panel into meshes.json. Defaults to refusing to clobber an
135
+ * existing panel (overwrite=false) — mirrors the mesh_init write/overwrite
136
+ * precedent. Returns the normalized, persisted panel.
137
+ */
138
+ export declare function upsertMagiPanel(name: string, config: unknown, opts?: {
139
+ overwrite?: boolean;
140
+ }): MagiPanel;
141
+ /** Remove a named panel. Returns true when a panel was removed. */
142
+ export declare function removeMagiPanel(name: string): boolean;
package/dist/index.d.ts CHANGED
@@ -28,8 +28,9 @@ export { appendRecentActivity, getRecentActivity } from './config/recent-activit
28
28
  export type { RecentActivityEntry } from './config/recent-activity.js';
29
29
  export { getSavedProviderSessions, upsertSavedProviderSession } from './config/saved-sessions.js';
30
30
  export type { SavedProviderSessionEntry } from './config/saved-sessions.js';
31
- export { listMeshes, getMesh, getMeshByRepo, createMesh, updateMesh, deleteMesh, addNode, removeNode, updateNode, normalizeRepoIdentity, } from './config/mesh-config.js';
31
+ export { listMeshes, getMesh, getMeshByRepo, createMesh, updateMesh, deleteMesh, addNode, removeNode, updateNode, normalizeRepoIdentity, listMagiPanels, getMagiPanel, upsertMagiPanel, removeMagiPanel, } from './config/mesh-config.js';
32
32
  export type { CreateMeshOptions, UpdateMeshOptions, AddNodeOptions } from './config/mesh-config.js';
33
+ export type { MagiPanel, MagiPanelMember, MagiPanelMap, MagiMode, MagiClaim, MagiClaimStance, MagiAgentResponse, MagiResponseSource, MagiSynthesizedResponse, MagiClusterCategory, MagiClusterMember, MagiClaimCluster, MagiSynthesis, } from '@adhdev/mesh-shared';
33
34
  export { expandDaemonIdForms, daemonIdsEquivalent, machineCoreFromDaemonId, canonicalDaemonId } from '@adhdev/mesh-shared';
34
35
  export { normalizeMeshNodeId, meshNodeIdMatches } from '@adhdev/mesh-shared';
35
36
  export { buildCoordinatorSystemPrompt } from './mesh/coordinator-prompt.js';
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 ? "7a774e95a82354f5357197b3c84f63e68b5f7a5d" : void 0) ?? "unknown";
393
- const commitShort = readInjected(true ? "7a774e95" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
394
- const version = readInjected(true ? "0.9.82-rc.414" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
395
- const builtAt = readInjected(true ? "2026-06-28T11:50:52.585Z" : void 0);
392
+ const commit = readInjected(true ? "eeb6bb4fcd32cf1844ed87bb4a7c2760e132e69d" : void 0) ?? "unknown";
393
+ const commitShort = readInjected(true ? "eeb6bb4f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
394
+ const version = readInjected(true ? "0.9.82-rc.415" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
395
+ const builtAt = readInjected(true ? "2026-06-28T13:43:23.868Z" : void 0);
396
396
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
397
397
  return cached;
398
398
  }
@@ -2562,15 +2562,19 @@ __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,
2569
2571
  normalizeRepoIdentity: () => normalizeRepoIdentity,
2572
+ removeMagiPanel: () => removeMagiPanel,
2570
2573
  removeNode: () => removeNode,
2571
2574
  tokenIdForManualPairing: () => tokenIdForManualPairing,
2572
2575
  updateMesh: () => updateMesh,
2573
- updateNode: () => updateNode
2576
+ updateNode: () => updateNode,
2577
+ upsertMagiPanel: () => upsertMagiPanel
2574
2578
  });
2575
2579
  function getMeshConfigPath() {
2576
2580
  return (0, import_path3.join)(getConfigDir(), "meshes.json");
@@ -2943,7 +2947,89 @@ function updateNode(meshId, nodeId, opts) {
2943
2947
  saveMeshConfig(config);
2944
2948
  return node;
2945
2949
  }
2946
- var import_fs3, import_path3, import_crypto3, mergeMeshPolicy;
2950
+ function normalizeReplicaCount(value) {
2951
+ if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
2952
+ const n = Math.floor(value);
2953
+ return n >= 1 ? n : void 0;
2954
+ }
2955
+ function normalizeMagiPanel(config) {
2956
+ if (!config || typeof config !== "object" || Array.isArray(config)) {
2957
+ throw new Error("invalid_magi_panel: config must be an object");
2958
+ }
2959
+ const raw = config;
2960
+ const rawMembers = raw.members;
2961
+ if (!Array.isArray(rawMembers) || rawMembers.length === 0) {
2962
+ throw new Error("invalid_magi_panel: members must be a non-empty array");
2963
+ }
2964
+ if (rawMembers.length > MAX_MAGI_PANEL_MEMBERS) {
2965
+ throw new Error(`invalid_magi_panel: too many members (max ${MAX_MAGI_PANEL_MEMBERS})`);
2966
+ }
2967
+ const members = rawMembers.map((entry, idx) => {
2968
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
2969
+ throw new Error(`invalid_magi_panel: member[${idx}] must be an object`);
2970
+ }
2971
+ const m = entry;
2972
+ const provider = typeof m.provider === "string" ? m.provider.trim() : "";
2973
+ if (!provider) {
2974
+ throw new Error(`invalid_magi_panel: member[${idx}].provider is required`);
2975
+ }
2976
+ const nodeId = typeof m.nodeId === "string" && m.nodeId.trim() ? m.nodeId.trim() : void 0;
2977
+ const capabilityTags = normalizeCapabilityTags(m.capabilityTags);
2978
+ const n = normalizeReplicaCount(m.n);
2979
+ return {
2980
+ provider,
2981
+ ...nodeId ? { nodeId } : {},
2982
+ ...capabilityTags ? { capabilityTags } : {},
2983
+ ...n !== void 0 ? { n } : {}
2984
+ };
2985
+ });
2986
+ const description = typeof raw.description === "string" && raw.description.trim() ? raw.description.trim().slice(0, 200) : void 0;
2987
+ const defaultN = normalizeReplicaCount(raw.defaultN);
2988
+ return {
2989
+ ...description ? { description } : {},
2990
+ members,
2991
+ ...defaultN !== void 0 ? { defaultN } : {},
2992
+ // dedupExempt is always meaningful for a MAGI panel (intentional same-prompt
2993
+ // fan-out). Persist it true unless the caller explicitly disables it.
2994
+ dedupExempt: raw.dedupExempt === false ? false : true
2995
+ };
2996
+ }
2997
+ function normalizePanelName(name) {
2998
+ const trimmed = typeof name === "string" ? name.trim() : "";
2999
+ if (!trimmed) throw new Error("invalid_magi_panel: panel name is required");
3000
+ return trimmed.slice(0, 100);
3001
+ }
3002
+ function listMagiPanels() {
3003
+ return loadMeshConfig().magiPanels ?? {};
3004
+ }
3005
+ function getMagiPanel(name) {
3006
+ const key2 = typeof name === "string" ? name.trim() : "";
3007
+ if (!key2) return void 0;
3008
+ return loadMeshConfig().magiPanels?.[key2];
3009
+ }
3010
+ function upsertMagiPanel(name, config, opts = {}) {
3011
+ const key2 = normalizePanelName(name);
3012
+ const panel = normalizeMagiPanel(config);
3013
+ const stored = loadMeshConfig();
3014
+ const panels = stored.magiPanels ?? {};
3015
+ if (panels[key2] && opts.overwrite !== true) {
3016
+ throw new Error(`magi_panel_exists: panel '${key2}' already exists \u2014 pass overwrite=true to replace it`);
3017
+ }
3018
+ panels[key2] = panel;
3019
+ stored.magiPanels = panels;
3020
+ saveMeshConfig(stored);
3021
+ return panel;
3022
+ }
3023
+ function removeMagiPanel(name) {
3024
+ const key2 = typeof name === "string" ? name.trim() : "";
3025
+ if (!key2) return false;
3026
+ const stored = loadMeshConfig();
3027
+ if (!stored.magiPanels || !stored.magiPanels[key2]) return false;
3028
+ delete stored.magiPanels[key2];
3029
+ saveMeshConfig(stored);
3030
+ return true;
3031
+ }
3032
+ var import_fs3, import_path3, import_crypto3, mergeMeshPolicy, MAX_MAGI_PANEL_MEMBERS;
2947
3033
  var init_mesh_config = __esm({
2948
3034
  "src/config/mesh-config.ts"() {
2949
3035
  "use strict";
@@ -2955,6 +3041,7 @@ var init_mesh_config = __esm({
2955
3041
  init_repo_mesh_types();
2956
3042
  init_mesh_host_ownership();
2957
3043
  mergeMeshPolicy = mergeAndNormalizePolicy;
3044
+ MAX_MAGI_PANEL_MEMBERS = 24;
2958
3045
  }
2959
3046
  });
2960
3047
 
@@ -5142,6 +5229,7 @@ function enqueueTask(meshId, message, opts) {
5142
5229
  requiredTags: resolvedRequiredTags,
5143
5230
  ...dependsOn.length > 0 ? { dependsOn } : {},
5144
5231
  ...typeof opts?.missionId === "string" && opts.missionId.trim() ? { missionId: opts.missionId.trim() } : {},
5232
+ ...typeof opts?.consensusGroupId === "string" && opts.consensusGroupId.trim() ? { consensusGroupId: opts.consensusGroupId.trim() } : {},
5145
5233
  ...typeof opts?.sourceCoordinatorSessionId === "string" && opts.sourceCoordinatorSessionId.trim() ? { sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId.trim() } : {},
5146
5234
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
5147
5235
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -8451,6 +8539,14 @@ function resolveWin32GlobalBin(trimmed) {
8451
8539
  }
8452
8540
  return null;
8453
8541
  }
8542
+ function selectWin32ExecutableMatch(matches) {
8543
+ const cleaned = matches.map((m) => m.trim()).filter(Boolean);
8544
+ const direct = cleaned.find((m) => DIRECT_EXEC_EXT.has(path10.extname(m).toLowerCase()));
8545
+ if (direct) return direct;
8546
+ const shim = cleaned.find((m) => SHIM_EXEC_EXT.has(path10.extname(m).toLowerCase()));
8547
+ if (shim) return shim;
8548
+ return null;
8549
+ }
8454
8550
  function resolveWin32Executable(command) {
8455
8551
  if (process.platform !== "win32") return command;
8456
8552
  const trimmed = (command || "").trim();
@@ -8463,8 +8559,8 @@ function resolveWin32Executable(command) {
8463
8559
  }).trim();
8464
8560
  if (out) {
8465
8561
  const matches = out.split(/\r?\n/).map((s2) => s2.trim()).filter(Boolean);
8466
- const direct = matches.find((m) => DIRECT_EXEC_EXT.has(path10.extname(m).toLowerCase()));
8467
- return direct || matches[0] || command;
8562
+ const selected = selectWin32ExecutableMatch(matches);
8563
+ if (selected) return selected;
8468
8564
  }
8469
8565
  } catch {
8470
8566
  }
@@ -8472,7 +8568,38 @@ function resolveWin32Executable(command) {
8472
8568
  if (globalBin) return globalBin;
8473
8569
  return command;
8474
8570
  }
8475
- var import_child_process, import_fs8, path10, DIRECT_EXEC_EXT, WIN_EXEC_EXT;
8571
+ function quoteWin32CmdArg(arg) {
8572
+ if (arg.length > 0 && !/[ \t"]/.test(arg)) return arg;
8573
+ let result = '"';
8574
+ let backslashes = 0;
8575
+ for (const ch of arg) {
8576
+ if (ch === "\\") {
8577
+ backslashes += 1;
8578
+ continue;
8579
+ }
8580
+ if (ch === '"') {
8581
+ result += "\\".repeat(backslashes * 2 + 1) + '"';
8582
+ backslashes = 0;
8583
+ continue;
8584
+ }
8585
+ result += "\\".repeat(backslashes) + ch;
8586
+ backslashes = 0;
8587
+ }
8588
+ result += "\\".repeat(backslashes * 2) + '"';
8589
+ return result;
8590
+ }
8591
+ function buildWin32ExecFileSpawn(resolvedCommand, args) {
8592
+ if (process.platform !== "win32") return { file: resolvedCommand, args };
8593
+ const ext = path10.extname(resolvedCommand).toLowerCase();
8594
+ if (!SHIM_EXEC_EXT.has(ext)) return { file: resolvedCommand, args };
8595
+ const commandLine = [resolvedCommand, ...args].map(quoteWin32CmdArg).join(" ");
8596
+ return {
8597
+ file: process.env.ComSpec || "cmd.exe",
8598
+ args: ["/d", "/s", "/c", `"${commandLine}"`],
8599
+ windowsVerbatimArguments: true
8600
+ };
8601
+ }
8602
+ var import_child_process, import_fs8, path10, DIRECT_EXEC_EXT, SHIM_EXEC_EXT, WIN_EXEC_EXT;
8476
8603
  var init_resolve_executable = __esm({
8477
8604
  "src/cli-adapters/resolve-executable.ts"() {
8478
8605
  "use strict";
@@ -8480,6 +8607,7 @@ var init_resolve_executable = __esm({
8480
8607
  import_fs8 = require("fs");
8481
8608
  path10 = __toESM(require("path"));
8482
8609
  DIRECT_EXEC_EXT = /* @__PURE__ */ new Set([".exe", ".com"]);
8610
+ SHIM_EXEC_EXT = /* @__PURE__ */ new Set([".cmd", ".bat"]);
8483
8611
  WIN_EXEC_EXT = [".exe", ".com", ".cmd", ".bat"];
8484
8612
  }
8485
8613
  });
@@ -8664,14 +8792,16 @@ async function runMeshWorktreeBootstrap(mesh, workspace) {
8664
8792
  const startedAt = Date.now();
8665
8793
  state.lastCommand = command.displayCommand;
8666
8794
  const resolvedCommand = resolveWin32Executable(command.command);
8795
+ const spawn4 = buildWin32ExecFileSpawn(resolvedCommand, command.args);
8667
8796
  try {
8668
- const result = await execFileAsync4(resolvedCommand, command.args, {
8797
+ const result = await execFileAsync4(spawn4.file, spawn4.args, {
8669
8798
  cwd,
8670
8799
  encoding: "utf8",
8671
8800
  timeout: command.timeoutMs || DEFAULT_TIMEOUT_MS2,
8672
8801
  maxBuffer: command.outputLimitBytes || DEFAULT_OUTPUT_LIMIT_BYTES,
8673
8802
  env: { ...process.env, CI: process.env.CI || "1", ...command.env || {} },
8674
- windowsHide: true
8803
+ windowsHide: true,
8804
+ ...spawn4.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
8675
8805
  });
8676
8806
  state.commandsRun?.push({
8677
8807
  command: command.command,
@@ -10426,6 +10556,11 @@ function buildPendingEventFingerprint(event) {
10426
10556
  ].join("::");
10427
10557
  }
10428
10558
  }
10559
+ const consensusGroupId = readNonEmptyString2(metadata.consensusGroupId) || readNonEmptyString2(readRecord4(metadata.payload)?.consensusGroupId);
10560
+ if (consensusGroupId) {
10561
+ const groupTaskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(readRecord4(metadata.payload)?.taskId);
10562
+ return [event.meshId, event.event, groupTaskId || "", consensusGroupId, "group"].join("::");
10563
+ }
10429
10564
  const sessionId = resolveEventSessionId(metadata);
10430
10565
  const providerSessionId = readNonEmptyString2(metadata.providerSessionId);
10431
10566
  const taskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(readRecord4(metadata.payload)?.taskId);
@@ -12252,6 +12387,12 @@ function sessionHasActiveAssignment(meshId, sessionId) {
12252
12387
  }
12253
12388
  return false;
12254
12389
  }
12390
+ function isSessionActivelyGenerating(components, sessionId) {
12391
+ if (!sessionId) return false;
12392
+ const state = components.instanceManager?.getInstance?.(sessionId)?.getState?.();
12393
+ if (!state) return false;
12394
+ return sessionStateLooksActive(state);
12395
+ }
12255
12396
  function liveSessionCountForNode(components, meshId, nodeId) {
12256
12397
  return components.instanceManager.getByCategory("cli").filter((inst) => {
12257
12398
  const state = inst.getState();
@@ -15696,13 +15837,22 @@ function injectMeshSystemMessage(components, args) {
15696
15837
  ) || readNonEmptyString2(args.metadataEvent.meshCoordinatorSessionId);
15697
15838
  const enrichedMetadataEvent = (() => {
15698
15839
  const last = sourceSession ? getLastDisplayMessage(sourceSession.getState()) : null;
15699
- if (!last || !last.preview) return args.metadataEvent;
15700
- return {
15840
+ const base = !last || !last.preview ? args.metadataEvent : {
15701
15841
  ...args.metadataEvent,
15702
15842
  lastMessagePreview: last.preview,
15703
15843
  lastMessageRole: last.role,
15704
15844
  ...last.receivedAt > 0 ? { lastMessageAt: last.receivedAt } : {}
15705
15845
  };
15846
+ if (readNonEmptyString2(base.consensusGroupId)) return base;
15847
+ const eventTaskId = readNonEmptyString2(args.metadataEvent.taskId);
15848
+ if (!eventTaskId) return base;
15849
+ try {
15850
+ const entry = MeshRuntimeStore.getInstance().findQueueEntryById(args.meshId, eventTaskId);
15851
+ const consensusGroupId = readNonEmptyString2(entry?.consensusGroupId);
15852
+ if (consensusGroupId) return { ...base, consensusGroupId };
15853
+ } catch {
15854
+ }
15855
+ return base;
15706
15856
  })();
15707
15857
  if (components.onMeshCoordinatorEventForwarded) {
15708
15858
  try {
@@ -17319,6 +17469,7 @@ __export(mesh_events_exports, {
17319
17469
  getPendingMeshCoordinatorEvents: () => getPendingMeshCoordinatorEvents,
17320
17470
  handleMeshForwardEvent: () => handleMeshForwardEvent,
17321
17471
  isMeshCoordinatorEvent: () => isMeshCoordinatorEvent,
17472
+ isSessionActivelyGenerating: () => isSessionActivelyGenerating,
17322
17473
  queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
17323
17474
  reconcileDirectDispatchCompletionFromTranscript: () => reconcileDirectDispatchCompletionFromTranscript,
17324
17475
  resolveCoordinatorDrainDeliverability: () => resolveCoordinatorDrainDeliverability,
@@ -23146,6 +23297,7 @@ __export(index_exports, {
23146
23297
  getLedgerDir: () => getLedgerDir,
23147
23298
  getLedgerSummary: () => getLedgerSummary,
23148
23299
  getLogLevel: () => getLogLevel,
23300
+ getMagiPanel: () => getMagiPanel,
23149
23301
  getMesh: () => getMesh,
23150
23302
  getMeshByRepo: () => getMeshByRepo,
23151
23303
  getMeshMission: () => getMeshMission,
@@ -23199,6 +23351,7 @@ __export(index_exports, {
23199
23351
  launchWithCdp: () => launchWithCdp,
23200
23352
  listCoordinatorsForWorkspace: () => listCoordinatorsForWorkspace,
23201
23353
  listHostedCliRuntimes: () => listHostedCliRuntimes,
23354
+ listMagiPanels: () => listMagiPanels,
23202
23355
  listMeshMissionSummaries: () => listMeshMissionSummaries,
23203
23356
  listMeshes: () => listMeshes,
23204
23357
  listWorktrees: () => listWorktrees,
@@ -23268,6 +23421,7 @@ __export(index_exports, {
23268
23421
  recordMeshToolCall: () => recordMeshToolCall,
23269
23422
  registerExtensionProviders: () => registerExtensionProviders,
23270
23423
  registerMeshCoordinator: () => registerMeshCoordinator,
23424
+ removeMagiPanel: () => removeMagiPanel,
23271
23425
  removeNode: () => removeNode,
23272
23426
  removeWorktree: () => removeWorktree,
23273
23427
  requeueTask: () => requeueTask,
@@ -23322,6 +23476,7 @@ __export(index_exports, {
23322
23476
  updateSessionDeliveryStatus: () => updateSessionDeliveryStatus,
23323
23477
  updateSessionTaskStatus: () => updateSessionTaskStatus,
23324
23478
  updateTaskStatus: () => updateTaskStatus,
23479
+ upsertMagiPanel: () => upsertMagiPanel,
23325
23480
  upsertMeshMission: () => upsertMeshMission,
23326
23481
  upsertSavedProviderSession: () => upsertSavedProviderSession,
23327
23482
  validateChangeImpactConfig: () => validateChangeImpactConfig,
@@ -49590,7 +49745,18 @@ var meshQueueHandlers = {
49590
49745
  const ownerFailure = await ctx.requireMeshHostMutationOwner(meshId, args?.inlineMesh, "queue requeue");
49591
49746
  if (ownerFailure) return ownerFailure;
49592
49747
  try {
49593
- const { requeueTask: requeueTask2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
49748
+ const { requeueTask: requeueTask2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
49749
+ if (args?.force !== true) {
49750
+ const { isSessionActivelyGenerating: isSessionActivelyGenerating2 } = await Promise.resolve().then(() => (init_mesh_events(), mesh_events_exports));
49751
+ const existing = getQueue2(meshId).find((t) => t?.id === taskId);
49752
+ if (existing?.status === "assigned" && existing.assignedSessionId && isSessionActivelyGenerating2(ctx.deps, existing.assignedSessionId)) {
49753
+ return {
49754
+ success: false,
49755
+ 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.`,
49756
+ task: existing
49757
+ };
49758
+ }
49759
+ }
49594
49760
  const task = requeueTask2(meshId, taskId, {
49595
49761
  reason: typeof args?.reason === "string" ? args.reason : void 0,
49596
49762
  targetNodeId: typeof args?.targetNodeId === "string" ? args.targetNodeId.trim() : void 0,
@@ -53526,13 +53692,15 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
53526
53692
  const cwd = candidate.cwd ? (0, import_path14.resolve)(workspace, candidate.cwd) : workspace;
53527
53693
  const timeout = candidate.timeoutMs || REFINE_VALIDATION_TIMEOUT_MS;
53528
53694
  const resolvedCommand = resolveWin32Executable(candidate.command);
53695
+ const spawn4 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
53529
53696
  try {
53530
- const result = await execFileAsync4(resolvedCommand, candidate.args, {
53697
+ const result = await execFileAsync4(spawn4.file, spawn4.args, {
53531
53698
  cwd,
53532
53699
  encoding: "utf8",
53533
53700
  timeout,
53534
53701
  maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
53535
- env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} }
53702
+ env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} },
53703
+ ...spawn4.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
53536
53704
  });
53537
53705
  summary.bootstrapCommandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
53538
53706
  } catch (error) {
@@ -53543,7 +53711,7 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
53543
53711
  timedOut: error?.killed === true || /timed out/i.test(String(error?.message || "")),
53544
53712
  ...spawnResolutionFailed ? { failureKind: "spawn_resolution_failed", resolvedCommand } : { failureKind: "dependency_bootstrap_failed" }
53545
53713
  }));
53546
- summary.bootstrap = { stage: "failed", error: describeSpawnError(error, candidate.command, spawnResolutionFailed) };
53714
+ summary.bootstrap = { stage: "failed", error: describeSpawnError(error, resolvedCommand, spawnResolutionFailed) };
53547
53715
  summary.status = "failed";
53548
53716
  summary.failureKind = spawnResolutionFailed ? "spawn_resolution_failed" : "dependency_bootstrap_failed";
53549
53717
  summary.failureCode = spawnResolutionFailed ? "spawn_resolution_failed" : "dependency_bootstrap_failed";
@@ -53570,13 +53738,15 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
53570
53738
  return summary;
53571
53739
  }
53572
53740
  const resolvedCommand = resolveWin32Executable(candidate.command);
53741
+ const spawn4 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
53573
53742
  try {
53574
- const result = await execFileAsync4(resolvedCommand, candidate.args, {
53743
+ const result = await execFileAsync4(spawn4.file, spawn4.args, {
53575
53744
  cwd,
53576
53745
  encoding: "utf8",
53577
53746
  timeout,
53578
53747
  maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
53579
- env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} }
53748
+ env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} },
53749
+ ...spawn4.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
53580
53750
  });
53581
53751
  summary.commandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
53582
53752
  } catch (error) {
@@ -53593,7 +53763,7 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
53593
53763
  if (spawnResolutionFailed) {
53594
53764
  summary.failureKind = "spawn_resolution_failed";
53595
53765
  summary.failureCode = "spawn_resolution_failed";
53596
- summary.spawnResolutionError = describeSpawnError(error, candidate.command, true);
53766
+ summary.spawnResolutionError = describeSpawnError(error, resolvedCommand, true);
53597
53767
  } else if (missingDependencyFailure) {
53598
53768
  summary.failureKind = "missing_dependencies";
53599
53769
  summary.failureCode = "missing_dependencies";
@@ -64596,6 +64766,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
64596
64766
  getLedgerDir,
64597
64767
  getLedgerSummary,
64598
64768
  getLogLevel,
64769
+ getMagiPanel,
64599
64770
  getMesh,
64600
64771
  getMeshByRepo,
64601
64772
  getMeshMission,
@@ -64649,6 +64820,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
64649
64820
  launchWithCdp,
64650
64821
  listCoordinatorsForWorkspace,
64651
64822
  listHostedCliRuntimes,
64823
+ listMagiPanels,
64652
64824
  listMeshMissionSummaries,
64653
64825
  listMeshes,
64654
64826
  listWorktrees,
@@ -64718,6 +64890,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
64718
64890
  recordMeshToolCall,
64719
64891
  registerExtensionProviders,
64720
64892
  registerMeshCoordinator,
64893
+ removeMagiPanel,
64721
64894
  removeNode,
64722
64895
  removeWorktree,
64723
64896
  requeueTask,
@@ -64772,6 +64945,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
64772
64945
  updateSessionDeliveryStatus,
64773
64946
  updateSessionTaskStatus,
64774
64947
  updateTaskStatus,
64948
+ upsertMagiPanel,
64775
64949
  upsertMeshMission,
64776
64950
  upsertSavedProviderSession,
64777
64951
  validateChangeImpactConfig,