@adhdev/daemon-core 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.d.ts +2 -2
- package/dist/index.js +184 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +172 -20
- package/dist/index.mjs.map +1 -1
- package/dist/providers/chat-message-normalization.d.ts +35 -6
- package/package.json +1 -1
- package/src/chat/subscription-updates.ts +3 -1
- package/src/index.ts +13 -1
- package/src/providers/chat-message-normalization.ts +211 -50
package/dist/index.mjs
CHANGED
|
@@ -7815,6 +7815,20 @@ var StatusMonitor = class {
|
|
|
7815
7815
|
|
|
7816
7816
|
// src/providers/chat-message-normalization.ts
|
|
7817
7817
|
var BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
|
|
7818
|
+
var CHAT_MESSAGE_VISIBILITIES = ["user", "debug", "internal", "hidden"];
|
|
7819
|
+
var CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES = ["visible", "chat", "user", "debug", "internal", "hidden"];
|
|
7820
|
+
var CHAT_MESSAGE_AUDIENCES = ["chat", "debug", "trace", "internal"];
|
|
7821
|
+
var CHAT_MESSAGE_SOURCES = [
|
|
7822
|
+
"assistant_text",
|
|
7823
|
+
"tool_call",
|
|
7824
|
+
"terminal_command",
|
|
7825
|
+
"runtime_activity",
|
|
7826
|
+
"runtime_status",
|
|
7827
|
+
"provider_chrome",
|
|
7828
|
+
"control"
|
|
7829
|
+
];
|
|
7830
|
+
var CHAT_MESSAGE_ACTIVITY_SOURCES = ["tool_call", "terminal_command", "runtime_activity"];
|
|
7831
|
+
var CHAT_MESSAGE_INTERNAL_SOURCES = ["runtime_status", "provider_chrome", "control"];
|
|
7818
7832
|
var KNOWN_CHAT_MESSAGE_KINDS = new Set(BUILTIN_CHAT_MESSAGE_KINDS);
|
|
7819
7833
|
var CHAT_MESSAGE_KIND_ALIASES = {
|
|
7820
7834
|
text: "standard",
|
|
@@ -7963,37 +7977,162 @@ function readMessageMeta(message) {
|
|
|
7963
7977
|
function readStringField(value) {
|
|
7964
7978
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
7965
7979
|
}
|
|
7966
|
-
function
|
|
7980
|
+
function readRecordField(message, meta, key) {
|
|
7967
7981
|
const record = message;
|
|
7968
|
-
return
|
|
7982
|
+
return record[key] ?? meta?.[key];
|
|
7969
7983
|
}
|
|
7970
|
-
function
|
|
7971
|
-
|
|
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;
|
|
7984
|
+
function readVisibilityField(message, meta) {
|
|
7985
|
+
return readStringField(readRecordField(message, meta, "visibility"));
|
|
7976
7986
|
}
|
|
7977
|
-
function
|
|
7987
|
+
function readTranscriptVisibilityField(message, meta) {
|
|
7978
7988
|
const record = message;
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7989
|
+
return readStringField(record.transcriptVisibility ?? meta?.transcriptVisibility ?? record.visibility ?? meta?.visibility);
|
|
7990
|
+
}
|
|
7991
|
+
var EXPLICIT_HIDDEN_VISIBILITIES = /* @__PURE__ */ new Set(["hidden", "debug", "internal"]);
|
|
7992
|
+
var EXPLICIT_VISIBLE_VISIBILITIES = /* @__PURE__ */ new Set(["visible", "user", "chat"]);
|
|
7993
|
+
var HIDDEN_AUDIENCES = /* @__PURE__ */ new Set(["debug", "trace", "internal"]);
|
|
7994
|
+
var ACTIVITY_SOURCE_SET = new Set(CHAT_MESSAGE_ACTIVITY_SOURCES);
|
|
7995
|
+
var INTERNAL_SOURCE_SET = new Set(CHAT_MESSAGE_INTERNAL_SOURCES);
|
|
7996
|
+
function hasBooleanMarker(message, meta, keys) {
|
|
7997
|
+
const record = message;
|
|
7998
|
+
return keys.some((key) => record[key] === true || meta?.[key] === true);
|
|
7982
7999
|
}
|
|
7983
|
-
function
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
if (isExplicitlyVisibleInTranscript(message, meta)) return true;
|
|
7988
|
-
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
7989
|
-
const kind = resolveChatMessageKind(message);
|
|
8000
|
+
function isActivityKind(kind) {
|
|
8001
|
+
return kind === "thought" || kind === "tool" || kind === "terminal";
|
|
8002
|
+
}
|
|
8003
|
+
function isOrdinaryVisibleTurn(message, role, kind) {
|
|
7990
8004
|
if (role === "user" || role === "human") return kind === "standard" || kind === "";
|
|
7991
8005
|
if (role === "assistant") return kind === "standard" || kind === "";
|
|
7992
8006
|
return false;
|
|
7993
8007
|
}
|
|
8008
|
+
function classifyChatMessageVisibility(message) {
|
|
8009
|
+
if (!message) {
|
|
8010
|
+
return {
|
|
8011
|
+
surface: "internal",
|
|
8012
|
+
isUserFacing: false,
|
|
8013
|
+
isActivityFacing: false,
|
|
8014
|
+
isInternal: true,
|
|
8015
|
+
explicitUserFacing: false,
|
|
8016
|
+
explicitHidden: true,
|
|
8017
|
+
role: "",
|
|
8018
|
+
kind: "standard",
|
|
8019
|
+
visibility: "",
|
|
8020
|
+
transcriptVisibility: "",
|
|
8021
|
+
audience: "",
|
|
8022
|
+
source: ""
|
|
8023
|
+
};
|
|
8024
|
+
}
|
|
8025
|
+
const meta = readMessageMeta(message);
|
|
8026
|
+
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
8027
|
+
const kind = resolveChatMessageKind(message);
|
|
8028
|
+
const visibility = readVisibilityField(message, meta);
|
|
8029
|
+
const transcriptVisibility = readTranscriptVisibilityField(message, meta);
|
|
8030
|
+
const audience = readStringField(readRecordField(message, meta, "audience"));
|
|
8031
|
+
const source = readStringField(readRecordField(message, meta, "source"));
|
|
8032
|
+
const explicitHidden = EXPLICIT_HIDDEN_VISIBILITIES.has(visibility) || EXPLICIT_HIDDEN_VISIBILITIES.has(transcriptVisibility) || HIDDEN_AUDIENCES.has(audience) || hasBooleanMarker(message, meta, ["internal", "isInternal", "debug", "statusOnly", "controlOnly"]);
|
|
8033
|
+
const explicitUserFacing = EXPLICIT_VISIBLE_VISIBILITIES.has(visibility) || EXPLICIT_VISIBLE_VISIBILITIES.has(transcriptVisibility) || audience === "chat" || hasBooleanMarker(message, meta, ["userFacing"]);
|
|
8034
|
+
if (explicitHidden) {
|
|
8035
|
+
const activityLike = isActivityKind(kind) || ACTIVITY_SOURCE_SET.has(source);
|
|
8036
|
+
return {
|
|
8037
|
+
surface: activityLike ? "activity" : "internal",
|
|
8038
|
+
isUserFacing: false,
|
|
8039
|
+
isActivityFacing: activityLike,
|
|
8040
|
+
isInternal: !activityLike,
|
|
8041
|
+
explicitUserFacing,
|
|
8042
|
+
explicitHidden,
|
|
8043
|
+
role,
|
|
8044
|
+
kind,
|
|
8045
|
+
visibility,
|
|
8046
|
+
transcriptVisibility,
|
|
8047
|
+
audience,
|
|
8048
|
+
source
|
|
8049
|
+
};
|
|
8050
|
+
}
|
|
8051
|
+
if (explicitUserFacing) {
|
|
8052
|
+
return {
|
|
8053
|
+
surface: "chat",
|
|
8054
|
+
isUserFacing: true,
|
|
8055
|
+
isActivityFacing: false,
|
|
8056
|
+
isInternal: false,
|
|
8057
|
+
explicitUserFacing,
|
|
8058
|
+
explicitHidden,
|
|
8059
|
+
role,
|
|
8060
|
+
kind,
|
|
8061
|
+
visibility,
|
|
8062
|
+
transcriptVisibility,
|
|
8063
|
+
audience,
|
|
8064
|
+
source
|
|
8065
|
+
};
|
|
8066
|
+
}
|
|
8067
|
+
if (INTERNAL_SOURCE_SET.has(source) || role === "system" || kind === "system") {
|
|
8068
|
+
return {
|
|
8069
|
+
surface: "internal",
|
|
8070
|
+
isUserFacing: false,
|
|
8071
|
+
isActivityFacing: false,
|
|
8072
|
+
isInternal: true,
|
|
8073
|
+
explicitUserFacing,
|
|
8074
|
+
explicitHidden,
|
|
8075
|
+
role,
|
|
8076
|
+
kind,
|
|
8077
|
+
visibility,
|
|
8078
|
+
transcriptVisibility,
|
|
8079
|
+
audience,
|
|
8080
|
+
source
|
|
8081
|
+
};
|
|
8082
|
+
}
|
|
8083
|
+
if (ACTIVITY_SOURCE_SET.has(source) || isActivityKind(kind)) {
|
|
8084
|
+
return {
|
|
8085
|
+
surface: "activity",
|
|
8086
|
+
isUserFacing: false,
|
|
8087
|
+
isActivityFacing: true,
|
|
8088
|
+
isInternal: false,
|
|
8089
|
+
explicitUserFacing,
|
|
8090
|
+
explicitHidden,
|
|
8091
|
+
role,
|
|
8092
|
+
kind,
|
|
8093
|
+
visibility,
|
|
8094
|
+
transcriptVisibility,
|
|
8095
|
+
audience,
|
|
8096
|
+
source
|
|
8097
|
+
};
|
|
8098
|
+
}
|
|
8099
|
+
const isUserFacing = isOrdinaryVisibleTurn(message, role, kind);
|
|
8100
|
+
return {
|
|
8101
|
+
surface: isUserFacing ? "chat" : "internal",
|
|
8102
|
+
isUserFacing,
|
|
8103
|
+
isActivityFacing: false,
|
|
8104
|
+
isInternal: !isUserFacing,
|
|
8105
|
+
explicitUserFacing,
|
|
8106
|
+
explicitHidden,
|
|
8107
|
+
role,
|
|
8108
|
+
kind,
|
|
8109
|
+
visibility,
|
|
8110
|
+
transcriptVisibility,
|
|
8111
|
+
audience,
|
|
8112
|
+
source
|
|
8113
|
+
};
|
|
8114
|
+
}
|
|
8115
|
+
function isUserFacingChatMessage(message) {
|
|
8116
|
+
return classifyChatMessageVisibility(message).isUserFacing;
|
|
8117
|
+
}
|
|
8118
|
+
function isActivityChatMessage(message) {
|
|
8119
|
+
return classifyChatMessageVisibility(message).isActivityFacing;
|
|
8120
|
+
}
|
|
8121
|
+
function isInternalChatMessage(message) {
|
|
8122
|
+
return classifyChatMessageVisibility(message).isInternal;
|
|
8123
|
+
}
|
|
7994
8124
|
function filterUserFacingChatMessages(messages) {
|
|
7995
8125
|
return (Array.isArray(messages) ? messages : []).filter((message) => isUserFacingChatMessage(message));
|
|
7996
8126
|
}
|
|
8127
|
+
function filterActivityChatMessages(messages) {
|
|
8128
|
+
return (Array.isArray(messages) ? messages : []).filter((message) => isActivityChatMessage(message));
|
|
8129
|
+
}
|
|
8130
|
+
function filterInternalChatMessages(messages) {
|
|
8131
|
+
return (Array.isArray(messages) ? messages : []).filter((message) => isInternalChatMessage(message));
|
|
8132
|
+
}
|
|
8133
|
+
function filterChatMessagesByVisibility(messages, surface) {
|
|
8134
|
+
return (Array.isArray(messages) ? messages : []).filter((message) => classifyChatMessageVisibility(message).surface === surface);
|
|
8135
|
+
}
|
|
7997
8136
|
|
|
7998
8137
|
// src/providers/control-effects.ts
|
|
7999
8138
|
function extractProviderControlValues(controls, data) {
|
|
@@ -23000,7 +23139,8 @@ function prepareSessionChatTailUpdate(input) {
|
|
|
23000
23139
|
update: null
|
|
23001
23140
|
};
|
|
23002
23141
|
}
|
|
23003
|
-
const
|
|
23142
|
+
const fullMessages = normalizeChatMessages(Array.isArray(result.messages) ? result.messages : []);
|
|
23143
|
+
const messages = filterUserFacingChatMessages(fullMessages);
|
|
23004
23144
|
const title = typeof result.title === "string" ? result.title : void 0;
|
|
23005
23145
|
const activeModal = normalizeChatTailActiveModal(result.activeModal);
|
|
23006
23146
|
const status = typeof result.status === "string" ? result.status : "idle";
|
|
@@ -30622,6 +30762,12 @@ export {
|
|
|
30622
30762
|
AcpProviderInstance,
|
|
30623
30763
|
AgentStreamPoller,
|
|
30624
30764
|
BUILTIN_CHAT_MESSAGE_KINDS,
|
|
30765
|
+
CHAT_MESSAGE_ACTIVITY_SOURCES,
|
|
30766
|
+
CHAT_MESSAGE_AUDIENCES,
|
|
30767
|
+
CHAT_MESSAGE_INTERNAL_SOURCES,
|
|
30768
|
+
CHAT_MESSAGE_SOURCES,
|
|
30769
|
+
CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES,
|
|
30770
|
+
CHAT_MESSAGE_VISIBILITIES,
|
|
30625
30771
|
CdpDomHandlers,
|
|
30626
30772
|
CliProviderInstance,
|
|
30627
30773
|
DAEMON_WS_PATH,
|
|
@@ -30684,6 +30830,7 @@ export {
|
|
|
30684
30830
|
buildThoughtChatMessage,
|
|
30685
30831
|
buildToolChatMessage,
|
|
30686
30832
|
buildUserChatMessage,
|
|
30833
|
+
classifyChatMessageVisibility,
|
|
30687
30834
|
classifyHotChatSessionsForSubscriptionFlush,
|
|
30688
30835
|
clearDebugTrace,
|
|
30689
30836
|
compareGitSnapshots,
|
|
@@ -30703,6 +30850,9 @@ export {
|
|
|
30703
30850
|
detectIDEs,
|
|
30704
30851
|
ensureSessionHostReady,
|
|
30705
30852
|
execNpmCommandSync,
|
|
30853
|
+
filterActivityChatMessages,
|
|
30854
|
+
filterChatMessagesByVisibility,
|
|
30855
|
+
filterInternalChatMessages,
|
|
30706
30856
|
filterUserFacingChatMessages,
|
|
30707
30857
|
findCdpManager,
|
|
30708
30858
|
flattenMessageParts,
|
|
@@ -30734,11 +30884,13 @@ export {
|
|
|
30734
30884
|
initDaemonComponents,
|
|
30735
30885
|
installExtensions,
|
|
30736
30886
|
installGlobalInterceptor,
|
|
30887
|
+
isActivityChatMessage,
|
|
30737
30888
|
isBuiltinChatMessageKind,
|
|
30738
30889
|
isCdpConnected,
|
|
30739
30890
|
isExtensionInstalled,
|
|
30740
30891
|
isGitCommandName,
|
|
30741
30892
|
isIdeRunning,
|
|
30893
|
+
isInternalChatMessage,
|
|
30742
30894
|
isManagedStatusWaiting,
|
|
30743
30895
|
isManagedStatusWorking,
|
|
30744
30896
|
isPathInside,
|