@adhdev/daemon-core 0.9.7 → 0.9.9
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/index.d.ts +2 -2
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -2
- package/dist/index.mjs.map +1 -1
- package/dist/providers/contracts.d.ts +4 -0
- package/dist/providers/index.d.ts +1 -1
- package/dist/types.d.ts +7 -0
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +4 -1
- package/src/index.d.ts +2 -2
- package/src/index.ts +2 -1
- package/src/providers/contracts.d.ts +4 -0
- package/src/providers/contracts.ts +5 -0
- package/src/providers/index.ts +1 -0
- package/src/providers/read-chat-contract.ts +23 -1
- package/src/types.d.ts +7 -0
- package/src/types.ts +8 -0
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Core logic for daemon: CDP, Provider, IDE detection, CLI/ACP adapters and more.
|
|
5
5
|
*/
|
|
6
|
-
export type { ChatMessage, ExtensionInfo, CommandResult as CoreCommandResult, ProviderConfig, DaemonEvent, StatusResponse, SystemInfo, DetectedIde, ProviderInfo, AgentEntry, } from './types.js';
|
|
6
|
+
export type { ChatBubbleState, ChatMessage, ExtensionInfo, CommandResult as CoreCommandResult, ProviderConfig, DaemonEvent, StatusResponse, SystemInfo, DetectedIde, ProviderInfo, AgentEntry, } from './types.js';
|
|
7
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';
|
|
@@ -77,7 +77,7 @@ export { ProviderInstanceManager } from './providers/provider-instance-manager.j
|
|
|
77
77
|
export { IdeProviderInstance } from './providers/ide-provider-instance.js';
|
|
78
78
|
export { CliProviderInstance } from './providers/cli-provider-instance.js';
|
|
79
79
|
export { AcpProviderInstance } from './providers/acp-provider-instance.js';
|
|
80
|
-
export type { ProviderModule, CdpTargetFilter, ProviderResumeCapability, InputEnvelope, InputPart, MessagePart, ControlListResult, ControlSetResult, ControlInvokeResult } from './providers/contracts.js';
|
|
80
|
+
export type { ProviderModule, CdpTargetFilter, ProviderResumeCapability, InputEnvelope, InputPart, MessagePart, ReadChatTurnStatus, ControlListResult, ControlSetResult, ControlInvokeResult } from './providers/contracts.js';
|
|
81
81
|
export type { ProviderSourceConfigSnapshot, ProviderSourceConfigUpdate } from './config/provider-source-config.js';
|
|
82
82
|
export { parseProviderSourceConfigUpdate } from './config/provider-source-config.js';
|
|
83
83
|
export { normalizeInputEnvelope, normalizeMessageParts, flattenMessageParts } from './providers/io-contracts.js';
|
package/dist/index.js
CHANGED
|
@@ -852,6 +852,18 @@ function validateRole(role, source, index) {
|
|
|
852
852
|
}
|
|
853
853
|
return role;
|
|
854
854
|
}
|
|
855
|
+
function validateBubbleState(state, source, index) {
|
|
856
|
+
if (typeof state !== "string" || !VALID_BUBBLE_STATES.includes(state)) {
|
|
857
|
+
throw new Error(`${source}: messages[${index}].bubbleState must be one of ${VALID_BUBBLE_STATES.join(", ")}`);
|
|
858
|
+
}
|
|
859
|
+
return state;
|
|
860
|
+
}
|
|
861
|
+
function validateTurnStatus(turnStatus, source) {
|
|
862
|
+
if (typeof turnStatus !== "string" || !VALID_TURN_STATUSES.includes(turnStatus)) {
|
|
863
|
+
throw new Error(`${source}: turnStatus must be one of ${VALID_TURN_STATUSES.join(", ")}`);
|
|
864
|
+
}
|
|
865
|
+
return turnStatus;
|
|
866
|
+
}
|
|
855
867
|
function validateMessageContent(content, source, index) {
|
|
856
868
|
if (typeof content === "string") return content;
|
|
857
869
|
if (Array.isArray(content)) return normalizeMessageParts(content);
|
|
@@ -867,6 +879,9 @@ function validateMessage(message, source, index) {
|
|
|
867
879
|
};
|
|
868
880
|
if (typeof message.kind === "string") normalized.kind = message.kind;
|
|
869
881
|
if (typeof message.id === "string") normalized.id = message.id;
|
|
882
|
+
if (typeof message.bubbleId === "string") normalized.bubbleId = message.bubbleId;
|
|
883
|
+
if (typeof message.providerUnitKey === "string") normalized.providerUnitKey = message.providerUnitKey;
|
|
884
|
+
if (message.bubbleState !== void 0) normalized.bubbleState = validateBubbleState(message.bubbleState, source, index);
|
|
870
885
|
if (isFiniteNumber(message.index)) normalized.index = message.index;
|
|
871
886
|
if (isFiniteNumber(message.timestamp)) normalized.timestamp = message.timestamp;
|
|
872
887
|
if (isFiniteNumber(message.receivedAt)) normalized.receivedAt = message.receivedAt;
|
|
@@ -934,6 +949,8 @@ function validateReadChatResultPayload(raw, source = "read_chat") {
|
|
|
934
949
|
if (activeModal !== void 0) normalized.activeModal = activeModal;
|
|
935
950
|
if (typeof raw.id === "string") normalized.id = raw.id;
|
|
936
951
|
if (typeof raw.title === "string") normalized.title = raw.title;
|
|
952
|
+
if (typeof raw.currentTurnId === "string") normalized.currentTurnId = raw.currentTurnId;
|
|
953
|
+
if (raw.turnStatus !== void 0) normalized.turnStatus = validateTurnStatus(raw.turnStatus, source);
|
|
937
954
|
if (typeof raw.agentType === "string") normalized.agentType = raw.agentType;
|
|
938
955
|
if (typeof raw.agentName === "string") normalized.agentName = raw.agentName;
|
|
939
956
|
if (typeof raw.extensionId === "string") normalized.extensionId = raw.extensionId;
|
|
@@ -946,13 +963,15 @@ function validateReadChatResultPayload(raw, source = "read_chat") {
|
|
|
946
963
|
if (typeof raw.providerSessionId === "string") normalized.providerSessionId = raw.providerSessionId;
|
|
947
964
|
return normalized;
|
|
948
965
|
}
|
|
949
|
-
var VALID_STATUSES, VALID_ROLES;
|
|
966
|
+
var VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES;
|
|
950
967
|
var init_read_chat_contract = __esm({
|
|
951
968
|
"src/providers/read-chat-contract.ts"() {
|
|
952
969
|
"use strict";
|
|
953
970
|
init_contracts();
|
|
954
971
|
VALID_STATUSES = ["idle", "generating", "waiting_approval", "error", "panel_hidden", "streaming", "long_generating"];
|
|
955
972
|
VALID_ROLES = ["user", "assistant", "system", "human"];
|
|
973
|
+
VALID_BUBBLE_STATES = ["draft", "streaming", "final", "removed"];
|
|
974
|
+
VALID_TURN_STATUSES = ["open", "waiting_approval", "complete", "error"];
|
|
956
975
|
}
|
|
957
976
|
});
|
|
958
977
|
|
|
@@ -2642,7 +2661,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
2642
2661
|
);
|
|
2643
2662
|
const parsedModal = parsedTranscript?.activeModal && Array.isArray(parsedTranscript.activeModal.buttons) && parsedTranscript.activeModal.buttons.some((button) => typeof button === "string" && button.trim()) ? parsedTranscript.activeModal : null;
|
|
2644
2663
|
const modal = this.runParseApproval(tail) || parsedModal;
|
|
2645
|
-
const
|
|
2664
|
+
const rawScriptStatus = this.runDetectStatus(tail);
|
|
2665
|
+
const scriptStatus = parsedTranscript?.status === "waiting_approval" && modal ? "waiting_approval" : rawScriptStatus;
|
|
2646
2666
|
const parsedMessages = Array.isArray(parsedTranscript?.messages) ? normalizeCliParsedMessages(parsedTranscript.messages, {
|
|
2647
2667
|
committedMessages: this.committedMessages,
|
|
2648
2668
|
scope: this.currentTurnScope,
|