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/index.js
CHANGED
|
@@ -4036,6 +4036,10 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
|
|
|
4036
4036
|
persistedEntries: nextPersistedEntries
|
|
4037
4037
|
};
|
|
4038
4038
|
}
|
|
4039
|
+
function normalizePaginationNumber(value, fallback2, min) {
|
|
4040
|
+
const numeric = Number(value);
|
|
4041
|
+
return Number.isFinite(numeric) ? Math.max(min, numeric) : fallback2;
|
|
4042
|
+
}
|
|
4039
4043
|
function pageHistoryRecords(agentType, records, offset = 0, limit = 30, excludeRecentCount = 0, historyBehavior) {
|
|
4040
4044
|
const allMessages = records.map((message) => sanitizeHistoryMessage(agentType, message)).filter(Boolean);
|
|
4041
4045
|
allMessages.sort((a, b) => a.receivedAt - b.receivedAt);
|
|
@@ -4049,9 +4053,12 @@ function pageHistoryRecords(agentType, records, offset = 0, limit = 30, excludeR
|
|
|
4049
4053
|
if (message.role !== "system") lastTurn = message;
|
|
4050
4054
|
}
|
|
4051
4055
|
const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
|
|
4052
|
-
const boundedLimit =
|
|
4053
|
-
const boundedOffset =
|
|
4054
|
-
const boundedExclude = Math.
|
|
4056
|
+
const boundedLimit = normalizePaginationNumber(limit, 30, 1);
|
|
4057
|
+
const boundedOffset = normalizePaginationNumber(offset, 0, 0);
|
|
4058
|
+
const boundedExclude = Math.min(
|
|
4059
|
+
normalizePaginationNumber(excludeRecentCount, 0, 0),
|
|
4060
|
+
collapsed.length
|
|
4061
|
+
);
|
|
4055
4062
|
const endExclusive = Math.max(0, collapsed.length - boundedExclude - boundedOffset);
|
|
4056
4063
|
const startInclusive = Math.max(0, endExclusive - boundedLimit);
|
|
4057
4064
|
const sliced = collapsed.slice(startInclusive, endExclusive);
|
|
@@ -7912,6 +7919,28 @@ function getStateLastSignature(state) {
|
|
|
7912
7919
|
if (!last) return "";
|
|
7913
7920
|
return `${last.role || ""}:${String(last.content || "").replace(/\s+/g, " ").trim()}`;
|
|
7914
7921
|
}
|
|
7922
|
+
function toNonNegativeNumber(value) {
|
|
7923
|
+
const numeric = Number(value ?? 0);
|
|
7924
|
+
return Number.isFinite(numeric) ? Math.max(0, numeric) : 0;
|
|
7925
|
+
}
|
|
7926
|
+
function getCliVisibleTranscriptCount(adapter) {
|
|
7927
|
+
const adapterStatus = adapter?.getStatus?.() || {};
|
|
7928
|
+
const adapterMessages = Array.isArray(adapterStatus.messages) ? adapterStatus.messages : [];
|
|
7929
|
+
let parsedRecord = null;
|
|
7930
|
+
if (typeof adapter?.getScriptParsedStatus === "function") {
|
|
7931
|
+
try {
|
|
7932
|
+
const parsed = parseMaybeJson(adapter.getScriptParsedStatus());
|
|
7933
|
+
parsedRecord = parsed && typeof parsed === "object" ? parsed : null;
|
|
7934
|
+
} catch {
|
|
7935
|
+
parsedRecord = null;
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
const parsedMessages = Array.isArray(parsedRecord?.messages) ? parsedRecord.messages : [];
|
|
7939
|
+
if (!parsedRecord) return adapterMessages.length;
|
|
7940
|
+
const parsedIsProviderAuthoritative = parsedRecord.transcriptAuthority === "provider" || parsedRecord.coverage === "full";
|
|
7941
|
+
const shouldPreferAdapterMessages = !parsedIsProviderAuthoritative && adapterMessages.length > 0 && adapterMessages.length > parsedMessages.length;
|
|
7942
|
+
return shouldPreferAdapterMessages ? adapterMessages.length : parsedMessages.length;
|
|
7943
|
+
}
|
|
7915
7944
|
async function getStableExtensionBaseline(h) {
|
|
7916
7945
|
const first = await readExtensionChatState(h);
|
|
7917
7946
|
if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
|
|
@@ -7940,11 +7969,11 @@ async function handleChatHistory(h, args) {
|
|
|
7940
7969
|
const provider = h.getProvider(agentType);
|
|
7941
7970
|
const agentStr = provider?.type || agentType || getCurrentProviderType(h);
|
|
7942
7971
|
const transport = getTargetTransport(h, provider);
|
|
7943
|
-
|
|
7944
|
-
|
|
7972
|
+
const hasExplicitExcludeRecentCount = args?.excludeRecentCount !== void 0 && args?.excludeRecentCount !== null;
|
|
7973
|
+
let excludeRecentCount = toNonNegativeNumber(args?.excludeRecentCount);
|
|
7974
|
+
if (!hasExplicitExcludeRecentCount && isCliLikeTransport(transport)) {
|
|
7945
7975
|
const adapter = getTargetedCliAdapter(h, args, provider?.type);
|
|
7946
|
-
const
|
|
7947
|
-
const visibleCount = Array.isArray(status?.messages) ? status.messages.length : 0;
|
|
7976
|
+
const visibleCount = getCliVisibleTranscriptCount(adapter);
|
|
7948
7977
|
if (visibleCount > excludeRecentCount) excludeRecentCount = visibleCount;
|
|
7949
7978
|
}
|
|
7950
7979
|
const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
|
|
@@ -57390,7 +57419,7 @@ var init_adhdev_daemon = __esm({
|
|
|
57390
57419
|
init_version();
|
|
57391
57420
|
init_src();
|
|
57392
57421
|
init_runtime_defaults();
|
|
57393
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
57422
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.53" });
|
|
57394
57423
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
57395
57424
|
localHttpServer = null;
|
|
57396
57425
|
localWss = null;
|