@mcp-b/react-components 0.74.0 → 0.75.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.
- package/dist/ConversationTabPicker-C_hMt0GY.d.ts +28 -0
- package/dist/{ThinkChatActivity-C7xnO0Fx.d.ts → ThinkChatActivity-Cb47dKAW.d.ts} +2 -2
- package/dist/{ThinkChatActivitySummary-Dh4Av7x_.d.ts → ThinkChatActivitySummary-Hvur11FV.d.ts} +1 -1
- package/dist/{ThinkChatToolParts-BrntWlpa.d.ts → ThinkChatToolParts-vSzcCbQW.d.ts} +144 -25
- package/dist/components/agents-sdk/EmployeeChat.d.ts +1 -1
- package/dist/components/agents-sdk/PromptInputCommands.d.ts +13 -4
- package/dist/components/agents-sdk/PromptInputCommands.js +4 -6
- package/dist/components/agents-sdk/ThinkChat.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChatActivity.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/agents-sdk/ThinkChatActivitySummary.js +17 -10
- package/dist/components/agents-sdk/ThinkChatToolPanels.d.ts +5 -5
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +498 -254
- package/dist/components/agents-sdk/ThinkChatToolParts.d.ts +2 -2
- package/dist/components/agents-sdk/ThinkChatToolParts.js +13 -4
- package/dist/components/extension/ConversationTabPicker.d.ts +2 -27
- package/dist/components/extension/FirstRunSetup.d.ts +2 -2
- package/package.json +16 -11
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/components/extension/ConversationTabPicker.d.ts
|
|
3
|
+
type ConversationTabId = string | number;
|
|
4
|
+
interface ConversationTabPickerItem {
|
|
5
|
+
id: ConversationTabId;
|
|
6
|
+
title?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
iconSrc?: string;
|
|
9
|
+
}
|
|
10
|
+
interface ConversationTabPickerProps<Tab extends ConversationTabPickerItem = ConversationTabPickerItem> {
|
|
11
|
+
/** Browser-enriched tabs already scoped to the current conversation. */
|
|
12
|
+
tabs: readonly Tab[];
|
|
13
|
+
/** Host-owned activation, such as Chrome tab/window focus. */
|
|
14
|
+
onSelect: (tab: Tab) => void | Promise<void>;
|
|
15
|
+
/** Maximum site marks shown in the collapsed trigger. */
|
|
16
|
+
maxVisible?: number;
|
|
17
|
+
/** Visible heading for the tab choices in the menu. */
|
|
18
|
+
groupLabel?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Shared tab-menu presentation over host-resolved browser data.
|
|
22
|
+
*
|
|
23
|
+
* The browser adapter owns tab lookup and activation. This component owns URL
|
|
24
|
+
* labels, favicon fallbacks, menu state, and async activation feedback.
|
|
25
|
+
*/
|
|
26
|
+
declare function ConversationTabPicker<Tab extends ConversationTabPickerItem>({ tabs, ...props }: ConversationTabPickerProps<Tab>): React.JSX.Element | null;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ConversationTabPickerProps as i, ConversationTabPicker as n, ConversationTabPickerItem as r, ConversationTabId as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as AgentMessageRenderPartContext } from "./AgentMessageParts-BtWwiE4f.js";
|
|
2
2
|
import { AgentChatMessageContentProps } from "./components/agents-sdk/AgentChat.js";
|
|
3
3
|
import { r as AgentToolRunValue } from "./AgentToolRunsContext-Br3jZ6Up.js";
|
|
4
|
-
import {
|
|
5
|
-
import { t as ThinkChatActivityDescription } from "./ThinkChatActivitySummary-
|
|
4
|
+
import { l as ThinkChatPart } from "./ThinkChatToolParts-vSzcCbQW.js";
|
|
5
|
+
import { t as ThinkChatActivityDescription } from "./ThinkChatActivitySummary-Hvur11FV.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { DynamicToolUIPart, ToolUIPart, UIMessage } from "ai";
|
|
8
8
|
//#region src/components/agents-sdk/ThinkChatActivity.d.ts
|
package/dist/{ThinkChatActivitySummary-Dh4Av7x_.d.ts → ThinkChatActivitySummary-Hvur11FV.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as AgentActivitySummary, n as AgentActivityIconKind } from "./AgentActivity-Cngwkalq.js";
|
|
2
|
-
import {
|
|
2
|
+
import { l as ThinkChatPart } from "./ThinkChatToolParts-vSzcCbQW.js";
|
|
3
3
|
import { DynamicToolUIPart, ToolUIPart } from "ai";
|
|
4
4
|
//#region src/components/agents-sdk/ThinkChatActivitySummary.d.ts
|
|
5
5
|
interface ThinkChatToolDescriber {
|
|
@@ -1,36 +1,155 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InferToolInput, Tool, ToolUIPart, UIMessage } from "ai";
|
|
2
2
|
import { ProxyToolInput, ProxyToolOutput } from "@cloudflare/codemode";
|
|
3
3
|
import { QuickActionExtractInput, QuickActionPage, QuickActionScrapeInput, QuickActionToolName } from "@cloudflare/think/tools/browser";
|
|
4
4
|
import { FetchResponseMode, FetchResult } from "@cloudflare/think/tools/fetch";
|
|
5
|
-
import {
|
|
5
|
+
import { ExecToolOutput } from "@cloudflare/computer/tools";
|
|
6
|
+
import { createDeleteTool, createEditTool, createExecTool, createFindTool, createGrepTool, createListTool, createPublishTool, createReadTool, createWriteTool } from "@cloudflare/computer/tools/ai-sdk";
|
|
6
7
|
//#region src/components/agents-sdk/ThinkChatToolParts.d.ts
|
|
7
8
|
type ThinkChatPart = UIMessage["parts"][number];
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
type ToolInput<Create extends (...args: never[]) => Tool> = InferToolInput<ReturnType<Create>>;
|
|
10
|
+
type WorkspaceToolError = {
|
|
11
|
+
error: string;
|
|
12
|
+
};
|
|
13
|
+
type WorkspaceReadOutput = {
|
|
14
|
+
path: string;
|
|
15
|
+
content: string;
|
|
16
|
+
startLine: number;
|
|
17
|
+
endLine: number;
|
|
18
|
+
totalLines: number | null;
|
|
19
|
+
truncated: boolean;
|
|
20
|
+
nextOffset?: number;
|
|
21
|
+
nextByteOffset?: number;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "image" | "file" | "binary";
|
|
24
|
+
path: string;
|
|
25
|
+
name: string;
|
|
26
|
+
mediaType: string;
|
|
27
|
+
sizeBytes: number;
|
|
28
|
+
data?: string;
|
|
29
|
+
unsupported?: true;
|
|
30
|
+
} | WorkspaceToolError;
|
|
31
|
+
type WorkspaceWriteOutput = {
|
|
32
|
+
path: string;
|
|
33
|
+
bytesWritten: number;
|
|
34
|
+
} | WorkspaceToolError;
|
|
35
|
+
type WorkspaceEditOutput = {
|
|
36
|
+
path: string;
|
|
37
|
+
editsApplied: number;
|
|
38
|
+
/** Line-numbered display diff: `+`, `-` or space, the line number, then the line. */
|
|
39
|
+
diff: string;
|
|
40
|
+
patch: string;
|
|
41
|
+
firstChangedLine: number | undefined;
|
|
42
|
+
diffTruncated?: boolean;
|
|
43
|
+
} | WorkspaceToolError;
|
|
44
|
+
type WorkspaceDeleteOutput = {
|
|
45
|
+
deleted: string;
|
|
46
|
+
} | WorkspaceToolError;
|
|
47
|
+
type WorkspaceListOutput = {
|
|
48
|
+
path: string;
|
|
49
|
+
count: number;
|
|
50
|
+
entries: {
|
|
51
|
+
name: string;
|
|
52
|
+
size: number;
|
|
53
|
+
mtime: number;
|
|
54
|
+
isFile: boolean;
|
|
55
|
+
isDirectory: boolean;
|
|
56
|
+
isSymbolicLink: boolean;
|
|
57
|
+
}[];
|
|
58
|
+
nextOffset?: number;
|
|
59
|
+
} | WorkspaceToolError;
|
|
60
|
+
type WorkspaceFindOutput = {
|
|
61
|
+
path: string;
|
|
62
|
+
pattern: string;
|
|
63
|
+
count: number;
|
|
64
|
+
entries: {
|
|
65
|
+
path: string;
|
|
66
|
+
type: "file" | "dir";
|
|
67
|
+
}[];
|
|
68
|
+
nextOffset?: number;
|
|
69
|
+
} | WorkspaceToolError;
|
|
70
|
+
type WorkspaceGrepOutput = {
|
|
71
|
+
path: string;
|
|
72
|
+
query: string;
|
|
73
|
+
count: number;
|
|
74
|
+
matches: {
|
|
75
|
+
path: string;
|
|
76
|
+
line: number;
|
|
77
|
+
text: string;
|
|
78
|
+
context?: {
|
|
79
|
+
line: number;
|
|
80
|
+
text: string;
|
|
81
|
+
isMatch: boolean;
|
|
82
|
+
}[];
|
|
83
|
+
}[];
|
|
84
|
+
nextOffset?: number;
|
|
85
|
+
} | WorkspaceToolError;
|
|
86
|
+
type WorkspacePublishOutput = {
|
|
87
|
+
ok: true;
|
|
88
|
+
url: string;
|
|
89
|
+
} | {
|
|
90
|
+
ok: false;
|
|
91
|
+
error: string;
|
|
92
|
+
};
|
|
93
|
+
type BashToolInput = {
|
|
94
|
+
script: string;
|
|
95
|
+
cwd?: string;
|
|
96
|
+
};
|
|
97
|
+
type BashToolOutput = {
|
|
20
98
|
stdout: string;
|
|
21
99
|
stderr: string;
|
|
22
100
|
exitCode: number;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
101
|
+
};
|
|
102
|
+
type WorkspaceUITools = {
|
|
103
|
+
read: {
|
|
104
|
+
input: ToolInput<typeof createReadTool>;
|
|
105
|
+
output: WorkspaceReadOutput;
|
|
106
|
+
};
|
|
107
|
+
ls: {
|
|
108
|
+
input: ToolInput<typeof createListTool>;
|
|
109
|
+
output: WorkspaceListOutput;
|
|
110
|
+
};
|
|
111
|
+
find: {
|
|
112
|
+
input: ToolInput<typeof createFindTool>;
|
|
113
|
+
output: WorkspaceFindOutput;
|
|
114
|
+
};
|
|
115
|
+
grep: {
|
|
116
|
+
input: ToolInput<typeof createGrepTool>;
|
|
117
|
+
output: WorkspaceGrepOutput;
|
|
118
|
+
};
|
|
119
|
+
write: {
|
|
120
|
+
input: ToolInput<typeof createWriteTool>;
|
|
121
|
+
output: WorkspaceWriteOutput;
|
|
122
|
+
};
|
|
123
|
+
edit: {
|
|
124
|
+
input: ToolInput<typeof createEditTool>;
|
|
125
|
+
output: WorkspaceEditOutput;
|
|
126
|
+
};
|
|
127
|
+
delete: {
|
|
128
|
+
input: ToolInput<typeof createDeleteTool>;
|
|
129
|
+
output: WorkspaceDeleteOutput;
|
|
130
|
+
};
|
|
131
|
+
exec: {
|
|
132
|
+
input: ToolInput<typeof createExecTool>;
|
|
133
|
+
output: ExecToolOutput;
|
|
134
|
+
};
|
|
135
|
+
publish: {
|
|
136
|
+
input: ToolInput<typeof createPublishTool>;
|
|
137
|
+
output: WorkspacePublishOutput;
|
|
138
|
+
};
|
|
139
|
+
bash: {
|
|
140
|
+
input: BashToolInput;
|
|
141
|
+
output: BashToolOutput;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
type WorkspaceToolPart = ToolUIPart<WorkspaceUITools>;
|
|
145
|
+
type ThinkWorkspaceToolName = keyof WorkspaceUITools;
|
|
146
|
+
/** The two shell tools: upstream `exec` and a host's `bash`. */
|
|
147
|
+
type ShellToolPart = Extract<WorkspaceToolPart, {
|
|
148
|
+
type: "tool-exec" | "tool-bash";
|
|
149
|
+
}>;
|
|
33
150
|
declare function isWorkspaceToolPart(part: ThinkChatPart): part is WorkspaceToolPart;
|
|
151
|
+
/** The `{ error }` (or publish's `{ ok: false, error }`) a settled workspace tool returned. */
|
|
152
|
+
declare function workspaceToolError(part: WorkspaceToolPart): string | undefined;
|
|
34
153
|
type SkillUITools = {
|
|
35
154
|
activate_skill: {
|
|
36
155
|
input: {
|
|
@@ -180,4 +299,4 @@ declare function readFollowUpReceipt(part: ThinkChatPart): FollowUpReceipt | und
|
|
|
180
299
|
declare function thinkToolOutcome(part: ThinkChatPart): ThinkToolOutcome;
|
|
181
300
|
declare function displayUrl(url: string | undefined): string;
|
|
182
301
|
//#endregion
|
|
183
|
-
export {
|
|
302
|
+
export { isWorkspaceToolPart as C, workspaceToolError as E, isThinkChatActivityPart as S, thinkToolOutcome as T, isPartFailed as _, SessionContextToolName as a, isSessionContextToolPart as b, SkillToolPart as c, ThinkWorkspaceToolName as d, WorkspaceToolPart as f, isFetchToolPart as g, isExecuteToolPart as h, FollowUpReceipt as i, ThinkChatPart as l, isBrowserToolPart as m, ExecuteToolPart as n, SessionContextToolPart as o, displayUrl as p, FetchToolPart as r, ShellToolPart as s, BrowserToolPart as t, ThinkToolOutcome as u, isPartWorking as v, readFollowUpReceipt as w, isSkillToolPart as x, isSessionContextToolFailure as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { E as PromptInputCommandComposerProps, M as PromptInputContextSelectorProps } from "../../PromptInput-DEwFMj6f.js";
|
|
2
2
|
import { AgentChatTranscriptProps } from "./AgentChat.js";
|
|
3
|
-
import { ConversationTabPickerProps } from "
|
|
3
|
+
import { i as ConversationTabPickerProps } from "../../ConversationTabPicker-C_hMt0GY.js";
|
|
4
4
|
import { SetupChecklistGroupProps } from "../general-purpose/SetupChecklist.js";
|
|
5
5
|
import { McpServerPickerItemsProps } from "./McpServerPicker.js";
|
|
6
6
|
import { EmployeeStartScreenProps } from "./EmployeeStartScreen.js";
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { D as PromptInputCommandDefinition } from "../../PromptInput-DEwFMj6f.js";
|
|
2
|
-
import { ConversationTabPickerItem } from "
|
|
2
|
+
import { r as ConversationTabPickerItem } from "../../ConversationTabPicker-C_hMt0GY.js";
|
|
3
3
|
import { MCPServersState } from "agents";
|
|
4
|
-
import {
|
|
4
|
+
import { Skill, SkillCatalogEntry } from "agents/skills";
|
|
5
5
|
//#region src/components/agents-sdk/PromptInputCommands.d.ts
|
|
6
6
|
/** Project whole upstream Agents MCP state into composer mention commands. */
|
|
7
7
|
export declare function mcpPromptInputCommands(mcp: MCPServersState): PromptInputCommandDefinition[];
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A skill as a host lists it: upstream `Skill`'s name and description and the
|
|
10
|
+
* `SkillCatalogEntry` source that provided it, without the instructions body.
|
|
11
|
+
* The name widens upstream's branded `SkillName` to `string`, because rows
|
|
12
|
+
* reach the UI through RPC or synchronized state, where the brand is gone.
|
|
13
|
+
*/
|
|
14
|
+
export type SkillSummary = Pick<Skill, "description"> & Pick<SkillCatalogEntry, "sourceId"> & {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
};
|
|
17
|
+
/** Project host skill summaries into composer slash commands. */
|
|
18
|
+
export declare function skillPromptInputCommands(skills: readonly SkillSummary[]): PromptInputCommandDefinition[];
|
|
10
19
|
/** Project host-resolved browser tabs into composer `@` mentions. */
|
|
11
20
|
export declare function tabPromptInputCommands(tabs: readonly ConversationTabPickerItem[]): PromptInputCommandDefinition[];
|
|
12
21
|
//#endregion
|
|
@@ -47,10 +47,10 @@ function mcpPromptInputCommands(mcp) {
|
|
|
47
47
|
}];
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
/** Project
|
|
50
|
+
/** Project host skill summaries into composer slash commands. */
|
|
51
51
|
function skillPromptInputCommands(skills) {
|
|
52
52
|
return skills.map((skill) => ({
|
|
53
|
-
id: `skill:${skill.sourceId
|
|
53
|
+
id: `skill:${skill.sourceId}:${skill.name}`,
|
|
54
54
|
value: skill.name,
|
|
55
55
|
label: skill.name,
|
|
56
56
|
description: skill.description,
|
|
@@ -60,10 +60,8 @@ function skillPromptInputCommands(skills) {
|
|
|
60
60
|
label: skill.name
|
|
61
61
|
}),
|
|
62
62
|
icon: /* @__PURE__ */ jsx(BoxIcon, {}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
meta: skill.sourceId
|
|
66
|
-
} : {},
|
|
63
|
+
keywords: [skill.sourceId],
|
|
64
|
+
meta: skill.sourceId,
|
|
67
65
|
group: "Skills"
|
|
68
66
|
}));
|
|
69
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { J as PromptInputMessage } from "../../PromptInput-DEwFMj6f.js";
|
|
2
2
|
import { i as AgentMessageRenderPartContext } from "../../AgentMessageParts-BtWwiE4f.js";
|
|
3
3
|
import { AgentChatMessageContentProps, AgentChatRootProps } from "./AgentChat.js";
|
|
4
|
-
import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-
|
|
4
|
+
import { o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, t as ThinkChatActivity } from "../../ThinkChatActivity-Cb47dKAW.js";
|
|
5
5
|
import { i as ThinkChatValue } from "../../ThinkChatContext-DQ6M2VlJ.js";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { ChatStatus, UIMessage } from "ai";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-
|
|
1
|
+
import { a as ThinkChatToolRenderers, i as ThinkChatToolRenderer, n as ThinkChatActivityProps, o as createThinkChatActivityRenderer, r as ThinkChatActivityRendererOptions, s as renderThinkChatActivityPart, t as ThinkChatActivity } from "../../ThinkChatActivity-Cb47dKAW.js";
|
|
2
2
|
export { ThinkChatActivity, ThinkChatActivityProps, ThinkChatActivityRendererOptions, ThinkChatToolRenderer, ThinkChatToolRenderers, createThinkChatActivityRenderer, renderThinkChatActivityPart };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ThinkChatToolLifecycleSnapshot, c as deriveThinkChatActivityHeader, d as summarizeActivitySteps, i as ThinkChatToolDescribers, l as deriveThinkChatToolLifecycleHeader, n as ThinkChatActivityHeader, o as activityPartIconKind, r as ThinkChatToolDescriber, s as activityPartUrl, t as ThinkChatActivityDescription, u as describeThinkChatActivityPart } from "../../ThinkChatActivitySummary-
|
|
1
|
+
import { a as ThinkChatToolLifecycleSnapshot, c as deriveThinkChatActivityHeader, d as summarizeActivitySteps, i as ThinkChatToolDescribers, l as deriveThinkChatToolLifecycleHeader, n as ThinkChatActivityHeader, o as activityPartIconKind, r as ThinkChatToolDescriber, s as activityPartUrl, t as ThinkChatActivityDescription, u as describeThinkChatActivityPart } from "../../ThinkChatActivitySummary-Hvur11FV.js";
|
|
2
2
|
export { ThinkChatActivityDescription, ThinkChatActivityHeader, ThinkChatToolDescriber, ThinkChatToolDescribers, ThinkChatToolLifecycleSnapshot, activityPartIconKind, activityPartUrl, deriveThinkChatActivityHeader, deriveThinkChatToolLifecycleHeader, describeThinkChatActivityPart, summarizeActivitySteps };
|
|
@@ -3,7 +3,7 @@ import { getToolDisplayName } from "../ai-sdk/ToolPart.js";
|
|
|
3
3
|
import { t as summarizeToolInput } from "../../summarize-tool-input-CqTcGRYy.js";
|
|
4
4
|
import { i as workspaceBasename } from "../../workspace-path-TZggP-u4.js";
|
|
5
5
|
import { formatThinkExecutionShortTimestamp } from "./ThinkExecutionRun.js";
|
|
6
|
-
import { displayUrl, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSessionContextToolFailure, isSessionContextToolPart, isSkillToolPart, isWorkspaceToolPart, readFollowUpReceipt, thinkToolOutcome } from "./ThinkChatToolParts.js";
|
|
6
|
+
import { displayUrl, isBrowserToolPart, isExecuteToolPart, isFetchToolPart, isPartFailed, isPartWorking, isSessionContextToolFailure, isSessionContextToolPart, isSkillToolPart, isWorkspaceToolPart, readFollowUpReceipt, thinkToolOutcome, workspaceToolError } from "./ThinkChatToolParts.js";
|
|
7
7
|
import { getStaticToolName, getToolName, isReasoningUIPart, isStaticToolUIPart, isToolUIPart } from "ai";
|
|
8
8
|
//#region src/components/agents-sdk/ThinkChatActivitySummary.ts
|
|
9
9
|
function described(action, detail) {
|
|
@@ -222,12 +222,14 @@ function activityPartIconKind(part, hasUrl) {
|
|
|
222
222
|
if (isReasoningUIPart(part)) return "thought";
|
|
223
223
|
if (isWorkspaceToolPart(part)) switch (part.type) {
|
|
224
224
|
case "tool-read":
|
|
225
|
-
case "tool-
|
|
225
|
+
case "tool-ls": return "read";
|
|
226
226
|
case "tool-write":
|
|
227
227
|
case "tool-edit":
|
|
228
228
|
case "tool-delete": return "edit";
|
|
229
229
|
case "tool-find":
|
|
230
230
|
case "tool-grep": return "search";
|
|
231
|
+
case "tool-publish": return "web";
|
|
232
|
+
case "tool-exec":
|
|
231
233
|
case "tool-bash": return "command";
|
|
232
234
|
}
|
|
233
235
|
if (isSkillToolPart(part)) return "tool";
|
|
@@ -244,7 +246,8 @@ function activityPartWorkspaceDestination(part) {
|
|
|
244
246
|
case "tool-read":
|
|
245
247
|
case "tool-write":
|
|
246
248
|
case "tool-edit":
|
|
247
|
-
case "tool-delete":
|
|
249
|
+
case "tool-delete":
|
|
250
|
+
case "tool-publish": {
|
|
248
251
|
const path = part.input?.path;
|
|
249
252
|
return typeof path === "string" && path.length > 0 ? {
|
|
250
253
|
kind: "file",
|
|
@@ -252,9 +255,10 @@ function activityPartWorkspaceDestination(part) {
|
|
|
252
255
|
fragment: null
|
|
253
256
|
} : null;
|
|
254
257
|
}
|
|
255
|
-
case "tool-
|
|
258
|
+
case "tool-ls":
|
|
256
259
|
case "tool-find":
|
|
257
260
|
case "tool-grep":
|
|
261
|
+
case "tool-exec":
|
|
258
262
|
case "tool-bash": return null;
|
|
259
263
|
}
|
|
260
264
|
}
|
|
@@ -312,9 +316,9 @@ function describeBuiltInThinkChatActivityPart(part) {
|
|
|
312
316
|
}
|
|
313
317
|
function describeWorkspaceToolPart(part) {
|
|
314
318
|
const working = isPartWorking(part);
|
|
315
|
-
const failed = isPartFailed(part);
|
|
316
|
-
if (part.type === "tool-bash") {
|
|
317
|
-
const command = part.input?.script?.trim() ?? "";
|
|
319
|
+
const failed = isPartFailed(part) || workspaceToolError(part) !== void 0;
|
|
320
|
+
if (part.type === "tool-exec" || part.type === "tool-bash") {
|
|
321
|
+
const command = (part.type === "tool-exec" ? part.input?.command : part.input?.script)?.trim() ?? "";
|
|
318
322
|
if (failed) return described("Command failed", command);
|
|
319
323
|
const verb = working ? "Running" : "Ran";
|
|
320
324
|
return command ? described(verb, command) : described(`${verb} a command`);
|
|
@@ -325,12 +329,13 @@ function describeWorkspaceToolPart(part) {
|
|
|
325
329
|
case "tool-write": return described(working ? "Writing" : "Wrote", part.input?.path ? workspaceBasename(part.input.path) : "a file");
|
|
326
330
|
case "tool-edit": return described(working ? "Editing" : "Edited", part.input?.path ? workspaceBasename(part.input.path) : "a file");
|
|
327
331
|
case "tool-delete": return described(working ? "Deleting" : "Deleted", part.input?.path || "a file");
|
|
328
|
-
case "tool-
|
|
332
|
+
case "tool-ls": {
|
|
329
333
|
const path = part.input?.path;
|
|
330
334
|
return described(working ? "Listing" : "Listed", path && path !== "/" ? path : "files");
|
|
331
335
|
}
|
|
332
336
|
case "tool-find": return described(working ? "Searching" : "Searched", `for ${part.input?.pattern || "files"}`);
|
|
333
337
|
case "tool-grep": return described(working ? "Searching" : "Searched", `for ${part.input?.query || "text"}`);
|
|
338
|
+
case "tool-publish": return described(working ? "Publishing" : "Published", part.input?.path ? workspaceBasename(part.input.path) : "a file");
|
|
334
339
|
}
|
|
335
340
|
})();
|
|
336
341
|
return failed ? described(`${action} ${detail ?? ""}`.trim() + " · failed") : described(action, detail);
|
|
@@ -442,7 +447,8 @@ function summarizeActivitySteps(parts) {
|
|
|
442
447
|
const reads = count("read");
|
|
443
448
|
const edits = count("edit") + count("write");
|
|
444
449
|
const deletes = count("delete");
|
|
445
|
-
const commands = count("bash");
|
|
450
|
+
const commands = count("exec") + count("bash");
|
|
451
|
+
const publishes = count("publish");
|
|
446
452
|
const segments = [];
|
|
447
453
|
if (thoughts > 0) segments.push("thought");
|
|
448
454
|
if (skillParts > 0) segments.push(skillNames.size === 1 ? `used the ${[...skillNames][0]} skill` : skillNames.size > 1 ? `used ${skillNames.size} skills` : "used a skill");
|
|
@@ -451,7 +457,8 @@ function summarizeActivitySteps(parts) {
|
|
|
451
457
|
if (edits > 0) segments.push(`edited ${files(edits)}`);
|
|
452
458
|
if (deletes > 0) segments.push(`deleted ${files(deletes)}`);
|
|
453
459
|
if (count("find") + count("grep") > 0) segments.push("searched code");
|
|
454
|
-
if (count("
|
|
460
|
+
if (count("ls") > 0) segments.push("listed files");
|
|
461
|
+
if (publishes > 0) segments.push(`published ${files(publishes)}`);
|
|
455
462
|
if (fetches > 0) segments.push(fetches === 1 ? "fetched a URL" : `fetched ${fetches} URLs`);
|
|
456
463
|
if (browses > 0) segments.push("used the browser");
|
|
457
464
|
if (codeRuns > 0) segments.push("ran code");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as SkillToolPart, f as WorkspaceToolPart, n as ExecuteToolPart, o as SessionContextToolPart, r as FetchToolPart, t as BrowserToolPart } from "../../ThinkChatToolParts-vSzcCbQW.js";
|
|
2
2
|
import { AnyToolUIPart } from "../ai-sdk/ToolPart.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
//#region src/components/agents-sdk/ThinkChatToolPanels.d.ts
|
|
5
|
-
/** Default panels for the
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
the
|
|
5
|
+
/** Default panels for the workspace tools, Claude Code-style: read/write show
|
|
6
|
+
the file, edit shows upstream's line-numbered diff, ls/find/grep show
|
|
7
|
+
their pages of results, and exec or a host's bash get the shell panel.
|
|
8
|
+
Every field comes from the tool contract in ThinkChatToolParts. */
|
|
9
9
|
export declare function ThinkChatWorkspacePanel({ part }: {
|
|
10
10
|
part: WorkspaceToolPart;
|
|
11
11
|
}): React.JSX.Element | null;
|