@vibes.diy/prompts 14.3.290 → 14.3.292
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 +60 -0
- package/package.json +5 -5
package/llms/backend.md
CHANGED
|
@@ -600,6 +600,66 @@ const budget = await ctx.youtube.status(); // { available, unitsLeftToday, daily
|
|
|
600
600
|
exactly the people entitled to see it, because the platform resolves that
|
|
601
601
|
audience per reader at read time. The app's own screen is the source of
|
|
602
602
|
truth; that's what makes it the right surface for anything shared.
|
|
603
|
+
- **Followers by text: a `subscribers` collection.** A public vibe can let
|
|
604
|
+
anyone follow it from their phone, signed in or not: they text Vibes the
|
|
605
|
+
vibe's link ("please notify me about the schedule on https://vibes.diy/vibe/…"),
|
|
606
|
+
and Vibes writes ONE record for them into the vibe's `subscribers` database,
|
|
607
|
+
`{ _id: "subscriber:<handle>", type: "subscriber", handle, authorHandle, created, until }`,
|
|
608
|
+
then texts them each notification the vibe sends to that handle. The vibe
|
|
609
|
+
opts in by giving `access.js` a `subscribers` function; with none, Vibes tells
|
|
610
|
+
the texter this vibe doesn't send updates yet and saves nothing.
|
|
611
|
+
|
|
612
|
+
```js
|
|
613
|
+
// access.js — one record per follower, written only by that follower.
|
|
614
|
+
export function subscribers(doc, oldDoc, user, ctx) {
|
|
615
|
+
if (!user?.userHandle) throw { forbidden: "sign in" };
|
|
616
|
+
if (doc.type !== "subscriber" || doc.handle !== user.userHandle) throw { forbidden: "follow as yourself" };
|
|
617
|
+
if (doc._id !== "subscriber:" + doc.handle) throw { forbidden: "one record per follower" };
|
|
618
|
+
return { channels: ["subscribers"] }; // no grant: followers' handles stay with the owner
|
|
619
|
+
}
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
The writing is what makes a follower someone the app may `ctx.notify`. A
|
|
623
|
+
`scheduled` handler reads the list in admin mode and tells each follower,
|
|
624
|
+
keyed by the happening so a re-run sends nothing twice. Group things that
|
|
625
|
+
happen at once into one message (two events at 5:00 PM are one text):
|
|
626
|
+
|
|
627
|
+
```js
|
|
628
|
+
export const config = { scheduled: { interval: "1m" } };
|
|
629
|
+
export async function scheduled(event, ctx) {
|
|
630
|
+
const soon = startingWithin(10); // your own schedule, in its own time zone
|
|
631
|
+
if (soon.length === 0) return;
|
|
632
|
+
const nowIso = new Date().toISOString();
|
|
633
|
+
const subs = [];
|
|
634
|
+
let after;
|
|
635
|
+
do {
|
|
636
|
+
const page = await ctx.db.query({ db: "subscribers", field: "type", key: "subscriber", limit: 500, after });
|
|
637
|
+
// A follow past its `until` texts nobody, so leave it out.
|
|
638
|
+
subs.push(...page.docs.filter((d) => !d.until || d.until > nowIso));
|
|
639
|
+
after = page.next;
|
|
640
|
+
} while (after);
|
|
641
|
+
const body = soon.map((e) => `${e.title} starts at ${e.time}${e.loc ? `, ${e.loc}` : ""}`).join("\n");
|
|
642
|
+
for (const doc of subs) {
|
|
643
|
+
try {
|
|
644
|
+
await ctx.notify({ toHandle: doc.handle, body, dedupeKey: `soon-${soon[0].slot}`, path: `#${soon[0].id}` });
|
|
645
|
+
} catch (err) {
|
|
646
|
+
ctx.log("warn", "notify failed", { handle: doc.handle, reason: err.message });
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
For the button, an `sms:` link opens Messages with the ask written out.
|
|
653
|
+
`target="_blank"` is what lets the tap leave the app's frame for Messages:
|
|
654
|
+
|
|
655
|
+
```jsx
|
|
656
|
+
const ask = `Please notify me about changes to the schedule on ${appUrl}`;
|
|
657
|
+
<a href={`sms:vibes@vibes.diy&body=${encodeURIComponent(ask)}`} target="_blank" rel="noopener">Text me reminders</a>
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
It works where iMessage does (iPhone, iPad, Mac), so label it for that.
|
|
661
|
+
A follower ends it by replying "stop", and their follow lapses on its own
|
|
662
|
+
after the days Vibes set for it.
|
|
603
663
|
- **`ctx.log(level?, ...args)` is the handler's diagnostic lane.** It is the
|
|
604
664
|
output that reaches the owner, who reads it back with
|
|
605
665
|
`vibes-diy app logs <owner>/<slug> --since 1h [--tail]` — the isolate's
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/prompts",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.292",
|
|
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.292",
|
|
43
|
+
"@vibes.diy/call-ai-v2": "14.3.292",
|
|
44
|
+
"@vibes.diy/identity": "14.3.292",
|
|
45
|
+
"@vibes.diy/use-vibes-types": "14.3.292",
|
|
46
46
|
"arktype": "~2.2.9",
|
|
47
47
|
"json-schema-faker": "~0.6.3"
|
|
48
48
|
},
|