@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.js CHANGED
@@ -671,7 +671,7 @@ function buildRulesSection(coordinatorCliType) {
671
671
  - **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.
672
672
  - **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.
673
673
  - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
674
- - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
674
+ - **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.
675
675
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
676
676
  - **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
677
677
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
@@ -707,8 +707,8 @@ var init_coordinator_prompt = __esm({
707
707
  b. If you need branch isolation for parallel work, call \`mesh_clone_node\` to create a worktree node first.
708
708
  c. If no session exists, call \`mesh_launch_session\` to start one.
709
709
  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.
710
- 4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
711
- 5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
710
+ 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\`.
711
+ 5. **Verify** \u2014 When a task reports completion or git work is visible, call \`mesh_git_status\` to verify changes were made.
712
712
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
713
713
  7. **Clean up** \u2014 Remove worktree nodes via \`mesh_remove_node\` after their work is merged or no longer needed.
714
714
  8. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
@@ -8158,21 +8158,31 @@ function readMessageMeta(message) {
8158
8158
  const meta = message?.meta;
8159
8159
  return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : null;
8160
8160
  }
8161
- function isExplicitlyHiddenFromTranscript(meta) {
8162
- if (!meta) return false;
8163
- const visibility = typeof meta.transcriptVisibility === "string" ? meta.transcriptVisibility.trim().toLowerCase() : "";
8164
- return visibility === "hidden" || visibility === "debug" || meta.internal === true || meta.debug === true || meta.statusOnly === true || meta.controlOnly === true;
8161
+ function readStringField(value) {
8162
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
8165
8163
  }
8166
- function isExplicitlyVisibleInTranscript(meta) {
8167
- if (!meta) return false;
8168
- const visibility = typeof meta.transcriptVisibility === "string" ? meta.transcriptVisibility.trim().toLowerCase() : "";
8169
- return visibility === "visible" || meta.userFacing === true;
8164
+ function readVisibilityField(message, meta) {
8165
+ const record = message;
8166
+ return readStringField(record.visibility ?? record.transcriptVisibility ?? meta?.visibility ?? meta?.transcriptVisibility);
8167
+ }
8168
+ function isExplicitlyHiddenFromTranscript(message, meta) {
8169
+ const record = message;
8170
+ const visibility = readVisibilityField(message, meta);
8171
+ const audience = readStringField(record.audience ?? meta?.audience);
8172
+ const source = readStringField(record.source ?? meta?.source);
8173
+ 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;
8174
+ }
8175
+ function isExplicitlyVisibleInTranscript(message, meta) {
8176
+ const record = message;
8177
+ const visibility = readVisibilityField(message, meta);
8178
+ const audience = readStringField(record.audience ?? meta?.audience);
8179
+ return visibility === "visible" || visibility === "user" || visibility === "chat" || audience === "chat" || record.userFacing === true || meta?.userFacing === true;
8170
8180
  }
8171
8181
  function isUserFacingChatMessage(message) {
8172
8182
  if (!message) return false;
8173
8183
  const meta = readMessageMeta(message);
8174
- if (isExplicitlyHiddenFromTranscript(meta)) return false;
8175
- if (isExplicitlyVisibleInTranscript(meta)) return true;
8184
+ if (isExplicitlyHiddenFromTranscript(message, meta)) return false;
8185
+ if (isExplicitlyVisibleInTranscript(message, meta)) return true;
8176
8186
  const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
8177
8187
  const kind = resolveChatMessageKind(message);
8178
8188
  if (role === "user" || role === "human") return kind === "standard" || kind === "";
@@ -10154,6 +10164,14 @@ function validateMessage(message, source, index) {
10154
10164
  if (typeof message.senderName === "string") normalized.senderName = message.senderName;
10155
10165
  if (typeof message._type === "string") normalized._type = message._type;
10156
10166
  if (typeof message._sub === "string") normalized._sub = message._sub;
10167
+ if (typeof message.visibility === "string") normalized.visibility = message.visibility;
10168
+ if (typeof message.transcriptVisibility === "string") normalized.transcriptVisibility = message.transcriptVisibility;
10169
+ if (typeof message.audience === "string") normalized.audience = message.audience;
10170
+ if (typeof message.source === "string") normalized.source = message.source;
10171
+ if (typeof message.userFacing === "boolean") normalized.userFacing = message.userFacing;
10172
+ if (typeof message.internal === "boolean") normalized.internal = message.internal;
10173
+ if (typeof message.isInternal === "boolean") normalized.isInternal = message.isInternal;
10174
+ if (typeof message.debug === "boolean") normalized.debug = message.debug;
10157
10175
  return normalized;
10158
10176
  }
10159
10177
  function validateModal(activeModal, status, source) {
@@ -12158,19 +12176,19 @@ function buildReadChatCommandResult(payload, args) {
12158
12176
  const visibleMessages = filterUserFacingChatMessages(messages);
12159
12177
  const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
12160
12178
  const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
12161
- const nextDebugReadChat = {
12162
- ...debugReadChat || {},
12163
- fullMsgCount: messages.length,
12179
+ const returnedDebugReadChat = debugReadChat ? {
12180
+ ...debugReadChat,
12181
+ fullMsgCount: typeof debugReadChat.fullMsgCount === "number" ? debugReadChat.fullMsgCount : messages.length,
12164
12182
  visibleMsgCount: visibleMessages.length,
12165
12183
  hiddenMsgCount,
12166
12184
  returnedMsgCount: sync.messages.length
12167
- };
12185
+ } : void 0;
12168
12186
  return {
12169
12187
  success: true,
12170
12188
  ...validatedPayload,
12171
12189
  messages: sync.messages,
12172
12190
  totalMessages: sync.totalMessages,
12173
- debugReadChat: nextDebugReadChat
12191
+ ...returnedDebugReadChat ? { debugReadChat: returnedDebugReadChat } : {}
12174
12192
  };
12175
12193
  }
12176
12194
  var DEFAULT_DEBUG_SANITIZE_OPTIONS = {
@@ -15801,12 +15819,11 @@ ${effect.notification.body || ""}`.trim();
15801
15819
  return Number.isFinite(value) && value > 0 ? value : 0;
15802
15820
  };
15803
15821
  const getRole = (message) => typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
15804
- const isAutoApprovalRuntimeOverlay = (entry) => {
15822
+ const isRuntimeOverlay = (entry) => {
15805
15823
  if (entry.source !== "runtime") return false;
15806
15824
  const key = typeof entry.runtimeKey === "string" ? entry.runtimeKey.trim().toLowerCase() : "";
15807
15825
  if (key.startsWith("auto_approval:")) return true;
15808
- const content = typeof entry.message.content === "string" ? entry.message.content.trim().toLowerCase() : flattenContent(entry.message.content).trim().toLowerCase();
15809
- return content.startsWith("auto-approved:");
15826
+ return !isUserFacingChatMessage(entry.message);
15810
15827
  };
15811
15828
  const shouldKeepParsedBeforeUntimedRuntime = (message) => {
15812
15829
  const role = getRole(message);
@@ -15825,7 +15842,7 @@ ${effect.notification.body || ""}`.trim();
15825
15842
  if (a.source !== b.source && aTime !== bTime) {
15826
15843
  const parsedEntry = a.source === "parsed" ? a : b.source === "parsed" ? b : null;
15827
15844
  const runtimeEntry = a.source === "runtime" ? a : b.source === "runtime" ? b : null;
15828
- if (parsedEntry && runtimeEntry && isAutoApprovalRuntimeOverlay(runtimeEntry) && getTime(parsedEntry.message) === 0 && getTime(runtimeEntry.message) > 0) {
15845
+ if (parsedEntry && runtimeEntry && isRuntimeOverlay(runtimeEntry) && getTime(parsedEntry.message) === 0 && getTime(runtimeEntry.message) > 0) {
15829
15846
  if (shouldKeepParsedBeforeUntimedRuntime(parsedEntry.message)) {
15830
15847
  return a.source === "parsed" ? -1 : 1;
15831
15848
  }