golem-ui 0.1.1
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/LICENSE +21 -0
- package/README.md +165 -0
- package/dist/abi/define-component.d.ts +28 -0
- package/dist/abi/define-component.d.ts.map +1 -0
- package/dist/abi/docs.d.ts +104 -0
- package/dist/abi/docs.d.ts.map +1 -0
- package/dist/abi/error-card.d.ts +18 -0
- package/dist/abi/error-card.d.ts.map +1 -0
- package/dist/abi/fields.d.ts +71 -0
- package/dist/abi/fields.d.ts.map +1 -0
- package/dist/abi/index.d.ts +8 -0
- package/dist/abi/index.d.ts.map +1 -0
- package/dist/adapters/chat.d.ts +28 -0
- package/dist/adapters/chat.d.ts.map +1 -0
- package/dist/adapters/chat.docs.d.ts +3 -0
- package/dist/adapters/chat.docs.d.ts.map +1 -0
- package/dist/adapters/clock.d.ts +5 -0
- package/dist/adapters/clock.d.ts.map +1 -0
- package/dist/adapters/clock.docs.d.ts +3 -0
- package/dist/adapters/clock.docs.d.ts.map +1 -0
- package/dist/adapters/common.d.ts +3 -0
- package/dist/adapters/common.d.ts.map +1 -0
- package/dist/adapters/fake/chat.d.ts +13 -0
- package/dist/adapters/fake/chat.d.ts.map +1 -0
- package/dist/adapters/fake/clock.d.ts +4 -0
- package/dist/adapters/fake/clock.d.ts.map +1 -0
- package/dist/adapters/fake/emitter.d.ts +7 -0
- package/dist/adapters/fake/emitter.d.ts.map +1 -0
- package/dist/adapters/fake/files.d.ts +42 -0
- package/dist/adapters/fake/files.d.ts.map +1 -0
- package/dist/adapters/fake/identity.d.ts +24 -0
- package/dist/adapters/fake/identity.d.ts.map +1 -0
- package/dist/adapters/fake/index.d.ts +11 -0
- package/dist/adapters/fake/index.d.ts.map +1 -0
- package/dist/adapters/fake/navigation.d.ts +3 -0
- package/dist/adapters/fake/navigation.d.ts.map +1 -0
- package/dist/adapters/fake/records.d.ts +32 -0
- package/dist/adapters/fake/records.d.ts.map +1 -0
- package/dist/adapters/files.d.ts +59 -0
- package/dist/adapters/files.d.ts.map +1 -0
- package/dist/adapters/files.docs.d.ts +3 -0
- package/dist/adapters/files.docs.d.ts.map +1 -0
- package/dist/adapters/identity.d.ts +41 -0
- package/dist/adapters/identity.d.ts.map +1 -0
- package/dist/adapters/identity.docs.d.ts +3 -0
- package/dist/adapters/identity.docs.d.ts.map +1 -0
- package/dist/adapters/index.d.ts +10 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/navigation.d.ts +11 -0
- package/dist/adapters/navigation.d.ts.map +1 -0
- package/dist/adapters/navigation.docs.d.ts +3 -0
- package/dist/adapters/navigation.docs.d.ts.map +1 -0
- package/dist/adapters/records.d.ts +99 -0
- package/dist/adapters/records.d.ts.map +1 -0
- package/dist/adapters/records.docs.d.ts +3 -0
- package/dist/adapters/records.docs.d.ts.map +1 -0
- package/dist/components/Auth/Auth.config.d.ts +33 -0
- package/dist/components/Auth/Auth.config.d.ts.map +1 -0
- package/dist/components/Auth/Auth.d.ts +146 -0
- package/dist/components/Auth/Auth.d.ts.map +1 -0
- package/dist/components/Auth/Auth.docs.d.ts +3 -0
- package/dist/components/Auth/Auth.docs.d.ts.map +1 -0
- package/dist/components/Auth/index.d.ts +6 -0
- package/dist/components/Auth/index.d.ts.map +1 -0
- package/dist/components/Chat/Chat.config.d.ts +13 -0
- package/dist/components/Chat/Chat.config.d.ts.map +1 -0
- package/dist/components/Chat/Chat.d.ts +34 -0
- package/dist/components/Chat/Chat.d.ts.map +1 -0
- package/dist/components/Chat/Chat.docs.d.ts +3 -0
- package/dist/components/Chat/Chat.docs.d.ts.map +1 -0
- package/dist/components/Chat/index.d.ts +6 -0
- package/dist/components/Chat/index.d.ts.map +1 -0
- package/dist/components/Editor/Editor.config.d.ts +21 -0
- package/dist/components/Editor/Editor.config.d.ts.map +1 -0
- package/dist/components/Editor/Editor.d.ts +46 -0
- package/dist/components/Editor/Editor.d.ts.map +1 -0
- package/dist/components/Editor/Editor.docs.d.ts +3 -0
- package/dist/components/Editor/Editor.docs.d.ts.map +1 -0
- package/dist/components/Editor/index.d.ts +6 -0
- package/dist/components/Editor/index.d.ts.map +1 -0
- package/dist/components/Editor/source.d.ts +29 -0
- package/dist/components/Editor/source.d.ts.map +1 -0
- package/dist/components/RecordForm/RecordForm.config.d.ts +52 -0
- package/dist/components/RecordForm/RecordForm.config.d.ts.map +1 -0
- package/dist/components/RecordForm/RecordForm.d.ts +96 -0
- package/dist/components/RecordForm/RecordForm.d.ts.map +1 -0
- package/dist/components/RecordForm/RecordForm.docs.d.ts +3 -0
- package/dist/components/RecordForm/RecordForm.docs.d.ts.map +1 -0
- package/dist/components/RecordForm/index.d.ts +6 -0
- package/dist/components/RecordForm/index.d.ts.map +1 -0
- package/dist/components/RecordForm/values.d.ts +26 -0
- package/dist/components/RecordForm/values.d.ts.map +1 -0
- package/dist/components/RecordList/RecordList.config.d.ts +43 -0
- package/dist/components/RecordList/RecordList.config.d.ts.map +1 -0
- package/dist/components/RecordList/RecordList.d.ts +76 -0
- package/dist/components/RecordList/RecordList.d.ts.map +1 -0
- package/dist/components/RecordList/RecordList.docs.d.ts +3 -0
- package/dist/components/RecordList/RecordList.docs.d.ts.map +1 -0
- package/dist/components/RecordList/index.d.ts +6 -0
- package/dist/components/RecordList/index.d.ts.map +1 -0
- package/dist/components/Report/Report.config.d.ts +23 -0
- package/dist/components/Report/Report.config.d.ts.map +1 -0
- package/dist/components/Report/Report.d.ts +53 -0
- package/dist/components/Report/Report.d.ts.map +1 -0
- package/dist/components/Report/Report.docs.d.ts +3 -0
- package/dist/components/Report/Report.docs.d.ts.map +1 -0
- package/dist/components/Report/index.d.ts +6 -0
- package/dist/components/Report/index.d.ts.map +1 -0
- package/dist/components/Shell/Shell.config.d.ts +13 -0
- package/dist/components/Shell/Shell.config.d.ts.map +1 -0
- package/dist/components/Shell/Shell.d.ts +35 -0
- package/dist/components/Shell/Shell.d.ts.map +1 -0
- package/dist/components/Shell/Shell.docs.d.ts +3 -0
- package/dist/components/Shell/Shell.docs.d.ts.map +1 -0
- package/dist/components/Shell/index.d.ts +6 -0
- package/dist/components/Shell/index.d.ts.map +1 -0
- package/dist/components/Timeline/Timeline.config.d.ts +48 -0
- package/dist/components/Timeline/Timeline.config.d.ts.map +1 -0
- package/dist/components/Timeline/Timeline.d.ts +62 -0
- package/dist/components/Timeline/Timeline.d.ts.map +1 -0
- package/dist/components/Timeline/Timeline.docs.d.ts +3 -0
- package/dist/components/Timeline/Timeline.docs.d.ts.map +1 -0
- package/dist/components/Timeline/index.d.ts +6 -0
- package/dist/components/Timeline/index.d.ts.map +1 -0
- package/dist/components/Upload/Upload.config.d.ts +47 -0
- package/dist/components/Upload/Upload.config.d.ts.map +1 -0
- package/dist/components/Upload/Upload.d.ts +80 -0
- package/dist/components/Upload/Upload.d.ts.map +1 -0
- package/dist/components/Upload/Upload.docs.d.ts +3 -0
- package/dist/components/Upload/Upload.docs.d.ts.map +1 -0
- package/dist/components/Upload/index.d.ts +6 -0
- package/dist/components/Upload/index.d.ts.map +1 -0
- package/dist/docs.d.ts +23 -0
- package/dist/docs.d.ts.map +1 -0
- package/dist/golem-ui.css +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5237 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/diff3.d.ts +41 -0
- package/dist/lib/diff3.d.ts.map +1 -0
- package/dist/lib/format.d.ts +19 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/locale.d.ts +13 -0
- package/dist/lib/locale.d.ts.map +1 -0
- package/dist/lib/markdown.d.ts +15 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/use-container-width.d.ts +11 -0
- package/dist/lib/use-container-width.d.ts.map +1 -0
- package/package.json +103 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tony Lâmpada
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# golem-ui
|
|
2
|
+
|
|
3
|
+
UI components with **one ABI**, built so an agent assembling a screen unattended gets it right the
|
|
4
|
+
first time. Part of [Golem](https://github.com/tonylampada/golem-ui). MIT.
|
|
5
|
+
|
|
6
|
+
**The site: https://tonylampada.github.io/golem-ui/** — the pitch, the quick start, and an index of
|
|
7
|
+
everything below it:
|
|
8
|
+
|
|
9
|
+
- **Showcase** (a demo app, for people, phone first): https://tonylampada.github.io/golem-ui/app/
|
|
10
|
+
- **API pages** (the spec, phone first, readable signed out):
|
|
11
|
+
https://tonylampada.github.io/golem-ui/app/#/api
|
|
12
|
+
- **Adapter pages** (the contract behind every `adapters` prop):
|
|
13
|
+
https://tonylampada.github.io/golem-ui/app/#/adapters
|
|
14
|
+
- **Storybook** (every example as a live story, desktop):
|
|
15
|
+
https://tonylampada.github.io/golem-ui/storybook/
|
|
16
|
+
|
|
17
|
+
## The ABI
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<Shell
|
|
21
|
+
config={{ title: 'Northgate Cycles', chatSide: 'left', breakpoint: 768, showTopBar: true }}
|
|
22
|
+
adapters={{ identity, navigation }}
|
|
23
|
+
chat={<AgentChat />}
|
|
24
|
+
canvas={<TodayScreen />}
|
|
25
|
+
/>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Every component has the same outer shape: `config` and `adapters`. No exceptions.
|
|
29
|
+
- `config` is plain JSON-serializable data — what the component _is_. A Zod schema validates it on
|
|
30
|
+
mount; unknown fields are rejected.
|
|
31
|
+
- Invalid config renders a **loud error card** naming the field and the rule, in dev and in prod.
|
|
32
|
+
- `adapters` are how the component _talks to the world_: `Records`, `Files`, `Identity`, `Chat`,
|
|
33
|
+
`Clock`, `Navigation`. A component never imports a data layer, a router or a fetch.
|
|
34
|
+
- `golem-ui` ships an in-memory fake of every adapter (`fakeIdentity()`, `fakeRecords()`, …). Stories
|
|
35
|
+
and tests run on the fakes; no backend, no network.
|
|
36
|
+
- Config is **generated** by the agent, adapters are **wired** by the app. Two failure modes, kept
|
|
37
|
+
apart.
|
|
38
|
+
- Docs are generated from the schema, so they cannot drift from the validator.
|
|
39
|
+
|
|
40
|
+
## Adapters
|
|
41
|
+
|
|
42
|
+
The adapters are the interface between a Golem app and the world, and that interface is the
|
|
43
|
+
architecture. There are six, each documented as a thing in itself — every method, what an
|
|
44
|
+
implementation has to guarantee, what it rejects with, and the in-memory fake — at
|
|
45
|
+
[`#/adapters`](https://tonylampada.github.io/golem-ui/app/#/adapters) and under `Adapters/` in
|
|
46
|
+
Storybook.
|
|
47
|
+
|
|
48
|
+
| Adapter | What it is |
|
|
49
|
+
| ------------ | --------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `Records` | Collections of JSON rows, the four writes, and the version check that keeps two writers apart |
|
|
51
|
+
| `Files` | A folder of blobs; refs are plain JSON and carry no bytes |
|
|
52
|
+
| `Identity` | Who is here, how they got here, and who else may come in |
|
|
53
|
+
| `Chat` | The conversation: history, send, and a stream that arrives token by token |
|
|
54
|
+
| `Clock` | Now and the zone to read it in, so nothing in the kit calls `new Date()` |
|
|
55
|
+
| `Navigation` | The current route, `go(path)`, and a listener — no router imported anywhere |
|
|
56
|
+
|
|
57
|
+
**One instance serves every component that takes it.** `Records` handed to a `RecordList` and to a
|
|
58
|
+
`RecordForm` is what makes a ticket saved on one screen appear on the other; `subscribe` carries it,
|
|
59
|
+
and neither component knows the other is there. The same goes for `Identity` across `Shell`, `Auth`,
|
|
60
|
+
`RecordForm` and `Timeline`, and for `Files` across `Upload` and `Timeline`.
|
|
61
|
+
|
|
62
|
+
## Adding an adapter
|
|
63
|
+
|
|
64
|
+
1. `src/adapters/<name>.ts` — the interface, one doc comment per method, and any error class it
|
|
65
|
+
throws. Keep it minimal: cut what no component calls.
|
|
66
|
+
2. `src/adapters/fake/<name>.ts` — the in-memory fake, real enough to run the failure path.
|
|
67
|
+
3. `src/adapters/<name>.docs.ts` — the page's prose as data (`purpose`, every `method` with what it
|
|
68
|
+
guarantees and what it throws, `fake`, `consumers`). Add it to `adapterDocs` in `src/docs.ts`.
|
|
69
|
+
4. `src/adapters/<Name>.mdx` — four lines: `<AdapterPage docs={...} links={storybookLinks} />`. The
|
|
70
|
+
showcase's `#/adapters/<name>` needs nothing; it reads the same list.
|
|
71
|
+
5. Export the types from `src/adapters/index.ts` and the fake from `src/adapters/fake/index.ts`.
|
|
72
|
+
|
|
73
|
+
`src/adapters/adapters.docs.test.ts` fails on an adapter with no `.docs.ts`, and on a `consumers`
|
|
74
|
+
list that disagrees with what the components say they take.
|
|
75
|
+
|
|
76
|
+
## Adding a component
|
|
77
|
+
|
|
78
|
+
1. `src/components/<X>/<X>.config.ts` — the Zod schema, one `.describe()` per field, `.strict()`.
|
|
79
|
+
2. `src/components/<X>/<X>.tsx` — a capitalised render function wrapped in `defineComponent`.
|
|
80
|
+
Adapters and slots go in interfaces beside it.
|
|
81
|
+
3. `src/components/<X>/<X>.examples.tsx` — every example as data, adapters built once at module
|
|
82
|
+
scope. This file is the single source: stories and tests both import it.
|
|
83
|
+
4. `src/components/<X>/<X>.stories.tsx` — one story per example, including an invalid-config one.
|
|
84
|
+
5. `src/components/<X>/<X>.test.tsx` — renders every example, plus the seams worth holding.
|
|
85
|
+
6. `src/components/<X>/<X>.docs.ts` — the page's prose as data (`tagline`, `purpose`, `adapters`,
|
|
86
|
+
`failureModes`, the example), and `<X>.mdx` reading it. Both the Storybook page and the API page
|
|
87
|
+
at `#/api/<x>` render that one object, so a sentence lives in one place. Copy `docs/TEMPLATE.md`
|
|
88
|
+
for the section order: it is fixed and no section is optional. Add the docs object to
|
|
89
|
+
`src/docs.ts`, and the component to `showcase/src/api-registry.tsx`.
|
|
90
|
+
7. Export it from `src/index.ts`.
|
|
91
|
+
8. Give it a place in the showcase: `showcase/README.md` names the screen it replaces, and that
|
|
92
|
+
screen is plain markup waiting for it. A component nobody can see working is not finished.
|
|
93
|
+
|
|
94
|
+
A component that needs something new from the world extends an adapter rather than importing a data
|
|
95
|
+
layer — and an adapter that gains a method gains a row on its own page in the same commit.
|
|
96
|
+
|
|
97
|
+
`pnpm lint && pnpm typecheck && pnpm test && pnpm build && pnpm build-site && pnpm build-storybook &&
|
|
98
|
+
pnpm build-showcase`
|
|
99
|
+
|
|
100
|
+
## Install
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
npm i golem-ui react react-dom
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
React 19 is a peer dependency. Import the stylesheet once, at your app's entry:
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import { Shell, fakeIdentity, fakeNavigation } from 'golem-ui'
|
|
110
|
+
import 'golem-ui/styles.css'
|
|
111
|
+
|
|
112
|
+
const adapters = {
|
|
113
|
+
identity: fakeIdentity(),
|
|
114
|
+
navigation: fakeNavigation({ path: '/today', params: {} }),
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function App() {
|
|
118
|
+
return (
|
|
119
|
+
<Shell
|
|
120
|
+
config={{ title: 'Northgate Cycles' }}
|
|
121
|
+
adapters={adapters}
|
|
122
|
+
chat={<AgentChat />}
|
|
123
|
+
canvas={<TodayScreen />}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
In a TypeScript app, the `.css` import needs the ambient declaration Vite ships: keep
|
|
130
|
+
`/// <reference types="vite/client" />` in `src/vite-env.d.ts`, as `npm create vite` writes it.
|
|
131
|
+
|
|
132
|
+
`scripts/smoke-pack.sh` runs that install end to end — it packs the kit, installs the tarball into a
|
|
133
|
+
throwaway Vite app outside the repo, and typechecks and builds it.
|
|
134
|
+
|
|
135
|
+
## Releasing
|
|
136
|
+
|
|
137
|
+
Every release after the first ships from GitHub Actions with npm [trusted
|
|
138
|
+
publishing](https://docs.npmjs.com/trusted-publishers): the workflow mints its own short-lived
|
|
139
|
+
credential from an OIDC token, so there is no `NPM_TOKEN` secret anywhere and the published tarball
|
|
140
|
+
carries provenance.
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
# bump "version" in package.json and add the entry to CHANGELOG.md, then:
|
|
144
|
+
git commit -am "Release 0.1.1"
|
|
145
|
+
git tag v0.1.1
|
|
146
|
+
git push origin main --tags
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The tag starts `.github/workflows/release.yml`, which runs lint, typecheck, tests and the build,
|
|
150
|
+
checks the tag matches `package.json`, and publishes. A tag whose version disagrees with
|
|
151
|
+
`package.json` fails before the publish step.
|
|
152
|
+
|
|
153
|
+
### The two one-time steps, for the captain
|
|
154
|
+
|
|
155
|
+
1. **Publish 0.1.0 by hand**, from a shell logged in to npm. Trusted publishing is configured per
|
|
156
|
+
package, and the package has to exist first.
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
npm login
|
|
160
|
+
pnpm build && npm publish --provenance --access public
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. **Turn on trusted publishing** at npmjs.com → the `golem-ui` package → Settings → Trusted
|
|
164
|
+
publishing → GitHub Actions, with organization/user `tonylampada`, repository `golem-ui`,
|
|
165
|
+
workflow `release.yml`, and no environment. From then on the tag is the whole release.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type FunctionComponent } from 'react';
|
|
2
|
+
import type { z, ZodType } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* The outer shape of every golem-ui component, no exceptions.
|
|
5
|
+
*
|
|
6
|
+
* `Slots` carries the ReactNode holes a component exposes, plus the per-use props that belong to
|
|
7
|
+
* the call site rather than to the config — `Auth.Guard`'s `roles` is one. Anything the agent would
|
|
8
|
+
* write once for the whole app belongs in `config`, and anything that reaches the world in
|
|
9
|
+
* `adapters`.
|
|
10
|
+
*/
|
|
11
|
+
export type GolemProps<ConfigInput, Adapters, Slots = object> = {
|
|
12
|
+
config: ConfigInput;
|
|
13
|
+
adapters: Adapters;
|
|
14
|
+
} & Slots;
|
|
15
|
+
export interface ComponentSpec<Schema extends ZodType, Adapters, Slots = object> {
|
|
16
|
+
/** Shown in the error card, so it must be the name the agent writes in JSX. */
|
|
17
|
+
name: string;
|
|
18
|
+
schema: Schema;
|
|
19
|
+
render: FunctionComponent<GolemProps<z.output<Schema>, Adapters, Slots>>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Wraps a renderer so the component validates its config before it renders anything, and shows a
|
|
23
|
+
* loud error card naming the field and the rule when validation fails.
|
|
24
|
+
*/
|
|
25
|
+
export declare function defineComponent<Schema extends ZodType, Adapters, Slots = object>(spec: ComponentSpec<Schema, Adapters, Slots>): FunctionComponent<GolemProps<z.input<Schema>, Adapters, Slots>> & {
|
|
26
|
+
schema: Schema;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=define-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-component.d.ts","sourceRoot":"","sources":["../../src/abi/define-component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAGrC;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CAAC,WAAW,EAAE,QAAQ,EAAE,KAAK,GAAG,MAAM,IAAI;IAC9D,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,EAAE,QAAQ,CAAA;CACnB,GAAG,KAAK,CAAA;AAET,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,MAAM;IAC7E,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;CACzE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,SAAS,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,MAAM,EAC9E,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,GAC3C,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAsBtF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prose a component page is made of, as data. Both consumers read this one object — the
|
|
3
|
+
* `.mdx` Storybook page and the showcase's phone-first `#/api` page — so a sentence exists once
|
|
4
|
+
* and neither surface can drift from the other.
|
|
5
|
+
*
|
|
6
|
+
* The generated parts of a page are not here: the configuration table is read off the Zod schema
|
|
7
|
+
* and the worked example is rendered from `<X>.examples.tsx`.
|
|
8
|
+
*/
|
|
9
|
+
export interface ComponentDocs {
|
|
10
|
+
/** As the component is exported and imported: `Shell`, `RecordList`. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** The path segment under `#/api/`. */
|
|
13
|
+
slug: string;
|
|
14
|
+
/** Storybook's docs id for the component, e.g. `components-shell`. */
|
|
15
|
+
storybookPath: string;
|
|
16
|
+
/** One line, for a catalogue: what this component is, with no second sentence. */
|
|
17
|
+
tagline: string;
|
|
18
|
+
/** What it is for, and when to reach for something else. Markdown. */
|
|
19
|
+
purpose: string;
|
|
20
|
+
/** Anything the schema's own `.describe()` sentences cannot carry, in the order it reads. */
|
|
21
|
+
configNotes?: DocBlock[];
|
|
22
|
+
/** One row per adapter interface. An interface absent from here is one it never touches. */
|
|
23
|
+
adapters: AdapterRow[];
|
|
24
|
+
/** Rules about the adapters that are not per-method. Markdown. */
|
|
25
|
+
adapterNotes?: string;
|
|
26
|
+
/** Only for a component that takes slots. */
|
|
27
|
+
slots?: SlotRow[];
|
|
28
|
+
/** The complete config object as copy-pasteable TSX. */
|
|
29
|
+
example: string;
|
|
30
|
+
/** A markdown bullet list, each item opening with the bold name of the failure. */
|
|
31
|
+
failureModes: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A run of prose, or a table the prose around it refers to — the field-type vocabulary, for one.
|
|
35
|
+
* Markdown carries no tables, so a table is data and each surface draws it its own way.
|
|
36
|
+
*/
|
|
37
|
+
export type DocBlock = string | {
|
|
38
|
+
table: DocTable;
|
|
39
|
+
};
|
|
40
|
+
export interface DocTable {
|
|
41
|
+
headings: string[];
|
|
42
|
+
/** One array per row, in heading order. Cells are inline markdown. */
|
|
43
|
+
rows: string[][];
|
|
44
|
+
}
|
|
45
|
+
export interface AdapterRow {
|
|
46
|
+
/** The adapter interface, as it is named in `src/adapters/`. */
|
|
47
|
+
adapter: string;
|
|
48
|
+
/** The methods the component calls on it. */
|
|
49
|
+
calls: string;
|
|
50
|
+
/** Why it calls them. */
|
|
51
|
+
why: string;
|
|
52
|
+
}
|
|
53
|
+
export interface SlotRow {
|
|
54
|
+
slot: string;
|
|
55
|
+
what: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The prose an adapter page is made of, as data — the same arrangement `ComponentDocs` has, and
|
|
59
|
+
* for the same reason: the Storybook `Adapters/<Name>` page and the showcase's phone-first
|
|
60
|
+
* `#/adapters/<name>` page both render this one object, so a sentence exists once.
|
|
61
|
+
*
|
|
62
|
+
* An adapter has no Zod schema and no examples file, so nothing on its page is generated from
|
|
63
|
+
* code except `consumers`, which a test holds to what `componentDocs` actually says.
|
|
64
|
+
*/
|
|
65
|
+
export interface AdapterDocs {
|
|
66
|
+
/** The interface, as `src/adapters/` names it: `Records`, `Files`. */
|
|
67
|
+
name: string;
|
|
68
|
+
/** The file's basename in `src/adapters/`, and the path segment under `#/adapters/`. */
|
|
69
|
+
slug: string;
|
|
70
|
+
/** Storybook's docs id for the page, e.g. `adapters-records`. */
|
|
71
|
+
storybookPath: string;
|
|
72
|
+
/** One line, for a catalogue: what this adapter is, with no second sentence. */
|
|
73
|
+
tagline: string;
|
|
74
|
+
/** What the app is being asked for, and where the line between it and the component falls. */
|
|
75
|
+
purpose: string;
|
|
76
|
+
/** Every method on the interface, in the order the interface declares them. */
|
|
77
|
+
methods: AdapterMethod[];
|
|
78
|
+
/** Guarantees that span methods — error types, ordering, what a listener is promised. Markdown. */
|
|
79
|
+
notes?: string;
|
|
80
|
+
/** The in-memory fake, and how a story or a test reaches for it. */
|
|
81
|
+
fake: AdapterFake;
|
|
82
|
+
/**
|
|
83
|
+
* Every component that takes this adapter, by name. Read off each component's own adapter list
|
|
84
|
+
* rather than written here twice; a test fails when the two disagree.
|
|
85
|
+
*/
|
|
86
|
+
consumers: string[];
|
|
87
|
+
}
|
|
88
|
+
export interface AdapterMethod {
|
|
89
|
+
/** The method as the interface declares it, parameter and return types included. */
|
|
90
|
+
signature: string;
|
|
91
|
+
/** What an implementation has to be true to. Markdown. */
|
|
92
|
+
guarantees: string;
|
|
93
|
+
/** What it rejects with, and when. Markdown. Absent on a method that cannot be refused. */
|
|
94
|
+
throws?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface AdapterFake {
|
|
97
|
+
/** The exported factory: `fakeRecords`. */
|
|
98
|
+
name: string;
|
|
99
|
+
/** What it does that a real store does, and where it stops short. Markdown. */
|
|
100
|
+
what: string;
|
|
101
|
+
/** Building it and handing it to a component, as copy-pasteable TSX. */
|
|
102
|
+
example: string;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/abi/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,sEAAsE;IACtE,aAAa,EAAE,MAAM,CAAA;IACrB,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAA;IACf,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAA;IACf,6FAA6F;IAC7F,WAAW,CAAC,EAAE,QAAQ,EAAE,CAAA;IACxB,4FAA4F;IAC5F,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;IACjB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,mFAAmF;IACnF,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAA;AAEnD,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,sEAAsE;IACtE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAA;IACf,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAA;IACZ,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAA;IACZ,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAA;IACrB,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAA;IACf,8FAA8F;IAC9F,OAAO,EAAE,MAAM,CAAA;IACf,+EAA+E;IAC/E,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oEAAoE;IACpE,IAAI,EAAE,WAAW,CAAA;IACjB;;;OAGG;IACH,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAA;IACjB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAA;IAClB,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;IACZ,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ZodError } from 'zod';
|
|
2
|
+
export interface ConfigIssue {
|
|
3
|
+
/** Dotted path of the offending field, or `(root)` for the object itself. */
|
|
4
|
+
field: string;
|
|
5
|
+
/** The rule that rejected it, in Zod's own vocabulary. */
|
|
6
|
+
rule: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function issuesFromZodError(error: ZodError): ConfigIssue[];
|
|
10
|
+
/**
|
|
11
|
+
* Rendered in place of the component whenever its config fails validation — in dev and in prod
|
|
12
|
+
* alike. A silent fallback would hide the mistake from the agent that made it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ConfigErrorCard({ component, issues, }: {
|
|
15
|
+
component: string;
|
|
16
|
+
issues: ConfigIssue[];
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=error-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-card.d.ts","sourceRoot":"","sources":["../../src/abi/error-card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAEnC,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAA;IACb,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,EAAE,CAMjE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB,+BAwBA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The vocabulary an agent picks a field's `type` from, shared by every component configured with a
|
|
4
|
+
* list of fields. The type decides how a value is rendered, what `format` means, and — on a form —
|
|
5
|
+
* which control the reader gets. It never changes what the adapter returns or what is written back.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FIELD_TYPES: readonly ["text", "number", "date", "datetime", "enum", "boolean", "money", "user"];
|
|
8
|
+
export type FieldType = (typeof FIELD_TYPES)[number];
|
|
9
|
+
/** A field as a list shows it: read-only, one column wide. */
|
|
10
|
+
export declare const listFieldSchema: z.ZodObject<{
|
|
11
|
+
primary: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
key: z.ZodString;
|
|
13
|
+
label: z.ZodString;
|
|
14
|
+
type: z.ZodEnum<{
|
|
15
|
+
number: "number";
|
|
16
|
+
boolean: "boolean";
|
|
17
|
+
text: "text";
|
|
18
|
+
date: "date";
|
|
19
|
+
datetime: "datetime";
|
|
20
|
+
enum: "enum";
|
|
21
|
+
money: "money";
|
|
22
|
+
user: "user";
|
|
23
|
+
}>;
|
|
24
|
+
format: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export declare const fieldOptionSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
label: z.ZodString;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
/** A field as a form edits it: everything above, plus what makes a control out of it. */
|
|
31
|
+
export declare const formFieldSchema: z.ZodObject<{
|
|
32
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
readOnly: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
help: z.ZodOptional<z.ZodString>;
|
|
35
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
36
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
label: z.ZodString;
|
|
39
|
+
}, z.core.$strict>>>;
|
|
40
|
+
min: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
41
|
+
max: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
42
|
+
multiline: z.ZodDefault<z.ZodBoolean>;
|
|
43
|
+
users: z.ZodDefault<z.ZodEnum<{
|
|
44
|
+
members: "members";
|
|
45
|
+
free: "free";
|
|
46
|
+
}>>;
|
|
47
|
+
key: z.ZodString;
|
|
48
|
+
label: z.ZodString;
|
|
49
|
+
type: z.ZodEnum<{
|
|
50
|
+
number: "number";
|
|
51
|
+
boolean: "boolean";
|
|
52
|
+
text: "text";
|
|
53
|
+
date: "date";
|
|
54
|
+
datetime: "datetime";
|
|
55
|
+
enum: "enum";
|
|
56
|
+
money: "money";
|
|
57
|
+
user: "user";
|
|
58
|
+
}>;
|
|
59
|
+
format: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export type ListField = z.output<typeof listFieldSchema>;
|
|
62
|
+
export type FormField = z.output<typeof formFieldSchema>;
|
|
63
|
+
export type FieldOption = z.output<typeof fieldOptionSchema>;
|
|
64
|
+
/** Whatever a records adapter hands back. `id` is the row key when there is one. */
|
|
65
|
+
export type RecordRow = Record<string, unknown>;
|
|
66
|
+
/** The part of a field that formatting reads. Both field shapes satisfy it. */
|
|
67
|
+
export interface RenderedField {
|
|
68
|
+
type: FieldType;
|
|
69
|
+
format?: string;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/abi/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,eAAO,MAAM,WAAW,qFASd,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AA4BpD,8DAA8D;AAC9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;kBAUjB,CAAA;AAEX,eAAO,MAAM,iBAAiB;;;kBAKnB,CAAA;AAEX,yFAAyF;AACzF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmDjB,CAAA;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA;AACxD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA;AACxD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE5D,oFAAoF;AACpF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE/C,+EAA+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { AdapterDocs, AdapterFake, AdapterMethod, AdapterRow, ComponentDocs, DocBlock, DocTable, SlotRow, } from './docs';
|
|
2
|
+
export { defineComponent } from './define-component';
|
|
3
|
+
export type { ComponentSpec, GolemProps } from './define-component';
|
|
4
|
+
export { ConfigErrorCard, issuesFromZodError } from './error-card';
|
|
5
|
+
export type { ConfigIssue } from './error-card';
|
|
6
|
+
export { FIELD_TYPES, fieldOptionSchema, formFieldSchema, listFieldSchema } from './fields';
|
|
7
|
+
export type { FieldOption, FieldType, FormField, ListField, RecordRow, RenderedField, } from './fields';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/abi/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,UAAU,EACV,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,OAAO,GACR,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC3F,YAAY,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,aAAa,GACd,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Unsubscribe } from './common';
|
|
2
|
+
/** A file carried by a message, or staged in the composer. Name and size only — no bytes. */
|
|
3
|
+
export interface ChatAttachment {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Bytes. Rendered on the chip as `12 KB`; omit it and the chip shows the name alone. */
|
|
7
|
+
size?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ChatMessage {
|
|
10
|
+
id: string;
|
|
11
|
+
role: 'user' | 'agent';
|
|
12
|
+
text: string;
|
|
13
|
+
at: string;
|
|
14
|
+
attachments?: ChatAttachment[];
|
|
15
|
+
/**
|
|
16
|
+
* True while the agent is still writing this message. The adapter emits the same `id` again and
|
|
17
|
+
* again with a longer `text`; the last emission of that id drops the flag, and that is `done`.
|
|
18
|
+
* An empty `text` with the flag set is the agent thinking before its first token.
|
|
19
|
+
*/
|
|
20
|
+
streaming?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ChatAdapter {
|
|
23
|
+
history(): Promise<ChatMessage[]>;
|
|
24
|
+
send(text: string, attachments?: ChatAttachment[]): Promise<void>;
|
|
25
|
+
/** Called with the whole conversation on every change, including each token of a stream. */
|
|
26
|
+
subscribe(listener: (messages: ChatMessage[]) => void): Unsubscribe;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/adapters/chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,6FAA6F;AAC7F,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,CAAC,EAAE,cAAc,EAAE,CAAA;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;IACjC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjE,4FAA4F;IAC5F,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,GAAG,WAAW,CAAA;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.docs.d.ts","sourceRoot":"","sources":["../../src/adapters/chat.docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEzC,eAAO,MAAM,eAAe,EAAE,WA0E7B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/adapters/clock.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,GAAG,IAAI,IAAI,CAAA;IACX,QAAQ,IAAI,MAAM,CAAA;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.docs.d.ts","sourceRoot":"","sources":["../../src/adapters/clock.docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEzC,eAAO,MAAM,gBAAgB,EAAE,WAgD9B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChatAdapter, ChatMessage } from '../chat';
|
|
2
|
+
export interface FakeChatOptions {
|
|
3
|
+
/** Answered in order, one per send, looping when they run out. Empty means the agent stays mute. */
|
|
4
|
+
replies?: string[];
|
|
5
|
+
/** Milliseconds between tokens. Stories want it slow enough to watch, tests want it near zero. */
|
|
6
|
+
tokenDelayMs?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The in-memory Chat adapter. `send` echoes the message, then streams the next canned reply word by
|
|
10
|
+
* word under one message id, so a component's streaming path is exercised without a backend.
|
|
11
|
+
*/
|
|
12
|
+
export declare function fakeChat(initial?: ChatMessage[], options?: FakeChatOptions): ChatAdapter;
|
|
13
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/adapters/fake/chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAkB,WAAW,EAAE,MAAM,SAAS,CAAA;AAGvE,MAAM,WAAW,eAAe;IAC9B,oGAAoG;IACpG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,kGAAkG;IAClG,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAQD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,WAAW,EAAO,EAAE,OAAO,GAAE,eAAoB,GAAG,WAAW,CAsDhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../src/adapters/fake/clock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,+FAA+F;AAC/F,wBAAgB,SAAS,CACvB,KAAK,GAAE,IAAuC,EAC9C,QAAQ,SAAQ,GACf,YAAY,CAKd"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Unsubscribe } from '../common';
|
|
2
|
+
/** Shared listener bookkeeping for the fakes; not part of the public adapter surface. */
|
|
3
|
+
export declare function createEmitter<T>(): {
|
|
4
|
+
subscribe(listener: (value: T) => void): Unsubscribe;
|
|
5
|
+
emit(value: T): void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../../src/adapters/fake/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,CAAC;wBAGP,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,WAAW;gBAIxC,CAAC;EAIhB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type FilesAdapter } from '../files';
|
|
2
|
+
/**
|
|
3
|
+
* A file already in the store when the fake is built. `content` is what `url` hands back — a data
|
|
4
|
+
* URL for a seeded image — because the fake has no bytes of its own for a file nobody uploaded.
|
|
5
|
+
*/
|
|
6
|
+
export interface FakeFileSeed {
|
|
7
|
+
id?: string;
|
|
8
|
+
folder: string;
|
|
9
|
+
name: string;
|
|
10
|
+
contentType: string;
|
|
11
|
+
/** Bytes, for the tile. Defaults to the length of `content`. */
|
|
12
|
+
size?: number;
|
|
13
|
+
content?: string;
|
|
14
|
+
caption?: string;
|
|
15
|
+
/** A full ISO datetime. Defaults to the fake's `now`. */
|
|
16
|
+
uploadedAt?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FakeFilesOptions {
|
|
19
|
+
seed?: FakeFileSeed[];
|
|
20
|
+
/**
|
|
21
|
+
* `upload` rejects any file with exactly this name, so the error path has somewhere to be seen.
|
|
22
|
+
* Everything else in the same batch still goes up.
|
|
23
|
+
*/
|
|
24
|
+
failOn?: string;
|
|
25
|
+
/** How long a fake upload takes end to end, in milliseconds. */
|
|
26
|
+
uploadMs?: number;
|
|
27
|
+
/** What stamps `uploadedAt`, so a test is not reading the wall clock. */
|
|
28
|
+
now?: () => Date;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A small stand-in picture, drawn rather than photographed: the fakes ship no image files, and a
|
|
32
|
+
* gallery with nothing in it teaches nothing. It is an SVG data URL, so it costs a few hundred
|
|
33
|
+
* bytes and needs no canvas, no network and no build step.
|
|
34
|
+
*/
|
|
35
|
+
export declare function placeholderImage(label: string, hue?: number): string;
|
|
36
|
+
/**
|
|
37
|
+
* Files in memory: blobs behind object URLs, an upload that takes about 600 ms and says how far it
|
|
38
|
+
* has got, a canvas thumbnail for anything that is a picture, and one name it always refuses so the
|
|
39
|
+
* failure has a story of its own.
|
|
40
|
+
*/
|
|
41
|
+
export declare function fakeFiles(options?: FakeFilesOptions): FilesAdapter;
|
|
42
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/adapters/fake/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,UAAU,CAAA;AAGjB;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,YAAY,EAAE,CAAA;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CACjB;AAKD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAM,GAAG,MAAM,CASjE;AAiED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,YAAY,CAiGtE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IdentityAdapter, User } from '../identity';
|
|
2
|
+
export declare const fakeUser: User;
|
|
3
|
+
export interface FakeIdentityOptions {
|
|
4
|
+
/** Who is signed in on mount. Omit and it is the first member; `null` starts the app signed out. */
|
|
5
|
+
user?: User | null;
|
|
6
|
+
/** The member table the list, invite and remove all work on. Defaults to `[fakeUser]`. */
|
|
7
|
+
members?: User[];
|
|
8
|
+
/** The one password every member accepts, so a demo can say it out loud. */
|
|
9
|
+
password?: string;
|
|
10
|
+
/** The one code `requestCode` always "sends". */
|
|
11
|
+
code?: string;
|
|
12
|
+
/** Role given to someone who signs up without an invite. */
|
|
13
|
+
defaultRole?: string;
|
|
14
|
+
/** What `invite()` prefixes the token with. The token is the last thing in the URL. */
|
|
15
|
+
inviteBase?: string;
|
|
16
|
+
/** Invites that already exist, token to role, so an example can open on a link nobody minted. */
|
|
17
|
+
invites?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The in-memory Identity adapter: a member table, a signed-in user, and invite tokens that really
|
|
21
|
+
* round-trip — `invite()` hands back a URL whose token `signUp()` accepts exactly once.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fakeIdentity(options?: FakeIdentityOptions): IdentityAdapter;
|
|
24
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/adapters/fake/identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAe,IAAI,EAAE,MAAM,aAAa,CAAA;AAGrE,eAAO,MAAM,QAAQ,EAAE,IAKtB,CAAA;AAED,MAAM,WAAW,mBAAmB;IAClC,oGAAoG;IACpG,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,IAAI,EAAE,CAAA;IAChB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,eAAe,CA+F/E"}
|