devnonla-ui 0.4.0 → 0.4.2
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/package.json
CHANGED
|
@@ -172,6 +172,7 @@ export function useAgentStream({ endpoint, extraBody, headers, fetcher = fetch,
|
|
|
172
172
|
let assistantText = "";
|
|
173
173
|
let currentId = assistantId;
|
|
174
174
|
let needsNewBubble = false;
|
|
175
|
+
const seenToolCallIds = new Set<string>();
|
|
175
176
|
|
|
176
177
|
const freezeOpen = () => {
|
|
177
178
|
const freezeId = currentId;
|
|
@@ -298,6 +299,34 @@ export function useAgentStream({ endpoint, extraBody, headers, fetcher = fetch,
|
|
|
298
299
|
},
|
|
299
300
|
onToolCall: (event) => {
|
|
300
301
|
const label = event.toolLabel ? (event.toolLabel.includes(" ") ? event.toolLabel : formatToolName(event.toolLabel)) : formatToolName(event.toolName);
|
|
302
|
+
const alreadySeen = event.toolCallId ? seenToolCallIds.has(event.toolCallId) : false;
|
|
303
|
+
if (event.toolCallId) seenToolCallIds.add(event.toolCallId);
|
|
304
|
+
|
|
305
|
+
if (alreadySeen) {
|
|
306
|
+
setMessages((prev) =>
|
|
307
|
+
prev.map((m) =>
|
|
308
|
+
m.role === "tool-call" && m.toolCallId === event.toolCallId
|
|
309
|
+
? {
|
|
310
|
+
...m,
|
|
311
|
+
content: event.toolName,
|
|
312
|
+
toolName: event.toolName,
|
|
313
|
+
toolLabel: label,
|
|
314
|
+
toolInput: event.input !== undefined ? event.input : m.toolInput,
|
|
315
|
+
}
|
|
316
|
+
: m,
|
|
317
|
+
),
|
|
318
|
+
);
|
|
319
|
+
if (event.input !== undefined) {
|
|
320
|
+
emitCall({
|
|
321
|
+
toolCallId: event.toolCallId,
|
|
322
|
+
toolName: event.toolName,
|
|
323
|
+
toolLabel: label,
|
|
324
|
+
input: event.input,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
|
|
301
330
|
freezeOpen();
|
|
302
331
|
const id = nextId("tc");
|
|
303
332
|
const call: AgentToolCallEvent = {
|
|
@@ -2,12 +2,10 @@ import { forwardRef, type ReactNode } from "react";
|
|
|
2
2
|
import { FluentIcon } from "../icon/FluentIcon";
|
|
3
3
|
|
|
4
4
|
const iconButtonClass =
|
|
5
|
-
"group w-[96px] flex flex-col items-center gap-
|
|
5
|
+
"group w-[96px] flex flex-col items-center gap-0.5 py-2 px-0 rounded-md border-none cursor-pointer select-none outline-none bg-transparent focus-visible:outline-2 focus-visible:outline-brand motion-safe:transition-transform motion-safe:hover:-translate-y-0.5 motion-safe:active:scale-[0.98]";
|
|
6
6
|
|
|
7
7
|
const labelClass = "text-xs leading-[18px] font-semibold text-center line-clamp-2 w-full";
|
|
8
8
|
|
|
9
|
-
const plateClass = "nonla-window-glass nonla-desktop-icon-plate w-11 h-11 flex items-center justify-center";
|
|
10
|
-
|
|
11
9
|
export const DesktopIcon = forwardRef<
|
|
12
10
|
HTMLButtonElement,
|
|
13
11
|
{
|
|
@@ -21,11 +19,7 @@ export const DesktopIcon = forwardRef<
|
|
|
21
19
|
>(function DesktopIcon({ label, icon, media, active = false, onCard = false, onClick }, ref) {
|
|
22
20
|
return (
|
|
23
21
|
<button ref={ref} type="button" title={label} aria-label={label} aria-current={active ? "true" : undefined} dir="ltr" onClick={onClick} className={iconButtonClass}>
|
|
24
|
-
{media ??
|
|
25
|
-
<span className={plateClass}>
|
|
26
|
-
<FluentIcon name={icon ?? "sparkle-24"} size={32} />
|
|
27
|
-
</span>
|
|
28
|
-
)}
|
|
22
|
+
{media ?? <FluentIcon name={icon ?? "sparkle-24"} size={32} />}
|
|
29
23
|
<span className={`${labelClass} ${onCard ? "text-foreground" : "text-white [text-shadow:0_1px_2px_rgba(0,0,0,0.85)]"}`}>{label}</span>
|
|
30
24
|
</button>
|
|
31
25
|
);
|
|
@@ -6,7 +6,7 @@ export function MeadowDesktop({ children, src }: { children?: ReactNode; src?: s
|
|
|
6
6
|
<div className="absolute inset-0 bg-meadow">
|
|
7
7
|
<MeadowWallpaper src={src} />
|
|
8
8
|
<div className="nonla-desktop-layer absolute inset-x-0 bottom-0 top-desktop-bar">
|
|
9
|
-
<nav aria-label="Desktop" className="absolute inset-0 overflow-auto pl-
|
|
9
|
+
<nav aria-label="Desktop" className="absolute inset-0 overflow-auto pl-0 pr-3 pt-3 pb-3">
|
|
10
10
|
<div className="flex h-full flex-col flex-wrap content-start gap-x-2 gap-y-3">{children}</div>
|
|
11
11
|
</nav>
|
|
12
12
|
</div>
|
package/src/styles.css
CHANGED
|
@@ -633,14 +633,6 @@
|
|
|
633
633
|
backdrop-filter: blur(40px) saturate(108%);
|
|
634
634
|
}
|
|
635
635
|
|
|
636
|
-
/* Fluent Color desktop tile — same frost as the window, macOS squircle. */
|
|
637
|
-
.nonla-desktop-icon-plate {
|
|
638
|
-
overflow: hidden;
|
|
639
|
-
border: 0;
|
|
640
|
-
border-radius: 22%;
|
|
641
|
-
box-shadow: none;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
636
|
.nonla-btn-glass {
|
|
645
637
|
border-color: var(--glass-border);
|
|
646
638
|
background: var(--glass);
|