@adhdev/daemon-core 0.9.82-rc.506 → 0.9.82-rc.508

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 CHANGED
@@ -417,10 +417,10 @@ function readInjected(value) {
417
417
  }
418
418
  function getDaemonBuildInfo() {
419
419
  if (cached) return cached;
420
- const commit = readInjected(true ? "d7415812627054f6b93f8caf231387b4e6d0181b" : void 0) ?? "unknown";
421
- const commitShort = readInjected(true ? "d7415812" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
422
- const version = readInjected(true ? "0.9.82-rc.506" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
423
- const builtAt = readInjected(true ? "2026-07-12T15:25:43.979Z" : void 0);
420
+ const commit = readInjected(true ? "3c72ac19ec9253071d614cd2410dc9f8d555eb26" : void 0) ?? "unknown";
421
+ const commitShort = readInjected(true ? "3c72ac19" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
422
+ const version = readInjected(true ? "0.9.82-rc.508" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
423
+ const builtAt = readInjected(true ? "2026-07-12T23:18:59.856Z" : void 0);
424
424
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
425
425
  return cached;
426
426
  }
@@ -3564,7 +3564,8 @@ var init_mesh_config = __esm({
3564
3564
  // src/mesh/coordinator-prompt.ts
3565
3565
  var coordinator_prompt_exports = {};
3566
3566
  __export(coordinator_prompt_exports, {
3567
- buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt
3567
+ buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt,
3568
+ buildMagiKindPanelsSection: () => buildMagiKindPanelsSection
3568
3569
  });
3569
3570
  function buildCoordinatorSystemPrompt(ctx) {
3570
3571
  let prompt = assembleCoordinatorPrompt(ctx, {});
@@ -3650,6 +3651,8 @@ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
3650
3651
  }
3651
3652
  sections.push(buildPolicySection(mergeAndNormalizePolicy(void 0, mesh.policy)));
3652
3653
  sections.push(buildBrainPresetsSection());
3654
+ const magiSection = buildMagiKindPanelsSection(ctx.magiKindPanels);
3655
+ if (magiSection) sections.push(magiSection);
3653
3656
  sections.push(TOOLS_SECTION);
3654
3657
  sections.push(TOOL_EXPOSURE_PREFLIGHT_SECTION);
3655
3658
  sections.push(WORKFLOW_SECTION);
@@ -3866,6 +3869,36 @@ function buildBrainPresetsSection() {
3866
3869
  }
3867
3870
  return lines.join("\n");
3868
3871
  }
3872
+ function buildMagiKindPanelsSection(panels) {
3873
+ if (!panels) return null;
3874
+ const configured = Object.entries(panels).filter(([, slots]) => Array.isArray(slots) && slots.length > 0);
3875
+ if (configured.length === 0) return null;
3876
+ const lines = [
3877
+ "## Configured MAGI panels",
3878
+ "",
3879
+ "These machine-local MAGI kind-panels are configured on this mesh \u2014 read-only cross-verification quorums:",
3880
+ ""
3881
+ ];
3882
+ for (const [kind, slots] of configured) {
3883
+ const replicaCount = slots.reduce((sum, s2) => sum + (s2.n && s2.n > 0 ? s2.n : 1), 0);
3884
+ const label = replicaCount === slots.length ? `${slots.length} ${slots.length === 1 ? "slot" : "slots"}` : `${replicaCount} replicas`;
3885
+ const rendered = slots.map(renderMagiSlot).join(", ");
3886
+ lines.push(`- **${kind}** (${label}): ${rendered}`);
3887
+ }
3888
+ lines.push("");
3889
+ lines.push("Use these via `mesh_magi_review` (the `task_kind` is REQUIRED \u2014 it selects BOTH the output schema and the panel). The live authoritative slot list is `mesh_magi_kind_panel_list`. MAGI worker replicas are read-only and typically do NOT have mesh MCP tools exposed, so for live timing / tool-behavior claims you MUST gather the primary evidence yourself and use MAGI only for independent source-level corroboration.");
3890
+ return lines.join("\n");
3891
+ }
3892
+ function renderMagiSlot(slot) {
3893
+ let s2 = slot.provider;
3894
+ if (slot.nodeId) s2 += `@${slot.nodeId}`;
3895
+ const extra = [];
3896
+ if (slot.model) extra.push(`model: ${slot.model}`);
3897
+ if (slot.capabilityTags && slot.capabilityTags.length) extra.push(`tags: ${slot.capabilityTags.join("+")}`);
3898
+ if (slot.n && slot.n > 1) extra.push(`\xD7${slot.n}`);
3899
+ if (extra.length) s2 += ` (${extra.join(", ")})`;
3900
+ return s2;
3901
+ }
3869
3902
  function buildPolicySection(policy) {
3870
3903
  const rules = [];
3871
3904
  if (policy.requirePreTaskCheckpoint) rules.push("- Create a git checkpoint **before** starting each task");
@@ -3892,7 +3925,7 @@ function buildRulesSection(coordinatorCliType) {
3892
3925
 
3893
3926
  - **Route, don't implement.** Delegate all code reading, analysis, and execution to node agents. Never read source files or run commands in the coordinator \u2014 keep context lean.
3894
3927
  - **Front-load task messages.** Include everything the agent needs (files, problem, expected fix) in \`mesh_enqueue_task\` / \`mesh_send_task\`. Append a structured result request at the end: ask the worker to conclude with a JSON block containing \`status\`, \`changedFiles\`, \`gitStatus\`, \`validationResults\`, \`errors\`, \`nextAction\`. The daemon parses this automatically; you can read it from \`mesh_task_history\`.
3895
- - **Reuse idle sessions.** For follow-up, retry, commit/push, or cleanup on the same issue, send only the delta to the existing idle session. Start fresh only for independent work, provider mismatch, transcript contamination, or required worktree isolation.
3928
+ - **Reuse idle sessions.** For follow-up, retry, commit/push, or cleanup on the same issue, send only the delta to the existing idle session. Start a fresh session only when: (a) branch/worktree isolation is required, (b) the existing session had a dispatch failure or provider mismatch, (c) the transcript/runtime is contaminated or interrupted, or (d) the user explicitly asks for a different provider/session. Continuation of the same issue in an already-idle session is allowed and preferred \u2014 this rule blocks concurrent unrelated work interleaved into a live (still-generating) session, not sequential same-issue follow-ups.
3896
3929
  - **Worktree affinity.** A worktree is a durable per-branch workspace; keep all of a branch's code_change/fix/review work on its worktree node by targeting \`required_tags: ["worktree=<branch>"]\` or \`target_node_id\`. Get the id/branch from the \`mesh_clone_node\` result or a live \`mesh_status\` \u2014 the Configured Nodes snapshot won't list a worktree cloned after launch. Untargeted same-branch follow-ups drift to the base node. Only \`convergence\` (merge/push) runs on the base, never pinned to the worktree.
3897
3930
  - **Classify task difficulty to save tokens.** For each task you enqueue, judge its execution difficulty and pass \`difficulty\`: \`easy\` (extraction, renames, doc tweaks, trivial fixes), \`medium\` (ordinary feature/bugfix work), \`difficult\` (architecture, tricky debugging, multi-file refactors, subtle reasoning), or \`freeform\`. The mesh's per-difficulty brain preset then runs easy tasks on a cheaper model at low reasoning effort and hard tasks on a stronger model at high effort \u2014 real token savings on simple work. The current presets are shown in the "Brain presets" section below. You may still pass an explicit \`model\`/\`thinkingLevel\` to override the preset for one task.
3898
3931
  - **Retune node profiles when routing is a poor fit \u2014 but only with approval.** A node's capability slots (its provider/model/thinking + difficulty range + capability tags, seen via \`mesh_node_slots_list\`) are what task\u2192node fitness routing matches against. If you notice a persistent mismatch \u2014 e.g. every \`difficult\` task lands on a node whose only slot is a cheap model, or a capability a node clearly has isn't declared \u2014 you MAY propose a slot change with \`mesh_node_slots_set\` (write=false). That returns current-vs-proposed; present that diff to the user with a one-line reason and apply (write=true) ONLY after they approve. It is a WHOLESALE replacement of the node's slots, so include the slots you want to keep. Never rewrite a node's profile silently or without a clear routing reason.
@@ -3900,12 +3933,15 @@ function buildRulesSection(coordinatorCliType) {
3900
3933
  - **Verify via git, not source.** Use \`mesh_git_status\` to confirm side effects. Treat agent summaries as self-reports, not verification.
3901
3934
  - **Limit parallelism.** Start with 1\u20132 tasks; scale only on success. Never duplicate a session because \`mesh_read_chat\` shows no final message while tool/terminal activity is ongoing. This caps *concurrent* load \u2014 it does not mean serialize independent work: when a new, independent request arrives and there is headroom under \`maxParallelTasks\`, dispatch it right away rather than waiting for an in-flight task or a user nudge (read-only diagnosis especially, since it has no merge cost).
3902
3935
  - **Check history first.** Call \`mesh_task_history\` at session start to avoid duplicate work and inform recovery. On failure, read task history before retrying.
3936
+ - **Don't reopen already-done work after a resume.** Before reopening a reported issue after context compaction or session resume, check current git state and recent session context. If another session has already completed the work, continue from the existing diff/commit instead of starting a duplicate investigation.
3903
3937
  - **Sequence shared-base-moving merges.** Parallel dispatch is encouraged, but merging one worktree can advance another in-flight worktree's base \u2014 especially a shared submodule pointer \u2014 turning a clean fast-forward into a diverged rebase (patch-equivalence correctly blocks this). Before merging an in-flight worktree while siblings are also in flight, land in an intentional order, re-clone long-running worktrees from the advanced base, or expect to manually rebase + ff-only the laggards; merging an independent fix mid-flight can strand siblings into a rebase.
3904
3938
  - **Converge branches.** After worktree tasks: refine/fast-forward, or classify as \`pushed_feature_branch_needs_merge\` / \`blocked_review\` / \`cleanup_candidate\` / \`not_mergeable\`. Clean up with \`mesh_remove_node\`.
3905
3939
  - **Refinery is config-driven.** \`mesh_refine_node\` must run validation from \`.adhdev/refine.{json,yaml,yml}\` or \`repo-mesh.refine.*\`. Heuristics are scaffolding only.
3906
3940
  - **Submodule reachability = publish-needed.** \`submodule_reachability_failed\` \u2192 classify as \`blocked_review\`, request user approval to push to submodule main, then rerun \`mesh_refine_node\`.
3907
3941
  - **Honor per-node instructions.** When a node carries a \u{1F4CC} Node instruction in the nodes section, include the relevant parts of that instruction in the task message you send to that node. Don't paraphrase the instruction into your own words \u2014 quote it verbatim so the worker agent sees exactly what the user wrote.
3908
3942
  - **Mission status does not update itself.** When a mission's tasks are all done or the work is abandoned, explicitly call \`mesh_mission_upsert\` to set status \`completed\` or \`abandoned\`. Never leave a finished mission in \`active\`. All-cancelled tasks with no further work \u2192 \`abandoned\`.
3943
+ - **Don't spawn a nested coordinator for simple inspection.** Do not spawn a nested coordinator-like agent for simple inspection tasks. If delegation is required, use explicit provider selection and a fully self-contained, bounded task instruction.
3944
+ - **Keep internal traffic out of the transcript.** Internal tool calls, status events, control messages, and debug output must not appear as ordinary user-visible chat transcript content unless explicitly marked user-facing by the producing agent.
3909
3945
  - **Never fabricate tool results.** Always call the actual tool.
3910
3946
  - **Keep the user informed.** One or two sentences after each delegation round.${coordinatorNote}
3911
3947
 
@@ -4010,7 +4046,9 @@ Follow these recovery rules:
4010
4046
  1. **If "Retry recommended"**: Check \`mesh_view_queue\` first \u2014 the daemon may have auto-requeued. If not, re-launch the session on the same node (\`mesh_launch_session\`), then resend the original task (\`mesh_send_task\`). The system message includes the original task text.
4011
4047
  2. **If "Max retries exceeded"**: Do NOT retry on the same node. Either reassign the task to a different node, or inform the user that the task requires manual intervention.
4012
4048
  3. **If no recovery context**: The stop may be intentional (normal completion). Use \`mesh_read_chat\` once to verify, then move on.
4013
- 4. **Always record what happened**: After handling a failure, briefly note the outcome in your report to the user.`;
4049
+ 4. **Always record what happened**: After handling a failure, briefly note the outcome in your report to the user.
4050
+ 5. **Stuck-but-done vs actually-stuck**: If a delegated session appears stuck but has already produced a verified final summary or diff, stop polling noisy tool/terminal transcript bubbles. Verify with \`mesh_git_status\` or a checkpoint and proceed to landing.
4051
+ 6. **Refinery falsely blocks a verified-clean branch \u2014 manual fast-forward convergence**: When \`mesh_refine_node\` falsely blocks a verified-clean branch (stale preflight, or the submodule-gitlink trivial-fast-forward misjudgment), bypass the refine tool and converge by strict fast-forward \u2014 (1) rebase the submodule commit onto the submodule \`origin/main\`, (2) push the submodule ff-only (verify \`git merge-base --is-ancestor\` first), (3) rebase the root branch and re-bump the submodule pointer so the root diff stays non-empty, (4) push the root ff-only. NEVER force-push or reset; abort and report on any non-fast-forward.`;
4014
4052
  ONBOARDING_SECTION = `## Onboarding / Reinit
4015
4053
 
4016
4054
  When the user asks to **set up / configure / onboard** this repo for Repo Mesh (or to **re-init / reconfigure** an already-onboarded repo), run ONE guided, approval-gated conversation. You draft, the user approves, the daemon writes. Never auto-write a heuristic suggestion without an explicit user approval turn.
@@ -15535,6 +15573,32 @@ var init_mesh_clone_grace = __esm({
15535
15573
  }
15536
15574
  });
15537
15575
 
15576
+ // src/mesh/model-provider-compat.ts
15577
+ function isAnthropicProvider(providerType) {
15578
+ const p = typeof providerType === "string" ? providerType.trim().toLowerCase() : "";
15579
+ return p.length > 0 && ANTHROPIC_PROVIDER_TYPES.has(p);
15580
+ }
15581
+ function isAnthropicModel(model) {
15582
+ const m = typeof model === "string" ? model.trim().toLowerCase() : "";
15583
+ if (!m) return false;
15584
+ if (m.startsWith("claude") || m.startsWith("anthropic")) return true;
15585
+ return /^(opus|sonnet|haiku)(\b|[-_])/.test(m);
15586
+ }
15587
+ function isModelCompatibleWithProvider(model, providerType) {
15588
+ if (!isAnthropicModel(model)) return true;
15589
+ if (isAnthropicProvider(providerType)) return true;
15590
+ return false;
15591
+ }
15592
+ var ANTHROPIC_PROVIDER_TYPES;
15593
+ var init_model_provider_compat = __esm({
15594
+ "src/mesh/model-provider-compat.ts"() {
15595
+ "use strict";
15596
+ ANTHROPIC_PROVIDER_TYPES = /* @__PURE__ */ new Set([
15597
+ "claude-cli"
15598
+ ]);
15599
+ }
15600
+ });
15601
+
15538
15602
  // src/mesh/mesh-queue-assignment.ts
15539
15603
  function localCoordinatorDaemonId() {
15540
15604
  return canonicalDaemonId(readNonEmptyString2(loadConfig().machineId));
@@ -16511,8 +16575,12 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
16511
16575
  markAutoLaunch(meshId, task.id, { status: "skipped", reason: resolved.reason || "provider_unusable", nodeId });
16512
16576
  continue;
16513
16577
  }
16514
- const effectiveModel = typeof task.model === "string" && task.model.trim() ? task.model.trim() : resolved.model;
16578
+ const rawEffectiveModel = typeof task.model === "string" && task.model.trim() ? task.model.trim() : resolved.model;
16515
16579
  const effectiveThinkingLevel = typeof task.thinkingLevel === "string" && task.thinkingLevel.trim() ? task.thinkingLevel.trim() : resolved.thinkingLevel;
16580
+ const effectiveModel = isModelCompatibleWithProvider(rawEffectiveModel, resolved.providerType) ? rawEffectiveModel : void 0;
16581
+ if (rawEffectiveModel && effectiveModel === void 0) {
16582
+ LOG.info("MeshQueue", `CODEX-400 GUARD: dropped incompatible launch model '${rawEffectiveModel}' for non-Anthropic provider '${resolved.providerType}' on node ${nodeId} (task ${task.id}); provider will use its own default model`);
16583
+ }
16516
16584
  const providerCap = resolveProviderMaxParallel(node?.policy, resolved.providerType);
16517
16585
  if (providerCap !== void 0 && activeProviderAssignedCount(meshId, nodeId, resolved.providerType) >= providerCap) {
16518
16586
  markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_provider_parallel_reached", nodeId, providerType: resolved.providerType });
@@ -16844,6 +16912,7 @@ var init_mesh_queue_assignment = __esm({
16844
16912
  init_worktree_bootstrap_config();
16845
16913
  init_mesh_clone_grace();
16846
16914
  init_mesh_task_inflight();
16915
+ init_model_provider_compat();
16847
16916
  IDLE_AUTO_FAST_FORWARD_THROTTLE_MS = 30 * 60 * 1e3;
16848
16917
  idleAutoFastForwardLastAttempt = /* @__PURE__ */ new Map();
16849
16918
  BOOTSTRAP_TERMINAL_STATUSES = /* @__PURE__ */ new Set(["complete", "failed"]);
@@ -57408,6 +57477,14 @@ var meshCoordinatorLaunchHandlers = {
57408
57477
  return void 0;
57409
57478
  }
57410
57479
  };
57480
+ const loadMagiKindPanelsBestEffort = async () => {
57481
+ try {
57482
+ const { listMagiKindPanels: listMagiKindPanels2 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
57483
+ return listMagiKindPanels2();
57484
+ } catch {
57485
+ return void 0;
57486
+ }
57487
+ };
57411
57488
  let mesh;
57412
57489
  if (args?.inlineMesh && typeof args.inlineMesh === "object") {
57413
57490
  mesh = args.inlineMesh;
@@ -57505,7 +57582,7 @@ var meshCoordinatorLaunchHandlers = {
57505
57582
  if (coordinatorSetup.kind === "cli_command") {
57506
57583
  let cliCmdSystemPrompt = "";
57507
57584
  try {
57508
- cliCmdSystemPrompt = buildCoordinatorSystemPrompt2({ mesh: effectiveMesh, coordinatorCliType: cliType, userInstruction: extraSystemPrompt || void 0, missionSection: buildMissionSectionBestEffort(mesh.id), recentActivity: await buildRecentActivityBestEffort(mesh.id), operatingNotes: await buildEffectiveOperatingNotes(mesh.id) });
57585
+ cliCmdSystemPrompt = buildCoordinatorSystemPrompt2({ mesh: effectiveMesh, coordinatorCliType: cliType, userInstruction: extraSystemPrompt || void 0, missionSection: buildMissionSectionBestEffort(mesh.id), recentActivity: await buildRecentActivityBestEffort(mesh.id), operatingNotes: await buildEffectiveOperatingNotes(mesh.id), magiKindPanels: await loadMagiKindPanelsBestEffort() });
57509
57586
  } catch (error) {
57510
57587
  const message = error?.message || String(error);
57511
57588
  LOG.error("MeshCoordinator", `Failed to build coordinator prompt: ${message}`);
@@ -57684,7 +57761,7 @@ ${ptyResult.output.slice(-2e3)}`);
57684
57761
  }
57685
57762
  let systemPrompt = "";
57686
57763
  try {
57687
- systemPrompt = buildCoordinatorSystemPrompt2({ mesh: effectiveMesh, coordinatorCliType: cliType, userInstruction: extraSystemPrompt || void 0, missionSection: buildMissionSectionBestEffort(mesh.id), recentActivity: await buildRecentActivityBestEffort(mesh.id), operatingNotes: await buildEffectiveOperatingNotes(mesh.id) });
57764
+ systemPrompt = buildCoordinatorSystemPrompt2({ mesh: effectiveMesh, coordinatorCliType: cliType, userInstruction: extraSystemPrompt || void 0, missionSection: buildMissionSectionBestEffort(mesh.id), recentActivity: await buildRecentActivityBestEffort(mesh.id), operatingNotes: await buildEffectiveOperatingNotes(mesh.id), magiKindPanels: await loadMagiKindPanelsBestEffort() });
57688
57765
  } catch (error) {
57689
57766
  const message = error?.message || String(error);
57690
57767
  LOG.error("MeshCoordinator", `Failed to build coordinator prompt: ${message}`);