anyclaude-react 0.2.0 → 0.2.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 (3) hide show
  1. package/README.md +27 -2
  2. package/package.json +1 -1
  3. package/styles.css +6 -1
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # anyclaude-react
2
2
 
3
- Restylable React UI kit for [`anyclaude-sdk`](https://www.npmjs.com/package/anyclaude-sdk) — hooks + components to build chatbots, AI agents, research assistants, and more. Includes built-in **serverless "survivor" stream-stitching** so long agent runs span function time-limits transparently.
3
+ Restylable React UI kit for [`anyclaude-sdk`](https://www.npmjs.com/package/anyclaude-sdk) — hooks + components to build chatbots, AI agents, research assistants, and **browser IDEs**. Includes built-in **serverless "survivor" stream-stitching** (long runs span function time-limits transparently) and **client-side tool execution** (the server-side agent runs `bash`/file tools in the user's browser). Markdown via [`streamdown`](https://www.npmjs.com/package/streamdown).
4
+
5
+ > **[Live demo](https://anyclaude-docs.puter.site/demo/)** — a full IDE built with this kit, running in your browser.
4
6
 
5
7
  ```bash
6
8
  npm install anyclaude-react anyclaude-sdk react
@@ -51,17 +53,40 @@ const { messages, streamingText, status, tokens, cost, send, interrupt, clear }
51
53
  - `status`: `'idle' | 'running' | 'paused'`
52
54
  - `send(text)` starts/continues; `interrupt()` aborts; `clear()` resets (new session).
53
55
 
56
+ ## Client-side tools (server brain, browser hands)
57
+
58
+ Run the agent on your server but execute chosen tools in the browser — e.g. `bash` on a WebContainer. Pair `query({ clientTools: ['bash'] })` server-side with a `clientTools` executor map here; `client_tool_request`s are auto-executed and the results streamed back:
59
+
60
+ ```tsx
61
+ useAgent({
62
+ endpoint: '/api/agent',
63
+ clientTools: { bash: async ({ command }) => ({ content: await runOnWebContainer(command) }) },
64
+ })
65
+ ```
66
+
54
67
  ## Components
55
68
 
69
+ **Chat**
70
+
56
71
  | Component | Purpose |
57
72
  |---|---|
58
73
  | `<AgentChat>` | All-in-one: Transcript + Working + Composer wired to `useAgent`. |
74
+ | `<ChatPanel>` | Like AgentChat with a header (status / tokens / cost). |
59
75
  | `<Transcript messages streamingText>` | Renders messages; pairs tool calls with results. |
60
- | `<Message>` / `<MarkdownMessage>` | Chat bubbles; safe built-in markdown (override via `render`). |
76
+ | `<Message>` / `<MarkdownMessage>` | Chat bubbles; markdown via `streamdown` (override via `render`). |
61
77
  | `<ToolCall>` | Collapsible tool call + result. |
62
78
  | `<Composer onSend>` | Textarea + send (Enter sends, Shift+Enter newline). |
63
79
  | `<Working active paused>` | Shimmering "Working…" indicator. |
64
80
 
81
+ **IDE** (optional peers: `@xterm/xterm`, `codemirror`)
82
+
83
+ | Component | Purpose |
84
+ |---|---|
85
+ | `<Terminal spawn>` | xterm.js bound to a streaming shell (e.g. a WebContainer process). |
86
+ | `<FileExplorer list onOpen>` | Collapsible file tree over any filesystem adapter. |
87
+ | `<CodeEditor value onChange>` | Controlled CodeMirror 6 editor. |
88
+ | `<AskUser question onAnswer>` | Renders an `ask_user_question` prompt; pair with the SDK's `onAskUser`. |
89
+
65
90
  ## Styling
66
91
 
67
92
  Everything is class-based (`.ac-*`) with `data-role` attributes. Import the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anyclaude-react",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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",
package/styles.css CHANGED
@@ -22,6 +22,11 @@
22
22
  }
23
23
 
24
24
  .ac-transcript { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 14px; }
25
+ /* The transcript is a flex column; children must NOT shrink. Tool pills use
26
+ overflow:hidden (→ flex min-height:0), so without this they collapse to a
27
+ sliver and the error border reads as a stray red line. They should keep their
28
+ natural height and let the transcript scroll. */
29
+ .ac-transcript > * { flex-shrink: 0; }
25
30
 
26
31
  .ac-msg { display: flex; gap: 8px; }
27
32
  .ac-msg-user { color: var(--ac-user); }
@@ -37,7 +42,7 @@
37
42
  .ac-code-inline { font-family: var(--ac-mono); background: var(--ac-panel); border: 1px solid var(--ac-border); border-radius: 6px; padding: 1px 5px; font-size: 0.9em; }
38
43
  .ac-code-block { font-family: var(--ac-mono); background: var(--ac-panel); border: 1px solid var(--ac-border); border-radius: var(--ac-radius); padding: 12px 14px; overflow-x: auto; margin: 10px 0; }
39
44
 
40
- .ac-tool { border: 1px solid var(--ac-border); border-radius: 10px; background: var(--ac-panel); margin: 2px 0; overflow: hidden; }
45
+ .ac-tool { border: 1px solid var(--ac-border); border-radius: 10px; background: var(--ac-panel); margin: 2px 0; overflow: hidden; flex-shrink: 0; }
41
46
  .ac-tool-error { border-color: #b3403a; }
42
47
  .ac-tool-head { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--ac-accent); padding: 8px 12px; cursor: pointer; font: inherit; text-align: left; }
43
48
  .ac-tool-caret { color: var(--ac-muted); }