@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.d.ts
CHANGED
|
@@ -90,8 +90,8 @@ export type { ProviderModule, CdpTargetFilter, ProviderResumeCapability, InputEn
|
|
|
90
90
|
export type { ProviderSourceConfigSnapshot, ProviderSourceConfigUpdate } from './config/provider-source-config.js';
|
|
91
91
|
export { parseProviderSourceConfigUpdate } from './config/provider-source-config.js';
|
|
92
92
|
export { normalizeInputEnvelope, normalizeMessageParts, flattenMessageParts } from './providers/io-contracts.js';
|
|
93
|
-
export { BUILTIN_CHAT_MESSAGE_KINDS, isBuiltinChatMessageKind, normalizeChatMessageKind, resolveChatMessageKind, buildChatMessage, buildSystemChatMessage, buildRuntimeSystemChatMessage, buildAssistantChatMessage, buildThoughtChatMessage, buildToolChatMessage, buildTerminalChatMessage, buildUserChatMessage, normalizeChatMessage, normalizeChatMessages, isUserFacingChatMessage, filterUserFacingChatMessages, } from './providers/chat-message-normalization.js';
|
|
94
|
-
export type { BuiltinChatMessageKind, ChatMessageKind } from './providers/chat-message-normalization.js';
|
|
93
|
+
export { BUILTIN_CHAT_MESSAGE_KINDS, isBuiltinChatMessageKind, normalizeChatMessageKind, resolveChatMessageKind, buildChatMessage, buildSystemChatMessage, buildRuntimeSystemChatMessage, buildAssistantChatMessage, buildThoughtChatMessage, buildToolChatMessage, buildTerminalChatMessage, buildUserChatMessage, normalizeChatMessage, normalizeChatMessages, CHAT_MESSAGE_VISIBILITIES, CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES, CHAT_MESSAGE_AUDIENCES, CHAT_MESSAGE_SOURCES, CHAT_MESSAGE_ACTIVITY_SOURCES, CHAT_MESSAGE_INTERNAL_SOURCES, classifyChatMessageVisibility, isUserFacingChatMessage, isActivityChatMessage, isInternalChatMessage, filterUserFacingChatMessages, filterActivityChatMessages, filterInternalChatMessages, filterChatMessagesByVisibility, } from './providers/chat-message-normalization.js';
|
|
94
|
+
export type { BuiltinChatMessageKind, ChatMessageKind, ChatMessageVisibility, ChatMessageTranscriptVisibility, ChatMessageAudience, ChatMessageSource, ChatMessageTranscriptSurface, ChatMessageVisibilityClassification } from './providers/chat-message-normalization.js';
|
|
95
95
|
export { VersionArchive, detectAllVersions } from './providers/version-archive.js';
|
|
96
96
|
export type { ProviderVersionInfo, VersionHistory } from './providers/version-archive.js';
|
|
97
97
|
export { DevServer, DEV_SERVER_PORT } from './daemon/dev-server.js';
|
package/dist/index.js
CHANGED
|
@@ -3819,6 +3819,12 @@ __export(index_exports, {
|
|
|
3819
3819
|
AcpProviderInstance: () => AcpProviderInstance,
|
|
3820
3820
|
AgentStreamPoller: () => AgentStreamPoller,
|
|
3821
3821
|
BUILTIN_CHAT_MESSAGE_KINDS: () => BUILTIN_CHAT_MESSAGE_KINDS,
|
|
3822
|
+
CHAT_MESSAGE_ACTIVITY_SOURCES: () => CHAT_MESSAGE_ACTIVITY_SOURCES,
|
|
3823
|
+
CHAT_MESSAGE_AUDIENCES: () => CHAT_MESSAGE_AUDIENCES,
|
|
3824
|
+
CHAT_MESSAGE_INTERNAL_SOURCES: () => CHAT_MESSAGE_INTERNAL_SOURCES,
|
|
3825
|
+
CHAT_MESSAGE_SOURCES: () => CHAT_MESSAGE_SOURCES,
|
|
3826
|
+
CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES: () => CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES,
|
|
3827
|
+
CHAT_MESSAGE_VISIBILITIES: () => CHAT_MESSAGE_VISIBILITIES,
|
|
3822
3828
|
CdpDomHandlers: () => CdpDomHandlers,
|
|
3823
3829
|
CliProviderInstance: () => CliProviderInstance,
|
|
3824
3830
|
DAEMON_WS_PATH: () => DAEMON_WS_PATH,
|
|
@@ -3881,6 +3887,7 @@ __export(index_exports, {
|
|
|
3881
3887
|
buildThoughtChatMessage: () => buildThoughtChatMessage,
|
|
3882
3888
|
buildToolChatMessage: () => buildToolChatMessage,
|
|
3883
3889
|
buildUserChatMessage: () => buildUserChatMessage,
|
|
3890
|
+
classifyChatMessageVisibility: () => classifyChatMessageVisibility,
|
|
3884
3891
|
classifyHotChatSessionsForSubscriptionFlush: () => classifyHotChatSessionsForSubscriptionFlush,
|
|
3885
3892
|
clearDebugTrace: () => clearDebugTrace,
|
|
3886
3893
|
compareGitSnapshots: () => compareGitSnapshots,
|
|
@@ -3900,6 +3907,9 @@ __export(index_exports, {
|
|
|
3900
3907
|
detectIDEs: () => detectIDEs,
|
|
3901
3908
|
ensureSessionHostReady: () => ensureSessionHostReady,
|
|
3902
3909
|
execNpmCommandSync: () => execNpmCommandSync,
|
|
3910
|
+
filterActivityChatMessages: () => filterActivityChatMessages,
|
|
3911
|
+
filterChatMessagesByVisibility: () => filterChatMessagesByVisibility,
|
|
3912
|
+
filterInternalChatMessages: () => filterInternalChatMessages,
|
|
3903
3913
|
filterUserFacingChatMessages: () => filterUserFacingChatMessages,
|
|
3904
3914
|
findCdpManager: () => findCdpManager,
|
|
3905
3915
|
flattenMessageParts: () => flattenMessageParts,
|
|
@@ -3931,11 +3941,13 @@ __export(index_exports, {
|
|
|
3931
3941
|
initDaemonComponents: () => initDaemonComponents,
|
|
3932
3942
|
installExtensions: () => installExtensions,
|
|
3933
3943
|
installGlobalInterceptor: () => installGlobalInterceptor,
|
|
3944
|
+
isActivityChatMessage: () => isActivityChatMessage,
|
|
3934
3945
|
isBuiltinChatMessageKind: () => isBuiltinChatMessageKind,
|
|
3935
3946
|
isCdpConnected: () => isCdpConnected,
|
|
3936
3947
|
isExtensionInstalled: () => isExtensionInstalled,
|
|
3937
3948
|
isGitCommandName: () => isGitCommandName,
|
|
3938
3949
|
isIdeRunning: () => isIdeRunning,
|
|
3950
|
+
isInternalChatMessage: () => isInternalChatMessage,
|
|
3939
3951
|
isManagedStatusWaiting: () => isManagedStatusWaiting,
|
|
3940
3952
|
isManagedStatusWorking: () => isManagedStatusWorking,
|
|
3941
3953
|
isPathInside: () => isPathInside,
|
|
@@ -8013,6 +8025,20 @@ var StatusMonitor = class {
|
|
|
8013
8025
|
|
|
8014
8026
|
// src/providers/chat-message-normalization.ts
|
|
8015
8027
|
var BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
|
|
8028
|
+
var CHAT_MESSAGE_VISIBILITIES = ["user", "debug", "internal", "hidden"];
|
|
8029
|
+
var CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES = ["visible", "chat", "user", "debug", "internal", "hidden"];
|
|
8030
|
+
var CHAT_MESSAGE_AUDIENCES = ["chat", "debug", "trace", "internal"];
|
|
8031
|
+
var CHAT_MESSAGE_SOURCES = [
|
|
8032
|
+
"assistant_text",
|
|
8033
|
+
"tool_call",
|
|
8034
|
+
"terminal_command",
|
|
8035
|
+
"runtime_activity",
|
|
8036
|
+
"runtime_status",
|
|
8037
|
+
"provider_chrome",
|
|
8038
|
+
"control"
|
|
8039
|
+
];
|
|
8040
|
+
var CHAT_MESSAGE_ACTIVITY_SOURCES = ["tool_call", "terminal_command", "runtime_activity"];
|
|
8041
|
+
var CHAT_MESSAGE_INTERNAL_SOURCES = ["runtime_status", "provider_chrome", "control"];
|
|
8016
8042
|
var KNOWN_CHAT_MESSAGE_KINDS = new Set(BUILTIN_CHAT_MESSAGE_KINDS);
|
|
8017
8043
|
var CHAT_MESSAGE_KIND_ALIASES = {
|
|
8018
8044
|
text: "standard",
|
|
@@ -8161,37 +8187,162 @@ function readMessageMeta(message) {
|
|
|
8161
8187
|
function readStringField(value) {
|
|
8162
8188
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
8163
8189
|
}
|
|
8164
|
-
function
|
|
8190
|
+
function readRecordField(message, meta, key) {
|
|
8165
8191
|
const record = message;
|
|
8166
|
-
return
|
|
8192
|
+
return record[key] ?? meta?.[key];
|
|
8167
8193
|
}
|
|
8168
|
-
function
|
|
8169
|
-
|
|
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;
|
|
8194
|
+
function readVisibilityField(message, meta) {
|
|
8195
|
+
return readStringField(readRecordField(message, meta, "visibility"));
|
|
8174
8196
|
}
|
|
8175
|
-
function
|
|
8197
|
+
function readTranscriptVisibilityField(message, meta) {
|
|
8176
8198
|
const record = message;
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8199
|
+
return readStringField(record.transcriptVisibility ?? meta?.transcriptVisibility ?? record.visibility ?? meta?.visibility);
|
|
8200
|
+
}
|
|
8201
|
+
var EXPLICIT_HIDDEN_VISIBILITIES = /* @__PURE__ */ new Set(["hidden", "debug", "internal"]);
|
|
8202
|
+
var EXPLICIT_VISIBLE_VISIBILITIES = /* @__PURE__ */ new Set(["visible", "user", "chat"]);
|
|
8203
|
+
var HIDDEN_AUDIENCES = /* @__PURE__ */ new Set(["debug", "trace", "internal"]);
|
|
8204
|
+
var ACTIVITY_SOURCE_SET = new Set(CHAT_MESSAGE_ACTIVITY_SOURCES);
|
|
8205
|
+
var INTERNAL_SOURCE_SET = new Set(CHAT_MESSAGE_INTERNAL_SOURCES);
|
|
8206
|
+
function hasBooleanMarker(message, meta, keys) {
|
|
8207
|
+
const record = message;
|
|
8208
|
+
return keys.some((key) => record[key] === true || meta?.[key] === true);
|
|
8180
8209
|
}
|
|
8181
|
-
function
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
if (isExplicitlyVisibleInTranscript(message, meta)) return true;
|
|
8186
|
-
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
8187
|
-
const kind = resolveChatMessageKind(message);
|
|
8210
|
+
function isActivityKind(kind) {
|
|
8211
|
+
return kind === "thought" || kind === "tool" || kind === "terminal";
|
|
8212
|
+
}
|
|
8213
|
+
function isOrdinaryVisibleTurn(message, role, kind) {
|
|
8188
8214
|
if (role === "user" || role === "human") return kind === "standard" || kind === "";
|
|
8189
8215
|
if (role === "assistant") return kind === "standard" || kind === "";
|
|
8190
8216
|
return false;
|
|
8191
8217
|
}
|
|
8218
|
+
function classifyChatMessageVisibility(message) {
|
|
8219
|
+
if (!message) {
|
|
8220
|
+
return {
|
|
8221
|
+
surface: "internal",
|
|
8222
|
+
isUserFacing: false,
|
|
8223
|
+
isActivityFacing: false,
|
|
8224
|
+
isInternal: true,
|
|
8225
|
+
explicitUserFacing: false,
|
|
8226
|
+
explicitHidden: true,
|
|
8227
|
+
role: "",
|
|
8228
|
+
kind: "standard",
|
|
8229
|
+
visibility: "",
|
|
8230
|
+
transcriptVisibility: "",
|
|
8231
|
+
audience: "",
|
|
8232
|
+
source: ""
|
|
8233
|
+
};
|
|
8234
|
+
}
|
|
8235
|
+
const meta = readMessageMeta(message);
|
|
8236
|
+
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
8237
|
+
const kind = resolveChatMessageKind(message);
|
|
8238
|
+
const visibility = readVisibilityField(message, meta);
|
|
8239
|
+
const transcriptVisibility = readTranscriptVisibilityField(message, meta);
|
|
8240
|
+
const audience = readStringField(readRecordField(message, meta, "audience"));
|
|
8241
|
+
const source = readStringField(readRecordField(message, meta, "source"));
|
|
8242
|
+
const explicitHidden = EXPLICIT_HIDDEN_VISIBILITIES.has(visibility) || EXPLICIT_HIDDEN_VISIBILITIES.has(transcriptVisibility) || HIDDEN_AUDIENCES.has(audience) || hasBooleanMarker(message, meta, ["internal", "isInternal", "debug", "statusOnly", "controlOnly"]);
|
|
8243
|
+
const explicitUserFacing = EXPLICIT_VISIBLE_VISIBILITIES.has(visibility) || EXPLICIT_VISIBLE_VISIBILITIES.has(transcriptVisibility) || audience === "chat" || hasBooleanMarker(message, meta, ["userFacing"]);
|
|
8244
|
+
if (explicitHidden) {
|
|
8245
|
+
const activityLike = isActivityKind(kind) || ACTIVITY_SOURCE_SET.has(source);
|
|
8246
|
+
return {
|
|
8247
|
+
surface: activityLike ? "activity" : "internal",
|
|
8248
|
+
isUserFacing: false,
|
|
8249
|
+
isActivityFacing: activityLike,
|
|
8250
|
+
isInternal: !activityLike,
|
|
8251
|
+
explicitUserFacing,
|
|
8252
|
+
explicitHidden,
|
|
8253
|
+
role,
|
|
8254
|
+
kind,
|
|
8255
|
+
visibility,
|
|
8256
|
+
transcriptVisibility,
|
|
8257
|
+
audience,
|
|
8258
|
+
source
|
|
8259
|
+
};
|
|
8260
|
+
}
|
|
8261
|
+
if (explicitUserFacing) {
|
|
8262
|
+
return {
|
|
8263
|
+
surface: "chat",
|
|
8264
|
+
isUserFacing: true,
|
|
8265
|
+
isActivityFacing: false,
|
|
8266
|
+
isInternal: false,
|
|
8267
|
+
explicitUserFacing,
|
|
8268
|
+
explicitHidden,
|
|
8269
|
+
role,
|
|
8270
|
+
kind,
|
|
8271
|
+
visibility,
|
|
8272
|
+
transcriptVisibility,
|
|
8273
|
+
audience,
|
|
8274
|
+
source
|
|
8275
|
+
};
|
|
8276
|
+
}
|
|
8277
|
+
if (INTERNAL_SOURCE_SET.has(source) || role === "system" || kind === "system") {
|
|
8278
|
+
return {
|
|
8279
|
+
surface: "internal",
|
|
8280
|
+
isUserFacing: false,
|
|
8281
|
+
isActivityFacing: false,
|
|
8282
|
+
isInternal: true,
|
|
8283
|
+
explicitUserFacing,
|
|
8284
|
+
explicitHidden,
|
|
8285
|
+
role,
|
|
8286
|
+
kind,
|
|
8287
|
+
visibility,
|
|
8288
|
+
transcriptVisibility,
|
|
8289
|
+
audience,
|
|
8290
|
+
source
|
|
8291
|
+
};
|
|
8292
|
+
}
|
|
8293
|
+
if (ACTIVITY_SOURCE_SET.has(source) || isActivityKind(kind)) {
|
|
8294
|
+
return {
|
|
8295
|
+
surface: "activity",
|
|
8296
|
+
isUserFacing: false,
|
|
8297
|
+
isActivityFacing: true,
|
|
8298
|
+
isInternal: false,
|
|
8299
|
+
explicitUserFacing,
|
|
8300
|
+
explicitHidden,
|
|
8301
|
+
role,
|
|
8302
|
+
kind,
|
|
8303
|
+
visibility,
|
|
8304
|
+
transcriptVisibility,
|
|
8305
|
+
audience,
|
|
8306
|
+
source
|
|
8307
|
+
};
|
|
8308
|
+
}
|
|
8309
|
+
const isUserFacing = isOrdinaryVisibleTurn(message, role, kind);
|
|
8310
|
+
return {
|
|
8311
|
+
surface: isUserFacing ? "chat" : "internal",
|
|
8312
|
+
isUserFacing,
|
|
8313
|
+
isActivityFacing: false,
|
|
8314
|
+
isInternal: !isUserFacing,
|
|
8315
|
+
explicitUserFacing,
|
|
8316
|
+
explicitHidden,
|
|
8317
|
+
role,
|
|
8318
|
+
kind,
|
|
8319
|
+
visibility,
|
|
8320
|
+
transcriptVisibility,
|
|
8321
|
+
audience,
|
|
8322
|
+
source
|
|
8323
|
+
};
|
|
8324
|
+
}
|
|
8325
|
+
function isUserFacingChatMessage(message) {
|
|
8326
|
+
return classifyChatMessageVisibility(message).isUserFacing;
|
|
8327
|
+
}
|
|
8328
|
+
function isActivityChatMessage(message) {
|
|
8329
|
+
return classifyChatMessageVisibility(message).isActivityFacing;
|
|
8330
|
+
}
|
|
8331
|
+
function isInternalChatMessage(message) {
|
|
8332
|
+
return classifyChatMessageVisibility(message).isInternal;
|
|
8333
|
+
}
|
|
8192
8334
|
function filterUserFacingChatMessages(messages) {
|
|
8193
8335
|
return (Array.isArray(messages) ? messages : []).filter((message) => isUserFacingChatMessage(message));
|
|
8194
8336
|
}
|
|
8337
|
+
function filterActivityChatMessages(messages) {
|
|
8338
|
+
return (Array.isArray(messages) ? messages : []).filter((message) => isActivityChatMessage(message));
|
|
8339
|
+
}
|
|
8340
|
+
function filterInternalChatMessages(messages) {
|
|
8341
|
+
return (Array.isArray(messages) ? messages : []).filter((message) => isInternalChatMessage(message));
|
|
8342
|
+
}
|
|
8343
|
+
function filterChatMessagesByVisibility(messages, surface) {
|
|
8344
|
+
return (Array.isArray(messages) ? messages : []).filter((message) => classifyChatMessageVisibility(message).surface === surface);
|
|
8345
|
+
}
|
|
8195
8346
|
|
|
8196
8347
|
// src/providers/control-effects.ts
|
|
8197
8348
|
function extractProviderControlValues(controls, data) {
|
|
@@ -23193,7 +23344,8 @@ function prepareSessionChatTailUpdate(input) {
|
|
|
23193
23344
|
update: null
|
|
23194
23345
|
};
|
|
23195
23346
|
}
|
|
23196
|
-
const
|
|
23347
|
+
const fullMessages = normalizeChatMessages(Array.isArray(result.messages) ? result.messages : []);
|
|
23348
|
+
const messages = filterUserFacingChatMessages(fullMessages);
|
|
23197
23349
|
const title = typeof result.title === "string" ? result.title : void 0;
|
|
23198
23350
|
const activeModal = normalizeChatTailActiveModal(result.activeModal);
|
|
23199
23351
|
const status = typeof result.status === "string" ? result.status : "idle";
|
|
@@ -30811,6 +30963,12 @@ async function shutdownDaemonComponents(components) {
|
|
|
30811
30963
|
AcpProviderInstance,
|
|
30812
30964
|
AgentStreamPoller,
|
|
30813
30965
|
BUILTIN_CHAT_MESSAGE_KINDS,
|
|
30966
|
+
CHAT_MESSAGE_ACTIVITY_SOURCES,
|
|
30967
|
+
CHAT_MESSAGE_AUDIENCES,
|
|
30968
|
+
CHAT_MESSAGE_INTERNAL_SOURCES,
|
|
30969
|
+
CHAT_MESSAGE_SOURCES,
|
|
30970
|
+
CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES,
|
|
30971
|
+
CHAT_MESSAGE_VISIBILITIES,
|
|
30814
30972
|
CdpDomHandlers,
|
|
30815
30973
|
CliProviderInstance,
|
|
30816
30974
|
DAEMON_WS_PATH,
|
|
@@ -30873,6 +31031,7 @@ async function shutdownDaemonComponents(components) {
|
|
|
30873
31031
|
buildThoughtChatMessage,
|
|
30874
31032
|
buildToolChatMessage,
|
|
30875
31033
|
buildUserChatMessage,
|
|
31034
|
+
classifyChatMessageVisibility,
|
|
30876
31035
|
classifyHotChatSessionsForSubscriptionFlush,
|
|
30877
31036
|
clearDebugTrace,
|
|
30878
31037
|
compareGitSnapshots,
|
|
@@ -30892,6 +31051,9 @@ async function shutdownDaemonComponents(components) {
|
|
|
30892
31051
|
detectIDEs,
|
|
30893
31052
|
ensureSessionHostReady,
|
|
30894
31053
|
execNpmCommandSync,
|
|
31054
|
+
filterActivityChatMessages,
|
|
31055
|
+
filterChatMessagesByVisibility,
|
|
31056
|
+
filterInternalChatMessages,
|
|
30895
31057
|
filterUserFacingChatMessages,
|
|
30896
31058
|
findCdpManager,
|
|
30897
31059
|
flattenMessageParts,
|
|
@@ -30923,11 +31085,13 @@ async function shutdownDaemonComponents(components) {
|
|
|
30923
31085
|
initDaemonComponents,
|
|
30924
31086
|
installExtensions,
|
|
30925
31087
|
installGlobalInterceptor,
|
|
31088
|
+
isActivityChatMessage,
|
|
30926
31089
|
isBuiltinChatMessageKind,
|
|
30927
31090
|
isCdpConnected,
|
|
30928
31091
|
isExtensionInstalled,
|
|
30929
31092
|
isGitCommandName,
|
|
30930
31093
|
isIdeRunning,
|
|
31094
|
+
isInternalChatMessage,
|
|
30931
31095
|
isManagedStatusWaiting,
|
|
30932
31096
|
isManagedStatusWorking,
|
|
30933
31097
|
isPathInside,
|