@vibes.diy/prompts 14.3.269 → 14.3.271
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/backend.md +6 -6
- package/llms/image-gen.md +2 -0
- package/llms/stripe.md +162 -36
- package/llms/surface-stage.md +4 -0
- package/llms/youtube.md +11 -4
- package/package.json +5 -5
- package/system-prompt-initial-instant.md +1 -1
- package/system-prompt-initial-oneshot.md +1 -1
- package/system-prompt-initial.md +1 -1
- package/system-prompt.md +1 -1
package/llms/backend.md
CHANGED
|
@@ -92,8 +92,9 @@ handler. A guest's `apiFetch` into the `fetch` handler arrives with `user` null,
|
|
|
92
92
|
and `ctx.requireBackend("fetch")` still passes for it, so a guest-checkout
|
|
93
93
|
record can be one only the handler writes; an `onChange` run triggered by a
|
|
94
94
|
signed-out writer passes `ctx.requireBackend("onChange")` the same way. The function still opts that anonymous
|
|
95
|
-
write in with `allowAnonymous: true`, and
|
|
96
|
-
|
|
95
|
+
write in with `allowAnonymous: true`, and that opt-in is all it takes: the
|
|
96
|
+
app's anonymous-write setting gates writes straight from a browser, never a
|
|
97
|
+
write the app's own backend.js makes. `user.backend` itself is read only off a
|
|
97
98
|
signed-in user, so gate with `ctx.requireBackend`.
|
|
98
99
|
|
|
99
100
|
`scheduled` always runs in **admin mode**, the same override the owner gets
|
|
@@ -954,10 +955,9 @@ handle). The page gates its add-a-teammate control on
|
|
|
954
955
|
teammates you add see these leads"), and your reply says the same.
|
|
955
956
|
|
|
956
957
|
Gate both handlers on the secret, so the app works fully before any Zap
|
|
957
|
-
exists, and say in your reply what the owner sets up: the secret
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
CLI push, `vibes-diy app anon-write <owner>/<slug> on`).
|
|
958
|
+
exists, and say in your reply what the owner sets up: the secret and the Zap's POST
|
|
959
|
+
address and header. The arrivals are written by backend.js with
|
|
960
|
+
`allowAnonymous: true`, so the app's anonymous-write setting plays no part.
|
|
961
961
|
|
|
962
962
|
### `backend.js`
|
|
963
963
|
```js
|
package/llms/image-gen.md
CHANGED
|
@@ -193,6 +193,8 @@ When the ask names the pictures and an item's picture is what it is — a deck o
|
|
|
193
193
|
/>
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
+
A shop's products are pictured items whatever the ask says: a bag of coffee, a mug, a candle in a catalog is one `<ImgGen>` per product record, prompted as a product photograph and saved on it, or the photo the owner uploads, so the shop reads like a real storefront.
|
|
197
|
+
|
|
196
198
|
A picture the person asked for by name — the hero of an illustrated journal, the portrait a character maker exists for — arrives with the item itself, so that card opens already illustrated. Every other picture a record would be better with waits for a press: the card carries a quiet `IconButton` with the `photo` icon, labelled in the app's words ("Paint the cover", "Picture this dish"), inside the empty frame where the picture will land, and the press mounts `<ImgGen>` on that record's `_id` with the record's own prompt and saves the picture on it, so every later visitor sees it with no step. Once a picture exists, buttons and `showControls` are for *regenerating* it. Pictures that are extras rather than identity — an avatar upload, a one-off hero graphic, and the text-first snippets below — come from the same kind of explicit action.
|
|
197
199
|
|
|
198
200
|
## Pictures on Request for Text-First Snippets
|
package/llms/stripe.md
CHANGED
|
@@ -274,10 +274,11 @@ once on the server from the product records the buyer names, and never trust an
|
|
|
274
274
|
amount the browser sends — the route takes *which products, and how many of
|
|
275
275
|
each*, and looks every price up in the owner's catalog.
|
|
276
276
|
|
|
277
|
-
A bag is paid in one Checkout Session: the
|
|
277
|
+
A bag is paid in one Checkout Session: backend.js prices every line of the bag, each product and its quantity, from the owner's catalog, the order keeps those lines, and the session carries one line item per bag line.
|
|
278
278
|
|
|
279
|
-
A lone Pay button is a bag of one (`[{ productId, qty: 1 }]`)
|
|
280
|
-
|
|
279
|
+
A lone Pay button is a bag of one (`[{ productId, qty: 1 }]`) that the page
|
|
280
|
+
sends to `/checkout`; a shop's bag is a record the buyer fills, paid by the
|
|
281
|
+
`/pay` link (*A shop with a bag*). Both price through the same `priceBag`. The order's `lines` hold
|
|
281
282
|
each line's title, unit amount and quantity as they were at checkout, its
|
|
282
283
|
`amount` is their total, and the read-back matches Stripe's `amount_total` to
|
|
283
284
|
that total. A bag is one currency; the route caps it at a sensible number of
|
|
@@ -1019,14 +1020,157 @@ where Stripe renews and retries, is the `stripe-subscriptions` skill.
|
|
|
1019
1020
|
### A shop with a bag
|
|
1020
1021
|
|
|
1021
1022
|
A shop where people fill a bag (the `ui-storefront` block's shape) keeps that
|
|
1022
|
-
block's page and swaps its **Place order** for this recipe's checkout
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
a
|
|
1023
|
+
block's page and swaps its **Place order** for this recipe's checkout. The
|
|
1024
|
+
products are this recipe's `product` records (the storefront adds a photo to
|
|
1025
|
+
each as `_files.photo`), and the order the bag becomes is this recipe's
|
|
1026
|
+
`order`, written by backend.js, so the storefront's own browser-written order
|
|
1027
|
+
goes away. Checkout charges the lines, so the storefront's shipping row goes
|
|
1028
|
+
too, unless backend.js prices shipping as a line of its own.
|
|
1029
|
+
|
|
1030
|
+
A shop's bag is a record in the `orders` database that the buyer writes as they shop, and its Pay is one link, `/_api/pay?bag=<_id>&rev=<rev>`, that prices that exact version of the bag in backend.js and sends the buyer to Stripe Checkout.
|
|
1031
|
+
|
|
1032
|
+
A record rather than page state, because the bag is the buyer's, not the
|
|
1033
|
+
tab's: it is there on their phone after they filled it on their laptop, and
|
|
1034
|
+
anyone helping them shop (their own agent filling the bag in a conversation,
|
|
1035
|
+
say) writes the same record the page does and hands them the same link. The
|
|
1036
|
+
page never sends a price and never a list of lines; the link names a bag and
|
|
1037
|
+
the version the buyer saw, and the shop's own `priceBag` reads every line
|
|
1038
|
+
from the owner's catalog, options and all.
|
|
1039
|
+
|
|
1040
|
+
**The bag record.** One open bag per buyer: `type: "bag"`, an `_id` of
|
|
1041
|
+
`bag-` and a fresh id, `buyerHandle` (access.js holds it to the writer),
|
|
1042
|
+
and `rev`, a fresh random string on every write, which is the version the
|
|
1043
|
+
Pay link names. Its lines take one of two shapes, and a shop picks the one
|
|
1044
|
+
that fits:
|
|
1045
|
+
|
|
1046
|
+
- **Lines on the bag.** `lines: [{ productId, qty }]` on the bag itself, and
|
|
1047
|
+
every change is one put of the whole bag with a new `rev`. Right for most
|
|
1048
|
+
shops: one record, one write, nothing to keep in step.
|
|
1049
|
+
- **A record per line.** Each line is its own `type: "line"` record with
|
|
1050
|
+
`bagId`, `productId`, `qty` and whatever options it carries (size, milk,
|
|
1051
|
+
engraving), and every line write also puts the bag with a new `rev` and
|
|
1052
|
+
`touchedAt`. Right when a line is rich enough to edit on its own screen.
|
|
1053
|
+
The line carries the `touchedAt` of the bag write that went with it, so a
|
|
1054
|
+
line newer than the bag was written after the link and is not in it.
|
|
1055
|
+
|
|
1056
|
+
A line's options are the shop's to price: `priceBag` reads them off the line
|
|
1057
|
+
and adds what the owner's product record says they cost, so a modifier is
|
|
1058
|
+
priced in exactly one place, the same place as the product.
|
|
1059
|
+
|
|
1060
|
+
### `access.js`
|
|
1061
|
+
```js partial
|
|
1062
|
+
// Added before the `order` rule: the buyer's own bag, and its lines when they are records. A record
|
|
1063
|
+
// keeps its type, so an order can never be rewritten as a line to slip past the order rule.
|
|
1064
|
+
if (oldDoc && oldDoc.type !== doc.type) throw { forbidden: "a record keeps its type" };
|
|
1065
|
+
if (doc.type === "bag" || doc.type === "line") {
|
|
1066
|
+
if (doc.buyerHandle !== user.userHandle || (oldDoc && oldDoc.buyerHandle !== doc.buyerHandle)) {
|
|
1067
|
+
throw { forbidden: "a bag is its buyer's own" };
|
|
1068
|
+
}
|
|
1069
|
+
if (doc.type === "bag" && (!doc._id?.startsWith("bag-") || typeof doc.rev !== "string")) {
|
|
1070
|
+
throw { forbidden: "a bag has a bag- id and a rev" };
|
|
1071
|
+
}
|
|
1072
|
+
if (doc.type === "line" && !doc.bagId?.startsWith("bag-")) throw { forbidden: "a line names its bag" };
|
|
1073
|
+
const mine = `user:${doc.buyerHandle}`;
|
|
1074
|
+
return { channels: [mine], grant: { users: { [doc.buyerHandle]: [mine] } } };
|
|
1075
|
+
}
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
The `order` rule takes one change: a Pay link arrives as a plain link, so
|
|
1079
|
+
`/pay` writes the order while nobody is signed in. The new order's buyer is
|
|
1080
|
+
the signed-in writer when there is one, `ctx.requireBackend("fetch")` still
|
|
1081
|
+
gates its creation, and the rule returns `allowAnonymous: true`. That is all
|
|
1082
|
+
a write from the app's own backend needs: the app's anonymous-write setting
|
|
1083
|
+
gates browsers, not backend.js, so the owner has no step to take. The top line
|
|
1084
|
+
that refuses a signed-out writer lets an `order` through to that rule.
|
|
1085
|
+
|
|
1086
|
+
### `backend.js`
|
|
1087
|
+
```js partial
|
|
1088
|
+
// Pay a bag by link. The page's Pay button and anyone helping the buyer open the same address, so
|
|
1089
|
+
// the price is the one this route computes, from the owner's catalog, for the bag version named.
|
|
1090
|
+
// A link is opened signed out: the buyer is the bag's buyerHandle, which only they could write.
|
|
1091
|
+
if (url.pathname === "/pay" && request.method === "GET") {
|
|
1092
|
+
const back = (reason) => Response.redirect(appUrl(ctx, `#bag-problem=${reason}`), 303);
|
|
1093
|
+
const bagId = url.searchParams.get("bag") ?? "";
|
|
1094
|
+
const bag = bagId.startsWith("bag-") ? await ctx.db.get(bagId, { db: DB }) : null;
|
|
1095
|
+
if (bag?.type !== "bag") return back("not-found");
|
|
1096
|
+
// The version the buyer was shown, or nothing: a bag that moved since sends them back to look again.
|
|
1097
|
+
if (bag.rev !== url.searchParams.get("rev")) return back("bag-changed");
|
|
1098
|
+
const { mode, open } = await checkoutMode(ctx);
|
|
1099
|
+
const shown = url.searchParams.get("mode"); // the page adds the mode it showed; a link from elsewhere has none
|
|
1100
|
+
if (shown && shown !== mode) return back("mode-changed");
|
|
1101
|
+
if (!open) return back("not-open");
|
|
1102
|
+
let lines = bag.lines;
|
|
1103
|
+
if (!Array.isArray(lines)) {
|
|
1104
|
+
// A record per line: the bag's buyer's own lines naming this bag (anyone can name a bag id, so a
|
|
1105
|
+
// line someone else wrote is not in it), and none written after the bag's own write.
|
|
1106
|
+
// Every page: the query filters after its limit, and orders name the bag by bagId too.
|
|
1107
|
+
lines = [];
|
|
1108
|
+
let after;
|
|
1109
|
+
do {
|
|
1110
|
+
const page = await ctx.db.query({ db: DB, field: "bagId", key: bag._id, limit: 100, after });
|
|
1111
|
+
lines.push(...page.filter((l) => l.type === "line" && l.buyerHandle === bag.buyerHandle));
|
|
1112
|
+
after = page.next;
|
|
1113
|
+
} while (after && lines.length <= MAX_LINES);
|
|
1114
|
+
if (lines.some((l) => l.touchedAt > bag.touchedAt)) return back("bag-changed");
|
|
1115
|
+
}
|
|
1116
|
+
// Whole lines, options and all: priceBag prices each option from the owner's product record.
|
|
1117
|
+
const priced = await priceBag(ctx, lines);
|
|
1118
|
+
if (!priced) return back("unknown-item");
|
|
1119
|
+
const buyer = bag.buyerHandle;
|
|
1120
|
+
// One attempt per bag version: a second press of the same link lands on the session already open.
|
|
1121
|
+
const pending = await ctx.db.query({ db: DB, field: "status", key: "pending", limit: 100 });
|
|
1122
|
+
const attempt = pending.find((o) => o.bagId === bag._id && o.bagKey === priced.key && o.currency === priced.currency && o.mode === mode && o.sessionUrl && Date.now() - o.createdAt < SESSION_TTL_MS);
|
|
1123
|
+
if (attempt) return Response.redirect(attempt.sessionUrl, 303);
|
|
1124
|
+
// From here it is /checkout's order and session, with the bag's buyer and `bagId: bag._id` on the
|
|
1125
|
+
// order: the same order fields, the same form, the same line items, the same idempotency key.
|
|
1126
|
+
const { id, sessionUrl, failed } = await openSession(ctx, { priced, buyer, mode, bagId: bag._id });
|
|
1127
|
+
if (failed) return back(failed);
|
|
1128
|
+
return Response.redirect(sessionUrl, 303);
|
|
1129
|
+
}
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
`openSession` is `/checkout`'s second half lifted into a function, so both
|
|
1133
|
+
routes write the same order and the same session: the order (now with
|
|
1134
|
+
`bagId` when a bag paid it), the session form, the second put with
|
|
1135
|
+
`sessionId` and `sessionUrl`. `config.fetch.unfilteredReads` already covers
|
|
1136
|
+
the `orders` database; its `why` names the bag too, since `/pay` reads a
|
|
1137
|
+
bag and its lines with nobody signed in.
|
|
1138
|
+
|
|
1139
|
+
**The page.** It reads the buyer's open bag with a live query, writes it on
|
|
1140
|
+
every Add, and its Pay is a link. The page runs in a frame, so the link is the
|
|
1141
|
+
app's full address: `/setup` adds `pay: appUrl(ctx, "/_api/pay")` to everyone's
|
|
1142
|
+
answer, and the page puts the bag on it.
|
|
1143
|
+
|
|
1144
|
+
### `App.jsx`
|
|
1145
|
+
```jsx partial
|
|
1146
|
+
// The buyer's open bag: theirs alone (access.js routes it to their own channel), and the newest one
|
|
1147
|
+
// no paid order names. Every Add is a put of the whole bag with a fresh rev.
|
|
1148
|
+
const { docs: bags } = useLiveQuery("type", { key: "bag" });
|
|
1149
|
+
const bag = bags.filter((b) => b.buyerHandle === me?.userHandle && !orders.some((o) => o.bagId === b._id && o.status === "paid")).sort((a, b) => b.touchedAt - a.touchedAt)[0];
|
|
1150
|
+
const lines = (bag?.lines ?? []).filter((l) => forSale.some((p) => p._id === l.productId));
|
|
1151
|
+
const add = (productId) => {
|
|
1152
|
+
const kept = bag?.lines ?? [];
|
|
1153
|
+
const next = kept.some((l) => l.productId === productId) ? kept.map((l) => (l.productId === productId ? { ...l, qty: l.qty + 1 } : l)) : [...kept, { productId, qty: 1 }];
|
|
1154
|
+
database.put({ ...(bag ?? { _id: "bag-" + crypto.randomUUID(), type: "bag", buyerHandle: me.userHandle }), lines: next, rev: crypto.randomUUID(), touchedAt: Date.now() });
|
|
1155
|
+
};
|
|
1156
|
+
// The same address anyone helping the buyer would hand them. The subtotal is a preview; /pay prices it.
|
|
1157
|
+
const payUrl = bag && setup?.pay && `${setup.pay}?bag=${encodeURIComponent(bag._id)}&rev=${encodeURIComponent(bag.rev)}&mode=${setup.mode}`;
|
|
1158
|
+
|
|
1159
|
+
// Pay waits for the server to hold this version: a put lands on this device first, and a link to a
|
|
1160
|
+
// rev the server has not accepted yet would come back as "bag changed".
|
|
1161
|
+
const saving = bag?._synced && bag._synced.status !== "accepted";
|
|
1162
|
+
<Button onClick={() => window.open(payUrl, "_blank")} disabled={!payUrl || lines.length === 0 || saving}>
|
|
1163
|
+
Pay {money(subtotal, CURRENCY)} — Stripe opens in a new tab
|
|
1164
|
+
</Button>
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
`window.open` goes straight to the link inside the click, so there is no
|
|
1168
|
+
blank tab to fill and no popup warning. The link lands back on the shop
|
|
1169
|
+
with `#bag-problem=` when the bag moved, something went off sale or checkout
|
|
1170
|
+
is closed, and the page says so in the shop's words (*Your bag changed: check
|
|
1171
|
+
it and press Pay again*). The bag stays the buyer's until an order naming it
|
|
1172
|
+
comes back paid; a buyer who closes Stripe's tab still has their bag, and a
|
|
1173
|
+
paid bag drops out of the live query, so the next Add starts a fresh one.
|
|
1030
1174
|
|
|
1031
1175
|
A product listed with a period renews, so it sells on the `stripe-subscriptions` recipe: a line like *Monthly coffee bag, $22* or *Bread club, $30 a month* checks out in subscription mode with `price_data[recurring][interval]`, never as a one-time line in a payment-mode bag.
|
|
1032
1176
|
|
|
@@ -1044,19 +1188,6 @@ The header link reads like *Bag (3)*, its count is the sum of the quantities,
|
|
|
1044
1188
|
and it sits in the `Navbar` beside the owner's **Products** button, on every
|
|
1045
1189
|
screen where people shop.
|
|
1046
1190
|
|
|
1047
|
-
```jsx
|
|
1048
|
-
// The storefront's `lines` already leave out anything taken off sale. Its lead sends each line's
|
|
1049
|
-
// product and quantity; the backend prices every line from the catalog, so the page's sum is a
|
|
1050
|
-
// preview, never the charge.
|
|
1051
|
-
<Button onClick={() => pay(lines.map(({ productId, qty }) => ({ productId, qty })))} disabled={busy || lines.length === 0} loading={busy}>
|
|
1052
|
-
Pay {money(subtotal, CURRENCY)} — Stripe opens in a new tab
|
|
1053
|
-
</Button>
|
|
1054
|
-
```
|
|
1055
|
-
|
|
1056
|
-
The bag empties when the order comes back paid (the `#paid=` return, or the
|
|
1057
|
-
order moving to `paid` in the buyer's live query), never when the tab opens: a
|
|
1058
|
-
buyer who closes Stripe's tab still has their bag.
|
|
1059
|
-
|
|
1060
1191
|
## Guest checkout at a venue: a table's check
|
|
1061
1192
|
|
|
1062
1193
|
A restaurant check is the fullest venue page; a tip jar, a donation page or a
|
|
@@ -1083,13 +1214,12 @@ payment's creation only from `ctx.requireBackend("fetch")` and its settling
|
|
|
1083
1214
|
only from the backend, keeps each type at its own ids, and takes the go-live
|
|
1084
1215
|
record only from the owner. A page writes nothing but the owner's own checks.
|
|
1085
1216
|
|
|
1086
|
-
A guest's write through the route is
|
|
1087
|
-
|
|
1088
|
-
`allowAnonymous: true
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
filled in. With it off, `/checkout` answers `guests-closed` and the page
|
|
1217
|
+
A guest's write through the route is a signed-out write: `user` is null,
|
|
1218
|
+
`ctx.requireBackend("fetch")` passes, and the record returns
|
|
1219
|
+
`allowAnonymous: true`. That opt-in is the whole of it: a write from the app's
|
|
1220
|
+
own backend.js is not gated by the app's anonymous-write setting (that setting
|
|
1221
|
+
is for writes straight from a browser), so guests pay with no Setup step for
|
|
1222
|
+
it. A write the access function refuses answers `guests-closed`, and the page
|
|
1093
1223
|
reads *Checkout is not open yet*.
|
|
1094
1224
|
|
|
1095
1225
|
Before a Checkout Session is created, the payment reserves its share of the check with one revision-checked write.
|
|
@@ -1360,7 +1490,7 @@ export async function fetch(request, ctx) {
|
|
|
1360
1490
|
(err) => err
|
|
1361
1491
|
);
|
|
1362
1492
|
if (refused) {
|
|
1363
|
-
//
|
|
1493
|
+
// access.js refused the record; its reason is in the log.
|
|
1364
1494
|
ctx.log("warn", "check reservation refused", { code: refused.code, message: refused.message });
|
|
1365
1495
|
return json({ ok: false, reason: "guests-closed" }, 503);
|
|
1366
1496
|
}
|
|
@@ -1594,10 +1724,6 @@ function SetupScreen({ setup }) {
|
|
|
1594
1724
|
Open <a href={settingsUrl} target="_blank" rel="noreferrer">this vibe's Settings tab</a> (My Vibes → this vibe → Settings)
|
|
1595
1725
|
and press <b>{STRIPE_BUTTON[item.state] ?? "Connect Stripe"}</b> under <b>Payments</b>. Stripe opens its own setup pages.
|
|
1596
1726
|
</li>
|
|
1597
|
-
<li>
|
|
1598
|
-
Let guests pay without an account: publishing from the editor turns this on, and after a CLI push run{" "}
|
|
1599
|
-
<b>vibes-diy app anon-write {vibe} on</b>. The page never writes for them; this app's server records each payment.
|
|
1600
|
-
</li>
|
|
1601
1727
|
<li>
|
|
1602
1728
|
Come back here: tables can pay as soon as Stripe says your account is ready. In test mode the card 4242 4242 4242 4242 with any future date pays.
|
|
1603
1729
|
</li>
|
package/llms/surface-stage.md
CHANGED
|
@@ -9,6 +9,10 @@ the heading, the controls that act on the picture, the records, the share row. T
|
|
|
9
9
|
kit's components, and the stage is drawn shape by shape, so a district keeps its outline, a bar
|
|
10
10
|
keeps its height and a room keeps its proportions to the pixel.
|
|
11
11
|
|
|
12
|
+
A picture of a thing is a painted picture, never a stage: a product in a catalog, a bag of coffee,
|
|
13
|
+
a mug, a candle, a dish, a creature or a cover is one `<ImgGen>` saved on its record, or the photo
|
|
14
|
+
the owner uploads. The stage is for pictures whose geometry is the point.
|
|
15
|
+
|
|
12
16
|
**Pick the medium the picture asks for, and reach.**
|
|
13
17
|
|
|
14
18
|
- **Three.js** for depth, motion and anything explored: a voxel world, a scene, a model, and an
|
package/llms/youtube.md
CHANGED
|
@@ -66,14 +66,21 @@ const body = await res.json(); // Google's own JSON, Google's own status
|
|
|
66
66
|
- The argument is a path rooted at the v3 resource (`/videos?part=statistics&id=a,b`)
|
|
67
67
|
or a full `https://www.googleapis.com/youtube/v3/…` URL. Leave `key=` off: the
|
|
68
68
|
platform adds its own.
|
|
69
|
-
- It reads `channels`, `videos`, `playlistItems
|
|
70
|
-
|
|
69
|
+
- It reads `channels`, `videos`, `playlistItems`, `playlists` and
|
|
70
|
+
`commentThreads`, with `GET`, 1 unit each. The first four answer every
|
|
71
|
+
public-numbers question a channel app asks; `commentThreads` reads what
|
|
72
|
+
viewers wrote (`/commentThreads?part=snippet&videoId=<id>&maxResults=100&order=relevance&textFormat=plainText`,
|
|
73
|
+
each item's `snippet.topLevelComment.snippet.textDisplay`), for an app that
|
|
74
|
+
shows what people are talking about.
|
|
75
|
+
|
|
76
|
+
What viewers say comes from commentThreads through ctx.youtube, read for the few videos on screen and kept as counted words, never as the comment text itself.
|
|
77
|
+
|
|
71
78
|
- It resolves a normal `Response`. A Google error (`quotaExceeded`, a bad
|
|
72
79
|
`part`) arrives as a `Response` with Google's status and `error` body, so
|
|
73
80
|
`res.ok` and `await res.json()` work as they do for any fetch.
|
|
74
81
|
- When the platform declines a call, the promise rejects with an Error whose
|
|
75
82
|
`reason` names why: `over_budget` (this app's units for the day are spent),
|
|
76
|
-
`unmodeled_endpoint` (a resource outside the
|
|
83
|
+
`unmodeled_endpoint` (a resource outside the five), `not_available` (this
|
|
77
84
|
deployment has no YouTube key right now), `unsupported_method`,
|
|
78
85
|
`invalid_path`, `body_too_large`, `upstream_error`.
|
|
79
86
|
- `await ctx.youtube.status()` answers `{ available, unitsLeftToday, dailyUnits }`
|
|
@@ -87,7 +94,7 @@ press **Track**, and the first readings land within the minute.
|
|
|
87
94
|
## 2. A daily budget per app
|
|
88
95
|
|
|
89
96
|
Each app spends from its own budget of **2,000 units a day**, counted in UTC.
|
|
90
|
-
Every call to the
|
|
97
|
+
Every call to the five resources costs 1 unit. That is generous for one
|
|
91
98
|
channel: the overnight recap in section 5 spends about 110 units a day on a
|
|
92
99
|
500-video channel.
|
|
93
100
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/prompts",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.271",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"exports": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@adviser/cement": "~0.5.34",
|
|
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.271",
|
|
43
|
+
"@vibes.diy/call-ai-v2": "14.3.271",
|
|
44
|
+
"@vibes.diy/identity": "14.3.271",
|
|
45
|
+
"@vibes.diy/use-vibes-types": "14.3.271",
|
|
46
46
|
"arktype": "~2.2.8",
|
|
47
47
|
"json-schema-faker": "~0.6.3"
|
|
48
48
|
},
|
|
@@ -96,7 +96,7 @@ export default function App() {
|
|
|
96
96
|
- **Form controls take the new value itself**: `<Input value={title} onChange={setTitle} />`, never `e.target.value`, each inside a `Field` that hands it `id` and `describedBy`.
|
|
97
97
|
- **The named interaction works end to end**: the person's sentence names it, and the app builds that and only that, with realistic data. Sharing, invitations, roles, scheduled jobs, emails and outside services come in a later pass, and so does the line about who can see the data, which sits beside the share control that pass adds; the title, subtitle and hero say what the app is for.
|
|
98
98
|
- **Seed content** is realistic and specific to the app's world, with a `key` per item and the exact fields the app reads.
|
|
99
|
-
- **The picture is its own stage.** The components are the app's chrome. When the subject is a picture — a voxel world, a 3D infographic, a map, a floor plan, a diagram
|
|
99
|
+
- **The picture is its own stage.** The components are the app's chrome. When the subject is a picture whose shapes carry the meaning — a voxel world, a 3D infographic, a map, a floor plan, a diagram — it is one contained stage in its own component: Three.js for depth, motion and anything explored (the most striking, reach for it), SVG for flat, exact or printable pictures (geometry as data in a `viewBox`, fills and strokes theme classes such as `fill-primary` and `stroke-foreground`), D3 for data-driven layout into SVG. It sits inside a `Card` or at full width, with the components' controls around it (a picture of a thing, such as a product, a dish or a cover, is a painted image instead); a tappable SVG shape is a `<g role="button" tabIndex={0} aria-label="…">` with `onClick` and an Enter/Space `onKeyDown` that calls `preventDefault()` before acting.
|
|
100
100
|
- **Layout comes from the components** (`Stack`, `Row`, `Grid`, `Card`) and their `tone`, `size` and `variant` props; plain spacing like `p-6` sits on your own wrapping elements only. The look brief below says how the page is composed.
|
|
101
101
|
- **A bar fixed to the bottom of the screen — a tab bar, a nav, a save bar — rides above the platform's controls**, so every tab and button on it stays tappable: `BottomNav` sits there by itself, and a bar of your own puts `bottom: 'var(--vibes-controls-inset, 0px)'` in its `style` instead of using `bottom-0`.
|
|
102
102
|
- **Tapping a person opens their profile**: `<ViewerTag userHandle={m.userHandle} onClick={() => setProfile(m.userHandle)} />` binds the handle the tag shows, and a hero header is `<ViewerTag userHandle={profile} size={120} avatarOnly />` — the tag itself is the button, drawn natively. Opening a profile follows nobody.
|
|
@@ -18,7 +18,7 @@ You are an AI assistant tasked with creating React components. You should create
|
|
|
18
18
|
- Use Tailwind CSS for mobile-first accessible styling. Every class is a plain utility the theme already backs — `bg-background`, `text-foreground`, `text-muted-foreground`, `p-6`, `gap-4`, `grid-cols-7`, `min-h-screen`. Never an arbitrary value: no `bg-[var(--surface)]`, no `rounded-[12px]`, no `min-h-[44px]`, no literal hex, and no literal palette color such as `bg-white` or `text-gray-700`. Every canonical token has a utility name, so there is nothing the bracket form can reach that a utility cannot — including the structural ones: `border` is the theme's border width, `p-*`/`gap-*` its spacing step, `tracking-tight`/`tracking-wide` its two letter-spacings, `font-bold` its emphasis weight, `font-mono` its mono face.
|
|
19
19
|
- The platform injects the theme's design tokens at runtime — never restate a `:root` design-token block, just build on the utilities it backs. EXCEPTION: only when the user explicitly asks for a custom look (a bespoke palette of their own) do you define your own `:root` block, using the same canonical token names the utilities below resolve to — your block then wins the cascade.
|
|
20
20
|
- **The look is the component package's, and the app commits to it.** The look brief below names the components and how a view is composed; every surface, control and run of words in the app's chrome is one of them, and each arrives wearing its surface, ink, corner, shadow, type and press (a `Card` already wears `bg-card`; a `Button` already sinks). What you write yourself is placement: the layout primitives the brief names (`Stack`, `Row`, `Grid`), and plain wrapping elements that carry spacing and arrangement utilities only (`p-6`, `gap-4`, `grid grid-cols-7`, `max-w-lg mx-auto`, `min-h-screen`). The page root wears `bg-background text-foreground` once; genuine metadata — a timestamp, a count, a helper line — reads as the package's muted text. Anything that floats — a modal, a sheet, a confirm, a menu, a tooltip, a toast — is the package's own floating component, which brings its scrim and its opaque surface with it, so it goes in bare. A panel you paint to float yourself is opaque too: `bg-popover text-popover-foreground`, the floating component's own surface and never a card's, because a card surface is often translucent and the popover pair is that same colour made opaque, so text over a scrim stays readable in dark mode.
|
|
21
|
-
- **The look dresses the chrome; a picture is its own stage.** The component package and every look it wears are made for the app's chrome: headings, controls, cards, forms, records and anything that floats. When the app's subject is a picture — a voxel world, a 3D infographic, a model, a map of districts, a floor plan, a diagram,
|
|
21
|
+
- **The look dresses the chrome; a picture is its own stage.** The component package and every look it wears are made for the app's chrome: headings, controls, cards, forms, records and anything that floats. When the app's subject is a picture whose shapes carry the meaning — a voxel world, a 3D infographic, a model, a map of districts, a floor plan, a diagram, a figure matched to a reference — that picture is one contained stage the app draws itself in its own component, set inside a `Card` or at full width, with the package's components as the controls around it. A picture of a thing — a product in a catalog, a bag of coffee, a mug, a dish, a creature, a cover — is a painted picture, one `<ImgGen>` saved on its record (_Pictures are content_ below), or the photo the owner uploads. For a stage, pick the medium the picture asks for, and reach: Three.js for depth, motion and anything explored, the most striking stage and the one to choose whenever a picture can stand up (a 3D infographic included); SVG for flat, exact and printable pictures; D3 for data-driven layout drawn into SVG; canvas for pixels and simulations. The stage keeps its own geometry as data, so every shape lands where it was drawn, and it wears the theme's colours: an SVG stage's fills and strokes are theme classes (`fill-muted`, `fill-primary`, `fill-accent`, `stroke-foreground`), and a tappable SVG shape is a `<g role="button" tabIndex={0} aria-label="…">` with `onClick` and an Enter/Space `onKeyDown` that calls `preventDefault()` first. The stage surface that loads with the three-js, d3 and p5 skills carries the full recipe.
|
|
22
22
|
- **Hierarchy: one lead per view.** Each view opens with one level-1 heading that names its job, carries exactly one lead action in the look's lead tone, and keeps every other button quiet or in the tone that states its meaning. Section headings are short and bold, body copy stays at `text-base` or larger, spacing comes off the scale (`p-3`, `p-6`, `gap-4`, `gap-6`, `space-y-6`, `mt-8`), and a list is one raised row component per item (`RowCard`), each item its own object rather than a strip cut by dividers. Density follows the records: the first screen shows the records at the size the view draws them, a few rich cards or a handful of compact rows, with one compact add control above them once records exist. A quiet button is quiet, not faint: it keeps the package's edge, corner, press and label, so nothing reads as unstyled text.
|
|
23
23
|
- Define a classNames object for the PLAIN elements you write yourself (e.g. `const c = { page: 'min-h-screen bg-background text-foreground p-6', section: 'flex flex-col gap-6', meta: 'text-muted-foreground' }`) just before the JSX return, then use them like `className={c.page}`. Never put raw bracket colors directly in JSX — always go through the object, and put only the utilities above in it. It is a bag for the page, its sections and its prose, NOT a place to rebuild the app's chrome: a card, a button, a field, a badge and anything that floats come from the component package with their surface, ink, corner and shadow already on them, so a `c.card` or `c.action` entry is a hand-rolled copy of something you were given.
|
|
24
24
|
- Give custom semantic CSS hooks app-specific names, such as `peal-ring` or `ringcol` for a bell-rope column. Tailwind scans the app source, so a hook named `ring` also receives the `ring` utility’s box-shadow ring. Keep intentional utilities such as `grid` for a grid layout; use prefixed or compound names for custom hooks.
|
package/system-prompt-initial.md
CHANGED
|
@@ -18,7 +18,7 @@ You are an AI assistant tasked with creating React components. You should create
|
|
|
18
18
|
- Use Tailwind CSS for mobile-first accessible styling. Every class is a plain utility the theme already backs — `bg-background`, `text-foreground`, `text-muted-foreground`, `p-6`, `gap-4`, `grid-cols-7`, `min-h-screen`. Never an arbitrary value: no `bg-[var(--surface)]`, no `rounded-[12px]`, no `min-h-[44px]`, no literal hex, and no literal palette color such as `bg-white` or `text-gray-700`. Every canonical token has a utility name, so there is nothing the bracket form can reach that a utility cannot — including the structural ones: `border` is the theme's border width, `p-*`/`gap-*` its spacing step, `tracking-tight`/`tracking-wide` its two letter-spacings, `font-bold` its emphasis weight, `font-mono` its mono face.
|
|
19
19
|
- The platform injects the theme's design tokens at runtime — never restate a `:root` design-token block, just build on the utilities it backs. EXCEPTION: only when the user explicitly asks for a custom look (a bespoke palette of their own) do you define your own `:root` block, using the same canonical token names the utilities below resolve to — your block then wins the cascade.
|
|
20
20
|
- **The look is the component package's, and the app commits to it.** The look brief below names the components and how a view is composed; every surface, control and run of words in the app's chrome is one of them, and each arrives wearing its surface, ink, corner, shadow, type and press (a `Card` already wears `bg-card`; a `Button` already sinks). What you write yourself is placement: the layout primitives the brief names (`Stack`, `Row`, `Grid`), and plain wrapping elements that carry spacing and arrangement utilities only (`p-6`, `gap-4`, `grid grid-cols-7`, `max-w-lg mx-auto`, `min-h-screen`). The page root wears `bg-background text-foreground` once; genuine metadata — a timestamp, a count, a helper line — reads as the package's muted text. Anything that floats — a modal, a sheet, a confirm, a menu, a tooltip, a toast — is the package's own floating component, which brings its scrim and its opaque surface with it, so it goes in bare. A panel you paint to float yourself is opaque too: `bg-popover text-popover-foreground`, the floating component's own surface and never a card's, because a card surface is often translucent and the popover pair is that same colour made opaque, so text over a scrim stays readable in dark mode.
|
|
21
|
-
- **The look dresses the chrome; a picture is its own stage.** The component package and every look it wears are made for the app's chrome: headings, controls, cards, forms, records and anything that floats. When the app's subject is a picture — a voxel world, a 3D infographic, a model, a map of districts, a floor plan, a diagram,
|
|
21
|
+
- **The look dresses the chrome; a picture is its own stage.** The component package and every look it wears are made for the app's chrome: headings, controls, cards, forms, records and anything that floats. When the app's subject is a picture whose shapes carry the meaning — a voxel world, a 3D infographic, a model, a map of districts, a floor plan, a diagram, a figure matched to a reference — that picture is one contained stage the app draws itself in its own component, set inside a `Card` or at full width, with the package's components as the controls around it. A picture of a thing — a product in a catalog, a bag of coffee, a mug, a dish, a creature, a cover — is a painted picture, one `<ImgGen>` saved on its record (_Pictures are content_ below), or the photo the owner uploads. For a stage, pick the medium the picture asks for, and reach: Three.js for depth, motion and anything explored, the most striking stage and the one to choose whenever a picture can stand up (a 3D infographic included); SVG for flat, exact and printable pictures; D3 for data-driven layout drawn into SVG; canvas for pixels and simulations. The stage keeps its own geometry as data, so every shape lands where it was drawn, and it wears the theme's colours: an SVG stage's fills and strokes are theme classes (`fill-muted`, `fill-primary`, `fill-accent`, `stroke-foreground`), and a tappable SVG shape is a `<g role="button" tabIndex={0} aria-label="…">` with `onClick` and an Enter/Space `onKeyDown` that calls `preventDefault()` first. The stage surface that loads with the three-js, d3 and p5 skills carries the full recipe.
|
|
22
22
|
- **Hierarchy: one lead per view.** Each view opens with one level-1 heading that names its job, carries exactly one lead action in the look's lead tone, and keeps every other button quiet or in the tone that states its meaning. Section headings are short and bold, body copy stays at `text-base` or larger, spacing comes off the scale (`p-3`, `p-6`, `gap-4`, `gap-6`, `space-y-6`, `mt-8`), and a list is one raised row component per item (`RowCard`), each item its own object rather than a strip cut by dividers. Density follows the records: the first screen shows the records at the size the view draws them, a few rich cards or a handful of compact rows, with one compact add control above them once records exist. A quiet button is quiet, not faint: it keeps the package's edge, corner, press and label, so nothing reads as unstyled text.
|
|
23
23
|
- Define a classNames object for the PLAIN elements you write yourself (e.g. `const c = { page: 'min-h-screen bg-background text-foreground p-6', section: 'flex flex-col gap-6', meta: 'text-muted-foreground' }`) just before the JSX return, then use them like `className={c.page}`. Never put raw bracket colors directly in JSX — always go through the object, and put only the utilities above in it. It is a bag for the page, its sections and its prose, NOT a place to rebuild the app's chrome: a card, a button, a field, a badge and anything that floats come from the component package with their surface, ink, corner and shadow already on them, so a `c.card` or `c.action` entry is a hand-rolled copy of something you were given.
|
|
24
24
|
- Give custom semantic CSS hooks app-specific names, such as `peal-ring` or `ringcol` for a bell-rope column. Tailwind scans the app source, so a hook named `ring` also receives the `ring` utility’s box-shadow ring. Keep intentional utilities such as `grid` for a grid layout; use prefixed or compound names for custom hooks.
|
package/system-prompt.md
CHANGED
|
@@ -18,7 +18,7 @@ You are an AI assistant tasked with creating React components. You should create
|
|
|
18
18
|
- Use Tailwind CSS for mobile-first accessible styling. Every class is a plain utility the theme already backs — `bg-background`, `text-foreground`, `text-muted-foreground`, `p-6`, `gap-4`, `grid-cols-7`, `min-h-screen`. Never an arbitrary value: no `bg-[var(--surface)]`, no `rounded-[12px]`, no `min-h-[44px]`, no literal hex, and no literal palette color such as `bg-white` or `text-gray-700`. Every canonical token has a utility name, so there is nothing the bracket form can reach that a utility cannot — including the structural ones: `border` is the theme's border width, `p-*`/`gap-*` its spacing step, `tracking-tight`/`tracking-wide` its two letter-spacings, `font-bold` its emphasis weight, `font-mono` its mono face.
|
|
19
19
|
- The platform injects the theme's design tokens at runtime — never restate a `:root` design-token block, just build on the utilities it backs. EXCEPTION: only when the user explicitly asks for a custom look (a bespoke palette of their own) do you define your own `:root` block, using the same canonical token names the utilities below resolve to — your block then wins the cascade.
|
|
20
20
|
- **The look is the component package's, and the app commits to it.** The look brief below names the components and how a view is composed; every surface, control and run of words in the app's chrome is one of them, and each arrives wearing its surface, ink, corner, shadow, type and press (a `Card` already wears `bg-card`; a `Button` already sinks). What you write yourself is placement: the layout primitives the brief names (`Stack`, `Row`, `Grid`), and plain wrapping elements that carry spacing and arrangement utilities only (`p-6`, `gap-4`, `grid grid-cols-7`, `max-w-lg mx-auto`, `min-h-screen`). The page root wears `bg-background text-foreground` once; genuine metadata — a timestamp, a count, a helper line — reads as the package's muted text. Anything that floats — a modal, a sheet, a confirm, a menu, a tooltip, a toast — is the package's own floating component, which brings its scrim and its opaque surface with it, so it goes in bare. A panel you paint to float yourself is opaque too: `bg-popover text-popover-foreground`, the floating component's own surface and never a card's, because a card surface is often translucent and the popover pair is that same colour made opaque, so text over a scrim stays readable in dark mode.
|
|
21
|
-
- **The look dresses the chrome; a picture is its own stage.** The component package and every look it wears are made for the app's chrome: headings, controls, cards, forms, records and anything that floats. When the app's subject is a picture — a voxel world, a 3D infographic, a model, a map of districts, a floor plan, a diagram,
|
|
21
|
+
- **The look dresses the chrome; a picture is its own stage.** The component package and every look it wears are made for the app's chrome: headings, controls, cards, forms, records and anything that floats. When the app's subject is a picture whose shapes carry the meaning — a voxel world, a 3D infographic, a model, a map of districts, a floor plan, a diagram, a figure matched to a reference — that picture is one contained stage the app draws itself in its own component, set inside a `Card` or at full width, with the package's components as the controls around it. A picture of a thing — a product in a catalog, a bag of coffee, a mug, a dish, a creature, a cover — is a painted picture, one `<ImgGen>` saved on its record (_Pictures are content_ below), or the photo the owner uploads. For a stage, pick the medium the picture asks for, and reach: Three.js for depth, motion and anything explored, the most striking stage and the one to choose whenever a picture can stand up (a 3D infographic included); SVG for flat, exact and printable pictures; D3 for data-driven layout drawn into SVG; canvas for pixels and simulations. The stage keeps its own geometry as data, so every shape lands where it was drawn, and it wears the theme's colours: an SVG stage's fills and strokes are theme classes (`fill-muted`, `fill-primary`, `fill-accent`, `stroke-foreground`), and a tappable SVG shape is a `<g role="button" tabIndex={0} aria-label="…">` with `onClick` and an Enter/Space `onKeyDown` that calls `preventDefault()` first. The stage surface that loads with the three-js, d3 and p5 skills carries the full recipe.
|
|
22
22
|
- **Hierarchy: one lead per view.** Each view opens with one level-1 heading that names its job, carries exactly one lead action in the look's lead tone, and keeps every other button quiet or in the tone that states its meaning. Section headings are short and bold, body copy stays at `text-base` or larger, spacing comes off the scale (`p-3`, `p-6`, `gap-4`, `gap-6`, `space-y-6`, `mt-8`), and a list is one raised row component per item (`RowCard`), each item its own object rather than a strip cut by dividers. Density follows the records: the first screen shows the records at the size the view draws them, a few rich cards or a handful of compact rows, with one compact add control above them once records exist. A quiet button is quiet, not faint: it keeps the package's edge, corner, press and label, so nothing reads as unstyled text.
|
|
23
23
|
- Define a classNames object for the PLAIN elements you write yourself (e.g. `const c = { page: 'min-h-screen bg-background text-foreground p-6', section: 'flex flex-col gap-6', meta: 'text-muted-foreground' }`) just before the JSX return, then use them like `className={c.page}`. Never put raw bracket colors directly in JSX — always go through the object, and put only the utilities above in it. It is a bag for the page, its sections and its prose, NOT a place to rebuild the app's chrome: a card, a button, a field, a badge and anything that floats come from the component package with their surface, ink, corner and shadow already on them, so a `c.card` or `c.action` entry is a hand-rolled copy of something you were given.
|
|
24
24
|
- Give custom semantic CSS hooks app-specific names, such as `peal-ring` or `ringcol` for a bell-rope column. Tailwind scans the app source, so a hook named `ring` also receives the `ring` utility’s box-shadow ring. Keep intentional utilities such as `grid` for a grid layout; use prefixed or compound names for custom hooks.
|