@vibes.diy/api-pkg 0.0.0-smoke-70d942c5-1774564515

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.md ADDED
@@ -0,0 +1,232 @@
1
+ The contents of this repository are Copyright (c) corresponding authors and
2
+ contributors, licensed under the `Permissive License Stack` meaning either of:
3
+
4
+ - Apache-2.0 Software License: https://www.apache.org/licenses/LICENSE-2.0
5
+ ([...4tr2kfsq](https://dweb.link/ipfs/bafkreiankqxazcae4onkp436wag2lj3ccso4nawxqkkfckd6cg4tr2kfsq))
6
+
7
+ - MIT Software License: https://opensource.org/licenses/MIT
8
+ ([...vljevcba](https://dweb.link/ipfs/bafkreiepofszg4gfe2gzuhojmksgemsub2h4uy2gewdnr35kswvljevcba))
9
+
10
+ You may not use the contents of this repository except in compliance
11
+ with one of the listed Licenses. For an extended clarification of the
12
+ intent behind the choice of Licensing please refer to
13
+ https://protocol.ai/blog/announcing-the-permissive-license-stack/
14
+
15
+ Unless required by applicable law or agreed to in writing, software
16
+ distributed under the terms listed in this notice is distributed on
17
+ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18
+ either express or implied. See each License for the specific language
19
+ governing permissions and limitations under that License.
20
+
21
+ <!--- SPDX-License-Identifier: Apache-2.0 OR MIT -->
22
+
23
+ `SPDX-License-Identifier: Apache-2.0 OR MIT`
24
+
25
+ Verbatim copies of both licenses are included below:
26
+
27
+ <details><summary>Apache-2.0 Software License</summary>
28
+
29
+ ```
30
+ Apache License
31
+ Version 2.0, January 2004
32
+ http://www.apache.org/licenses/
33
+
34
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
35
+
36
+ 1. Definitions.
37
+
38
+ "License" shall mean the terms and conditions for use, reproduction,
39
+ and distribution as defined by Sections 1 through 9 of this document.
40
+
41
+ "Licensor" shall mean the copyright owner or entity authorized by
42
+ the copyright owner that is granting the License.
43
+
44
+ "Legal Entity" shall mean the union of the acting entity and all
45
+ other entities that control, are controlled by, or are under common
46
+ control with that entity. For the purposes of this definition,
47
+ "control" means (i) the power, direct or indirect, to cause the
48
+ direction or management of such entity, whether by contract or
49
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
50
+ outstanding shares, or (iii) beneficial ownership of such entity.
51
+
52
+ "You" (or "Your") shall mean an individual or Legal Entity
53
+ exercising permissions granted by this License.
54
+
55
+ "Source" form shall mean the preferred form for making modifications,
56
+ including but not limited to software source code, documentation
57
+ source, and configuration files.
58
+
59
+ "Object" form shall mean any form resulting from mechanical
60
+ transformation or translation of a Source form, including but
61
+ not limited to compiled object code, generated documentation,
62
+ and conversions to other media types.
63
+
64
+ "Work" shall mean the work of authorship, whether in Source or
65
+ Object form, made available under the License, as indicated by a
66
+ copyright notice that is included in or attached to the work
67
+ (an example is provided in the Appendix below).
68
+
69
+ "Derivative Works" shall mean any work, whether in Source or Object
70
+ form, that is based on (or derived from) the Work and for which the
71
+ editorial revisions, annotations, elaborations, or other modifications
72
+ represent, as a whole, an original work of authorship. For the purposes
73
+ of this License, Derivative Works shall not include works that remain
74
+ separable from, or merely link (or bind by name) to the interfaces of,
75
+ the Work and Derivative Works thereof.
76
+
77
+ "Contribution" shall mean any work of authorship, including
78
+ the original version of the Work and any modifications or additions
79
+ to that Work or Derivative Works thereof, that is intentionally
80
+ submitted to Licensor for inclusion in the Work by the copyright owner
81
+ or by an individual or Legal Entity authorized to submit on behalf of
82
+ the copyright owner. For the purposes of this definition, "submitted"
83
+ means any form of electronic, verbal, or written communication sent
84
+ to the Licensor or its representatives, including but not limited to
85
+ communication on electronic mailing lists, source code control systems,
86
+ and issue tracking systems that are managed by, or on behalf of, the
87
+ Licensor for the purpose of discussing and improving the Work, but
88
+ excluding communication that is conspicuously marked or otherwise
89
+ designated in writing by the copyright owner as "Not a Contribution."
90
+
91
+ "Contributor" shall mean Licensor and any individual or Legal Entity
92
+ on behalf of whom a Contribution has been received by Licensor and
93
+ subsequently incorporated within the Work.
94
+
95
+ 2. Grant of Copyright License. Subject to the terms and conditions of
96
+ this License, each Contributor hereby grants to You a perpetual,
97
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
98
+ copyright license to reproduce, prepare Derivative Works of,
99
+ publicly display, publicly perform, sublicense, and distribute the
100
+ Work and such Derivative Works in Source or Object form.
101
+
102
+ 3. Grant of Patent License. Subject to the terms and conditions of
103
+ this License, each Contributor hereby grants to You a perpetual,
104
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
105
+ (except as stated in this section) patent license to make, have made,
106
+ use, offer to sell, sell, import, and otherwise transfer the Work,
107
+ where such license applies only to those patent claims licensable
108
+ by such Contributor that are necessarily infringed by their
109
+ Contribution(s) alone or by combination of their Contribution(s)
110
+ with the Work to which such Contribution(s) was submitted. If You
111
+ institute patent litigation against any entity (including a
112
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
113
+ or a Contribution incorporated within the Work constitutes direct
114
+ or contributory patent infringement, then any patent licenses
115
+ granted to You under this License for that Work shall terminate
116
+ as of the date such litigation is filed.
117
+
118
+ 4. Redistribution. You may reproduce and distribute copies of the
119
+ Work or Derivative Works thereof in any medium, with or without
120
+ modifications, and in Source or Object form, provided that You
121
+ meet the following conditions:
122
+
123
+ (a) You must give any other recipients of the Work or
124
+ Derivative Works a copy of this License; and
125
+
126
+ (b) You must cause any modified files to carry prominent notices
127
+ stating that You changed the files; and
128
+
129
+ (c) You must retain, in the Source form of any Derivative Works
130
+ that You distribute, all copyright, patent, trademark, and
131
+ attribution notices from the Source form of the Work,
132
+ excluding those notices that do not pertain to any part of
133
+ the Derivative Works; and
134
+
135
+ (d) If the Work includes a "NOTICE" text file as part of its
136
+ distribution, then any Derivative Works that You distribute must
137
+ include a readable copy of the attribution notices contained
138
+ within such NOTICE file, excluding those notices that do not
139
+ pertain to any part of the Derivative Works, in at least one
140
+ of the following places: within a NOTICE text file distributed
141
+ as part of the Derivative Works; within the Source form or
142
+ documentation, if provided along with the Derivative Works; or,
143
+ within a display generated by the Derivative Works, if and
144
+ wherever such third-party notices normally appear. The contents
145
+ of the NOTICE file are for informational purposes only and
146
+ do not modify the License. You may add Your own attribution
147
+ notices within Derivative Works that You distribute, alongside
148
+ or as an addendum to the NOTICE text from the Work, provided
149
+ that such additional attribution notices cannot be construed
150
+ as modifying the License.
151
+
152
+ You may add Your own copyright statement to Your modifications and
153
+ may provide additional or different license terms and conditions
154
+ for use, reproduction, or distribution of Your modifications, or
155
+ for any such Derivative Works as a whole, provided Your use,
156
+ reproduction, and distribution of the Work otherwise complies with
157
+ the conditions stated in this License.
158
+
159
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
160
+ any Contribution intentionally submitted for inclusion in the Work
161
+ by You to the Licensor shall be under the terms and conditions of
162
+ this License, without any additional terms or conditions.
163
+ Notwithstanding the above, nothing herein shall supersede or modify
164
+ the terms of any separate license agreement you may have executed
165
+ with Licensor regarding such Contributions.
166
+
167
+ 6. Trademarks. This License does not grant permission to use the trade
168
+ names, trademarks, service marks, or product names of the Licensor,
169
+ except as required for reasonable and customary use in describing the
170
+ origin of the Work and reproducing the content of the NOTICE file.
171
+
172
+ 7. Disclaimer of Warranty. Unless required by applicable law or
173
+ agreed to in writing, Licensor provides the Work (and each
174
+ Contributor provides its Contributions) on an "AS IS" BASIS,
175
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
176
+ implied, including, without limitation, any warranties or conditions
177
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
178
+ PARTICULAR PURPOSE. You are solely responsible for determining the
179
+ appropriateness of using or redistributing the Work and assume any
180
+ risks associated with Your exercise of permissions under this License.
181
+
182
+ 8. Limitation of Liability. In no event and under no legal theory,
183
+ whether in tort (including negligence), contract, or otherwise,
184
+ unless required by applicable law (such as deliberate and grossly
185
+ negligent acts) or agreed to in writing, shall any Contributor be
186
+ liable to You for damages, including any direct, indirect, special,
187
+ incidental, or consequential damages of any character arising as a
188
+ result of this License or out of the use or inability to use the
189
+ Work (including but not limited to damages for loss of goodwill,
190
+ work stoppage, computer failure or malfunction, or any and all
191
+ other commercial damages or losses), even if such Contributor
192
+ has been advised of the possibility of such damages.
193
+
194
+ 9. Accepting Warranty or Additional Liability. While redistributing
195
+ the Work or Derivative Works thereof, You may choose to offer,
196
+ and charge a fee for, acceptance of support, warranty, indemnity,
197
+ or other liability obligations and/or rights consistent with this
198
+ License. However, in accepting such obligations, You may act only
199
+ on Your own behalf and on Your sole responsibility, not on behalf
200
+ of any other Contributor, and only if You agree to indemnify,
201
+ defend, and hold each Contributor harmless for any liability
202
+ incurred by, or claims asserted against, such Contributor by reason
203
+ of your accepting any such warranty or additional liability.
204
+
205
+ END OF TERMS AND CONDITIONS
206
+ ```
207
+
208
+ </details>
209
+
210
+ <details><summary>MIT Software License</summary>
211
+
212
+ ```
213
+ Permission is hereby granted, free of charge, to any person obtaining a copy
214
+ of this software and associated documentation files (the "Software"), to deal
215
+ in the Software without restriction, including without limitation the rights
216
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
217
+ copies of the Software, and to permit persons to whom the Software is
218
+ furnished to do so, subject to the following conditions:
219
+
220
+ The above copyright notice and this permission notice shall be included in
221
+ all copies or substantial portions of the Software.
222
+
223
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
224
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
225
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
226
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
227
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
228
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
229
+ THE SOFTWARE.
230
+ ```
231
+
232
+ </details>
package/README.md ADDED
@@ -0,0 +1,539 @@
1
+ # vibes.diy API
2
+
3
+ WebSocket-based API for vibes.diy chat persistence and app deployment. Supports both HTTP POST and WebSocket connections using the same handler via the Evento event-driven framework.
4
+
5
+ ## Package Structure
6
+
7
+ ```
8
+ api/
9
+ ├── types/ @vibes.diy/api-types SHARED (client + server)
10
+ │ ├── msg-types.ts Request/response types, VibeFile, MsgBase envelope, arktype schemas
11
+ │ ├── types.ts FileSystemItem with transform support
12
+ │ └── vibes-diy-serv-ctx.ts Server context for wrapper/iframe rendering
13
+
14
+ ├── pkg/ @vibes.diy/api-pkg SHARED (client + server)
15
+ │ ├── api.ts VibesDiyApiIface interface (3 methods)
16
+ │ ├── encoder.ts Evento encoders: ReqRes, W3CWebSocket, Combined
17
+ │ ├── index.ts Re-exports
18
+ │ └── react/ React components (client only in practice)
19
+
20
+ ├── impl/ @vibes.diy/api-impl CLIENT
21
+ │ └── index.ts VibeDiyApi class (WebSocket client, WIP - no reconnection)
22
+
23
+ ├── svc/ @vibes.diy/api-svc SERVER (Cloudflare Workers)
24
+ │ ├── cf-serve.ts Cloudflare Worker entry point (HTTP + WebSocket)
25
+ │ ├── create-handler.ts Evento pipeline setup with all handlers
26
+ │ ├── check-auth.ts Auth middleware (clerk, device-id verification)
27
+ │ ├── unwrap-msg-base.ts MsgBase envelope unwrapping for validation
28
+ │ ├── api.ts VibesApiSQLCtx type + VibesFPApiParameters
29
+ │ ├── entry-point-utils.ts URL construction for deployed apps
30
+ │ │
31
+ │ ├── public/ Public API handlers (Evento handlers)
32
+ │ │ ├── ensure-app-slug-item.ts App deployment with CID-based storage
33
+ │ │ ├── ensure-chat-context.ts Chat session creation/retrieval
34
+ │ │ ├── append-chat-section.ts Message persistence with seq numbers
35
+ │ │ └── serv-entry-point.ts Serves deployed app HTML
36
+ │ │
37
+ │ ├── intern/ Internal helpers
38
+ │ │ ├── ensure-slug-binding.ts User/app slug management (random-words)
39
+ │ │ ├── ensure-storage.ts CID calculation (SHA-256 + base58btc)
40
+ │ │ ├── import-map.ts ESM import map generation (esm.sh)
41
+ │ │ ├── render-vibes.tsx HTML rendering with import map injection
42
+ │ │ └── write-apps.ts App record creation with transforms (sucrase, acorn)
43
+ │ │
44
+ │ └── sql/
45
+ │ └── vibes-diy-api-schema.ts Drizzle schema (D1)
46
+
47
+ └── tests/ @vibes.diy/api-test
48
+ └── api.test.ts
49
+ ```
50
+
51
+ ## Package Summary
52
+
53
+ | Package | Runs On | Purpose |
54
+ | ---------------------- | ------- | --------------------------------------- |
55
+ | `@vibes.diy/api-types` | Both | arktype schemas, request/response types |
56
+ | `@vibes.diy/api-pkg` | Both | Interface + encoders (shared contract) |
57
+ | `@vibes.diy/api-impl` | Client | `VibeDiyApi` WebSocket client class |
58
+ | `@vibes.diy/api-svc` | Server | Cloudflare Worker handlers, D1/Drizzle |
59
+
60
+ ## Architecture
61
+
62
+ ### Message Envelope
63
+
64
+ All requests are wrapped in a `MsgBase` envelope:
65
+
66
+ ```typescript
67
+ interface MsgBase {
68
+ tid: string; // Transaction ID for request/response correlation
69
+ src: string; // Source identifier
70
+ dst: string; // Destination identifier
71
+ ttl: number; // Time-to-live
72
+ payload: unknown; // The actual request/response
73
+ }
74
+ ```
75
+
76
+ ### Evento Pipeline
77
+
78
+ The server uses Evento (from `@adviser/cement`) for request routing. Handlers are registered in order:
79
+
80
+ 1. **CORS preflight** - Handles OPTIONS requests
81
+ 2. **servEntryPoint** - Serves deployed app HTML (hostname routing: `{appSlug}--{userSlug}.{host}/~{fsId}~/`)
82
+ 3. **Request logging** - Logs incoming POST/PUT requests, rejects other methods with 503
83
+ 4. **ensureAppSlugItem** - App deployment handler
84
+ 5. **ensureChatContext** - Chat session handler
85
+ 6. **appendChatSection** - Message persistence handler
86
+ 7. **Not-found handler** - Returns 501 for unmatched requests (semantically "Not Implemented")
87
+ 8. **Error handler** - Catches and formats errors as 500
88
+
89
+ Each handler has `validate` (arktype schema check) and `handle` (business logic) phases. Some handlers also have a `post` phase for cleanup/logging.
90
+
91
+ ## Data Flow
92
+
93
+ ```
94
+ Client (browser) Server (CF Worker)
95
+ ───────────────── ──────────────────
96
+ VibeDiyApi.ensureAppSlug() → cf-serve.ts
97
+ ↓ ↓
98
+ WebSocket.send(MsgBox<Req>) → WebSocketPair upgrade
99
+
100
+ CombinedEventoEnDecoder.encode()
101
+
102
+ Evento.trigger() with handlers
103
+
104
+ unwrapMsgBase() → extract payload
105
+
106
+ checkAuth() → verify token
107
+
108
+ handler.handle() → business logic
109
+
110
+ D1 queries (Drizzle ORM)
111
+
112
+ MsgBox<Res> ← SendResponseProvider.send()
113
+ ```
114
+
115
+ ## API Methods
116
+
117
+ ### `ensureAppSlug()`
118
+
119
+ Deploy an app with a filesystem. Process:
120
+
121
+ 1. Verify auth token (clerk/device-id)
122
+ 2. Create or retrieve user slug binding
123
+ 3. Create or retrieve app slug binding
124
+ 4. Calculate CIDs for all file contents
125
+ 5. Store assets in D1 `Assets` table
126
+ 6. Apply transforms (jsx-to-js, import map generation)
127
+ 7. Create `Apps` record with filesystem manifest
128
+ 8. Return `entryPointUrl` for iframe loading
129
+
130
+ ### `ensureChatContext()`
131
+
132
+ Create or retrieve a chat session:
133
+
134
+ 1. If `contextId` provided, verify it exists and belongs to user
135
+ 2. Otherwise, generate new contextId (12-char ID)
136
+ 3. Insert into `ChatContexts` table
137
+ 4. Return `contextId`
138
+
139
+ ### `appendChatSection()`
140
+
141
+ Add messages to a chat context:
142
+
143
+ 1. Verify context exists and belongs to user
144
+ 2. Get max `seq` for context, increment
145
+ 3. Insert into `ChatSections` with `origin` ('user' or 'llm')
146
+ 4. Blocks use `BlockMsgs | PromptMsg` types from `@vibes.diy/call-ai-v2`
147
+ 5. Return `seq` number
148
+
149
+ ## CI/CD
150
+
151
+ The API is bundled into the main vibes.diy Cloudflare Worker (not a separate deployment).
152
+
153
+ ### Workflow
154
+
155
+ `.github/workflows/vibes-diy-deploy.yaml`
156
+
157
+ **Triggers:**
158
+
159
+ - Push to `vibes.diy/**/*` paths
160
+ - Tags: `vibes-diy@*`
161
+ - Manual dispatch
162
+
163
+ ### Environments
164
+
165
+ | Trigger | Environment | Domain |
166
+ | ----------------------- | ----------- | ------------------------ |
167
+ | Tag `vibes-diy@s*` | staging | `*.dev-v2.vibesdiy.net` |
168
+ | Tag `vibes-diy@p*` | production | `*.prod-v2.vibesdiy.net` |
169
+ | Path push or other tags | dev | `*.dev-v2.vibesdiy.net` |
170
+
171
+ ### Deploy Steps
172
+
173
+ Deployment is handled by the GitHub Action (`vibes.diy/actions/deploy`). The action runs:
174
+
175
+ ```bash
176
+ pnpm run build # Build React app + bundle worker
177
+ pnpm run drizzle:d1-remote # Run D1 migrations
178
+ core-cli writeEnv | wrangler secret bulk # Push secrets
179
+ pnpm run deploy:${ENV} # wrangler deploy
180
+ ```
181
+
182
+ Do not run these manually - push a tag or merge to trigger the workflow.
183
+
184
+ ### Infrastructure
185
+
186
+ | Resource | Binding | Purpose |
187
+ | ------------- | -------- | ----------------------------- |
188
+ | D1 Database | `DB` | Chat contexts, sections, apps |
189
+ | Static Assets | `ASSETS` | React app build |
190
+
191
+ ### Server Context (VibesApiSQLCtx)
192
+
193
+ All handlers receive a shared context via `ctx.ctx.getOrThrow<VibesApiSQLCtx>("vibesApiCtx")`:
194
+
195
+ ```typescript
196
+ interface VibesApiSQLCtx {
197
+ sthis: SuperThis; // Fireproof utilities (logger, nextId, env)
198
+ db: VibesSqlite; // Drizzle DB instance
199
+ tokenApi: Record<string, FPApiToken>; // Auth verifiers by type
200
+ deviceCA: DeviceIdCAIf; // Device ID certificate authority
201
+ logger: Logger; // Structured logger
202
+ params: VibesFPApiParameters; // Service configuration
203
+ cache: CfCacheIf; // Cloudflare cache API
204
+ fetchPkgVersion(pkg): Promise<string | undefined>; // npm registry lookup
205
+ waitUntil<T>(promise): void; // CF worker lifecycle
206
+ ensureStorage(...items): Promise<Result<StorageResult[]>>; // Asset storage
207
+ }
208
+ ```
209
+
210
+ ### D1 Schema
211
+
212
+ Defined in `svc/sql/vibes-diy-api-schema.ts` using Drizzle ORM.
213
+
214
+ **Assets** - Binary content storage (could move to R2)
215
+ | Column | Type | Description |
216
+ |--------|------|-------------|
217
+ | `assetId` | text PK | CID of content |
218
+ | `content` | blob | Actual content |
219
+ | `created` | text | ISO timestamp |
220
+
221
+ **UserSlugBindings** - Maps users to their human-friendly slugs
222
+ | Column | Type | Description |
223
+ |--------|------|-------------|
224
+ | `userId` | text | User identifier |
225
+ | `userSlug` | text | Human-friendly user slug (unique) |
226
+ | `created` | text | ISO timestamp |
227
+
228
+ Primary key: `(userSlug, userId)`. Unique index on `userSlug`.
229
+
230
+ **AppSlugBindings** - Maps apps to slugs within a user's namespace
231
+ | Column | Type | Description |
232
+ |--------|------|-------------|
233
+ | `userSlug` | text FK | References UserSlugBindings.userSlug |
234
+ | `appSlug` | text | Human-friendly app slug |
235
+ | `created` | text | ISO timestamp |
236
+
237
+ Primary key: `(appSlug, userSlug)`.
238
+
239
+ **Apps** - Deployed app versions with filesystem and environment
240
+ | Column | Type | Description |
241
+ |--------|------|-------------|
242
+ | `appSlug` | text | App identifier |
243
+ | `userId` | text | Owner |
244
+ | `userSlug` | text | Owner's slug |
245
+ | `releaseSeq` | int | Incremented on each deployment |
246
+ | `fsId` | text | CID of filesystem manifest |
247
+ | `env` | json | Environment variables (VibesEnv) |
248
+ | `fileSystem` | json | Array of FileSystemItem with transforms |
249
+ | `mode` | text | 'production' or 'dev' |
250
+ | `created` | text | ISO timestamp |
251
+
252
+ Primary key: `(appSlug, userId, releaseSeq)`. Indexes on `fsId` and `created`.
253
+
254
+ **ChatContexts** - Chat session containers
255
+ | Column | Type | Description |
256
+ |--------|------|-------------|
257
+ | `contextId` | text PK | UUID v4 |
258
+ | `userId` | text | Owner |
259
+ | `created` | text | ISO timestamp |
260
+
261
+ **ChatSections** - Individual messages/blocks within a chat
262
+ | Column | Type | Description |
263
+ |--------|------|-------------|
264
+ | `contextId` | text FK | References ChatContexts.contextId |
265
+ | `seq` | int | Section sequence number (0-indexed, auto-incremented) |
266
+ | `origin` | text | 'user' or 'llm' |
267
+ | `blocks` | json | Array of BlockMsgs or PromptMsg from call-ai-v2 |
268
+ | `created` | text | ISO timestamp |
269
+
270
+ Primary key: `(seq, contextId)`.
271
+
272
+ ### Environment Variables
273
+
274
+ **Required:**
275
+ | Variable | Purpose |
276
+ |----------|---------|
277
+ | `CLOUD_SESSION_TOKEN_PUBLIC` | Public key for cloud session tokens |
278
+ | `CLERK_PUBLISHABLE_KEY` | Clerk auth verification |
279
+ | `DEVICE_ID_CA_PRIV_KEY` | Device ID certificate authority private key |
280
+ | `DEVICE_ID_CA_CERT` | Device ID certificate authority cert |
281
+ | `FP_VERSION` | Fireproof version for import maps |
282
+ | `VIBES_SVC_HOSTNAME_BASE` | Base hostname for deployed apps (e.g., `vibes.app`) |
283
+
284
+ **Optional (with defaults):**
285
+ | Variable | Default | Purpose |
286
+ |----------|---------|---------|
287
+ | `VIBES_SVC_PROTOCOL` | `https` | Protocol for deployed apps |
288
+ | `MAX_APP_SLUG_PER_USER_ID` | `10` | Max app slugs per user |
289
+ | `MAX_USER_SLUG_PER_USER_ID` | `10` | Max user slugs per user |
290
+ | `MAX_APPS_PER_USER_ID` | `50` | Max app deployments per user |
291
+
292
+ ## Message Types
293
+
294
+ ### VibeFile (for deployment)
295
+
296
+ Six variants for different content types:
297
+
298
+ | Type | Content | Use Case |
299
+ | ------------------- | ------------------------------------ | ------------------------------ |
300
+ | `code-block` | Inline string, `lang: 'jsx' \| 'js'` | JSX/JS source code |
301
+ | `code-ref` | `refId` reference | Code stored elsewhere |
302
+ | `str-asset-block` | Inline string | CSS, JSON, text files |
303
+ | `str-asset-ref` | `refId` reference | String assets stored elsewhere |
304
+ | `uint8-asset-block` | `Uint8Array` | Images, fonts, binaries |
305
+ | `uint8-asset-ref` | `refId` reference | Binary assets stored elsewhere |
306
+
307
+ All file types share base properties:
308
+
309
+ ```typescript
310
+ {
311
+ filename: string; // Must start with /, no //, /../, /./
312
+ entryPoint?: boolean; // Last one wins, marks app entry
313
+ mimetype?: string; // Derived from filename if not set
314
+ }
315
+ ```
316
+
317
+ ### FileSystemItem (stored result)
318
+
319
+ After processing, files become `FileSystemItem`:
320
+
321
+ ```typescript
322
+ {
323
+ fileName: string;
324
+ mimeType: string;
325
+ assetId: string; // CID of content
326
+ assetURI: string; // sql://Assets.assetId, s3://..., r2://...
327
+ entryPoint?: boolean;
328
+ size: number;
329
+ transform?: {
330
+ type: 'jsx-to-js' | 'imports' | 'import-map' | 'transformed';
331
+ // ... transform-specific fields
332
+ }
333
+ }
334
+ ```
335
+
336
+ ### Auth Types
337
+
338
+ ```typescript
339
+ type DashAuthType = {
340
+ type: "clerk" | "device-id";
341
+ token: string;
342
+ };
343
+ ```
344
+
345
+ Auth is verified via `tokenApi` which supports:
346
+
347
+ - **clerk** - Clerk JWT verification using `CLERK_PUB_JWT_KEY` / `CLERK_PUB_JWT_URL` env vars
348
+ - **device-id** - Device certificate verification using `DEVICE_ID_CA_*` keys
349
+
350
+ ## Client Usage
351
+
352
+ > [!WARNING]
353
+ > The client (`@vibes.diy/api-impl`) is currently a work-in-progress. While it can send requests over WebSocket, the response correlation logic (matching server responses to requests via `tid`) is not yet fully implemented. It is currently primarily used for testing with direct handler calls.
354
+
355
+ The client is currently used in tests. The main vibes.diy app doesn't use it yet - integration is in progress.
356
+
357
+ ### Creating a Client
358
+
359
+ ```typescript
360
+ import { VibeDiyApi } from "@vibes.diy/api-impl";
361
+ import { Result } from "@adviser/cement";
362
+
363
+ const api = new VibeDiyApi({
364
+ apiUrl: "wss://api.vibes.diy/v1/ws", // Default if omitted
365
+ getToken: async () => {
366
+ // Return auth token (Clerk or device-id)
367
+ return Result.Ok({ type: "clerk", token: clerkToken });
368
+ },
369
+ timeoutMs: 10000, // Default: 10s request timeout
370
+ });
371
+ ```
372
+
373
+ The client uses `KeyedResolvOnce` for connection pooling - multiple `VibeDiyApi` instances with the same `apiUrl` share a WebSocket connection. (See `impl/index.ts` for custom message routing options via the `msg` config.)
374
+
375
+ ### Deploying an App
376
+
377
+ ```typescript
378
+ const res = await api.ensureAppSlug({
379
+ mode: "dev", // 'dev' or 'production'
380
+ appSlug: "my-app", // optional, server generates 3-word slug
381
+ userSlug: "my-user", // optional, server generates 3-word slug
382
+ env: { API_KEY: "..." }, // optional, passed to app runtime
383
+ fileSystem: [
384
+ {
385
+ type: "code-block",
386
+ lang: "jsx",
387
+ filename: "/App.jsx", // Must start with /, becomes entry point
388
+ entryPoint: true,
389
+ content: "export default function App() { return <div>Hello</div>; }",
390
+ },
391
+ ],
392
+ });
393
+
394
+ if (res.isOk()) {
395
+ const { entryPointUrl, fsId, userSlug, appSlug, fileSystem } = res.Ok();
396
+ // entryPointUrl -> https://{appSlug}--{userSlug}.{hostnameBase}/~{fsId}~/
397
+ // e.g. https://my-app--my-user.vibes.app/~zABC123~/
398
+ // fsId -> CID of filesystem manifest
399
+ // fileSystem -> Array<FileSystemItem> with assetIds and transforms
400
+ }
401
+ ```
402
+
403
+ **Response includes:**
404
+
405
+ - `entryPointUrl` - URL to load in iframe (constructed from `VIBES_SVC_*` config)
406
+ - `wrapperUrl` - URL for wrapper page with auth handoff
407
+ - `fsId` - CID of the filesystem manifest
408
+ - `fileSystem` - Processed `FileSystemItem[]` with CIDs and transforms applied
409
+
410
+ ### Chat Context Management
411
+
412
+ ```typescript
413
+ // Create a new chat context (server generates contextId)
414
+ const ctx = await api.ensureChatContext({});
415
+
416
+ // Or retrieve/create with a specific contextId
417
+ const ctx = await api.ensureChatContext({ contextId: "my-context-id" });
418
+
419
+ if (ctx.isOk()) {
420
+ const { contextId } = ctx.Ok();
421
+
422
+ // Append a user message
423
+ const userRes = await api.appendChatSection({
424
+ contextId,
425
+ origin: "user", // 'user' | 'llm'
426
+ blocks: [
427
+ // BlockMsgs or PromptMsg from @vibes.diy/call-ai-v2
428
+ {
429
+ type: "prompt.txt",
430
+ streamId: "stream-1",
431
+ request: { model: "gpt-4", messages: [{ role: "user", content: "Hello" }] },
432
+ timestamp: new Date(),
433
+ },
434
+ ],
435
+ });
436
+ // userRes.Ok().seq -> 0 (first section)
437
+
438
+ // Append LLM response
439
+ const llmRes = await api.appendChatSection({
440
+ contextId,
441
+ origin: "llm",
442
+ blocks: sectionBlocks, // BlockMsgs from call-ai sections stream
443
+ });
444
+ // llmRes.Ok().seq -> 1 (second section)
445
+ }
446
+ ```
447
+
448
+ **Note:** Context ownership is enforced - you can only append to contexts created by your userId.
449
+
450
+ ### Testing
451
+
452
+ Tests use a local handler directly rather than WebSocket. See `api/tests/api.test.ts` for the full setup including:
453
+
454
+ - Creating a local D1/libsql database
455
+ - Setting up test device-id auth
456
+ - Calling the handler directly
457
+
458
+ Note: The test passes an ad-hoc `fetch` property via TypeScript structural typing, but this isn't part of the official `VibeDiyApiParam` interface. A proper `fetch` override may be added in the future.
459
+
460
+ ## Running Tests
461
+
462
+ ```bash
463
+ cd vibes.diy/api/tests
464
+ pnpm test
465
+ ```
466
+
467
+ ## Implementation Details
468
+
469
+ ### URL Structure
470
+
471
+ Deployed apps are served via hostname-based routing:
472
+
473
+ ```
474
+ https://{appSlug}--{userSlug}.{hostnameBase}/~{fsId}~/
475
+ └────────────────────┘ └──────────┘ └──────┘
476
+ hostname base domain version path
477
+ ```
478
+
479
+ Example: `https://my-app--fuzzy-purple-elephant.vibes.app/~z4PhNX7vuL~/`
480
+
481
+ The `extractHostToBindings()` function parses:
482
+
483
+ - Hostname pattern: `{appSlug}--{userSlug}.{rest}`
484
+ - Path pattern: `/~{fsId}~/` (fsId starts with `z`, 8+ chars)
485
+ - If no fsId in path, serves latest production release
486
+
487
+ ### Slug Generation
488
+
489
+ When `appSlug` or `userSlug` are not provided, the server generates 3-word slugs using the `random-words` package:
490
+
491
+ ```typescript
492
+ generate({ exactly: 1, wordsPerString: 3, separator: "-" });
493
+ // → "fuzzy-purple-elephant"
494
+ ```
495
+
496
+ Up to 5 attempts are made to find a unique slug before failing.
497
+
498
+ ### Transform Pipeline
499
+
500
+ The `write-apps.ts` module applies transforms to uploaded files:
501
+
502
+ 1. **JSX → JS** (`sucrase` with automatic JSX runtime)
503
+ - Input: `code-block` with `lang: "jsx"`
504
+ - Output: `/~~transformed~~/{cid}` with `transform: { type: "transformed", action: "jsx-to-js" }`
505
+
506
+ 2. **Import Extraction** (`acorn` parser)
507
+ - Parses all JS files for `import`/`export` statements
508
+ - Extracts bare specifiers (e.g., `react`, `@fireproof/core`)
509
+
510
+ 3. **Import Map Generation**
511
+ - Unknown packages → npm registry lookup for version → `esm.sh` URL
512
+ - Predefined mappings for React 19.2.1, Fireproof, Clerk, etc.
513
+ - Output: `/~~calculated~~/import-map.json` with `transform: { type: "import-map" }`
514
+
515
+ ### fsId Calculation
516
+
517
+ The `fsId` is a deterministic CID computed from:
518
+
519
+ ```typescript
520
+ hash(sortedFilenames + mimetypes + contentCIDs + sortedEnvJSON);
521
+ ```
522
+
523
+ Same files + same env = same fsId (enables deduplication).
524
+
525
+ ### Asset Caching
526
+
527
+ `serv-entry-point.ts` uses two-tier Cloudflare caching:
528
+
529
+ 1. **Global cache** by CID: `assetCacheUrl/{assetId}`
530
+ 2. **Path cache** by request URL
531
+
532
+ On cache miss: D1 query → populate both caches via `waitUntil()`.
533
+
534
+ ### App Eviction
535
+
536
+ When a user exceeds `MAX_APPS_PER_USER_ID`:
537
+
538
+ - Oldest `dev` mode apps are evicted first (10% of total + 1)
539
+ - `production` apps are preserved
package/api.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/api.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=api.js.map
package/api.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../jsr/api.ts"],"names":[],"mappings":""}
package/encoder.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { EventoEnDecoder, Result } from "@adviser/cement";
2
+ import { W3CWebSocketEvent } from "@vibes.diy/api-types";
3
+ export declare class ReqResEventoEnDecoder implements EventoEnDecoder<Request, string> {
4
+ encode(args: Request): Promise<Result<unknown>>;
5
+ decode(data: unknown): Promise<Result<string>>;
6
+ }
7
+ export declare class W3CWebSocketEventEventoEnDecoder implements EventoEnDecoder<W3CWebSocketEvent, string> {
8
+ readonly jsEncoder: import("@adviser/cement").JSONEnDecoder;
9
+ encode(args: W3CWebSocketEvent): Promise<Result<unknown>>;
10
+ decode(data: unknown): Promise<Result<string>>;
11
+ }
12
+ export declare class CombinedEventoEnDecoder implements EventoEnDecoder<Request | W3CWebSocketEvent, string> {
13
+ private decoders;
14
+ constructor(...decoders: EventoEnDecoder<unknown, string>[]);
15
+ encode(args: Request | W3CWebSocketEvent): Promise<Result<unknown>>;
16
+ decode(data: unknown): Promise<Result<string>>;
17
+ }
package/encoder.js ADDED
@@ -0,0 +1,59 @@
1
+ import { Result, JSONEnDecoderSingleton, top_uint8 } from "@adviser/cement";
2
+ import { w3CWebSocketEvent } from "@vibes.diy/api-types";
3
+ import { type } from "arktype";
4
+ export class ReqResEventoEnDecoder {
5
+ async encode(args) {
6
+ if (args.method === "POST" || args.method === "PUT") {
7
+ const body = (await args.json());
8
+ return Result.Ok(body);
9
+ }
10
+ return Result.Ok();
11
+ }
12
+ decode(data) {
13
+ return Promise.resolve(Result.Ok(JSON.stringify(data)));
14
+ }
15
+ }
16
+ export class W3CWebSocketEventEventoEnDecoder {
17
+ jsEncoder = JSONEnDecoderSingleton();
18
+ async encode(args) {
19
+ const arkMatch = w3CWebSocketEvent(args);
20
+ if (arkMatch instanceof type.errors) {
21
+ return Result.Ok();
22
+ }
23
+ switch (arkMatch.type) {
24
+ case "MessageEvent":
25
+ if (!arkMatch.event.data) {
26
+ return Result.Ok();
27
+ }
28
+ return this.jsEncoder.parse(await top_uint8(arkMatch.event.data));
29
+ case "CloseEvent":
30
+ case "ErrorEvent":
31
+ return Result.Ok();
32
+ default:
33
+ console.error("Unknown WS Event:", arkMatch);
34
+ return Result.Ok();
35
+ }
36
+ }
37
+ decode(data) {
38
+ return Promise.resolve(Result.Ok(JSON.stringify(data)));
39
+ }
40
+ }
41
+ export class CombinedEventoEnDecoder {
42
+ decoders;
43
+ constructor(...decoders) {
44
+ this.decoders = decoders;
45
+ }
46
+ async encode(args) {
47
+ for (const decoder of this.decoders) {
48
+ const result = await decoder.encode(args);
49
+ if (result.isOk()) {
50
+ return result;
51
+ }
52
+ }
53
+ return Result.Ok();
54
+ }
55
+ decode(data) {
56
+ return Promise.resolve(Result.Ok(JSON.stringify(data)));
57
+ }
58
+ }
59
+ //# sourceMappingURL=encoder.js.map
package/encoder.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoder.js","sourceRoot":"","sources":["../jsr/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,OAAO,qBAAqB;IAChC,KAAK,CAAC,MAAM,CAAC,IAAa;QACxB,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YACpD,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAY,CAAC;YAC5C,OAAO,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,IAAa;QAClB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF;AAED,MAAM,OAAO,gCAAgC;IAClC,SAAS,GAAG,sBAAsB,EAAE,CAAC;IAC9C,KAAK,CAAC,MAAM,CAAC,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AAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,CAAC,IAAa;QAClB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ import { Option } from "@adviser/cement";
2
+ import { VibeBindings } from "@vibes.diy/api-types";
3
+ export interface CalcEntryPointUrlParams {
4
+ hostnameBase: string;
5
+ bindings: VibeBindings;
6
+ protocol: string;
7
+ port?: string;
8
+ }
9
+ export declare function calcEntryPointUrl({ hostnameBase, protocol, bindings, port }: CalcEntryPointUrlParams): string;
10
+ export interface ExtractedHostToBindings {
11
+ url: string;
12
+ userSlug: string;
13
+ appSlug: string;
14
+ fsId?: string;
15
+ groupId?: string;
16
+ path: string;
17
+ }
18
+ export declare function extractHostToBindings({ matchURL }: {
19
+ matchURL: string;
20
+ }): Option<ExtractedHostToBindings>;
@@ -0,0 +1,39 @@
1
+ import { BuildURI, Option, URI } from "@adviser/cement";
2
+ export function calcEntryPointUrl({ hostnameBase, protocol, bindings, port }) {
3
+ const hostname = `${bindings.appSlug}--${bindings.userSlug}.${hostnameBase.replace(/^\./, "")}`;
4
+ const buri = BuildURI.from(`http://template`);
5
+ if (port && port !== "80" && port !== "443") {
6
+ buri.port(port);
7
+ }
8
+ buri.protocol(protocol).hostname(hostname);
9
+ if (bindings.fsId) {
10
+ buri.pathname(`~${bindings.fsId}~`);
11
+ }
12
+ return buri.toString();
13
+ }
14
+ export function extractHostToBindings({ matchURL }) {
15
+ const uri = URI.from(matchURL);
16
+ const match = /^([a-zA-Z0-9][a-zA-Z0-9-]*?)--([a-zA-Z0-9][a-zA-Z0-9-]+)/.exec(uri.hostname);
17
+ if (!match) {
18
+ return Option.None();
19
+ }
20
+ const appSlug = match[1].toLowerCase();
21
+ const userSlug = match[2].toLowerCase();
22
+ const restPath = uri.pathname.match(/^\/~(z[a-zA-Z0-9]{8,})~(\/.*)?$/);
23
+ if (restPath) {
24
+ return Option.Some({
25
+ url: matchURL,
26
+ appSlug,
27
+ userSlug,
28
+ fsId: restPath[1],
29
+ path: restPath[2] ?? "/",
30
+ });
31
+ }
32
+ return Option.Some({
33
+ url: matchURL,
34
+ appSlug,
35
+ userSlug,
36
+ path: uri.pathname,
37
+ });
38
+ }
39
+ //# sourceMappingURL=entry-point-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-point-utils.js","sourceRoot":"","sources":["../jsr/entry-point-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAUxD,MAAM,UAAU,iBAAiB,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAA2B;IACnG,MAAM,QAAQ,GAAG,GAAG,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,QAAQ,IAAI,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC;IAChG,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC9C,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC;AAWD,MAAM,UAAU,qBAAqB,CAAC,EAAE,QAAQ,EAAwB;IACtE,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,0DAA0D,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5F,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACvE,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,MAAM,CAAC,IAAI,CAAC;YACjB,GAAG,EAAE,QAAQ;YACb,OAAO;YACP,QAAQ;YACR,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;YACjB,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG;SACzB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;QACjB,GAAG,EAAE,QAAQ;QACb,OAAO;QACP,QAAQ;QACR,IAAI,EAAE,GAAG,CAAC,QAAQ;KACnB,CAAC,CAAC;AACL,CAAC"}
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./api.js";
2
+ export * from "./encoder.js";
3
+ export * from "./entry-point-utils.js";
4
+ export * from "./react/components/index.js";
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./api.js";
2
+ export * from "./encoder.js";
3
+ export * from "./entry-point-utils.js";
4
+ export * from "./react/components/index.js";
5
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@vibes.diy/api-pkg",
3
+ "version": "0.0.0-smoke-70d942c5-1774564515",
4
+ "type": "module",
5
+ "scripts": {
6
+ "build": "core-cli tsc"
7
+ },
8
+ "dependencies": {
9
+ "@adviser/cement": "~0.5.34",
10
+ "@fireproof/core-device-id": "~0.24.13",
11
+ "@fireproof/core-protocols-dashboard": "~0.24.13",
12
+ "@fireproof/core-runtime": "~0.24.13",
13
+ "@fireproof/core-types-base": "~0.24.13",
14
+ "@fireproof/core-types-device-id": "~0.24.13",
15
+ "@fireproof/core-types-protocols-cloud": "~0.24.13",
16
+ "@fireproof/core-types-protocols-dashboard": "~0.24.13",
17
+ "@vibes.diy/api-types": "0.0.0-smoke-70d942c5-1774564515",
18
+ "acorn": "~8.16.0",
19
+ "arktype": "~2.2.0",
20
+ "random-words": "~2.0.1",
21
+ "react": "~19.2.4",
22
+ "react-dom": "~19.2.4"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/VibesDIY/vibes.diy.git"
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ export * from "./vibes-control.js";
@@ -0,0 +1,2 @@
1
+ export * from "./vibes-control.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../jsr/react/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { VibesDiyServCtx } from "@vibes.diy/api-types";
3
+ export default function VibeControls(props: VibesDiyServCtx): React.JSX.Element;
@@ -0,0 +1,112 @@
1
+ import React from "react";
2
+ export default function VibeControls(props) {
3
+ if (props.wrapper.state === "active") {
4
+ return React.createElement(React.Fragment, null);
5
+ }
6
+ return (React.createElement(React.Fragment, null,
7
+ React.createElement("div", { "data-vibe-controls-container": true },
8
+ React.createElement("button", { "data-vibe-switch": true, "aria-label": "Toggle settings", type: "button" },
9
+ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", height: "80", viewBox: "0 0 600 300", fill: "currentColor" },
10
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", fill: "#000", d: "M293.353,298.09c-41.038,0-82.078,0.125-123.115-0.077 c-11.993-0.06-24.011-0.701-35.964-1.703c-15.871-1.331-29.73-7.937-41.948-17.946c-16.769-13.736-27.207-31.417-30.983-52.7 c-4.424-24.93,1.404-47.685,16.506-67.913c11.502-15.407,26.564-26.1,45.258-30.884c7.615-1.949,15.631-2.91,23.501-3.165 c20.08-0.652,40.179-0.853,60.271-0.879c69.503-0.094,139.007-0.106,208.51,0.02c14.765,0.026,29.583,0.097,44.28,1.313 c36.984,3.059,61.78,23.095,74.653,57.301c17.011,45.199-8.414,96.835-54.29,111.864c-7.919,2.595-16.165,3.721-24.434,3.871 c-25.614,0.467-51.234,0.742-76.853,0.867C350.282,298.197,321.817,298.09,293.353,298.09z" }),
11
+ React.createElement("path", { className: "morphing", fill: "#fff", fillRule: "evenodd", clipRule: "evenodd", d: "M165.866,285.985c-7.999-0.416-19.597-0.733-31.141-1.687 c-15.692-1.297-28.809-8.481-40.105-19.104c-12.77-12.008-20.478-26.828-22.714-44.177c-3.048-23.644,3.384-44.558,19.646-62.143 c9.174-9.92,20.248-17.25,33.444-20.363c7.786-1.837,15.944-2.399,23.973-2.828c9.988-0.535,121.023-0.666,131.021-0.371 c10.191,0.301,20.433,0.806,30.521,2.175c12.493,1.696,23.132,7.919,32.552,16.091c14.221,12.337,22.777,27.953,25.184,46.594 c2.822,21.859-2.605,41.617-16.777,58.695c-9.494,11.441-21.349,19.648-35.722,23.502c-6.656,1.785-13.724,2.278-20.647,2.77 C286.914,285.721,177.682,285.667,165.866,285.985z" }),
12
+ React.createElement("path", { className: "logo-vibes", fillRule: "evenodd", clipRule: "evenodd", d: "M135.138,229.842c-2.941-0.084-5.296-1.462-6.684-3.9 c-1.827-3.21-3.328-6.618-4.81-10.011c-3.55-8.128-7.021-16.291-10.486-24.455c-0.48-1.132-0.902-2.329-1.087-3.536 c-0.417-2.72,1.238-4.585,3.938-4.119c1.591,0.275,3.569,0.98,4.45,2.173c2.226,3.015,4.175,6.299,5.784,9.69 c2.208,4.654,3.898,9.552,6.032,14.244c0.628,1.379,2.009,2.416,3.045,3.609c0.892-1.159,2.042-2.201,2.63-3.498 c2.697-5.953,5.22-11.985,7.841-17.974c1.423-3.252,3.089-6.418,6.532-7.905c1.238-0.535,3.012-0.712,4.184-0.214 c0.81,0.344,1.377,2.126,1.385,3.271c0.009,1.458-0.479,2.997-1.059,4.371c-4.227,10.013-8.504,20.005-12.833,29.974 c-0.79,1.819-1.762,3.589-2.875,5.229C139.73,228.848,137.671,229.894,135.138,229.842z" }),
13
+ React.createElement("path", { className: "logo-vibes", fillRule: "evenodd", clipRule: "evenodd", d: "M164.636,206.263c0-6.691,0.054-13.383-0.036-20.073 c-0.024-1.851,0.716-2.67,2.449-2.81c0.274-0.022,0.549-0.054,0.823-0.076c5.488-0.445,6.091,0.105,6.091,5.562 c0,12.348,0,24.695,0,37.043c0,2.887-0.354,3.405-3.222,3.618c-1.628,0.121-3.338-0.001-4.91-0.408 c-0.593-0.153-1.265-1.408-1.278-2.171c-0.096-5.584-0.034-11.172-0.022-16.759c0.002-1.308,0-2.617,0-3.926 C164.566,206.263,164.601,206.263,164.636,206.263z" }),
14
+ React.createElement("path", { className: "logo-vibes", fillRule: "evenodd", clipRule: "evenodd", d: "M181.891,205.861c0-5.043-0.001-10.086,0-15.129 c0.001-5.046,1.679-7.539,6.606-7.695c9.292-0.294,18.653-1.051,27.888,0.707c7.614,1.449,11.523,5.954,11.902,13.446 c0.066,1.312-0.313,2.752-0.857,3.966c-1.401,3.123-1.399,6.266-0.673,9.507c0.301,1.342,0.443,2.723,0.787,4.053 c1.274,4.925-1.78,10.114-6.085,11.937c-3.111,1.318-6.561,2.327-9.909,2.497c-7.303,0.37-14.639,0.136-21.96,0.101 c-1.165-0.005-2.345-0.181-3.488-0.422c-2.657-0.56-4.162-2.962-4.197-6.801C181.854,216.639,181.891,211.25,181.891,205.861z M204.442,192.385c-2.757,0-5.514,0-8.271,0c-3.695,0-5.151,1.669-4.712,5.403c0.369,3.14,1.05,3.735,4.225,3.737 c5.024,0.004,10.05,0.109,15.07-0.014c2.028-0.05,4.167-0.27,6.04-0.98c3.182-1.207,3.639-4.256,1.008-6.455 c-1.073-0.896-2.659-1.509-4.06-1.618C210.659,192.220,207.544,192.385,204.442,192.385z M204.334,211.104c0,0.045,0,0.091,0,0.137 c-3.101,0-6.203-0.055-9.302,0.037c-0.823,0.024-2.257,0.373-2.344,0.794c-0.447,2.154-0.959,4.444-0.639,6.563 c0.276,1.822,2.447,1.451,3.882,1.441c5.989-0.042,11.98-0.118,17.961-0.385c1.416-0.063,2.859-0.79,4.176-1.441 c1.79-0.886,1.833-2.475,1.029-4.046c-1.166-2.276-3.297-3.024-5.677-3.081C210.394,211.049,207.363,211.104,204.334,211.104z" }),
15
+ React.createElement("path", { className: "logo-vibes", fillRule: "evenodd", clipRule: "evenodd", d: "M235.786,208.14c0-6.905-0.01-13.809,0.004-20.714 c0.007-3.474,0.948-4.428,4.415-3.758c6.62,1.279,13.232,2.651,19.759,4.331c1.7,0.438,3.404,1.896,4.515,3.341 c1.777,2.31,0.433,5.367-2.463,5.745c-1.86,0.243-3.819-0.138-5.717-0.368c-2.183-0.264-4.339-0.783-6.525-0.976 c-1.572-0.138-3.065,0.375-3.8,1.959c-0.76,1.638-0.319,3.329,0.942,4.34c1.619,1.296,3.522,2.327,5.447,3.128 c2.146,0.894,4.539,1.207,6.66,2.145c1.446,0.64,2.982,1.687,3.786,2.981c0.689,1.11,0.928,3.094,0.378,4.202 c-0.492,0.991-2.32,1.795-3.579,1.825c-2.238,0.052-4.483-0.652-6.741-0.832c-1.614-0.127-3.333-0.203-4.865,0.212 c-2.574,0.699-3.225,3.013-1.719,5.218c1.396,2.044,3.431,3.141,5.757,3.761c2.791,0.744,5.637,1.315,8.373,2.222 c3.19,1.058,4.791,3.496,4.801,6.723c0.011,3.365-1.759,5.021-5.138,4.424c-4.402-0.778-8.759-1.81-13.134-2.735 c-2.357-0.499-4.718-0.981-7.069-1.511c-3.263-0.737-4.132-1.805-4.141-5.154c-0.019-6.836-0.006-13.672-0.006-20.508 C235.747,208.141,235.766,208.14,235.786,208.14z" }),
16
+ React.createElement("path", { className: "logo-vibes", fillRule: "evenodd", clipRule: "evenodd", d: "M291.409,229.748c-3.621-0.394-7.838-0.587-11.94-1.379 c-3.577-0.69-6.343-2.991-8.213-6.163c-1.763-2.99-0.301-5.6,3.139-5.292c2.287,0.205,4.512,1.129,6.758,1.755 c6.281,1.751,12.643,1.892,19.053,0.951c0.667-0.098,1.31-0.416,1.941-0.686c1.502-0.644,2.55-1.682,2.581-3.415 c0.031-1.74-1.195-2.749-2.579-3.132c-2.298-0.637-4.688-1.021-7.065-1.273c-5.062-0.536-10.252-0.401-15.187-1.475 c-9.677-2.105-11.678-10.53-10.101-16.009c1.62-5.625,5.911-8.92,11.318-9.73c8.388-1.257,16.925-1.491,25.279,0.654 c3.702,0.951,6.615,3.072,7.883,6.931c0.918,2.792-0.332,4.6-3.268,4.357c-1.684-0.139-3.367-0.676-4.974-1.248 c-6.711-2.387-13.572-2.897-20.569-1.783c-1.001,0.159-2.146,0.414-2.875,1.034c-0.901,0.766-2.016,1.981-1.98,2.964 c0.041,1.128,0.995,2.733,1.991,3.206c1.81,0.857,3.925,1.279,5.948,1.441c5.152,0.41,10.356,0.296,15.479,0.905 c7.98,0.949,13.779,9.833,11.241,17.125c-1.959,5.628-6.44,8.489-12.143,9.322C299.455,229.344,295.715,229.419,291.409,229.748z" }),
17
+ React.createElement("path", { className: "logo-diy", fillRule: "evenodd", clipRule: "evenodd", d: "M388.313,210.147c0-6.356,0.034-12.713-0.023-19.069 c-0.015-1.61,0.359-2.472,2.19-2.346c2.887,0.198,5.809,0.045,8.671,0.398c4.396,0.542,8.019,4.294,8.144,8.904 c0.223,8.142,0.265,16.304-0.074,24.439c-0.248,5.945-4.552,9.662-10.491,9.831c-1.999,0.057-4.003-0.081-6.006-0.09 c-1.746-0.008-2.439-0.853-2.428-2.584C388.34,223.136,388.313,216.642,388.313,210.147z M393.418,210.324c-0.037,0-0.075,0-0.114,0 c0,4.55-0.038,9.101,0.015,13.65c0.031,2.688,0.926,3.439,3.56,3.239c3.273-0.248,5.493-2.511,5.534-6.04 c0.082-7.099,0.054-14.2-0.033-21.299c-0.041-3.268-1.739-5.241-4.87-6.092c-2.68-0.728-4.025,0.161-4.07,2.896 C393.364,201.226,393.418,205.775,393.418,210.324z" }),
18
+ React.createElement("path", { className: "logo-diy", fillRule: "evenodd", clipRule: "evenodd", d: "M440.516,210.627c0,6.281,0.007,12.563-0.004,18.844 c-0.004,2.067-0.805,3.038-2.531,3.015c-1.877-0.025-2.365-1.136-2.359-2.876c0.046-12.631,0.019-25.263,0.029-37.895 c0.002-2.592,0.525-3.205,2.419-3.148c1.856,0.057,2.479,1.03,2.466,2.803C440.484,197.788,440.515,204.208,440.516,210.627z" }),
19
+ React.createElement("path", { className: "logo-diy", fillRule: "evenodd", clipRule: "evenodd", d: "M416.875,210.721c0.068-3.305,1.849-5.306,4.727-5.309 c2.765-0.003,4.924,2.404,4.816,5.371c-0.106,2.956-2.355,5.212-5.12,5.138C418.626,215.849,416.813,213.718,416.875,210.721z" }),
20
+ React.createElement("path", { className: "logo-diy", fillRule: "evenodd", clipRule: "evenodd", d: "M449.933,210.636c0.102-3.331,1.886-5.279,4.778-5.22 c2.67,0.055,4.829,2.432,4.762,5.243c-0.073,3.021-2.404,5.36-5.242,5.261C451.606,215.829,449.84,213.657,449.933,210.636z" }),
21
+ React.createElement("path", { className: "logo-diy", fillRule: "evenodd", clipRule: "evenodd", d: "M478.079,200.8c0.674-1.566,1.121-2.53,1.506-3.519 c0.673-1.73,1.252-3.5,1.981-5.205c0.315-0.737,0.766-1.654,1.407-1.961c1.094-0.523,2.388-0.63,3.598-0.912 c0.205,1.142,0.798,2.381,0.537,3.404c-0.606,2.388-1.448,4.756-2.507,6.984c-3.981,8.389-4.352,17.254-3.78,26.282 c0.091,1.438,0.031,2.899-0.105,4.335c-0.14,1.473-0.989,2.428-2.542,2.497c-1.514,0.067-2.311-0.903-2.54-2.23 c-0.232-1.348-0.394-2.754-0.277-4.108c0.94-10.972-1.116-21.38-5.626-31.375c-0.586-1.298-0.899-2.762-1.093-4.183 c-0.233-1.712,0.825-2.592,2.379-1.843c1.164,0.561,2.345,1.55,2.973,2.657c1.078,1.897,1.712,4.043,2.568,6.07 C476.918,198.547,477.370,199.361,478.079,200.8z" }))),
22
+ React.createElement("div", { "data-vibe-panel": true, "data-panel-hidden": true },
23
+ React.createElement("div", { "data-panel-mode": "default" },
24
+ React.createElement("div", { "data-label-container": true },
25
+ React.createElement("div", { "data-label": true, "data-disappear": true },
26
+ React.createElement("span", null, "Launcher")),
27
+ React.createElement("div", { "data-button-wrapper": true },
28
+ React.createElement("button", { "data-action": "logout", "data-variant": "blue", "data-has-icon": true, type: "button" },
29
+ React.createElement("div", { "data-content-wrapper": true },
30
+ React.createElement("div", { "data-icon-container": true },
31
+ React.createElement("div", { "data-icon": true },
32
+ React.createElement("svg", { width: "45", height: "45", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
33
+ React.createElement("circle", { cx: "22", cy: "22", r: "22", fill: "var(--vibes-button-icon-bg)" }),
34
+ React.createElement("path", { d: "M21.895 25.562C23.266 25.562 24.581 25.0176 25.5506 24.048C26.5202 23.0784 27.0646 21.7635 27.0646 20.3922C27.0646 19.021 26.5202 17.7061 25.5506 16.7365C24.581 15.7669 23.266 15.2225 21.895 15.2225C20.524 15.2225 19.2089 15.7669 18.2393 16.7365C17.2697 17.7061 16.7253 19.021 16.7253 20.3922C16.7253 21.7635 17.2697 23.0784 18.2393 24.048C19.2089 25.0176 20.524 25.562 21.895 25.562ZM30.1624 31.7676C30.1624 33.8395 30.1624 33.8395 21.895 33.8395C13.6277 33.8395 13.6277 33.8395 13.6277 31.7676C13.6277 29.1817 17.3309 27.078 21.895 27.078C26.4591 27.078 30.1624 29.1817 30.1624 31.7676Z", fill: "var(--vibes-button-icon-fill)" })))),
35
+ React.createElement("span", null, "Logout"))),
36
+ React.createElement("button", { "data-action": "remix", "data-variant": "red", "data-has-icon": true, type: "button" },
37
+ React.createElement("div", { "data-content-wrapper": true },
38
+ React.createElement("div", { "data-icon-container": true },
39
+ React.createElement("div", { "data-icon": true },
40
+ React.createElement("svg", { width: "45", height: "45", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
41
+ React.createElement("circle", { cx: "22", cy: "22", r: "22", fill: "var(--vibes-button-icon-bg)" }),
42
+ React.createElement("path", { d: "M27.3889 13.2222L30.7778 16.6111M30.7778 16.6111L27.3889 20M30.7778 16.6111H18.5556C17.6558 16.6111 16.7929 16.9686 16.1552 17.6063C15.5175 18.244 15.1601 19.1069 15.1601 20.0067V21.7044M16.6111 30.7778L13.2222 27.3889M13.2222 27.3889L16.6111 24M13.2222 27.3889L25.4445 27.3889C26.3442 27.3889 27.2071 27.0314 27.8448 26.3937C28.4825 25.756 28.84 24.8931 28.84 23.9933L28.84 22.2956", stroke: "var(--vibes-button-icon-fill)", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" })))),
43
+ React.createElement("span", null, "Remix"))),
44
+ React.createElement("button", { "data-action": "invite", "data-variant": "yellow", "data-has-icon": true, type: "button" },
45
+ React.createElement("div", { "data-content-wrapper": true },
46
+ React.createElement("div", { "data-icon-container": true },
47
+ React.createElement("div", { "data-icon": true },
48
+ React.createElement("svg", { width: "45", height: "45", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
49
+ React.createElement("circle", { cx: "22", cy: "22", r: "22", fill: "var(--vibes-button-icon-bg)" }),
50
+ React.createElement("path", { d: "M19.1262 23.3156C20.2853 23.3156 21.3969 22.8551 22.2166 22.0354C23.0362 21.2157 23.4967 20.1041 23.4967 18.9451C23.4967 17.786 23.0362 16.6744 22.2166 15.8547C21.3969 15.0351 20.2853 14.5745 19.1262 14.5745C17.9672 14.5745 16.8556 15.0351 16.0359 15.8547C15.2162 16.6744 14.7557 17.786 14.7557 18.9451C14.7557 20.1041 15.2162 21.2157 16.0359 22.0354C16.8556 22.8551 17.9672 23.3156 19.1262 23.3156ZM26.1148 23.3156C26.9589 23.3156 27.7685 22.9804 28.3651 22.3838C28.9617 21.7872 29.2968 20.9776 29.2968 20.1335C29.2968 19.2895 28.9617 18.4799 28.3651 17.8832C27.7685 17.2866 26.9589 16.9515 26.1148 16.9515M11.9328 30.3042C11.9328 27.3327 15.1575 24.9222 19.1262 24.9222C23.095 24.9222 26.3197 27.3327 26.3197 30.3042M29.2968 25.7255C31.2891 26.2717 32.8082 27.7629 32.8082 29.5009", stroke: "var(--vibes-button-icon-fill)", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })))),
51
+ React.createElement("span", null, "Invite"))),
52
+ React.createElement("button", { "data-action": "home", "data-variant": "gray", "data-has-icon": true, type: "button" },
53
+ React.createElement("div", { "data-content-wrapper": true },
54
+ React.createElement("div", { "data-icon-container": true },
55
+ React.createElement("div", { "data-icon": true },
56
+ React.createElement("svg", { width: "45", height: "45", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
57
+ React.createElement("circle", { cx: "22", cy: "22", r: "22", fill: "var(--vibes-button-icon-bg)" }),
58
+ React.createElement("path", { d: "M22.6107 12.5279C22.4369 12.3756 22.2139 12.2915 21.9831 12.2915C21.7523 12.2915 21.5293 12.3756 21.3555 12.5279L12.3887 20.3792C12.2947 20.4616 12.2189 20.563 12.166 20.6768C12.1131 20.7906 12.0843 20.9143 12.0815 21.0399C12.0787 21.1655 12.1019 21.2904 12.1497 21.4064C12.1974 21.5224 12.2686 21.627 12.3588 21.7135C12.449 21.8 12.5564 21.8666 12.6743 21.9093C12.7922 21.9521 12.9179 21.9699 13.0432 21.9618C13.1686 21.9537 13.2909 21.9197 13.4024 21.862C13.5138 21.8043 13.612 21.7242 13.6905 21.6266L14.0788 21.2869V29.6111C14.0788 29.9844 14.2271 30.3424 14.4911 30.6064C14.7551 30.8704 15.1131 31.0186 15.4863 31.0186H18.6527C18.9065 31.0186 19.1499 30.9178 19.3294 30.7382C19.509 30.5587 19.6098 30.3152 19.6098 30.0615V25.8379C19.6098 25.5842 19.7106 25.3408 19.8901 25.1612C20.0697 24.9817 20.3131 24.8809 20.5669 24.8809H23.3992C23.6529 24.8809 23.8964 24.9817 24.0759 25.1612C24.2555 25.3408 24.3563 25.5842 24.3563 25.8379V30.0615C24.3563 30.3152 24.4571 30.5587 24.6366 30.7382C24.8162 30.9178 25.0596 31.0186 25.3133 31.0186H28.4798C28.8531 31.0186 29.211 30.8704 29.4751 30.6064C29.7391 30.3424 29.8873 29.9844 29.8873 29.6111V21.2869L30.2756 21.6266C30.4406 21.7631 30.6507 21.8305 30.8631 21.8155C31.0755 21.8004 31.2737 21.7041 31.4177 21.5459C31.5616 21.3877 31.6397 21.1803 31.6356 20.9674C31.6315 20.7545 31.5455 20.5503 31.3954 20.3978L22.6107 12.5279Z", fill: "var(--vibes-button-icon-fill)" })))),
59
+ React.createElement("span", null, "Home")))))),
60
+ React.createElement("div", { "data-panel-mode": "mutate", "data-mode-hidden": true },
61
+ React.createElement("div", { "data-label-container": true },
62
+ React.createElement("div", { "data-label": true, "data-disappear": true },
63
+ React.createElement("span", null, "Remix")),
64
+ React.createElement("div", { "data-button-wrapper": true },
65
+ React.createElement("button", { "data-action": "fresh-start", "data-variant": "blue", "data-has-icon": true, type: "button" },
66
+ React.createElement("div", { "data-content-wrapper": true },
67
+ React.createElement("div", { "data-icon-container": true },
68
+ React.createElement("div", { "data-icon": true },
69
+ React.createElement("svg", { width: "45", height: "45", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
70
+ React.createElement("circle", { cx: "22", cy: "22", r: "22", fill: "var(--vibes-button-icon-bg)" }),
71
+ React.createElement("path", { d: "M27.3889 13.2222L30.7778 16.6111M30.7778 16.6111L27.3889 20M30.7778 16.6111H18.5556C17.6558 16.6111 16.7929 16.9686 16.1552 17.6063C15.5175 18.244 15.1601 19.1069 15.1601 20.0067V21.7044M16.6111 30.7778L13.2222 27.3889M13.2222 27.3889L16.6111 24M13.2222 27.3889L25.4445 27.3889C26.3442 27.3889 27.2071 27.0314 27.8448 26.3937C28.4825 25.756 28.84 24.8931 28.84 23.9933L28.84 22.2956", stroke: "var(--vibes-button-icon-fill)", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" })))),
72
+ React.createElement("span", null, "Fresh Start"))),
73
+ React.createElement("button", { "data-action": "remix-code", "data-variant": "red", "data-has-icon": true, type: "button" },
74
+ React.createElement("div", { "data-content-wrapper": true },
75
+ React.createElement("div", { "data-icon-container": true },
76
+ React.createElement("div", { "data-icon": true },
77
+ React.createElement("svg", { width: "45", height: "45", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
78
+ React.createElement("circle", { cx: "22", cy: "22", r: "22", fill: "var(--vibes-button-icon-bg)" }),
79
+ React.createElement("path", { d: "M27.3889 13.2222L30.7778 16.6111M30.7778 16.6111L27.3889 20M30.7778 16.6111H18.5556C17.6558 16.6111 16.7929 16.9686 16.1552 17.6063C15.5175 18.244 15.1601 19.1069 15.1601 20.0067V21.7044M16.6111 30.7778L13.2222 27.3889M13.2222 27.3889L16.6111 24M13.2222 27.3889L25.4445 27.3889C26.3442 27.3889 27.2071 27.0314 27.8448 26.3937C28.4825 25.756 28.84 24.8931 28.84 23.9933L28.84 22.2956", stroke: "var(--vibes-button-icon-fill)", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" })))),
80
+ React.createElement("span", null, "Remix Code"))),
81
+ React.createElement("button", { "data-action": "back", "data-variant": "yellow", "data-has-icon": true, type: "button" },
82
+ React.createElement("div", { "data-content-wrapper": true },
83
+ React.createElement("div", { "data-icon-container": true },
84
+ React.createElement("div", { "data-icon": true },
85
+ React.createElement("svg", { width: "45", height: "45", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
86
+ React.createElement("circle", { cx: "22", cy: "22", r: "22", fill: "var(--vibes-button-icon-bg)" }),
87
+ React.createElement("path", { d: "M25.5 14L17.5 22L25.5 30", stroke: "var(--vibes-button-icon-fill)", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })))),
88
+ React.createElement("span", null, "Back")))))),
89
+ React.createElement("div", { "data-panel-mode": "invite", "data-mode-hidden": true },
90
+ React.createElement("div", { "data-label-container": true, "data-label-yellow": true },
91
+ React.createElement("div", { "data-label": true, "data-disappear": true },
92
+ React.createElement("span", null, "Invite")),
93
+ React.createElement("div", { "data-button-wrapper": true },
94
+ React.createElement("form", { "data-invite-form": true, action: "/invite", method: "GET" },
95
+ React.createElement("input", { type: "hidden", name: "db", id: "vibe-db", value: "" }),
96
+ React.createElement("input", { type: "hidden", name: "vibe", id: "vibe-vibe", value: "" }),
97
+ React.createElement("input", { type: "hidden", name: "group", id: "vibe-group", value: "" }),
98
+ React.createElement("label", { htmlFor: "vibe-invite-email" }, "Invite by email"),
99
+ React.createElement("input", { id: "vibe-invite-email", type: "email", name: "email", placeholder: "friend@example.com", autoComplete: "email", required: true }),
100
+ React.createElement("button", { type: "submit", "data-variant": "blue" }, "Send Invite")),
101
+ React.createElement("div", { "data-invite-status": true, style: { display: "none" } }),
102
+ React.createElement("button", { "data-action": "back", "data-variant": "yellow", "data-has-icon": true, type: "button" },
103
+ React.createElement("div", { "data-content-wrapper": true },
104
+ React.createElement("div", { "data-icon-container": true },
105
+ React.createElement("div", { "data-icon": true },
106
+ React.createElement("svg", { width: "45", height: "45", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
107
+ React.createElement("circle", { cx: "22", cy: "22", r: "22", fill: "var(--vibes-button-icon-bg)" }),
108
+ React.createElement("path", { d: "M25.5 14L17.5 22L25.5 30", stroke: "var(--vibes-button-icon-fill)", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" })))),
109
+ React.createElement("span", null, "Back")))))))),
110
+ React.createElement("script", { type: "module", src: "/dist/vibes.diy/pkg/serve/vibes-controls/scripts.js" })));
111
+ }
112
+ //# sourceMappingURL=vibes-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vibes-control.js","sourceRoot":"","sources":["../../../jsr/react/components/vibes-control.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAsB;IACzD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,yCAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL;QACE;YAEE,wEAAoC,iBAAiB,EAAC,IAAI,EAAC,QAAQ;gBACjE,6BAAK,KAAK,EAAC,4BAA4B,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,aAAa,EAAC,IAAI,EAAC,cAAc;oBAE3F,8BACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,IAAI,EAAC,MAAM,EACX,CAAC,EAAC,+mBAA+mB,GACjnB;oBAKF,8BACE,SAAS,EAAC,UAAU,EACpB,IAAI,EAAC,MAAM,EACX,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,qlBAAqlB,GACvlB;oBAGF,8BACE,SAAS,EAAC,YAAY,EACtB,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,srBAAsrB,GACxrB;oBAGF,8BACE,SAAS,EAAC,YAAY,EACtB,QAAQ,EAAC,SAAS,EAClB,QAAQ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,EAAC,IAAI,EAAC,OAAO,EAAC,EAAE,EAAC,YAAY,EAAC,KAAK,EAAC,EAAE,GAAG;gCAE7D,+BAAO,OAAO,EAAC,mBAAmB,sBAAwB;gCAC1D,+BACE,EAAE,EAAC,mBAAmB,EACtB,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,OAAO,EACZ,WAAW,EAAC,oBAAoB,EAChC,YAAY,EAAC,OAAO,EACpB,QAAQ,SACR;gCACF,gCAAQ,IAAI,EAAC,QAAQ,kBAAc,MAAM,kBAEhC,CACJ;4BAEP,yDAAwB,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAE5C;4BAGN,+CAAoB,MAAM,kBAAc,QAAQ,yBAAe,IAAI,EAAC,QAAQ;gCAC1E;oCACE;wCACE;4CACE,6BAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,4BAA4B;gDAC5F,gCAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,EAAC,IAAI,EAAC,6BAA6B,GAAG;gDACpE,8BACE,CAAC,EAAC,0BAA0B,EAC5B,MAAM,EAAC,+BAA+B,EACtC,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACtB,CACE,CACF,CACF;oCACN,yCAAiB,CACb,CACC,CACL,CACF,CACF,CACF,CACF;QAKN,gCAAQ,IAAI,EAAC,QAAQ,EAAC,GAAG,EAAC,qDAAqD,GAAG,CACjF,CACJ,CAAC;AACJ,CAAC"}
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": [
3
+ "/Users/menabe/Software/fproof/vibes.diy-main/tsconfig.dist.json"
4
+ ],
5
+ "compilerOptions": {
6
+ "outDir": "../npm/",
7
+ "noEmit": false
8
+ },
9
+ "include": [
10
+ "**/*"
11
+ ],
12
+ "exclude": [
13
+ "node_modules",
14
+ "dist",
15
+ ".git",
16
+ ".vscode"
17
+ ]
18
+ }