@vibes.diy/prompts 14.3.337 → 14.3.338
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/llms/access.md +79 -4
- package/llms/backend.js +2 -2
- package/llms/backend.md +93 -0
- package/llms/stripe-subscriptions.md +29 -7
- package/llms/stripe.md +49 -11
- package/package.json +5 -5
- package/system-prompt-initial-oneshot.md +2 -2
- package/system-prompt-initial.md +2 -2
- package/system-prompt.md +1 -1
package/llms/access.md
CHANGED
|
@@ -208,7 +208,7 @@ The effective access state is the union of every current document's `AccessDescr
|
|
|
208
208
|
|
|
209
209
|
### `allowAnonymous`
|
|
210
210
|
|
|
211
|
-
If `user` is `null` and the function returns without throwing, the runtime checks `allowAnonymous`. If absent or `false`, the write is rejected. This prevents a function that never inspects `user` from silently opening anonymous writes. When `user` is not null, `allowAnonymous` has no effect. `grant.public` makes
|
|
211
|
+
If `user` is `null` and the function returns without throwing, the runtime checks `allowAnonymous`. If absent or `false`, the write is rejected. This prevents a function that never inspects `user` from silently opening anonymous writes. When `user` is not null, `allowAnonymous` has no effect. `grant.public` makes a channel readable by everyone who can open the app, with no channel grant: on an app published open that is everyone with the link, signed out included. A channel meant for signed-in members is the one a `member` record grants. Anonymous _write_ requires `allowAnonymous: true` separately. Declaring it is how the app asks for signed-out writes: when the app is published open and isn't sensitive, the platform turns the deployment's owner-visible anonymous-writes setting on from your literal `allowAnonymous: true`, and the owner can switch it off any time. Write the literal `true` where the app takes signed-out writes.
|
|
212
212
|
|
|
213
213
|
### Choosing channels — keep the count low
|
|
214
214
|
|
|
@@ -561,6 +561,81 @@ Every item a visitor creates lands on their own `user:<handle>` channel, private
|
|
|
561
561
|
|
|
562
562
|
A privacy-sensitive domain on its own (a journal, a health tracker) gets the two controls from _Two controls_ above, off until the person says so — its buddy picker is this same add-a-friend control. **Every app that is neither privacy-sensitive nor an only-me ask ships with a sharing path already in it: either an always-on shared channel its records land on, a publish control, or an add-a-friend control on its first screen**, so what a person makes has a way to reach someone from the first build.
|
|
563
563
|
|
|
564
|
+
**A record a visitor sends the owner is an inbox record — an order, a booking, a message, feedback, a delivery request, a greeting written for someone. It routes to the owner's channel and the sender's own channel**: the owner, and the staff the owner names with a role, read every one; each sender reads what they sent; the next visitor sees only their own. An open app keeps the same split, because the wall a visitor reads and the inbox the owner reads are two record types, and only the wall's channel is `grant.public`. A signed-out sender (a contact form, an order without an account) writes with `allowAnonymous: true` to the owner's channel alone. **A public record carries only what everyone may read, and the private half goes on a sibling record in the owner's channel**: a part's name and price on the public catalog record, its supplier link and unit cost on a `partCost` record beside it; a booked slot's time on the public calendar, and the booker's handle, name and phone on the `booking` in the owner's inbox. Contact details (an email, a phone, a street address), costs and suppliers, and the handle or name of the person a record is about all ride that private sibling. The screen says where each record goes, in the app's words: "Only the bakery reads your message" beside the send button, "Your orders" over the sender's own list.
|
|
565
|
+
|
|
566
|
+
**A community for signed-in members reads on a members' channel.** A `grant.public` channel reaches everyone with the link once the app is open, signed out included, so the members' channel is what keeps a community's rooms with the people signed into it. Rooms and posts route to a channel the `member` record grants: a signed-in visitor taps Join and writes their own `member` record, which grants them the community's channel, or the owner writes each one when the owner picks who belongs. The room list belongs to the community too: each room's name and topic sits on the same members' channel as its posts. Signed-out visitors meet the sign-in invitation and the community's description, written in the app's code rather than read from a record. The rooms open to everyone with the link when the owner asks for that, and only then.
|
|
567
|
+
|
|
568
|
+
### `access.js`
|
|
569
|
+
```js partial
|
|
570
|
+
export function community(doc, oldDoc, user, ctx) {
|
|
571
|
+
if (oldDoc && oldDoc.type !== doc.type) throw { forbidden: "a record keeps its type" };
|
|
572
|
+
if (!user?.userHandle) throw { forbidden: "sign in to join" };
|
|
573
|
+
const me = user.userHandle;
|
|
574
|
+
|
|
575
|
+
if (doc.type === "member") {
|
|
576
|
+
// Join: a signed-in person's own member record lets them into the community's channel.
|
|
577
|
+
if (oldDoc && oldDoc.userHandle !== me) throw { forbidden: "your own membership only" };
|
|
578
|
+
if (doc.userHandle !== me) throw { forbidden: "join as yourself" };
|
|
579
|
+
return { channels: ["members:" + me], grant: { users: { [me]: ["community", "members:" + me] } } };
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if (doc.type === "room" || doc.type === "post") {
|
|
583
|
+
// Members read and write the rooms; signed-out visitors see the sign-in invitation.
|
|
584
|
+
ctx.requireAccess("community");
|
|
585
|
+
if (doc.authorHandle !== me) throw { forbidden: "not author" };
|
|
586
|
+
if (oldDoc && oldDoc.authorHandle !== me) throw { forbidden: "not author" };
|
|
587
|
+
return { channels: ["community"] };
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
throw { forbidden: "unknown document type" };
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// Summary: a signed-in person joins with their own member record, and every member reads and writes the community's rooms and posts, each person editing only their own. A member record names its person in userHandle; rooms and posts carry their writer in authorHandle.
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
**Worked example — an inbox beside a public catalog (orders, feedback, bookings, deliveries).** The menu is public; what each item costs the shop is the owner's; every order goes to the shop and to the person who placed it. Staff are a role the owner hands out, as in the cookie shop below.
|
|
597
|
+
|
|
598
|
+
### `access.js`
|
|
599
|
+
```js partial
|
|
600
|
+
export function bakery(doc, oldDoc, user, ctx) {
|
|
601
|
+
if (oldDoc && oldDoc.type !== doc.type) throw { forbidden: "a record keeps its type" };
|
|
602
|
+
|
|
603
|
+
if (doc.type === "roleGrant") {
|
|
604
|
+
ctx.requireRole("owner");
|
|
605
|
+
if (doc.role !== "staff") throw { forbidden: "unknown role" };
|
|
606
|
+
return { channels: ["admin:roles"], members: { staff: [doc.userHandle] }, grant: { roles: { owner: ["admin:roles"] } } };
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
if (doc.type === "item") {
|
|
610
|
+
// The public half: what every visitor reads on the menu.
|
|
611
|
+
ctx.requireRole("staff");
|
|
612
|
+
return { channels: ["menu"], grant: { public: ["menu"] } };
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (doc.type === "itemCost") {
|
|
616
|
+
// The private half of the same item: its supplier link and unit cost, beside it in the shop's channel.
|
|
617
|
+
ctx.requireRole("staff");
|
|
618
|
+
return { channels: ["shop:costs"], grant: { roles: { owner: ["shop:costs"], staff: ["shop:costs"] } } };
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
if (doc.type === "order") {
|
|
622
|
+
// An inbox record: the shop reads every order, and each sender reads their own.
|
|
623
|
+
if (oldDoc) throw { forbidden: "an order stays as it was sent" };
|
|
624
|
+
const shop = { owner: ["inbox"], staff: ["inbox"] };
|
|
625
|
+
if (!user) return { channels: ["inbox"], grant: { roles: shop }, allowAnonymous: true };
|
|
626
|
+
if (doc.senderHandle !== user.userHandle) throw { forbidden: "send as yourself" };
|
|
627
|
+
const sent = "sent:" + user.userHandle;
|
|
628
|
+
return { channels: ["inbox", sent], grant: { roles: shop, users: { [user.userHandle]: [sent] } } };
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
throw { forbidden: "unknown document type" };
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// Summary: everyone reads the menu and staff change it, each item's supplier and cost are read by the shop alone, and every order goes to the shop and to the person who placed it, signed in or not. An order carries its sender's handle in senderHandle; a role grant names its member in userHandle.
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
The order form saves `{ type: "order", senderHandle: me?.userHandle, name, email, items }`, its contact fields on the order itself, because the order lives in the inbox. The menu reads `item` records, the staff screen reads `order` and `itemCost` records, and a signed-in sender's "Your orders" list reads the `order` records their own channel returns.
|
|
638
|
+
|
|
564
639
|
**Worked example — a cast everyone can meet: shared characters, private chats (a character chat, a creature gallery, a songbook).** Sharing is the baseline, so an app where people make things ships a way to see them on its first build, even when the ask names nobody else and the invite screen waits for an option. Here every character lands on one always-on public channel, so every visitor meets the whole cast with no step at all, and each maker edits only their own. A one-tap publish per character (the sketches shape above) is an equally good answer; this example shows the always-on one. Each chat, the thread and the story so far, is private to the person having it. Letting a friend join a chat is an option the app can offer later, as a membership on that chat. The app's code holds no notion of an owner. The canned characters the ask starts with are a fixed set of documents in `seed.json`, seeded where everyone reads them, and the app writes no copy of them for each visitor. Adding the seed is the owner's choice, so the app works without it: until then the cast opens empty, inviting the first person to make a character. The screen says who can see the cast ("Anyone with the link can meet the cast") beside a copy-link.
|
|
565
640
|
|
|
566
641
|
### `access.js`
|
|
@@ -1615,7 +1690,7 @@ export function survey(doc, oldDoc, user, ctx) {
|
|
|
1615
1690
|
// Summary: anyone, signed in or not, submits responses that stay as written; the owner names each feedback team member with a team-member record, and the team reads the responses and publishes the final results for everyone. A team-member record names its person in memberHandle.
|
|
1616
1691
|
```
|
|
1617
1692
|
|
|
1618
|
-
Key patterns: `allowAnonymous: true` on survey-response lets unauthenticated visitors submit, `grant.public` on final-results makes them readable by
|
|
1693
|
+
Key patterns: `allowAnonymous: true` on survey-response lets unauthenticated visitors submit, `grant.public` on final-results makes them readable by everyone who can open the app, the **singleton grant doc** pattern (survey-config) wires role-to-channel access in one place, and each **team-member** record the owner writes puts one person in that role through `members` — so the team the config lets in has people in it, and removing the record lets that person go.
|
|
1619
1694
|
|
|
1620
1695
|
App.jsx — anonymous-friendly submit form, owner-only config panel, role-gated results view:
|
|
1621
1696
|
|
|
@@ -1662,9 +1737,9 @@ App.jsx — anonymous-friendly submit form, owner-only config panel, role-gated
|
|
|
1662
1737
|
>>>>>>> REPLACE
|
|
1663
1738
|
```
|
|
1664
1739
|
|
|
1665
|
-
### Example: Public guestbook
|
|
1740
|
+
### Example: Public guestbook (anonymous writes)
|
|
1666
1741
|
|
|
1667
|
-
When the prompt says **anyone can sign / submit without logging in** (a guestbook, a contact form, an RSVP), do **not** throw on `!user` — return `allowAnonymous: true` so the write is accepted for anonymous visitors. `useVibe().can.create(...)` then returns `ok` for an anonymous viewer, and the form shows instead of a sign-in wall. Stamp `authorHandle` only when there is a user.
|
|
1742
|
+
When the prompt says **anyone can sign / submit without logging in** (a guestbook, a contact form, an RSVP), do **not** throw on `!user` — return `allowAnonymous: true` so the write is accepted for anonymous visitors. `useVibe().can.create(...)` then returns `ok` for an anonymous viewer, and the form shows instead of a sign-in wall. Stamp `authorHandle` only when there is a user. A guestbook entry is made for everyone to read, so it lands on the public channel below; a contact form's message is an inbox record, so it lands on the owner's channel as the inbox example shows, with the same `allowAnonymous: true`.
|
|
1668
1743
|
|
|
1669
1744
|
### `access.js`
|
|
1670
1745
|
```js partial
|
package/llms/backend.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const backendConfig = {
|
|
2
2
|
name: "backend",
|
|
3
3
|
label: "backend-js",
|
|
4
|
-
description: "server-side backend.js file: answer HTTP/webhook requests at the app's /_api URL, react to committed data changes, and run scheduled jobs — its writes go through the app's own access rules; reads a web page, feed or API the person names and hands it to the page through /_api; emails, notifies and reminds people through ctx.notify by handle — a weekly digest, a summary for the owner, a Monday email to the manager — and invites a recipient who is not in the app yet; sends a record to a tool the person names (Slack, Google Sheets, a CRM, Zapier) through a Zapier Catch Hook the owner connects; and takes records in from Zapier — a Google Forms response, a new sheet row, an email — at its /_api URL, checked against a shared secret, including the person's own Gmail: a Zap they filter forwards only the mail they choose, which is how an app reads receipts or newsletters from an inbox",
|
|
4
|
+
description: "server-side backend.js file: answer HTTP/webhook requests at the app's /_api URL, react to committed data changes, and run scheduled jobs — its writes go through the app's own access rules; reads a web page, feed or API the person names and hands it to the page through /_api; emails, notifies and reminds people through ctx.notify by handle — a weekly digest, a summary for the owner, a Monday email to the manager — and invites a recipient who is not in the app yet; texts the app's followers, takes their replies into a replies database, and runs a first-to-reply-gets-it offer as a claims database the texted #claim=<id> link points at; sends a record to a tool the person names (Slack, Google Sheets, a CRM, Zapier) through a Zapier Catch Hook the owner connects; and takes records in from Zapier — a Google Forms response, a new sheet row, an email — at its /_api URL, checked against a shared secret, including the person's own Gmail: a Zap they filter forwards only the mail they choose, which is how an app reads receipts or newsletters from an inbox",
|
|
5
5
|
universal: "edits",
|
|
6
|
-
cues: ["email", "notify", "remind", "digest", "zapier", "catch hook", "webhook", "slack", "sheets", "crm", "google forms", "gmail", "inbox"],
|
|
6
|
+
cues: ["email", "notify", "remind", "digest", "zapier", "catch hook", "webhook", "slack", "sheets", "crm", "google forms", "gmail", "inbox", "followers", "first to reply", "dibs"],
|
|
7
7
|
};
|
package/llms/backend.md
CHANGED
|
@@ -36,6 +36,14 @@ A reminder that recurs at a wall-clock time — "every morning at 9", "each
|
|
|
36
36
|
Friday" — is a `scheduled` handler; `onChange` answers a write that just
|
|
37
37
|
happened.
|
|
38
38
|
|
|
39
|
+
Followers who hear from the app by text and answer back are this file's work
|
|
40
|
+
too. "Followers hear about…", "text me when…" is a notify to each
|
|
41
|
+
`subscriber`; "they can reply", "send a photo back" is a `replies` database;
|
|
42
|
+
and "the first one to reply gets it", "whoever texts back first", "last one
|
|
43
|
+
left", "dibs" is a claim-once offer: a `claims` database whose access function
|
|
44
|
+
lets the first claim stand, offered by a notify whose `path` is
|
|
45
|
+
`#claim=<id>` (see *A claim-once offer* below).
|
|
46
|
+
|
|
39
47
|
An app can need more than one — a payments app wants `fetch` (webhook receipt)
|
|
40
48
|
**and** `onChange` (email on the new order). If none of these signal words fit
|
|
41
49
|
the request, the app needs no `backend.js` — don't emit one.
|
|
@@ -775,6 +783,13 @@ const budget = await ctx.youtube.status(); // { available, unitsLeftToday, daily
|
|
|
775
783
|
first, and its `forbidden` reason is what it hears. Vibes texts the winner
|
|
776
784
|
"It's yours!" and everyone after "That one's already taken".
|
|
777
785
|
|
|
786
|
+
The claim has a home of its own: the `claims` database, with its own
|
|
787
|
+
`claims` function in `access.js`, beside whatever database holds the loaves
|
|
788
|
+
or seats themselves. Vibes reads a follower's "mine" as a claim when the
|
|
789
|
+
vibe exports that `claims` function and the text they answer was sent with
|
|
790
|
+
`path: "#claim=<id>"`, so the offer's notify names the claim id in its path
|
|
791
|
+
every time. The app's other screens read `claims` to show what is taken.
|
|
792
|
+
|
|
778
793
|
```js
|
|
779
794
|
// access.js — the first claim stands; its claimer may re-save it, nobody else may.
|
|
780
795
|
export function claims(doc, oldDoc, user, ctx) {
|
|
@@ -1114,6 +1129,84 @@ signed in.
|
|
|
1114
1129
|
Writes a handler makes with `ctx.db.put` still pass through `access.js` as the
|
|
1115
1130
|
caller, so the app's rules hold for API writes too.
|
|
1116
1131
|
|
|
1132
|
+
### A route knows who is calling from `ctx.userInfo`
|
|
1133
|
+
|
|
1134
|
+
Identity comes only from `ctx.userInfo`.
|
|
1135
|
+
A route that acts for a person reads who they are there, the one place the
|
|
1136
|
+
platform verified, and compares that handle with the record it guards. The
|
|
1137
|
+
query, the body and the app's own headers carry what the caller chose to send,
|
|
1138
|
+
so they name the thing being asked about: the crew, the list, the item. A field
|
|
1139
|
+
on a stored record names a person when the backend wrote it from
|
|
1140
|
+
`ctx.userInfo`, or when `access.js` checked it equals the writer
|
|
1141
|
+
(`doc.ownerHandle !== user.userHandle` throws).
|
|
1142
|
+
|
|
1143
|
+
A record read to authorize is checked against every field the decision relies on.
|
|
1144
|
+
A member record answers "may this person act on this crew" when it belongs to
|
|
1145
|
+
both: key it by the two, `member:<crewId>:<userHandle>`, read it with the id
|
|
1146
|
+
built from the crew the route serves and `ctx.userInfo`, and compare its
|
|
1147
|
+
`crewId`, its `userHandle` and its `role` before the route acts:
|
|
1148
|
+
|
|
1149
|
+
### `backend.js`
|
|
1150
|
+
```js partial
|
|
1151
|
+
const me = ctx.userInfo?.userHandle;
|
|
1152
|
+
if (!me) return json({ ok: false, reason: "sign in" }, 401);
|
|
1153
|
+
const crewId = String(body.crewId ?? "");
|
|
1154
|
+
const member = await ctx.db.get(`member:${crewId}:${me}`, { db: "crew" });
|
|
1155
|
+
if (member?.crewId !== crewId || member.userHandle !== me || member.role !== "manager") {
|
|
1156
|
+
return json({ ok: false, reason: "managers of this crew only" }, 403);
|
|
1157
|
+
}
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
A feed token is minted by a signed-in route, so the token record names its minter.
|
|
1161
|
+
A calendar app fetches a private `.ics` feed with no sign-in, so the token in
|
|
1162
|
+
the link is how the feed knows whose records to serve. The page asks a route
|
|
1163
|
+
for a link through `apiFetch`; the route draws the token from
|
|
1164
|
+
`crypto.getRandomValues`, saves `{ type: "feedToken", ownerHandle: me }` at
|
|
1165
|
+
`feedToken:<token>`, and `access.js` lets only the route write that type
|
|
1166
|
+
(`ctx.requireBackend("fetch")` on it). The feed route then reads the token
|
|
1167
|
+
record by id and serves the records whose `ownerHandle` it names. Pair it with
|
|
1168
|
+
`config.fetch.unfilteredReads` (above), and give each record an `ownerHandle`
|
|
1169
|
+
that `access.js` checks equals the writer, so the feed's query by that field
|
|
1170
|
+
returns that person's records and theirs alone:
|
|
1171
|
+
|
|
1172
|
+
### `backend.js`
|
|
1173
|
+
```js partial
|
|
1174
|
+
if (url.pathname === "/feed-token" && request.method === "POST") {
|
|
1175
|
+
const me = ctx.userInfo?.userHandle;
|
|
1176
|
+
if (!me) return json({ ok: false, reason: "sign in to make a feed link" }, 401);
|
|
1177
|
+
const bytes = crypto.getRandomValues(new Uint8Array(24));
|
|
1178
|
+
const token = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
1179
|
+
await ctx.db.put({ type: "feedToken", ownerHandle: me }, { db: "planner", id: "feedToken:" + token });
|
|
1180
|
+
return json({ ok: true, token });
|
|
1181
|
+
}
|
|
1182
|
+
if (url.pathname === "/feed.ics") {
|
|
1183
|
+
const token = url.searchParams.get("t") ?? "";
|
|
1184
|
+
const grant = token ? await ctx.db.get("feedToken:" + token, { db: "planner" }) : null;
|
|
1185
|
+
if (grant?.type !== "feedToken") return new Response("not found", { status: 404 });
|
|
1186
|
+
const rows = await ctx.db.query({ db: "planner", field: "ownerHandle", key: grant.ownerHandle, limit: 200 });
|
|
1187
|
+
return new Response(toIcs(rows), { headers: { "content-type": "text/calendar" } });
|
|
1188
|
+
}
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
OAuth state ties the user who starts the flow to the user who finishes it.
|
|
1192
|
+
A visitor's own account on another service is a connection first (the
|
|
1193
|
+
`connections` skill), and the platform holds that flow end to end. A flow the
|
|
1194
|
+
app runs itself starts in a route the page calls through `apiFetch`: it saves
|
|
1195
|
+
`{ type: "oauthState", startedBy: me }` under a `crypto.randomUUID()` state and
|
|
1196
|
+
sends the person to the provider with it. The provider's redirect lands on the
|
|
1197
|
+
app's page, which hands the `code` and `state` to a finish route, again through
|
|
1198
|
+
`apiFetch` so the handler runs as the signed-in person. The finish route reads
|
|
1199
|
+
`oauthState:<state>`, carries on when its `startedBy` equals
|
|
1200
|
+
`ctx.userInfo.userHandle`, deletes the state so it is used once, exchanges the
|
|
1201
|
+
code and stores the token under that same handle.
|
|
1202
|
+
|
|
1203
|
+
A route that spends the owner's key or deletes a record checks who is calling first.
|
|
1204
|
+
A route that calls a paid service with `ctx.secrets`, or removes a record,
|
|
1205
|
+
opens with the guard that says who may: the owner
|
|
1206
|
+
(`ctx.userInfo?.userHandle === ctx.appInfo.ownerHandle`), the signed-in person
|
|
1207
|
+
whose record it is, or a sender proving a shared secret (the Zapier recipe
|
|
1208
|
+
below).
|
|
1209
|
+
|
|
1117
1210
|
### Records in from Zapier — a Zap that POSTs to `/_api`
|
|
1118
1211
|
|
|
1119
1212
|
A Zap brings records into the app by POSTing to its `/_api` route.
|
|
@@ -141,6 +141,16 @@ memberships end when the app goes live. The owner's Go-live step reads
|
|
|
141
141
|
`liveReady`) to name the next button. The `stripe` skill's *Test mode first*
|
|
142
142
|
section is the same rule in more words.
|
|
143
143
|
|
|
144
|
+
When ctx.stripe.status() reads disconnected for the mode the app charges in, the page shows no Join button and one friendly line in the owner's voice, such as "Payments are paused right now. Check back soon.", while everything else in the app keeps working.
|
|
145
|
+
|
|
146
|
+
`/setup` hands everyone `paused: true` with that state, so the page knows on
|
|
147
|
+
its first render. Members keep reading what their membership already opened,
|
|
148
|
+
and each member's own record and history stay readable from the app's own
|
|
149
|
+
records; the Stripe portal button steps aside with Join until the account is
|
|
150
|
+
back. The owner's Setup item names **Connect Stripe again**, and Join returns
|
|
151
|
+
on its own once the account reads `ready`. A press that meets
|
|
152
|
+
`account_disconnected` shows the same paused line and re-reads `/setup`.
|
|
153
|
+
|
|
144
154
|
## 2. Stripe stays on the server, and so does Stripe.js
|
|
145
155
|
|
|
146
156
|
Every Stripe request is made in backend.js with ctx.stripe.fetch(path, { method, body, headers, mode }); App.jsx never calls api.stripe.com and never loads Stripe.js.
|
|
@@ -310,8 +320,11 @@ A scheduled sweep refreshes every live subscription from Stripe, so a failed ren
|
|
|
310
320
|
`entitled`, and writes the document when anything changed — including when
|
|
311
321
|
nothing at Stripe changed but the grace period ran out. A pending membership
|
|
312
322
|
whose session was never completed is settled the same way as the one-time
|
|
313
|
-
recipe's orders: expired after a day.
|
|
314
|
-
|
|
323
|
+
recipe's orders: expired after a day. One whose session can no longer be read
|
|
324
|
+
because the owner's account went away is never expired from that refusal (the
|
|
325
|
+
member may have paid before it went): it stays pending and unentitled, and
|
|
326
|
+
the first sweep after the owner reconnects binds it to what Stripe says. The
|
|
327
|
+
work is bounded by the number of members.
|
|
315
328
|
|
|
316
329
|
Why not a webhook: a webhook write arrives with no identity and would need
|
|
317
330
|
`allowAnonymous` on the one record that grants access. Reading the
|
|
@@ -508,6 +521,8 @@ async function settlePending(ctx, m, appMode) {
|
|
|
508
521
|
return m;
|
|
509
522
|
}
|
|
510
523
|
const session = await stripe(ctx, m.mode, "GET", `/checkout/sessions/${m.sessionId}`);
|
|
524
|
+
// A refusal changes nothing, an unreadable account included: the member may have paid before it
|
|
525
|
+
// went away, so the record waits, unentitled, and the first read after the owner reconnects binds it.
|
|
511
526
|
if (!session.ok) return m;
|
|
512
527
|
const s = session.body;
|
|
513
528
|
if (s.id !== m.sessionId || s.client_reference_id !== m._id) {
|
|
@@ -556,10 +571,12 @@ export async function fetch(request, ctx) {
|
|
|
556
571
|
const items = [connect, { id: "stripe-portal", label: "Customer portal", ...(await portalSaved(ctx, owner, mode, open)) }];
|
|
557
572
|
const ready = items.every((item) => item.done);
|
|
558
573
|
// `mode` is everyone's: the Join button wears a Test mode badge while the app takes test payments.
|
|
559
|
-
|
|
574
|
+
// `paused` is everyone's too: a disconnected account shows a calm paused line, never a Join button.
|
|
575
|
+
const paused = state === "disconnected";
|
|
576
|
+
if (!owner) return json({ ok: true, ready, owner, mode, paused });
|
|
560
577
|
// The Go-live step: `liveOpen` (vibes.diy takes live payments) and `liveReady` (the owner's live
|
|
561
578
|
// Stripe account is ready, so this app can be taken live).
|
|
562
|
-
return json({ ok: true, ready, owner, mode, liveOpen, liveReady, items, graceDays: GRACE_DAYS, ownerHandle: ctx.appInfo.ownerHandle, appSlug: ctx.appInfo.appSlug });
|
|
579
|
+
return json({ ok: true, ready, owner, mode, paused, liveOpen, liveReady, items, graceDays: GRACE_DAYS, ownerHandle: ctx.appInfo.ownerHandle, appSlug: ctx.appInfo.appSlug });
|
|
563
580
|
}
|
|
564
581
|
|
|
565
582
|
// The owner takes this app live: one document, written for the owner alone, once their live
|
|
@@ -791,7 +808,7 @@ const per = (plan) => `${money(plan.amount, plan.currency)} a ${plan.interval}`;
|
|
|
791
808
|
// connects Stripe or saves the portal in another tab and returns, and the Join buttons unlock
|
|
792
809
|
// without a reload.
|
|
793
810
|
function useSetup() {
|
|
794
|
-
const [setup, setSetup] = useState(null); // { ready, owner, mode, liveOpen?, items?, graceDays?, ownerHandle?, appSlug? }
|
|
811
|
+
const [setup, setSetup] = useState(null); // { ready, owner, mode, paused, liveOpen?, items?, graceDays?, ownerHandle?, appSlug? }
|
|
795
812
|
const latest = useRef(0);
|
|
796
813
|
useEffect(() => {
|
|
797
814
|
// Mount, focus and visibility reads overlap; only the latest one may land, or a slow stale
|
|
@@ -810,6 +827,9 @@ function useSetup() {
|
|
|
810
827
|
return setup;
|
|
811
828
|
}
|
|
812
829
|
|
|
830
|
+
// The paused line, in the owner's voice: a disconnected Stripe account shows this where Join was.
|
|
831
|
+
const PAUSED = "Payments are paused right now. Check back soon.";
|
|
832
|
+
|
|
813
833
|
// The button the Settings tab shows for each state of the owner's Stripe account, in its own words.
|
|
814
834
|
const STRIPE_BUTTON = { absent: "Connect Stripe", onboarding: "Finish Stripe setup", disconnected: "Connect Stripe again" };
|
|
815
835
|
|
|
@@ -985,8 +1005,10 @@ export default function App() {
|
|
|
985
1005
|
: data.reason === "already-member" ? "You already have a membership — manage it below."
|
|
986
1006
|
: data.reason === "mode-changed" ? `Memberships here just moved to ${data.mode} mode. Refresh the page and press Join again.`
|
|
987
1007
|
: data.reason === "unknown-plan" ? "That plan is no longer offered."
|
|
1008
|
+
: data.reason === "account_disconnected" ? PAUSED
|
|
988
1009
|
: "Memberships are not open yet."
|
|
989
1010
|
);
|
|
1011
|
+
if (data.reason === "account_disconnected") window.dispatchEvent(new Event("setup-changed")); // re-read: Join steps aside
|
|
990
1012
|
return;
|
|
991
1013
|
}
|
|
992
1014
|
tab.location.href = data.url;
|
|
@@ -1067,13 +1089,13 @@ export default function App() {
|
|
|
1067
1089
|
))}
|
|
1068
1090
|
</Stack>
|
|
1069
1091
|
) : offered.length > 0 ? (
|
|
1070
|
-
<Text muted>Memberships are not open yet
|
|
1092
|
+
<Text muted>{setup?.paused ? PAUSED : "Memberships are not open yet."}</Text>
|
|
1071
1093
|
) : null}
|
|
1072
1094
|
</Stack>
|
|
1073
1095
|
)}
|
|
1074
1096
|
{/* The portal is reachable whenever Stripe knows this member, entitled or not: a lapsed
|
|
1075
1097
|
member needs it most, to update the card or to cancel. */}
|
|
1076
|
-
{mine?.customerId && (
|
|
1098
|
+
{mine?.customerId && !setup?.paused && (
|
|
1077
1099
|
<Button variant="quiet" onClick={() => openStripe("/portal", {})} disabled={busy} loading={busy}>
|
|
1078
1100
|
Manage membership — Stripe opens in a new tab
|
|
1079
1101
|
</Button>
|
package/llms/stripe.md
CHANGED
|
@@ -144,7 +144,8 @@ for where the button is, and **Connect Stripe** and **Payments** in so many
|
|
|
144
144
|
words. "The Settings page" is a direction to search for, and a person who has
|
|
145
145
|
never seen it has to go looking. In the consumer flow, a Pay button whose item
|
|
146
146
|
is not done reads *Checkout is not open yet*; the owner's Setup entry is where
|
|
147
|
-
the steps are.
|
|
147
|
+
the steps are. A Stripe account that reads `disconnected` is the paused state,
|
|
148
|
+
and its page is a finished one (§ 5).
|
|
148
149
|
|
|
149
150
|
The owner pastes nothing: the platform holds the credential and attaches it
|
|
150
151
|
to every call, and the backend names only which of the owner's two accounts —
|
|
@@ -347,7 +348,12 @@ order now settled from this same session is the answer it gives.
|
|
|
347
348
|
each one's session back, and settles it the same way. A Checkout Session
|
|
348
349
|
expires on its own after 24 hours, so the sweep's work is bounded by orders
|
|
349
350
|
made in the last day, and an order older than that with no session is marked
|
|
350
|
-
`expired` rather than read forever.
|
|
351
|
+
`expired` rather than read forever. One whose session can no longer be read
|
|
352
|
+
because the owner's Stripe account went away (`account_disconnected`) is
|
|
353
|
+
never written from that refusal, since the buyer may have paid before it
|
|
354
|
+
went: it stays `pending`, the owner's Orders list shows it *not completed*
|
|
355
|
+
once its day is out, and the first sweep after the owner reconnects settles
|
|
356
|
+
it to what Stripe says. A paid order never moves.
|
|
351
357
|
|
|
352
358
|
Why not a Stripe webhook: a webhook arrives with no identity, and a write with
|
|
353
359
|
no identity has to be opened to every anonymous visitor to be accepted — the
|
|
@@ -383,6 +389,18 @@ When an order settles as paid, backend.js tells the owner with ctx.notify — to
|
|
|
383
389
|
has been paid. This is the app's own ledger; it is also in the Stripe
|
|
384
390
|
dashboard, and the two agree because the app only ever copies Stripe's
|
|
385
391
|
answer.
|
|
392
|
+
- Payments pause when the owner's Stripe account disconnects, and the page
|
|
393
|
+
stays a finished page.
|
|
394
|
+
|
|
395
|
+
When ctx.stripe.status() reads disconnected for the mode the app charges in, the page shows no Pay button and one friendly line in the owner's voice, such as "Payments are paused right now. Check back soon.", while everything else in the app keeps working.
|
|
396
|
+
|
|
397
|
+
`/setup` hands everyone `paused: true` with that state, so the page knows
|
|
398
|
+
on its first render, before anyone presses anything. Paid orders, receipts,
|
|
399
|
+
history and the rest of the app read from the app's own records and carry
|
|
400
|
+
on as they are; the owner's Setup item names **Connect Stripe again**, and
|
|
401
|
+
Pay comes back on its own once the account reads `ready`. A press that
|
|
402
|
+
meets `account_disconnected` (the account went between the page loading and
|
|
403
|
+
the press) shows the same paused line and re-reads `/setup`.
|
|
386
404
|
- A paid order unlocks whatever it was for in the app's own terms — the member
|
|
387
405
|
shows as *dues paid* on the roster, the booking shows as *deposit received*,
|
|
388
406
|
the ticket shows as *going* — read off the order's `status`, never off the
|
|
@@ -525,7 +543,9 @@ async function settle(ctx, order) {
|
|
|
525
543
|
return order;
|
|
526
544
|
}
|
|
527
545
|
const session = await stripe(ctx, order.mode, "GET", `/checkout/sessions/${order.sessionId}`);
|
|
528
|
-
|
|
546
|
+
// A refusal settles nothing, an unreadable account included: the buyer may have paid before it
|
|
547
|
+
// went away, so the order stays pending and the first read after the owner reconnects settles it.
|
|
548
|
+
if (!session.ok) return order;
|
|
529
549
|
const s = session.body;
|
|
530
550
|
// The session must be THIS order's: Stripe's copy of the order id, amount and currency,
|
|
531
551
|
// never the document's own claim about which session it holds.
|
|
@@ -570,10 +590,12 @@ export async function fetch(request, ctx) {
|
|
|
570
590
|
const items = [item];
|
|
571
591
|
const ready = items.every((i) => i.done);
|
|
572
592
|
// `mode` is everyone's: the Pay button wears a Test mode badge while the app takes test payments.
|
|
573
|
-
|
|
593
|
+
// `paused` is everyone's too: a disconnected account shows a calm paused line, never a Pay button.
|
|
594
|
+
const paused = state === "disconnected";
|
|
595
|
+
if (!owner) return json({ ok: true, ready, owner, mode, paused });
|
|
574
596
|
// The Go-live step: `liveOpen` (vibes.diy takes live payments) and `liveReady` (the owner's live
|
|
575
597
|
// Stripe account is ready, so this app can be taken live).
|
|
576
|
-
return json({ ok: true, ready, owner, mode, liveOpen, liveReady, items, ownerHandle: ctx.appInfo.ownerHandle, appSlug: ctx.appInfo.appSlug });
|
|
598
|
+
return json({ ok: true, ready, owner, mode, paused, liveOpen, liveReady, items, ownerHandle: ctx.appInfo.ownerHandle, appSlug: ctx.appInfo.appSlug });
|
|
577
599
|
}
|
|
578
600
|
|
|
579
601
|
// The owner takes this app live: one document, written for the owner alone, once their live
|
|
@@ -745,11 +767,15 @@ const money = (amount, currency) => new Intl.NumberFormat(undefined, { style: "c
|
|
|
745
767
|
const toMinor = (text, currency) => Math.round(Number(text) * 10 ** digits(currency));
|
|
746
768
|
const shown = (amount, currency) => (amount / 10 ** digits(currency)).toFixed(digits(currency));
|
|
747
769
|
const CURRENCY = "usd"; // the currency new products are priced in
|
|
770
|
+
// A Checkout Session lasts a day. A pending order older than that is one Stripe could not be asked
|
|
771
|
+
// about (the owner's account went away): it reads not completed until a sweep can settle it.
|
|
772
|
+
const SESSION_TTL_MS = 24 * 60 * 60 * 1000;
|
|
773
|
+
const notCompleted = (o) => o.status === "expired" || (o.status === "pending" && Date.now() - o.createdAt > SESSION_TTL_MS);
|
|
748
774
|
|
|
749
775
|
// The setup verdict, read on mount and again whenever the app comes back into view: the owner
|
|
750
776
|
// connects Stripe in another tab and returns, and the Pay buttons unlock without a reload.
|
|
751
777
|
function useSetup() {
|
|
752
|
-
const [setup, setSetup] = useState(null); // { ready, owner, mode, liveOpen?, items?, ownerHandle?, appSlug? }
|
|
778
|
+
const [setup, setSetup] = useState(null); // { ready, owner, mode, paused, liveOpen?, items?, ownerHandle?, appSlug? }
|
|
753
779
|
const latest = useRef(0);
|
|
754
780
|
useEffect(() => {
|
|
755
781
|
// Mount, focus and visibility reads overlap; only the latest one may land, or a slow stale
|
|
@@ -768,6 +794,9 @@ function useSetup() {
|
|
|
768
794
|
return setup;
|
|
769
795
|
}
|
|
770
796
|
|
|
797
|
+
// The paused line, in the owner's voice: a disconnected Stripe account shows this where Pay was.
|
|
798
|
+
const PAUSED = "Payments are paused right now. Check back soon.";
|
|
799
|
+
|
|
771
800
|
// The button the Settings tab shows for each state of the owner's Stripe account, in its own words.
|
|
772
801
|
const STRIPE_BUTTON = { absent: "Connect Stripe", onboarding: "Finish Stripe setup", disconnected: "Connect Stripe again" };
|
|
773
802
|
|
|
@@ -949,8 +978,10 @@ export default function App() {
|
|
|
949
978
|
data.reason === "stripe" ? data.message
|
|
950
979
|
: data.reason === "mode-changed" ? `Payments here just moved to ${data.mode} mode. Refresh the page and press Pay again.`
|
|
951
980
|
: data.reason === "unknown-item" ? "Something in your order is no longer for sale. Refresh and try again."
|
|
981
|
+
: data.reason === "account_disconnected" ? PAUSED
|
|
952
982
|
: "Checkout is not open yet."
|
|
953
983
|
);
|
|
984
|
+
if (data.reason === "account_disconnected") window.dispatchEvent(new Event("setup-changed")); // re-read: Pay steps aside
|
|
954
985
|
return;
|
|
955
986
|
}
|
|
956
987
|
tab.location.href = data.url;
|
|
@@ -990,7 +1021,7 @@ export default function App() {
|
|
|
990
1021
|
) : (
|
|
991
1022
|
<ul>
|
|
992
1023
|
{orders.map((o) => (
|
|
993
|
-
<li key={o._id}>{o.buyerHandle ? `@${o.buyerHandle}` : "Guest"} · {o.title} · {money(o.amount, o.currency)} · {o.status}{o.mode === setup.mode ? "" : ` · ${o.mode} rehearsal`}</li>
|
|
1024
|
+
<li key={o._id}>{o.buyerHandle ? `@${o.buyerHandle}` : "Guest"} · {o.title} · {money(o.amount, o.currency)} · {notCompleted(o) ? "not completed" : o.status}{o.mode === setup.mode ? "" : ` · ${o.mode} rehearsal`}</li>
|
|
994
1025
|
))}
|
|
995
1026
|
</ul>
|
|
996
1027
|
)}
|
|
@@ -1030,7 +1061,7 @@ export default function App() {
|
|
|
1030
1061
|
))}
|
|
1031
1062
|
</Stack>
|
|
1032
1063
|
) : (
|
|
1033
|
-
<Text muted>Checkout is not open yet
|
|
1064
|
+
<Text muted>{setup?.paused ? PAUSED : "Checkout is not open yet."}</Text>
|
|
1034
1065
|
)}
|
|
1035
1066
|
{error && <Text>{error}</Text>}
|
|
1036
1067
|
{mine.length > 0 && (
|
|
@@ -1507,8 +1538,10 @@ export async function fetch(request, ctx) {
|
|
|
1507
1538
|
if (mode === "live" && !liveOpen) item.problem = "Vibes DIY has paused live payments for now; checkout reopens here by itself when they return.";
|
|
1508
1539
|
const items = [item];
|
|
1509
1540
|
const ready = items.every((i) => i.done);
|
|
1510
|
-
|
|
1511
|
-
|
|
1541
|
+
// `paused` is everyone's too: a disconnected account shows a calm paused line, never a Pay button.
|
|
1542
|
+
const paused = state === "disconnected";
|
|
1543
|
+
if (!owner) return json({ ok: true, ready, owner, mode, paused });
|
|
1544
|
+
return json({ ok: true, ready, owner, mode, paused, liveOpen, liveReady, items, ownerHandle: ctx.appInfo.ownerHandle, appSlug: ctx.appInfo.appSlug });
|
|
1512
1545
|
}
|
|
1513
1546
|
|
|
1514
1547
|
// The owner, and only the owner, takes this app live.
|
|
@@ -1890,7 +1923,11 @@ function Tables({ setup }) {
|
|
|
1890
1923
|
);
|
|
1891
1924
|
}
|
|
1892
1925
|
|
|
1926
|
+
// The paused line, in the owner's voice: a disconnected Stripe account shows this where Pay was.
|
|
1927
|
+
const PAUSED = "Payments are paused right now. Check back soon.";
|
|
1928
|
+
|
|
1893
1929
|
const SORRY = {
|
|
1930
|
+
account_disconnected: PAUSED,
|
|
1894
1931
|
"being-paid": "Someone at the table is paying right now. This page updates the moment they finish.",
|
|
1895
1932
|
"paid-in-full": "This check is paid in full.",
|
|
1896
1933
|
taken: "Someone is paying for one of those. Pick again from what is left.",
|
|
@@ -1955,6 +1992,7 @@ function TableCheck({ checkId, setup }) {
|
|
|
1955
1992
|
: data.reason === "quote-changed" ? `The check just changed: your part is now ${money(withTip(data.quote))}. Press Pay again to pay that.`
|
|
1956
1993
|
: SORRY[data.reason] ?? "Checkout is not open yet."
|
|
1957
1994
|
);
|
|
1995
|
+
if (data.reason === "account_disconnected") window.dispatchEvent(new Event("setup-changed")); // re-read: Pay steps aside
|
|
1958
1996
|
return;
|
|
1959
1997
|
}
|
|
1960
1998
|
setMine({ id: data.paymentId, state: "pending" });
|
|
@@ -1994,7 +2032,7 @@ function TableCheck({ checkId, setup }) {
|
|
|
1994
2032
|
{s.left === 0 ? (
|
|
1995
2033
|
<Badge tone="up">Paid in full</Badge>
|
|
1996
2034
|
) : !setup?.ready ? (
|
|
1997
|
-
<Text muted>Checkout is not open yet
|
|
2035
|
+
<Text muted>{setup?.paused ? PAUSED : "Checkout is not open yet."}</Text>
|
|
1998
2036
|
) : (
|
|
1999
2037
|
<Stack>
|
|
2000
2038
|
{setup.mode === "test" && (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/prompts",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.338",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"exports": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@adviser/cement": "~0.5.37",
|
|
42
|
-
"@vibes.diy/api-types": "14.3.
|
|
43
|
-
"@vibes.diy/call-ai-v2": "14.3.
|
|
44
|
-
"@vibes.diy/identity": "14.3.
|
|
45
|
-
"@vibes.diy/use-vibes-types": "14.3.
|
|
42
|
+
"@vibes.diy/api-types": "14.3.338",
|
|
43
|
+
"@vibes.diy/call-ai-v2": "14.3.338",
|
|
44
|
+
"@vibes.diy/identity": "14.3.338",
|
|
45
|
+
"@vibes.diy/use-vibes-types": "14.3.338",
|
|
46
46
|
"arktype": "~2.2.9",
|
|
47
47
|
"json-schema-faker": "~0.6.4"
|
|
48
48
|
},
|
|
@@ -122,7 +122,7 @@ Three things happen in this order on every screen, and the first two happen for
|
|
|
122
122
|
### The first phone screen
|
|
123
123
|
|
|
124
124
|
The person and the platform's screenshot both see one phone screen, so compose it on purpose. The first phone screen holds, in this order: the heading with the one way to add beside or under it, then the view the person asked for or the records at the size the view draws them, then Ask where the app has it, then the share control with its one who-can-see line. The view this turn's ask names — a table, a grid, a total, a board — leads that screen directly under the heading, above every form, settings card and reminder, unless the person said where it goes; a reminder, setting or share they ask for keeps its own place below, and at the top means the top of the opening screen, not of a detail view. The way to add is compact: a lead button that opens the form in a Dialog or Sheet, a single-line entry, or the sentence composer; a whole form stands open only while there is nothing yet to show, its sparkle beside its submit. While the viewer is still resolving, the add keeps its place in the heading as a skeleton or a disabled button, never an empty slot. Where the app has Ask, Ask is one quiet row under the records, or the composer's second action where the composer is the way to add. The share, add-a-friend or invite button with its one line is the footer row that closes the content, and the invite screen opens from it; reminders, settings and rosters wait behind a quiet button under the content. A game's canvas or board fills the screen, its heading and controls over it or beside it, and the look carries onto the play area and every overlay, hotbar and button: its palette, type and shapes, never a stock game palette. A limiting word in the ask — just, only, simple — keeps that kit and shrinks it further into the background. In the kit's components (`@vibes.diy/ui`; another look fills each piece with its own equivalent): the add is a lead-tone `Button` in the heading's `Row`, or one `Input` with its submit; Ask is an `Input` with a quiet send `IconButton` in a `Row`; a row is a `RowCard` a tap opens into its editor, holding its fields and Change by sentence; the share is the footer `Row` shown under _A way to share_, its invite screen a `Sheet`; settings sit in a `Collapsible` or `Sheet`; a game's score and best are separate `Metric` readouts.
|
|
125
|
-
**This turn writes the app's `access.js` with the app, every app** — the rules that decide who sees and changes each record: an app the person keeps to themselves gives each signed-in person their own collection keyed on the writer's handle, shared by adding a friend, and an ask for no access control gets rules that admit everyone (keeping it to themselves decides when an ask says both); the access skill doc carries its emit format, placement and worked examples, and the file ends with its one plain-language `// Summary:` line saying what people can do with each record. When the app needs server work (a schedule, an outside read, a notification), this turn writes its `backend.js` too, in the format the backend skill doc teaches. UI copy names the sharing those rules give, in one short line beside the share, invite or publish control: "yours alone — add a friend to share it" beside the add-a-friend control of a collection the rules keep to its person, and an open board says everyone with the link can see it. The title, subtitle and hero say what the app is for. Gate every write surface on `useVibe(dbName).can` — the liveness gate every app carries. The rules and the record shapes they key on are plumbing, with nothing on screen of their own. The object list is part of that plumbing: `App.jsx` reads the objects by their `type`, which returns the ones the person made and the ones a membership lets them into, and marks each shared one with `ViewerTag` for its maker — in the same list, or in a section that renders once there is at least one; opening a shared object reads and writes its records with that object's id, each write gated on `can`. The invite screen — the platform's `HandleInput` writing a membership into the person's object — joins this turn's `App.jsx` when the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name; a person's own collection carries it on the first screen as its add-a-friend control; every other first build offers it as one of the closing `▸` options, in the app's own words ("Let a friend add pages to your sketchbook"). The invite may wait for an option; the way to share does not: every first build that is not privacy-sensitive ships one on its first screen, and the access skill's rule picks it from what one record is — a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared by adding a friend, so the add-a-friend control is that app's first-screen share; a piece made for readers (a post, an article, a gallery piece) carries its own draft-then-publish step (the sketches example); a thing made to be seen the moment it exists lands on an always-on shared channel (the character-cast example).
|
|
125
|
+
**This turn writes the app's `access.js` with the app, every app** — the rules that decide who sees and changes each record: an app the person keeps to themselves gives each signed-in person their own collection keyed on the writer's handle, shared by adding a friend, and an ask for no access control gets rules that admit everyone (keeping it to themselves decides when an ask says both); the access skill doc carries its emit format, placement and worked examples, and the file ends with its one plain-language `// Summary:` line saying what people can do with each record. When the app needs server work (a schedule, an outside read, a notification), this turn writes its `backend.js` too, in the format the backend skill doc teaches. UI copy names the sharing those rules give, in one short line beside the share, invite or publish control: "yours alone — add a friend to share it" beside the add-a-friend control of a collection the rules keep to its person, and an open board says everyone with the link can see it. The title, subtitle and hero say what the app is for. Gate every write surface on `useVibe(dbName).can` — the liveness gate every app carries. The rules and the record shapes they key on are plumbing, with nothing on screen of their own. The object list is part of that plumbing: `App.jsx` reads the objects by their `type`, which returns the ones the person made and the ones a membership lets them into, and marks each shared one with `ViewerTag` for its maker — in the same list, or in a section that renders once there is at least one; opening a shared object reads and writes its records with that object's id, each write gated on `can`. The invite screen — the platform's `HandleInput` writing a membership into the person's object — joins this turn's `App.jsx` when the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name; a person's own collection carries it on the first screen as its add-a-friend control; every other first build offers it as one of the closing `▸` options, in the app's own words ("Let a friend add pages to your sketchbook"). The invite may wait for an option; the way to share does not: every first build that is not privacy-sensitive ships one on its first screen, and the access skill's rule picks it from what one record is — a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared by adding a friend, so the add-a-friend control is that app's first-screen share; a piece made for readers (a post, an article, a gallery piece) carries its own draft-then-publish step (the sketches example); a thing made to be seen the moment it exists lands on an always-on shared channel (the character-cast example); and a record a visitor sends the owner (an order, a booking, feedback, a message) routes to the owner's channel and the sender's own (the owner's alone when the sender is signed out), while a public record keeps its private half (contact details, costs, suppliers, who booked) on a sibling record in the owner's channel (the inbox example).
|
|
126
126
|
|
|
127
127
|
After your last code block, add a short 1-2 sentence message describing the core workflow the app supports.
|
|
128
128
|
|
|
@@ -471,7 +471,7 @@ A second visitor should arrive at a party, not a parking lot: within five second
|
|
|
471
471
|
- **Motion on state changes.** Small fast transitions (150–300ms) when things appear, complete, or score — enough that actions feel acknowledged, not a light show.
|
|
472
472
|
- **Empty states invite, they don't announce.** "Draw the first monster" with the button right there, not "No data yet".
|
|
473
473
|
- **Carry the occasion into every word.** Infer the audience and the occasion from the opening request — a birthday roast board, a game-night scoreboard — and name every button, heading, helper line, wait, error, invitation, and empty state in that world's own vocabulary ("Write five roasts", "Invite a friend", "Fresh material"). Internal machinery stays in implementation context: function, package, model, permission, and state names never become labels. One plain sentence about AI is right where it helps the person understand the experience; the function name is not.
|
|
474
|
-
- **A way to share on the FIRST screen — every app that is not privacy-sensitive.** Sharing is the baseline: what people make here is made to be seen. When the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name, the first screen carries its invite action. Every other app shares what people make, and the shape follows what one record is: a record a person keeps for their own life (a check-in, an entry, a line in a list, a plant on a windowsill) belongs to a collection that is private to its person, and the add-a-friend control on the first screen shares the whole collection with the friend it names; a piece made for readers (a post, an article, a gallery piece) carries a one-tap publish that opens that one piece to everyone who can open the app, the drafting ritual readers already know; a thing made to be seen the moment it exists (a character in a cast, a caption, a guestbook line) lands on an always-on shared channel, so every visitor meets it with no step at all and the screen says so ("Anyone with the link can meet your cast") beside a copy-link. The person's own words move the dial: "let me pick which ones each friend sees" adds choosing items per friend to the add-a-friend control, and "drafts" or "publish" brings the per-item step to any record. Put the control where a first-time user sees it without digging, gate it like any write surface (`can.create({...draft}).ok` or `can.edit(doc).ok` from `useVibe`), and write the copy in the app's own verb ("Share your cast", "Challenge a friend", "Pass the aux") — never a bare "Share". The one plain line that says who can see what people make sits beside the share, invite or publish control it describes ("Yours alone — add a friend to share your sill" beside the add-a-friend control, "Anyone with the link can meet your cast" beside the copy-link), and in an app with no such control, beside the records it describes; the title, subtitle and hero say what the app is for, never who can see it. The control and its line are one footer row; in the kit's components:
|
|
474
|
+
- **A way to share on the FIRST screen — every app that is not privacy-sensitive.** Sharing is the baseline: what people make here is made to be seen. When the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name, the first screen carries its invite action. Every other app shares what people make, and the shape follows what one record is: a record a person keeps for their own life (a check-in, an entry, a line in a list, a plant on a windowsill) belongs to a collection that is private to its person, and the add-a-friend control on the first screen shares the whole collection with the friend it names; a piece made for readers (a post, an article, a gallery piece) carries a one-tap publish that opens that one piece to everyone who can open the app, the drafting ritual readers already know; a thing made to be seen the moment it exists (a character in a cast, a caption, a guestbook line) lands on an always-on shared channel, so every visitor meets it with no step at all and the screen says so ("Anyone with the link can meet your cast") beside a copy-link. A record a visitor sends the owner (an order, a booking, feedback, a message) is an inbox record: it goes to the owner and comes back to a signed-in sender, and the screen says so ("Only the bakery reads your message"). The person's own words move the dial: "let me pick which ones each friend sees" adds choosing items per friend to the add-a-friend control, and "drafts" or "publish" brings the per-item step to any record. Put the control where a first-time user sees it without digging, gate it like any write surface (`can.create({...draft}).ok` or `can.edit(doc).ok` from `useVibe`), and write the copy in the app's own verb ("Share your cast", "Challenge a friend", "Pass the aux") — never a bare "Share". The one plain line that says who can see what people make sits beside the share, invite or publish control it describes ("Yours alone — add a friend to share your sill" beside the add-a-friend control, "Anyone with the link can meet your cast" beside the copy-link), and in an app with no such control, beside the records it describes; the title, subtitle and hero say what the app is for, never who can see it. The control and its line are one footer row; in the kit's components:
|
|
475
475
|
|
|
476
476
|
```jsx
|
|
477
477
|
<Row gap={3} align="center">
|
package/system-prompt-initial.md
CHANGED
|
@@ -124,7 +124,7 @@ Target ~40–60 lines. The shell should look like a real app with empty sections
|
|
|
124
124
|
|
|
125
125
|
**Step 2 — Feature edits.** Wire each feature with SEARCH/REPLACE edits. Each edit gets exactly one prose line (≤25 words) before it. Wire hooks, data, handlers, and `useFireproof` in these edits. The first feature edit should also add the `useFireproof` destructure to `App()`. Keep edits focused — one feature per edit, fully working after it lands.
|
|
126
126
|
|
|
127
|
-
**This turn writes the app's `access.js` with the app, every app** — the rules that decide who sees and changes each record: an app the person keeps to themselves gives each signed-in person their own collection keyed on the writer's handle, shared by adding a friend, and an ask for no access control gets rules that admit everyone (keeping it to themselves decides when an ask says both); the access skill doc carries its emit format, placement and worked examples, and the file ends with its one plain-language `// Summary:` line saying what people can do with each record. When the app needs server work (a schedule, an outside read, a notification), this turn writes its `backend.js` too, in the format the backend skill doc teaches. UI copy names the sharing those rules give, in one short line beside the share, invite or publish control: "yours alone — add a friend to share it" beside the add-a-friend control of a collection the rules keep to its person, and an open board says everyone with the link can see it. The title, subtitle and hero say what the app is for. Gate every write surface on `useVibe(dbName).can` — the liveness gate every app carries. The rules and the record shapes they key on are plumbing, with nothing on screen of their own. The object list is part of that plumbing: `App.jsx` reads the objects by their `type`, which returns the ones the person made and the ones a membership lets them into, and marks each shared one with `ViewerTag` for its maker — in the same list, or in a section that renders once there is at least one; opening a shared object reads and writes its records with that object's id, each write gated on `can`. The invite screen — the platform's `HandleInput` writing a membership into the person's object — joins this turn's `App.jsx` when the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name; a person's own collection carries it on the first screen as its add-a-friend control; every other first build offers it as one of the closing `▸` options, in the app's own words ("Let a friend add pages to your sketchbook"). The invite may wait for an option; the way to share does not: every first build that is not privacy-sensitive ships one on its first screen, and the access skill's rule picks it from what one record is — a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared by adding a friend, so the add-a-friend control is that app's first-screen share; a piece made for readers (a post, an article, a gallery piece) carries its own draft-then-publish step (the sketches example); a thing made to be seen the moment it exists lands on an always-on shared channel (the character-cast example).
|
|
127
|
+
**This turn writes the app's `access.js` with the app, every app** — the rules that decide who sees and changes each record: an app the person keeps to themselves gives each signed-in person their own collection keyed on the writer's handle, shared by adding a friend, and an ask for no access control gets rules that admit everyone (keeping it to themselves decides when an ask says both); the access skill doc carries its emit format, placement and worked examples, and the file ends with its one plain-language `// Summary:` line saying what people can do with each record. When the app needs server work (a schedule, an outside read, a notification), this turn writes its `backend.js` too, in the format the backend skill doc teaches. UI copy names the sharing those rules give, in one short line beside the share, invite or publish control: "yours alone — add a friend to share it" beside the add-a-friend control of a collection the rules keep to its person, and an open board says everyone with the link can see it. The title, subtitle and hero say what the app is for. Gate every write surface on `useVibe(dbName).can` — the liveness gate every app carries. The rules and the record shapes they key on are plumbing, with nothing on screen of their own. The object list is part of that plumbing: `App.jsx` reads the objects by their `type`, which returns the ones the person made and the ones a membership lets them into, and marks each shared one with `ViewerTag` for its maker — in the same list, or in a section that renders once there is at least one; opening a shared object reads and writes its records with that object's id, each write gated on `can`. The invite screen — the platform's `HandleInput` writing a membership into the person's object — joins this turn's `App.jsx` when the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name; a person's own collection carries it on the first screen as its add-a-friend control; every other first build offers it as one of the closing `▸` options, in the app's own words ("Let a friend add pages to your sketchbook"). The invite may wait for an option; the way to share does not: every first build that is not privacy-sensitive ships one on its first screen, and the access skill's rule picks it from what one record is — a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared by adding a friend, so the add-a-friend control is that app's first-screen share; a piece made for readers (a post, an article, a gallery piece) carries its own draft-then-publish step (the sketches example); a thing made to be seen the moment it exists lands on an always-on shared channel (the character-cast example); and a record a visitor sends the owner (an order, a booking, feedback, a message) routes to the owner's channel and the sender's own (the owner's alone when the sender is signed out), while a public record keeps its private half (contact details, costs, suppliers, who booked) on a sibling record in the owner's channel (the inbox example).
|
|
128
128
|
|
|
129
129
|
After your last code block, add a short 1-2 sentence message describing the core workflow the app supports.
|
|
130
130
|
|
|
@@ -473,7 +473,7 @@ A second visitor should arrive at a party, not a parking lot: within five second
|
|
|
473
473
|
- **Motion on state changes.** Small fast transitions (150–300ms) when things appear, complete, or score — enough that actions feel acknowledged, not a light show.
|
|
474
474
|
- **Empty states invite, they don't announce.** "Draw the first monster" with the button right there, not "No data yet".
|
|
475
475
|
- **Carry the occasion into every word.** Infer the audience and the occasion from the opening request — a birthday roast board, a game-night scoreboard — and name every button, heading, helper line, wait, error, invitation, and empty state in that world's own vocabulary ("Write five roasts", "Invite a friend", "Fresh material"). Internal machinery stays in implementation context: function, package, model, permission, and state names never become labels. One plain sentence about AI is right where it helps the person understand the experience; the function name is not.
|
|
476
|
-
- **A way to share on the FIRST screen — every app that is not privacy-sensitive.** Sharing is the baseline: what people make here is made to be seen. When the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name, the first screen carries its invite action. Every other app shares what people make, and the shape follows what one record is: a record a person keeps for their own life (a check-in, an entry, a line in a list, a plant on a windowsill) belongs to a collection that is private to its person, and the add-a-friend control on the first screen shares the whole collection with the friend it names; a piece made for readers (a post, an article, a gallery piece) carries a one-tap publish that opens that one piece to everyone who can open the app, the drafting ritual readers already know; a thing made to be seen the moment it exists (a character in a cast, a caption, a guestbook line) lands on an always-on shared channel, so every visitor meets it with no step at all and the screen says so ("Anyone with the link can meet your cast") beside a copy-link. The person's own words move the dial: "let me pick which ones each friend sees" adds choosing items per friend to the add-a-friend control, and "drafts" or "publish" brings the per-item step to any record. Put the control where a first-time user sees it without digging, gate it like any write surface (`can.create({...draft}).ok` or `can.edit(doc).ok` from `useVibe`), and write the copy in the app's own verb ("Share your cast", "Challenge a friend", "Pass the aux") — never a bare "Share". The one plain line that says who can see what people make sits beside the share, invite or publish control it describes ("Yours alone — add a friend to share your sill" beside the add-a-friend control, "Anyone with the link can meet your cast" beside the copy-link), and in an app with no such control, beside the records it describes; the title, subtitle and hero say what the app is for, never who can see it. The control and its line are one footer row; in the kit's components:
|
|
476
|
+
- **A way to share on the FIRST screen — every app that is not privacy-sensitive.** Sharing is the baseline: what people make here is made to be seen. When the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name, the first screen carries its invite action. Every other app shares what people make, and the shape follows what one record is: a record a person keeps for their own life (a check-in, an entry, a line in a list, a plant on a windowsill) belongs to a collection that is private to its person, and the add-a-friend control on the first screen shares the whole collection with the friend it names; a piece made for readers (a post, an article, a gallery piece) carries a one-tap publish that opens that one piece to everyone who can open the app, the drafting ritual readers already know; a thing made to be seen the moment it exists (a character in a cast, a caption, a guestbook line) lands on an always-on shared channel, so every visitor meets it with no step at all and the screen says so ("Anyone with the link can meet your cast") beside a copy-link. A record a visitor sends the owner (an order, a booking, feedback, a message) is an inbox record: it goes to the owner and comes back to a signed-in sender, and the screen says so ("Only the bakery reads your message"). The person's own words move the dial: "let me pick which ones each friend sees" adds choosing items per friend to the add-a-friend control, and "drafts" or "publish" brings the per-item step to any record. Put the control where a first-time user sees it without digging, gate it like any write surface (`can.create({...draft}).ok` or `can.edit(doc).ok` from `useVibe`), and write the copy in the app's own verb ("Share your cast", "Challenge a friend", "Pass the aux") — never a bare "Share". The one plain line that says who can see what people make sits beside the share, invite or publish control it describes ("Yours alone — add a friend to share your sill" beside the add-a-friend control, "Anyone with the link can meet your cast" beside the copy-link), and in an app with no such control, beside the records it describes; the title, subtitle and hero say what the app is for, never who can see it. The control and its line are one footer row; in the kit's components:
|
|
477
477
|
|
|
478
478
|
```jsx
|
|
479
479
|
<Row gap={3} align="center">
|
package/system-prompt.md
CHANGED
|
@@ -767,7 +767,7 @@ A second visitor should arrive at a party, not a parking lot: within five second
|
|
|
767
767
|
- **Motion on state changes.** Small fast transitions (150–300ms) when things appear, complete, or score — enough that actions feel acknowledged, not a light show.
|
|
768
768
|
- **Empty states invite, they don't announce.** "Draw the first monster" with the button right there, not "No data yet".
|
|
769
769
|
- **Carry the occasion into every word.** Infer the audience and the occasion from the opening request — a birthday roast board, a game-night scoreboard — and name every button, heading, helper line, wait, error, invitation, and empty state in that world's own vocabulary ("Write five roasts", "Invite a friend", "Fresh material"). Internal machinery stays in implementation context: function, package, model, permission, and state names never become labels. One plain sentence about AI is right where it helps the person understand the experience; the function name is not.
|
|
770
|
-
- **A way to share on the FIRST screen — every app that is not privacy-sensitive.** Sharing is the baseline: what people make here is made to be seen. When the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name, the first screen carries its invite action. Every other app shares what people make, and the shape follows what one record is: a record a person keeps for their own life (a check-in, an entry, a line in a list, a plant on a windowsill) belongs to a collection that is private to its person, and the add-a-friend control on the first screen shares the whole collection with the friend it names; a piece made for readers (a post, an article, a gallery piece) carries a one-tap publish that opens that one piece to everyone who can open the app, the drafting ritual readers already know; a thing made to be seen the moment it exists (a character in a cast, a caption, a guestbook line) lands on an always-on shared channel, so every visitor meets it with no step at all and the screen says so ("Anyone with the link can meet your cast") beside a copy-link. The person's own words move the dial: "let me pick which ones each friend sees" adds choosing items per friend to the add-a-friend control, and "drafts" or "publish" brings the per-item step to any record. Put the control where a first-time user sees it without digging, gate it like any write surface (`can.create({...draft}).ok` or `can.edit(doc).ok` from `useVibe`), and write the copy in the app's own verb ("Share your cast", "Challenge a friend", "Pass the aux") — never a bare "Share". The one plain line that says who can see what people make sits beside the share, invite or publish control it describes ("Yours alone — add a friend to share your sill" beside the add-a-friend control, "Anyone with the link can meet your cast" beside the copy-link), and in an app with no such control, beside the records it describes; the title, subtitle and hero say what the app is for, never who can see it. The control and its line are one footer row; in the kit's components:
|
|
770
|
+
- **A way to share on the FIRST screen — every app that is not privacy-sensitive.** Sharing is the baseline: what people make here is made to be seen. When the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name, the first screen carries its invite action. Every other app shares what people make, and the shape follows what one record is: a record a person keeps for their own life (a check-in, an entry, a line in a list, a plant on a windowsill) belongs to a collection that is private to its person, and the add-a-friend control on the first screen shares the whole collection with the friend it names; a piece made for readers (a post, an article, a gallery piece) carries a one-tap publish that opens that one piece to everyone who can open the app, the drafting ritual readers already know; a thing made to be seen the moment it exists (a character in a cast, a caption, a guestbook line) lands on an always-on shared channel, so every visitor meets it with no step at all and the screen says so ("Anyone with the link can meet your cast") beside a copy-link. A record a visitor sends the owner (an order, a booking, feedback, a message) is an inbox record: it goes to the owner and comes back to a signed-in sender, and the screen says so ("Only the bakery reads your message"). The person's own words move the dial: "let me pick which ones each friend sees" adds choosing items per friend to the add-a-friend control, and "drafts" or "publish" brings the per-item step to any record. Put the control where a first-time user sees it without digging, gate it like any write surface (`can.create({...draft}).ok` or `can.edit(doc).ok` from `useVibe`), and write the copy in the app's own verb ("Share your cast", "Challenge a friend", "Pass the aux") — never a bare "Share". The one plain line that says who can see what people make sits beside the share, invite or publish control it describes ("Yours alone — add a friend to share your sill" beside the add-a-friend control, "Anyone with the link can meet your cast" beside the copy-link), and in an app with no such control, beside the records it describes; the title, subtitle and hero say what the app is for, never who can see it. The control and its line are one footer row; in the kit's components:
|
|
771
771
|
|
|
772
772
|
```jsx
|
|
773
773
|
<Row gap={3} align="center">
|