@adhdev/daemon-standalone 1.0.39 → 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
@@ -31423,9 +31423,9 @@ var require_streamx = __commonJS({
31423
31423
  }
31424
31424
  });
31425
31425
 
31426
- // ../daemon-core/node_modules/b4a/index.js
31426
+ // ../../node_modules/tar-stream/node_modules/b4a/index.js
31427
31427
  var require_b4a2 = __commonJS({
31428
- "../daemon-core/node_modules/b4a/index.js"(exports2, module2) {
31428
+ "../../node_modules/tar-stream/node_modules/b4a/index.js"(exports2, module2) {
31429
31429
  "use strict";
31430
31430
  function isBuffer(value) {
31431
31431
  return Buffer.isBuffer(value) || value instanceof Uint8Array;
@@ -31581,9 +31581,9 @@ var require_b4a2 = __commonJS({
31581
31581
  }
31582
31582
  });
31583
31583
 
31584
- // ../daemon-core/node_modules/tar-stream/headers.js
31584
+ // ../../node_modules/tar-stream/headers.js
31585
31585
  var require_headers = __commonJS({
31586
- "../daemon-core/node_modules/tar-stream/headers.js"(exports2) {
31586
+ "../../node_modules/tar-stream/headers.js"(exports2) {
31587
31587
  "use strict";
31588
31588
  var b4a = require_b4a2();
31589
31589
  var ZEROS = "0000000000000000000";
@@ -31844,9 +31844,9 @@ var require_headers = __commonJS({
31844
31844
  }
31845
31845
  });
31846
31846
 
31847
- // ../daemon-core/node_modules/tar-stream/extract.js
31847
+ // ../../node_modules/tar-stream/extract.js
31848
31848
  var require_extract = __commonJS({
31849
- "../daemon-core/node_modules/tar-stream/extract.js"(exports2, module2) {
31849
+ "../../node_modules/tar-stream/extract.js"(exports2, module2) {
31850
31850
  "use strict";
31851
31851
  var { Writable, Readable, getStreamError } = require_streamx();
31852
31852
  var FIFO = require_fast_fifo();
@@ -32189,9 +32189,9 @@ var require_extract = __commonJS({
32189
32189
  }
32190
32190
  });
32191
32191
 
32192
- // ../daemon-core/node_modules/tar-stream/constants.js
32192
+ // ../../node_modules/tar-stream/constants.js
32193
32193
  var require_constants = __commonJS({
32194
- "../daemon-core/node_modules/tar-stream/constants.js"(exports2, module2) {
32194
+ "../../node_modules/tar-stream/constants.js"(exports2, module2) {
32195
32195
  "use strict";
32196
32196
  var constants = {
32197
32197
  // just for envs without fs
@@ -32210,9 +32210,9 @@ var require_constants = __commonJS({
32210
32210
  }
32211
32211
  });
32212
32212
 
32213
- // ../daemon-core/node_modules/tar-stream/pack.js
32213
+ // ../../node_modules/tar-stream/pack.js
32214
32214
  var require_pack = __commonJS({
32215
- "../daemon-core/node_modules/tar-stream/pack.js"(exports2, module2) {
32215
+ "../../node_modules/tar-stream/pack.js"(exports2, module2) {
32216
32216
  "use strict";
32217
32217
  var { Readable, Writable, getStreamError } = require_streamx();
32218
32218
  var b4a = require_b4a2();
@@ -32445,9 +32445,9 @@ var require_pack = __commonJS({
32445
32445
  }
32446
32446
  });
32447
32447
 
32448
- // ../daemon-core/node_modules/tar-stream/index.js
32448
+ // ../../node_modules/tar-stream/index.js
32449
32449
  var require_tar_stream = __commonJS({
32450
- "../daemon-core/node_modules/tar-stream/index.js"(exports2) {
32450
+ "../../node_modules/tar-stream/index.js"(exports2) {
32451
32451
  "use strict";
32452
32452
  exports2.extract = require_extract();
32453
32453
  exports2.pack = require_pack();
@@ -32690,9 +32690,9 @@ var require_pump = __commonJS({
32690
32690
  }
32691
32691
  });
32692
32692
 
32693
- // ../daemon-core/node_modules/tar-fs/index.js
32693
+ // ../../node_modules/tar-fs/index.js
32694
32694
  var require_tar_fs = __commonJS({
32695
- "../daemon-core/node_modules/tar-fs/index.js"(exports2) {
32695
+ "../../node_modules/tar-fs/index.js"(exports2) {
32696
32696
  "use strict";
32697
32697
  var tar = require_tar_stream();
32698
32698
  var pump = require_pump();
@@ -36266,11 +36266,22 @@ var require_dist3 = __commonJS({
36266
36266
  type: "object",
36267
36267
  additionalProperties: false,
36268
36268
  required: ["text"],
36269
+ // Every property normalizeOperatingNote() reads must appear here:
36270
+ // additionalProperties stays false (typo defence), so a field the
36271
+ // loader accepts but the schema omits makes a VALID config fail
36272
+ // validation. operating-notes-schema-loader-parity.test.ts pins the
36273
+ // two sets together. `noteId` is deliberately absent — it is threaded
36274
+ // from the ledger entry at launch and never declared in a repo file,
36275
+ // so the loader does not read it.
36269
36276
  properties: {
36270
36277
  text: { type: "string", minLength: 1 },
36271
36278
  category: { enum: ["provider_quirk", "pattern_to_avoid", "recovery_lesson"] },
36272
36279
  createdAt: { type: "string" },
36273
- sourceCoordinator: { type: "string" }
36280
+ sourceCoordinator: { type: "string" },
36281
+ pinned: { type: "boolean" },
36282
+ expiresAt: { type: "string" },
36283
+ supersedes: { type: "string" },
36284
+ subjectKey: { type: "string" }
36274
36285
  }
36275
36286
  }
36276
36287
  },
@@ -36528,10 +36539,10 @@ var require_dist3 = __commonJS({
36528
36539
  }
36529
36540
  function getDaemonBuildInfo() {
36530
36541
  if (cached2) return cached2;
36531
- const commit = readInjected(true ? "0e4e467b525e0c6d5df45dfd98a142d0cc6ea6d4" : void 0) ?? "unknown";
36532
- const commitShort = readInjected(true ? "0e4e467" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36533
- const version2 = readInjected(true ? "1.0.39" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36534
- const builtAt = readInjected(true ? "2026-08-08T05:44:22.295Z" : 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);
36535
36546
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36536
36547
  return cached2;
36537
36548
  }
@@ -37789,7 +37800,7 @@ var require_dist3 = __commonJS({
37789
37800
  }
37790
37801
  });
37791
37802
  function resolveBuildTrack(env2 = process.env) {
37792
- const injected = true ? "" : void 0;
37803
+ const injected = true ? "preview" : void 0;
37793
37804
  const stamped = typeof injected === "string" ? injected.trim() : "";
37794
37805
  const raw = (stamped || (env2[BUILD_CHANNEL_ENV_VAR] ?? "").trim()).toLowerCase();
37795
37806
  return raw === "preview" || raw === "next" ? "preview" : "stable";
@@ -46481,6 +46492,7 @@ Next step: ${nextStep}`;
46481
46492
  __resetMeshRuntimeStoreForTests: () => __resetMeshRuntimeStoreForTests,
46482
46493
  assertNoDependencyCycle: () => assertNoDependencyCycle,
46483
46494
  buildMeshNodeCapabilityTags: () => buildMeshNodeCapabilityTags,
46495
+ buildMeshTaskModeViolationError: () => buildMeshTaskModeViolationError,
46484
46496
  cancelTask: () => cancelTask,
46485
46497
  claimNextTask: () => claimNextTask,
46486
46498
  cleanupTerminalDirectDispatches: () => cleanupTerminalDirectDispatches,
@@ -46488,6 +46500,7 @@ Next step: ${nextStep}`;
46488
46500
  describeTaskDependencyState: () => describeTaskDependencyState,
46489
46501
  enqueueTask: () => enqueueTask,
46490
46502
  expireTaskTargetPin: () => expireTaskTargetPin,
46503
+ formatMeshTaskModeViolations: () => formatMeshTaskModeViolations,
46491
46504
  getActiveDirectDispatches: () => getActiveDirectDispatches,
46492
46505
  getMeshQueueRevision: () => getMeshQueueRevision,
46493
46506
  getMeshQueueStats: () => getMeshQueueStats,
@@ -46555,6 +46568,25 @@ Next step: ${nextStep}`;
46555
46568
  if (!task) return false;
46556
46569
  return task.readonly === true || task.taskMode === "live_debug_readonly";
46557
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
+ }
46558
46590
  function hasNegationBefore(text, matchIndex) {
46559
46591
  const before = text.slice(0, matchIndex);
46560
46592
  const clauseStart = Math.max(
@@ -46606,7 +46638,6 @@ Next step: ${nextStep}`;
46606
46638
  if (atCmdPos && /^(?:\.\/|\.\.\/|~\/|\/)/.test(tokenLead)) return true;
46607
46639
  if (/(?:&&|\|\||\||;)\s*$/.test(linePrefix)) return true;
46608
46640
  if (/(?:^|[\s,])(?:then|run|first)\s+$/i.test(linePrefix)) return true;
46609
- if (/,\s*$/.test(linePrefix)) return true;
46610
46641
  return false;
46611
46642
  }
46612
46643
  function isInsideBackticksOrFence(text, matchStart, matchEnd) {
@@ -46698,42 +46729,49 @@ Next step: ${nextStep}`;
46698
46729
  if (isInsideQuotedSpan(text, matchStart, matchEnd)) return false;
46699
46730
  return isMutationKeywordInCommandContext(text, matchStart, matchEnd);
46700
46731
  }
46701
- function patternHasRealMutation(pattern, text) {
46732
+ function findRealMutation(pattern, text) {
46702
46733
  const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
46703
46734
  let match;
46704
46735
  while ((match = re.exec(text)) !== null) {
46705
- 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 };
46706
46739
  if (match.index === re.lastIndex) re.lastIndex++;
46707
46740
  }
46708
- return false;
46741
+ return null;
46709
46742
  }
46710
46743
  function detectGitMutation(message) {
46711
46744
  const re = /\bgit\s+([a-z][a-z0-9-]*)/gi;
46712
46745
  let match;
46713
46746
  while ((match = re.exec(message)) !== null) {
46714
46747
  const sub = match[1].toLowerCase();
46715
- 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);
46716
46750
  if (GIT_MUTATION_SUBCOMMANDS.has(sub)) {
46717
- if (isReal()) return true;
46751
+ if (isReal()) return span;
46718
46752
  continue;
46719
46753
  }
46720
46754
  if (sub === "stash") {
46721
46755
  const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
46722
46756
  const next = after ? after[1].toLowerCase() : "";
46723
- if (!GIT_STASH_READONLY_SUBCOMMANDS.has(next) && isReal()) return true;
46757
+ if (!GIT_STASH_READONLY_SUBCOMMANDS.has(next) && isReal()) return span;
46724
46758
  } else if (sub === "checkout") {
46725
- if (isReal()) return true;
46759
+ if (isReal()) return span;
46726
46760
  } else if (sub === "submodule") {
46727
46761
  const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
46728
46762
  const next = after ? after[1].toLowerCase() : "";
46729
- 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
+ }
46730
46766
  } else if (sub === "worktree") {
46731
46767
  const after = message.slice(re.lastIndex).match(/^\s+([a-z][a-z0-9-]*)/i);
46732
46768
  const next = after ? after[1].toLowerCase() : "";
46733
- 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
+ }
46734
46772
  }
46735
46773
  }
46736
- return false;
46774
+ return null;
46737
46775
  }
46738
46776
  function normalizeMeshTaskMode(value) {
46739
46777
  if (typeof value !== "string") return void 0;
@@ -46747,14 +46785,21 @@ Next step: ${nextStep}`;
46747
46785
  return taskMode ? { valid: true, taskMode, violations: [] } : { valid: true, violations: [] };
46748
46786
  }
46749
46787
  const text = message || "";
46750
- const violations = LIVE_DEBUG_READONLY_FORBIDDEN.filter((rule) => patternHasRealMutation(rule.pattern, text)).map((rule) => rule.label);
46751
- if (detectGitMutation(text)) {
46752
- 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));
46753
46796
  }
46797
+ const violations = violationDetails.map((d) => d.label);
46754
46798
  return {
46755
46799
  valid: violations.length === 0,
46756
46800
  taskMode,
46757
46801
  violations,
46802
+ ...violationDetails.length ? { violationDetails } : {},
46758
46803
  allowedOperations: [
46759
46804
  "process/log/window/port/session inspection",
46760
46805
  "read-only filesystem listing/reading",
@@ -46890,7 +46935,7 @@ Next step: ${nextStep}`;
46890
46935
  const readonly2 = opts?.readonly === true;
46891
46936
  const modeValidation = validateMeshTaskModeRequest(opts?.taskMode, message, readonly2);
46892
46937
  if (!modeValidation.valid) {
46893
- throw new Error(`live_debug_readonly_guardrail_violation: forbidden operations (${modeValidation.violations.join(", ")})`);
46938
+ throw new Error(buildMeshTaskModeViolationError(modeValidation));
46894
46939
  }
46895
46940
  const id = typeof opts?.id === "string" && opts.id.trim() ? opts.id.trim() : (0, import_crypto8.randomUUID)();
46896
46941
  const dependsOn = normalizeDependsOn(opts?.dependsOn);
@@ -46973,7 +47018,7 @@ Next step: ${nextStep}`;
46973
47018
  const readonly2 = opts.readonly === true;
46974
47019
  const modeValidation = validateMeshTaskModeRequest(opts.taskMode, message, readonly2);
46975
47020
  if (!modeValidation.valid) {
46976
- throw new Error(`live_debug_readonly_guardrail_violation: forbidden operations (${modeValidation.violations.join(", ")})`);
47021
+ throw new Error(buildMeshTaskModeViolationError(modeValidation));
46977
47022
  }
46978
47023
  const now = opts.dispatchedAt && opts.dispatchedAt.trim() ? opts.dispatchedAt : (/* @__PURE__ */ new Date()).toISOString();
46979
47024
  return withQueueLock(meshId, () => {
@@ -47401,6 +47446,7 @@ Next step: ${nextStep}`;
47401
47446
  var MESH_TASK_MODES;
47402
47447
  var MESH_TASK_PRIORITIES;
47403
47448
  var NOT_BEFORE_RELATIVE_THRESHOLD_MS;
47449
+ var MAX_REPORTED_MATCH_LEN;
47404
47450
  var LIVE_DEBUG_READONLY_FORBIDDEN;
47405
47451
  var NEGATION_CUES;
47406
47452
  var NEGATION_WINDOW_TOKENS;
@@ -47431,6 +47477,7 @@ Next step: ${nextStep}`;
47431
47477
  MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
47432
47478
  MESH_TASK_PRIORITIES = ["low", "normal", "high"];
47433
47479
  NOT_BEFORE_RELATIVE_THRESHOLD_MS = 365 * 24 * 60 * 60 * 1e3;
47480
+ MAX_REPORTED_MATCH_LEN = 40;
47434
47481
  LIVE_DEBUG_READONLY_FORBIDDEN = [
47435
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 },
47436
47483
  { label: "checkpoint", pattern: /\b(checkpoint|mesh_checkpoint)\b/i },
@@ -60192,12 +60239,19 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
60192
60239
  kind: "dispatch_failed",
60193
60240
  nodeId: ctx.nodeId,
60194
60241
  sessionId: ctx.sessionId,
60195
- 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 }
60196
60243
  });
60197
60244
  } catch {
60198
60245
  }
60199
60246
  });
60200
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
+ }
60201
60255
  function resolveClaimingSessionTranscriptProfile(components, sessionId) {
60202
60256
  try {
60203
60257
  const instances = components.instanceManager?.getByCategory?.("cli") || [];
@@ -60341,7 +60395,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
60341
60395
  const silentIdlePushOnDispatch = resolveCoordinatorIdlePushPolicy(mesh?.policy) === "auto_silent_on_dispatch";
60342
60396
  const remoteDaemonId = readMeshNodeDaemonId(node ?? {});
60343
60397
  if (remoteDaemonId && components.dispatchMeshCommand) {
60344
- const isLocalNode = components.cliManager.adapters.has(sessionId);
60398
+ const isLocalNode = isLocalAutoLaunchNode(node) || components.cliManager.adapters.has(sessionId);
60345
60399
  if (!isLocalNode) {
60346
60400
  const localDaemonIdForDispatch = localCoordinatorDaemonId();
60347
60401
  const sourceCoordinatorSessionId = readNonEmptyString(task.sourceCoordinatorSessionId) || void 0;
@@ -77309,6 +77363,7 @@ ${lastSnapshot}`;
77309
77363
  buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
77310
77364
  buildMeshNodeProbeFreshness: () => buildMeshNodeProbeFreshness,
77311
77365
  buildMeshSchedulingRuntime: () => buildMeshSchedulingRuntime,
77366
+ buildMeshTaskModeViolationError: () => buildMeshTaskModeViolationError,
77312
77367
  buildMissionPromptSection: () => buildMissionPromptSection,
77313
77368
  buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
77314
77369
  buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
@@ -77389,6 +77444,7 @@ ${lastSnapshot}`;
77389
77444
  flattenMessageParts: () => flattenMessageParts,
77390
77445
  foldUsageRecords: () => foldUsageRecords,
77391
77446
  formatManifestValidationIssues: () => formatManifestValidationIssues,
77447
+ formatMeshTaskModeViolations: () => formatMeshTaskModeViolations,
77392
77448
  forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance2,
77393
77449
  getAIExtensions: () => getAIExtensions,
77394
77450
  getActiveDirectDispatches: () => getActiveDirectDispatches,