@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 +87 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -10
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/coordinator-prompt.d.ts +21 -0
- package/dist/mesh/model-provider-compat.d.ts +44 -0
- package/package.json +3 -3
- package/src/commands/high-family/mesh-coordinator-launch.ts +15 -2
- package/src/mesh/coordinator-prompt.ts +73 -2
- package/src/mesh/mesh-queue-assignment.ts +20 -1
- package/src/mesh/model-provider-compat.ts +73 -0
package/dist/index.mjs
CHANGED
|
@@ -412,10 +412,10 @@ function readInjected(value) {
|
|
|
412
412
|
}
|
|
413
413
|
function getDaemonBuildInfo() {
|
|
414
414
|
if (cached) return cached;
|
|
415
|
-
const commit = readInjected(true ? "
|
|
416
|
-
const commitShort = readInjected(true ? "
|
|
417
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
418
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
415
|
+
const commit = readInjected(true ? "3c72ac19ec9253071d614cd2410dc9f8d555eb26" : void 0) ?? "unknown";
|
|
416
|
+
const commitShort = readInjected(true ? "3c72ac19" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
417
|
+
const version = readInjected(true ? "0.9.82-rc.508" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
418
|
+
const builtAt = readInjected(true ? "2026-07-12T23:18:59.856Z" : void 0);
|
|
419
419
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
420
420
|
return cached;
|
|
421
421
|
}
|
|
@@ -3558,7 +3558,8 @@ var init_mesh_config = __esm({
|
|
|
3558
3558
|
// src/mesh/coordinator-prompt.ts
|
|
3559
3559
|
var coordinator_prompt_exports = {};
|
|
3560
3560
|
__export(coordinator_prompt_exports, {
|
|
3561
|
-
buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt
|
|
3561
|
+
buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt,
|
|
3562
|
+
buildMagiKindPanelsSection: () => buildMagiKindPanelsSection
|
|
3562
3563
|
});
|
|
3563
3564
|
import * as fs2 from "fs";
|
|
3564
3565
|
import * as os2 from "os";
|
|
@@ -3647,6 +3648,8 @@ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
|
|
|
3647
3648
|
}
|
|
3648
3649
|
sections.push(buildPolicySection(mergeAndNormalizePolicy(void 0, mesh.policy)));
|
|
3649
3650
|
sections.push(buildBrainPresetsSection());
|
|
3651
|
+
const magiSection = buildMagiKindPanelsSection(ctx.magiKindPanels);
|
|
3652
|
+
if (magiSection) sections.push(magiSection);
|
|
3650
3653
|
sections.push(TOOLS_SECTION);
|
|
3651
3654
|
sections.push(TOOL_EXPOSURE_PREFLIGHT_SECTION);
|
|
3652
3655
|
sections.push(WORKFLOW_SECTION);
|
|
@@ -3863,6 +3866,36 @@ function buildBrainPresetsSection() {
|
|
|
3863
3866
|
}
|
|
3864
3867
|
return lines.join("\n");
|
|
3865
3868
|
}
|
|
3869
|
+
function buildMagiKindPanelsSection(panels) {
|
|
3870
|
+
if (!panels) return null;
|
|
3871
|
+
const configured = Object.entries(panels).filter(([, slots]) => Array.isArray(slots) && slots.length > 0);
|
|
3872
|
+
if (configured.length === 0) return null;
|
|
3873
|
+
const lines = [
|
|
3874
|
+
"## Configured MAGI panels",
|
|
3875
|
+
"",
|
|
3876
|
+
"These machine-local MAGI kind-panels are configured on this mesh \u2014 read-only cross-verification quorums:",
|
|
3877
|
+
""
|
|
3878
|
+
];
|
|
3879
|
+
for (const [kind, slots] of configured) {
|
|
3880
|
+
const replicaCount = slots.reduce((sum, s2) => sum + (s2.n && s2.n > 0 ? s2.n : 1), 0);
|
|
3881
|
+
const label = replicaCount === slots.length ? `${slots.length} ${slots.length === 1 ? "slot" : "slots"}` : `${replicaCount} replicas`;
|
|
3882
|
+
const rendered = slots.map(renderMagiSlot).join(", ");
|
|
3883
|
+
lines.push(`- **${kind}** (${label}): ${rendered}`);
|
|
3884
|
+
}
|
|
3885
|
+
lines.push("");
|
|
3886
|
+
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.");
|
|
3887
|
+
return lines.join("\n");
|
|
3888
|
+
}
|
|
3889
|
+
function renderMagiSlot(slot) {
|
|
3890
|
+
let s2 = slot.provider;
|
|
3891
|
+
if (slot.nodeId) s2 += `@${slot.nodeId}`;
|
|
3892
|
+
const extra = [];
|
|
3893
|
+
if (slot.model) extra.push(`model: ${slot.model}`);
|
|
3894
|
+
if (slot.capabilityTags && slot.capabilityTags.length) extra.push(`tags: ${slot.capabilityTags.join("+")}`);
|
|
3895
|
+
if (slot.n && slot.n > 1) extra.push(`\xD7${slot.n}`);
|
|
3896
|
+
if (extra.length) s2 += ` (${extra.join(", ")})`;
|
|
3897
|
+
return s2;
|
|
3898
|
+
}
|
|
3866
3899
|
function buildPolicySection(policy) {
|
|
3867
3900
|
const rules = [];
|
|
3868
3901
|
if (policy.requirePreTaskCheckpoint) rules.push("- Create a git checkpoint **before** starting each task");
|
|
@@ -3889,7 +3922,7 @@ function buildRulesSection(coordinatorCliType) {
|
|
|
3889
3922
|
|
|
3890
3923
|
- **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.
|
|
3891
3924
|
- **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\`.
|
|
3892
|
-
- **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
|
|
3925
|
+
- **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.
|
|
3893
3926
|
- **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.
|
|
3894
3927
|
- **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.
|
|
3895
3928
|
- **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.
|
|
@@ -3897,12 +3930,15 @@ function buildRulesSection(coordinatorCliType) {
|
|
|
3897
3930
|
- **Verify via git, not source.** Use \`mesh_git_status\` to confirm side effects. Treat agent summaries as self-reports, not verification.
|
|
3898
3931
|
- **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).
|
|
3899
3932
|
- **Check history first.** Call \`mesh_task_history\` at session start to avoid duplicate work and inform recovery. On failure, read task history before retrying.
|
|
3933
|
+
- **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.
|
|
3900
3934
|
- **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.
|
|
3901
3935
|
- **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\`.
|
|
3902
3936
|
- **Refinery is config-driven.** \`mesh_refine_node\` must run validation from \`.adhdev/refine.{json,yaml,yml}\` or \`repo-mesh.refine.*\`. Heuristics are scaffolding only.
|
|
3903
3937
|
- **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\`.
|
|
3904
3938
|
- **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.
|
|
3905
3939
|
- **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\`.
|
|
3940
|
+
- **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.
|
|
3941
|
+
- **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.
|
|
3906
3942
|
- **Never fabricate tool results.** Always call the actual tool.
|
|
3907
3943
|
- **Keep the user informed.** One or two sentences after each delegation round.${coordinatorNote}
|
|
3908
3944
|
|
|
@@ -4004,7 +4040,9 @@ Follow these recovery rules:
|
|
|
4004
4040
|
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.
|
|
4005
4041
|
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.
|
|
4006
4042
|
3. **If no recovery context**: The stop may be intentional (normal completion). Use \`mesh_read_chat\` once to verify, then move on.
|
|
4007
|
-
4. **Always record what happened**: After handling a failure, briefly note the outcome in your report to the user
|
|
4043
|
+
4. **Always record what happened**: After handling a failure, briefly note the outcome in your report to the user.
|
|
4044
|
+
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.
|
|
4045
|
+
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.`;
|
|
4008
4046
|
ONBOARDING_SECTION = `## Onboarding / Reinit
|
|
4009
4047
|
|
|
4010
4048
|
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.
|
|
@@ -15537,6 +15575,32 @@ var init_mesh_clone_grace = __esm({
|
|
|
15537
15575
|
}
|
|
15538
15576
|
});
|
|
15539
15577
|
|
|
15578
|
+
// src/mesh/model-provider-compat.ts
|
|
15579
|
+
function isAnthropicProvider(providerType) {
|
|
15580
|
+
const p = typeof providerType === "string" ? providerType.trim().toLowerCase() : "";
|
|
15581
|
+
return p.length > 0 && ANTHROPIC_PROVIDER_TYPES.has(p);
|
|
15582
|
+
}
|
|
15583
|
+
function isAnthropicModel(model) {
|
|
15584
|
+
const m = typeof model === "string" ? model.trim().toLowerCase() : "";
|
|
15585
|
+
if (!m) return false;
|
|
15586
|
+
if (m.startsWith("claude") || m.startsWith("anthropic")) return true;
|
|
15587
|
+
return /^(opus|sonnet|haiku)(\b|[-_])/.test(m);
|
|
15588
|
+
}
|
|
15589
|
+
function isModelCompatibleWithProvider(model, providerType) {
|
|
15590
|
+
if (!isAnthropicModel(model)) return true;
|
|
15591
|
+
if (isAnthropicProvider(providerType)) return true;
|
|
15592
|
+
return false;
|
|
15593
|
+
}
|
|
15594
|
+
var ANTHROPIC_PROVIDER_TYPES;
|
|
15595
|
+
var init_model_provider_compat = __esm({
|
|
15596
|
+
"src/mesh/model-provider-compat.ts"() {
|
|
15597
|
+
"use strict";
|
|
15598
|
+
ANTHROPIC_PROVIDER_TYPES = /* @__PURE__ */ new Set([
|
|
15599
|
+
"claude-cli"
|
|
15600
|
+
]);
|
|
15601
|
+
}
|
|
15602
|
+
});
|
|
15603
|
+
|
|
15540
15604
|
// src/mesh/mesh-queue-assignment.ts
|
|
15541
15605
|
import { existsSync as existsSync18 } from "fs";
|
|
15542
15606
|
function localCoordinatorDaemonId() {
|
|
@@ -16514,8 +16578,12 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
16514
16578
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: resolved.reason || "provider_unusable", nodeId });
|
|
16515
16579
|
continue;
|
|
16516
16580
|
}
|
|
16517
|
-
const
|
|
16581
|
+
const rawEffectiveModel = typeof task.model === "string" && task.model.trim() ? task.model.trim() : resolved.model;
|
|
16518
16582
|
const effectiveThinkingLevel = typeof task.thinkingLevel === "string" && task.thinkingLevel.trim() ? task.thinkingLevel.trim() : resolved.thinkingLevel;
|
|
16583
|
+
const effectiveModel = isModelCompatibleWithProvider(rawEffectiveModel, resolved.providerType) ? rawEffectiveModel : void 0;
|
|
16584
|
+
if (rawEffectiveModel && effectiveModel === void 0) {
|
|
16585
|
+
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`);
|
|
16586
|
+
}
|
|
16519
16587
|
const providerCap = resolveProviderMaxParallel(node?.policy, resolved.providerType);
|
|
16520
16588
|
if (providerCap !== void 0 && activeProviderAssignedCount(meshId, nodeId, resolved.providerType) >= providerCap) {
|
|
16521
16589
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_provider_parallel_reached", nodeId, providerType: resolved.providerType });
|
|
@@ -16846,6 +16914,7 @@ var init_mesh_queue_assignment = __esm({
|
|
|
16846
16914
|
init_worktree_bootstrap_config();
|
|
16847
16915
|
init_mesh_clone_grace();
|
|
16848
16916
|
init_mesh_task_inflight();
|
|
16917
|
+
init_model_provider_compat();
|
|
16849
16918
|
IDLE_AUTO_FAST_FORWARD_THROTTLE_MS = 30 * 60 * 1e3;
|
|
16850
16919
|
idleAutoFastForwardLastAttempt = /* @__PURE__ */ new Map();
|
|
16851
16920
|
BOOTSTRAP_TERMINAL_STATUSES = /* @__PURE__ */ new Set(["complete", "failed"]);
|
|
@@ -56988,6 +57057,14 @@ var meshCoordinatorLaunchHandlers = {
|
|
|
56988
57057
|
return void 0;
|
|
56989
57058
|
}
|
|
56990
57059
|
};
|
|
57060
|
+
const loadMagiKindPanelsBestEffort = async () => {
|
|
57061
|
+
try {
|
|
57062
|
+
const { listMagiKindPanels: listMagiKindPanels2 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
57063
|
+
return listMagiKindPanels2();
|
|
57064
|
+
} catch {
|
|
57065
|
+
return void 0;
|
|
57066
|
+
}
|
|
57067
|
+
};
|
|
56991
57068
|
let mesh;
|
|
56992
57069
|
if (args?.inlineMesh && typeof args.inlineMesh === "object") {
|
|
56993
57070
|
mesh = args.inlineMesh;
|
|
@@ -57085,7 +57162,7 @@ var meshCoordinatorLaunchHandlers = {
|
|
|
57085
57162
|
if (coordinatorSetup.kind === "cli_command") {
|
|
57086
57163
|
let cliCmdSystemPrompt = "";
|
|
57087
57164
|
try {
|
|
57088
|
-
cliCmdSystemPrompt = buildCoordinatorSystemPrompt2({ mesh: effectiveMesh, coordinatorCliType: cliType, userInstruction: extraSystemPrompt || void 0, missionSection: buildMissionSectionBestEffort(mesh.id), recentActivity: await buildRecentActivityBestEffort(mesh.id), operatingNotes: await buildEffectiveOperatingNotes(mesh.id) });
|
|
57165
|
+
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() });
|
|
57089
57166
|
} catch (error) {
|
|
57090
57167
|
const message = error?.message || String(error);
|
|
57091
57168
|
LOG.error("MeshCoordinator", `Failed to build coordinator prompt: ${message}`);
|
|
@@ -57264,7 +57341,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
57264
57341
|
}
|
|
57265
57342
|
let systemPrompt = "";
|
|
57266
57343
|
try {
|
|
57267
|
-
systemPrompt = buildCoordinatorSystemPrompt2({ mesh: effectiveMesh, coordinatorCliType: cliType, userInstruction: extraSystemPrompt || void 0, missionSection: buildMissionSectionBestEffort(mesh.id), recentActivity: await buildRecentActivityBestEffort(mesh.id), operatingNotes: await buildEffectiveOperatingNotes(mesh.id) });
|
|
57344
|
+
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() });
|
|
57268
57345
|
} catch (error) {
|
|
57269
57346
|
const message = error?.message || String(error);
|
|
57270
57347
|
LOG.error("MeshCoordinator", `Failed to build coordinator prompt: ${message}`);
|