reifyui 0.2.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 +61 -10
- package/dist/index.cjs +407 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +128 -22
- package/dist/index.js +416 -172
- package/dist/index.js.map +1 -1
- package/dist/slides.cjs +737 -0
- package/dist/slides.cjs.map +1 -0
- package/dist/slides.d.ts +125 -0
- package/dist/slides.js +705 -0
- package/dist/slides.js.map +1 -0
- package/package.json +9 -2
- package/src/auth/AuthForm.jsx +187 -0
- package/src/auth/GoogleButton.jsx +80 -0
- package/src/auth/client.js +177 -0
- package/src/components/ChatMessages.jsx +194 -0
- package/src/components/CodeBlock.jsx +120 -0
- package/src/components/Composer.jsx +75 -0
- package/src/components/Dialog.jsx +312 -0
- package/src/components/TaskList.jsx +193 -0
- package/src/components/ToolSteps.jsx +84 -0
- package/src/components/icons.jsx +33 -0
- package/src/components/resizable.jsx +84 -0
- package/src/components/toolMeta.js +91 -0
- package/src/index.d.ts +234 -0
- package/src/index.js +35 -0
- package/src/sheet/SheetGrid.jsx +633 -0
- package/src/slides/Editor.jsx +246 -0
- package/src/slides/Presentation.jsx +79 -0
- package/src/slides/SlideView.jsx +97 -0
- package/src/slides/elements.jsx +178 -0
- package/src/slides/index.d.ts +125 -0
- package/src/slides/index.js +10 -0
- package/src/state/blocks.js +37 -0
- package/src/state/conversationStore.js +55 -0
- package/src/stream/responses.js +122 -0
- package/styles/dialog.css +145 -0
- package/styles/slides.css +38 -0
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ _Reify_ — to make the abstract concrete. ReifyUI reifies an agent's intent int
|
|
|
14
14
|
npm install reifyui
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
> **Status: v0.
|
|
17
|
+
> **Status: v0.4, early.** ReifyUI is an open foundation, not a finished platform. This first
|
|
18
18
|
> release line ships the rendering-and-interaction core described under **Today** below. The larger
|
|
19
19
|
> vision — a component registry, agent-driven composition, and protocol interop — is on the
|
|
20
20
|
> **Roadmap**, stated plainly so you can tell what runs now from what's coming. We don't ship
|
|
@@ -54,7 +54,8 @@ A production-grade surface for rendering and interacting with a live agent turn:
|
|
|
54
54
|
| **Chat surface** | `ChatMessages`, `UserTurn`, `AssistantTurn`, `ToolGroup`, `ToolRow`, `Composer` — message list + a collapsible "ran 5 commands, wrote a file" tool-step timeline |
|
|
55
55
|
| **Rich blocks** | `CodeBlock` (highlight.js + mermaid + charts), `useResizablePane`, `PaneResizer` |
|
|
56
56
|
| **Task list** | `TaskList`, `taskStatusGroup` — the master list beside a conversation: live status, filtering, cursor pagination. Transport-agnostic: you supply `fetchPage(cursor)` |
|
|
57
|
-
| **
|
|
57
|
+
| **Dialogs** | `DialogHost`, `useDialog` — awaited in-app `alert` / `confirm` / `prompt`, so a destructive tool call or a "name this" step never falls back to a browser popup |
|
|
58
|
+
| **Slides** (`reifyui/slides`) | `SlideView`, `SlideStage`, `EditorCanvas`, `Presentation`, `ElementView`, `themeVars` — render a JSON deck, edit it by direct manipulation, present it |
|
|
58
59
|
| **Spreadsheet** | `SheetGrid`, `sheetToDelimited`, `sheetToAoA` — an AI-editable grid |
|
|
59
60
|
| **Icons / tool meta** | `Ic*` icon set, `toolMeta`, `humanize`, `summarizeSteps` |
|
|
60
61
|
| **Auth (optional)** | `configureAuth`, `login`, `AuthForm`, `GoogleButton` — a thin JWT client for products with a `/v1/auth`-style backend; wired to nothing by default |
|
|
@@ -87,29 +88,43 @@ Render a live agent turn from a Server-Sent-Events response:
|
|
|
87
88
|
|
|
88
89
|
```jsx
|
|
89
90
|
import { useState } from 'react';
|
|
90
|
-
import { ChatMessages, Composer,
|
|
91
|
+
import { ChatMessages, Composer, pumpResponsesStream } from 'reifyui';
|
|
91
92
|
import 'reifyui/styles/chat.css';
|
|
92
93
|
import 'reifyui/styles/themes/light.css'; // or themes/dark.css
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
// You own the conversation array. ReifyUI renders it — text, reasoning, and a collapsible
|
|
96
|
+
// tool-step timeline — and never decides how you fetch or where your state lives.
|
|
96
97
|
export function Chat({ endpoint }) {
|
|
97
|
-
const [,
|
|
98
|
-
|
|
98
|
+
const [messages, setMessages] = useState([]);
|
|
99
|
+
const [busy, setBusy] = useState(false);
|
|
100
|
+
|
|
101
|
+
const amendLast = (patch) =>
|
|
102
|
+
setMessages((m) => m.map((x, i) => (i === m.length - 1 ? { ...x, ...patch(x) } : x)));
|
|
99
103
|
|
|
100
104
|
async function send(text) {
|
|
105
|
+
setMessages((m) => [...m, { role: 'user', text }, { role: 'assistant', text: '', steps: [] }]);
|
|
106
|
+
setBusy(true);
|
|
101
107
|
const res = await fetch(endpoint, {
|
|
102
108
|
method: 'POST',
|
|
103
109
|
headers: { 'content-type': 'application/json' },
|
|
104
110
|
body: JSON.stringify({ input: text, stream: true }),
|
|
105
111
|
});
|
|
106
|
-
await pumpResponsesStream(
|
|
112
|
+
await pumpResponsesStream(res.body, {
|
|
113
|
+
onTextDelta: (d) => amendLast((x) => ({ text: x.text + d })),
|
|
114
|
+
onReasoningDelta: (d) => amendLast((x) => ({ reasoning: (x.reasoning || '') + d })),
|
|
115
|
+
onToolCall: (name, args, callId) =>
|
|
116
|
+
amendLast((x) => ({ steps: [...x.steps, { name, args, callId }] })),
|
|
117
|
+
onToolResult: (callId, output) =>
|
|
118
|
+
amendLast((x) => ({ steps: x.steps.map((s) => (s.callId === callId ? { ...s, output } : s)) })),
|
|
119
|
+
onDone: () => setBusy(false),
|
|
120
|
+
onError: () => setBusy(false),
|
|
121
|
+
});
|
|
107
122
|
}
|
|
108
123
|
|
|
109
124
|
return (
|
|
110
125
|
<>
|
|
111
|
-
<ChatMessages
|
|
112
|
-
<Composer onSend={send}
|
|
126
|
+
<ChatMessages messages={messages} workingLabel={busy ? 'Working…' : undefined} />
|
|
127
|
+
<Composer onSend={send} disabled={busy} />
|
|
113
128
|
</>
|
|
114
129
|
);
|
|
115
130
|
}
|
|
@@ -130,11 +145,47 @@ import 'reifyui/styles/themes/dark.css'; // dark theme variables
|
|
|
130
145
|
import 'reifyui/styles/slides.css'; // slides
|
|
131
146
|
import 'reifyui/styles/sheet.css'; // spreadsheet grid
|
|
132
147
|
import 'reifyui/styles/tasks.css'; // task list
|
|
148
|
+
import 'reifyui/styles/dialog.css'; // alert / confirm / prompt dialogs
|
|
133
149
|
```
|
|
134
150
|
|
|
135
151
|
Themes are CSS-variable files — load one, or switch at runtime by toggling which you apply. Override
|
|
136
152
|
the variables to match your design system.
|
|
137
153
|
|
|
154
|
+
## Slides
|
|
155
|
+
|
|
156
|
+
A deck is JSON — a fixed 1920×1080 stage, and elements with absolute frames and stable ids. That
|
|
157
|
+
makes it something an agent can author and patch precisely, and something you can render, edit and
|
|
158
|
+
present from the same components.
|
|
159
|
+
|
|
160
|
+
Imported from **`reifyui/slides`**, not the root: chart, diagram and code elements lazy-load
|
|
161
|
+
echarts, mermaid and highlight.js, and a root re-export would put all three in the dependency graph
|
|
162
|
+
of every app that imports a `Button`.
|
|
163
|
+
|
|
164
|
+
```jsx
|
|
165
|
+
import { SlideView, EditorCanvas, Presentation } from 'reifyui/slides';
|
|
166
|
+
import 'reifyui/styles/slides.css';
|
|
167
|
+
|
|
168
|
+
// Read-only: thumbnails, previews, print pages.
|
|
169
|
+
<SlideView slide={deck.slides[0]} theme={deck.theme} bare />
|
|
170
|
+
|
|
171
|
+
// Editable: drag to move, corner handles to resize, double-click to edit text,
|
|
172
|
+
// Delete to remove, arrows to nudge. The canvas never mutates the deck — you do.
|
|
173
|
+
<EditorCanvas
|
|
174
|
+
slide={deck.slides[i]}
|
|
175
|
+
theme={deck.theme}
|
|
176
|
+
selectedId={selected}
|
|
177
|
+
onSelect={setSelected}
|
|
178
|
+
onPatchElement={(id, patch) => setDeck((d) => patchElement(d, i, id, patch))}
|
|
179
|
+
onDeleteElement={(id) => setDeck((d) => removeElement(d, i, id))}
|
|
180
|
+
readOnly={agentIsWriting}
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Because every commit leaves as a typed patch, undo, autosave and collaboration stay where they
|
|
185
|
+
belong — with the host. Pass `peers` to draw other people's selections and live drags, and
|
|
186
|
+
`onDragState` to broadcast your own. `resolveSrc` rewrites element `src` values on the way out, so
|
|
187
|
+
workspace-relative image paths can point at your own file API.
|
|
188
|
+
|
|
138
189
|
## Optional: auth client
|
|
139
190
|
|
|
140
191
|
ReifyUI includes a small, framework-agnostic auth client for products whose backend exposes a JSON
|