@adhdev/daemon-standalone 0.9.82-rc.322 → 0.9.82-rc.324
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 +210 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -30033,10 +30033,10 @@ var require_dist3 = __commonJS({
|
|
|
30033
30033
|
}
|
|
30034
30034
|
function getDaemonBuildInfo() {
|
|
30035
30035
|
if (cached2) return cached2;
|
|
30036
|
-
const commit = readInjected(true ? "
|
|
30037
|
-
const commitShort = readInjected(true ? "
|
|
30038
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30039
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30036
|
+
const commit = readInjected(true ? "a0aeebdac30d9abea5b46e3f2618f864bbff19d0" : void 0) ?? "unknown";
|
|
30037
|
+
const commitShort = readInjected(true ? "a0aeebda" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30038
|
+
const version2 = readInjected(true ? "0.9.82-rc.324" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30039
|
+
const builtAt = readInjected(true ? "2026-06-19T07:38:51.241Z" : void 0);
|
|
30040
30040
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30041
30041
|
return cached2;
|
|
30042
30042
|
}
|
|
@@ -32693,26 +32693,113 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
32693
32693
|
updateTaskStatus: () => updateTaskStatus,
|
|
32694
32694
|
validateMeshTaskModeRequest: () => validateMeshTaskModeRequest
|
|
32695
32695
|
});
|
|
32696
|
+
function hasNegationBefore(text, matchIndex) {
|
|
32697
|
+
const before = text.slice(0, matchIndex);
|
|
32698
|
+
const clauseStart = Math.max(
|
|
32699
|
+
before.lastIndexOf("\n"),
|
|
32700
|
+
before.lastIndexOf(". "),
|
|
32701
|
+
before.lastIndexOf("! "),
|
|
32702
|
+
before.lastIndexOf("? "),
|
|
32703
|
+
before.lastIndexOf(";")
|
|
32704
|
+
);
|
|
32705
|
+
const clause = before.slice(clauseStart + 1);
|
|
32706
|
+
const lower = clause.toLowerCase();
|
|
32707
|
+
const tokens = clause.split(/\s+/).filter(Boolean);
|
|
32708
|
+
const windowTokens = tokens.slice(Math.max(0, tokens.length - NEGATION_WINDOW_TOKENS));
|
|
32709
|
+
const windowText = windowTokens.join(" ").toLowerCase();
|
|
32710
|
+
for (const cue of NEGATION_CUES) {
|
|
32711
|
+
const c = cue.toLowerCase();
|
|
32712
|
+
if (/[^\x00-\x7f]/.test(c)) {
|
|
32713
|
+
if (lower.includes(c)) return true;
|
|
32714
|
+
} else if (windowText.includes(c)) {
|
|
32715
|
+
return true;
|
|
32716
|
+
}
|
|
32717
|
+
}
|
|
32718
|
+
return false;
|
|
32719
|
+
}
|
|
32720
|
+
function hasTrailingNegation(text, matchEnd) {
|
|
32721
|
+
const after = text.slice(matchEnd);
|
|
32722
|
+
const clauseEnd = (() => {
|
|
32723
|
+
const stops = [after.indexOf("\n"), after.indexOf(". "), after.indexOf("; ")].filter((i) => i >= 0);
|
|
32724
|
+
return stops.length ? Math.min(...stops) : after.length;
|
|
32725
|
+
})();
|
|
32726
|
+
const clause = after.slice(0, clauseEnd).toLowerCase();
|
|
32727
|
+
for (const cue of NEGATION_CUES) {
|
|
32728
|
+
const c = cue.toLowerCase();
|
|
32729
|
+
if (/[^\x00-\x7f]/.test(c) && clause.includes(c)) return true;
|
|
32730
|
+
}
|
|
32731
|
+
return false;
|
|
32732
|
+
}
|
|
32733
|
+
function isMutationKeywordInCommandContext(text, matchStart, matchEnd) {
|
|
32734
|
+
if (isInsideBackticksOrFence(text, matchStart, matchEnd)) return true;
|
|
32735
|
+
const lineStart = text.lastIndexOf("\n", matchStart - 1) + 1;
|
|
32736
|
+
const linePrefix = text.slice(lineStart, matchStart);
|
|
32737
|
+
if (/^\s*[$>]\s/.test(text.slice(lineStart))) return true;
|
|
32738
|
+
if (/^\s*$/.test(linePrefix)) return true;
|
|
32739
|
+
if (/(?:&&|\|\||\||;)\s*$/.test(linePrefix)) return true;
|
|
32740
|
+
if (/(?:^|[\s,])(?:then|run|first)\s+$/i.test(linePrefix)) return true;
|
|
32741
|
+
if (/,\s*$/.test(linePrefix)) return true;
|
|
32742
|
+
return false;
|
|
32743
|
+
}
|
|
32744
|
+
function isInsideBackticksOrFence(text, matchStart, matchEnd) {
|
|
32745
|
+
const fenceRe = /```/g;
|
|
32746
|
+
let fenceCount = 0;
|
|
32747
|
+
let m;
|
|
32748
|
+
while ((m = fenceRe.exec(text)) !== null) {
|
|
32749
|
+
if (m.index >= matchStart) break;
|
|
32750
|
+
fenceCount++;
|
|
32751
|
+
}
|
|
32752
|
+
if (fenceCount % 2 === 1) return true;
|
|
32753
|
+
let inlineCount = 0;
|
|
32754
|
+
for (let i = 0; i < matchStart; i++) {
|
|
32755
|
+
if (text[i] === "`") {
|
|
32756
|
+
if (text[i + 1] === "`" && text[i + 2] === "`") {
|
|
32757
|
+
i += 2;
|
|
32758
|
+
continue;
|
|
32759
|
+
}
|
|
32760
|
+
inlineCount++;
|
|
32761
|
+
}
|
|
32762
|
+
}
|
|
32763
|
+
return inlineCount % 2 === 1;
|
|
32764
|
+
}
|
|
32765
|
+
function isRealMutationMatch(text, matchStart, matchEnd) {
|
|
32766
|
+
if (hasNegationBefore(text, matchStart)) return false;
|
|
32767
|
+
if (hasTrailingNegation(text, matchEnd)) return false;
|
|
32768
|
+
return isMutationKeywordInCommandContext(text, matchStart, matchEnd);
|
|
32769
|
+
}
|
|
32770
|
+
function patternHasRealMutation(pattern, text) {
|
|
32771
|
+
const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
|
|
32772
|
+
let match;
|
|
32773
|
+
while ((match = re.exec(text)) !== null) {
|
|
32774
|
+
if (isRealMutationMatch(text, match.index, match.index + match[0].length)) return true;
|
|
32775
|
+
if (match.index === re.lastIndex) re.lastIndex++;
|
|
32776
|
+
}
|
|
32777
|
+
return false;
|
|
32778
|
+
}
|
|
32696
32779
|
function detectGitMutation(message) {
|
|
32697
32780
|
const re = /\bgit\s+([a-z][a-z0-9-]*)/gi;
|
|
32698
32781
|
let match;
|
|
32699
32782
|
while ((match = re.exec(message)) !== null) {
|
|
32700
32783
|
const sub = match[1].toLowerCase();
|
|
32701
|
-
|
|
32784
|
+
const isReal = () => isRealMutationMatch(message, match.index, match.index + match[0].length);
|
|
32785
|
+
if (GIT_MUTATION_SUBCOMMANDS.has(sub)) {
|
|
32786
|
+
if (isReal()) return true;
|
|
32787
|
+
continue;
|
|
32788
|
+
}
|
|
32702
32789
|
if (sub === "stash") {
|
|
32703
32790
|
const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
|
|
32704
32791
|
const next = after ? after[1].toLowerCase() : "";
|
|
32705
|
-
if (!GIT_STASH_READONLY_SUBCOMMANDS.has(next)) return true;
|
|
32792
|
+
if (!GIT_STASH_READONLY_SUBCOMMANDS.has(next) && isReal()) return true;
|
|
32706
32793
|
} else if (sub === "checkout") {
|
|
32707
|
-
return true;
|
|
32794
|
+
if (isReal()) return true;
|
|
32708
32795
|
} else if (sub === "submodule") {
|
|
32709
32796
|
const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
|
|
32710
32797
|
const next = after ? after[1].toLowerCase() : "";
|
|
32711
|
-
if (next === "update" || next === "add" || next === "sync" || next === "deinit") return true;
|
|
32798
|
+
if ((next === "update" || next === "add" || next === "sync" || next === "deinit") && isReal()) return true;
|
|
32712
32799
|
} else if (sub === "worktree") {
|
|
32713
32800
|
const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
|
|
32714
32801
|
const next = after ? after[1].toLowerCase() : "";
|
|
32715
|
-
if (next === "add" || next === "remove" || next === "move" || next === "prune") return true;
|
|
32802
|
+
if ((next === "add" || next === "remove" || next === "move" || next === "prune") && isReal()) return true;
|
|
32716
32803
|
}
|
|
32717
32804
|
}
|
|
32718
32805
|
return false;
|
|
@@ -32731,7 +32818,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
32731
32818
|
return { valid: true, taskMode, violations: [] };
|
|
32732
32819
|
}
|
|
32733
32820
|
const text = message || "";
|
|
32734
|
-
const violations = LIVE_DEBUG_READONLY_FORBIDDEN.filter((rule) => rule.pattern
|
|
32821
|
+
const violations = LIVE_DEBUG_READONLY_FORBIDDEN.filter((rule) => patternHasRealMutation(rule.pattern, text)).map((rule) => rule.label);
|
|
32735
32822
|
if (detectGitMutation(text)) {
|
|
32736
32823
|
violations.push("git_mutation");
|
|
32737
32824
|
}
|
|
@@ -32761,13 +32848,21 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
32761
32848
|
if (!Array.isArray(raw)) return void 0;
|
|
32762
32849
|
return raw.find((type) => typeof type === "string" && type.trim())?.trim();
|
|
32763
32850
|
}
|
|
32851
|
+
function readNodeOverride(node, key) {
|
|
32852
|
+
const overrides = node?.userOverrides;
|
|
32853
|
+
if (!overrides || typeof overrides !== "object" || Array.isArray(overrides)) return null;
|
|
32854
|
+
const value = overrides[key];
|
|
32855
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
32856
|
+
}
|
|
32764
32857
|
function buildMeshNodeCapabilityTags(node, providerType) {
|
|
32765
32858
|
const provider = typeof providerType === "string" && providerType.trim() ? providerType.trim() : firstProviderPriority(node?.policy);
|
|
32766
32859
|
const worktreeBranch = typeof node?.worktreeBranch === "string" && node.worktreeBranch.trim() ? node.worktreeBranch.trim() : null;
|
|
32860
|
+
const os30 = readNodeOverride(node, "platform") ?? process.platform;
|
|
32861
|
+
const arch2 = readNodeOverride(node, "arch") ?? process.arch;
|
|
32767
32862
|
return normalizeMeshCapabilityTags([
|
|
32768
32863
|
...Array.isArray(node?.capabilities) ? node.capabilities : [],
|
|
32769
|
-
`os=${
|
|
32770
|
-
`arch=${
|
|
32864
|
+
`os=${os30}`,
|
|
32865
|
+
`arch=${arch2}`,
|
|
32771
32866
|
...provider ? [`provider=${provider}`] : [],
|
|
32772
32867
|
// Worktree nodes automatically expose a "worktree=<branch>" tag so that
|
|
32773
32868
|
// mesh_enqueue_task with required_tags: ["worktree=<branch>"] routes
|
|
@@ -33129,6 +33224,8 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
33129
33224
|
var HISTORICAL_MESH_QUEUE_STATUSES;
|
|
33130
33225
|
var MESH_TASK_MODES;
|
|
33131
33226
|
var LIVE_DEBUG_READONLY_FORBIDDEN;
|
|
33227
|
+
var NEGATION_CUES;
|
|
33228
|
+
var NEGATION_WINDOW_TOKENS;
|
|
33132
33229
|
var GIT_MUTATION_SUBCOMMANDS;
|
|
33133
33230
|
var GIT_STASH_READONLY_SUBCOMMANDS;
|
|
33134
33231
|
var DEPENDENCY_FAILURE_TERMINALS;
|
|
@@ -33151,6 +33248,23 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
33151
33248
|
{ label: "package_install", pattern: /\b(npm\s+(?:install|i|add|link|uninstall|remove)|yarn\s+(?:add|remove|link)|pnpm\s+(?:add|remove|link)|pip\s+install|brew\s+install|apt\s+install|cargo\s+install)\b/i },
|
|
33152
33249
|
{ label: "container_mutation", pattern: /\b(docker\s+(?:build|run|exec|push|tag|rmi|rm|create|start|stop|kill)|kubectl\s+(?:apply|delete|patch|replace|create|scale))\b/i }
|
|
33153
33250
|
];
|
|
33251
|
+
NEGATION_CUES = [
|
|
33252
|
+
"don't",
|
|
33253
|
+
"do not",
|
|
33254
|
+
"never",
|
|
33255
|
+
"avoid",
|
|
33256
|
+
"without",
|
|
33257
|
+
"no longer",
|
|
33258
|
+
"not",
|
|
33259
|
+
"forbidden",
|
|
33260
|
+
"\uD558\uC9C0 \uB9C8",
|
|
33261
|
+
"\uD558\uC9C0 \uB9C8\uC138\uC694",
|
|
33262
|
+
"\uB9D0 \uAC83",
|
|
33263
|
+
"\uAE08\uC9C0",
|
|
33264
|
+
"\uC5C6\uC74C",
|
|
33265
|
+
"\uC54A"
|
|
33266
|
+
];
|
|
33267
|
+
NEGATION_WINDOW_TOKENS = 6;
|
|
33154
33268
|
GIT_MUTATION_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
33155
33269
|
"add",
|
|
33156
33270
|
"commit",
|
|
@@ -73412,6 +73526,70 @@ ${e?.stderr || ""}`
|
|
|
73412
73526
|
};
|
|
73413
73527
|
}
|
|
73414
73528
|
}
|
|
73529
|
+
async function checkWorktreeChangesPatchEquivalentInRef(repoRoot, ref, worktreeHead) {
|
|
73530
|
+
const startedAt = Date.now();
|
|
73531
|
+
try {
|
|
73532
|
+
const { execFileSync: execFileSync7 } = await import("child_process");
|
|
73533
|
+
const git = (gitArgs) => execFileSync7("git", gitArgs, {
|
|
73534
|
+
cwd: repoRoot,
|
|
73535
|
+
encoding: "utf8",
|
|
73536
|
+
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
73537
|
+
});
|
|
73538
|
+
const mergeBase = git(["merge-base", ref, worktreeHead]).trim();
|
|
73539
|
+
let mergedTree = "";
|
|
73540
|
+
try {
|
|
73541
|
+
mergedTree = git(["merge-tree", "--write-tree", ref, worktreeHead]).trim().split(/\s+/)[0] || "";
|
|
73542
|
+
} catch (mergeTreeErr) {
|
|
73543
|
+
const output = `${mergeTreeErr?.message || ""}
|
|
73544
|
+
${mergeTreeErr?.stdout || ""}
|
|
73545
|
+
${mergeTreeErr?.stderr || ""}`;
|
|
73546
|
+
const isSubmoduleConflict = /(submodule|160000)/i.test(output) || /Recursive merging with submodules/i.test(output);
|
|
73547
|
+
if (!isSubmoduleConflict) throw mergeTreeErr;
|
|
73548
|
+
const evaluation = evaluateGitlinkTrivialFastForward(repoRoot, ref, worktreeHead);
|
|
73549
|
+
if (!evaluation.trivial) {
|
|
73550
|
+
return {
|
|
73551
|
+
contained: false,
|
|
73552
|
+
ref,
|
|
73553
|
+
worktreeHead,
|
|
73554
|
+
mergeBase: mergeBase || void 0,
|
|
73555
|
+
durationMs: Date.now() - startedAt,
|
|
73556
|
+
error: `merge-tree submodule conflict is not a trivial fast-forward: ${evaluation.reason || "unknown"}`
|
|
73557
|
+
};
|
|
73558
|
+
}
|
|
73559
|
+
mergedTree = synthesizeTrivialFastForwardMergeTree(repoRoot, ref, worktreeHead, evaluation.gitlinks) || "";
|
|
73560
|
+
}
|
|
73561
|
+
if (!mergedTree) {
|
|
73562
|
+
return {
|
|
73563
|
+
contained: false,
|
|
73564
|
+
ref,
|
|
73565
|
+
worktreeHead,
|
|
73566
|
+
mergeBase: mergeBase || void 0,
|
|
73567
|
+
durationMs: Date.now() - startedAt,
|
|
73568
|
+
error: "could not resolve synthetic merge tree for containment check"
|
|
73569
|
+
};
|
|
73570
|
+
}
|
|
73571
|
+
const ffGitlinkExcludePaths = collectFastForwardGitlinkPaths(repoRoot, ref, worktreeHead);
|
|
73572
|
+
const residualPatchId = await computeGitPatchId(repoRoot, ref, mergedTree, ffGitlinkExcludePaths);
|
|
73573
|
+
const contained = residualPatchId === "";
|
|
73574
|
+
return {
|
|
73575
|
+
contained,
|
|
73576
|
+
ref,
|
|
73577
|
+
worktreeHead,
|
|
73578
|
+
mergeBase: mergeBase || void 0,
|
|
73579
|
+
mergedTree,
|
|
73580
|
+
residualPatchId,
|
|
73581
|
+
durationMs: Date.now() - startedAt
|
|
73582
|
+
};
|
|
73583
|
+
} catch (e) {
|
|
73584
|
+
return {
|
|
73585
|
+
contained: false,
|
|
73586
|
+
ref,
|
|
73587
|
+
worktreeHead,
|
|
73588
|
+
durationMs: Date.now() - startedAt,
|
|
73589
|
+
error: e?.message || String(e)
|
|
73590
|
+
};
|
|
73591
|
+
}
|
|
73592
|
+
}
|
|
73415
73593
|
async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
73416
73594
|
const startedAt = Date.now();
|
|
73417
73595
|
try {
|
|
@@ -74383,13 +74561,19 @@ ${e?.stderr || ""}`
|
|
|
74383
74561
|
const workspace = typeof source?.workspace === "string" && source.workspace.trim() ? source.workspace.trim() : typeof args?.workspace === "string" && args.workspace.trim() ? args.workspace.trim() : process.cwd();
|
|
74384
74562
|
if (!workspace) return null;
|
|
74385
74563
|
const nodeId = typeof source?.id === "string" && source.id.trim() ? source.id.trim() : typeof source?.nodeId === "string" && source.nodeId.trim() ? source.nodeId.trim() : void 0;
|
|
74564
|
+
const baseOverrides = source?.userOverrides && typeof source.userOverrides === "object" && !Array.isArray(source.userOverrides) ? source.userOverrides : {};
|
|
74565
|
+
const userOverrides = {
|
|
74566
|
+
...baseOverrides,
|
|
74567
|
+
...typeof baseOverrides.platform === "string" && baseOverrides.platform.trim() ? {} : { platform: process.platform },
|
|
74568
|
+
...typeof baseOverrides.arch === "string" && baseOverrides.arch.trim() ? {} : { arch: process.arch }
|
|
74569
|
+
};
|
|
74386
74570
|
return {
|
|
74387
74571
|
...nodeId ? { id: nodeId } : {},
|
|
74388
74572
|
workspace,
|
|
74389
74573
|
...typeof source?.repoRoot === "string" && source.repoRoot.trim() ? { repoRoot: source.repoRoot.trim() } : {},
|
|
74390
74574
|
...typeof source?.daemonId === "string" && source.daemonId.trim() ? { daemonId: source.daemonId.trim() } : fallbackDaemonId ? { daemonId: fallbackDaemonId } : {},
|
|
74391
74575
|
...typeof source?.machineId === "string" && source.machineId.trim() ? { machineId: source.machineId.trim() } : {},
|
|
74392
|
-
userOverrides
|
|
74576
|
+
userOverrides,
|
|
74393
74577
|
policy: source?.policy && typeof source.policy === "object" && !Array.isArray(source.policy) ? source.policy : {},
|
|
74394
74578
|
role: "member"
|
|
74395
74579
|
};
|
|
@@ -74899,6 +75083,7 @@ ${e?.stderr || ""}`
|
|
|
74899
75083
|
candidateRefs.push("origin/main", "origin/master", "main", "master");
|
|
74900
75084
|
const seen = /* @__PURE__ */ new Set();
|
|
74901
75085
|
const checkedRefs = [];
|
|
75086
|
+
const resolvedRefCommits = [];
|
|
74902
75087
|
for (const ref of candidateRefs) {
|
|
74903
75088
|
if (!ref || seen.has(ref)) continue;
|
|
74904
75089
|
seen.add(ref);
|
|
@@ -74909,12 +75094,24 @@ ${e?.stderr || ""}`
|
|
|
74909
75094
|
continue;
|
|
74910
75095
|
}
|
|
74911
75096
|
checkedRefs.push(ref);
|
|
75097
|
+
resolvedRefCommits.push({ ref, commit });
|
|
74912
75098
|
try {
|
|
74913
75099
|
await runGit3(["merge-base", "--is-ancestor", head, commit], args.repoRoot);
|
|
74914
75100
|
return { allow: true, status: "merged_to_default_ref", source: "git_merge_base", ref };
|
|
74915
75101
|
} catch {
|
|
74916
75102
|
}
|
|
74917
75103
|
}
|
|
75104
|
+
for (const { ref, commit } of resolvedRefCommits) {
|
|
75105
|
+
let containment;
|
|
75106
|
+
try {
|
|
75107
|
+
containment = await checkWorktreeChangesPatchEquivalentInRef(args.repoRoot, commit, head);
|
|
75108
|
+
} catch {
|
|
75109
|
+
continue;
|
|
75110
|
+
}
|
|
75111
|
+
if (containment.contained) {
|
|
75112
|
+
return { allow: true, status: "patch_equivalent_to_default_ref", source: "git_patch_equivalence", ref };
|
|
75113
|
+
}
|
|
75114
|
+
}
|
|
74918
75115
|
return {
|
|
74919
75116
|
allow: false,
|
|
74920
75117
|
status: metadataStatus || void 0,
|