@vibes.diy/prompts 14.3.249 → 14.3.251

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.
Files changed (137) hide show
  1. package/generation-variety.js +1 -1
  2. package/index.d.ts +1 -1
  3. package/index.js +1 -1
  4. package/index.js.map +1 -1
  5. package/llms/backend.js +1 -0
  6. package/llms/backend.js.map +1 -1
  7. package/llms/blockly.js +1 -0
  8. package/llms/blockly.js.map +1 -1
  9. package/llms/blockly.md +2 -3
  10. package/llms/bluesky.js +2 -0
  11. package/llms/bluesky.js.map +1 -1
  12. package/llms/board-games.js +9 -4
  13. package/llms/board-games.js.map +1 -1
  14. package/llms/board-games.md +3 -153
  15. package/llms/callai.js +1 -0
  16. package/llms/callai.js.map +1 -1
  17. package/llms/callai.md +1 -1
  18. package/llms/canvas-theme-colors.d.ts +2 -0
  19. package/llms/canvas-theme-colors.js +7 -0
  20. package/llms/canvas-theme-colors.js.map +1 -0
  21. package/llms/canvas-theme-colors.md +70 -0
  22. package/llms/image-gen.js +1 -0
  23. package/llms/image-gen.js.map +1 -1
  24. package/llms/image-gen.md +1 -1
  25. package/llms/index.d.ts +24 -2
  26. package/llms/index.js +64 -0
  27. package/llms/index.js.map +1 -1
  28. package/llms/keepsake.d.ts +2 -0
  29. package/llms/keepsake.js +9 -0
  30. package/llms/keepsake.js.map +1 -0
  31. package/llms/keepsake.md +74 -0
  32. package/llms/live-rooms.d.ts +2 -0
  33. package/llms/live-rooms.js +28 -0
  34. package/llms/live-rooms.js.map +1 -0
  35. package/llms/live-rooms.md +288 -0
  36. package/llms/media-capture.d.ts +2 -0
  37. package/llms/media-capture.js +27 -0
  38. package/llms/media-capture.js.map +1 -0
  39. package/llms/media-capture.md +190 -0
  40. package/llms/mic-capture.d.ts +2 -0
  41. package/llms/mic-capture.js +7 -0
  42. package/llms/mic-capture.js.map +1 -0
  43. package/llms/mic-capture.md +76 -0
  44. package/llms/needs.d.ts +12 -0
  45. package/llms/needs.js +71 -0
  46. package/llms/needs.js.map +1 -0
  47. package/llms/owner-secret.d.ts +2 -0
  48. package/llms/owner-secret.js +8 -0
  49. package/llms/owner-secret.js.map +1 -0
  50. package/llms/owner-secret.md +82 -0
  51. package/llms/p5.js +1 -0
  52. package/llms/p5.js.map +1 -1
  53. package/llms/p5.md +15 -69
  54. package/llms/photo-input.d.ts +2 -0
  55. package/llms/photo-input.js +7 -0
  56. package/llms/photo-input.js.map +1 -0
  57. package/llms/photo-input.md +141 -0
  58. package/llms/physics.js +1 -0
  59. package/llms/physics.js.map +1 -1
  60. package/llms/physics.md +7 -16
  61. package/llms/reskin.js +3 -8
  62. package/llms/reskin.js.map +1 -1
  63. package/llms/reskin.md +12 -78
  64. package/llms/richtext.md +2 -0
  65. package/llms/social-post.js +1 -0
  66. package/llms/social-post.js.map +1 -1
  67. package/llms/social-post.md +22 -4
  68. package/llms/sound-core.d.ts +2 -0
  69. package/llms/sound-core.js +7 -0
  70. package/llms/sound-core.js.map +1 -0
  71. package/llms/sound-core.md +131 -0
  72. package/llms/spotify.js +11 -1
  73. package/llms/spotify.js.map +1 -1
  74. package/llms/spotify.md +54 -50
  75. package/llms/strudel.js +2 -0
  76. package/llms/strudel.js.map +1 -1
  77. package/llms/strudel.md +24 -25
  78. package/llms/surface-board.d.ts +2 -0
  79. package/llms/surface-board.js +8 -0
  80. package/llms/surface-board.js.map +1 -0
  81. package/llms/surface-board.md +140 -0
  82. package/llms/surface-play-area.d.ts +2 -0
  83. package/llms/surface-play-area.js +8 -0
  84. package/llms/surface-play-area.js.map +1 -0
  85. package/llms/surface-play-area.md +51 -0
  86. package/llms/surface-presence.d.ts +2 -0
  87. package/llms/surface-presence.js +9 -0
  88. package/llms/surface-presence.js.map +1 -0
  89. package/llms/surface-presence.md +118 -0
  90. package/llms/third-party-embed.d.ts +2 -0
  91. package/llms/third-party-embed.js +8 -0
  92. package/llms/third-party-embed.js.map +1 -0
  93. package/llms/third-party-embed.md +110 -0
  94. package/llms/three-js.js +1 -1
  95. package/llms/three-js.js.map +1 -1
  96. package/llms/three-js.md +52 -18
  97. package/llms/touch-games.js +11 -11
  98. package/llms/touch-games.js.map +1 -1
  99. package/llms/touch-games.md +59 -354
  100. package/llms/types.d.ts +14 -0
  101. package/llms/ui-chat.js +2 -1
  102. package/llms/ui-chat.js.map +1 -1
  103. package/llms/ui-chat.md +25 -14
  104. package/llms/ui-weather.js +1 -1
  105. package/llms/ui-weather.js.map +1 -1
  106. package/llms/ui-weather.md +1 -2
  107. package/llms/use-vibe.js +1 -0
  108. package/llms/use-vibe.js.map +1 -1
  109. package/llms/use-viewer.js +1 -0
  110. package/llms/use-viewer.js.map +1 -1
  111. package/llms/voxel.js +1 -0
  112. package/llms/voxel.js.map +1 -1
  113. package/llms/voxel.md +33 -109
  114. package/llms/weather.d.ts +2 -0
  115. package/llms/weather.js +12 -0
  116. package/llms/weather.js.map +1 -0
  117. package/llms/weather.md +248 -0
  118. package/llms/web-audio.js +4 -21
  119. package/llms/web-audio.js.map +1 -1
  120. package/llms/web-audio.md +19 -951
  121. package/llms/web-music.d.ts +2 -0
  122. package/llms/web-music.js +8 -0
  123. package/llms/web-music.js.map +1 -0
  124. package/llms/web-music.md +895 -0
  125. package/llms/world-controls.d.ts +2 -0
  126. package/llms/world-controls.js +14 -0
  127. package/llms/world-controls.js.map +1 -0
  128. package/llms/world-controls.md +262 -0
  129. package/llms/worlds.js +2 -1
  130. package/llms/worlds.js.map +1 -1
  131. package/llms/worlds.md +5 -14
  132. package/llms/youtube.js +10 -1
  133. package/llms/youtube.js.map +1 -1
  134. package/llms/youtube.md +67 -53
  135. package/package.json +5 -5
  136. package/prompts.js +5 -19
  137. package/prompts.js.map +1 -1
package/llms/ui-chat.md CHANGED
@@ -15,6 +15,8 @@ import { useFireproof } from "use-fireproof";
15
15
  import { useViewer, useVibe } from "use-vibes";
16
16
  import { Button, Card, Empty, Field, Heading, Icon, IconButton, Input, Row, RowCard, Skeleton, Stack, Text } from "@vibes.diy/ui";
17
17
  import { ScrollArea } from "@vibes.diy/ui/interactive";
18
+ import { Presence, newRoomId, roomLink, useHere, useRoomId } from "./lib/room.js";
19
+ import { HereBar } from "./lib/here.jsx";
18
20
 
19
21
  const when = (ms) => new Date(ms).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
20
22
 
@@ -24,14 +26,16 @@ function Author({ handle }) {
24
26
  }
25
27
 
26
28
  function Thread({ room, onBack }) {
27
- const { database, useLiveQuery } = useFireproof("chat");
29
+ const { database, useDocument, useLiveQuery } = useFireproof("chat");
28
30
  const { can, me } = useVibe("chat");
29
- const { docs } = useLiveQuery("roomId", { key: room._id });
30
- const messages = [...docs].sort((a, b) => a.createdAt - b.createdAt);
31
+ // One query on the room returns its messages and the presence of whoever has it open.
32
+ const { docs } = useLiveQuery("roomId", { key: room.roomId });
33
+ const messages = docs.filter((d) => d.type === "message").sort((a, b) => a.createdAt - b.createdAt);
34
+ const here = useHere(room.roomId, useLiveQuery, me?.userHandle);
31
35
  const [draft, setDraft] = useState("");
32
36
  const endRef = useRef(null);
33
37
  // The verdict for the doc send writes, carrying the same fields it stamps.
34
- const canSend = can.create({ type: "message", roomId: room._id, authorHandle: me?.userHandle });
38
+ const canSend = can.create({ type: "message", roomId: room.roomId, authorHandle: me?.userHandle });
35
39
 
36
40
  useEffect(() => {
37
41
  endRef.current?.scrollIntoView({ block: "nearest" });
@@ -43,16 +47,18 @@ function Thread({ room, onBack }) {
43
47
  if (text === "") return;
44
48
  // The field is ready for the next one at once; a save that does not land hands the words back.
45
49
  setDraft("");
46
- const { ok } = await database.put({ type: "message", roomId: room._id, text, authorHandle: me?.userHandle, createdAt: Date.now() });
50
+ const { ok } = await database.put({ type: "message", roomId: room.roomId, text, authorHandle: me?.userHandle, createdAt: Date.now() });
47
51
  if (!ok) setDraft((now) => now || text);
48
52
  }
49
53
 
50
54
  return (
51
55
  <Stack gap={4}>
56
+ {me?.userHandle && <Presence key={`${room.roomId}:${me.userHandle}`} roomId={room.roomId} handle={me.userHandle} useDocument={useDocument} />}
52
57
  <Row gap={2} wrap={false}>
53
58
  <IconButton size="sm" onClick={onBack} label="Back to rooms" icon={<Icon name="prev" size="sm" />} />
54
59
  <Heading level={1}>{room.name}</Heading>
55
60
  </Row>
61
+ <HereBar people={here} onInvite={() => navigator.clipboard.writeText(roomLink(room.roomId))} />
56
62
 
57
63
  <Card>
58
64
  <Stack gap={4}>
@@ -114,12 +120,15 @@ export default function App() {
114
120
  const { docs: messages } = useLiveQuery("type", { key: "message" });
115
121
  const rooms = [...roomDocs].sort((a, b) => a.createdAt - b.createdAt);
116
122
 
117
- const [activeId, setActiveId] = useState(undefined);
123
+ const [activeId, go] = useRoomId(); // the open room is in the link, so a shared link opens it
118
124
  const [name, setName] = useState("");
119
125
  const [error, setError] = useState(undefined);
120
- const active = rooms.find((r) => r._id === activeId);
121
- // The verdict for the doc startRoom writes, carrying the same fields it stamps.
122
- const canStart = can.create({ type: "room", authorHandle: me?.userHandle });
126
+ const active = rooms.find((r) => r.roomId === activeId);
127
+ // The verdict for the doc startRoom writes, carrying the same fields it stamps; the next room's
128
+ // id is drawn up front so the verdict reads that very document.
129
+ const [nextId, setNextId] = useState(newRoomId);
130
+ const roomDraft = { _id: `room:${nextId}`, type: "room", roomId: nextId, hostHandle: me?.userHandle };
131
+ const canStart = can.create(roomDraft);
123
132
 
124
133
  async function startRoom(e) {
125
134
  e.preventDefault();
@@ -130,8 +139,9 @@ export default function App() {
130
139
  }
131
140
  setError(undefined);
132
141
  setName(""); // ready for the next room name at once
133
- const { id, ok } = await database.put({ type: "room", name: text, authorHandle: me?.userHandle, createdAt: Date.now() });
134
- if (ok) setActiveId(id);
142
+ setNextId(newRoomId());
143
+ const { ok } = await database.put({ ...roomDraft, name: text, createdAt: Date.now() });
144
+ if (ok) go(roomDraft.roomId);
135
145
  else setName((now) => now || text);
136
146
  }
137
147
 
@@ -144,7 +154,7 @@ export default function App() {
144
154
  return (
145
155
  <main className="mx-auto max-w-2xl px-4 py-8">
146
156
  {active ? (
147
- <Thread room={active} onBack={() => setActiveId(undefined)} />
157
+ <Thread room={active} onBack={() => go(null)} />
148
158
  ) : (
149
159
  <Stack gap={5}>
150
160
  <Stack gap={1}>
@@ -159,11 +169,11 @@ export default function App() {
159
169
  ) : (
160
170
  <Stack gap={2}>
161
171
  {rooms.map((room) => (
162
- <RowCard key={room._id} onClick={() => setActiveId(room._id)}>
172
+ <RowCard key={room._id} onClick={() => go(room.roomId)}>
163
173
  <Stack gap={1}>
164
174
  <Text truncate>{room.name}</Text>
165
175
  <Text size="sm" muted truncate>
166
- {latest(room._id)}
176
+ {latest(room.roomId)}
167
177
  </Text>
168
178
  </Stack>
169
179
  </RowCard>
@@ -214,6 +224,7 @@ export default function App() {
214
224
  ## Adapting
215
225
 
216
226
  - Rename rooms and messages to the app's own nouns (`trip`, `song`, `channel`) in the `type` key, the headings and the copy; keep one document per message, linked to its room by `roomId`.
227
+ - Who has a room open is the live-rooms presence above: the thread mounts the visitor's presence draft and shows the faces, the count and the Invite in its header, and the open room rides the link as `#room=`, so an invite opens straight into the thread. A "typing" line is a `typing: true` field in the same presence state, set while the composer has text and cleared on send.
217
228
  - An unread marker is per person, not per message: keep it as a `lastRead:<room>:<person>` document with a time, and show the count as a `Badge tone="info"`.
218
229
  - A side-by-side list and thread on a wide screen is a `Grid cols="sidebar"` with the thread first; keep the back button for phones.
219
230
  - Authors are always `ViewerTag` with the stored handle; the visitor's own messages are told apart by `me.userHandle`, never by a stored name.
@@ -2,6 +2,6 @@ export const uiWeatherConfig = {
2
2
  name: "ui-weather",
3
3
  aliases: ["pouf-weather"],
4
4
  label: "Weather block",
5
- description: "Weather card with city and unit pickers, hourly strip and forecast",
5
+ description: 'Weather card with city and unit pickers, hourly strip and forecast, drawn on sample figures; name "weather" beside it for live forecasts',
6
6
  };
7
7
  //# sourceMappingURL=ui-weather.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-weather.js","sourceRoot":"","sources":["../../jsr/llms/ui-weather.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,eAAe,GAAc;IACxC,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,oEAAoE;CAClF,CAAC"}
1
+ {"version":3,"file":"ui-weather.js","sourceRoot":"","sources":["../../jsr/llms/ui-weather.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,eAAe,GAAc;IACxC,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,KAAK,EAAE,eAAe;IAGtB,WAAW,EACT,0IAA0I;CAC7I,CAAC"}
@@ -177,8 +177,7 @@ export default function App() {
177
177
 
178
178
  ## Adapting
179
179
 
180
- - Real forecasts come from the app's backend, never from the page: a `backend.js` `scheduled` handler (the `backend` skill) reads a forecast feed with `ctx.fetch` every 15 minutes or so, writes one `forecast` document per place (the `PLACES` shape above) into the `weather` database, and keeps the last good documents when a refresh fails. The page then reads that same database, `useFireproof("weather")` with `useLiveQuery("type", { key: "forecast" })`, in place of `PLACES`, and drops the `Sample forecast` badge.
181
- - Never fetch a forecast from render or a React effect, and never put an API key in `App.jsx`. Prefer a keyless public forecast feed: a plain `GET` with no credentials reaches any https host. A keyed call (an `Authorization` header, a key read from the backend's secrets) is admitted only when the forecast host is CORS-open or on the platform's curated list, so check the host before choosing a keyed API.
180
+ - Real forecasts are the `weather` skill's: Open-Meteo answers with no key, and its days fill the `PLACES` shape here (`condition` from the code's words, `windKmh` from the default km/h), so the `Sample forecast` badge goes. Never put an API key in `App.jsx`.
182
181
  - Change the places, not the shape: each one keeps a list of days with `hi` and `lo` in °C, `humidity` in percent, `windKmh`, `uv`, an `icon` from the built-in set (`sun`, `cloud`, `rain`, `wind`) and a `condition` in plain words. Store one unit and convert at render, as `deg` and `speed` do.
183
182
  - To remember a person's places or units between visits, keep one small preference document per signed-in person and gate its write on `useVibe(dbName).can`, as the settings block does; a visitor who has not signed in keeps the page defaults.
184
183
  - Keep the selected day as the view's one lead. A button added to the card (say, `Add a place`) becomes the lead instead, and the selected row then shows its choice with an `info` `Badge` rather than `selected`.
package/llms/use-vibe.js CHANGED
@@ -2,6 +2,7 @@ export const useVibeConfig = {
2
2
  name: "use-vibe",
3
3
  label: "Vibe Write Gating",
4
4
  description: "Gate write surfaces on the app's own access.js via useVibe().can",
5
+ universal: "always",
5
6
  importModule: "use-vibes",
6
7
  importName: "useVibe",
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-vibe.js","sourceRoot":"","sources":["../../jsr/llms/use-vibe.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,kEAAkE;IAC/E,YAAY,EAAE,WAAW;IACzB,UAAU,EAAE,SAAS;CACtB,CAAC"}
1
+ {"version":3,"file":"use-vibe.js","sourceRoot":"","sources":["../../jsr/llms/use-vibe.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,kEAAkE;IAC/E,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,WAAW;IACzB,UAAU,EAAE,SAAS;CACtB,CAAC"}
@@ -2,6 +2,7 @@ export const useViewerConfig = {
2
2
  name: "use-viewer",
3
3
  label: "Viewer Identity",
4
4
  description: "Get the current viewer's identity and capability gates",
5
+ universal: "always",
5
6
  importModule: "use-vibes",
6
7
  importName: "useViewer",
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-viewer.js","sourceRoot":"","sources":["../../jsr/llms/use-viewer.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAc;IACxC,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,wDAAwD;IACrE,YAAY,EAAE,WAAW;IACzB,UAAU,EAAE,WAAW;CACxB,CAAC"}
1
+ {"version":3,"file":"use-viewer.js","sourceRoot":"","sources":["../../jsr/llms/use-viewer.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAc;IACxC,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,wDAAwD;IACrE,SAAS,EAAE,QAAQ;IACnB,YAAY,EAAE,WAAW;IACzB,UAAU,EAAE,WAAW;CACxB,CAAC"}
package/llms/voxel.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export const voxelConfig = {
2
2
  name: "voxel",
3
+ needs: ["world-controls", "live-rooms"],
3
4
  label: "Voxel",
4
5
  description: "Any voxel or block world — Minecraft-style, an island, a city, a sandbox — walked, flown or built in. " +
5
6
  "Build a Minecraft-style first-person voxel sandbox with Three.js: chunked block world, " +
package/llms/voxel.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"voxel.js","sourceRoot":"","sources":["../../jsr/llms/voxel.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAc;IACpC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,WAAW,EACT,wGAAwG;QACtG,yFAAyF;QAC3F,6FAA6F;QAC7F,4FAA4F;QAC5F,0HAA0H;QAC1H,uFAAuF;QACvF,gGAAgG;QAChG,2FAA2F;QAC3F,yFAAyF;QACzF,6CAA6C;QAC7C,2FAA2F;QAC3F,+JAA+J;IACjK,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,CAAC;IAC/E,YAAY,EAAE,OAAO;IACrB,UAAU,EAAE,OAAO;IACnB,UAAU,EAAE,WAAW;CACxB,CAAC"}
1
+ {"version":3,"file":"voxel.js","sourceRoot":"","sources":["../../jsr/llms/voxel.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAc;IACpC,IAAI,EAAE,OAAO;IAEb,KAAK,EAAE,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACvC,KAAK,EAAE,OAAO;IACd,WAAW,EACT,wGAAwG;QACtG,yFAAyF;QAC3F,6FAA6F;QAC7F,4FAA4F;QAC5F,0HAA0H;QAC1H,uFAAuF;QACvF,gGAAgG;QAChG,2FAA2F;QAC3F,yFAAyF;QACzF,6CAA6C;QAC7C,2FAA2F;QAC3F,+JAA+J;IACjK,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,CAAC;IAG/E,YAAY,EAAE,OAAO;IACrB,UAAU,EAAE,OAAO;IACnB,UAAU,EAAE,WAAW;CACxB,CAAC"}
package/llms/voxel.md CHANGED
@@ -140,7 +140,7 @@ colors in one named table, shared by material swatches and HUD controls. Add
140
140
  game-specific materials to that table; preserve these colors for matching
141
141
  materials. The surrounding app retains its supplied theme's surfaces and text, and the world
142
142
  around the blocks wears the look too: the sky, fog and light come from the theme tokens through
143
- `readLook` (the `touch-games` skill, _The look reaches the play area_), and the title, hotbar and
143
+ `readLook` (the play-area surface and canvas theme colours above), and the title, hotbar and
144
144
  panels are kit components on the look's surfaces. This table colours the blocks and the accent.
145
145
 
146
146
  ```js
@@ -409,8 +409,8 @@ when the engine unmounts.
409
409
 
410
410
  Controls come from `useWorldControls`; voxel adds what the acts mean: a tap builds on the targeted block, a hold breaks it, the block chip and hotbar pick the material, G toggles flying, and a flick down sinks while flying.
411
411
 
412
- The hook, its usage example and its desktop twin live in the `touch-games` skill (Walk + look);
413
- load it beside this one. In a block world the hook's callbacks become:
412
+ The hook, its usage example and its desktop twin are in the world controls above. In a block
413
+ world the hook's callbacks become:
414
414
 
415
415
  - `onTap(x, y)` builds and `onHold(x, y)` breaks, through the DDA raycast below — from that point
416
416
  (client coordinates) on a phone, from screen centre under the crosshair while the mouse is locked.
@@ -423,7 +423,7 @@ Pointer lock is the number-one confusion in browser voxel games: players click
423
423
  and nothing happens, or they don't know the mouse controls the camera at all.
424
424
  **Always** show an explicit "Click to play" overlay with the control legend,
425
425
  and only request lock from that click: its button calls the hook's `requestLock()`, and the hook's
426
- `locked` brings the overlay back when the player presses Esc. The overlay JSX is in `touch-games`;
426
+ `locked` brings the overlay back when the player presses Esc. The overlay JSX is in the world controls;
427
427
  the voxel legend reads "WASD move · Mouse look · Shift sprint · Space jump · Click build ·
428
428
  Right-click break · G fly · V views · 1–9 blocks".
429
429
 
@@ -432,7 +432,7 @@ Right-click break · G fly · V views · 1–9 blocks".
432
432
  Include a view switcher between first-person and third-person so players can see their own avatar.
433
433
  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`.
434
434
  Toggle once per press, ignoring key repeat. On a phone the world opens in Free cam, an overview that frames the island;
435
- back its radius off on a narrow screen as `touch-games` shows.
435
+ back its radius off on a narrow screen as the world controls show.
436
436
  Render a simple blocky local-player avatar in third-person, following
437
437
  the player's position and heading, and hide it in first-person so it does not
438
438
  cover the camera. Keep the same player physics and position when switching:
@@ -465,7 +465,7 @@ belongs to the platform. A smaller boxed world is only for when the person asks
465
465
 
466
466
  ### No text selection on the game surface
467
467
 
468
- The phone controls themselves come from `useWorldControls`, taught in the `touch-games` skill.
468
+ The phone controls themselves come from `useWorldControls`, taught in the world controls above.
469
469
 
470
470
  Two things separate "works on my laptop" from "works", and both are easy to
471
471
  forget because the desktop build hides them:
@@ -512,12 +512,12 @@ when a block breaks — cheap, and it makes mining feel real.
512
512
 
513
513
  ## Multiplayer: live block edits over Fireproof
514
514
 
515
- ### Keep saved edits separate from temporary movement
515
+ A shared world is a live room: the room in the URL, presence, who is here and
516
+ the room's access branches come from the live-rooms doc above, with the world
517
+ as the room (`roomId` is the `worldId`). This section is what a block world
518
+ adds on top.
516
519
 
517
- `useDocument.merge(updates)` updates a local draft and broadcasts its **full
518
- merged snapshot** to authorized connected peers when it has an `_id`.
519
- It is a shallow merge, not a durable field-patch API; `save()` persists through
520
- `database.put()`. The app-facing database has no `database.merge()` method.
520
+ ### Keep saved edits separate from temporary movement
521
521
 
522
522
  Use small, separate documents for different lifetimes:
523
523
 
@@ -529,100 +529,35 @@ Use small, separate documents for different lifetimes:
529
529
  stays gone after reload. Use the consistency model below for concurrent edits.
530
530
  - **Inventory, health, and resume checkpoints:** persist per world and player,
531
531
  with change detection and an explicit commit/checkpoint cadence. Commit
532
- important collected items when the action completes; a player-pose heartbeat
533
- should carry only pose. `save()` still creates a durable write. To commit in
532
+ important collected items when the action completes; the pose heartbeat
533
+ carries only pose. `save()` still creates a durable write. To commit in
534
534
  the same callback as a draft update, pass the complete next snapshot to
535
535
  `save(snapshot)`; a bare `save()` can read the previous render's draft.
536
536
  A nested object replaces that entire field rather than merging individual
537
537
  coordinates.
538
- - **Live pose/aim:** use a dedicated presence draft and `merge()` without
539
- `save()`. Keep the movement cadence bounded and heartbeat while stationary.
540
- Temporary overlays expire after about 12 seconds without updates or when the
541
- peer disconnects; they are not a durable resume position or offline edit log.
538
+ - **Live pose/aim:** the player's presence draft. Point the presence state ref
539
+ at the engine's latest `{ x, y, z, theta }` snapshot (`poseRef`), which
540
+ animation updates without React state or database writes; the heartbeat
541
+ sends it, and peers draw each fresh pose as an avatar in the scene. It is not
542
+ a durable resume position or an offline edit log.
542
543
  - **Activity feed:** use a bounded/coalesced recent-action summary unless a
543
544
  durable audit trail is required. Showing only eight results does not bound
544
545
  storage when every block placement appends a new activity document.
545
546
 
546
547
  Blocktopia's per-coordinate writes already avoid saving an entire world for
547
- each block. The useful `merge()` substitution is its recurring **presence**
548
- write. Block Craft's whole-world snapshot every two seconds combines edits,
548
+ each block; its recurring presence write is the one to move onto the presence
549
+ draft. Block Craft's whole-world snapshot every two seconds combines edits,
549
550
  inventory, vitals, and pose; split those lifetimes before adopting its survival
550
551
  systems. Fewer durable commits and smaller documents reduce persistence work;
551
552
  measure wire bytes and delivery latency separately before claiming faster sync.
552
553
 
553
- For a world whose membership is already established, mount this component
554
- with `key={worldId + ":" + handle}`. Its hook stays at component scope and
555
- starts a new draft when the player changes worlds. `poseRef` is the engine's
556
- latest `{ x, y, z, theta }` snapshot; animation updates that ref without React
557
- state or database writes:
558
-
559
- ```jsx
560
- function PlayerPresence({ worldId, handle, poseRef, useDocument }) {
561
- const { merge } = useDocument({
562
- _id: `presence:${worldId}:${handle}`, type: "presence",
563
- worldId, userHandle: handle,
564
- });
565
- React.useEffect(() => {
566
- let previous = "";
567
- let lastSent = 0;
568
- const timer = setInterval(() => {
569
- const p = poseRef.current;
570
- if (!p) return;
571
- const pose = { x: p.x, y: p.y, z: p.z, theta: p.theta };
572
- const stamp = JSON.stringify(pose);
573
- const now = Date.now();
574
- if (stamp === previous && now - lastSent < 5000) return;
575
- merge({ ...pose, at: now });
576
- previous = stamp;
577
- lastSent = now;
578
- }, 350);
579
- return () => clearInterval(timer);
580
- }, [merge, poseRef]);
581
- return null;
582
- }
583
- ```
584
-
585
- Peers can receive this never-saved row through a live query on `worldId`;
586
- the temporary overlay supplies the index fields. The access function must
587
- validate the sender's identity, bind `_id` to its world/player, validate finite
588
- pose coordinates, and require world membership before returning the existing
589
- world channel. Persist the world/invitation that grants that membership first:
590
- a presence broadcast does not create grants. Use this matching branch in the
591
- multi-world access function (the single-world example later uses different IDs
592
- and `authorHandle`):
593
-
594
- ```js
595
- if (doc.type === "presence") {
596
- if (!user || doc.userHandle !== user.userHandle) throw { forbidden: "not you" };
597
- if (typeof doc.worldId !== "string" || !doc.worldId) throw { forbidden: "world required" };
598
- if (doc._id !== `presence:${doc.worldId}:${user.userHandle}`) throw { forbidden: "presence ID" };
599
- if (![doc.x, doc.y, doc.z, doc.theta, doc.at].every(Number.isFinite)) throw { forbidden: "invalid pose" };
600
- const channel = `world:${doc.worldId}`;
601
- ctx.requireAccess(channel);
602
- return { channels: [channel] };
603
- }
604
- ```
605
-
606
- A hidden or disconnected tab may miss its heartbeat, so peers expire it rather
607
- than treating it as saved state. Use receiver arrival time for update freshness.
608
- Rely on disconnect/expiry for departure:
609
- an unmount-time `merge()` can be canceled before broadcast. This example uses
610
- one presence ID per handle; independent same-handle tabs need a session suffix
611
- and access rules that validate that ID. During migration from saved presence,
612
- admit old durable rows only if their timestamps are plausibly fresh; their
613
- first query arrival or reappearance after overlay expiry is not a heartbeat.
614
- Alternatively, use a distinct ephemeral namespace with matching access rules.
615
-
616
554
  ### Choose the durable edit conflict model
617
555
 
618
- **Know exactly what the substrate gives you before you design for it.** A live
619
- query returns the **full, latest-per-document result set**, deliveries are
620
- **unordered** (notifications can be delayed; overlapping re-queries can resolve
621
- out of order), and when two writes target the **same `_id`** the durable head is
622
- whichever the **server wrote last by arrival order — not the higher client
623
- timestamp.** That last fact is the one that bites: a client-side fold can order
624
- what a session *observes*, but it cannot change which revision the server keeps,
625
- so **there is no free lunch here.** Pick a model with eyes open:
556
+ Many players editing the same coordinates is the case the live-rooms substrate
557
+ rules do not settle on their own: deliveries are unordered and the server keeps
558
+ the last ARRIVAL per `_id`, so a client-side fold can order what a session
559
+ *observes*, but it cannot change which revision the server keeps, so **there is
560
+ no free lunch here.** Pick a model with eyes open:
626
561
 
627
562
  - **Model A — one doc per coordinate (bounded, eventually-consistent-per-session).**
628
563
  Deterministic `_id: block:<key>`, so each edit *overwrites* the same doc and the
@@ -905,15 +840,12 @@ Ordering rules, each load-bearing (both models):
905
840
  derived map; if you only apply the keys that are present, everything mined
906
841
  before the reset stays rendered. Diff against the previous key set and
907
842
  apply `null` (revert-to-terrain) for keys that vanished.
908
- - **Clear an optimistic overlay only when the synced value AGREES with it**,
909
- never when the key merely exists. A re-edited voxel always has an older doc,
910
- so key-presence clears the overlay against stale data — the same refill bug
911
- through a different door. `if (blocks.get(k) === pending.get(k)) pending.delete(k)`.
843
+ - **An optimistic overlay clears on agreement** (the live-rooms rule), keyed by
844
+ coordinate: `if (blocks.get(k) === pending.get(k)) pending.delete(k)`.
912
845
 
913
- Apply the local edit **before** the `put` so the world never waits on the
914
- network, and read live handles/permissions through refs (a value captured in the
915
- engine closure at load time goes stale — bind live state via `state.on*`
916
- callbacks or refs, never the closure).
846
+ Read live handles/permissions through refs (a value captured in the engine
847
+ closure at load time goes stale — bind live state via `state.on*` callbacks or
848
+ refs, never the closure).
917
849
 
918
850
  The `access.js` keeps the shared world **open** — block docs channel publicly
919
851
  with anonymous writers allowed — while survival doc types each get a branch
@@ -950,14 +882,7 @@ export default function (doc, oldDoc, user, ctx) {
950
882
  if (oldDoc && oldDoc.authorHandle !== user.userHandle) throw { forbidden: "not your inventory" };
951
883
  return { channels: [WORLD], grant: { public: [WORLD] } };
952
884
  }
953
- if (doc.type === "presence") {
954
- // Roster heartbeat — same self-only rule and _id binding, create AND update.
955
- if (!user) throw { forbidden: "sign in" };
956
- if (doc._id !== `presence:${user.userHandle}`) throw { forbidden: "not you" };
957
- if (doc.authorHandle !== user.userHandle) throw { forbidden: "not you" };
958
- if (oldDoc && oldDoc.authorHandle !== user.userHandle) throw { forbidden: "not you" };
959
- return { channels: [WORLD], grant: { public: [WORLD] } };
960
- }
885
+ // The room and presence branches are the live-rooms ones, with the world's channel as the room's.
961
886
  if (doc.type === "worldReset") {
962
887
  // Singleton at a FIXED _id, owner only — destructive for the whole group.
963
888
  // Clients ignore voxel edits older than doc.at, so "reset" deletes
@@ -980,9 +905,8 @@ The pattern generalizes: **self-owned docs bind their `_id` to the writer's
980
905
  handle and check ownership on both create and update**; group-destructive
981
906
  singletons gate on the owner role.
982
907
 
983
- Do the world's block editing on the **client** regardless of write
984
- permission (`applyBlock` always runs locally); gate only the **sync** on
985
- `can.create(...)` so a slow or stale rule binding can never freeze the game.
908
+ `applyBlock` always runs locally, whatever the write verdict says; only the
909
+ sync waits on `can.create(...)`.
986
910
 
987
911
  ## The survival layer: data tables first, systems second
988
912
 
@@ -0,0 +1,2 @@
1
+ import type { LlmConfig } from "./types.js";
2
+ export declare const weatherConfig: LlmConfig;
@@ -0,0 +1,12 @@
1
+ export const weatherConfig = {
2
+ name: "weather",
3
+ label: "Weather forecasts",
4
+ description: "Live weather for any app that shows weather (a dashboard, a trip planner, a garden or event page), with no key and no setup, from Open-Meteo: a place name to coordinates, current conditions, an hourly strip and a daily forecast for one or several places in one call, °C/°F and wind units, weather codes in plain words, refresh and errors that keep the last forecast, and the data credit",
5
+ cues: ["weather", "forecast", "weather dashboard", "weather app"],
6
+ credential: "none",
7
+ egress: [
8
+ { url: "https://geocoding-api.open-meteo.com/v1/search?name=Oslo", via: "cors", checked: "2026-11-02" },
9
+ { url: "https://api.open-meteo.com/v1/forecast?latitude=59.91&longitude=10.75", via: "cors", checked: "2026-11-02" },
10
+ ],
11
+ };
12
+ //# sourceMappingURL=weather.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weather.js","sourceRoot":"","sources":["../../jsr/llms/weather.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EACT,oYAAoY;IACtY,IAAI,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,CAAC;IACjE,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE;QACN,EAAE,GAAG,EAAE,0DAA0D,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE;QACvG,EAAE,GAAG,EAAE,uEAAuE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE;KACrH;CACF,CAAC"}