@nexface/chat 0.1.21-alpha.4 → 0.1.21-alpha.6
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/BUNDLED_DEPENDENCIES.json +12 -0
- package/dist/BUNDLED_LICENSES.txt +50 -0
- package/dist/assistant-components.d.ts +1 -2
- package/dist/assistant-components.js +6 -8
- package/dist/assistant-runtime.d.ts +1 -4
- package/dist/assistant-runtime.js +5 -19
- package/dist/client.js +9 -27
- package/dist/default-chat.d.ts +1 -1
- package/dist/default-chat.js +7864 -1552
- package/dist/messages.d.ts +0 -3
- package/dist/protocol-messages.d.ts +2 -3
- package/dist/protocol-messages.js +27 -145
- package/dist/protocol-response.js +2 -2
- package/dist/react.d.ts +1 -11
- package/dist/react.js +100 -515
- package/dist/storage.d.ts +6 -3
- package/dist/storage.js +44 -50
- package/dist/styles.css +676 -1503
- package/dist/tool-result.d.ts +0 -5
- package/dist/tool-result.js +0 -31
- package/dist/types.d.ts +1 -3
- package/dist/ui/home-demo/action-bar.js +2 -13
- package/dist/ui/home-demo/greeting.d.ts +1 -3
- package/dist/ui/home-demo/greeting.js +2 -2
- package/dist/ui/home-demo/suggestions.d.ts +4 -2
- package/dist/ui/home-demo/suggestions.js +4 -5
- package/dist/ui/home-demo/trace.js +3 -2
- package/dist/ui/markdown-text.d.ts +1 -6
- package/dist/ui/markdown-text.js +2 -39
- package/dist/ui/thread-list.aui.d.ts +1 -2
- package/dist/ui/thread-list.aui.js +2 -6
- package/package.json +3 -4
- package/dist/fonts/Inter-OFL.txt +0 -93
- package/dist/fonts/inter-medium.ttf +0 -0
- package/dist/session-coordinator.d.ts +0 -23
- package/dist/session-coordinator.js +0 -139
- package/dist/session-history.d.ts +0 -29
- package/dist/session-history.js +0 -282
- package/dist/shared/text-only-reply.d.ts +0 -6
- package/dist/shared/text-only-reply.js +0 -10
- package/dist/shared/tool-presentation.d.ts +0 -17
- package/dist/shared/tool-presentation.js +0 -5
- package/dist/shared/tool-result-markdown.d.ts +0 -15
- package/dist/shared/tool-result-markdown.js +0 -55
- package/dist/shared/tool-result-reference.d.ts +0 -2
- package/dist/shared/tool-result-reference.js +0 -5
- package/dist/tool-presentation.d.ts +0 -6
- package/dist/tool-presentation.js +0 -112
package/dist/storage.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentMessage } from "@nexface/agent";
|
|
2
2
|
import type { UIMessage } from "./react.js";
|
|
3
3
|
export declare const chatStorageKey = "nexface:chat:sessions:v3";
|
|
4
|
-
|
|
4
|
+
interface StoredSession {
|
|
5
5
|
id: string;
|
|
6
6
|
title?: string;
|
|
7
7
|
appendOnly?: boolean;
|
|
@@ -11,7 +11,10 @@ interface StoredChat {
|
|
|
11
11
|
sessions: StoredSession[];
|
|
12
12
|
activeSessionId: string;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
15
|
-
|
|
14
|
+
export interface ChatStorageVersion {
|
|
15
|
+
value: string | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function readChatStorage(key: string, version?: ChatStorageVersion): StoredChat | undefined;
|
|
18
|
+
export declare function writeChatStorage(key: string, state: StoredChat, version: ChatStorageVersion): "saved" | "unchanged" | "conflict" | "unavailable";
|
|
16
19
|
export declare function conversationFromMessages(messages: readonly UIMessage[]): AgentMessage[];
|
|
17
20
|
export {};
|
package/dist/storage.js
CHANGED
|
@@ -146,21 +146,6 @@ function restoreMessage(message) {
|
|
|
146
146
|
});
|
|
147
147
|
return {
|
|
148
148
|
...message,
|
|
149
|
-
...(message.attachments
|
|
150
|
-
? {
|
|
151
|
-
attachments: message.attachments.map((attachment) => {
|
|
152
|
-
const image = attachmentContent(attachment).find((content) => content.type === "image" && content.source.type === "data");
|
|
153
|
-
return attachment.preview === undefined &&
|
|
154
|
-
image?.type === "image" &&
|
|
155
|
-
image.source.type === "data"
|
|
156
|
-
? {
|
|
157
|
-
...attachment,
|
|
158
|
-
preview: `data:${image.source.mimeType ?? "image/png"};base64,${image.source.value}`,
|
|
159
|
-
}
|
|
160
|
-
: attachment;
|
|
161
|
-
}),
|
|
162
|
-
}
|
|
163
|
-
: {}),
|
|
164
149
|
parts,
|
|
165
150
|
...(unfinished ? { state: "error" } : {}),
|
|
166
151
|
...(error ? { error } : {}),
|
|
@@ -174,10 +159,16 @@ function withoutReasoning(messages) {
|
|
|
174
159
|
return [{ ...message, parts }];
|
|
175
160
|
});
|
|
176
161
|
}
|
|
177
|
-
export function
|
|
162
|
+
export function readChatStorage(key, version) {
|
|
178
163
|
try {
|
|
164
|
+
const raw = localStorage.getItem(key);
|
|
165
|
+
if (version)
|
|
166
|
+
version.value = raw;
|
|
179
167
|
const value = JSON.parse(raw ?? "null");
|
|
180
|
-
if (!record(value) ||
|
|
168
|
+
if (!record(value) ||
|
|
169
|
+
value.version !== 3 ||
|
|
170
|
+
!Array.isArray(value.sessions) ||
|
|
171
|
+
!value.sessions.length)
|
|
181
172
|
return;
|
|
182
173
|
const sessions = [];
|
|
183
174
|
for (const session of value.sessions) {
|
|
@@ -197,45 +188,48 @@ export function decodeChatStorage(raw) {
|
|
|
197
188
|
messages: migratePageTaskResults(withoutReasoning(session.messages)).map(restoreMessage),
|
|
198
189
|
});
|
|
199
190
|
}
|
|
200
|
-
const activeSessionId = sessions.find((session) => session.id === value.activeSessionId)?.id ?? sessions[0]
|
|
191
|
+
const activeSessionId = sessions.find((session) => session.id === value.activeSessionId)?.id ?? sessions[0].id;
|
|
201
192
|
return { sessions, activeSessionId };
|
|
202
193
|
}
|
|
203
194
|
catch {
|
|
204
195
|
return undefined;
|
|
205
196
|
}
|
|
206
197
|
}
|
|
207
|
-
export function
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
? {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
198
|
+
export function writeChatStorage(key, state, version) {
|
|
199
|
+
try {
|
|
200
|
+
const next = JSON.stringify({
|
|
201
|
+
version: 3,
|
|
202
|
+
activeSessionId: state.activeSessionId,
|
|
203
|
+
sessions: state.sessions.map(({ id, title, appendOnly, messages }) => ({
|
|
204
|
+
id,
|
|
205
|
+
title,
|
|
206
|
+
...(appendOnly ? { appendOnly } : {}),
|
|
207
|
+
messages: withoutReasoning(messages).map((message) => ({
|
|
208
|
+
...message,
|
|
209
|
+
parts: message.parts.map((part) => part.type === "tool" && part.error
|
|
210
|
+
? {
|
|
211
|
+
...part,
|
|
212
|
+
errorMessage: part.error.userMessage,
|
|
213
|
+
result: JSON.stringify({
|
|
214
|
+
error: { code: part.error.code, message: part.error.userMessage },
|
|
215
|
+
}),
|
|
216
|
+
}
|
|
217
|
+
: part),
|
|
218
|
+
})),
|
|
219
|
+
})),
|
|
220
|
+
});
|
|
221
|
+
if (next === version.value)
|
|
222
|
+
return "unchanged";
|
|
223
|
+
if (localStorage.getItem(key) !== version.value)
|
|
224
|
+
return "conflict";
|
|
225
|
+
localStorage.setItem(key, next);
|
|
226
|
+
version.value = next;
|
|
227
|
+
return "saved";
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
// Storage restrictions or quota exhaustion must not break the active chat.
|
|
231
|
+
return "unavailable";
|
|
232
|
+
}
|
|
239
233
|
}
|
|
240
234
|
export function conversationFromMessages(messages) {
|
|
241
235
|
const legacy = new Set([
|