@adhdev/daemon-standalone 1.0.40-rc.1 → 1.0.40-rc.3
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 +110 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +4 -1
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -36539,10 +36539,10 @@ var require_dist3 = __commonJS({
|
|
|
36539
36539
|
}
|
|
36540
36540
|
function getDaemonBuildInfo() {
|
|
36541
36541
|
if (cached2) return cached2;
|
|
36542
|
-
const commit = readInjected(true ? "
|
|
36543
|
-
const commitShort = readInjected(true ? "
|
|
36544
|
-
const version2 = readInjected(true ? "1.0.40-rc.
|
|
36545
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
36542
|
+
const commit = readInjected(true ? "acb6f55e37771396fa029424684127932eb94587" : void 0) ?? "unknown";
|
|
36543
|
+
const commitShort = readInjected(true ? "acb6f55e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
36544
|
+
const version2 = readInjected(true ? "1.0.40-rc.3" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
36545
|
+
const builtAt = readInjected(true ? "2026-08-08T09:31:44.924Z" : void 0);
|
|
36546
36546
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
36547
36547
|
return cached2;
|
|
36548
36548
|
}
|
|
@@ -46492,6 +46492,7 @@ Next step: ${nextStep}`;
|
|
|
46492
46492
|
__resetMeshRuntimeStoreForTests: () => __resetMeshRuntimeStoreForTests,
|
|
46493
46493
|
assertNoDependencyCycle: () => assertNoDependencyCycle,
|
|
46494
46494
|
buildMeshNodeCapabilityTags: () => buildMeshNodeCapabilityTags,
|
|
46495
|
+
buildMeshTaskModeViolationError: () => buildMeshTaskModeViolationError,
|
|
46495
46496
|
cancelTask: () => cancelTask,
|
|
46496
46497
|
claimNextTask: () => claimNextTask,
|
|
46497
46498
|
cleanupTerminalDirectDispatches: () => cleanupTerminalDirectDispatches,
|
|
@@ -46499,6 +46500,7 @@ Next step: ${nextStep}`;
|
|
|
46499
46500
|
describeTaskDependencyState: () => describeTaskDependencyState,
|
|
46500
46501
|
enqueueTask: () => enqueueTask,
|
|
46501
46502
|
expireTaskTargetPin: () => expireTaskTargetPin,
|
|
46503
|
+
formatMeshTaskModeViolations: () => formatMeshTaskModeViolations,
|
|
46502
46504
|
getActiveDirectDispatches: () => getActiveDirectDispatches,
|
|
46503
46505
|
getMeshQueueRevision: () => getMeshQueueRevision,
|
|
46504
46506
|
getMeshQueueStats: () => getMeshQueueStats,
|
|
@@ -46566,6 +46568,25 @@ Next step: ${nextStep}`;
|
|
|
46566
46568
|
if (!task) return false;
|
|
46567
46569
|
return task.readonly === true || task.taskMode === "live_debug_readonly";
|
|
46568
46570
|
}
|
|
46571
|
+
function formatMeshTaskModeViolations(result) {
|
|
46572
|
+
const details = result.violationDetails;
|
|
46573
|
+
if (!details?.length) return result.violations.join(", ");
|
|
46574
|
+
return details.map((d) => `${d.label}: '${d.match}' at line ${d.line} col ${d.column}`).join("; ");
|
|
46575
|
+
}
|
|
46576
|
+
function buildMeshTaskModeViolationError(result) {
|
|
46577
|
+
return `live_debug_readonly_guardrail_violation: forbidden operations (${result.violations.join(", ")}) \u2014 ${formatMeshTaskModeViolations(result)}`;
|
|
46578
|
+
}
|
|
46579
|
+
function locateOffset(text, index) {
|
|
46580
|
+
const before = text.slice(0, index);
|
|
46581
|
+
const line = before.split("\n").length;
|
|
46582
|
+
const lastNl = before.lastIndexOf("\n");
|
|
46583
|
+
return { line, column: index - lastNl };
|
|
46584
|
+
}
|
|
46585
|
+
function buildViolationDetail(label, text, start, end) {
|
|
46586
|
+
const raw = text.slice(start, end);
|
|
46587
|
+
const match = raw.length > MAX_REPORTED_MATCH_LEN ? `${raw.slice(0, MAX_REPORTED_MATCH_LEN)}\u2026` : raw;
|
|
46588
|
+
return { label, match, ...locateOffset(text, start) };
|
|
46589
|
+
}
|
|
46569
46590
|
function hasNegationBefore(text, matchIndex) {
|
|
46570
46591
|
const before = text.slice(0, matchIndex);
|
|
46571
46592
|
const clauseStart = Math.max(
|
|
@@ -46603,12 +46624,51 @@ Next step: ${nextStep}`;
|
|
|
46603
46624
|
}
|
|
46604
46625
|
return false;
|
|
46605
46626
|
}
|
|
46627
|
+
function stripCommandWrappers(prefix) {
|
|
46628
|
+
const m = /^([\s\S]*(?:&&|\|\||\||;)\s*)([\s\S]*)$/.exec(prefix);
|
|
46629
|
+
const head = m ? m[1] : /^\s*/.exec(prefix)?.[0] ?? "";
|
|
46630
|
+
let rest = m ? m[2] : prefix.slice(head.length);
|
|
46631
|
+
let stripped = false;
|
|
46632
|
+
let sawEvidence = false;
|
|
46633
|
+
let sawEvidenceOnlyWrapper = false;
|
|
46634
|
+
for (; ; ) {
|
|
46635
|
+
const tok = /^([^\s]+)\s+/.exec(rest);
|
|
46636
|
+
if (!tok) break;
|
|
46637
|
+
const word = tok[1];
|
|
46638
|
+
const lower = word.toLowerCase();
|
|
46639
|
+
if (COMMAND_WRAPPERS.has(lower)) {
|
|
46640
|
+
rest = rest.slice(tok[0].length);
|
|
46641
|
+
stripped = true;
|
|
46642
|
+
continue;
|
|
46643
|
+
}
|
|
46644
|
+
if (EVIDENCE_ONLY_WRAPPERS.has(lower)) {
|
|
46645
|
+
rest = rest.slice(tok[0].length);
|
|
46646
|
+
stripped = true;
|
|
46647
|
+
sawEvidenceOnlyWrapper = true;
|
|
46648
|
+
continue;
|
|
46649
|
+
}
|
|
46650
|
+
if (stripped && (/^-/.test(word) || /^[A-Za-z_][A-Za-z0-9_]*=/.test(word) || /^\d+$/.test(word))) {
|
|
46651
|
+
rest = rest.slice(tok[0].length);
|
|
46652
|
+
sawEvidence = true;
|
|
46653
|
+
continue;
|
|
46654
|
+
}
|
|
46655
|
+
break;
|
|
46656
|
+
}
|
|
46657
|
+
if (!stripped) return null;
|
|
46658
|
+
if (sawEvidenceOnlyWrapper && !sawEvidence) return null;
|
|
46659
|
+
return head + rest;
|
|
46660
|
+
}
|
|
46606
46661
|
function isMutationKeywordInCommandContext(text, matchStart, matchEnd) {
|
|
46607
46662
|
if (isInsideBackticksOrFence(text, matchStart, matchEnd)) return true;
|
|
46608
46663
|
const lineStart = text.lastIndexOf("\n", matchStart - 1) + 1;
|
|
46609
46664
|
const linePrefix = text.slice(lineStart, matchStart);
|
|
46610
46665
|
if (/^\s*[$>]\s/.test(text.slice(lineStart))) return true;
|
|
46611
46666
|
if (/^\s*$/.test(linePrefix)) return true;
|
|
46667
|
+
const unwrapped = stripCommandWrappers(linePrefix);
|
|
46668
|
+
if (unwrapped !== null) {
|
|
46669
|
+
if (/^\s*$/.test(unwrapped)) return true;
|
|
46670
|
+
if (/(?:&&|\|\||\||;)\s*$/.test(unwrapped)) return true;
|
|
46671
|
+
}
|
|
46612
46672
|
let tokStart = matchStart;
|
|
46613
46673
|
while (tokStart > lineStart && !/\s/.test(text[tokStart - 1])) tokStart--;
|
|
46614
46674
|
const beforeToken = text.slice(lineStart, tokStart);
|
|
@@ -46617,7 +46677,6 @@ Next step: ${nextStep}`;
|
|
|
46617
46677
|
if (atCmdPos && /^(?:\.\/|\.\.\/|~\/|\/)/.test(tokenLead)) return true;
|
|
46618
46678
|
if (/(?:&&|\|\||\||;)\s*$/.test(linePrefix)) return true;
|
|
46619
46679
|
if (/(?:^|[\s,])(?:then|run|first)\s+$/i.test(linePrefix)) return true;
|
|
46620
|
-
if (/,\s*$/.test(linePrefix)) return true;
|
|
46621
46680
|
return false;
|
|
46622
46681
|
}
|
|
46623
46682
|
function isInsideBackticksOrFence(text, matchStart, matchEnd) {
|
|
@@ -46709,42 +46768,49 @@ Next step: ${nextStep}`;
|
|
|
46709
46768
|
if (isInsideQuotedSpan(text, matchStart, matchEnd)) return false;
|
|
46710
46769
|
return isMutationKeywordInCommandContext(text, matchStart, matchEnd);
|
|
46711
46770
|
}
|
|
46712
|
-
function
|
|
46771
|
+
function findRealMutation(pattern, text) {
|
|
46713
46772
|
const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
|
|
46714
46773
|
let match;
|
|
46715
46774
|
while ((match = re.exec(text)) !== null) {
|
|
46716
|
-
|
|
46775
|
+
const start = match.index;
|
|
46776
|
+
const end = match.index + match[0].length;
|
|
46777
|
+
if (isRealMutationMatch(text, start, end)) return { start, end };
|
|
46717
46778
|
if (match.index === re.lastIndex) re.lastIndex++;
|
|
46718
46779
|
}
|
|
46719
|
-
return
|
|
46780
|
+
return null;
|
|
46720
46781
|
}
|
|
46721
46782
|
function detectGitMutation(message) {
|
|
46722
46783
|
const re = /\bgit\s+([a-z][a-z0-9-]*)/gi;
|
|
46723
46784
|
let match;
|
|
46724
46785
|
while ((match = re.exec(message)) !== null) {
|
|
46725
46786
|
const sub = match[1].toLowerCase();
|
|
46726
|
-
const
|
|
46787
|
+
const span = { start: match.index, end: match.index + match[0].length };
|
|
46788
|
+
const isReal = () => isRealMutationMatch(message, span.start, span.end);
|
|
46727
46789
|
if (GIT_MUTATION_SUBCOMMANDS.has(sub)) {
|
|
46728
|
-
if (isReal()) return
|
|
46790
|
+
if (isReal()) return span;
|
|
46729
46791
|
continue;
|
|
46730
46792
|
}
|
|
46731
46793
|
if (sub === "stash") {
|
|
46732
46794
|
const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
|
|
46733
46795
|
const next = after ? after[1].toLowerCase() : "";
|
|
46734
|
-
if (!GIT_STASH_READONLY_SUBCOMMANDS.has(next) && isReal()) return
|
|
46796
|
+
if (!GIT_STASH_READONLY_SUBCOMMANDS.has(next) && isReal()) return span;
|
|
46735
46797
|
} else if (sub === "checkout") {
|
|
46736
|
-
if (isReal()) return
|
|
46798
|
+
if (isReal()) return span;
|
|
46737
46799
|
} else if (sub === "submodule") {
|
|
46738
46800
|
const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
|
|
46739
46801
|
const next = after ? after[1].toLowerCase() : "";
|
|
46740
|
-
if ((next === "update" || next === "add" || next === "sync" || next === "deinit") && isReal())
|
|
46802
|
+
if ((next === "update" || next === "add" || next === "sync" || next === "deinit") && isReal()) {
|
|
46803
|
+
return { start: span.start, end: re.lastIndex + after[0].length };
|
|
46804
|
+
}
|
|
46741
46805
|
} else if (sub === "worktree") {
|
|
46742
46806
|
const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
|
|
46743
46807
|
const next = after ? after[1].toLowerCase() : "";
|
|
46744
|
-
if ((next === "add" || next === "remove" || next === "move" || next === "prune") && isReal())
|
|
46808
|
+
if ((next === "add" || next === "remove" || next === "move" || next === "prune") && isReal()) {
|
|
46809
|
+
return { start: span.start, end: re.lastIndex + after[0].length };
|
|
46810
|
+
}
|
|
46745
46811
|
}
|
|
46746
46812
|
}
|
|
46747
|
-
return
|
|
46813
|
+
return null;
|
|
46748
46814
|
}
|
|
46749
46815
|
function normalizeMeshTaskMode(value) {
|
|
46750
46816
|
if (typeof value !== "string") return void 0;
|
|
@@ -46758,14 +46824,21 @@ Next step: ${nextStep}`;
|
|
|
46758
46824
|
return taskMode ? { valid: true, taskMode, violations: [] } : { valid: true, violations: [] };
|
|
46759
46825
|
}
|
|
46760
46826
|
const text = message || "";
|
|
46761
|
-
const
|
|
46762
|
-
|
|
46763
|
-
|
|
46827
|
+
const violationDetails = [];
|
|
46828
|
+
for (const rule of LIVE_DEBUG_READONLY_FORBIDDEN) {
|
|
46829
|
+
const hit = findRealMutation(rule.pattern, text);
|
|
46830
|
+
if (hit) violationDetails.push(buildViolationDetail(rule.label, text, hit.start, hit.end));
|
|
46831
|
+
}
|
|
46832
|
+
const gitHit = detectGitMutation(text);
|
|
46833
|
+
if (gitHit) {
|
|
46834
|
+
violationDetails.push(buildViolationDetail("git_mutation", text, gitHit.start, gitHit.end));
|
|
46764
46835
|
}
|
|
46836
|
+
const violations = violationDetails.map((d) => d.label);
|
|
46765
46837
|
return {
|
|
46766
46838
|
valid: violations.length === 0,
|
|
46767
46839
|
taskMode,
|
|
46768
46840
|
violations,
|
|
46841
|
+
...violationDetails.length ? { violationDetails } : {},
|
|
46769
46842
|
allowedOperations: [
|
|
46770
46843
|
"process/log/window/port/session inspection",
|
|
46771
46844
|
"read-only filesystem listing/reading",
|
|
@@ -46901,7 +46974,7 @@ Next step: ${nextStep}`;
|
|
|
46901
46974
|
const readonly2 = opts?.readonly === true;
|
|
46902
46975
|
const modeValidation = validateMeshTaskModeRequest(opts?.taskMode, message, readonly2);
|
|
46903
46976
|
if (!modeValidation.valid) {
|
|
46904
|
-
throw new Error(
|
|
46977
|
+
throw new Error(buildMeshTaskModeViolationError(modeValidation));
|
|
46905
46978
|
}
|
|
46906
46979
|
const id = typeof opts?.id === "string" && opts.id.trim() ? opts.id.trim() : (0, import_crypto8.randomUUID)();
|
|
46907
46980
|
const dependsOn = normalizeDependsOn(opts?.dependsOn);
|
|
@@ -46984,7 +47057,7 @@ Next step: ${nextStep}`;
|
|
|
46984
47057
|
const readonly2 = opts.readonly === true;
|
|
46985
47058
|
const modeValidation = validateMeshTaskModeRequest(opts.taskMode, message, readonly2);
|
|
46986
47059
|
if (!modeValidation.valid) {
|
|
46987
|
-
throw new Error(
|
|
47060
|
+
throw new Error(buildMeshTaskModeViolationError(modeValidation));
|
|
46988
47061
|
}
|
|
46989
47062
|
const now = opts.dispatchedAt && opts.dispatchedAt.trim() ? opts.dispatchedAt : (/* @__PURE__ */ new Date()).toISOString();
|
|
46990
47063
|
return withQueueLock(meshId, () => {
|
|
@@ -47412,9 +47485,12 @@ Next step: ${nextStep}`;
|
|
|
47412
47485
|
var MESH_TASK_MODES;
|
|
47413
47486
|
var MESH_TASK_PRIORITIES;
|
|
47414
47487
|
var NOT_BEFORE_RELATIVE_THRESHOLD_MS;
|
|
47488
|
+
var MAX_REPORTED_MATCH_LEN;
|
|
47415
47489
|
var LIVE_DEBUG_READONLY_FORBIDDEN;
|
|
47416
47490
|
var NEGATION_CUES;
|
|
47417
47491
|
var NEGATION_WINDOW_TOKENS;
|
|
47492
|
+
var COMMAND_WRAPPERS;
|
|
47493
|
+
var EVIDENCE_ONLY_WRAPPERS;
|
|
47418
47494
|
var GIT_MUTATION_SUBCOMMANDS;
|
|
47419
47495
|
var GIT_STASH_READONLY_SUBCOMMANDS;
|
|
47420
47496
|
var DEPENDENCY_FAILURE_TERMINALS;
|
|
@@ -47442,6 +47518,7 @@ Next step: ${nextStep}`;
|
|
|
47442
47518
|
MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
47443
47519
|
MESH_TASK_PRIORITIES = ["low", "normal", "high"];
|
|
47444
47520
|
NOT_BEFORE_RELATIVE_THRESHOLD_MS = 365 * 24 * 60 * 60 * 1e3;
|
|
47521
|
+
MAX_REPORTED_MATCH_LEN = 40;
|
|
47445
47522
|
LIVE_DEBUG_READONLY_FORBIDDEN = [
|
|
47446
47523
|
{ label: "source_edit", pattern: /\b(edit|modify|patch|apply\s+patch|write\s+(?:to\s+)?(?:file|source)|overwrite|delete\s+file|remove\s+file|create\s+file|touch\s+file)\b/i },
|
|
47447
47524
|
{ label: "checkpoint", pattern: /\b(checkpoint|mesh_checkpoint)\b/i },
|
|
@@ -47467,6 +47544,8 @@ Next step: ${nextStep}`;
|
|
|
47467
47544
|
"\uC54A"
|
|
47468
47545
|
];
|
|
47469
47546
|
NEGATION_WINDOW_TOKENS = 6;
|
|
47547
|
+
COMMAND_WRAPPERS = /* @__PURE__ */ new Set(["xargs", "sudo", "doas", "nohup", "sh", "bash", "zsh"]);
|
|
47548
|
+
EVIDENCE_ONLY_WRAPPERS = /* @__PURE__ */ new Set(["time", "command", "env", "nice", "exec", "builtin", "timeout"]);
|
|
47470
47549
|
GIT_MUTATION_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
47471
47550
|
"add",
|
|
47472
47551
|
"commit",
|
|
@@ -60203,12 +60282,19 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
60203
60282
|
kind: "dispatch_failed",
|
|
60204
60283
|
nodeId: ctx.nodeId,
|
|
60205
60284
|
sessionId: ctx.sessionId,
|
|
60206
|
-
payload: { taskId: ctx.task.id, deliveryId: delivery.id, error: e?.message, retryable:
|
|
60285
|
+
payload: { taskId: ctx.task.id, deliveryId: delivery.id, error: e?.message, retryable: isRetryableDispatchFailure(e), transport: ctx.transport }
|
|
60207
60286
|
});
|
|
60208
60287
|
} catch {
|
|
60209
60288
|
}
|
|
60210
60289
|
});
|
|
60211
60290
|
}
|
|
60291
|
+
function isRetryableDispatchFailure(e) {
|
|
60292
|
+
if (e && typeof e === "object") {
|
|
60293
|
+
if (e.retryRecommended === false) return false;
|
|
60294
|
+
if (e.recoverable === false) return false;
|
|
60295
|
+
}
|
|
60296
|
+
return true;
|
|
60297
|
+
}
|
|
60212
60298
|
function resolveClaimingSessionTranscriptProfile(components, sessionId) {
|
|
60213
60299
|
try {
|
|
60214
60300
|
const instances = components.instanceManager?.getByCategory?.("cli") || [];
|
|
@@ -60352,7 +60438,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
60352
60438
|
const silentIdlePushOnDispatch = resolveCoordinatorIdlePushPolicy(mesh?.policy) === "auto_silent_on_dispatch";
|
|
60353
60439
|
const remoteDaemonId = readMeshNodeDaemonId(node ?? {});
|
|
60354
60440
|
if (remoteDaemonId && components.dispatchMeshCommand) {
|
|
60355
|
-
const isLocalNode = components.cliManager.adapters.has(sessionId);
|
|
60441
|
+
const isLocalNode = isLocalAutoLaunchNode(node) || components.cliManager.adapters.has(sessionId);
|
|
60356
60442
|
if (!isLocalNode) {
|
|
60357
60443
|
const localDaemonIdForDispatch = localCoordinatorDaemonId();
|
|
60358
60444
|
const sourceCoordinatorSessionId = readNonEmptyString(task.sourceCoordinatorSessionId) || void 0;
|
|
@@ -77320,6 +77406,7 @@ ${lastSnapshot}`;
|
|
|
77320
77406
|
buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
|
|
77321
77407
|
buildMeshNodeProbeFreshness: () => buildMeshNodeProbeFreshness,
|
|
77322
77408
|
buildMeshSchedulingRuntime: () => buildMeshSchedulingRuntime,
|
|
77409
|
+
buildMeshTaskModeViolationError: () => buildMeshTaskModeViolationError,
|
|
77323
77410
|
buildMissionPromptSection: () => buildMissionPromptSection,
|
|
77324
77411
|
buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
|
|
77325
77412
|
buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
|
|
@@ -77400,6 +77487,7 @@ ${lastSnapshot}`;
|
|
|
77400
77487
|
flattenMessageParts: () => flattenMessageParts,
|
|
77401
77488
|
foldUsageRecords: () => foldUsageRecords,
|
|
77402
77489
|
formatManifestValidationIssues: () => formatManifestValidationIssues,
|
|
77490
|
+
formatMeshTaskModeViolations: () => formatMeshTaskModeViolations,
|
|
77403
77491
|
forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance2,
|
|
77404
77492
|
getAIExtensions: () => getAIExtensions,
|
|
77405
77493
|
getActiveDirectDispatches: () => getActiveDirectDispatches,
|