@demind-inc/core 1.11.14 → 1.11.15
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/models/Chat.d.ts +44 -0
- package/lib/models/Chat.ts +50 -0
- package/package.json +1 -1
package/dist/models/Chat.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ChatAdjustmentCTA } from "../types";
|
|
2
|
+
import { RichContext } from "./RichContext";
|
|
1
3
|
import { SuggestedTaskItem } from "./TodoTasks";
|
|
2
4
|
export interface Chat {
|
|
3
5
|
chatId: string;
|
|
@@ -71,6 +73,48 @@ export interface SessionMessage {
|
|
|
71
73
|
role: MessageRole;
|
|
72
74
|
sentAt: string;
|
|
73
75
|
}
|
|
76
|
+
/** A message doc of any chat session: a chat turn or a routine thread. */
|
|
77
|
+
export type ChatMessageRole = MessageRole | "system";
|
|
78
|
+
/**
|
|
79
|
+
* `cta`: a bubble that carries a turn's suggestions (null content, the CTA in `cta`).
|
|
80
|
+
* `execution_status`: closes a routine run (system row).
|
|
81
|
+
*/
|
|
82
|
+
export type ChatMessageType = "cta" | "execution_status";
|
|
83
|
+
/** RichContext as stored/streamed, with the fields the enrichment pipeline adds. */
|
|
84
|
+
export type ChatRichContext = RichContext & {
|
|
85
|
+
reminder_min?: number | null;
|
|
86
|
+
enrichment_pending?: boolean;
|
|
87
|
+
status_text?: string | null;
|
|
88
|
+
};
|
|
89
|
+
export interface ChatRichContextEntry {
|
|
90
|
+
date?: string;
|
|
91
|
+
suggestionId: string;
|
|
92
|
+
richContext: ChatRichContext;
|
|
93
|
+
/** 'adjustment' = came from an adjustments item; 'query' = came from a query field */
|
|
94
|
+
source: "adjustment" | "query";
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* What gets written to chat/{chatId}/<type>Sessions/{sessionId}/messages. Same shape for every
|
|
98
|
+
* session type; `SessionMessage` only covers plain user/assistant text.
|
|
99
|
+
*/
|
|
100
|
+
export interface NewChatSessionMessage {
|
|
101
|
+
role: ChatMessageRole;
|
|
102
|
+
/** null on bubbles that render another field (a CTA). */
|
|
103
|
+
content: string | null;
|
|
104
|
+
title?: string;
|
|
105
|
+
sentAt: string;
|
|
106
|
+
messageType?: ChatMessageType;
|
|
107
|
+
cta?: ChatAdjustmentCTA;
|
|
108
|
+
/** Rich-context cards of the turn, on the assistant reply. */
|
|
109
|
+
richContexts?: ChatRichContextEntry[];
|
|
110
|
+
/** Routine status rows only. */
|
|
111
|
+
triggeredBy?: "schedule" | "manual";
|
|
112
|
+
status?: "success" | "failed";
|
|
113
|
+
}
|
|
114
|
+
/** A chat session message as read back: the stored fields plus the doc id. */
|
|
115
|
+
export interface ChatSessionMessage extends NewChatSessionMessage {
|
|
116
|
+
messageId: string;
|
|
117
|
+
}
|
|
74
118
|
export interface RecommendationSession {
|
|
75
119
|
recSessionId: string;
|
|
76
120
|
messages: SessionMessage[];
|
package/lib/models/Chat.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ChatAdjustmentCTA } from "../types";
|
|
2
|
+
import { RichContext } from "./RichContext";
|
|
1
3
|
import { SuggestedTaskItem } from "./TodoTasks";
|
|
2
4
|
|
|
3
5
|
export interface Chat {
|
|
@@ -96,6 +98,54 @@ export interface SessionMessage {
|
|
|
96
98
|
sentAt: string;
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
/** A message doc of any chat session: a chat turn or a routine thread. */
|
|
102
|
+
export type ChatMessageRole = MessageRole | "system";
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* `cta`: a bubble that carries a turn's suggestions (null content, the CTA in `cta`).
|
|
106
|
+
* `execution_status`: closes a routine run (system row).
|
|
107
|
+
*/
|
|
108
|
+
export type ChatMessageType = "cta" | "execution_status";
|
|
109
|
+
|
|
110
|
+
/** RichContext as stored/streamed, with the fields the enrichment pipeline adds. */
|
|
111
|
+
export type ChatRichContext = RichContext & {
|
|
112
|
+
reminder_min?: number | null;
|
|
113
|
+
enrichment_pending?: boolean;
|
|
114
|
+
status_text?: string | null;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export interface ChatRichContextEntry {
|
|
118
|
+
date?: string;
|
|
119
|
+
suggestionId: string;
|
|
120
|
+
richContext: ChatRichContext;
|
|
121
|
+
/** 'adjustment' = came from an adjustments item; 'query' = came from a query field */
|
|
122
|
+
source: "adjustment" | "query";
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* What gets written to chat/{chatId}/<type>Sessions/{sessionId}/messages. Same shape for every
|
|
127
|
+
* session type; `SessionMessage` only covers plain user/assistant text.
|
|
128
|
+
*/
|
|
129
|
+
export interface NewChatSessionMessage {
|
|
130
|
+
role: ChatMessageRole;
|
|
131
|
+
/** null on bubbles that render another field (a CTA). */
|
|
132
|
+
content: string | null;
|
|
133
|
+
title?: string;
|
|
134
|
+
sentAt: string; // ISO
|
|
135
|
+
messageType?: ChatMessageType;
|
|
136
|
+
cta?: ChatAdjustmentCTA;
|
|
137
|
+
/** Rich-context cards of the turn, on the assistant reply. */
|
|
138
|
+
richContexts?: ChatRichContextEntry[];
|
|
139
|
+
/** Routine status rows only. */
|
|
140
|
+
triggeredBy?: "schedule" | "manual";
|
|
141
|
+
status?: "success" | "failed";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** A chat session message as read back: the stored fields plus the doc id. */
|
|
145
|
+
export interface ChatSessionMessage extends NewChatSessionMessage {
|
|
146
|
+
messageId: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
99
149
|
export interface RecommendationSession {
|
|
100
150
|
recSessionId: string;
|
|
101
151
|
messages: SessionMessage[];
|