@mcp-b/react-components 0.46.7 → 0.48.0

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 (130) hide show
  1. package/dist/{CodeBlock-CcteqDvA.js → CodeBlock-BSJl682D.js} +1 -1
  2. package/dist/Correspondent-7K6uNLUm.d.ts +64 -0
  3. package/dist/{FileTree-jtP9471I.js → FileTree-DvE0hNZu.js} +1 -1
  4. package/dist/{SetupChecklist-BXwSSorj.js → SetupChecklist-DeTU9YpW.js} +1 -1
  5. package/dist/ThinkChat-CwMdEum8.d.ts +185 -0
  6. package/dist/{ThinkChat-qztQ6Clo.js → ThinkChat-DiI6hhDP.js} +14 -14
  7. package/dist/ThinkThreadPicker-yFz4vvIf.d.ts +91 -0
  8. package/dist/{Workspace-DZusrEeP.d.ts → Workspace-LIoU30n7.d.ts} +13 -2
  9. package/dist/{WorkspaceFileView-D0HyoUV8.js → WorkspaceFileView-C_WnYm-a.js} +4 -4
  10. package/dist/{WorkspaceLink-DtH66bAY.js → WorkspaceLink-B1d2GIGl.js} +7 -2
  11. package/dist/WorkspaceLive-DfjH1Ypm.d.ts +61 -0
  12. package/dist/{WorkspaceMessageResponse-CJCmGvTx.js → WorkspaceMessageResponse-BqOezptB.js} +79 -40
  13. package/dist/WorkspaceMessageResponse-kJYU8Onj.d.ts +48 -0
  14. package/dist/components/agents-sdk/AgentActivity.js +1 -1
  15. package/dist/components/agents-sdk/AgentChat.js +2 -2
  16. package/dist/components/agents-sdk/BrowserLiveScreen.js +1 -1
  17. package/dist/components/agents-sdk/BrowserLiveView.js +1 -1
  18. package/dist/components/agents-sdk/BrowserReplay.js +1 -1
  19. package/dist/components/agents-sdk/BrowserRunPanel.js +1 -1
  20. package/dist/components/agents-sdk/ManagerOffice.d.ts +41 -50
  21. package/dist/components/agents-sdk/ManagerOffice.js +359 -978
  22. package/dist/components/agents-sdk/McpConnectionRequest.js +1 -1
  23. package/dist/components/agents-sdk/McpPluginCatalog.js +1 -1
  24. package/dist/components/agents-sdk/McpServerPicker.js +1 -1
  25. package/dist/components/agents-sdk/ModelSelector.js +1 -1
  26. package/dist/components/agents-sdk/PromptInputCommands.js +1 -1
  27. package/dist/components/agents-sdk/SubagentRunIndicator.js +1 -1
  28. package/dist/components/agents-sdk/ThinkChat.d.ts +1 -180
  29. package/dist/components/agents-sdk/ThinkChat.js +1 -1
  30. package/dist/components/agents-sdk/ThinkChatToolPanels.js +1 -1
  31. package/dist/components/agents-sdk/ThinkExecutionDetail.js +1 -1
  32. package/dist/components/agents-sdk/ThinkExecutionStatus.js +1 -1
  33. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +1 -1
  34. package/dist/components/agents-sdk/ThinkFullApp.d.ts +12 -3
  35. package/dist/components/agents-sdk/ThinkFullApp.js +15 -3
  36. package/dist/components/agents-sdk/ThinkRoutineBrowser.js +1 -1
  37. package/dist/components/agents-sdk/ThinkRoutineForm.js +1 -1
  38. package/dist/components/agents-sdk/ThinkRoutineLibrary.js +1 -1
  39. package/dist/components/agents-sdk/ThinkSidepanel.d.ts +20 -5
  40. package/dist/components/agents-sdk/ThinkSidepanel.js +48 -36
  41. package/dist/components/agents-sdk/ThinkThreadPicker.d.ts +1 -90
  42. package/dist/components/agents-sdk/ThinkThreadPicker.js +1 -1
  43. package/dist/components/agents-sdk/Workspace.d.ts +2 -2
  44. package/dist/components/agents-sdk/Workspace.js +13 -10
  45. package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +1 -1
  46. package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
  47. package/dist/components/agents-sdk/WorkspaceConcept.d.ts +45 -0
  48. package/dist/components/agents-sdk/WorkspaceConcept.js +42 -0
  49. package/dist/components/agents-sdk/WorkspaceCorrespondence.d.ts +96 -0
  50. package/dist/components/agents-sdk/WorkspaceCorrespondence.js +429 -0
  51. package/dist/components/agents-sdk/WorkspaceExecution.d.ts +115 -0
  52. package/dist/components/agents-sdk/WorkspaceExecution.js +330 -0
  53. package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +1 -1
  54. package/dist/components/agents-sdk/WorkspaceExplorer.js +2 -2
  55. package/dist/components/agents-sdk/WorkspaceFileView.js +1 -1
  56. package/dist/components/agents-sdk/WorkspaceHeader.js +1 -1
  57. package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
  58. package/dist/components/agents-sdk/WorkspaceLive.d.ts +2 -0
  59. package/dist/components/agents-sdk/WorkspaceLive.js +113 -0
  60. package/dist/components/agents-sdk/WorkspaceMessageResponse.d.ts +2 -2
  61. package/dist/components/agents-sdk/WorkspaceMessageResponse.js +2 -2
  62. package/dist/components/agents-sdk/WorkspaceMountManager.js +1 -1
  63. package/dist/components/agents-sdk/WorkspaceProject.d.ts +131 -0
  64. package/dist/components/agents-sdk/WorkspaceProject.js +238 -0
  65. package/dist/components/agents-sdk/WorkspaceUserScript.d.ts +47 -0
  66. package/dist/components/agents-sdk/WorkspaceUserScript.js +146 -0
  67. package/dist/components/ai-sdk/Activity.js +1 -1
  68. package/dist/components/ai-sdk/AgentChatStartScreen.js +1 -1
  69. package/dist/components/ai-sdk/Approval.js +1 -1
  70. package/dist/components/ai-sdk/Artifact.js +3 -3
  71. package/dist/components/ai-sdk/ChainOfThought.d.ts +1 -1
  72. package/dist/components/ai-sdk/ChainOfThought.js +1 -1
  73. package/dist/components/ai-sdk/Checkpoint.js +1 -1
  74. package/dist/components/ai-sdk/CodeBlock.js +1 -1
  75. package/dist/components/ai-sdk/ComposerLink.d.ts +4 -1
  76. package/dist/components/ai-sdk/ComposerLink.js +4 -3
  77. package/dist/components/ai-sdk/ConnectedAppCards.d.ts +29 -2
  78. package/dist/components/ai-sdk/ConnectedAppCards.js +78 -103
  79. package/dist/components/ai-sdk/Conversation.js +1 -1
  80. package/dist/components/ai-sdk/Correspondent.d.ts +2 -0
  81. package/dist/components/ai-sdk/Correspondent.js +145 -0
  82. package/dist/components/ai-sdk/Goal.js +1 -1
  83. package/dist/components/ai-sdk/MediaPreviewCard.js +1 -1
  84. package/dist/components/ai-sdk/Message.js +1 -1
  85. package/dist/components/ai-sdk/MessageScroller.js +1 -1
  86. package/dist/components/ai-sdk/MessageScrollerVirtual.js +1 -1
  87. package/dist/components/ai-sdk/Plan.js +1 -1
  88. package/dist/components/ai-sdk/PromptInput.js +1 -1
  89. package/dist/components/ai-sdk/Queue.js +1 -1
  90. package/dist/components/ai-sdk/Reasoning.js +1 -1
  91. package/dist/components/ai-sdk/Sources.js +1 -1
  92. package/dist/components/ai-sdk/Task.js +1 -1
  93. package/dist/components/extension/ChatGptSignInScreen.js +1 -1
  94. package/dist/components/extension/CodexModelSelector.js +1 -1
  95. package/dist/components/extension/ConversationTabPicker.js +1 -1
  96. package/dist/components/foundations/Checkbox.js +1 -1
  97. package/dist/components/foundations/ContextMenu.js +1 -1
  98. package/dist/components/foundations/Menubar.js +1 -1
  99. package/dist/components/foundations/SearchField.js +1 -1
  100. package/dist/components/foundations/Select.js +1 -1
  101. package/dist/components/foundations/Stepper.js +1 -1
  102. package/dist/components/foundations/Toast.js +1 -1
  103. package/dist/components/foundations/icons.d.ts +2 -2
  104. package/dist/components/foundations/icons.js +2 -2
  105. package/dist/components/general-purpose/Commit.js +2 -2
  106. package/dist/components/general-purpose/EnvironmentVariables.js +2 -2
  107. package/dist/components/general-purpose/FileTree.js +1 -1
  108. package/dist/components/general-purpose/PricingPlanCard.js +1 -1
  109. package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
  110. package/dist/components/general-purpose/SetupChecklist.js +1 -1
  111. package/dist/components/general-purpose/Terminal.js +2 -2
  112. package/dist/components/general-purpose/TestResults.js +1 -1
  113. package/dist/components/general-purpose/ThemeModeControl.js +1 -1
  114. package/dist/components/general-purpose/WebPreview.js +1 -1
  115. package/dist/components/nanites/AgentConnection.js +2 -2
  116. package/dist/components/nanites/AgentToolDetail.d.ts +1 -1
  117. package/dist/components/nanites/AgentToolDetail.js +2 -2
  118. package/dist/{copy-button-BABPlsc-.js → copy-button-Dk2vRe9j.js} +1 -1
  119. package/dist/{icons-ChPpNMmU.d.ts → icons-CCZGYUwU.d.ts} +6 -1
  120. package/dist/{icons-BC4HZqSK.js → icons-CeGfXO21.js} +3 -2
  121. package/dist/styles/base.css +2 -2
  122. package/dist/styles/connected-app-card.css +8 -0
  123. package/dist/styles/correspondent.css +73 -0
  124. package/dist/styles/description-list.css +3 -1
  125. package/dist/styles/index.css +2 -0
  126. package/dist/styles/manager-office.css +380 -1086
  127. package/dist/styles/workspace-concepts.css +28 -0
  128. package/dist/workspace-assets-GqsCYxqT.js +168 -0
  129. package/package.json +2 -2
  130. package/dist/WorkspaceMessageResponse-D66ty4FO.d.ts +0 -24
@@ -1,6 +1,6 @@
1
1
  import { t as cx } from "./class-names-BiMDVpUo.js";
2
2
  import { Select } from "./components/foundations/Select.js";
3
- import { t as CopyButton } from "./copy-button-BABPlsc-.js";
3
+ import { t as CopyButton } from "./copy-button-Dk2vRe9j.js";
4
4
  import * as React from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { createHighlighter } from "shiki";
@@ -0,0 +1,64 @@
1
+ import * as React from "react";
2
+
3
+ //#region src/components/ai-sdk/Correspondent.d.ts
4
+ /** One live handle. Extra handles are extra correspondents — no merge. */
5
+ type CorrespondentHandle = {
6
+ kind: "email";
7
+ address: string;
8
+ } | {
9
+ kind: "slack";
10
+ userId: string;
11
+ userName?: string;
12
+ } | {
13
+ kind: "linkedin";
14
+ url: string;
15
+ } | {
16
+ kind: "people";
17
+ resourceName: string;
18
+ };
19
+ type CorrespondentLatest = {
20
+ kind: "email-thread";
21
+ label: string;
22
+ } | {
23
+ kind: "slack-thread";
24
+ threadId: string;
25
+ label: string;
26
+ } | {
27
+ kind: "linkedin-tab";
28
+ tabId: number;
29
+ url: string;
30
+ title?: string;
31
+ } | {
32
+ kind: "calendar-event";
33
+ label: string;
34
+ };
35
+ /**
36
+ * Presentation of a person-shaped destination on current work. Not a contact
37
+ * record and not a ManagerOfficeEmployee seat.
38
+ */
39
+ interface Correspondent {
40
+ handle: CorrespondentHandle;
41
+ displayName?: string;
42
+ avatarUrl?: string;
43
+ latest?: CorrespondentLatest;
44
+ }
45
+ declare function slackDestinationCorrespondent(to: string): Correspondent | undefined;
46
+ declare function emailDestinationCorrespondent(to: string): Correspondent | undefined;
47
+ declare function linkedinTabCorrespondent(url: string): Correspondent | undefined;
48
+ declare function correspondentHandleLabel(handle: CorrespondentHandle): string;
49
+ declare function correspondentInitials(label: string): string;
50
+ interface CorrespondentNameProps {
51
+ correspondent: Correspondent;
52
+ className?: string;
53
+ }
54
+ /**
55
+ * Avatar + name for a person-shaped destination. LinkedIn handles open the
56
+ * profile; other handles disclose handle and latest thread without inventing
57
+ * a directory.
58
+ */
59
+ declare function CorrespondentName({
60
+ correspondent,
61
+ className
62
+ }: CorrespondentNameProps): React.ReactElement;
63
+ //#endregion
64
+ export { CorrespondentNameProps as a, emailDestinationCorrespondent as c, CorrespondentName as i, linkedinTabCorrespondent as l, CorrespondentHandle as n, correspondentHandleLabel as o, CorrespondentLatest as r, correspondentInitials as s, Correspondent as t, slackDestinationCorrespondent as u };
@@ -1,5 +1,5 @@
1
1
  import { t as cx } from "./class-names-BiMDVpUo.js";
2
- import { C as FolderIcon, S as FileIcon, p as ChevronRightIcon, w as FolderOpenIcon } from "./icons-BC4HZqSK.js";
2
+ import { C as FolderIcon, S as FileIcon, p as ChevronRightIcon, w as FolderOpenIcon } from "./icons-CeGfXO21.js";
3
3
  import { t as NavigationLink } from "./navigation-link-kqMa81v5.js";
4
4
  import * as React from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  import { n as mergeBaseClassName } from "./class-names-BiMDVpUo.js";
2
- import { $ as WarningIcon, B as PlusIcon, d as CheckIcon, f as ChevronDownIcon } from "./icons-BC4HZqSK.js";
2
+ import { B as PlusIcon, d as CheckIcon, et as WarningIcon, f as ChevronDownIcon } from "./icons-CeGfXO21.js";
3
3
  import { Button } from "./components/foundations/Button.js";
4
4
  import { Menu } from "./components/foundations/Menu.js";
5
5
  import * as React from "react";
@@ -0,0 +1,185 @@
1
+ import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-C7L-Mv9U.js";
2
+ import { K as PromptInputMessage } from "./PromptInput-DtJHyp0S.js";
3
+ import { r as AgentChatProps } from "./AgentChat-BLmQghkt.js";
4
+ import { n as AgentToolEventsValue } from "./AgentToolRunsContext-jtmveaRE.js";
5
+ import { o as UseSessionCompactionResult } from "./SessionCompaction-CmTJFpzj.js";
6
+ import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "./ThinkChatActivity-B3lGVS-6.js";
7
+ import { i as ThinkChatValue } from "./ThinkChatContext-COIgzkYp.js";
8
+ import { t as ThinkRecoveryNotice } from "./ThinkRecoveryNotice-DGWr94rk.js";
9
+ import { n as WorkspaceFileRenderer } from "./WorkspaceMessageResponse-kJYU8Onj.js";
10
+ import * as React from "react";
11
+ import { UIMessage } from "ai";
12
+ import { UseAgentOptions } from "agents/react";
13
+ import { DataTag, UndefinedInitialDataOptions } from "@tanstack/react-query";
14
+ import { PendingApproval, Think } from "@cloudflare/think";
15
+ import { AgentStub } from "agents/client";
16
+
17
+ //#region src/components/agents-sdk/ThinkChat.d.ts
18
+ type ThinkPendingExecutionApprovalsQueryKey = readonly ["think", sourceKey: string, "pending-approvals"];
19
+ type ThinkPendingExecutionApprovalsQueryOptions = UndefinedInitialDataOptions<readonly PendingApproval[], Error, readonly PendingApproval[], ThinkPendingExecutionApprovalsQueryKey> & {
20
+ queryKey: DataTag<ThinkPendingExecutionApprovalsQueryKey, readonly PendingApproval[], Error>;
21
+ };
22
+ interface ThinkChatProviderProps<State = unknown, MessageT extends UIMessage = UIMessage> {
23
+ /** The `useAgentChat` value from `@cloudflare/think/react` that descendants read. */
24
+ chat: ThinkChatValue<State, MessageT>;
25
+ /** Optional whole `useAgentToolEvents` result when the app owns the parent connection. */
26
+ agentTools?: AgentToolEventsValue<MessageT["parts"][number]>;
27
+ children: React.ReactNode;
28
+ }
29
+ interface ThinkChatRootProps<State = unknown> {
30
+ /** Agent to connect to: a kebab-case class name, or full `useAgent` options. */
31
+ agent: string | UseAgentOptions<State>;
32
+ /** Disable durable pending-approval discovery. Also disable it on `ThinkChat.Messages`. */
33
+ approvalsEnabled?: boolean;
34
+ /** Instance name (e.g. a session or room id). Wins over `agent.name`. */
35
+ name?: string;
36
+ /**
37
+ * Stable, non-secret identity for the remote Think agent. Include endpoint,
38
+ * account or tenant scope, and agent path so sources cannot share cached data.
39
+ */
40
+ sourceKey: string;
41
+ children: React.ReactNode;
42
+ }
43
+ /**
44
+ * The first-turn surface with no conversation behind it. Supply this instead of
45
+ * a chat provider when the composer's submission is what creates the
46
+ * conversation: connecting early is what leaves empty threads behind.
47
+ */
48
+ interface ThinkChatDraft<MessageT extends UIMessage = UIMessage> {
49
+ /** Client-only transcript rows, such as a locally rendered guide. */
50
+ messages?: readonly MessageT[];
51
+ /** Receives the first message, normalized the same way a live thread's is. */
52
+ onSubmit: (message: {
53
+ text: string;
54
+ files: PromptInputMessage["files"];
55
+ }) => void | Promise<void>;
56
+ /** Set while the app is creating the conversation, so the composer reads busy. */
57
+ status?: AgentChatProps<MessageT>["status"];
58
+ }
59
+ type ThinkChatManagedAgentChatProp = "messages" | "onApprovalResponse" | "onRegenerate" | "onStop" | "onSubmit" | "status";
60
+ /**
61
+ * The AgentChat composition surface, minus the live values ThinkChat supplies
62
+ * from `useAgentChat`. Think-specific activity and draft/session inputs extend
63
+ * that owner instead of mirroring every AgentChat prop here.
64
+ */
65
+ type ThinkChatMessagesProps<MessageT extends UIMessage = UIMessage> = Omit<AgentChatProps<MessageT>, ThinkChatManagedAgentChatProp> & ThinkChatActivityRendererOptions<MessageT> & {
66
+ /**
67
+ * Renders without a chat provider, for the first turn of a conversation
68
+ * that does not exist yet.
69
+ */
70
+ draft?: ThinkChatDraft<MessageT>; /** Whole `useSessionCompaction` result for built-in progress and error notices. */
71
+ sessionCompaction?: UseSessionCompactionResult;
72
+ /**
73
+ * Promotes one standalone assistant workspace file link through a host
74
+ * callback. Return a node to replace the link, or `null` to keep it.
75
+ */
76
+ renderWorkspaceFile?: WorkspaceFileRenderer;
77
+ };
78
+ /** Shared pending-approval options for components and TanStack Router loaders. */
79
+ declare function thinkPendingExecutionApprovalsQueryOptions(stub: AgentStub<Think>, sourceKey: string): ThinkPendingExecutionApprovalsQueryOptions;
80
+ declare function useThinkPendingExecutionApprovals(stub: AgentStub<Think>, sourceKey: string, refreshSignal?: unknown, enabled?: boolean): {
81
+ pendingApprovals: readonly PendingApproval[];
82
+ refreshPendingApprovals: () => Promise<void>;
83
+ };
84
+ /**
85
+ * Chat UI for Cloudflare Think agents. Provide a `useAgentChat` value (or let
86
+ * `ThinkChat.Root` create one) and `ThinkChat.Messages` renders the message
87
+ * stream with agent work folded into collapsed Activity blocks.
88
+ */
89
+ declare function ThinkChatProvider<State = unknown, MessageT extends UIMessage = UIMessage>({
90
+ agentTools,
91
+ chat,
92
+ children
93
+ }: ThinkChatProviderProps<State, MessageT>): React.JSX.Element;
94
+ /**
95
+ * Batteries-included root: connects to the named Think agent (upstream's
96
+ * `useAgent` + `useAgentChat`) and provides the live chat to everything
97
+ * inside. Render it beneath the app's `QueryClientProvider`. If the app
98
+ * already owns the chat hook, use `ThinkChat.Provider`.
99
+ *
100
+ * @example
101
+ * ```tsx
102
+ * <QueryClientProvider client={queryClient}>
103
+ * <ThinkChat.Root
104
+ * agent="my-agent"
105
+ * name="session-1"
106
+ * sourceKey="api.example.com:account:acme:agent:session-1"
107
+ * >
108
+ * <ThinkChat.Messages />
109
+ * </ThinkChat.Root>
110
+ * </QueryClientProvider>
111
+ * ```
112
+ */
113
+ declare function ThinkChatRoot<State = unknown, MessageT extends UIMessage = UIMessage>({
114
+ agent: agentOption,
115
+ approvalsEnabled,
116
+ name,
117
+ sourceKey,
118
+ children
119
+ }: ThinkChatRootProps<State>): React.JSX.Element;
120
+ /**
121
+ * The full conversation surface — message list plus composer — with the
122
+ * activity renderer as the default `renderPart`: runs of reasoning/tool parts
123
+ * fold into one collapsed Activity block with derived labels and per-tool
124
+ * panels. Session-generated context/load/search tools are recognized from
125
+ * their upstream runtime schemas and keep their recorded inputs and outputs
126
+ * inspectable. Extend for app-specific tools with `toolRenderers` (label/panel
127
+ * inside the log) or `excludeTools` + your own `renderPart` (standalone
128
+ * card) — see README "App-specific tools" and the Custom Tool Panel story.
129
+ */
130
+ declare function ThinkChatMessages<State = unknown, MessageT extends UIMessage = UIMessage>({
131
+ draft,
132
+ loading,
133
+ renderPart,
134
+ excludeTools,
135
+ renderAgentToolRunLink,
136
+ renderWorkspaceFile,
137
+ toolRenderers,
138
+ thinkStub,
139
+ onExecutionSettled,
140
+ pendingApprovals,
141
+ notice,
142
+ sessionCompaction,
143
+ ...props
144
+ }: ThinkChatMessagesProps<MessageT>): React.JSX.Element;
145
+ /**
146
+ * The ambient chat value from `ThinkChat.Root`/`Provider` — for custom tool
147
+ * panels, cards, or composer actions that need `messages`, `status`, or
148
+ * `sendMessage`. Throws outside a provider.
149
+ */
150
+ declare function useThinkChat<State = unknown, MessageT extends UIMessage = UIMessage>(): Omit<import("@ai-sdk/react").UseChatHelpers<MessageT>, "addToolOutput"> & {
151
+ clearHistory: () => void;
152
+ addToolOutput: (opts: {
153
+ toolCallId: string;
154
+ toolName?: string;
155
+ output?: unknown;
156
+ state?: "output-available" | "output-error";
157
+ errorText?: string;
158
+ }) => void;
159
+ isServerStreaming: boolean;
160
+ isStreaming: boolean;
161
+ isRecovering: boolean;
162
+ isToolContinuation: boolean;
163
+ connectionError: (Error & {
164
+ code: number;
165
+ reason: string;
166
+ wasClean: boolean;
167
+ }) | null;
168
+ };
169
+ /**
170
+ * Namespace entry point. `Root` + `Messages` is the standard surface;
171
+ * `Provider` + `useThinkChat` when the app owns the chat hook; `Activity`,
172
+ * `renderActivityPart`, and `createActivityRenderer` for custom layouts and
173
+ * app-specific tools.
174
+ */
175
+ declare const ThinkChat: {
176
+ Provider: typeof ThinkChatProvider;
177
+ Root: typeof ThinkChatRoot;
178
+ Messages: typeof ThinkChatMessages;
179
+ Activity: typeof ThinkChatActivity;
180
+ RecoveryNotice: typeof ThinkRecoveryNotice;
181
+ renderActivityPart: (context: AgentMessageRenderPartContext<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>) => React.ReactNode | undefined;
182
+ createActivityRenderer: typeof createThinkChatActivityRenderer;
183
+ };
184
+ //#endregion
185
+ export { ThinkChatProvider as a, ThinkChatRootProps as c, thinkPendingExecutionApprovalsQueryOptions as d, useThinkChat as f, ThinkChatMessagesProps as i, ThinkPendingExecutionApprovalsQueryKey as l, ThinkChatDraft as n, ThinkChatProviderProps as o, useThinkPendingExecutionApprovals as p, ThinkChatMessages as r, ThinkChatRoot as s, ThinkChat as t, ThinkPendingExecutionApprovalsQueryOptions as u };
@@ -5,7 +5,7 @@ import { AgentChat, compactingNotice } from "./components/agents-sdk/AgentChat.j
5
5
  import { ThinkChatContext, ThinkChatLiveContext, useOptionalThinkChatContext, useThinkChatContext } from "./components/agents-sdk/ThinkChatContext.js";
6
6
  import { ThinkChatActivity, createThinkChatActivityRenderer, renderThinkChatActivityPart } from "./components/agents-sdk/ThinkChatActivity.js";
7
7
  import { ThinkRecoveryNotice } from "./components/agents-sdk/ThinkRecoveryNotice.js";
8
- import { t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-CJCmGvTx.js";
8
+ import { n as WorkspaceMessageResponse, t as WorkspaceFileRendererProvider } from "./WorkspaceMessageResponse-BqOezptB.js";
9
9
  import * as React from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { isTextUIPart } from "ai";
@@ -195,7 +195,7 @@ const ThinkChatApprovalsContext = React.createContext(null);
195
195
  * inside the log) or `excludeTools` + your own `renderPart` (standalone
196
196
  * card) — see README "App-specific tools" and the Custom Tool Panel story.
197
197
  */
198
- function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAgentToolRunLink, renderWorkspaceHtmlArtifact, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, sessionCompaction, ...props }) {
198
+ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAgentToolRunLink, renderWorkspaceFile, toolRenderers, thinkStub, onExecutionSettled, pendingApprovals, notice, sessionCompaction, ...props }) {
199
199
  const chat = useOptionalThinkChatContext();
200
200
  const approvals = React.useContext(ThinkChatApprovalsContext);
201
201
  const resolvedApprovals = resolveThinkApprovalProps({
@@ -223,14 +223,10 @@ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAge
223
223
  return isTextUIPart(context.part) && context.part.text ? /* @__PURE__ */ jsx(WorkspaceMessageResponse, {
224
224
  animated: STREAMED_TEXT_ANIMATION,
225
225
  isAnimating: context.message.role === "assistant" && context.message.id === streamingMessageId && context.part.state === "streaming",
226
- renderWorkspaceHtmlArtifact: context.message.role === "assistant" ? renderWorkspaceHtmlArtifact : void 0,
226
+ promoteWorkspaceFiles: context.message.role === "assistant",
227
227
  children: context.part.text
228
228
  }) : void 0;
229
- }, [
230
- activityRenderPart,
231
- renderWorkspaceHtmlArtifact,
232
- streamingMessageId
233
- ]);
229
+ }, [activityRenderPart, streamingMessageId]);
234
230
  const resolvedRenderPart = React.useMemo(() => renderPart ? (context) => {
235
231
  const renderBuiltIn = () => {
236
232
  const builtIn = defaultRenderPart(context);
@@ -269,7 +265,11 @@ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAge
269
265
  files
270
266
  });
271
267
  };
272
- if (loading) return /* @__PURE__ */ jsx(AgentChat, {
268
+ const withWorkspaceFileRenderer = (lane) => /* @__PURE__ */ jsx(WorkspaceFileRendererProvider, {
269
+ renderWorkspaceFile,
270
+ children: lane
271
+ });
272
+ if (loading) return withWorkspaceFileRenderer(/* @__PURE__ */ jsx(AgentChat, {
273
273
  showComposer: true,
274
274
  ...props,
275
275
  renderPart: resolvedRenderPart,
@@ -277,19 +277,19 @@ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAge
277
277
  status: "ready",
278
278
  notice,
279
279
  loading: true
280
- });
280
+ }));
281
281
  if (!chat) {
282
282
  if (!draft) throw new Error("ThinkChat.Messages must be used inside <ThinkChat.Provider> or <ThinkChat.Root>, or given a `draft`, or set `loading` while one hydrates.");
283
- return /* @__PURE__ */ jsx(AgentChat, {
283
+ return withWorkspaceFileRenderer(/* @__PURE__ */ jsx(AgentChat, {
284
284
  ...props,
285
285
  renderPart: resolvedRenderPart,
286
286
  messages: draft.messages ?? EMPTY_DRAFT_MESSAGES,
287
287
  status: draft.status ?? "ready",
288
288
  notice: notice ?? sessionCompactionNotice,
289
289
  onSubmit: (message) => submit(message, draft.onSubmit)
290
- });
290
+ }));
291
291
  }
292
- return /* @__PURE__ */ jsx(AgentChat, {
292
+ return withWorkspaceFileRenderer(/* @__PURE__ */ jsx(AgentChat, {
293
293
  ...props,
294
294
  renderPart: resolvedRenderPart,
295
295
  messages: chat.messages,
@@ -302,7 +302,7 @@ function ThinkChatMessages({ draft, loading, renderPart, excludeTools, renderAge
302
302
  notice: notice ?? (recoveryActive ? defaultNotice : sessionCompactionNotice),
303
303
  onRegenerate: (messageId) => void chat.regenerate({ messageId }),
304
304
  onSubmit: (message) => submit(message, chat.sendMessage)
305
- });
305
+ }));
306
306
  }
307
307
  const EMPTY_DRAFT_MESSAGES = [];
308
308
  /**
@@ -0,0 +1,91 @@
1
+ import * as React from "react";
2
+
3
+ //#region src/components/agents-sdk/ThinkThreadPicker.d.ts
4
+ interface ThinkThreadItem {
5
+ /** Stable child-agent/thread id used by the app-authored link's route params. */
6
+ id: string;
7
+ /** Human-readable thread title, usually generated by the parent Think agent. */
8
+ title: string;
9
+ /** Optional parent-owned preview for apps that render their own richer sidebar. */
10
+ lastMessagePreview?: string;
11
+ /** Timestamp from the parent registry or metadata row. `updatedAt` wins over `createdAt`. */
12
+ createdAt?: Date | number;
13
+ /** Timestamp from parent-owned thread metadata when available. */
14
+ updatedAt?: Date | number;
15
+ /** Preformatted timestamp label when the app already has one, such as "14m". */
16
+ updatedAtLabel?: string;
17
+ /** Optional upstream/app status string. The picker only displays it; it does not derive it. */
18
+ status?: string;
19
+ /** Human label for `status` when the raw upstream value is not user-facing. */
20
+ statusLabel?: string;
21
+ }
22
+ interface ThinkThreadStatusSummary {
23
+ /** Threads currently processing a turn. */
24
+ running: number;
25
+ /** Completed or interrupted background threads that have not been reviewed. */
26
+ attention: number;
27
+ /** Threads whose latest turn failed. */
28
+ failed: number;
29
+ }
30
+ interface ThinkThreadStatusIndicatorsProps {
31
+ summary: ThinkThreadStatusSummary;
32
+ className?: string;
33
+ }
34
+ interface ThinkThreadPickerProps extends Omit<React.HTMLAttributes<HTMLElement>, "onSelect" | "title"> {
35
+ /** Threads from the parent agent, already sorted in the order the app wants to show. */
36
+ threads: readonly ThinkThreadItem[];
37
+ /**
38
+ * Renders the application-owned TanStack Router Link for a thread.
39
+ *
40
+ * Put `to`, `params`, `search`, and active state on this element so they stay
41
+ * inferred from the consuming application's registered route tree.
42
+ */
43
+ renderThreadLink: (thread: ThinkThreadItem) => React.ReactElement;
44
+ /**
45
+ * App-authored TanStack Router Link to the new-thread screen. A thread
46
+ * created on click is an empty thread until someone writes in it.
47
+ */
48
+ createThreadLink?: React.ReactElement;
49
+ /**
50
+ * Notified on unmodified primary activation. The link still navigates — the
51
+ * route is the selection — so this is for side effects such as closing a
52
+ * compact drawer, never for performing the selection itself.
53
+ */
54
+ onSelect?: (thread: ThinkThreadItem) => void;
55
+ /** Optional parent-agent delete action, usually `parent.stub.deleteThread(thread.id)`. */
56
+ onDelete?: (thread: ThinkThreadItem) => void | Promise<void>;
57
+ /** Visible heading for the roster. */
58
+ title?: React.ReactNode;
59
+ /** Accessible label for the list navigation. */
60
+ "aria-label"?: string;
61
+ }
62
+ declare function summarizeThinkThreads(threads: readonly Pick<ThinkThreadItem, "status">[]): ThinkThreadStatusSummary;
63
+ declare function ThinkThreadStatusIndicators({
64
+ summary,
65
+ className
66
+ }: ThinkThreadStatusIndicatorsProps): React.JSX.Element | null;
67
+ /**
68
+ * Thread roster UI for sub-agent chat apps.
69
+ *
70
+ * This component does not call Think or Cloudflare RPC methods directly. Feed
71
+ * it from the parent agent's roster method, then render app-owned route links
72
+ * that select the child `useAgent({ sub: [...] })` name. Keep backend contract
73
+ * notes beside the parent Think agent because
74
+ * `listThreads()`/`createThread()`/`deleteThread()` are app-owned.
75
+ */
76
+ declare function ThinkThreadPicker({
77
+ threads,
78
+ renderThreadLink,
79
+ createThreadLink,
80
+ onSelect,
81
+ onDelete,
82
+ className,
83
+ title,
84
+ "aria-label": ariaLabel,
85
+ ref,
86
+ ...props
87
+ }: ThinkThreadPickerProps & {
88
+ ref?: React.Ref<HTMLElement>;
89
+ }): React.JSX.Element;
90
+ //#endregion
91
+ export { ThinkThreadStatusIndicatorsProps as a, ThinkThreadStatusIndicators as i, ThinkThreadPicker as n, ThinkThreadStatusSummary as o, ThinkThreadPickerProps as r, summarizeThinkThreads as s, ThinkThreadItem as t };
@@ -1,5 +1,5 @@
1
1
  import { a as WorkspaceMediaInfo, i as WorkspaceFileState, r as WorkspaceFileAssetResolver, t as WorkspaceFileAsset } from "./WorkspaceFile-Dq-GC0_T.js";
2
- import { DataTag, QueryKey, UnusedSkipTokenOptions } from "@tanstack/react-query";
2
+ import { DataTag, QueryClient, QueryKey, UnusedSkipTokenOptions } from "@tanstack/react-query";
3
3
  import { FileInfo, Workspace, WorkspaceFsLike } from "@cloudflare/shell";
4
4
 
5
5
  //#region src/components/agents-sdk/Workspace.d.ts
@@ -85,6 +85,7 @@ declare function workspaceDirectoryQueryKey(sourceKey: string, root: string, pat
85
85
  type WorkspaceDirectoryQueryKey = ReturnType<typeof workspaceDirectoryQueryKey>;
86
86
  declare function workspaceFileQueryKey(sourceKey: string, root: string, requestedPath: string): readonly ["workspace", string, string, "file", string];
87
87
  type WorkspaceFileQueryKey = ReturnType<typeof workspaceFileQueryKey>;
88
+ declare function workspaceInfoQueryKey(sourceKey: string, root: string): readonly ["workspace", string, string, "info"];
88
89
  declare function workspaceFileVersion(target: WorkspaceFileReadTarget): {
89
90
  readonly path: string;
90
91
  readonly name: string;
@@ -121,6 +122,16 @@ declare function workspaceFileAssetQueryOptions(sourceKey: string, root: string,
121
122
  declare function workspaceTextFileQueryOptions(source: WorkspaceSource, sourceKey: string, root: string, target: WorkspaceFileReadTarget): WorkspaceTextFileQueryOptions;
122
123
  /** Active-file-only buffered asset options, scoped to the validated stat result. */
123
124
  declare function workspaceBinaryFileQueryOptions(source: WorkspaceSource, sourceKey: string, root: string, target: WorkspaceFileReadTarget, maxInlineAssetBytes: number): WorkspaceBinaryFileQueryOptions;
125
+ declare function refreshWorkspaceFileQueries(queryClient: QueryClient, {
126
+ source,
127
+ sourceKey,
128
+ root,
129
+ selectedPath,
130
+ resolveFileAsset,
131
+ maxInlineAssetBytes
132
+ }: Pick<UseWorkspaceOptions, "source" | "sourceKey" | "selectedPath" | "resolveFileAsset" | "maxInlineAssetBytes"> & {
133
+ root: string;
134
+ }): Promise<void>;
124
135
  /**
125
136
  * Headless state for browsing a Think workspace. TanStack Query owns remote
126
137
  * directory, metadata, resolver, text, and byte lifecycles; the route owns
@@ -136,4 +147,4 @@ declare function useWorkspace({
136
147
  maxInlineAssetBytes
137
148
  }: UseWorkspaceOptions): WorkspaceState;
138
149
  //#endregion
139
- export { workspaceQueryKey as A, workspaceBinaryFileQueryOptions as C, workspaceFileAssetQueryOptions as D, workspaceDirectoryQueryPrefix as E, workspaceFileStatQueryOptions as O, useWorkspace as S, workspaceDirectoryQueryOptions as T, WorkspaceResolvedAsset as _, WorkspaceDirectoryQueryOptions as a, WorkspaceTextFileQueryKey as b, WorkspaceFileQueryKey as c, WorkspaceFileStatQueryOptions as d, WorkspaceFileVersion as f, WorkspaceQueryKey as g, WorkspaceInfoQueryOptions as h, WorkspaceDirectoryQueryKey as i, workspaceTextFileQueryOptions as j, workspaceInfoQueryOptions as k, WorkspaceFileReadTarget as l, WorkspaceInfoQueryKey as m, WorkspaceBinaryFileQueryKey as n, WorkspaceFileAssetQueryKey as o, WorkspaceInfo as p, WorkspaceBinaryFileQueryOptions as r, WorkspaceFileAssetQueryOptions as s, UseWorkspaceOptions as t, WorkspaceFileStatQueryKey as u, WorkspaceSource as v, workspaceDirectoryQueryKey as w, WorkspaceTextFileQueryOptions as x, WorkspaceState as y };
150
+ export { workspaceFileQueryKey as A, refreshWorkspaceFileQueries as C, workspaceDirectoryQueryOptions as D, workspaceDirectoryQueryKey as E, workspaceTextFileQueryOptions as F, workspaceInfoQueryKey as M, workspaceInfoQueryOptions as N, workspaceDirectoryQueryPrefix as O, workspaceQueryKey as P, WorkspaceTextFileQueryOptions as S, workspaceBinaryFileQueryOptions as T, WorkspaceQueryOptions as _, WorkspaceDirectoryQueryOptions as a, WorkspaceState as b, WorkspaceFileQueryKey as c, WorkspaceFileStatQueryOptions as d, WorkspaceFileVersion as f, WorkspaceQueryKey as g, WorkspaceInfoQueryOptions as h, WorkspaceDirectoryQueryKey as i, workspaceFileStatQueryOptions as j, workspaceFileAssetQueryOptions as k, WorkspaceFileReadTarget as l, WorkspaceInfoQueryKey as m, WorkspaceBinaryFileQueryKey as n, WorkspaceFileAssetQueryKey as o, WorkspaceInfo as p, WorkspaceBinaryFileQueryOptions as r, WorkspaceFileAssetQueryOptions as s, UseWorkspaceOptions as t, WorkspaceFileStatQueryKey as u, WorkspaceResolvedAsset as v, useWorkspace as w, WorkspaceTextFileQueryKey as x, WorkspaceSource as y };
@@ -1,10 +1,10 @@
1
- import { $ as WarningIcon, b as EyeIcon, d as CheckIcon, k as MaximizeIcon, m as CodeIcon, r as ArrowLeftIcon, v as DownloadIcon } from "./icons-BC4HZqSK.js";
1
+ import { b as EyeIcon, d as CheckIcon, et as WarningIcon, k as MaximizeIcon, m as CodeIcon, r as ArrowLeftIcon, v as DownloadIcon } from "./icons-CeGfXO21.js";
2
2
  import { i as formatClock } from "./format-COCyV98Z.js";
3
- import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-CcteqDvA.js";
3
+ import { a as CodeBlockCopyButton, i as CodeBlockContent, r as CodeBlockContainer, t as CodeBlock } from "./CodeBlock-BSJl682D.js";
4
4
  import { AppTopBar } from "./components/general-purpose/AppTopBar.js";
5
5
  import { inferWorkspaceLanguage, inferWorkspaceMedia, isWorkspaceMarkdownPath, isWorkspaceSkillPath, parseWorkspaceSkill } from "./components/agents-sdk/WorkspaceFile.js";
6
- import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-DtH66bAY.js";
7
- import { n as createWorkspaceRehypePlugins, t as WorkspaceMessageResponse } from "./WorkspaceMessageResponse-CJCmGvTx.js";
6
+ import { c as useWorkspaceNavigationContext, s as useWorkspaceNavigationRestoration } from "./WorkspaceLink-B1d2GIGl.js";
7
+ import { n as WorkspaceMessageResponse, r as createWorkspaceRehypePlugins } from "./WorkspaceMessageResponse-BqOezptB.js";
8
8
  import { WorkspaceHeader } from "./components/agents-sdk/WorkspaceHeader.js";
9
9
  import * as React from "react";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -198,13 +198,18 @@ function resolveWorkspaceLink({ href, root, base }) {
198
198
  };
199
199
  }
200
200
  function WorkspaceNavigationProvider({ children, root, base, navigation }) {
201
+ const { kind: baseKind, path: basePath } = base;
201
202
  return /* @__PURE__ */ jsx(WorkspaceNavigationContext, {
202
203
  value: React.useMemo(() => ({
203
204
  root,
204
- base,
205
+ base: {
206
+ kind: baseKind,
207
+ path: basePath
208
+ },
205
209
  navigation
206
210
  }), [
207
- base,
211
+ baseKind,
212
+ basePath,
208
213
  navigation,
209
214
  root
210
215
  ]),
@@ -0,0 +1,61 @@
1
+ import { r as WorkspaceFileAssetResolver } from "./WorkspaceFile-Dq-GC0_T.js";
2
+ import { y as WorkspaceSource } from "./Workspace-LIoU30n7.js";
3
+ import { QueryClient } from "@tanstack/react-query";
4
+
5
+ //#region src/components/agents-sdk/WorkspaceLive.d.ts
6
+ type WorkspaceChange = {
7
+ type: "changed";
8
+ path: string;
9
+ movedFrom?: string;
10
+ } | {
11
+ type: "unknown";
12
+ };
13
+ /** Host adapter for a native workspace observer. */
14
+ interface WorkspaceChangeSource {
15
+ start?(): void | Promise<void>;
16
+ subscribe(listener: (change: WorkspaceChange) => void): () => void;
17
+ }
18
+ declare function invalidateWorkspaceDirectories(queryClient: QueryClient, sourceKey: string, directories: Iterable<string>, root: string): void;
19
+ interface UseWorkspaceLiveQueriesOptions {
20
+ /** Native observer adapter. Omit for hosts without workspace observation. */
21
+ changes?: WorkspaceChangeSource;
22
+ sourceKey: string | undefined;
23
+ /**
24
+ * The host's workspace boundary. Required, and the same value the concept
25
+ * options were built with: invalidation is prefix-matched on it, so a root
26
+ * that disagrees with the queries silently invalidates nothing.
27
+ */
28
+ root: string;
29
+ /** Workspace read adapter used to refresh an observed open file in order. */
30
+ source?: WorkspaceSource;
31
+ /** Route-owned open file. Omit or pass null when Files has no selection. */
32
+ selectedPath?: string | null;
33
+ resolveFileAsset?: WorkspaceFileAssetResolver;
34
+ maxInlineAssetBytes?: number;
35
+ /**
36
+ * Disposable freshness tick for hosts without native observation — for
37
+ * example a serialization of settled-turn state. Every change of a defined
38
+ * value invalidates the source's concept queries. It never enters query
39
+ * identity, so data, mutation state, and form drafts survive the refresh.
40
+ */
41
+ revision?: string;
42
+ }
43
+ /**
44
+ * Synchronize external workspace freshness with the design system's Query
45
+ * resources. This is the one external-system effect: native observer events
46
+ * and host revision ticks both land here as targeted invalidation against
47
+ * stable query keys. Hosts only supply events; neither layer adds another
48
+ * watcher.
49
+ */
50
+ declare function useWorkspaceLiveQueries({
51
+ changes,
52
+ maxInlineAssetBytes,
53
+ resolveFileAsset,
54
+ selectedPath,
55
+ source,
56
+ sourceKey,
57
+ root,
58
+ revision
59
+ }: UseWorkspaceLiveQueriesOptions): void;
60
+ //#endregion
61
+ export { useWorkspaceLiveQueries as a, invalidateWorkspaceDirectories as i, WorkspaceChange as n, WorkspaceChangeSource as r, UseWorkspaceLiveQueriesOptions as t };