@adhdev/daemon-core 0.9.76-rc.53 → 0.9.76-rc.55
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 +1 -1
- package/dist/index.js +76 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +13 -3
- package/src/index.ts +2 -0
- package/src/providers/cli-provider-instance.ts +41 -4
package/dist/index.mjs
CHANGED
|
@@ -7956,6 +7956,34 @@ function normalizeChatMessage(message) {
|
|
|
7956
7956
|
function normalizeChatMessages(messages) {
|
|
7957
7957
|
return (Array.isArray(messages) ? messages : []).map((message) => normalizeChatMessage(message));
|
|
7958
7958
|
}
|
|
7959
|
+
function readMessageMeta(message) {
|
|
7960
|
+
const meta = message?.meta;
|
|
7961
|
+
return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : null;
|
|
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;
|
|
7967
|
+
}
|
|
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;
|
|
7972
|
+
}
|
|
7973
|
+
function isUserFacingChatMessage(message) {
|
|
7974
|
+
if (!message) return false;
|
|
7975
|
+
const meta = readMessageMeta(message);
|
|
7976
|
+
if (isExplicitlyHiddenFromTranscript(meta)) return false;
|
|
7977
|
+
if (isExplicitlyVisibleInTranscript(meta)) return true;
|
|
7978
|
+
const role = typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
7979
|
+
const kind = resolveChatMessageKind(message);
|
|
7980
|
+
if (role === "user" || role === "human") return kind === "standard" || kind === "";
|
|
7981
|
+
if (role === "assistant") return kind === "standard" || kind === "";
|
|
7982
|
+
return false;
|
|
7983
|
+
}
|
|
7984
|
+
function filterUserFacingChatMessages(messages) {
|
|
7985
|
+
return (Array.isArray(messages) ? messages : []).filter((message) => isUserFacingChatMessage(message));
|
|
7986
|
+
}
|
|
7959
7987
|
|
|
7960
7988
|
// src/providers/control-effects.ts
|
|
7961
7989
|
function extractProviderControlValues(controls, data) {
|
|
@@ -11835,7 +11863,7 @@ function normalizeReadChatTailLimit(args) {
|
|
|
11835
11863
|
}
|
|
11836
11864
|
function normalizeReadChatMessages(payload) {
|
|
11837
11865
|
const messages = Array.isArray(payload.messages) ? payload.messages : [];
|
|
11838
|
-
return messages;
|
|
11866
|
+
return normalizeChatMessages(messages);
|
|
11839
11867
|
}
|
|
11840
11868
|
function deriveHistoryDedupKey(message) {
|
|
11841
11869
|
const unitKey = typeof message._unitKey === "string" ? message._unitKey.trim() : "";
|
|
@@ -11929,13 +11957,22 @@ function buildReadChatCommandResult(payload, args) {
|
|
|
11929
11957
|
return { success: false, error: error?.message || String(error) };
|
|
11930
11958
|
}
|
|
11931
11959
|
const messages = normalizeReadChatMessages(validatedPayload);
|
|
11932
|
-
const
|
|
11960
|
+
const visibleMessages = filterUserFacingChatMessages(messages);
|
|
11961
|
+
const sync = buildFullTail(visibleMessages, normalizeReadChatTailLimit(args));
|
|
11962
|
+
const hiddenMsgCount = Math.max(0, messages.length - visibleMessages.length);
|
|
11963
|
+
const nextDebugReadChat = {
|
|
11964
|
+
...debugReadChat || {},
|
|
11965
|
+
fullMsgCount: messages.length,
|
|
11966
|
+
visibleMsgCount: visibleMessages.length,
|
|
11967
|
+
hiddenMsgCount,
|
|
11968
|
+
returnedMsgCount: sync.messages.length
|
|
11969
|
+
};
|
|
11933
11970
|
return {
|
|
11934
11971
|
success: true,
|
|
11935
11972
|
...validatedPayload,
|
|
11936
11973
|
messages: sync.messages,
|
|
11937
11974
|
totalMessages: sync.totalMessages,
|
|
11938
|
-
|
|
11975
|
+
debugReadChat: nextDebugReadChat
|
|
11939
11976
|
};
|
|
11940
11977
|
}
|
|
11941
11978
|
var DEFAULT_DEBUG_SANITIZE_OPTIONS = {
|
|
@@ -15558,16 +15595,47 @@ ${effect.notification.body || ""}`.trim();
|
|
|
15558
15595
|
const runtimeEntries = this.runtimeMessages.map((entry, index) => ({
|
|
15559
15596
|
message: entry.message,
|
|
15560
15597
|
index: parsedMessages.length + index,
|
|
15561
|
-
source: "runtime"
|
|
15598
|
+
source: "runtime",
|
|
15599
|
+
runtimeKey: entry.key
|
|
15562
15600
|
}));
|
|
15563
15601
|
const getTime = (message) => {
|
|
15564
15602
|
const value = typeof message.receivedAt === "number" ? message.receivedAt : typeof message.timestamp === "number" ? message.timestamp : 0;
|
|
15565
15603
|
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
15566
15604
|
};
|
|
15605
|
+
const getRole = (message) => typeof message.role === "string" ? message.role.trim().toLowerCase() : "";
|
|
15606
|
+
const isAutoApprovalRuntimeOverlay = (entry) => {
|
|
15607
|
+
if (entry.source !== "runtime") return false;
|
|
15608
|
+
const key = typeof entry.runtimeKey === "string" ? entry.runtimeKey.trim().toLowerCase() : "";
|
|
15609
|
+
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:");
|
|
15612
|
+
};
|
|
15613
|
+
const shouldKeepParsedBeforeUntimedRuntime = (message) => {
|
|
15614
|
+
const role = getRole(message);
|
|
15615
|
+
return role === "user" || role === "human";
|
|
15616
|
+
};
|
|
15617
|
+
const shouldKeepParsedAfterUntimedRuntime = (message) => {
|
|
15618
|
+
const role = getRole(message);
|
|
15619
|
+
if (role !== "assistant") return false;
|
|
15620
|
+
const kind = resolveChatMessageKind(message);
|
|
15621
|
+
return kind === "standard" || kind === "terminal";
|
|
15622
|
+
};
|
|
15567
15623
|
return normalizeChatMessages([...parsedEntries, ...runtimeEntries].sort((a, b) => {
|
|
15568
15624
|
const aTime = getTime(a.message);
|
|
15569
15625
|
const bTime = getTime(b.message);
|
|
15570
15626
|
if (aTime && bTime && aTime !== bTime) return aTime - bTime;
|
|
15627
|
+
if (a.source !== b.source && aTime !== bTime) {
|
|
15628
|
+
const parsedEntry = a.source === "parsed" ? a : b.source === "parsed" ? b : null;
|
|
15629
|
+
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) {
|
|
15631
|
+
if (shouldKeepParsedBeforeUntimedRuntime(parsedEntry.message)) {
|
|
15632
|
+
return a.source === "parsed" ? -1 : 1;
|
|
15633
|
+
}
|
|
15634
|
+
if (shouldKeepParsedAfterUntimedRuntime(parsedEntry.message)) {
|
|
15635
|
+
return a.source === "parsed" ? 1 : -1;
|
|
15636
|
+
}
|
|
15637
|
+
}
|
|
15638
|
+
}
|
|
15571
15639
|
return a.index - b.index;
|
|
15572
15640
|
}).map((entry) => entry.message));
|
|
15573
15641
|
}
|
|
@@ -30618,6 +30686,7 @@ export {
|
|
|
30618
30686
|
detectIDEs,
|
|
30619
30687
|
ensureSessionHostReady,
|
|
30620
30688
|
execNpmCommandSync,
|
|
30689
|
+
filterUserFacingChatMessages,
|
|
30621
30690
|
findCdpManager,
|
|
30622
30691
|
flattenMessageParts,
|
|
30623
30692
|
forwardAgentStreamsToIdeInstance,
|
|
@@ -30659,6 +30728,7 @@ export {
|
|
|
30659
30728
|
isSessionHostLiveRuntime,
|
|
30660
30729
|
isSessionHostRecoverySnapshot,
|
|
30661
30730
|
isSetupComplete,
|
|
30731
|
+
isUserFacingChatMessage,
|
|
30662
30732
|
killIdeProcess,
|
|
30663
30733
|
launchIDE,
|
|
30664
30734
|
launchWithCdp,
|