@adhdev/daemon-standalone 0.9.76-rc.60 → 0.9.76-rc.61

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
@@ -35023,6 +35023,12 @@ ${lastSnapshot}`;
35023
35023
  AcpProviderInstance: () => AcpProviderInstance,
35024
35024
  AgentStreamPoller: () => AgentStreamPoller,
35025
35025
  BUILTIN_CHAT_MESSAGE_KINDS: () => BUILTIN_CHAT_MESSAGE_KINDS,
35026
+ CHAT_MESSAGE_ACTIVITY_SOURCES: () => CHAT_MESSAGE_ACTIVITY_SOURCES,
35027
+ CHAT_MESSAGE_AUDIENCES: () => CHAT_MESSAGE_AUDIENCES,
35028
+ CHAT_MESSAGE_INTERNAL_SOURCES: () => CHAT_MESSAGE_INTERNAL_SOURCES,
35029
+ CHAT_MESSAGE_SOURCES: () => CHAT_MESSAGE_SOURCES,
35030
+ CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES: () => CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES,
35031
+ CHAT_MESSAGE_VISIBILITIES: () => CHAT_MESSAGE_VISIBILITIES,
35026
35032
  CdpDomHandlers: () => CdpDomHandlers,
35027
35033
  CliProviderInstance: () => CliProviderInstance,
35028
35034
  DAEMON_WS_PATH: () => DAEMON_WS_PATH,
@@ -35085,6 +35091,7 @@ ${lastSnapshot}`;
35085
35091
  buildThoughtChatMessage: () => buildThoughtChatMessage,
35086
35092
  buildToolChatMessage: () => buildToolChatMessage,
35087
35093
  buildUserChatMessage: () => buildUserChatMessage,
35094
+ classifyChatMessageVisibility: () => classifyChatMessageVisibility,
35088
35095
  classifyHotChatSessionsForSubscriptionFlush: () => classifyHotChatSessionsForSubscriptionFlush2,
35089
35096
  clearDebugTrace: () => clearDebugTrace,
35090
35097
  compareGitSnapshots: () => compareGitSnapshots,
@@ -35104,6 +35111,9 @@ ${lastSnapshot}`;
35104
35111
  detectIDEs: () => detectIDEs,
35105
35112
  ensureSessionHostReady: () => ensureSessionHostReady2,
35106
35113
  execNpmCommandSync: () => execNpmCommandSync,
35114
+ filterActivityChatMessages: () => filterActivityChatMessages,
35115
+ filterChatMessagesByVisibility: () => filterChatMessagesByVisibility,
35116
+ filterInternalChatMessages: () => filterInternalChatMessages,
35107
35117
  filterUserFacingChatMessages: () => filterUserFacingChatMessages,
35108
35118
  findCdpManager: () => findCdpManager,
35109
35119
  flattenMessageParts: () => flattenMessageParts,
@@ -35135,11 +35145,13 @@ ${lastSnapshot}`;
35135
35145
  initDaemonComponents: () => initDaemonComponents2,
35136
35146
  installExtensions: () => installExtensions,
35137
35147
  installGlobalInterceptor: () => installGlobalInterceptor,
35148
+ isActivityChatMessage: () => isActivityChatMessage,
35138
35149
  isBuiltinChatMessageKind: () => isBuiltinChatMessageKind,
35139
35150
  isCdpConnected: () => isCdpConnected,
35140
35151
  isExtensionInstalled: () => isExtensionInstalled,
35141
35152
  isGitCommandName: () => isGitCommandName,
35142
35153
  isIdeRunning: () => isIdeRunning,
35154
+ isInternalChatMessage: () => isInternalChatMessage,
35143
35155
  isManagedStatusWaiting: () => isManagedStatusWaiting,
35144
35156
  isManagedStatusWorking: () => isManagedStatusWorking,
35145
35157
  isPathInside: () => isPathInside,
@@ -39157,6 +39169,20 @@ ${lastSnapshot}`;
39157
39169
  }
39158
39170
  };
39159
39171
  var BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
39172
+ var CHAT_MESSAGE_VISIBILITIES = ["user", "debug", "internal", "hidden"];
39173
+ var CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES = ["visible", "chat", "user", "debug", "internal", "hidden"];
39174
+ var CHAT_MESSAGE_AUDIENCES = ["chat", "debug", "trace", "internal"];
39175
+ var CHAT_MESSAGE_SOURCES = [
39176
+ "assistant_text",
39177
+ "tool_call",
39178
+ "terminal_command",
39179
+ "runtime_activity",
39180
+ "runtime_status",
39181
+ "provider_chrome",
39182
+ "control"
39183
+ ];
39184
+ var CHAT_MESSAGE_ACTIVITY_SOURCES = ["tool_call", "terminal_command", "runtime_activity"];
39185
+ var CHAT_MESSAGE_INTERNAL_SOURCES = ["runtime_status", "provider_chrome", "control"];
39160
39186
  var KNOWN_CHAT_MESSAGE_KINDS = new Set(BUILTIN_CHAT_MESSAGE_KINDS);
39161
39187
  var CHAT_MESSAGE_KIND_ALIASES = {
39162
39188
  text: "standard",
@@ -39305,37 +39331,162 @@ ${lastSnapshot}`;
39305
39331
  function readStringField(value) {
39306
39332
  return typeof value === "string" ? value.trim().toLowerCase() : "";
39307
39333
  }
39308
- function readVisibilityField(message, meta3) {
39334
+ function readRecordField(message, meta3, key) {
39309
39335
  const record2 = message;
39310
- return readStringField(record2.visibility ?? record2.transcriptVisibility ?? meta3?.visibility ?? meta3?.transcriptVisibility);
39336
+ return record2[key] ?? meta3?.[key];
39311
39337
  }
39312
- function isExplicitlyHiddenFromTranscript(message, meta3) {
39313
- const record2 = message;
39314
- const visibility = readVisibilityField(message, meta3);
39315
- const audience = readStringField(record2.audience ?? meta3?.audience);
39316
- const source = readStringField(record2.source ?? meta3?.source);
39317
- return visibility === "hidden" || visibility === "debug" || visibility === "internal" || audience === "debug" || audience === "trace" || audience === "internal" || source === "runtime_status" || source === "runtime_activity" || source === "provider_chrome" || source === "control" || record2.internal === true || record2.isInternal === true || record2.debug === true || meta3?.internal === true || meta3?.isInternal === true || meta3?.debug === true || meta3?.statusOnly === true || meta3?.controlOnly === true;
39338
+ function readVisibilityField(message, meta3) {
39339
+ return readStringField(readRecordField(message, meta3, "visibility"));
39318
39340
  }
39319
- function isExplicitlyVisibleInTranscript(message, meta3) {
39341
+ function readTranscriptVisibilityField(message, meta3) {
39320
39342
  const record2 = message;
39321
- const visibility = readVisibilityField(message, meta3);
39322
- const audience = readStringField(record2.audience ?? meta3?.audience);
39323
- return visibility === "visible" || visibility === "user" || visibility === "chat" || audience === "chat" || record2.userFacing === true || meta3?.userFacing === true;
39343
+ return readStringField(record2.transcriptVisibility ?? meta3?.transcriptVisibility ?? record2.visibility ?? meta3?.visibility);
39344
+ }
39345
+ var EXPLICIT_HIDDEN_VISIBILITIES = /* @__PURE__ */ new Set(["hidden", "debug", "internal"]);
39346
+ var EXPLICIT_VISIBLE_VISIBILITIES = /* @__PURE__ */ new Set(["visible", "user", "chat"]);
39347
+ var HIDDEN_AUDIENCES = /* @__PURE__ */ new Set(["debug", "trace", "internal"]);
39348
+ var ACTIVITY_SOURCE_SET = new Set(CHAT_MESSAGE_ACTIVITY_SOURCES);
39349
+ var INTERNAL_SOURCE_SET = new Set(CHAT_MESSAGE_INTERNAL_SOURCES);
39350
+ function hasBooleanMarker(message, meta3, keys) {
39351
+ const record2 = message;
39352
+ return keys.some((key) => record2[key] === true || meta3?.[key] === true);
39324
39353
  }
39325
- function isUserFacingChatMessage(message) {
39326
- if (!message) return false;
39327
- const meta3 = readMessageMeta(message);
39328
- if (isExplicitlyHiddenFromTranscript(message, meta3)) return false;
39329
- if (isExplicitlyVisibleInTranscript(message, meta3)) return true;
39330
- const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
39331
- const kind = resolveChatMessageKind(message);
39354
+ function isActivityKind(kind) {
39355
+ return kind === "thought" || kind === "tool" || kind === "terminal";
39356
+ }
39357
+ function isOrdinaryVisibleTurn(message, role, kind) {
39332
39358
  if (role === "user" || role === "human") return kind === "standard" || kind === "";
39333
39359
  if (role === "assistant") return kind === "standard" || kind === "";
39334
39360
  return false;
39335
39361
  }
39362
+ function classifyChatMessageVisibility(message) {
39363
+ if (!message) {
39364
+ return {
39365
+ surface: "internal",
39366
+ isUserFacing: false,
39367
+ isActivityFacing: false,
39368
+ isInternal: true,
39369
+ explicitUserFacing: false,
39370
+ explicitHidden: true,
39371
+ role: "",
39372
+ kind: "standard",
39373
+ visibility: "",
39374
+ transcriptVisibility: "",
39375
+ audience: "",
39376
+ source: ""
39377
+ };
39378
+ }
39379
+ const meta3 = readMessageMeta(message);
39380
+ const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
39381
+ const kind = resolveChatMessageKind(message);
39382
+ const visibility = readVisibilityField(message, meta3);
39383
+ const transcriptVisibility = readTranscriptVisibilityField(message, meta3);
39384
+ const audience = readStringField(readRecordField(message, meta3, "audience"));
39385
+ const source = readStringField(readRecordField(message, meta3, "source"));
39386
+ const explicitHidden = EXPLICIT_HIDDEN_VISIBILITIES.has(visibility) || EXPLICIT_HIDDEN_VISIBILITIES.has(transcriptVisibility) || HIDDEN_AUDIENCES.has(audience) || hasBooleanMarker(message, meta3, ["internal", "isInternal", "debug", "statusOnly", "controlOnly"]);
39387
+ const explicitUserFacing = EXPLICIT_VISIBLE_VISIBILITIES.has(visibility) || EXPLICIT_VISIBLE_VISIBILITIES.has(transcriptVisibility) || audience === "chat" || hasBooleanMarker(message, meta3, ["userFacing"]);
39388
+ if (explicitHidden) {
39389
+ const activityLike = isActivityKind(kind) || ACTIVITY_SOURCE_SET.has(source);
39390
+ return {
39391
+ surface: activityLike ? "activity" : "internal",
39392
+ isUserFacing: false,
39393
+ isActivityFacing: activityLike,
39394
+ isInternal: !activityLike,
39395
+ explicitUserFacing,
39396
+ explicitHidden,
39397
+ role,
39398
+ kind,
39399
+ visibility,
39400
+ transcriptVisibility,
39401
+ audience,
39402
+ source
39403
+ };
39404
+ }
39405
+ if (explicitUserFacing) {
39406
+ return {
39407
+ surface: "chat",
39408
+ isUserFacing: true,
39409
+ isActivityFacing: false,
39410
+ isInternal: false,
39411
+ explicitUserFacing,
39412
+ explicitHidden,
39413
+ role,
39414
+ kind,
39415
+ visibility,
39416
+ transcriptVisibility,
39417
+ audience,
39418
+ source
39419
+ };
39420
+ }
39421
+ if (INTERNAL_SOURCE_SET.has(source) || role === "system" || kind === "system") {
39422
+ return {
39423
+ surface: "internal",
39424
+ isUserFacing: false,
39425
+ isActivityFacing: false,
39426
+ isInternal: true,
39427
+ explicitUserFacing,
39428
+ explicitHidden,
39429
+ role,
39430
+ kind,
39431
+ visibility,
39432
+ transcriptVisibility,
39433
+ audience,
39434
+ source
39435
+ };
39436
+ }
39437
+ if (ACTIVITY_SOURCE_SET.has(source) || isActivityKind(kind)) {
39438
+ return {
39439
+ surface: "activity",
39440
+ isUserFacing: false,
39441
+ isActivityFacing: true,
39442
+ isInternal: false,
39443
+ explicitUserFacing,
39444
+ explicitHidden,
39445
+ role,
39446
+ kind,
39447
+ visibility,
39448
+ transcriptVisibility,
39449
+ audience,
39450
+ source
39451
+ };
39452
+ }
39453
+ const isUserFacing = isOrdinaryVisibleTurn(message, role, kind);
39454
+ return {
39455
+ surface: isUserFacing ? "chat" : "internal",
39456
+ isUserFacing,
39457
+ isActivityFacing: false,
39458
+ isInternal: !isUserFacing,
39459
+ explicitUserFacing,
39460
+ explicitHidden,
39461
+ role,
39462
+ kind,
39463
+ visibility,
39464
+ transcriptVisibility,
39465
+ audience,
39466
+ source
39467
+ };
39468
+ }
39469
+ function isUserFacingChatMessage(message) {
39470
+ return classifyChatMessageVisibility(message).isUserFacing;
39471
+ }
39472
+ function isActivityChatMessage(message) {
39473
+ return classifyChatMessageVisibility(message).isActivityFacing;
39474
+ }
39475
+ function isInternalChatMessage(message) {
39476
+ return classifyChatMessageVisibility(message).isInternal;
39477
+ }
39336
39478
  function filterUserFacingChatMessages(messages) {
39337
39479
  return (Array.isArray(messages) ? messages : []).filter((message) => isUserFacingChatMessage(message));
39338
39480
  }
39481
+ function filterActivityChatMessages(messages) {
39482
+ return (Array.isArray(messages) ? messages : []).filter((message) => isActivityChatMessage(message));
39483
+ }
39484
+ function filterInternalChatMessages(messages) {
39485
+ return (Array.isArray(messages) ? messages : []).filter((message) => isInternalChatMessage(message));
39486
+ }
39487
+ function filterChatMessagesByVisibility(messages, surface) {
39488
+ return (Array.isArray(messages) ? messages : []).filter((message) => classifyChatMessageVisibility(message).surface === surface);
39489
+ }
39339
39490
  function extractProviderControlValues(controls, data) {
39340
39491
  if (!data || typeof data !== "object") return void 0;
39341
39492
  const values = {};
@@ -54221,7 +54372,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
54221
54372
  update: null
54222
54373
  };
54223
54374
  }
54224
- const messages = Array.isArray(result.messages) ? result.messages : [];
54375
+ const fullMessages = normalizeChatMessages(Array.isArray(result.messages) ? result.messages : []);
54376
+ const messages = filterUserFacingChatMessages(fullMessages);
54225
54377
  const title = typeof result.title === "string" ? result.title : void 0;
54226
54378
  const activeModal = normalizeChatTailActiveModal(result.activeModal);
54227
54379
  const status = typeof result.status === "string" ? result.status : "idle";