adhdev 0.9.42 → 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/index.js +99 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +99 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -12774,7 +12774,8 @@ var provider_cli_adapter_exports = {};
|
|
|
12774
12774
|
__export(provider_cli_adapter_exports, {
|
|
12775
12775
|
ProviderCliAdapter: () => ProviderCliAdapter,
|
|
12776
12776
|
appendBoundedText: () => appendBoundedText,
|
|
12777
|
-
normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime
|
|
12777
|
+
normalizeCliProviderForRuntime: () => normalizeCliProviderForRuntime,
|
|
12778
|
+
sanitizeCliStandardMessageContent: () => sanitizeCliStandardMessageContent
|
|
12778
12779
|
});
|
|
12779
12780
|
function normalizeComparableTranscriptText(value) {
|
|
12780
12781
|
return sanitizeTerminalText(String(value || "")).replace(/\s+/g, " ").trim();
|
|
@@ -12814,7 +12815,63 @@ function appendBoundedText(current, chunk, maxChars) {
|
|
|
12814
12815
|
if (current.length <= keepFromCurrent) return current + chunk;
|
|
12815
12816
|
return current.slice(-keepFromCurrent) + chunk;
|
|
12816
12817
|
}
|
|
12817
|
-
|
|
12818
|
+
function isLikelyCommittedActivityPrefixContinuation(line) {
|
|
12819
|
+
const trimmed = String(line || "").trim();
|
|
12820
|
+
if (!trimmed) return false;
|
|
12821
|
+
if (COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(trimmed)) return false;
|
|
12822
|
+
if (/\s/.test(trimmed)) return false;
|
|
12823
|
+
if (/[가-힣]/.test(trimmed)) return false;
|
|
12824
|
+
if (trimmed.length > 96) return false;
|
|
12825
|
+
return /^[A-Za-z0-9_./:@+%=-]+$/.test(trimmed);
|
|
12826
|
+
}
|
|
12827
|
+
function parseCommittedActivityPrefixBlock(lines, index) {
|
|
12828
|
+
const first = String(lines[index] || "").trim();
|
|
12829
|
+
if (!COMMITTED_ACTIVITY_PREFIX_BLOCK_RE.test(first)) return null;
|
|
12830
|
+
const parts = [first];
|
|
12831
|
+
let nextIndex = index + 1;
|
|
12832
|
+
while (nextIndex < lines.length && isLikelyCommittedActivityPrefixContinuation(lines[nextIndex])) {
|
|
12833
|
+
parts.push(String(lines[nextIndex] || "").trim());
|
|
12834
|
+
nextIndex += 1;
|
|
12835
|
+
}
|
|
12836
|
+
return { label: parts.join(""), nextIndex };
|
|
12837
|
+
}
|
|
12838
|
+
function sanitizeCliStandardMessageContent(content) {
|
|
12839
|
+
const source = String(content || "").trim();
|
|
12840
|
+
if (!source) return "";
|
|
12841
|
+
const lines = source.split(/\r?\n/);
|
|
12842
|
+
if (lines.length < 4) return source;
|
|
12843
|
+
const counts = /* @__PURE__ */ new Map();
|
|
12844
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
12845
|
+
const block = parseCommittedActivityPrefixBlock(lines, index);
|
|
12846
|
+
if (!block) continue;
|
|
12847
|
+
counts.set(block.label, (counts.get(block.label) || 0) + 1);
|
|
12848
|
+
index = block.nextIndex - 1;
|
|
12849
|
+
}
|
|
12850
|
+
const repeatedLabels = new Set(
|
|
12851
|
+
Array.from(counts.entries()).filter(([, count]) => count >= 3).map(([label]) => label)
|
|
12852
|
+
);
|
|
12853
|
+
if (repeatedLabels.size === 0) return source;
|
|
12854
|
+
const stripped = [];
|
|
12855
|
+
let removed = 0;
|
|
12856
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
12857
|
+
const block = parseCommittedActivityPrefixBlock(lines, index);
|
|
12858
|
+
if (block && repeatedLabels.has(block.label)) {
|
|
12859
|
+
removed += 1;
|
|
12860
|
+
index = block.nextIndex - 1;
|
|
12861
|
+
continue;
|
|
12862
|
+
}
|
|
12863
|
+
stripped.push(lines[index]);
|
|
12864
|
+
}
|
|
12865
|
+
const next = stripped.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
12866
|
+
return removed >= 3 && next.length >= 80 ? next : source;
|
|
12867
|
+
}
|
|
12868
|
+
function sanitizeCommittedMessageForDisplay(message) {
|
|
12869
|
+
if (!message || message.role !== "assistant" || (message.kind || "standard") !== "standard") return message;
|
|
12870
|
+
const content = sanitizeCliStandardMessageContent(message.content);
|
|
12871
|
+
if (content === message.content) return message;
|
|
12872
|
+
return { ...message, content };
|
|
12873
|
+
}
|
|
12874
|
+
var os13, COMMITTED_ACTIVITY_PREFIX_BLOCK_RE, ProviderCliAdapter;
|
|
12818
12875
|
var init_provider_cli_adapter = __esm({
|
|
12819
12876
|
"../../oss/packages/daemon-core/src/cli-adapters/provider-cli-adapter.ts"() {
|
|
12820
12877
|
"use strict";
|
|
@@ -12830,6 +12887,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
12830
12887
|
init_provider_cli_config();
|
|
12831
12888
|
init_provider_cli_runtime();
|
|
12832
12889
|
init_provider_cli_shared();
|
|
12890
|
+
COMMITTED_ACTIVITY_PREFIX_BLOCK_RE = /^(?:📖|💻|🔎|📚|📋|✏️|📝|🔧|🛠️|⚙️)\s+(.+)$/;
|
|
12833
12891
|
ProviderCliAdapter = class _ProviderCliAdapter {
|
|
12834
12892
|
constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
|
|
12835
12893
|
this.extraArgs = extraArgs;
|
|
@@ -13041,7 +13099,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
13041
13099
|
const tailFirst = parseBaseMessages[0];
|
|
13042
13100
|
if (tailFirst && this.messagesComparable(parsedFirst, tailFirst)) {
|
|
13043
13101
|
const prefixLength = fullBaseMessages.length - parseBaseMessages.length;
|
|
13044
|
-
|
|
13102
|
+
const prefix = fullBaseMessages.slice(0, prefixLength);
|
|
13103
|
+
const shouldSanitizePrefix = !!this.currentTurnScope || this.currentStatus !== "idle" || !!this.activeModal;
|
|
13104
|
+
const nextPrefix = shouldSanitizePrefix ? prefix.map((message) => sanitizeCommittedMessageForDisplay(message)) : prefix;
|
|
13105
|
+
return [...nextPrefix, ...parsedMessages];
|
|
13045
13106
|
}
|
|
13046
13107
|
return [...fullBaseMessages, ...parsedMessages];
|
|
13047
13108
|
}
|
|
@@ -14240,10 +14301,12 @@ var init_provider_cli_adapter = __esm({
|
|
|
14240
14301
|
}
|
|
14241
14302
|
buildCommittedChatMessages() {
|
|
14242
14303
|
return this.committedMessages.map((message, index) => {
|
|
14243
|
-
const
|
|
14304
|
+
const rawContentValue = message.content;
|
|
14305
|
+
const rawContent = typeof rawContentValue === "string" ? rawContentValue : String(rawContentValue || "");
|
|
14306
|
+
const content = message.role === "assistant" && (message.kind || "standard") === "standard" ? sanitizeCliStandardMessageContent(rawContent) : rawContent;
|
|
14244
14307
|
return buildChatMessage({
|
|
14245
14308
|
role: message.role,
|
|
14246
|
-
content
|
|
14309
|
+
content,
|
|
14247
14310
|
timestamp: message.timestamp,
|
|
14248
14311
|
kind: message.kind,
|
|
14249
14312
|
meta: message.meta,
|
|
@@ -79728,8 +79791,12 @@ function sendToPeer(peer, data) {
|
|
|
79728
79791
|
}
|
|
79729
79792
|
return false;
|
|
79730
79793
|
}
|
|
79794
|
+
const json2 = JSON.stringify(data);
|
|
79795
|
+
if (messageType === "command_result" && json2.length > MAX_INLINE_JSON_MESSAGE_CHARS) {
|
|
79796
|
+
return sendChunkedCommandResult(peer, peerId, requestId, json2);
|
|
79797
|
+
}
|
|
79731
79798
|
try {
|
|
79732
|
-
peer.dataChannel.sendMessage(
|
|
79799
|
+
peer.dataChannel.sendMessage(json2);
|
|
79733
79800
|
return true;
|
|
79734
79801
|
} catch (error48) {
|
|
79735
79802
|
if (messageType === "command_result") {
|
|
@@ -79738,6 +79805,28 @@ function sendToPeer(peer, data) {
|
|
|
79738
79805
|
return false;
|
|
79739
79806
|
}
|
|
79740
79807
|
}
|
|
79808
|
+
function sendChunkedCommandResult(peer, peerId, requestId, json2) {
|
|
79809
|
+
const chunkId = requestId || `command_result_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
79810
|
+
const total = Math.ceil(json2.length / JSON_CHUNK_PAYLOAD_CHARS);
|
|
79811
|
+
logDebug(`command_result chunked: peer=${peerId} id=${requestId || "-"} chars=${json2.length} chunks=${total}`);
|
|
79812
|
+
for (let index = 0; index < total; index += 1) {
|
|
79813
|
+
const chunk = json2.slice(index * JSON_CHUNK_PAYLOAD_CHARS, (index + 1) * JSON_CHUNK_PAYLOAD_CHARS);
|
|
79814
|
+
try {
|
|
79815
|
+
peer.dataChannel?.sendMessage(JSON.stringify({
|
|
79816
|
+
type: "command_result_chunk",
|
|
79817
|
+
id: requestId,
|
|
79818
|
+
chunkId,
|
|
79819
|
+
index,
|
|
79820
|
+
total,
|
|
79821
|
+
data: chunk
|
|
79822
|
+
}));
|
|
79823
|
+
} catch (error48) {
|
|
79824
|
+
log(`command_result send failed: peer=${peerId} id=${requestId || "-"} chunk=${index + 1}/${total} error=${error48?.message || error48}`);
|
|
79825
|
+
return false;
|
|
79826
|
+
}
|
|
79827
|
+
}
|
|
79828
|
+
return true;
|
|
79829
|
+
}
|
|
79741
79830
|
function routeDataChannelMessage(peerId, msg, peers, handlers) {
|
|
79742
79831
|
const text = typeof msg === "string" ? msg : msg.toString("utf-8");
|
|
79743
79832
|
try {
|
|
@@ -80018,11 +80107,14 @@ async function handleFileRequest(peerId, req, peers, handlers) {
|
|
|
80018
80107
|
}
|
|
80019
80108
|
sendToPeer(peer, response);
|
|
80020
80109
|
}
|
|
80110
|
+
var MAX_INLINE_JSON_MESSAGE_CHARS, JSON_CHUNK_PAYLOAD_CHARS;
|
|
80021
80111
|
var init_data_channel_router = __esm({
|
|
80022
80112
|
"src/daemon-p2p/data-channel-router.ts"() {
|
|
80023
80113
|
"use strict";
|
|
80024
80114
|
init_permission();
|
|
80025
80115
|
init_log();
|
|
80116
|
+
MAX_INLINE_JSON_MESSAGE_CHARS = 6e4;
|
|
80117
|
+
JSON_CHUNK_PAYLOAD_CHARS = 32e3;
|
|
80026
80118
|
}
|
|
80027
80119
|
});
|
|
80028
80120
|
|
|
@@ -88411,7 +88503,7 @@ var init_adhdev_daemon = __esm({
|
|
|
88411
88503
|
init_version();
|
|
88412
88504
|
init_src();
|
|
88413
88505
|
init_runtime_defaults();
|
|
88414
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
88506
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.44" });
|
|
88415
88507
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
88416
88508
|
localHttpServer = null;
|
|
88417
88509
|
localWss = null;
|