anyclaude-react 0.3.0 → 0.4.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/README.md +28 -8
- package/dist/ide.d.ts +4 -0
- package/dist/ide.js +7 -0
- package/dist/index.d.ts +0 -4
- package/dist/index.js +3 -3
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -55,15 +55,24 @@ const { messages, streamingText, status, tokens, cost, send, interrupt, clear }
|
|
|
55
55
|
|
|
56
56
|
## Client-side tools (server brain, browser hands)
|
|
57
57
|
|
|
58
|
-
Run the agent on your server but execute
|
|
58
|
+
Run the agent on your server but execute its file/shell tools **in the browser** — against a WebContainer, an IndexedDB filesystem, OPFS, or memory. Pair `query({ clientTools: WORKSPACE_TOOL_NAMES })` server-side with a turnkey executor map here. `client_tool_request`s are auto-executed and the results streamed back; it reuses the real SDK tool implementations, so behavior matches server-side exactly.
|
|
59
59
|
|
|
60
60
|
```tsx
|
|
61
|
-
useAgent
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
import { useAgent, createWebContainerClientTools, createWorkspaceClientTools } from 'anyclaude-react'
|
|
62
|
+
import { DexieFileSystem } from 'anyclaude-sdk/fs'
|
|
63
|
+
|
|
64
|
+
// real shell + files in a WebContainer:
|
|
65
|
+
useAgent({ endpoint: '/api/agent', clientTools: createWebContainerClientTools(wc) })
|
|
66
|
+
|
|
67
|
+
// or point the file tools at the user's own IndexedDB (no shell):
|
|
68
|
+
useAgent({ endpoint: '/api/agent', clientTools: createWorkspaceClientTools(new DexieFileSystem('my-db')) })
|
|
69
|
+
|
|
70
|
+
// fully overridable per tool:
|
|
71
|
+
createWorkspaceClientTools(workspace, { only: ['write_file','read_file'], extra: { bash: myBash } })
|
|
65
72
|
```
|
|
66
73
|
|
|
74
|
+
You can still hand-write a `clientTools` map (`{ bash: async ({command}) => ({ content }) }`) for full control.
|
|
75
|
+
|
|
67
76
|
## Components
|
|
68
77
|
|
|
69
78
|
**Chat**
|
|
@@ -78,15 +87,26 @@ useAgent({
|
|
|
78
87
|
| `<Composer onSend>` | Textarea + send (Enter sends, Shift+Enter newline). |
|
|
79
88
|
| `<Working active paused>` | Shimmering "Working…" indicator. |
|
|
80
89
|
|
|
81
|
-
**
|
|
90
|
+
**Lightweight UI (root, no heavy deps)**
|
|
82
91
|
|
|
83
92
|
| Component | Purpose |
|
|
84
93
|
|---|---|
|
|
85
|
-
| `<Terminal spawn>` | xterm.js bound to a streaming shell (e.g. a WebContainer process). |
|
|
86
94
|
| `<FileExplorer list onOpen>` | Collapsible file tree over any filesystem adapter. |
|
|
87
|
-
| `<CodeEditor value onChange>` | Controlled CodeMirror 6 editor. |
|
|
88
95
|
| `<AskUser question onAnswer>` | Renders an `ask_user_question` prompt; pair with the SDK's `onAskUser`. |
|
|
89
96
|
|
|
97
|
+
**IDE — `anyclaude-react/ide` subpath** (so the root barrel stays dependency-light)
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { Terminal, CodeEditor } from 'anyclaude-react/ide'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
| Component | Purpose | Peer dep |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `<Terminal spawn>` | xterm.js terminal bound to a streaming shell (e.g. a WebContainer process). | `@xterm/xterm` + `@xterm/addon-fit` |
|
|
106
|
+
| `<CodeEditor value onChange>` | Controlled CodeMirror 6 editor. | `codemirror` + `@codemirror/*` |
|
|
107
|
+
|
|
108
|
+
The root export (`useAgent`, chat components, `FileExplorer`, `AskUser`, the client/workspace helpers) pulls **neither** `@xterm` nor `codemirror` — install those only if you import from `/ide`.
|
|
109
|
+
|
|
90
110
|
## Styling
|
|
91
111
|
|
|
92
112
|
Everything is class-based (`.ac-*`) with `data-role` attributes. Import the
|
package/dist/ide.d.ts
ADDED
package/dist/ide.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// anyclaude-react/ide — heavy IDE components, split onto a subpath so the root
|
|
2
|
+
// barrel stays dependency-light. These are the only components that need the
|
|
3
|
+
// optional peers @xterm/* (Terminal) and codemirror/@codemirror/* (CodeEditor).
|
|
4
|
+
//
|
|
5
|
+
// import { Terminal, CodeEditor } from 'anyclaude-react/ide'
|
|
6
|
+
export { Terminal } from './components/Terminal.js';
|
|
7
|
+
export { CodeEditor } from './components/CodeEditor.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -18,11 +18,7 @@ export { AgentChat } from './components/AgentChat.js';
|
|
|
18
18
|
export type { AgentChatProps } from './components/AgentChat.js';
|
|
19
19
|
export { ChatPanel } from './components/ChatPanel.js';
|
|
20
20
|
export type { ChatPanelProps } from './components/ChatPanel.js';
|
|
21
|
-
export { Terminal } from './components/Terminal.js';
|
|
22
|
-
export type { TerminalProps, ShellProcess } from './components/Terminal.js';
|
|
23
21
|
export { FileExplorer } from './components/FileExplorer.js';
|
|
24
22
|
export type { FileExplorerProps, FileEntry } from './components/FileExplorer.js';
|
|
25
|
-
export { CodeEditor } from './components/CodeEditor.js';
|
|
26
|
-
export type { CodeEditorProps } from './components/CodeEditor.js';
|
|
27
23
|
export { AskUser } from './components/AskUser.js';
|
|
28
24
|
export type { AskUserProps, AskUserQuestion } from './components/AskUser.js';
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,8 @@ export { Working } from './components/Working.js';
|
|
|
10
10
|
export { Transcript } from './components/Transcript.js';
|
|
11
11
|
export { AgentChat } from './components/AgentChat.js';
|
|
12
12
|
export { ChatPanel } from './components/ChatPanel.js';
|
|
13
|
-
// IDE-grade components (optional peer deps: @xterm/*, @codemirror/*)
|
|
14
|
-
export { Terminal } from './components/Terminal.js';
|
|
15
13
|
export { FileExplorer } from './components/FileExplorer.js';
|
|
16
|
-
export { CodeEditor } from './components/CodeEditor.js';
|
|
17
14
|
export { AskUser } from './components/AskUser.js';
|
|
15
|
+
// Heavy IDE components (Terminal → @xterm/*, CodeEditor → codemirror) live on a
|
|
16
|
+
// subpath so this root barrel stays dependency-light:
|
|
17
|
+
// import { Terminal, CodeEditor } from 'anyclaude-react/ide'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anyclaude-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React UI kit for anyclaude-sdk — restylable hooks + components (useAgent, Transcript, Composer, AgentChat, Terminal, FileExplorer, CodeEditor, ChatPanel, AskUser) with built-in serverless 'survivor' stream-stitching. Build chatbots, agents, research assistants, browser IDEs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./ide": {
|
|
15
|
+
"types": "./dist/ide.d.ts",
|
|
16
|
+
"import": "./dist/ide.js"
|
|
17
|
+
},
|
|
14
18
|
"./styles.css": "./styles.css"
|
|
15
19
|
},
|
|
16
20
|
"files": [
|