@adhdev/daemon-standalone 1.0.40-rc.1 → 1.0.40-rc.2

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
@@ -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 ? "3ac178c61e7ae403ba195b41bed9032cbf510ae6" : void 0) ?? "unknown";
36543
- const commitShort = readInjected(true ? "3ac178c6" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36544
- const version2 = readInjected(true ? "1.0.40-rc.1" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36545
- const builtAt = readInjected(true ? "2026-08-08T08:20:29.989Z" : void 0);
36542
+ const commit = readInjected(true ? "704ffa280ca33888df2c36135765e1967ede82f1" : void 0) ?? "unknown";
36543
+ const commitShort = readInjected(true ? "704ffa28" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36544
+ const version2 = readInjected(true ? "1.0.40-rc.2" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36545
+ const builtAt = readInjected(true ? "2026-08-08T09:09:44.240Z" : 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(
@@ -46617,7 +46638,6 @@ Next step: ${nextStep}`;
46617
46638
  if (atCmdPos && /^(?:\.\/|\.\.\/|~\/|\/)/.test(tokenLead)) return true;
46618
46639
  if (/(?:&&|\|\||\||;)\s*$/.test(linePrefix)) return true;
46619
46640
  if (/(?:^|[\s,])(?:then|run|first)\s+$/i.test(linePrefix)) return true;
46620
- if (/,\s*$/.test(linePrefix)) return true;
46621
46641
  return false;
46622
46642
  }
46623
46643
  function isInsideBackticksOrFence(text, matchStart, matchEnd) {
@@ -46709,42 +46729,49 @@ Next step: ${nextStep}`;
46709
46729
  if (isInsideQuotedSpan(text, matchStart, matchEnd)) return false;
46710
46730
  return isMutationKeywordInCommandContext(text, matchStart, matchEnd);
46711
46731
  }
46712
- function patternHasRealMutation(pattern, text) {
46732
+ function findRealMutation(pattern, text) {
46713
46733
  const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
46714
46734
  let match;
46715
46735
  while ((match = re.exec(text)) !== null) {
46716
- if (isRealMutationMatch(text, match.index, match.index + match[0].length)) return true;
46736
+ const start = match.index;
46737
+ const end = match.index + match[0].length;
46738
+ if (isRealMutationMatch(text, start, end)) return { start, end };
46717
46739
  if (match.index === re.lastIndex) re.lastIndex++;
46718
46740
  }
46719
- return false;
46741
+ return null;
46720
46742
  }
46721
46743
  function detectGitMutation(message) {
46722
46744
  const re = /\bgit\s+([a-z][a-z0-9-]*)/gi;
46723
46745
  let match;
46724
46746
  while ((match = re.exec(message)) !== null) {
46725
46747
  const sub = match[1].toLowerCase();
46726
- const isReal = () => isRealMutationMatch(message, match.index, match.index + match[0].length);
46748
+ const span = { start: match.index, end: match.index + match[0].length };
46749
+ const isReal = () => isRealMutationMatch(message, span.start, span.end);
46727
46750
  if (GIT_MUTATION_SUBCOMMANDS.has(sub)) {
46728
- if (isReal()) return true;
46751
+ if (isReal()) return span;
46729
46752
  continue;
46730
46753
  }
46731
46754
  if (sub === "stash") {
46732
46755
  const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
46733
46756
  const next = after ? after[1].toLowerCase() : "";
46734
- if (!GIT_STASH_READONLY_SUBCOMMANDS.has(next) && isReal()) return true;
46757
+ if (!GIT_STASH_READONLY_SUBCOMMANDS.has(next) && isReal()) return span;
46735
46758
  } else if (sub === "checkout") {
46736
- if (isReal()) return true;
46759
+ if (isReal()) return span;
46737
46760
  } else if (sub === "submodule") {
46738
46761
  const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
46739
46762
  const next = after ? after[1].toLowerCase() : "";
46740
- if ((next === "update" || next === "add" || next === "sync" || next === "deinit") && isReal()) return true;
46763
+ if ((next === "update" || next === "add" || next === "sync" || next === "deinit") && isReal()) {
46764
+ return { start: span.start, end: re.lastIndex + after[0].length };
46765
+ }
46741
46766
  } else if (sub === "worktree") {
46742
46767
  const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
46743
46768
  const next = after ? after[1].toLowerCase() : "";
46744
- if ((next === "add" || next === "remove" || next === "move" || next === "prune") && isReal()) return true;
46769
+ if ((next === "add" || next === "remove" || next === "move" || next === "prune") && isReal()) {
46770
+ return { start: span.start, end: re.lastIndex + after[0].length };
46771
+ }
46745
46772
  }
46746
46773
  }
46747
- return false;
46774
+ return null;
46748
46775
  }
46749
46776
  function normalizeMeshTaskMode(value) {
46750
46777
  if (typeof value !== "string") return void 0;
@@ -46758,14 +46785,21 @@ Next step: ${nextStep}`;
46758
46785
  return taskMode ? { valid: true, taskMode, violations: [] } : { valid: true, violations: [] };
46759
46786
  }
46760
46787
  const text = message || "";
46761
- const violations = LIVE_DEBUG_READONLY_FORBIDDEN.filter((rule) => patternHasRealMutation(rule.pattern, text)).map((rule) => rule.label);
46762
- if (detectGitMutation(text)) {
46763
- violations.push("git_mutation");
46788
+ const violationDetails = [];
46789
+ for (const rule of LIVE_DEBUG_READONLY_FORBIDDEN) {
46790
+ const hit = findRealMutation(rule.pattern, text);
46791
+ if (hit) violationDetails.push(buildViolationDetail(rule.label, text, hit.start, hit.end));
46792
+ }
46793
+ const gitHit = detectGitMutation(text);
46794
+ if (gitHit) {
46795
+ violationDetails.push(buildViolationDetail("git_mutation", text, gitHit.start, gitHit.end));
46764
46796
  }
46797
+ const violations = violationDetails.map((d) => d.label);
46765
46798
  return {
46766
46799
  valid: violations.length === 0,
46767
46800
  taskMode,
46768
46801
  violations,
46802
+ ...violationDetails.length ? { violationDetails } : {},
46769
46803
  allowedOperations: [
46770
46804
  "process/log/window/port/session inspection",
46771
46805
  "read-only filesystem listing/reading",
@@ -46901,7 +46935,7 @@ Next step: ${nextStep}`;
46901
46935
  const readonly2 = opts?.readonly === true;
46902
46936
  const modeValidation = validateMeshTaskModeRequest(opts?.taskMode, message, readonly2);
46903
46937
  if (!modeValidation.valid) {
46904
- throw new Error(`live_debug_readonly_guardrail_violation: forbidden operations (${modeValidation.violations.join(", ")})`);
46938
+ throw new Error(buildMeshTaskModeViolationError(modeValidation));
46905
46939
  }
46906
46940
  const id = typeof opts?.id === "string" && opts.id.trim() ? opts.id.trim() : (0, import_crypto8.randomUUID)();
46907
46941
  const dependsOn = normalizeDependsOn(opts?.dependsOn);
@@ -46984,7 +47018,7 @@ Next step: ${nextStep}`;
46984
47018
  const readonly2 = opts.readonly === true;
46985
47019
  const modeValidation = validateMeshTaskModeRequest(opts.taskMode, message, readonly2);
46986
47020
  if (!modeValidation.valid) {
46987
- throw new Error(`live_debug_readonly_guardrail_violation: forbidden operations (${modeValidation.violations.join(", ")})`);
47021
+ throw new Error(buildMeshTaskModeViolationError(modeValidation));
46988
47022
  }
46989
47023
  const now = opts.dispatchedAt && opts.dispatchedAt.trim() ? opts.dispatchedAt : (/* @__PURE__ */ new Date()).toISOString();
46990
47024
  return withQueueLock(meshId, () => {
@@ -47412,6 +47446,7 @@ Next step: ${nextStep}`;
47412
47446
  var MESH_TASK_MODES;
47413
47447
  var MESH_TASK_PRIORITIES;
47414
47448
  var NOT_BEFORE_RELATIVE_THRESHOLD_MS;
47449
+ var MAX_REPORTED_MATCH_LEN;
47415
47450
  var LIVE_DEBUG_READONLY_FORBIDDEN;
47416
47451
  var NEGATION_CUES;
47417
47452
  var NEGATION_WINDOW_TOKENS;
@@ -47442,6 +47477,7 @@ Next step: ${nextStep}`;
47442
47477
  MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
47443
47478
  MESH_TASK_PRIORITIES = ["low", "normal", "high"];
47444
47479
  NOT_BEFORE_RELATIVE_THRESHOLD_MS = 365 * 24 * 60 * 60 * 1e3;
47480
+ MAX_REPORTED_MATCH_LEN = 40;
47445
47481
  LIVE_DEBUG_READONLY_FORBIDDEN = [
47446
47482
  { 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
47483
  { label: "checkpoint", pattern: /\b(checkpoint|mesh_checkpoint)\b/i },
@@ -60203,12 +60239,19 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
60203
60239
  kind: "dispatch_failed",
60204
60240
  nodeId: ctx.nodeId,
60205
60241
  sessionId: ctx.sessionId,
60206
- payload: { taskId: ctx.task.id, deliveryId: delivery.id, error: e?.message, retryable: true, transport: ctx.transport }
60242
+ payload: { taskId: ctx.task.id, deliveryId: delivery.id, error: e?.message, retryable: isRetryableDispatchFailure(e), transport: ctx.transport }
60207
60243
  });
60208
60244
  } catch {
60209
60245
  }
60210
60246
  });
60211
60247
  }
60248
+ function isRetryableDispatchFailure(e) {
60249
+ if (e && typeof e === "object") {
60250
+ if (e.retryRecommended === false) return false;
60251
+ if (e.recoverable === false) return false;
60252
+ }
60253
+ return true;
60254
+ }
60212
60255
  function resolveClaimingSessionTranscriptProfile(components, sessionId) {
60213
60256
  try {
60214
60257
  const instances = components.instanceManager?.getByCategory?.("cli") || [];
@@ -60352,7 +60395,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
60352
60395
  const silentIdlePushOnDispatch = resolveCoordinatorIdlePushPolicy(mesh?.policy) === "auto_silent_on_dispatch";
60353
60396
  const remoteDaemonId = readMeshNodeDaemonId(node ?? {});
60354
60397
  if (remoteDaemonId && components.dispatchMeshCommand) {
60355
- const isLocalNode = components.cliManager.adapters.has(sessionId);
60398
+ const isLocalNode = isLocalAutoLaunchNode(node) || components.cliManager.adapters.has(sessionId);
60356
60399
  if (!isLocalNode) {
60357
60400
  const localDaemonIdForDispatch = localCoordinatorDaemonId();
60358
60401
  const sourceCoordinatorSessionId = readNonEmptyString(task.sourceCoordinatorSessionId) || void 0;
@@ -77320,6 +77363,7 @@ ${lastSnapshot}`;
77320
77363
  buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
77321
77364
  buildMeshNodeProbeFreshness: () => buildMeshNodeProbeFreshness,
77322
77365
  buildMeshSchedulingRuntime: () => buildMeshSchedulingRuntime,
77366
+ buildMeshTaskModeViolationError: () => buildMeshTaskModeViolationError,
77323
77367
  buildMissionPromptSection: () => buildMissionPromptSection,
77324
77368
  buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
77325
77369
  buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
@@ -77400,6 +77444,7 @@ ${lastSnapshot}`;
77400
77444
  flattenMessageParts: () => flattenMessageParts,
77401
77445
  foldUsageRecords: () => foldUsageRecords,
77402
77446
  formatManifestValidationIssues: () => formatManifestValidationIssues,
77447
+ formatMeshTaskModeViolations: () => formatMeshTaskModeViolations,
77403
77448
  forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance2,
77404
77449
  getAIExtensions: () => getAIExtensions,
77405
77450
  getActiveDirectDispatches: () => getActiveDirectDispatches,