@mcp-b/react-components 0.14.0 → 0.14.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.
Files changed (38) hide show
  1. package/dist/{AgentChat-Cgb1xuT7.d.ts → AgentChat-DQkqt82e.d.ts} +4 -2
  2. package/dist/{ModelSelector-DVgVBdvw.js → ModelSelector-CPCpFAUt.js} +15 -6
  3. package/dist/{ThinkChat-7DQ2CogF.js → ThinkChat-BPcehdbP.js} +3 -1
  4. package/dist/{ThinkChatActivity-m9orbdeI.d.ts → ThinkChatActivity-BmwuIigx.d.ts} +2 -2
  5. package/dist/{ThinkChatToolParts-Cv4o7j6F.d.ts → ThinkChatToolParts-CDEjqS6A.d.ts} +50 -1
  6. package/dist/components/AgentChat.d.ts +1 -1
  7. package/dist/components/AgentChat.js +8 -6
  8. package/dist/components/ChatGptSignInScreen.js +1 -1
  9. package/dist/components/McpServerPicker.d.ts +1 -1
  10. package/dist/components/McpServerPicker.js +6 -0
  11. package/dist/components/ModelSelector.d.ts +15 -3
  12. package/dist/components/ModelSelector.js +1 -1
  13. package/dist/components/NaniteScene.d.ts +10 -1
  14. package/dist/components/NaniteScene.js +36 -1
  15. package/dist/components/SubagentRun.d.ts +87 -0
  16. package/dist/components/SubagentRun.js +101 -0
  17. package/dist/components/SubagentRunDetails.d.ts +44 -0
  18. package/dist/components/SubagentRunDetails.js +48 -0
  19. package/dist/components/ThinkChat.d.ts +8 -4
  20. package/dist/components/ThinkChat.js +1 -1
  21. package/dist/components/ThinkChatActivity.d.ts +2 -2
  22. package/dist/components/ThinkChatActivity.js +30 -3
  23. package/dist/components/ThinkChatToolPanels.d.ts +10 -2
  24. package/dist/components/ThinkChatToolPanels.js +47 -2
  25. package/dist/components/ThinkChatToolParts.d.ts +2 -2
  26. package/dist/components/ThinkChatToolParts.js +17 -1
  27. package/dist/components/ThinkFullApp.js +1 -1
  28. package/dist/styles/activity.css +6 -0
  29. package/dist/styles/agent-chat.css +15 -1
  30. package/dist/styles/index.css +1 -0
  31. package/dist/styles/message-scroller.css +1 -1
  32. package/dist/styles/message.css +2 -0
  33. package/dist/styles/nanite-scene.css +16 -0
  34. package/dist/styles/streamdown.css +10 -0
  35. package/dist/styles/subagent-run.css +188 -0
  36. package/dist/styles/think-full-app.css +2 -0
  37. package/dist/styles/workspace-explorer.css +1 -0
  38. package/package.json +2 -2
@@ -44,8 +44,7 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
44
44
  * @example Think session compaction setup
45
45
  * ```ts
46
46
  * import { Think, defaultContextOverflowClassifier } from "@cloudflare/think";
47
- * import { Session } from "agents/experimental/memory/session";
48
- * import { createCompactFunction } from "agents/experimental/memory/utils";
47
+ * import { Session, createCompactFunction } from "agents/sessions";
49
48
  * import { generateText } from "ai";
50
49
  *
51
50
  * export class MyAgent extends Think<Env> {
@@ -78,6 +77,8 @@ interface AgentChatProps<MessageT extends UIMessage = UIMessage> {
78
77
  status?: ChatStatus;
79
78
  /** Called with the composed message when the user submits. Omit for a read-only transcript. */
80
79
  onSubmit?: (message: PromptInputMessage) => void | Promise<void>;
80
+ /** Show the prompt composer. Defaults to whether `onSubmit` is provided. */
81
+ showComposer?: boolean;
81
82
  /** Called when the user hits stop while `status` is streaming/submitted. */
82
83
  onStop?: () => void;
83
84
  placeholder?: string;
@@ -174,6 +175,7 @@ declare function AgentChat<MessageT extends UIMessage = UIMessage>({
174
175
  messages,
175
176
  status,
176
177
  onSubmit,
178
+ showComposer,
177
179
  onStop,
178
180
  placeholder,
179
181
  disabled,
@@ -134,7 +134,11 @@ function readCloudflareModelId(entry) {
134
134
  const modelId = readCatalogString(entry);
135
135
  return modelId && isCloudflareRunnableModelId(modelId) ? modelId : null;
136
136
  }
137
- for (const field of ["name", "id"]) {
137
+ for (const field of [
138
+ "model_id",
139
+ "name",
140
+ "id"
141
+ ]) {
138
142
  const modelId = readCatalogField(entry, field);
139
143
  if (modelId && isCloudflareRunnableModelId(modelId)) return modelId;
140
144
  }
@@ -175,12 +179,17 @@ function normalizeCloudflareModelSelectorModels(models) {
175
179
  return options;
176
180
  }
177
181
  async function listCloudflareModelSelectorOptions(client, params) {
182
+ const { account_id, task, per_page = 100 } = params;
178
183
  const models = [];
179
- for await (const model of client.ai.models.list(params)) models.push(model);
180
- if (params.format !== "openrouter") for await (const model of client.ai.models.list({
181
- ...params,
182
- format: "openrouter"
183
- })) models.push(model);
184
+ for (let page = 1;; page += 1) {
185
+ const response = await client.get(`/accounts/${account_id}/ai/catalog/models`, { query: {
186
+ page,
187
+ per_page
188
+ } });
189
+ const pageModels = response.result.filter((model) => !model.private && (!task || model.task === task));
190
+ models.push(...pageModels);
191
+ if (response.result.length < per_page) break;
192
+ }
184
193
  return normalizeCloudflareModelSelectorModels(models);
185
194
  }
186
195
  function groupCloudflareModelOptions(options) {
@@ -119,7 +119,9 @@ const ThinkChatApprovalsContext = React.createContext(null);
119
119
  * The full conversation surface — message list plus composer — with the
120
120
  * activity renderer as the default `renderPart`: runs of reasoning/tool parts
121
121
  * fold into one collapsed Activity block with derived labels and per-tool
122
- * panels. Extend for app-specific tools with `toolRenderers` (label/panel
122
+ * panels. Session-generated context/load/search tools are recognized from
123
+ * their upstream runtime schemas and keep their recorded inputs and outputs
124
+ * inspectable. Extend for app-specific tools with `toolRenderers` (label/panel
123
125
  * inside the log) or `excludeTools` + your own `renderPart` (standalone
124
126
  * card) — see README "App-specific tools" and the Custom Tool Panel story.
125
127
  */
@@ -1,5 +1,5 @@
1
- import { a as AgentChatRenderPartContext, r as AgentChatProps } from "./AgentChat-Cgb1xuT7.js";
2
- import { s as ThinkChatPart } from "./ThinkChatToolParts-Cv4o7j6F.js";
1
+ import { a as AgentChatRenderPartContext, r as AgentChatProps } from "./AgentChat-DQkqt82e.js";
2
+ import { l as ThinkChatPart } from "./ThinkChatToolParts-CDEjqS6A.js";
3
3
  import * as React from "react";
4
4
  import { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai";
5
5
 
@@ -39,6 +39,55 @@ type SkillUITools = {
39
39
  };
40
40
  type SkillToolPart = ToolUIPart<SkillUITools>;
41
41
  declare function isSkillToolPart(part: ThinkChatPart): part is SkillToolPart;
42
+ type SetContextInput = {
43
+ label: string;
44
+ content: string;
45
+ action?: "replace" | "append";
46
+ metadata?: {
47
+ title?: string;
48
+ description?: string;
49
+ };
50
+ };
51
+ type SessionContextUITools = {
52
+ set_context: {
53
+ input: SetContextInput;
54
+ output: string;
55
+ };
56
+ load_context: {
57
+ input: {
58
+ label: string;
59
+ key: string;
60
+ };
61
+ output: string;
62
+ };
63
+ unload_context: {
64
+ input: {
65
+ label: string;
66
+ key: string;
67
+ };
68
+ output: string;
69
+ };
70
+ search_context: {
71
+ input: {
72
+ label: string;
73
+ query: string;
74
+ };
75
+ output: string;
76
+ };
77
+ session_search: {
78
+ input: {
79
+ query: string;
80
+ };
81
+ output: string;
82
+ };
83
+ };
84
+ type SessionContextToolPart = ToolUIPart<SessionContextUITools>;
85
+ type SessionContextToolName = keyof SessionContextUITools;
86
+ declare function isSessionContextToolPart(part: ThinkChatPart): part is SessionContextToolPart;
87
+ /** Session tools report provider failures as successful string outputs so the
88
+ model can recover. Treat that upstream `Error:` envelope as failed UI while
89
+ preserving the recorded tool state and output verbatim. */
90
+ declare function isSessionContextToolFailure(part: SessionContextToolPart): boolean;
42
91
  type FetchToolInput = {
43
92
  url: string;
44
93
  path?: never;
@@ -88,4 +137,4 @@ declare function isPartWorking(part: ThinkChatPart): boolean;
88
137
  declare function isPartFailed(part: ThinkChatPart): boolean;
89
138
  declare function displayUrl(url: string | undefined): string;
90
139
  //#endregion
91
- export { isThinkChatActivityPart as _, ThinkBashToolOutput as a, ThinkWorkspaceToolName as c, isBrowserToolPart as d, isExecuteToolPart as f, isSkillToolPart as g, isPartWorking as h, SkillToolPart as i, WorkspaceToolPart as l, isPartFailed as m, ExecuteToolPart as n, ThinkBashToolPart as o, isFetchToolPart as p, FetchToolPart as r, ThinkChatPart as s, BrowserToolPart as t, displayUrl as u, isWorkspaceToolPart as v };
140
+ export { isWorkspaceToolPart as S, isPartWorking as _, SessionContextToolPart as a, isSkillToolPart as b, ThinkBashToolPart as c, WorkspaceToolPart as d, displayUrl as f, isPartFailed as g, isFetchToolPart as h, SessionContextToolName as i, ThinkChatPart as l, isExecuteToolPart as m, ExecuteToolPart as n, SkillToolPart as o, isBrowserToolPart as p, FetchToolPart as r, ThinkBashToolOutput as s, BrowserToolPart as t, ThinkWorkspaceToolName as u, isSessionContextToolFailure as v, isThinkChatActivityPart as x, isSessionContextToolPart as y };
@@ -1,2 +1,2 @@
1
- import { a as AgentChatRenderPartContext, i as AgentChatRenderMessageContext, n as AgentChatPart, r as AgentChatProps, t as AgentChat } from "../AgentChat-Cgb1xuT7.js";
1
+ import { a as AgentChatRenderPartContext, i as AgentChatRenderMessageContext, n as AgentChatPart, r as AgentChatProps, t as AgentChat } from "../AgentChat-DQkqt82e.js";
2
2
  export { AgentChat, AgentChatPart, AgentChatProps, AgentChatRenderMessageContext, AgentChatRenderPartContext };
@@ -107,11 +107,12 @@ function isStepStartPart(part) {
107
107
  /**
108
108
  * Session compaction overlay marker from Agents Sessions.
109
109
  *
110
- * Agents exports `isCompactionMessage` from
111
- * `agents/experimental/memory/utils`; it checks the canonical `compaction_`
110
+ * Agents exports `isCompactionMessage` from `agents/sessions`; it checks the canonical `compaction_`
112
111
  * id prefix used when `Session.getHistory()` materializes a summary overlay.
113
112
  * `UIMessage` is structurally compatible with the fields the helper reads, so
114
- * keep this wrapper instead of duplicating the prefix test locally.
113
+ * keep this wrapper instead of duplicating the prefix test locally. The
114
+ * runtime import above stays on the deprecated compatibility path until this
115
+ * package raises its Agents dependency floor to the graduating release.
115
116
  */
116
117
  function isCompactionMessage$1(message) {
117
118
  return isCompactionMessage(message);
@@ -310,7 +311,7 @@ function renderDefaultPart(part) {
310
311
  * transport. Product code that talks to a Cloudflare Think agent should render
311
312
  * `ThinkChat`; use this directly only for plain AI SDK or read-only messages.
312
313
  */
313
- function AgentChat({ className, messages, status = "ready", onSubmit, onStop, placeholder = "Ask anything...", disabled, emptyState, composerHeader, composerTools, voiceInput, beforeVoiceStart, composerAddMenuItems, notice, onRegenerate, onEditAndResend, onApprovalResponse, thinkStub, onExecutionSettled, pendingApprovals: durableApprovals = EMPTY_PENDING_APPROVALS, contextWindow, renderPart, renderMessageAfter, ref }) {
314
+ function AgentChat({ className, messages, status = "ready", onSubmit, showComposer = onSubmit !== void 0, onStop, placeholder = "Ask anything...", disabled, emptyState, composerHeader, composerTools, voiceInput, beforeVoiceStart, composerAddMenuItems, notice, onRegenerate, onEditAndResend, onApprovalResponse, thinkStub, onExecutionSettled, pendingApprovals: durableApprovals = EMPTY_PENDING_APPROVALS, contextWindow, renderPart, renderMessageAfter, ref }) {
314
315
  const [copyAnnouncement, setCopyAnnouncement] = React.useState("");
315
316
  const copyAnnouncementTimer = React.useRef(null);
316
317
  const announceCopyStatus = React.useCallback((message) => {
@@ -414,6 +415,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, onStop, pl
414
415
  return /* @__PURE__ */ jsxs("div", {
415
416
  ref,
416
417
  className: cx("agent-chat", className),
418
+ "data-composer-hidden": showComposer ? void 0 : "",
417
419
  children: [
418
420
  /* @__PURE__ */ jsx("span", {
419
421
  className: "message__copy-status",
@@ -512,7 +514,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, onStop, pl
512
514
  })]
513
515
  })
514
516
  }),
515
- /* @__PURE__ */ jsxs("div", {
517
+ showComposer ? /* @__PURE__ */ jsxs("div", {
516
518
  ref: composerRef,
517
519
  className: "agent-chat__composer",
518
520
  children: [/* @__PURE__ */ jsx("div", {
@@ -572,7 +574,7 @@ function AgentChat({ className, messages, status = "ready", onSubmit, onStop, pl
572
574
  })] })
573
575
  ] })
574
576
  })]
575
- })
577
+ }) : null
576
578
  ]
577
579
  });
578
580
  }
@@ -1,7 +1,7 @@
1
1
  import { t as cx } from "../class-names-9UtZwb0J.js";
2
2
  import { N as SpinnerIcon } from "../icons-Ba9THQKz.js";
3
3
  import { Button } from "./Button.js";
4
- import { u as ModelSelectorLogo } from "../ModelSelector-DVgVBdvw.js";
4
+ import { u as ModelSelectorLogo } from "../ModelSelector-CPCpFAUt.js";
5
5
  import "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/components/ChatGptSignInScreen.tsx
@@ -16,7 +16,7 @@ interface McpServerPickerProps {
16
16
  onRetry?: McpServerConnectionAction;
17
17
  /** Called when a ready/connected server should refresh discovery through an app-owned Agent RPC. */
18
18
  onRefresh?: McpServerConnectionAction;
19
- /** Called when a server transport should close but the stored config should remain. */
19
+ /** Called when an authenticating or connected server should be removed or disconnected. */
20
20
  onDisconnect?: McpServerConnectionAction;
21
21
  /** Offset from the plus trigger to the menu, useful for prompt composers. */
22
22
  sideOffset?: number;
@@ -120,6 +120,12 @@ function McpServerPickerRow({ server, mcp, onConnect, onAuthorize, onDisconnect,
120
120
  label: pending("authorize") ? `Opening ${server.name}` : `Authorize ${server.name}`,
121
121
  onClick: () => onAuthorize(connectedServerId, connectedServer)
122
122
  }) : null,
123
+ connectedServer?.state === "authenticating" && connectedServerId && onDisconnect ? /* @__PURE__ */ jsx(McpServerActionItem, {
124
+ disabled: pending("disconnect"),
125
+ icon: /* @__PURE__ */ jsx(MinusIcon, {}),
126
+ label: pending("disconnect") ? `Cancelling ${server.name} authentication` : `Cancel ${server.name} authentication`,
127
+ onClick: () => onDisconnect(connectedServerId, connectedServer)
128
+ }) : null,
123
129
  connectedServer?.state === "failed" && connectedServerId && onRetry ? /* @__PURE__ */ jsx(McpServerActionItem, {
124
130
  disabled: pending("retry"),
125
131
  icon: /* @__PURE__ */ jsx(RefreshIcon, {}),
@@ -5,7 +5,19 @@ import Cloudflare from "cloudflare";
5
5
  import { AiModelsSearchObject } from "@cloudflare/workers-types";
6
6
 
7
7
  //#region src/components/ModelSelector.d.ts
8
- type CloudflareModelSelectorModels = readonly Cloudflare.AI.ModelListResponse[] | readonly AiModelsSearchObject[] | readonly string[];
8
+ type CloudflareModelSelectorModels = readonly Cloudflare.AI.ModelListResponse[] | readonly CloudflareModelCatalogEntry[] | readonly AiModelsSearchObject[] | readonly string[];
9
+ interface CloudflareModelCatalogEntry {
10
+ readonly model_id: string;
11
+ readonly name?: string;
12
+ readonly description?: string;
13
+ readonly task?: string;
14
+ readonly private?: boolean;
15
+ }
16
+ interface CloudflareModelCatalogListParams {
17
+ readonly account_id: string;
18
+ readonly task?: string;
19
+ readonly per_page?: number;
20
+ }
9
21
  interface CloudflareModelSelectorOption {
10
22
  readonly id: string;
11
23
  readonly provider: string;
@@ -36,7 +48,7 @@ declare function readCloudflareModelId(entry: unknown): string | null;
36
48
  declare function getCloudflareModelProvider(modelId: string): string;
37
49
  declare function formatCloudflareModelProvider(provider: string): string;
38
50
  declare function normalizeCloudflareModelSelectorModels(models: CloudflareModelSelectorModels): CloudflareModelSelectorOption[];
39
- declare function listCloudflareModelSelectorOptions(client: Cloudflare, params: Cloudflare.AI.ModelListParams): Promise<CloudflareModelSelectorOption[]>;
51
+ declare function listCloudflareModelSelectorOptions(client: Cloudflare, params: CloudflareModelCatalogListParams): Promise<CloudflareModelSelectorOption[]>;
40
52
  interface ModelSelectorProps extends React.HTMLAttributes<HTMLDivElement> {
41
53
  /** Controlled dialog open state. */
42
54
  open?: boolean;
@@ -244,4 +256,4 @@ declare function ModelSelectorShortcut({
244
256
  ref?: React.Ref<HTMLSpanElement>;
245
257
  }): React.JSX.Element;
246
258
  //#endregion
247
- export { CloudflareModelSelector, CloudflareModelSelectorModels, CloudflareModelSelectorOption, CloudflareModelSelectorProps, ModelSelector, ModelSelectorContent, ModelSelectorContentProps, ModelSelectorDialog, ModelSelectorDialogProps, ModelSelectorEmpty, ModelSelectorEmptyProps, ModelSelectorGroup, ModelSelectorGroupProps, ModelSelectorInput, ModelSelectorInputProps, ModelSelectorItem, ModelSelectorItemProps, ModelSelectorList, ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, ModelSelectorLogoGroupProps, ModelSelectorLogoProps, ModelSelectorName, ModelSelectorNameProps, ModelSelectorProps, ModelSelectorSeparator, ModelSelectorSeparatorProps, ModelSelectorShortcut, ModelSelectorShortcutProps, ModelSelectorTrigger, ModelSelectorTriggerProps, formatCloudflareModelProvider, getCloudflareModelProvider, isCloudflareRunnableModelId, listCloudflareModelSelectorOptions, normalizeCloudflareModelSelectorModels, readCloudflareModelId };
259
+ export { CloudflareModelCatalogEntry, CloudflareModelCatalogListParams, CloudflareModelSelector, CloudflareModelSelectorModels, CloudflareModelSelectorOption, CloudflareModelSelectorProps, ModelSelector, ModelSelectorContent, ModelSelectorContentProps, ModelSelectorDialog, ModelSelectorDialogProps, ModelSelectorEmpty, ModelSelectorEmptyProps, ModelSelectorGroup, ModelSelectorGroupProps, ModelSelectorInput, ModelSelectorInputProps, ModelSelectorItem, ModelSelectorItemProps, ModelSelectorList, ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, ModelSelectorLogoGroupProps, ModelSelectorLogoProps, ModelSelectorName, ModelSelectorNameProps, ModelSelectorProps, ModelSelectorSeparator, ModelSelectorSeparatorProps, ModelSelectorShortcut, ModelSelectorShortcutProps, ModelSelectorTrigger, ModelSelectorTriggerProps, formatCloudflareModelProvider, getCloudflareModelProvider, isCloudflareRunnableModelId, listCloudflareModelSelectorOptions, normalizeCloudflareModelSelectorModels, readCloudflareModelId };
@@ -1,2 +1,2 @@
1
- import { _ as getCloudflareModelProvider, a as ModelSelectorEmpty, b as normalizeCloudflareModelSelectorModels, c as ModelSelectorItem, d as ModelSelectorLogoGroup, f as ModelSelectorName, g as formatCloudflareModelProvider, h as ModelSelectorTrigger, i as ModelSelectorDialog, l as ModelSelectorList, m as ModelSelectorShortcut, n as ModelSelector, o as ModelSelectorGroup, p as ModelSelectorSeparator, r as ModelSelectorContent, s as ModelSelectorInput, t as CloudflareModelSelector, u as ModelSelectorLogo, v as isCloudflareRunnableModelId, x as readCloudflareModelId, y as listCloudflareModelSelectorOptions } from "../ModelSelector-DVgVBdvw.js";
1
+ import { _ as getCloudflareModelProvider, a as ModelSelectorEmpty, b as normalizeCloudflareModelSelectorModels, c as ModelSelectorItem, d as ModelSelectorLogoGroup, f as ModelSelectorName, g as formatCloudflareModelProvider, h as ModelSelectorTrigger, i as ModelSelectorDialog, l as ModelSelectorList, m as ModelSelectorShortcut, n as ModelSelector, o as ModelSelectorGroup, p as ModelSelectorSeparator, r as ModelSelectorContent, s as ModelSelectorInput, t as CloudflareModelSelector, u as ModelSelectorLogo, v as isCloudflareRunnableModelId, x as readCloudflareModelId, y as listCloudflareModelSelectorOptions } from "../ModelSelector-CPCpFAUt.js";
2
2
  export { CloudflareModelSelector, ModelSelector, ModelSelectorContent, ModelSelectorDialog, ModelSelectorEmpty, ModelSelectorGroup, ModelSelectorInput, ModelSelectorItem, ModelSelectorList, ModelSelectorLogo, ModelSelectorLogoGroup, ModelSelectorName, ModelSelectorSeparator, ModelSelectorShortcut, ModelSelectorTrigger, formatCloudflareModelProvider, getCloudflareModelProvider, isCloudflareRunnableModelId, listCloudflareModelSelectorOptions, normalizeCloudflareModelSelectorModels, readCloudflareModelId };
@@ -6,6 +6,15 @@ type NaniteSceneProps = {
6
6
  readonly className?: string; /** Accessible title when the illustration communicates state. */
7
7
  readonly title?: string;
8
8
  };
9
+ type NaniteMarkProps = {
10
+ /** Selects one of the established Nanite body colors. */readonly index?: number; /** Additional class names for layout only. */
11
+ readonly className?: string;
12
+ };
13
+ /** Compact decorative Nanite identity mark for dense agent and task UI. */
14
+ declare function NaniteMark({
15
+ index,
16
+ className
17
+ }: NaniteMarkProps): import("react").JSX.Element;
9
18
  /**
10
19
  * Decorative Nanites illustration used in setup, status, and empty states.
11
20
  * Pass a title when the illustration communicates state; otherwise it remains
@@ -30,4 +39,4 @@ declare function NaniteScene({
30
39
  title
31
40
  }: NaniteSceneProps): import("react").JSX.Element;
32
41
  //#endregion
33
- export { NaniteScene, NaniteSceneProps, NaniteSceneVariant };
42
+ export { NaniteMark, NaniteMarkProps, NaniteScene, NaniteSceneProps, NaniteSceneVariant };
@@ -22,6 +22,41 @@ const TRIO_XS = [
22
22
  100,
23
23
  160
24
24
  ];
25
+ /** Compact decorative Nanite identity mark for dense agent and task UI. */
26
+ function NaniteMark({ index = 0, className }) {
27
+ return /* @__PURE__ */ jsx("span", {
28
+ className: ["nanite-mark", className].filter(Boolean).join(" "),
29
+ "aria-hidden": "true",
30
+ children: /* @__PURE__ */ jsxs("svg", {
31
+ viewBox: "-18 -34 36 54",
32
+ focusable: "false",
33
+ fill: "none",
34
+ children: [/* @__PURE__ */ jsx(NaniteBody, { index }), /* @__PURE__ */ jsxs("g", {
35
+ className: "nanite-mark__hat",
36
+ children: [
37
+ /* @__PURE__ */ jsx("path", {
38
+ d: "M -9 -22 Q -9 -31 0 -31 Q 9 -31 9 -22 Z",
39
+ fill: HAT_SHELL
40
+ }),
41
+ /* @__PURE__ */ jsx("rect", {
42
+ x: "-12",
43
+ y: "-23",
44
+ width: "24",
45
+ height: "3.5",
46
+ rx: "1.5",
47
+ fill: HAT_BRIM
48
+ }),
49
+ /* @__PURE__ */ jsx("circle", {
50
+ cx: "0",
51
+ cy: "-28",
52
+ r: "2",
53
+ fill: HAT_BULB
54
+ })
55
+ ]
56
+ })]
57
+ })
58
+ });
59
+ }
25
60
  /**
26
61
  * Decorative Nanites illustration used in setup, status, and empty states.
27
62
  * Pass a title when the illustration communicates state; otherwise it remains
@@ -402,4 +437,4 @@ function Nanite({ index, cx, cy, scale }) {
402
437
  });
403
438
  }
404
439
  //#endregion
405
- export { NaniteScene };
440
+ export { NaniteMark, NaniteScene };
@@ -0,0 +1,87 @@
1
+ import { Collapsible } from "./Collapsible.js";
2
+ import { BadgeProps } from "./Badge.js";
3
+ import { SubagentRunActions, SubagentRunActionsProps, SubagentRunMilestone, SubagentRunMilestoneProps, SubagentRunMilestones, SubagentRunMilestonesProps, SubagentRunProgress, SubagentRunProgressProps } from "./SubagentRunDetails.js";
4
+ import * as React from "react";
5
+
6
+ //#region src/components/SubagentRun.d.ts
7
+ interface SubagentRunProps extends Omit<React.ComponentProps<typeof Collapsible.Root>, "className" | "unstyled"> {
8
+ className?: string;
9
+ }
10
+ /** Transport-neutral disclosure for one delegated agent run. */
11
+ declare function SubagentRun({
12
+ className,
13
+ ref,
14
+ ...props
15
+ }: SubagentRunProps): React.JSX.Element;
16
+ interface SubagentRunTriggerProps extends Omit<React.ComponentProps<typeof Collapsible.Trigger>, "className" | "unstyled"> {
17
+ className?: string;
18
+ }
19
+ interface SubagentRunSelectorProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
20
+ naniteIndex?: number;
21
+ selected?: boolean;
22
+ }
23
+ /** Compact selector for a run whose transcript is rendered in a separate detail surface. */
24
+ declare function SubagentRunSelector({
25
+ className,
26
+ children,
27
+ naniteIndex,
28
+ selected,
29
+ ref,
30
+ type,
31
+ ...props
32
+ }: SubagentRunSelectorProps & {
33
+ ref?: React.Ref<HTMLButtonElement>;
34
+ }): React.JSX.Element;
35
+ /** Compact run selector. Use the content for a short preview, not a full child transcript. */
36
+ declare function SubagentRunTrigger({
37
+ className,
38
+ children,
39
+ ref,
40
+ ...props
41
+ }: SubagentRunTriggerProps): React.JSX.Element;
42
+ interface SubagentRunHeadingProps extends React.HTMLAttributes<HTMLSpanElement> {}
43
+ declare function SubagentRunHeading({
44
+ className,
45
+ ref,
46
+ ...props
47
+ }: SubagentRunHeadingProps & {
48
+ ref?: React.Ref<HTMLSpanElement>;
49
+ }): React.JSX.Element;
50
+ interface SubagentRunTitleProps extends React.HTMLAttributes<HTMLSpanElement> {}
51
+ declare function SubagentRunTitle({
52
+ className,
53
+ ref,
54
+ ...props
55
+ }: SubagentRunTitleProps & {
56
+ ref?: React.Ref<HTMLSpanElement>;
57
+ }): React.JSX.Element;
58
+ interface SubagentRunDescriptionProps extends React.HTMLAttributes<HTMLSpanElement> {}
59
+ declare function SubagentRunDescription({
60
+ className,
61
+ ref,
62
+ ...props
63
+ }: SubagentRunDescriptionProps & {
64
+ ref?: React.Ref<HTMLSpanElement>;
65
+ }): React.JSX.Element;
66
+ type SubagentRunStatusTone = "active" | "complete" | "error" | "stopped" | "warning";
67
+ interface SubagentRunStatusProps extends Omit<BadgeProps, "color"> {
68
+ tone?: SubagentRunStatusTone;
69
+ }
70
+ /** Visible status label. A transport adapter owns any debounced live announcement. */
71
+ declare function SubagentRunStatus({
72
+ className,
73
+ tone,
74
+ size,
75
+ ...props
76
+ }: SubagentRunStatusProps): React.JSX.Element;
77
+ interface SubagentRunContentProps extends Omit<React.ComponentProps<typeof Collapsible.Panel>, "className" | "unstyled"> {
78
+ className?: string;
79
+ }
80
+ declare function SubagentRunContent({
81
+ className,
82
+ children,
83
+ ref,
84
+ ...props
85
+ }: SubagentRunContentProps): React.JSX.Element;
86
+ //#endregion
87
+ export { SubagentRun, SubagentRunActions, type SubagentRunActionsProps, SubagentRunContent, SubagentRunContentProps, SubagentRunDescription, SubagentRunDescriptionProps, SubagentRunHeading, SubagentRunHeadingProps, SubagentRunMilestone, type SubagentRunMilestoneProps, SubagentRunMilestones, type SubagentRunMilestonesProps, SubagentRunProgress, type SubagentRunProgressProps, SubagentRunProps, SubagentRunSelector, SubagentRunSelectorProps, SubagentRunStatus, SubagentRunStatusProps, SubagentRunStatusTone, SubagentRunTitle, SubagentRunTitleProps, SubagentRunTrigger, SubagentRunTriggerProps };
@@ -0,0 +1,101 @@
1
+ import { Collapsible } from "./Collapsible.js";
2
+ import { t as cx } from "../class-names-9UtZwb0J.js";
3
+ import { Badge } from "./Badge.js";
4
+ import { NaniteMark } from "./NaniteScene.js";
5
+ import { SubagentRunActions, SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress } from "./SubagentRunDetails.js";
6
+ import "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/SubagentRun.tsx
9
+ /** Transport-neutral disclosure for one delegated agent run. */
10
+ function SubagentRun({ className, ref, ...props }) {
11
+ return /* @__PURE__ */ jsx(Collapsible.Root, {
12
+ ref,
13
+ "data-slot": "subagent-run",
14
+ className: cx("subagent-run", className),
15
+ ...props,
16
+ unstyled: true
17
+ });
18
+ }
19
+ /** Compact selector for a run whose transcript is rendered in a separate detail surface. */
20
+ function SubagentRunSelector({ className, children, naniteIndex = 0, selected = false, ref, type = "button", ...props }) {
21
+ return /* @__PURE__ */ jsxs("button", {
22
+ ref,
23
+ type,
24
+ "data-slot": "subagent-run-selector",
25
+ className: cx("subagent-run__trigger", className),
26
+ "aria-pressed": selected,
27
+ ...props,
28
+ children: [/* @__PURE__ */ jsx(NaniteMark, { index: naniteIndex }), /* @__PURE__ */ jsx("span", {
29
+ className: "subagent-run__trigger-content",
30
+ children
31
+ })]
32
+ });
33
+ }
34
+ /** Compact run selector. Use the content for a short preview, not a full child transcript. */
35
+ function SubagentRunTrigger({ className, children, ref, ...props }) {
36
+ return /* @__PURE__ */ jsxs(Collapsible.Trigger, {
37
+ ref,
38
+ "data-slot": "subagent-run-trigger",
39
+ className: cx("subagent-run__trigger", className),
40
+ ...props,
41
+ unstyled: true,
42
+ children: [/* @__PURE__ */ jsx(NaniteMark, {}), /* @__PURE__ */ jsx("span", {
43
+ className: "subagent-run__trigger-content",
44
+ children
45
+ })]
46
+ });
47
+ }
48
+ function SubagentRunHeading({ className, ref, ...props }) {
49
+ return /* @__PURE__ */ jsx("span", {
50
+ ref,
51
+ className: cx("subagent-run__heading", className),
52
+ ...props
53
+ });
54
+ }
55
+ function SubagentRunTitle({ className, ref, ...props }) {
56
+ return /* @__PURE__ */ jsx("span", {
57
+ ref,
58
+ className: cx("subagent-run__title", className),
59
+ ...props
60
+ });
61
+ }
62
+ function SubagentRunDescription({ className, ref, ...props }) {
63
+ return /* @__PURE__ */ jsx("span", {
64
+ ref,
65
+ className: cx("subagent-run__description", className),
66
+ ...props
67
+ });
68
+ }
69
+ const STATUS_COLOR = {
70
+ active: "primary",
71
+ complete: "success",
72
+ error: "destructive",
73
+ stopped: "neutral",
74
+ warning: "warning"
75
+ };
76
+ /** Visible status label. A transport adapter owns any debounced live announcement. */
77
+ function SubagentRunStatus({ className, tone = "active", size = "sm", ...props }) {
78
+ return /* @__PURE__ */ jsx(Badge, {
79
+ "data-slot": "subagent-run-status",
80
+ "data-tone": tone,
81
+ className: cx("subagent-run__status", className),
82
+ color: STATUS_COLOR[tone],
83
+ size,
84
+ ...props
85
+ });
86
+ }
87
+ function SubagentRunContent({ className, children, ref, ...props }) {
88
+ return /* @__PURE__ */ jsx(Collapsible.Panel, {
89
+ ref,
90
+ "data-slot": "subagent-run-content",
91
+ className: cx("subagent-run__content", className),
92
+ ...props,
93
+ unstyled: true,
94
+ children: /* @__PURE__ */ jsx("div", {
95
+ className: "subagent-run__content-inner",
96
+ children
97
+ })
98
+ });
99
+ }
100
+ //#endregion
101
+ export { SubagentRun, SubagentRunActions, SubagentRunContent, SubagentRunDescription, SubagentRunHeading, SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress, SubagentRunSelector, SubagentRunStatus, SubagentRunTitle, SubagentRunTrigger };
@@ -0,0 +1,44 @@
1
+ import * as React from "react";
2
+
3
+ //#region src/components/SubagentRunDetails.d.ts
4
+ interface SubagentRunProgressProps extends React.HTMLAttributes<HTMLDivElement> {
5
+ /** Human-readable current action or phase. */
6
+ label: string;
7
+ /** Completion fraction from 0 to 1. Omit for indeterminate progress. */
8
+ value?: number;
9
+ }
10
+ declare function SubagentRunProgress({
11
+ className,
12
+ label,
13
+ value,
14
+ ref,
15
+ ...props
16
+ }: SubagentRunProgressProps & {
17
+ ref?: React.Ref<HTMLDivElement>;
18
+ }): React.JSX.Element;
19
+ interface SubagentRunActionsProps extends React.HTMLAttributes<HTMLDivElement> {}
20
+ declare function SubagentRunActions({
21
+ className,
22
+ ref,
23
+ ...props
24
+ }: SubagentRunActionsProps & {
25
+ ref?: React.Ref<HTMLDivElement>;
26
+ }): React.JSX.Element;
27
+ interface SubagentRunMilestonesProps extends React.OlHTMLAttributes<HTMLOListElement> {}
28
+ declare function SubagentRunMilestones({
29
+ className,
30
+ ref,
31
+ ...props
32
+ }: SubagentRunMilestonesProps & {
33
+ ref?: React.Ref<HTMLOListElement>;
34
+ }): React.JSX.Element;
35
+ interface SubagentRunMilestoneProps extends React.LiHTMLAttributes<HTMLLIElement> {}
36
+ declare function SubagentRunMilestone({
37
+ className,
38
+ ref,
39
+ ...props
40
+ }: SubagentRunMilestoneProps & {
41
+ ref?: React.Ref<HTMLLIElement>;
42
+ }): React.JSX.Element;
43
+ //#endregion
44
+ export { SubagentRunActions, SubagentRunActionsProps, SubagentRunMilestone, SubagentRunMilestoneProps, SubagentRunMilestones, SubagentRunMilestonesProps, SubagentRunProgress, SubagentRunProgressProps };
@@ -0,0 +1,48 @@
1
+ import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { Progress } from "./Progress.js";
3
+ import * as React from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/components/SubagentRunDetails.tsx
6
+ function SubagentRunProgress({ className, label, value, ref, ...props }) {
7
+ const labelId = React.useId();
8
+ const percent = value === void 0 ? null : Math.round(Math.min(1, Math.max(0, value)) * 100);
9
+ return /* @__PURE__ */ jsxs("div", {
10
+ ref,
11
+ className: cx("subagent-run__progress", className),
12
+ ...props,
13
+ children: [/* @__PURE__ */ jsxs("span", {
14
+ id: labelId,
15
+ className: "subagent-run__progress-label",
16
+ children: [/* @__PURE__ */ jsx("span", { children: label }), percent === null ? null : /* @__PURE__ */ jsxs("span", { children: [percent, "%"] })]
17
+ }), /* @__PURE__ */ jsx(Progress.Root, {
18
+ value: percent,
19
+ "aria-labelledby": labelId,
20
+ children: /* @__PURE__ */ jsx(Progress.Track, { children: /* @__PURE__ */ jsx(Progress.Indicator, {}) })
21
+ })]
22
+ });
23
+ }
24
+ function SubagentRunActions({ className, ref, ...props }) {
25
+ return /* @__PURE__ */ jsx("div", {
26
+ ref,
27
+ className: cx("subagent-run__actions", className),
28
+ ...props
29
+ });
30
+ }
31
+ function SubagentRunMilestones({ className, ref, ...props }) {
32
+ return /* @__PURE__ */ jsx("ol", {
33
+ ref,
34
+ "data-slot": "subagent-run-milestones",
35
+ className: cx("subagent-run__milestones", className),
36
+ role: "list",
37
+ ...props
38
+ });
39
+ }
40
+ function SubagentRunMilestone({ className, ref, ...props }) {
41
+ return /* @__PURE__ */ jsx("li", {
42
+ ref,
43
+ className: cx("subagent-run__milestone", className),
44
+ ...props
45
+ });
46
+ }
47
+ //#endregion
48
+ export { SubagentRunActions, SubagentRunMilestone, SubagentRunMilestones, SubagentRunProgress };