@vibes.diy/prompts 14.1.35 → 14.1.37

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 (2) hide show
  1. package/llms/backend.md +35 -7
  2. package/package.json +4 -4
package/llms/backend.md CHANGED
@@ -149,7 +149,7 @@ const json = JSON.parse(
149
149
  await ctx.callAI("rate this", { schema: { properties: { verdict: { type: "string" }, score: { type: "number" } } } })
150
150
  ); // structured output
151
151
  const res = await ctx.fetch("https://api.example.com/x", { headers }); // outbound HTTP — use this, not bare fetch()
152
- await ctx.notify({ toHandle: "alice", body: "Your turn", dedupeKey: "game-7-turn-3" }); // one participant; throws on failure
152
+ await ctx.notify({ toHandle: "alice", body: "Your turn", dedupeKey: "game-7-turn-3", path: "#game-7" }); // one participant; `path` optional; throws on failure
153
153
  ctx.log("info", "tick finished", { written: 3 }); // diagnostics — read back with: vibes-diy app logs owner/slug
154
154
  const gh = await ctx.github.fetch("/repos/acme/site/issues", { method: "POST", body: { title: "Filed from the vibe" } }); // connected GitHub repo
155
155
  ```
@@ -352,11 +352,11 @@ const gh = await ctx.github.fetch("/repos/acme/site/issues", { method: "POST", b
352
352
  Keep interactive/streaming AI in `App.jsx` via `callAI`; use `ctx.callAI`
353
353
  when the result must be server-authoritative (moderation, digests,
354
354
  summaries users shouldn't be able to forge).
355
- - **`ctx.notify({ toHandle, body, dedupeKey })` sends one person a notification.**
356
- It takes a single object with all three fields — match the object form in the
357
- example above, which is the calling convention (codegen has been observed
358
- passing these positionally). The message lands in that person's bell, inbox,
359
- and push notifications.
355
+ - **`ctx.notify({ toHandle, body, dedupeKey, path })` sends one person a notification.**
356
+ It takes a single object; `toHandle`, `body` and `dedupeKey` are required and
357
+ `path` is optional — match the object form in the example above, which is the
358
+ calling convention (codegen has been observed passing these positionally).
359
+ The message lands in that person's bell, inbox, and push notifications.
360
360
  - `toHandle` is one handle, and the platform delivers to people already in
361
361
  this app: the owner, an accepted invite or approved request, or a handle
362
362
  named in the access function's persisted grant state.
@@ -366,6 +366,28 @@ const gh = await ctx.github.fetch("/repos/acme/site/issues", { method: "POST", b
366
366
  - `dedupeKey` names the happening, so one event delivers once however many
367
367
  times the handler runs: `"round-4-started"`, `"order-42-shipped"`,
368
368
  `"game-7-turn-3"`. The platform keys it per (app, recipient).
369
+ - `path` says WHERE in your app the notification points, so the bell and the
370
+ email land on the thing it is about instead of your front page. It must be
371
+ a `#` fragment — `"#game-7"`, `"#order/42"` — of at most 200 characters with
372
+ no spaces or line breaks, and nothing else: a fragment can only ever address
373
+ a position inside your own app, which is why it is the only form allowed.
374
+ Omit it and the notification links to the app itself, exactly as before.
375
+ **A malformed `path` fails the whole `ctx.notify` call** (the promise
376
+ rejects) rather than being quietly ignored — so a dead deep link is
377
+ something you find out about, not something your users find out about.
378
+ - Read it back in `App.jsx` from your own hash, and listen for changes,
379
+ because a click while the app is already open moves the hash without
380
+ reloading:
381
+
382
+ ```jsx
383
+ const [target, setTarget] = useState(() => window.location.hash.slice(1));
384
+ useEffect(() => {
385
+ const onHash = () => setTarget(window.location.hash.slice(1));
386
+ window.addEventListener("hashchange", onHash);
387
+ return () => window.removeEventListener("hashchange", onHash);
388
+ }, []);
389
+ // target === "game-7" → open that game
390
+ ```
369
391
  - `await` it and let it throw. Success resolves with nothing to inspect; a
370
392
  missing field, an over-long body, or a handle outside the app rejects the
371
393
  promise. Usually the surrounding work should survive an undeliverable
@@ -373,7 +395,12 @@ const gh = await ctx.github.fetch("/repos/acme/site/issues", { method: "POST", b
373
395
 
374
396
  ```js
375
397
  try {
376
- await ctx.notify({ toHandle: game.opponent, body: "Your turn", dedupeKey: `game-${game._id}-turn-${game.turn}` });
398
+ await ctx.notify({
399
+ toHandle: game.opponent,
400
+ body: "Your turn",
401
+ dedupeKey: `game-${game._id}-turn-${game.turn}`,
402
+ path: `#game-${game._id}`, // lands them on THAT game, not the lobby
403
+ });
377
404
  } catch (err) {
378
405
  ctx.log("warn", "notify failed", { game: game._id, reason: err.message });
379
406
  }
@@ -983,6 +1010,7 @@ export async function scheduled(event, ctx) {
983
1010
  toHandle: ctx.appInfo.ownerHandle,
984
1011
  body: "Your six jokes are drafted and ready for the show.",
985
1012
  dedupeKey: `draft-${dayKey}`,
1013
+ path: `#draft/${dayKey}`,
986
1014
  });
987
1015
  } catch (err) {
988
1016
  // The day stays claimed: the owner sees what went wrong and is not billed twice for it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/prompts",
3
- "version": "14.1.35",
3
+ "version": "14.1.37",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "exports": {
@@ -34,9 +34,9 @@
34
34
  "license": "Apache-2.0",
35
35
  "dependencies": {
36
36
  "@adviser/cement": "~0.5.34",
37
- "@vibes.diy/call-ai-v2": "14.1.35",
38
- "@vibes.diy/identity": "14.1.35",
39
- "@vibes.diy/use-vibes-types": "14.1.35",
37
+ "@vibes.diy/call-ai-v2": "14.1.37",
38
+ "@vibes.diy/identity": "14.1.37",
39
+ "@vibes.diy/use-vibes-types": "14.1.37",
40
40
  "arktype": "~2.2.3",
41
41
  "json-schema-faker": "~0.6.3"
42
42
  },