@adhdev/daemon-core 0.9.76-rc.55 → 0.9.76-rc.57

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.mjs CHANGED
@@ -666,7 +666,7 @@ function buildRulesSection(coordinatorCliType) {
666
666
  - **Respect explicit provider requests.** If the user names an agent/provider, pass the matching provider type to \`mesh_launch_session\`: Hermes \u2192 \`hermes-cli\`, Claude Code/Claude \u2192 \`claude-cli\`, Codex \u2192 \`codex-cli\`, Gemini \u2192 \`gemini-cli\`. Never substitute \`claude-cli\` just because the coordinator itself is Claude Code.
667
667
  - **Front-load the task message.** When calling \`mesh_send_task\`, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
668
668
  - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
669
- - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
669
+ - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed. Never launch a duplicate session or second worker solely because \`mesh_read_chat\` has no final assistant message while the delegated session is still showing tool/terminal activity.
670
670
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
671
671
  - **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
672
672
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
@@ -702,8 +702,8 @@ var init_coordinator_prompt = __esm({
702
702
  b. If you need branch isolation for parallel work, call \`mesh_clone_node\` to create a worktree node first.
703
703
  c. If no session exists, call \`mesh_launch_session\` to start one.
704
704
  d. Call \`mesh_send_task\` with a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
705
- 4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
706
- 5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
705
+ 4. **Monitor** \u2014 Prefer event-driven completion/status notifications. Do **not** poll \`mesh_read_chat\` repeatedly just because the delegated session has not produced a final assistant message yet; tool/terminal activity means work may still be in progress. Use at most one compact \`mesh_read_chat\` check after a completion/approval signal, an explicit user status request, or a real timeout/stall. Handle approvals via \`mesh_approve\`.
706
+ 5. **Verify** \u2014 When a task reports completion or git work is visible, call \`mesh_git_status\` to verify changes were made.
707
707
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
708
708
  7. **Clean up** \u2014 Remove worktree nodes via \`mesh_remove_node\` after their work is merged or no longer needed.
709
709
  8. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
@@ -7960,21 +7960,31 @@ function readMessageMeta(message) {
7960
7960
  const meta = message?.meta;
7961
7961
  return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : null;
7962
7962
  }
7963
- function isExplicitlyHiddenFromTranscript(meta) {
7964
- if (!meta) return false;
7965
- const visibility = typeof meta.transcriptVisibility === "string" ? meta.transcriptVisibility.trim().toLowerCase() : "";
7966
- return visibility === "hidden" || visibility === "debug" || meta.internal === true || meta.debug === true || meta.statusOnly === true || meta.controlOnly === true;
7963
+ function readStringField(value) {
7964
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
7967
7965
  }
7968
- function isExplicitlyVisibleInTranscript(meta) {
7969
- if (!meta) return false;
7970
- const visibility = typeof meta.transcriptVisibility === "string" ? meta.transcriptVisibility.trim().toLowerCase() : "";
7971
- return visibility === "visible" || meta.userFacing === true;
7966
+ function readVisibilityField(message, meta) {
7967
+ const record = message;
7968
+ return readStringField(record.visibility ?? record.transcriptVisibility ?? meta?.visibility ?? meta?.transcriptVisibility);
7969
+ }
7970
+ function isExplicitlyHiddenFromTranscript(message, meta) {
7971
+ const record = message;
7972
+ const visibility = readVisibilityField(message, meta);
7973
+ const audience = readStringField(record.audience ?? meta?.audience);
7974
+ const source = readStringField(record.source ?? meta?.source);
7975
+ return visibility === "hidden" || visibility === "debug" || visibility === "internal" || audience === "debug" || audience === "trace" || audience === "internal" || source === "runtime_status" || source === "runtime_activity" || source === "provider_chrome" || source === "control" || record.internal === true || record.isInternal === true || record.debug === true || meta?.internal === true || meta?.isInternal === true || meta?.debug === true || meta?.statusOnly === true || meta?.controlOnly === true;
7976
+ }
7977
+ function isExplicitlyVisibleInTranscript(message, meta) {
7978
+ const record = message;
7979
+ const visibility = readVisibilityField(message, meta);
7980
+ const audience = readStringField(record.audience ?? meta?.audience);
7981
+ return visibility === "visible" || visibility === "user" || visibility === "chat" || audience === "chat" || record.userFacing === true || meta?.userFacing === true;
7972
7982
  }
7973
7983
  function isUserFacingChatMessage(message) {
7974
7984
  if (!message) return false;
7975
7985
  const meta = readMessageMeta(message);
7976
- if (isExplicitlyHiddenFromTranscript(meta)) return false;
7977
- if (isExplicitlyVisibleInTranscript(meta)) return true;
7986
+ if (isExplicitlyHiddenFromTranscript(message, meta)) return false;
7987
+ if (isExplicitlyVisibleInTranscript(message, meta)) return true;
7978
7988
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
7979
7989
  const kind = resolveChatMessageKind(message);
7980
7990
  if (role === "user" || role === "human") return kind === "standard" || kind === "";
@@ -9956,6 +9966,14 @@ function validateMessage(message, source, index) {
9956
9966
  if (typeof message.senderName === "string") normalized.senderName = message.senderName;
9957
9967
  if (typeof message._type === "string") normalized._type = message._type;
9958
9968
  if (typeof message._sub === "string") normalized._sub = message._sub;
9969
+ if (typeof message.visibility === "string") normalized.visibility = message.visibility;
9970
+ if (typeof message.transcriptVisibility === "string") normalized.transcriptVisibility = message.transcriptVisibility;
9971
+ if (typeof message.audience === "string") normalized.audience = message.audience;
9972
+ if (typeof message.source === "string") normalized.source = message.source;
9973
+ if (typeof message.userFacing === "boolean") normalized.userFacing = message.userFacing;
9974
+ if (typeof message.internal === "boolean") normalized.internal = message.internal;
9975
+ if (typeof message.isInternal === "boolean") normalized.isInternal = message.isInternal;
9976
+ if (typeof message.debug === "boolean") normalized.debug = message.debug;
9959
9977
  return normalized;
9960
9978
  }
9961
9979
  function validateModal(activeModal, status, source) {
@@ -11960,19 +11978,19 @@ function buildReadChatCommandResult(payload, args) {
11960
11978
  const visibleMessages = filterUserFacingChatMessages(messages);
11961
11979
  const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
11962
11980
  const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
11963
- const nextDebugReadChat = {
11964
- ...debugReadChat || {},
11965
- fullMsgCount: messages.length,
11981
+ const returnedDebugReadChat = debugReadChat ? {
11982
+ ...debugReadChat,
11983
+ fullMsgCount: typeof debugReadChat.fullMsgCount === "number" ? debugReadChat.fullMsgCount : messages.length,
11966
11984
  visibleMsgCount: visibleMessages.length,
11967
11985
  hiddenMsgCount,
11968
11986
  returnedMsgCount: sync.messages.length
11969
- };
11987
+ } : void 0;
11970
11988
  return {
11971
11989
  success: true,
11972
11990
  ...validatedPayload,
11973
11991
  messages: sync.messages,
11974
11992
  totalMessages: sync.totalMessages,
11975
- debugReadChat: nextDebugReadChat
11993
+ ...returnedDebugReadChat ? { debugReadChat: returnedDebugReadChat } : {}
11976
11994
  };
11977
11995
  }
11978
11996
  var DEFAULT_DEBUG_SANITIZE_OPTIONS = {
@@ -15603,12 +15621,11 @@ ${effect.notification.body || ""}`.trim();
15603
15621
  return Number.isFinite(value) && value > 0 ? value : 0;
15604
15622
  };
15605
15623
  const getRole = (message) => typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
15606
- const isAutoApprovalRuntimeOverlay = (entry) => {
15624
+ const isRuntimeOverlay = (entry) => {
15607
15625
  if (entry.source !== "runtime") return false;
15608
15626
  const key = typeof entry.runtimeKey === "string" ? entry.runtimeKey.trim().toLowerCase() : "";
15609
15627
  if (key.startsWith("auto_approval:")) return true;
15610
- const content = typeof entry.message.content === "string" ? entry.message.content.trim().toLowerCase() : flattenContent(entry.message.content).trim().toLowerCase();
15611
- return content.startsWith("auto-approved:");
15628
+ return !isUserFacingChatMessage(entry.message);
15612
15629
  };
15613
15630
  const shouldKeepParsedBeforeUntimedRuntime = (message) => {
15614
15631
  const role = getRole(message);
@@ -15627,7 +15644,7 @@ ${effect.notification.body || ""}`.trim();
15627
15644
  if (a.source !== b.source && aTime !== bTime) {
15628
15645
  const parsedEntry = a.source === "parsed" ? a : b.source === "parsed" ? b : null;
15629
15646
  const runtimeEntry = a.source === "runtime" ? a : b.source === "runtime" ? b : null;
15630
- if (parsedEntry && runtimeEntry && isAutoApprovalRuntimeOverlay(runtimeEntry) && getTime(parsedEntry.message) === 0 && getTime(runtimeEntry.message) > 0) {
15647
+ if (parsedEntry && runtimeEntry && isRuntimeOverlay(runtimeEntry) && getTime(parsedEntry.message) === 0 && getTime(runtimeEntry.message) > 0) {
15631
15648
  if (shouldKeepParsedBeforeUntimedRuntime(parsedEntry.message)) {
15632
15649
  return a.source === "parsed" ? -1 : 1;
15633
15650
  }