@adhdev/daemon-core 0.9.43 → 0.9.44
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/cli-adapters/provider-cli-adapter.d.ts +1 -0
- package/dist/index.js +68 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -5
- package/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +80 -3
package/dist/index.mjs
CHANGED
|
@@ -2055,7 +2055,8 @@ var provider_cli_adapter_exports = {};
|
|
|
2055
2055
|
__export(provider_cli_adapter_exports, {
|
|
2056
2056
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
2057
2057
|
appendBoundedText: () => appendBoundedText,
|
|
2058
|
-
normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
|
|
2058
|
+
normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
|
|
2059
|
+
sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent
|
|
2059
2060
|
});
|
|
2060
2061
|
import * as os10 from "os";
|
|
2061
2062
|
function normalizeComparableTranscriptText(value) {
|
|
@@ -2096,7 +2097,63 @@ function appendBoundedText(current, chunk, maxChars) {
|
|
|
2096
2097
|
if (current.length <= keepFromCurrent) return current + chunk;
|
|
2097
2098
|
return current.slice(-keepFromCurrent) + chunk;
|
|
2098
2099
|
}
|
|
2099
|
-
|
|
2100
|
+
function isLikelyCommittedActivityPrefixContinuation(line) {
|
|
2101
|
+
const trimmed = String(line || "").trim();
|
|
2102
|
+
if (!trimmed) return false;
|
|
2103
|
+
if (COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(trimmed)) return false;
|
|
2104
|
+
if (/\s/.test(trimmed)) return false;
|
|
2105
|
+
if (/[가-힣]/.test(trimmed)) return false;
|
|
2106
|
+
if (trimmed.length > 96) return false;
|
|
2107
|
+
return /^[A-Za-z0-9_./:@+%=-]+$/.test(trimmed);
|
|
2108
|
+
}
|
|
2109
|
+
function parseCommittedActivityPrefixBlock(lines, index) {
|
|
2110
|
+
const first = String(lines[index] || "").trim();
|
|
2111
|
+
if (!COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(first)) return null;
|
|
2112
|
+
const parts = [first];
|
|
2113
|
+
let nextIndex = index + 1;
|
|
2114
|
+
while (nextIndex < lines.length && isLikelyCommittedActivityPrefixContinuation(lines[nextIndex])) {
|
|
2115
|
+
parts.push(String(lines[nextIndex] || "").trim());
|
|
2116
|
+
nextIndex += 1;
|
|
2117
|
+
}
|
|
2118
|
+
return { label: parts.join(""), nextIndex };
|
|
2119
|
+
}
|
|
2120
|
+
function sanitizeCliStandardMessageContent(content) {
|
|
2121
|
+
const source = String(content || "").trim();
|
|
2122
|
+
if (!source) return "";
|
|
2123
|
+
const lines = source.split(/\r?\n/);
|
|
2124
|
+
if (lines.length < 4) return source;
|
|
2125
|
+
const counts = /* @__PURE__ */ new Map();
|
|
2126
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
2127
|
+
const block = parseCommittedActivityPrefixBlock(lines, index);
|
|
2128
|
+
if (!block) continue;
|
|
2129
|
+
counts.set(block.label, (counts.get(block.label) || 0) + 1);
|
|
2130
|
+
index = block.nextIndex - 1;
|
|
2131
|
+
}
|
|
2132
|
+
const repeatedLabels = new Set(
|
|
2133
|
+
Array.from(counts.entries()).filter(([, count]) => count >= 3).map(([label]) => label)
|
|
2134
|
+
);
|
|
2135
|
+
if (repeatedLabels.size === 0) return source;
|
|
2136
|
+
const stripped = [];
|
|
2137
|
+
let removed = 0;
|
|
2138
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
2139
|
+
const block = parseCommittedActivityPrefixBlock(lines, index);
|
|
2140
|
+
if (block && repeatedLabels.has(block.label)) {
|
|
2141
|
+
removed += 1;
|
|
2142
|
+
index = block.nextIndex - 1;
|
|
2143
|
+
continue;
|
|
2144
|
+
}
|
|
2145
|
+
stripped.push(lines[index]);
|
|
2146
|
+
}
|
|
2147
|
+
const next = stripped.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
2148
|
+
return removed >= 3 && next.length >= 80 ? next : source;
|
|
2149
|
+
}
|
|
2150
|
+
function sanitizeCommittedMessageForDisplay(message) {
|
|
2151
|
+
if (!message || message.role !== "assistant" || (message.kind || "standard") !== "standard") return message;
|
|
2152
|
+
const content = sanitizeCliStandardMessageContent(message.content);
|
|
2153
|
+
if (content === message.content) return message;
|
|
2154
|
+
return { ...message, content };
|
|
2155
|
+
}
|
|
2156
|
+
var COMMITTED_ACTIVITY_PREFIX_BLOCK_RE, ProviderCliAdapter;
|
|
2100
2157
|
var init_provider_cli_adapter = __esm({
|
|
2101
2158
|
"src/cli-adapters/provider-cli-adapter.ts"() {
|
|
2102
2159
|
"use strict";
|
|
@@ -2111,6 +2168,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2111
2168
|
init_provider_cli_config();
|
|
2112
2169
|
init_provider_cli_runtime();
|
|
2113
2170
|
init_provider_cli_shared();
|
|
2171
|
+
COMMITTED_ACTIVITY_PREFIX_BLOCK_RE = /^(?:📖|💻|🔎|📚|📋|✏️|📝|🔧|🛠️|⚙️)\s+(.+)$/;
|
|
2114
2172
|
ProviderCliAdapter = class _ProviderCliAdapter {
|
|
2115
2173
|
constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
|
|
2116
2174
|
this.extraArgs = extraArgs;
|
|
@@ -2322,7 +2380,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
2322
2380
|
const tailFirst = parseBaseMessages[0];
|
|
2323
2381
|
if (tailFirst && this.messagesComparable(parsedFirst, tailFirst)) {
|
|
2324
2382
|
const prefixLength = fullBaseMessages.length - parseBaseMessages.length;
|
|
2325
|
-
|
|
2383
|
+
const prefix = fullBaseMessages.slice(0, prefixLength);
|
|
2384
|
+
const shouldSanitizePrefix = !!this.currentTurnScope || this.currentStatus !== "idle" || !!this.activeModal;
|
|
2385
|
+
const nextPrefix = shouldSanitizePrefix ? prefix.map((message) => sanitizeCommittedMessageForDisplay(message)) : prefix;
|
|
2386
|
+
return [...nextPrefix, ...parsedMessages];
|
|
2326
2387
|
}
|
|
2327
2388
|
return [...fullBaseMessages, ...parsedMessages];
|
|
2328
2389
|
}
|
|
@@ -3521,10 +3582,12 @@ var init_provider_cli_adapter = __esm({
|
|
|
3521
3582
|
}
|
|
3522
3583
|
buildCommittedChatMessages() {
|
|
3523
3584
|
return this.committedMessages.map((message, index) => {
|
|
3524
|
-
const
|
|
3585
|
+
const rawContentValue = message.content;
|
|
3586
|
+
const rawContent = typeof rawContentValue === "string" ? rawContentValue : String(rawContentValue || "");
|
|
3587
|
+
const content = message.role === "assistant" && (message.kind || "standard") === "standard" ? sanitizeCliStandardMessageContent(rawContent) : rawContent;
|
|
3525
3588
|
return buildChatMessage({
|
|
3526
3589
|
role: message.role,
|
|
3527
|
-
content
|
|
3590
|
+
content,
|
|
3528
3591
|
timestamp: message.timestamp,
|
|
3529
3592
|
kind: message.kind,
|
|
3530
3593
|
meta: message.meta,
|