@nexface/chat 0.1.20-alpha.0 → 0.1.20
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/assistant-components.js +3 -8
- package/dist/default-chat.d.ts +1 -1
- package/dist/default-chat.js +299 -536
- package/dist/protocol-messages.js +6 -1
- package/dist/react.d.ts +0 -5
- package/dist/react.js +6 -26
- package/dist/styles.css +677 -1482
- 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/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 -4
- package/dist/ui/home-demo/trace.js +3 -2
- package/package.json +3 -3
- package/dist/fonts/Inter-OFL.txt +0 -93
- package/dist/fonts/inter-medium.ttf +0 -0
- package/dist/shared/tool-presentation.d.ts +0 -16
- package/dist/shared/tool-presentation.js +0 -5
- package/dist/tool-presentation.d.ts +0 -6
- package/dist/tool-presentation.js +0 -70
|
@@ -413,7 +413,12 @@ export function projectMessages(messages) {
|
|
|
413
413
|
arguments: args,
|
|
414
414
|
...(result?.role === "tool"
|
|
415
415
|
? {
|
|
416
|
-
result: result.content
|
|
416
|
+
result: result.content.length > 4000
|
|
417
|
+
? JSON.stringify({
|
|
418
|
+
contentOmitted: true,
|
|
419
|
+
preview: result.content.slice(0, 4000),
|
|
420
|
+
})
|
|
421
|
+
: result.content,
|
|
417
422
|
isError,
|
|
418
423
|
}
|
|
419
424
|
: {}),
|
package/dist/react.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ import type { NexfaceAgentConfig } from "./config.js";
|
|
|
8
8
|
import type { ChatRunResult } from "./types.js";
|
|
9
9
|
import { type Attachment } from "./attachments.js";
|
|
10
10
|
import type { UIMessage } from "./messages.js";
|
|
11
|
-
import { type ToolPresentationController } from "./shared/tool-presentation.js";
|
|
12
11
|
export type { UIMessage, UIMessagePart } from "./messages.js";
|
|
13
12
|
export type ChatCommandErrorCode = "CHAT_MODEL_SWITCH_BLOCKED" | "CHAT_RUNTIME_CHANGED" | "CHAT_RUN_ACTIVE" | "CHAT_SESSION_CREATE_BLOCKED" | "CHAT_SESSION_SWITCH_BLOCKED" | "INVALID_INPUT" | "UNKNOWN_SESSION";
|
|
14
13
|
export interface ChatError {
|
|
@@ -62,9 +61,5 @@ export type NexfaceProviderProps = {
|
|
|
62
61
|
agent?: never;
|
|
63
62
|
});
|
|
64
63
|
export declare function assertChatSendable(chat: UseChatResult, sessionId: string): void;
|
|
65
|
-
export declare function useToolPresentations(): {
|
|
66
|
-
controller: ToolPresentationController | undefined;
|
|
67
|
-
report(cause: unknown, sessionId: string, toolCallId: string): void;
|
|
68
|
-
} | null;
|
|
69
64
|
export declare function NexfaceProvider(props: NexfaceProviderProps): ReactElement;
|
|
70
65
|
export declare function useChat(): UseChatResult;
|
package/dist/react.js
CHANGED
|
@@ -7,7 +7,6 @@ import { createChatClient, getClientController, ClientError, } from "./client.js
|
|
|
7
7
|
import { attachmentContent } from "./attachments.js";
|
|
8
8
|
import { projectMessages } from "./protocol-messages.js";
|
|
9
9
|
import { chatStorageKey, readChatStorage, writeChatStorage } from "./storage.js";
|
|
10
|
-
import { getToolPresentationController, } from "./shared/tool-presentation.js";
|
|
11
10
|
export function isChatError(error) {
|
|
12
11
|
const value = error;
|
|
13
12
|
return (!!value &&
|
|
@@ -21,20 +20,6 @@ export function assertChatSendable(chat, sessionId) {
|
|
|
21
20
|
sendGuards.get(chat.sendMessage)?.(sessionId);
|
|
22
21
|
}
|
|
23
22
|
const ChatContext = createContext(null);
|
|
24
|
-
const ToolPresentationContext = createContext(null);
|
|
25
|
-
function ToolPresentationProvider({ controller, report, children, }) {
|
|
26
|
-
const [, changed] = useReducer((revision) => revision + 1, 0);
|
|
27
|
-
useLayoutEffect(() => {
|
|
28
|
-
const unsubscribe = controller?.subscribe(changed);
|
|
29
|
-
// Child bindings may have registered before this provider's layout effect.
|
|
30
|
-
changed();
|
|
31
|
-
return unsubscribe;
|
|
32
|
-
}, [controller]);
|
|
33
|
-
return (_jsx(ToolPresentationContext.Provider, { value: { controller, report }, children: children }));
|
|
34
|
-
}
|
|
35
|
-
export function useToolPresentations() {
|
|
36
|
-
return useContext(ToolPresentationContext);
|
|
37
|
-
}
|
|
38
23
|
const createId = () => globalThis.crypto.randomUUID();
|
|
39
24
|
const textOf = (message) => message.parts
|
|
40
25
|
.filter((part) => part.type === "text")
|
|
@@ -371,17 +356,12 @@ export function NexfaceProvider(props) {
|
|
|
371
356
|
}
|
|
372
357
|
},
|
|
373
358
|
};
|
|
374
|
-
return (_jsx(ChatContext.Provider, { value: value, children: _jsx(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
if (registered)
|
|
381
|
-
pageTools.current.add(name);
|
|
382
|
-
else
|
|
383
|
-
pageTools.current.delete(name);
|
|
384
|
-
}, children: children }) }) }) }));
|
|
359
|
+
return (_jsx(ChatContext.Provider, { value: value, children: _jsx(ToolsProvider, { toolRuntime: toolRuntime, webMcp: webMcp, children: _jsx(PageConfirmationProvider, { interrupt: approval, onConfirm: () => getClientController(active().client).confirmPage(), onBindingRemoved: () => getClientController(active().client).invalidate("Page confirmation entry was removed."), onBindingRegistration: (name, registered) => {
|
|
360
|
+
if (registered)
|
|
361
|
+
pageTools.current.add(name);
|
|
362
|
+
else
|
|
363
|
+
pageTools.current.delete(name);
|
|
364
|
+
}, children: children }) }) }));
|
|
385
365
|
}
|
|
386
366
|
export function useChat() {
|
|
387
367
|
const chat = useContext(ChatContext);
|