@vibes.diy/prompts 14.3.205 → 14.3.207

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 CHANGED
@@ -57,7 +57,9 @@ the declared fallback, with its freshness and failure visible in saved status.
57
57
  heading naming `backend.js`, then one **complete** fenced block below it (the
58
58
  whole file — don't use SEARCH/REPLACE for it; re-emit the full file to change
59
59
  it). **Never put backend code inside an `App.jsx` block**, and never import
60
- `backend.js` from `App.jsx` — the browser can't run it.
60
+ `backend.js` from `App.jsx` — the browser can't run it. Each handler is a
61
+ top-level export (`export async function fetch(request, ctx)`, `scheduled`,
62
+ `onChange`); a `backend.js` that exports none of them saves as an error.
61
63
 
62
64
  ## Writes go through the access function
63
65
 
@@ -474,6 +476,22 @@ const stripe = await ctx.stripe.status(); // { test: { available, state }, live:
474
476
  a `ctx.fetch()` fired while a streamed body is still being pulled after the
475
477
  handler returned is unsupported and gets denied. Interactive frontend AI
476
478
  calls stay in `App.jsx` via `callAI`; server-side AI belongs to `ctx.callAI`.
479
+
480
+ **A server the person runs themselves is reached at its https address.** A
481
+ media server, a home dashboard, a NAS or a printer on their own network works
482
+ from a vibe once it answers at a public `https://` name: every vibe is served
483
+ over https, so the page and `ctx.fetch` both call https hosts. The person gets
484
+ that address from the server's own https setting, a reverse proxy with a
485
+ certificate in front of it, or a tunnel that gives the server a public https
486
+ name. Say that in your first reply, before the build, so the person can set
487
+ the address up while the app is being made. The app's connect form takes the
488
+ server's https address (placeholder `https://media.example.com`), saves it
489
+ with the person's other settings, and its helper line names those three ways
490
+ to get one. A call carrying the person's token, and any write, travels the
491
+ CORS lane: the server admits the app's origin in its CORS settings (media
492
+ servers usually have one), and the page calls it straight with that token. A
493
+ plain public read (a `GET` with no credentials) also works from a
494
+ `backend.js` route at that https address, through the read lane above.
477
495
  - **`ctx.callAI(prompt, options?)` is the server-side AI call.** It resolves to
478
496
  the completion **text** (a plain string) — no API key needed and none exists
479
497
  in the handler; the platform makes the call and meters the cost against the
package/llms/stripe.js CHANGED
@@ -31,5 +31,21 @@ export const stripeConfig = {
31
31
  "donations",
32
32
  "pay with stripe",
33
33
  ],
34
+ routeCues: [
35
+ "with stripe",
36
+ "through stripe",
37
+ "via stripe",
38
+ "using stripe",
39
+ "stripe checkout",
40
+ "stripe account",
41
+ "pay by card",
42
+ "pays by card",
43
+ "pay with card",
44
+ "card payment",
45
+ "card payments",
46
+ "take payments",
47
+ "accept payments",
48
+ ],
49
+ routeBlockers: ["subscribe", "subscription", "subscriptions", "a month", "per month", "monthly"],
34
50
  };
35
51
  //# sourceMappingURL=stripe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.js","sourceRoot":"","sources":["../../jsr/llms/stripe.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,iBAAiB;IACxB,WAAW,EACT,s8DAAs8D;IACx8D,IAAI,EAAE;QACJ,QAAQ;QACR,eAAe;QACf,cAAc;QACd,iBAAiB;QACjB,eAAe;QACf,cAAc;QACd,aAAa;QACb,UAAU;QACV,SAAS;QACT,MAAM;QACN,cAAc;QACd,SAAS;QACT,YAAY;QACZ,iBAAiB;QACjB,iBAAiB;QACjB,QAAQ;QACR,SAAS;QACT,cAAc;QACd,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,oBAAoB;QACpB,SAAS;QACT,QAAQ;QACR,UAAU;QACV,WAAW;QACX,iBAAiB;KAClB;CACF,CAAC"}
1
+ {"version":3,"file":"stripe.js","sourceRoot":"","sources":["../../jsr/llms/stripe.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,iBAAiB;IACxB,WAAW,EACT,s8DAAs8D;IACx8D,IAAI,EAAE;QACJ,QAAQ;QACR,eAAe;QACf,cAAc;QACd,iBAAiB;QACjB,eAAe;QACf,cAAc;QACd,aAAa;QACb,UAAU;QACV,SAAS;QACT,MAAM;QACN,cAAc;QACd,SAAS;QACT,YAAY;QACZ,iBAAiB;QACjB,iBAAiB;QACjB,QAAQ;QACR,SAAS;QACT,cAAc;QACd,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,oBAAoB;QACpB,SAAS;QACT,QAAQ;QACR,UAAU;QACV,WAAW;QACX,iBAAiB;KAClB;IAKD,SAAS,EAAE;QACT,aAAa;QACb,gBAAgB;QAChB,YAAY;QACZ,cAAc;QACd,iBAAiB;QACjB,gBAAgB;QAChB,aAAa;QACb,cAAc;QACd,eAAe;QACf,cAAc;QACd,eAAe;QACf,eAAe;QACf,iBAAiB;KAClB;IAGD,aAAa,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC;CACjG,CAAC"}
package/llms/stripe.md CHANGED
@@ -221,9 +221,10 @@ Every order records the mode it was made in, and every ctx.stripe.fetch call for
221
221
  - `client_reference_id` and `metadata[orderId]` both carry the order's `_id`, so
222
222
  the session names the order from Stripe's side too.
223
223
  - `success_url` and `cancel_url` are the app's public address with the order in
224
- the fragment: `https://vibes.diy/vibe/<owner>/<slug>#paid=<orderId>` and
225
- `#cancelled=<orderId>`. The fragment never reaches the server, so the return
226
- page is the fast cached one.
224
+ the fragment: `https://vibes.diy/vibe/<owner>/<slug>#paid=<orderId>&total=<amount>&currency=<currency>`
225
+ and `#cancelled=<orderId>`. The fragment never reaches the server, so the return
226
+ page is the fast cached one, and the amount in it lets that page thank the
227
+ buyer at once (see *The return*).
227
228
  - `Idempotency-Key` is the order's `_id`, so a retried request mints one session,
228
229
  not two. And a second press for the same thing reuses the open attempt: the
229
230
  route looks for this buyer's pending order of the same bag at the prices it
@@ -281,6 +282,14 @@ Two things settle an order, and both are the backend reading
281
282
  A session whose `status` is `"expired"` moves the order to `expired`. Anything
282
283
  else leaves it pending.
283
284
 
285
+ The return page thanks the buyer from its address before it asks the backend: the success_url carries the amount, the page shows "Payment received" with it on its first render, and `/confirm` runs behind it, changing the line to "still confirming" only if the order comes back unpaid.
286
+
287
+ That line is display, so taking it from the address is safe: someone who types
288
+ `#paid=` into their own address bar only fools themselves, and the order's paid
289
+ state still comes from the read-back, never from the URL. Waiting on `/confirm`
290
+ before saying anything leaves a buyer who just paid looking at an unchanged shop
291
+ for the length of a Stripe round trip.
292
+
284
293
  A scheduled sweep settles every order still pending by reading its session back from Stripe, so a buyer who closes the tab is still marked paid.
285
294
 
286
295
  Settling is idempotent: the backend reads the order first, and an order that is no longer pending comes back as it is, with ok.
@@ -546,7 +555,8 @@ export async function fetch(request, ctx) {
546
555
  mode: "payment",
547
556
  client_reference_id: id,
548
557
  "metadata[orderId]": id,
549
- success_url: appUrl(ctx, `#paid=${id}`),
558
+ // The amount rides in the fragment so the return page can thank the buyer before /confirm answers.
559
+ success_url: appUrl(ctx, `#paid=${id}&total=${order.amount}&currency=${order.currency}`),
550
560
  cancel_url: appUrl(ctx, `#cancelled=${id}`),
551
561
  });
552
562
  // One Stripe line per bag line, so the buyer's receipt lists what they bought.
@@ -793,16 +803,29 @@ export default function App() {
793
803
  const setup = useSetup();
794
804
  const [picked, setPicked] = useState(null);
795
805
  const [error, setError] = useState(null);
806
+ // The order the buyer just came back from, and the line that thanks them for it.
807
+ const [back, setBack] = useState(null);
796
808
 
797
- // Back from Stripe: ask the backend to read the session and settle the order. The wrapper hands
798
- // the app its fragment just after first render and fires hashchange, so read the hash now AND on
799
- // every change — a mount-only read can miss it.
809
+ // Back from Stripe: thank the buyer from the address at once, then ask the backend to read the
810
+ // session and settle the order. The wrapper hands the app its fragment just after first render and
811
+ // fires hashchange, so read the hash now AND on every change — a mount-only read can miss it.
800
812
  useEffect(() => {
801
813
  const confirm = () => {
802
- const m = /#paid=([\w-]+)/.exec(location.hash);
803
- if (!m) return;
814
+ const params = new URLSearchParams(location.hash.slice(1));
815
+ const orderId = params.get("paid");
816
+ if (!orderId) return;
804
817
  history.replaceState(null, "", location.pathname);
805
- apiFetch("/confirm", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ orderId: m[1] }) });
818
+ const total = Number(params.get("total") ?? "x"); // NaN when the address carries no amount
819
+ const currency = params.get("currency") ?? "usd";
820
+ // Display only: the order's paid state comes from /confirm's read-back, never from this URL.
821
+ const thanks = Number.isInteger(total) ? `Payment received: ${money(total, currency)}. Thank you!` : "Payment received. Thank you!";
822
+ setBack({ orderId, thanks, confirming: false });
823
+ apiFetch("/confirm", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ orderId }) })
824
+ .then((r) => r.json())
825
+ .then((d) => {
826
+ if (d.status !== "paid") setBack({ orderId, thanks, confirming: true });
827
+ })
828
+ .catch(() => setBack({ orderId, thanks, confirming: true }));
806
829
  };
807
830
  confirm();
808
831
  window.addEventListener("hashchange", confirm);
@@ -865,6 +888,17 @@ export default function App() {
865
888
  ) : (
866
889
  <Stack>
867
890
  <Heading>Shop</Heading>
891
+ {/* The live order settles the line: once the sweep marks it paid, "still confirming" goes away. */}
892
+ {back && (
893
+ <Text>
894
+ {(() => {
895
+ const status = orders.find((o) => o._id === back.orderId)?.status;
896
+ if (status === "expired") return "That checkout closed before it was paid. Press Pay to start a fresh one.";
897
+ if (back.confirming && status !== "paid") return "Your payment is still confirming. It shows here as paid in a moment.";
898
+ return back.thanks;
899
+ })()}
900
+ </Text>
901
+ )}
868
902
  {forSale.length === 0 ? (
869
903
  <Text muted>{setup?.owner ? "Nothing is for sale yet. Add what you sell under Products." : "Nothing for sale yet."}</Text>
870
904
  ) : ready ? (
@@ -194,10 +194,13 @@ The one-line hint follows the current view.
194
194
 
195
195
  The ☰ menu holds everything else, in this order: the views by name, fullscreen, how to play,
196
196
  who else is here and what they did lately (players and activity), then invite a friend and all
197
- worlds.
197
+ worlds. Every world's menu carries the first three: the views, a Fullscreen entry that fills the
198
+ phone with the world (`requestFullscreen()` on the root, from the tap itself), and a How to play
199
+ entry that keeps the gestures one tap away after the hint has moved on.
198
200
 
199
201
  **The desktop twin is the same world.** In the player views a click-to-play overlay calls
200
202
  `requestLock()`, so the mouse looks under pointer lock; WASD or the arrows walk and Space jumps.
203
+ The V key cycles the views just as the 🎥 button does, once per press, and the overlay's control legend names it (`V views`).
201
204
  `locked` reports the lock, so the overlay comes back when the player presses Esc, and `isTouch`
202
205
  keeps the overlay off phones. While locked, a click under the crosshair is the tap and a
203
206
  right-click is the hold (`onTap` / `onHold` at the screen centre). Free cam needs no lock: drag
@@ -224,6 +227,8 @@ export default function App() {
224
227
  const [camera] = React.useState(() => new THREE.PerspectiveCamera(70, 1, 0.1, 500));
225
228
  const [view, setView] = React.useState(() => (matchMedia("(pointer: coarse)").matches ? "Free cam" : "First person"));
226
229
  const [menuOpen, setMenuOpen] = React.useState(false);
230
+ const [howTo, setHowTo] = React.useState(false);
231
+ const [full, setFull] = React.useState(false);
227
232
  const me = React.useRef({ pos: new THREE.Vector3(0, 0, 12), yaw: 0, pitch: 0, move: [0, 0], vy: 0, zoom: 34 });
228
233
  const world = React.useRef({ hedges: [] });
229
234
 
@@ -315,7 +320,25 @@ export default function App() {
315
320
  };
316
321
  }, [camera]);
317
322
 
318
- const cycle = () => setView(VIEWS[(VIEWS.indexOf(view) + 1) % VIEWS.length]);
323
+ const cycle = () => setView((v) => VIEWS[(VIEWS.indexOf(v) + 1) % VIEWS.length]);
324
+ React.useEffect(() => {
325
+ // V cycles the views on a keyboard, once per press; a text field keeps its own V.
326
+ const onKey = (e) => {
327
+ if (e.code !== "KeyV" || e.repeat || e.target.closest?.("input, textarea, [contenteditable]")) return;
328
+ cycle();
329
+ };
330
+ const onFull = () => setFull(document.fullscreenElement !== null);
331
+ addEventListener("keydown", onKey);
332
+ document.addEventListener("fullscreenchange", onFull);
333
+ return () => {
334
+ removeEventListener("keydown", onKey);
335
+ document.removeEventListener("fullscreenchange", onFull);
336
+ };
337
+ }, []);
338
+ const toggleFullscreen = () => {
339
+ if (document.fullscreenElement) document.exitFullscreen();
340
+ else if (document.fullscreenEnabled) rootRef.current.requestFullscreen().catch(() => {});
341
+ };
319
342
  return (
320
343
  <div ref={rootRef} className="relative h-dvh w-full overflow-hidden bg-background text-foreground select-none touch-none">
321
344
  <canvas ref={canvasRef} className="absolute inset-0 block w-full h-full select-none touch-none" />
@@ -336,9 +359,18 @@ export default function App() {
336
359
  {v}
337
360
  </Button>
338
361
  ))}
339
- <Text size="sm" muted>
340
- Left thumb walks, right thumb looks. Tap a hedge to bloom it, hold to trim it, flick up to jump.
341
- </Text>
362
+ <Button variant="quiet" onClick={toggleFullscreen}>
363
+ {full ? "Exit fullscreen" : "Fullscreen"}
364
+ </Button>
365
+ <Button variant="quiet" onClick={() => setHowTo(!howTo)}>
366
+ How to play
367
+ </Button>
368
+ {howTo && (
369
+ <Text size="sm" muted>
370
+ Left thumb walks, right thumb looks. Tap a hedge to bloom it, hold to trim it, flick up to jump. On a
371
+ keyboard, V changes the view.
372
+ </Text>
373
+ )}
342
374
  </Stack>
343
375
  </Card>
344
376
  </div>
@@ -352,7 +384,7 @@ export default function App() {
352
384
  Click to play
353
385
  </Button>
354
386
  <Text size="sm" muted>
355
- WASD walk · mouse look · Space jump · click bloom · Esc frees the mouse
387
+ WASD walk · mouse look · Space jump · click bloom · V views · Esc frees the mouse
356
388
  </Text>
357
389
  </Stack>
358
390
  </Card>
package/llms/types.d.ts CHANGED
@@ -4,6 +4,8 @@ export interface LlmConfig {
4
4
  label: string;
5
5
  description: string;
6
6
  cues?: string[];
7
+ routeCues?: string[];
8
+ routeBlockers?: string[];
7
9
  importModule?: string;
8
10
  importName?: string;
9
11
  importType?: "named" | "namespace" | "default";
package/llms/voxel.md CHANGED
@@ -422,14 +422,13 @@ and nothing happens, or they don't know the mouse controls the camera at all.
422
422
  and only request lock from that click: its button calls the hook's `requestLock()`, and the hook's
423
423
  `locked` brings the overlay back when the player presses Esc. The overlay JSX is in `touch-games`;
424
424
  the voxel legend reads "WASD move · Mouse look · Shift sprint · Space jump · Click build ·
425
- Right-click break · G fly · 1–9 blocks".
425
+ Right-click break · G fly · V views · 1–9 blocks".
426
426
 
427
427
  ### View switcher: see your own character
428
428
 
429
429
  Include a view switcher between first-person and third-person so players can see their own avatar.
430
- The 🎥 camera button outside the menu cycles **Free cam → First person → Shoulder view**, and a
431
- keyboard shortcut (e.g. `V`, shown in the control legend) does the same; toggle once per press,
432
- ignoring key repeat. On a phone the world opens in Free cam, an overview that frames the island;
430
+ The 🎥 camera button outside the menu cycles **Free cam → First person → Shoulder view**, and the V key cycles them the same way on a keyboard, named in the control legend as `V views`.
431
+ Toggle once per press, ignoring key repeat. On a phone the world opens in Free cam, an overview that frames the island;
433
432
  back its radius off on a narrow screen as `touch-games` shows.
434
433
  Render a simple blocky local-player avatar in third-person, following
435
434
  the player's position and heading, and hide it in first-person so it does not
@@ -439,10 +438,10 @@ terrain blocks the view. Preserve aiming and the player's block-interaction
439
438
  reach as the camera moves. Keep the button reachable when pointer lock is
440
439
  released, and let the shortcut switch views during locked play.
441
440
 
442
- ### Optional fullscreen: keep the HUD with the world
441
+ ### Fullscreen in the menu: keep the HUD with the world
443
442
 
444
- Offer an optional fullscreen button for a larger play area; the Vibes iframe allows fullscreen.
445
- When included, call `requestFullscreen()` directly from the button's user
443
+ The ☰ menu offers a Fullscreen entry for a larger play area, right after the views and before How to play; the Vibes iframe allows fullscreen.
444
+ Call `requestFullscreen()` directly from the entry's user
446
445
  gesture on the game container that includes both the canvas and HUD. Check
447
446
  `document.fullscreenEnabled` and method availability, and handle a rejected
448
447
  request by keeping play usable in the embedded view. Derive the Enter/Exit
@@ -457,8 +456,8 @@ when needed. Remove the fullscreen listener on unmount.
457
456
  The world fills the screen (the `CanvasStage` above is `absolute inset-0` inside a
458
457
  `relative h-dvh w-full` root). Keep the crosshair, the block chip (the material in hand; a tap
459
458
  opens the palette), the hotbar (1–9 and 0 on a keyboard), undo and the 🎥 camera button on screen;
460
- put the title, settings, crafting recipes, the world-reset control and the player list behind
461
- **one** top-right menu button (`IconButton`) that toggles an overlay. The bottom-right corner
459
+ put everything else behind **one** top-right menu button (`IconButton`) that toggles an overlay.
460
+ The menu opens with the views by name, then Fullscreen, then How to play (the gestures and keys, one tap away once the hint has moved on), then the title, settings, crafting recipes, the world-reset control and the player list. The bottom-right corner
462
461
  belongs to the platform. A smaller boxed world is only for when the person asks for one.
463
462
 
464
463
  ### No text selection on the game surface
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/prompts",
3
- "version": "14.3.205",
3
+ "version": "14.3.207",
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.205",
43
- "@vibes.diy/call-ai-v2": "14.3.205",
44
- "@vibes.diy/identity": "14.3.205",
45
- "@vibes.diy/use-vibes-types": "14.3.205",
42
+ "@vibes.diy/api-types": "14.3.207",
43
+ "@vibes.diy/call-ai-v2": "14.3.207",
44
+ "@vibes.diy/identity": "14.3.207",
45
+ "@vibes.diy/use-vibes-types": "14.3.207",
46
46
  "arktype": "~2.2.8",
47
47
  "json-schema-faker": "~0.6.3"
48
48
  },
@@ -515,6 +515,10 @@ Static assets. Files the maker added in the Files tab (or pushed with the CLI) a
515
515
 
516
516
  When an app works on the contents of a URL the person types — scanning it, checking it, scoring it, summarizing it — that address is read server-side: a `backend.js` `fetch` handler reads it with `ctx.fetch` and the page asks `/_api/…` for the text, because a page in a browser reaches its own app and the hosts that invite it. If that read comes back empty or fails, the app says so where the result goes, before anything worked out without it appears.
517
517
 
518
+ ### Connecting to a server the person runs
519
+
520
+ An app for a server the person runs themselves — a media server, a home dashboard, a NAS — connects to it at its https address, because the app is served over https and calls https hosts. The connect form asks for the server's https address, opening empty with the placeholder `https://media.example.com`, and saves it with the person's settings, and its helper line names the three ways to get one: the server's own https setting, a reverse proxy with a certificate, or a tunnel that gives the server a public https name.
521
+
518
522
  ## End every turn with one improvement question
519
523
 
520
524
  After your code edits, end your response with exactly ONE short improvement question and 2–4 multiple-choice options.
@@ -517,6 +517,10 @@ Static assets. Files the maker added in the Files tab (or pushed with the CLI) a
517
517
 
518
518
  When an app works on the contents of a URL the person types — scanning it, checking it, scoring it, summarizing it — that address is read server-side: a `backend.js` `fetch` handler reads it with `ctx.fetch` and the page asks `/_api/…` for the text, because a page in a browser reaches its own app and the hosts that invite it. If that read comes back empty or fails, the app says so where the result goes, before anything worked out without it appears.
519
519
 
520
+ ### Connecting to a server the person runs
521
+
522
+ An app for a server the person runs themselves — a media server, a home dashboard, a NAS — connects to it at its https address, because the app is served over https and calls https hosts. The connect form asks for the server's https address, opening empty with the placeholder `https://media.example.com`, and saves it with the person's settings, and its helper line names the three ways to get one: the server's own https setting, a reverse proxy with a certificate, or a tunnel that gives the server a public https name.
523
+
520
524
  ## End every turn with one improvement question
521
525
 
522
526
  After your code edits, end your response with exactly ONE short improvement question and 2–4 multiple-choice options.
package/system-prompt.md CHANGED
@@ -822,6 +822,10 @@ Static assets. Files the maker added in the Files tab (or pushed with the CLI) a
822
822
 
823
823
  When an app works on the contents of a URL the person types — scanning it, checking it, scoring it, summarizing it — that address is read server-side: a `backend.js` `fetch` handler reads it with `ctx.fetch` and the page asks `/_api/…` for the text, because a page in a browser reaches its own app and the hosts that invite it. If that read comes back empty or fails, the app says so where the result goes, before anything worked out without it appears.
824
824
 
825
+ ### Connecting to a server the person runs
826
+
827
+ An app for a server the person runs themselves — a media server, a home dashboard, a NAS — connects to it at its https address, because the app is served over https and calls https hosts. The connect form asks for the server's https address, opening empty with the placeholder `https://media.example.com`, and saves it with the person's settings, and its helper line names the three ways to get one: the server's own https setting, a reverse proxy with a certificate, or a tunnel that gives the server a public https name.
828
+
825
829
  ## End every turn with one improvement question
826
830
 
827
831
  After your code edits, end your response with exactly ONE short improvement question and 2–4 multiple-choice options.