@vibes.diy/prompts 14.3.359 → 14.3.361

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.
@@ -1,6 +1,6 @@
1
1
  export const vibeToolsConfig = {
2
2
  name: "vibe-tools",
3
3
  label: "Vibe tools",
4
- description: "The verbs a person could ask for by text instead of tapping (vote for a place, claim a slot, book a table, add a book to the list), declared in backend.js as a static `export const tools` (at most 8) so an assistant in a group chat can do them for that person. Each tool has a one-line description, typed input fields, who it is for (anyone, members, owner), and either a handler shared with the page's button through a fetch route or a declared one-record write (`key: \"caller\"` for one record per person). A tool always acts as its caller through access.js (`user.backend` is `tool`, never admin mode) and its callAI spends the caller's credits. A picture app may mark one tool `offer: true`, which the assistant may offer once per chat after posting the app's picture. An app whose actions only happen on the page does not need it",
4
+ description: "The verbs a person could ask for by text instead of tapping (vote for a place, claim a slot, book a table, add a book to the list), declared in backend.js as a static `export const tools` (at most 8) so an assistant in a group chat can do them for that person. Each tool has a one-line description, typed input fields, who it is for (anyone, members, owner), and either a handler shared with the page's button through a fetch route or a declared one-record write (`key: \"caller\"` for one record per person). A tool always acts as its caller through access.js (`user.backend` is `tool`, never admin mode) and its callAI spends the caller's credits. A picture app may mark one tool `offer: true`, which the assistant offers once per chat with the app's first picture; `textsLater: true` beside it records each person's yes, and a scheduled `ctx.notify({ consent: \"text-later\" })` reaches only people who said yes. An app whose actions only happen on the page does not need it",
5
5
  cues: ["text the app", "ask the assistant to", "from the group chat", "vote by text", "claim by text", "tools for the agent"],
6
6
  };
@@ -27,6 +27,8 @@ static object whose keys are the tool names. Each tool has:
27
27
  - `write: { db, set, key }` saves one record and runs no code at all.
28
28
  - **`offer: true`** (optional, on one tool at most): the tool the assistant
29
29
  may offer after it posts this app's picture in a chat. See below.
30
+ - **`textsLater: true`** (optional, beside `offer: true` only): the offered
31
+ tool texts the person later. See below.
30
32
 
31
33
  **A vibe declares at most 8 tools.** A ninth refuses the save. Names are
32
34
  lowercase letters, digits and underscores, starting with a letter
@@ -247,13 +249,55 @@ export const tools = {
247
249
  };
248
250
  ```
249
251
 
250
- After the assistant posts this app's picture in a chat, it may ask once, in
251
- that chat, a short yes/no question the platform writes from the tool's name
252
- (`Want me to set up "remind me" for you?`), and it uses the tool
253
- only after someone says yes. It never asks twice in one chat, and never in a
254
- chat that is paused or opted out. The question comes from the platform, so
255
- your description stays a description: name the tool for what the person gets.
256
- At most one tool says `offer: true`; a second refuses the save.
252
+ When the assistant posts this app's first picture in a chat, it offers the
253
+ tool in that same text, once per chat: a short yes/no question the platform
254
+ writes from the tool's name (`Want me to set up "remind me" for you?`), with
255
+ your description beside it as what the app can do for them. It uses the tool
256
+ only after a yes (typed, or a 👍 on that text), and never in a chat that is
257
+ paused or opted out. Write the description as one plain line about what the
258
+ person gets: it reaches the assistant quoted, as your words, up to 300
259
+ characters. At most one tool says `offer: true`; a second refuses the save.
260
+
261
+ ### A tool that texts them later
262
+
263
+ When the offered tool sends the person a text later (a reminder before the
264
+ event), add `textsLater: true`. The assistant then asks in its own words, saying
265
+ plainly that it will text them later and about what, and the platform keeps a
266
+ record of each person's yes: who said it, when, and the words they said yes to.
267
+ Your scheduled handler marks that later text with `consent: "text-later"`, and
268
+ the platform delivers it only to people holding that yes for this app; anyone
269
+ else's notify refuses, and a person who texts STOP is off the list.
270
+
271
+ ### `backend.js`
272
+ ```js partial
273
+ export const tools = {
274
+ remind_me: {
275
+ description: "Text me a reminder the day before the next meetup.",
276
+ offer: true,
277
+ textsLater: true,
278
+ async handler(input, ctx) {
279
+ const handle = ctx.userInfo.userHandle;
280
+ await ctx.db.put({ type: "reminder", handle }, { db: "reminders", id: `remind:${handle}` });
281
+ return { ok: true, message: "Reminder set for the day before the meetup." };
282
+ },
283
+ },
284
+ };
285
+
286
+ export async function scheduled(event, ctx) {
287
+ const docs = await ctx.db.query({ db: "reminders", field: "type", key: "reminder", limit: 100 });
288
+ for (const r of docs) {
289
+ await ctx.notify({
290
+ toHandle: r.handle,
291
+ body: "The meetup is tomorrow at 6!",
292
+ dedupeKey: `meetup-eve:${r.handle}`,
293
+ consent: "text-later",
294
+ });
295
+ }
296
+ }
297
+ ```
298
+
299
+ A notify without `consent` works as it always has, so an app that already
300
+ notifies its members on a schedule keeps doing so.
257
301
 
258
302
  ## Writing a good tool
259
303
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/prompts",
3
- "version": "14.3.359",
3
+ "version": "14.3.361",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "exports": {
@@ -39,10 +39,10 @@
39
39
  "license": "SEE LICENSE IN LICENSE.md",
40
40
  "dependencies": {
41
41
  "@adviser/cement": "~0.5.37",
42
- "@vibes.diy/api-types": "14.3.359",
43
- "@vibes.diy/call-ai-v2": "14.3.359",
44
- "@vibes.diy/identity": "14.3.359",
45
- "@vibes.diy/use-vibes-types": "14.3.359",
42
+ "@vibes.diy/api-types": "14.3.361",
43
+ "@vibes.diy/call-ai-v2": "14.3.361",
44
+ "@vibes.diy/identity": "14.3.361",
45
+ "@vibes.diy/use-vibes-types": "14.3.361",
46
46
  "arktype": "~2.2.9",
47
47
  "json-schema-faker": "~0.6.4"
48
48
  },