adhdev 0.9.51 → 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 +39 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +39 -9
- 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;
|
|
@@ -9462,12 +9491,13 @@ async function handleSetProviderSourceConfig(h, args) {
|
|
|
9462
9491
|
});
|
|
9463
9492
|
loader.reload();
|
|
9464
9493
|
loader.registerToDetector();
|
|
9494
|
+
const refreshedInstances = h.ctx.instanceManager ? h.ctx.instanceManager.refreshProviderDefinitions((providerType) => loader.resolve(providerType)) : 0;
|
|
9465
9495
|
await h.ctx.onProviderSourceConfigChanged?.();
|
|
9466
9496
|
LOG.info(
|
|
9467
9497
|
"Command",
|
|
9468
9498
|
`[set_provider_source_config] mode=${sourceConfig.sourceMode} explicitProviderDir=${sourceConfig.explicitProviderDir || "-"} userDir=${sourceConfig.userDir}`
|
|
9469
9499
|
);
|
|
9470
|
-
return { success: true, reloaded: true, ...sourceConfig };
|
|
9500
|
+
return { success: true, reloaded: true, refreshedInstances, ...sourceConfig };
|
|
9471
9501
|
}
|
|
9472
9502
|
function normalizeProviderScriptArgs(args, scriptName) {
|
|
9473
9503
|
const normalizedArgs = { ...args || {} };
|
|
@@ -57389,7 +57419,7 @@ var init_adhdev_daemon = __esm({
|
|
|
57389
57419
|
init_version();
|
|
57390
57420
|
init_src();
|
|
57391
57421
|
init_runtime_defaults();
|
|
57392
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
57422
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.53" });
|
|
57393
57423
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
57394
57424
|
localHttpServer = null;
|
|
57395
57425
|
localWss = null;
|