@vibes.diy/prompts 4.2.3 → 4.3.1
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 +17 -2
- package/llms/calendar.md +5 -0
- package/package.json +4 -4
package/llms/backend.md
CHANGED
|
@@ -69,6 +69,7 @@ ctx.secrets; // Record<string,string> — the owner's per-vibe secrets; frozen,
|
|
|
69
69
|
await ctx.db.put(doc, { db: "notes", id: "optional-id" }); // resolves to the doc id AFTER commit
|
|
70
70
|
await ctx.db.delete(docId, { db: "notes" });
|
|
71
71
|
const docs = await ctx.db.query({ db: "notes" }); // latest non-deleted docs (each with _id)
|
|
72
|
+
const text = await ctx.callAI("prompt", { model: "openrouter/auto", max_tokens: 500 }); // server-side AI call
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
- `{ db }` names the Fireproof database (same names `App.jsx` uses with
|
|
@@ -101,8 +102,22 @@ const docs = await ctx.db.query({ db: "notes" }); // latest non-deleted docs (ea
|
|
|
101
102
|
on port 443 only, 15s per request, 10MB responses, per-vibe rate caps
|
|
102
103
|
(30/10s, 300/min). Make all outbound calls **before returning** the Response —
|
|
103
104
|
a `fetch()` fired while a streamed body is still being pulled after the
|
|
104
|
-
handler returned is unsupported and gets denied.
|
|
105
|
-
`App.jsx` via `callAI`.
|
|
105
|
+
handler returned is unsupported and gets denied. Interactive frontend AI
|
|
106
|
+
calls stay in `App.jsx` via `callAI`; server-side AI belongs to `ctx.callAI`.
|
|
107
|
+
- **`ctx.callAI(prompt, options?)` is the server-side AI call.** It resolves to
|
|
108
|
+
the completion **text** (a plain string) — no API key needed and none exists
|
|
109
|
+
in the handler; the platform makes the call and meters the cost against the
|
|
110
|
+
account of the user who triggered the handler (the writer in `onChange`, the
|
|
111
|
+
signed-in caller in `fetch`), or the app owner when no user is involved
|
|
112
|
+
(`scheduled` ticks, anonymous webhooks). Options: `model` (default
|
|
113
|
+
`"openrouter/auto"`), `max_tokens`, `temperature`. No streaming and no schema
|
|
114
|
+
mode — for structured output, ask for JSON in the prompt and `JSON.parse`
|
|
115
|
+
defensively. Budget: a handful of calls per invocation (currently 5) and
|
|
116
|
+
~64k prompt chars; a denied or failed call **throws** — catch it and degrade
|
|
117
|
+
(e.g. write the doc back with an error field) rather than losing the event.
|
|
118
|
+
Keep interactive/streaming AI in `App.jsx` via `callAI`; use `ctx.callAI`
|
|
119
|
+
when the result must be server-authoritative (moderation, digests,
|
|
120
|
+
summaries users shouldn't be able to forge).
|
|
106
121
|
|
|
107
122
|
## fetch — the app's HTTP endpoint
|
|
108
123
|
|
package/llms/calendar.md
CHANGED
|
@@ -92,6 +92,11 @@ lane can't query access-fn-bound databases at all). So:
|
|
|
92
92
|
The token is auto-minted when the calendar surface opens, so the Subscribe
|
|
93
93
|
button is simply there once the user has subscribable content.
|
|
94
94
|
|
|
95
|
+
⚠️ Read the token from its OWN live query on `type: "caltoken"` (as below). A
|
|
96
|
+
`caltoken` doc never appears in your items/favorites query — looking for it
|
|
97
|
+
there means the Subscribe link never renders, even though the mint effect and
|
|
98
|
+
the feed itself work.
|
|
99
|
+
|
|
95
100
|
```jsx
|
|
96
101
|
// access.js needs a `caltoken` branch routing the doc to the owner's PRIVATE
|
|
97
102
|
// channel (like notes) — the token is the secret.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/prompts",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"description": "",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@adviser/cement": "~0.5.34",
|
|
27
|
-
"@vibes.diy/call-ai-v2": "^4.
|
|
28
|
-
"@vibes.diy/identity": "^4.
|
|
29
|
-
"@vibes.diy/use-vibes-types": "^4.
|
|
27
|
+
"@vibes.diy/call-ai-v2": "^4.3.1",
|
|
28
|
+
"@vibes.diy/identity": "^4.3.1",
|
|
29
|
+
"@vibes.diy/use-vibes-types": "^4.3.1",
|
|
30
30
|
"arktype": "~2.2.2",
|
|
31
31
|
"json-schema-faker": "~0.6.2"
|
|
32
32
|
},
|