@adhdev/daemon-core 0.9.8 → 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 +20 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -1
- 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/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.mjs
CHANGED
|
@@ -847,6 +847,18 @@ function validateRole(role, source, index) {
|
|
|
847
847
|
}
|
|
848
848
|
return role;
|
|
849
849
|
}
|
|
850
|
+
function validateBubbleState(state, source, index) {
|
|
851
|
+
if (typeof state !== "string" || !VALID_BUBBLE_STATES.includes(state)) {
|
|
852
|
+
throw new Error(`${source}: messages[${index}].bubbleState must be one of ${VALID_BUBBLE_STATES.join(", ")}`);
|
|
853
|
+
}
|
|
854
|
+
return state;
|
|
855
|
+
}
|
|
856
|
+
function validateTurnStatus(turnStatus, source) {
|
|
857
|
+
if (typeof turnStatus !== "string" || !VALID_TURN_STATUSES.includes(turnStatus)) {
|
|
858
|
+
throw new Error(`${source}: turnStatus must be one of ${VALID_TURN_STATUSES.join(", ")}`);
|
|
859
|
+
}
|
|
860
|
+
return turnStatus;
|
|
861
|
+
}
|
|
850
862
|
function validateMessageContent(content, source, index) {
|
|
851
863
|
if (typeof content === "string") return content;
|
|
852
864
|
if (Array.isArray(content)) return normalizeMessageParts(content);
|
|
@@ -862,6 +874,9 @@ function validateMessage(message, source, index) {
|
|
|
862
874
|
};
|
|
863
875
|
if (typeof message.kind === "string") normalized.kind = message.kind;
|
|
864
876
|
if (typeof message.id === "string") normalized.id = message.id;
|
|
877
|
+
if (typeof message.bubbleId === "string") normalized.bubbleId = message.bubbleId;
|
|
878
|
+
if (typeof message.providerUnitKey === "string") normalized.providerUnitKey = message.providerUnitKey;
|
|
879
|
+
if (message.bubbleState !== void 0) normalized.bubbleState = validateBubbleState(message.bubbleState, source, index);
|
|
865
880
|
if (isFiniteNumber(message.index)) normalized.index = message.index;
|
|
866
881
|
if (isFiniteNumber(message.timestamp)) normalized.timestamp = message.timestamp;
|
|
867
882
|
if (isFiniteNumber(message.receivedAt)) normalized.receivedAt = message.receivedAt;
|
|
@@ -929,6 +944,8 @@ function validateReadChatResultPayload(raw, source = "read_chat") {
|
|
|
929
944
|
if (activeModal !== void 0) normalized.activeModal = activeModal;
|
|
930
945
|
if (typeof raw.id === "string") normalized.id = raw.id;
|
|
931
946
|
if (typeof raw.title === "string") normalized.title = raw.title;
|
|
947
|
+
if (typeof raw.currentTurnId === "string") normalized.currentTurnId = raw.currentTurnId;
|
|
948
|
+
if (raw.turnStatus !== void 0) normalized.turnStatus = validateTurnStatus(raw.turnStatus, source);
|
|
932
949
|
if (typeof raw.agentType === "string") normalized.agentType = raw.agentType;
|
|
933
950
|
if (typeof raw.agentName === "string") normalized.agentName = raw.agentName;
|
|
934
951
|
if (typeof raw.extensionId === "string") normalized.extensionId = raw.extensionId;
|
|
@@ -941,13 +958,15 @@ function validateReadChatResultPayload(raw, source = "read_chat") {
|
|
|
941
958
|
if (typeof raw.providerSessionId === "string") normalized.providerSessionId = raw.providerSessionId;
|
|
942
959
|
return normalized;
|
|
943
960
|
}
|
|
944
|
-
var VALID_STATUSES, VALID_ROLES;
|
|
961
|
+
var VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES;
|
|
945
962
|
var init_read_chat_contract = __esm({
|
|
946
963
|
"src/providers/read-chat-contract.ts"() {
|
|
947
964
|
"use strict";
|
|
948
965
|
init_contracts();
|
|
949
966
|
VALID_STATUSES = ["idle", "generating", "waiting_approval", "error", "panel_hidden", "streaming", "long_generating"];
|
|
950
967
|
VALID_ROLES = ["user", "assistant", "system", "human"];
|
|
968
|
+
VALID_BUBBLE_STATES = ["draft", "streaming", "final", "removed"];
|
|
969
|
+
VALID_TURN_STATUSES = ["open", "waiting_approval", "complete", "error"];
|
|
951
970
|
}
|
|
952
971
|
});
|
|
953
972
|
|