adhdev 0.9.52 → 0.9.53
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 +37 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +37 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4556,6 +4556,10 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
|
|
|
4556
4556
|
persistedEntries: nextPersistedEntries
|
|
4557
4557
|
};
|
|
4558
4558
|
}
|
|
4559
|
+
function normalizePaginationNumber(value, fallback2, min) {
|
|
4560
|
+
const numeric = Number(value);
|
|
4561
|
+
return Number.isFinite(numeric) ? Math.max(min, numeric) : fallback2;
|
|
4562
|
+
}
|
|
4559
4563
|
function pageHistoryRecords(agentType, records, offset = 0, limit = 30, excludeRecentCount = 0, historyBehavior) {
|
|
4560
4564
|
const allMessages = records.map((message) => sanitizeHistoryMessage(agentType, message)).filter(Boolean);
|
|
4561
4565
|
allMessages.sort((a, b) => a.receivedAt - b.receivedAt);
|
|
@@ -4569,9 +4573,12 @@ function pageHistoryRecords(agentType, records, offset = 0, limit = 30, excludeR
|
|
|
4569
4573
|
if (message.role !== "system") lastTurn = message;
|
|
4570
4574
|
}
|
|
4571
4575
|
const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
|
|
4572
|
-
const boundedLimit =
|
|
4573
|
-
const boundedOffset =
|
|
4574
|
-
const boundedExclude = Math.
|
|
4576
|
+
const boundedLimit = normalizePaginationNumber(limit, 30, 1);
|
|
4577
|
+
const boundedOffset = normalizePaginationNumber(offset, 0, 0);
|
|
4578
|
+
const boundedExclude = Math.min(
|
|
4579
|
+
normalizePaginationNumber(excludeRecentCount, 0, 0),
|
|
4580
|
+
collapsed.length
|
|
4581
|
+
);
|
|
4575
4582
|
const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
|
|
4576
4583
|
const startInclusive = Math.max(0, endExclusive - boundedLimit);
|
|
4577
4584
|
const sliced = collapsed.slice(startInclusive, endExclusive);
|
|
@@ -8432,6 +8439,28 @@ function getStateLastSignature(state) {
|
|
|
8432
8439
|
if (!last) return "";
|
|
8433
8440
|
return `${last.role || ""}:${String(last.content || "").replace(/\s+/g, " ").trim()}`;
|
|
8434
8441
|
}
|
|
8442
|
+
function toNonNegativeNumber(value) {
|
|
8443
|
+
const numeric = Number(value ?? 0);
|
|
8444
|
+
return Number.isFinite(numeric) ? Math.max(0, numeric) : 0;
|
|
8445
|
+
}
|
|
8446
|
+
function getCliVisibleTranscriptCount(adapter) {
|
|
8447
|
+
const adapterStatus = adapter?.getStatus?.() || {};
|
|
8448
|
+
const adapterMessages = Array.isArray(adapterStatus.messages) ? adapterStatus.messages : [];
|
|
8449
|
+
let parsedRecord = null;
|
|
8450
|
+
if (typeof adapter?.getScriptParsedStatus === "function") {
|
|
8451
|
+
try {
|
|
8452
|
+
const parsed = parseMaybeJson(adapter.getScriptParsedStatus());
|
|
8453
|
+
parsedRecord = parsed && typeof parsed === "object" ? parsed : null;
|
|
8454
|
+
} catch {
|
|
8455
|
+
parsedRecord = null;
|
|
8456
|
+
}
|
|
8457
|
+
}
|
|
8458
|
+
const parsedMessages = Array.isArray(parsedRecord?.messages) ? parsedRecord.messages : [];
|
|
8459
|
+
if (!parsedRecord) return adapterMessages.length;
|
|
8460
|
+
const parsedIsProviderAuthoritative = parsedRecord.transcriptAuthority === "provider" || parsedRecord.coverage === "full";
|
|
8461
|
+
const shouldPreferAdapterMessages = !parsedIsProviderAuthoritative && adapterMessages.length > 0 && adapterMessages.length > parsedMessages.length;
|
|
8462
|
+
return shouldPreferAdapterMessages ? adapterMessages.length : parsedMessages.length;
|
|
8463
|
+
}
|
|
8435
8464
|
async function getStableExtensionBaseline(h) {
|
|
8436
8465
|
const first = await readExtensionChatState(h);
|
|
8437
8466
|
if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
|
|
@@ -8460,11 +8489,11 @@ async function handleChatHistory(h, args) {
|
|
|
8460
8489
|
const provider = h.getProvider(agentType);
|
|
8461
8490
|
const agentStr = provider?.type || agentType || getCurrentProviderType(h);
|
|
8462
8491
|
const transport = getTargetTransport(h, provider);
|
|
8463
|
-
|
|
8464
|
-
|
|
8492
|
+
const hasExplicitExcludeRecentCount = args?.excludeRecentCount !== void 0 && args?.excludeRecentCount !== null;
|
|
8493
|
+
let excludeRecentCount = toNonNegativeNumber(args?.excludeRecentCount);
|
|
8494
|
+
if (!hasExplicitExcludeRecentCount && isCliLikeTransport(transport)) {
|
|
8465
8495
|
const adapter = getTargetedCliAdapter(h, args, provider?.type);
|
|
8466
|
-
const
|
|
8467
|
-
const visibleCount = Array.isArray(status?.messages) ? status.messages.length : 0;
|
|
8496
|
+
const visibleCount = getCliVisibleTranscriptCount(adapter);
|
|
8468
8497
|
if (visibleCount > excludeRecentCount) excludeRecentCount = visibleCount;
|
|
8469
8498
|
}
|
|
8470
8499
|
const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
|
|
@@ -88532,7 +88561,7 @@ var init_adhdev_daemon = __esm({
|
|
|
88532
88561
|
init_version();
|
|
88533
88562
|
init_src();
|
|
88534
88563
|
init_runtime_defaults();
|
|
88535
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
88564
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.53" });
|
|
88536
88565
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
88537
88566
|
localHttpServer = null;
|
|
88538
88567
|
localWss = null;
|