@adhdev/daemon-core 0.9.8 → 0.9.10
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/commands/chat-commands.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -8
- 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 +1 -1
- package/src/commands/chat-commands.ts +5 -4
- package/src/index.d.ts +2 -2
- package/src/index.ts +2 -1
- package/src/providers/cli-provider-instance.ts +4 -4
- 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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* setMode, changeModel, setThoughtLevel, resolveAction, chatHistory
|
|
4
4
|
*/
|
|
5
5
|
import type { CommandResult, CommandHelpers } from './handler.js';
|
|
6
|
+
export declare const READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25000;
|
|
6
7
|
export declare function handleChatHistory(h: CommandHelpers, args: any): Promise<CommandResult>;
|
|
7
8
|
export declare function handleReadChat(h: CommandHelpers, args: any): Promise<CommandResult>;
|
|
8
9
|
export declare function handleSendChat(h: CommandHelpers, args: any): Promise<CommandResult>;
|
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
|
|
|
@@ -2190,7 +2209,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
2190
2209
|
sendDelayMs;
|
|
2191
2210
|
sendKey;
|
|
2192
2211
|
submitStrategy;
|
|
2193
|
-
static SCRIPT_STATUS_DEBOUNCE_MS =
|
|
2212
|
+
static SCRIPT_STATUS_DEBOUNCE_MS = 3e3;
|
|
2194
2213
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
2195
2214
|
setCliScripts(scripts) {
|
|
2196
2215
|
this.cliScripts = scripts;
|
|
@@ -10053,6 +10072,7 @@ function buildSessionModalDeliverySignature(payload) {
|
|
|
10053
10072
|
// src/commands/chat-commands.ts
|
|
10054
10073
|
init_chat_message_normalization();
|
|
10055
10074
|
var RECENT_SEND_WINDOW_MS = 1200;
|
|
10075
|
+
var READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25e3;
|
|
10056
10076
|
var recentSendByTarget = /* @__PURE__ */ new Map();
|
|
10057
10077
|
function getCurrentProviderType(h, fallback = "") {
|
|
10058
10078
|
return h.currentSession?.providerType || h.currentProviderType || fallback;
|
|
@@ -10346,7 +10366,7 @@ function didProviderConfirmSend(result) {
|
|
|
10346
10366
|
}
|
|
10347
10367
|
async function readExtensionChatState(h) {
|
|
10348
10368
|
try {
|
|
10349
|
-
const evalResult = await h.evaluateProviderScript("readChat", void 0,
|
|
10369
|
+
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
10350
10370
|
if (!evalResult?.result) return null;
|
|
10351
10371
|
const parsed = parseMaybeJson(evalResult.result);
|
|
10352
10372
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
@@ -10434,7 +10454,7 @@ async function handleReadChat(h, args) {
|
|
|
10434
10454
|
const title = typeof parsedRecord?.title === "string" ? parsedRecord.title : void 0;
|
|
10435
10455
|
const providerSessionId = typeof parsedRecord?.providerSessionId === "string" ? parsedRecord.providerSessionId : void 0;
|
|
10436
10456
|
if (status) {
|
|
10437
|
-
LOG.
|
|
10457
|
+
LOG.debug("Command", `[read_chat] cli-like resolved provider=${adapter.cliType} target=${String(args?.targetSessionId || "")} adapterStatus=${String(adapterStatus.status || "")} parsedStatus=${String(parsedRecord?.status || "")} shouldPreferAdapterMessages=${String(shouldPreferAdapterMessages)} adapterMsgCount=${Array.isArray(adapterStatus.messages) ? adapterStatus.messages.length : 0} parsedMsgCount=${Array.isArray(parsedRecord?.messages) ? parsedRecord.messages.length : 0} returnedMsgCount=${Array.isArray(status.messages) ? status.messages.length : 0}`);
|
|
10438
10458
|
return buildReadChatCommandResult({
|
|
10439
10459
|
messages: status.messages || [],
|
|
10440
10460
|
status: status.status,
|
|
@@ -10459,7 +10479,7 @@ async function handleReadChat(h, args) {
|
|
|
10459
10479
|
}
|
|
10460
10480
|
if (isExtensionTransport(transport)) {
|
|
10461
10481
|
try {
|
|
10462
|
-
const evalResult = await h.evaluateProviderScript("readChat", void 0,
|
|
10482
|
+
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
10463
10483
|
if (evalResult?.result) {
|
|
10464
10484
|
let parsed = evalResult.result;
|
|
10465
10485
|
if (typeof parsed === "string") {
|
|
@@ -10563,7 +10583,7 @@ async function handleReadChat(h, args) {
|
|
|
10563
10583
|
const script = h.getProviderScript("readChat") || h.getProviderScript("read_chat");
|
|
10564
10584
|
if (script) {
|
|
10565
10585
|
try {
|
|
10566
|
-
const evalResult = await h.evaluateProviderScript("readChat", void 0,
|
|
10586
|
+
const evalResult = await h.evaluateProviderScript("readChat", void 0, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
|
|
10567
10587
|
if (evalResult?.result) {
|
|
10568
10588
|
let parsed = evalResult.result;
|
|
10569
10589
|
if (typeof parsed === "string") {
|
|
@@ -13145,7 +13165,7 @@ var CliProviderInstance = class {
|
|
|
13145
13165
|
this.generatingDebouncePending = null;
|
|
13146
13166
|
}
|
|
13147
13167
|
this.generatingDebounceTimer = null;
|
|
13148
|
-
},
|
|
13168
|
+
}, 3e3);
|
|
13149
13169
|
} else if (newStatus === "waiting_approval") {
|
|
13150
13170
|
this.suppressIdleHistoryReplay = false;
|
|
13151
13171
|
if (this.generatingDebouncePending) {
|
|
@@ -13201,7 +13221,7 @@ var CliProviderInstance = class {
|
|
|
13201
13221
|
this.generatingStartedAt = 0;
|
|
13202
13222
|
}
|
|
13203
13223
|
this.completedDebounceTimer = null;
|
|
13204
|
-
},
|
|
13224
|
+
}, 3e3);
|
|
13205
13225
|
}
|
|
13206
13226
|
} else if (newStatus === "stopped") {
|
|
13207
13227
|
if (this.generatingDebounceTimer) {
|