@adhdev/daemon-core 0.8.102 → 0.9.1
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.d.ts +1 -1
- package/dist/index.js +40 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -6
- package/dist/index.mjs.map +1 -1
- package/dist/shared-types.d.ts +4 -1
- package/dist/status/normalize.d.ts +2 -1
- package/dist/status/normalize.js +10 -3
- package/dist/status/normalize.js.map +1 -1
- package/dist/status/normalize.mjs +10 -3
- package/dist/status/normalize.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 +44 -3
- package/src/index.ts +1 -0
- package/src/shared-types.d.ts +4 -1
- package/src/shared-types.ts +5 -1
- package/src/status/normalize.ts +14 -6
|
@@ -149,6 +149,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
149
149
|
private runDetectStatus;
|
|
150
150
|
private runParseApproval;
|
|
151
151
|
private projectEffectiveStatus;
|
|
152
|
+
private suppressStaleParsedApproval;
|
|
152
153
|
getStatus(): CliSessionStatus;
|
|
153
154
|
seedCommittedMessages(messages: SeedCliChatMessage[]): void;
|
|
154
155
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Core logic for daemon: CDP, Provider, IDE detection, CLI/ACP adapters and more.
|
|
5
5
|
*/
|
|
6
6
|
export type { ChatMessage, ExtensionInfo, CommandResult as CoreCommandResult, ProviderConfig, DaemonEvent, StatusResponse, SystemInfo, DetectedIde, ProviderInfo, AgentEntry, } from './types.js';
|
|
7
|
-
export type { SessionEntry, CompactSessionEntry, CompactDaemonEntry, CloudDaemonSummaryEntry, DashboardBootstrapDaemonEntry, VersionUpdateReason, CloudStatusReportPayload, DaemonStatusEventPayload, DashboardStatusEventPayload, SessionTransport, SessionKind, SessionCapability, AgentSessionStream, ReadChatCursor, ReadChatSyncMode, ReadChatSyncResult, TransportTopic, SessionChatTailSubscriptionParams, MachineRuntimeSubscriptionParams, SessionHostDiagnosticsSubscriptionParams, SessionModalSubscriptionParams, DaemonMetadataSubscriptionParams, SessionChatTailUpdate, MachineRuntimeUpdate, SessionHostDiagnosticsUpdate, SessionModalUpdate, DaemonMetadataUpdate, TopicUpdateEnvelope, SubscribeRequest, UnsubscribeRequest, StandaloneWsStatusPayload, AvailableProviderInfo, AcpConfigOption, AcpMode, ProviderControlSchema, StatusReportPayload, MachineInfo, SessionHostDiagnosticsSnapshot, SessionHostRecord, SessionHostWriteOwner, SessionHostAttachedClient, SessionHostLogEntry, SessionHostRequestTrace, SessionHostRuntimeTransition, DetectedIdeInfo, WorkspaceEntry, ProviderSummaryItem, ProviderSummaryMetadata, ProviderState, ProviderStatus, ProviderErrorReason, ActiveChatData, IdeProviderState, CliProviderState, AcpProviderState, ExtensionProviderState, } from './shared-types.js';
|
|
7
|
+
export type { SessionEntry, CompactSessionEntry, CompactDaemonEntry, CloudDaemonSummaryEntry, DashboardBootstrapDaemonEntry, VersionUpdateReason, CloudStatusReportPayload, DaemonStatusEventPayload, DashboardStatusEventPayload, SessionTransport, SessionKind, SessionCapability, AgentSessionStream, ReadChatCursor, ReadChatSyncMode, ReadChatSyncResult, TransportTopic, SessionChatTailSubscriptionParams, MachineRuntimeSubscriptionParams, SessionHostDiagnosticsSubscriptionParams, SessionModalSubscriptionParams, DaemonMetadataSubscriptionParams, SessionChatTailUpdate, MachineRuntimeUpdate, SessionHostDiagnosticsUpdate, SessionModalUpdate, DaemonMetadataUpdate, TopicUpdateEnvelope, SubscribeRequest, UnsubscribeRequest, StandaloneWsStatusPayload, AvailableProviderInfo, AcpConfigOption, AcpMode, ProviderControlSchema, StatusReportPayload, MachineInfo, SessionHostDiagnosticsSnapshot, SessionHostRecord, SessionHostWriteOwner, SessionHostAttachedClient, SessionHostLogEntry, SessionHostRequestTrace, SessionHostRuntimeTransition, DetectedIdeInfo, WorkspaceEntry, ProviderSummaryItem, ProviderSummaryMetadata, ProviderState, ProviderStatus, ProviderErrorReason, SessionActiveChatData, ActiveChatData, IdeProviderState, CliProviderState, AcpProviderState, ExtensionProviderState, } from './shared-types.js';
|
|
8
8
|
import type { RuntimeWriteOwner as _RuntimeWriteOwner } from './shared-types-extra.js';
|
|
9
9
|
import type { RuntimeAttachedClient as _RuntimeAttachedClient } from './shared-types-extra.js';
|
|
10
10
|
import type { RecentLaunchEntry as _RecentLaunchEntry } from './shared-types.js';
|
package/dist/index.js
CHANGED
|
@@ -2324,6 +2324,10 @@ var init_provider_cli_adapter = __esm({
|
|
|
2324
2324
|
this.activeModal = startupModal;
|
|
2325
2325
|
this.setStatus("waiting_approval", `startup_ready:${trigger}`);
|
|
2326
2326
|
} else {
|
|
2327
|
+
if (this.currentStatus === "waiting_approval" || this.activeModal) {
|
|
2328
|
+
this.lastApprovalResolvedAt = Date.now();
|
|
2329
|
+
}
|
|
2330
|
+
this.activeModal = null;
|
|
2327
2331
|
this.setStatus("idle", `startup_ready:${trigger}`);
|
|
2328
2332
|
}
|
|
2329
2333
|
LOG.info(
|
|
@@ -3122,6 +3126,28 @@ var init_provider_cli_adapter = __esm({
|
|
|
3122
3126
|
if (this.isWaitingForResponse && this.currentTurnScope && this.currentStatus === "idle") return "generating";
|
|
3123
3127
|
return this.currentStatus;
|
|
3124
3128
|
}
|
|
3129
|
+
suppressStaleParsedApproval(parsed, recentBuffer, screenText) {
|
|
3130
|
+
const actionableParsedModal = parsed?.activeModal && Array.isArray(parsed.activeModal.buttons) && parsed.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsed.activeModal : null;
|
|
3131
|
+
if (!parsed || parsed?.status !== "waiting_approval" || !actionableParsedModal) {
|
|
3132
|
+
return parsed;
|
|
3133
|
+
}
|
|
3134
|
+
const inApprovalCooldown = this.lastApprovalResolvedAt > 0 && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown;
|
|
3135
|
+
if (!inApprovalCooldown) {
|
|
3136
|
+
return parsed;
|
|
3137
|
+
}
|
|
3138
|
+
const startupModal = this.getStartupConfirmationModal(screenText || "");
|
|
3139
|
+
const visibleModal = this.runParseApproval(recentBuffer) || startupModal;
|
|
3140
|
+
if (visibleModal) {
|
|
3141
|
+
return parsed;
|
|
3142
|
+
}
|
|
3143
|
+
const detectedStatus = this.runDetectStatus(recentBuffer);
|
|
3144
|
+
const fallbackStatus = detectedStatus && detectedStatus !== "waiting_approval" ? detectedStatus : this.isWaitingForResponse || this.currentTurnScope ? "generating" : this.currentStatus === "waiting_approval" ? "idle" : this.currentStatus;
|
|
3145
|
+
return {
|
|
3146
|
+
...parsed,
|
|
3147
|
+
status: fallbackStatus,
|
|
3148
|
+
activeModal: null
|
|
3149
|
+
};
|
|
3150
|
+
}
|
|
3125
3151
|
// ─── Public API (CliAdapter) ───────────────────
|
|
3126
3152
|
getStatus() {
|
|
3127
3153
|
const screenText = this.terminalScreen.getText() || "";
|
|
@@ -3340,15 +3366,16 @@ var init_provider_cli_adapter = __esm({
|
|
|
3340
3366
|
if (parsed && refinedStatus && parsed.status !== refinedStatus) {
|
|
3341
3367
|
parsed.status = refinedStatus;
|
|
3342
3368
|
}
|
|
3369
|
+
const normalizedParsed = this.suppressStaleParsedApproval(parsed, input.recentBuffer, input.screenText);
|
|
3343
3370
|
const promptForTrim = scope?.prompt || getLastUserPromptText(baseMessages);
|
|
3344
|
-
if (
|
|
3345
|
-
const lastAssistant = [...
|
|
3371
|
+
if (normalizedParsed && Array.isArray(normalizedParsed.messages) && promptForTrim) {
|
|
3372
|
+
const lastAssistant = [...normalizedParsed.messages].reverse().find((message) => message?.role === "assistant" && typeof message.content === "string");
|
|
3346
3373
|
if (lastAssistant) {
|
|
3347
3374
|
lastAssistant.content = trimPromptEchoPrefix(lastAssistant.content, promptForTrim);
|
|
3348
3375
|
}
|
|
3349
3376
|
}
|
|
3350
3377
|
this.parseErrorMessage = null;
|
|
3351
|
-
return
|
|
3378
|
+
return normalizedParsed;
|
|
3352
3379
|
} catch (e) {
|
|
3353
3380
|
const message = e?.message || String(e);
|
|
3354
3381
|
this.parseErrorMessage = message;
|
|
@@ -9608,10 +9635,13 @@ function normalizeActiveChatData(activeChat, options = FULL_STATUS_ACTIVE_CHAT_O
|
|
|
9608
9635
|
...FULL_STATUS_ACTIVE_CHAT_OPTIONS,
|
|
9609
9636
|
...options
|
|
9610
9637
|
};
|
|
9611
|
-
|
|
9612
|
-
|
|
9638
|
+
const {
|
|
9639
|
+
messages: _messages,
|
|
9640
|
+
...rest
|
|
9641
|
+
} = activeChat;
|
|
9642
|
+
const normalized = {
|
|
9643
|
+
...rest,
|
|
9613
9644
|
status: normalizeManagedStatus(activeChat.status, { activeModal: activeChat.activeModal }),
|
|
9614
|
-
messages: trimMessagesForStatus(activeChat.messages, resolvedOptions),
|
|
9615
9645
|
activeModal: resolvedOptions.includeActiveModal && activeChat.activeModal ? {
|
|
9616
9646
|
message: truncateString(activeChat.activeModal.message || "", STATUS_MODAL_MESSAGE_LIMIT),
|
|
9617
9647
|
buttons: (activeChat.activeModal.buttons || []).map(
|
|
@@ -9620,6 +9650,10 @@ function normalizeActiveChatData(activeChat, options = FULL_STATUS_ACTIVE_CHAT_O
|
|
|
9620
9650
|
} : null,
|
|
9621
9651
|
inputContent: resolvedOptions.includeInputContent && activeChat.inputContent ? truncateString(activeChat.inputContent, 2 * 1024) : void 0
|
|
9622
9652
|
};
|
|
9653
|
+
if (resolvedOptions.includeMessages) {
|
|
9654
|
+
normalized.messages = trimMessagesForStatus(activeChat.messages, resolvedOptions);
|
|
9655
|
+
}
|
|
9656
|
+
return normalized;
|
|
9623
9657
|
}
|
|
9624
9658
|
|
|
9625
9659
|
// src/status/builders.ts
|