@vibes.diy/prompts 14.3.342 → 14.3.344

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/cli-footer.md CHANGED
@@ -10,6 +10,7 @@
10
10
  ### Other Commands
11
11
 
12
12
  - Name the app as `handle/app-slug` on every command (a bare slug falls back to your default handle — fine at a terminal, never in a script or agent)
13
+ - `npx vibes-diy push --vibe <handle>/<app-slug> --title "Potluck Sign-up"` — name a new app; the tab, share cards and emails show it (it never renames an app that already has a name)
13
14
  - `npx vibes-diy push --vibe <handle>/<app-slug> --access gated` — deploy so anyone can view but only members write (`open` is the default, `private` is members-only)
14
15
  - `npx vibes-diy push --vibe <handle>/<app-slug> --access private` — deploy for you and the members you invite, and nobody else
15
16
  - `npx vibes-diy push --handle <handle> --app-slug other-name` — deploy to a different app slug instead of the directory name
package/llms/index.d.ts CHANGED
@@ -46,6 +46,7 @@ export { spotifyConfig } from "./spotify.js";
46
46
  export { squareConfig } from "./square.js";
47
47
  export { stripeConfig } from "./stripe.js";
48
48
  export { stripeSubscriptionsConfig } from "./stripe-subscriptions.js";
49
+ export { memberAreaConfig } from "./member-area.js";
49
50
  export { blocklyConfig } from "./blockly.js";
50
51
  export { strudelConfig } from "./strudel.js";
51
52
  export { hydraConfig } from "./hydra.js";
@@ -86,7 +87,7 @@ export { uiTestimonialsConfig } from "./ui-testimonials.js";
86
87
  export type { LlmConfig, SkillCredential, SkillEgress } from "./types.js";
87
88
  export { cueMatches, cueMatchedSkills, type CueCatalogEntry } from "./cues.js";
88
89
  export { dropCoveredSkills, expandSkills, onSkillMenu, skillGraphProblems, universalSkillNames, type NeedsCatalogEntry } from "./needs.js";
89
- export declare const allConfigs: readonly [LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig];
90
+ export declare const allConfigs: readonly [LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig, LlmConfig];
90
91
  export { mapsConfig } from "./maps.js";
91
92
  export declare const SKILL_ALIASES: ReadonlyMap<string, string>;
92
93
  export declare function canonicalSkillName(name: string): string;
package/llms/index.js CHANGED
@@ -46,6 +46,7 @@ import { spotifyConfig } from "./spotify.js";
46
46
  import { squareConfig } from "./square.js";
47
47
  import { stripeConfig } from "./stripe.js";
48
48
  import { stripeSubscriptionsConfig } from "./stripe-subscriptions.js";
49
+ import { memberAreaConfig } from "./member-area.js";
49
50
  import { blocklyConfig } from "./blockly.js";
50
51
  import { strudelConfig } from "./strudel.js";
51
52
  import { hydraConfig } from "./hydra.js";
@@ -130,6 +131,7 @@ export { spotifyConfig } from "./spotify.js";
130
131
  export { squareConfig } from "./square.js";
131
132
  export { stripeConfig } from "./stripe.js";
132
133
  export { stripeSubscriptionsConfig } from "./stripe-subscriptions.js";
134
+ export { memberAreaConfig } from "./member-area.js";
133
135
  export { blocklyConfig } from "./blockly.js";
134
136
  export { strudelConfig } from "./strudel.js";
135
137
  export { hydraConfig } from "./hydra.js";
@@ -214,6 +216,7 @@ export const allConfigs = [
214
216
  stripeConfig,
215
217
  stripeSubscriptionsConfig,
216
218
  squareConfig,
219
+ memberAreaConfig,
217
220
  groupPlanConfig,
218
221
  vibeToolsConfig,
219
222
  blocklyConfig,
@@ -0,0 +1,2 @@
1
+ import type { LlmConfig } from "./types.js";
2
+ export declare const memberAreaConfig: LlmConfig;
@@ -0,0 +1,19 @@
1
+ export const memberAreaConfig = {
2
+ name: "member-area",
3
+ label: "Member area with tiers",
4
+ description: "A member area with TIERS on top of a payment recipe — gold and platinum, supporter levels, a top tier that gets the owner's own tools — for a creator's audience from YouTube, a newsletter or a community: load it beside stripe-subscriptions (renewing, the default), square (when the person names Square) or stripe (dues or a season pass), never on its own, and only when the person asks for tiers, a members' discussion or members-only tools. Each tier is an owner-written plan record with a rank, copied onto the membership by backend.js; a member of rank N holds channels tier-1 through tier-N while entitled; every post, room and message names its lowest tier in minRank; members post in rooms their tier reads, checked with ctx.requireAccess in access.js; members-only tools run in backend.js and answer 403 below the tool's rank before ctx.callAI; on Square or a one-time Stripe charge a tier is a pass whose paidThrough each paid order moves forward. One database for memberships, plans, posts, rooms and messages. A single members-only feed with one price and no tiers, discussion or tools is stripe-subscriptions alone",
5
+ cues: [
6
+ "member area",
7
+ "members area",
8
+ "members' area",
9
+ "membership tiers",
10
+ "tiers",
11
+ "gold and platinum",
12
+ "supporter tiers",
13
+ "patron tiers",
14
+ "members-only discussion",
15
+ "members only discussion",
16
+ "members-only tools",
17
+ "community for my subscribers",
18
+ ],
19
+ };
@@ -0,0 +1,212 @@
1
+ # Member area — tiers, a members' discussion, and members-only tools
2
+
3
+ When someone asks for a **member area with tiers** — gold and platinum for a
4
+ YouTube audience, supporter levels for a newsletter, a community where the top
5
+ tier gets the owner's own tools — build the layer this page teaches on top of
6
+ a payment recipe. The payment recipe decides *who paid and until when*; this
7
+ page decides *what each tier opens*: a ladder of tiers, a discussion members
8
+ post in, and tools that only a tier's members can run.
9
+
10
+ **This page sits on a payment recipe, and it works the same on each one.**
11
+
12
+ - **Stripe, renewing** (the default, and what "a month", "subscribe" or "a
13
+ membership" means): the `stripe-subscriptions` recipe. Stripe renews and
14
+ retries, and its status plus the grace period is the entitlement.
15
+ - **Square** ("I sell on Square", "with my Square account"): the `square`
16
+ recipe, which takes one payment at a time. A tier is a **pass**: the member
17
+ buys a month (or a year) and buys the next one when it runs out (§ 6).
18
+ - **Stripe, once** (annual dues, a season pass with no renewal): the `stripe`
19
+ recipe, with the same pass shape as Square.
20
+
21
+ Whichever it is, the payment recipe keeps its own rules word for word — its
22
+ setup items, its read-back, its sweep, its mode. This page adds a field to its
23
+ plan record, a field to its membership record, and the records the member
24
+ area holds. Nothing here talks to a payment provider.
25
+
26
+ **One database.** Grants are reduced per database, so the membership records,
27
+ the plans, the posts, the rooms and the messages all live in the payment
28
+ recipe's one database (`club` in `stripe-subscriptions`), and one access
29
+ function handles every type. A discussion kept in a second database would
30
+ grant a paying member a channel no message is on.
31
+
32
+ **The owner names the tiers.** The app's code writes no tier names and no
33
+ prices: "Gold" and "Platinum" are plan records the owner creates on the
34
+ **Plans** screen, and the page shows each plan's own title. Asking the builder
35
+ for "a gold tier at $5 and a platinum tier at $15" writes those two records,
36
+ the same ones the screen does.
37
+
38
+ ## 1. A tier is a plan with a rank
39
+
40
+ Each tier is a plan with a rank the owner sets — 1 for the first tier, 2 for the one above it — and the membership carries the rank of the plan it was settled for, copied by backend.js from the plan record, never sent by the browser.
41
+
42
+ - The plan record gains `rank`, a whole number from 1 to `MAX_RANK` (5). The
43
+ **Plans** screen shows it as "Tier 1, 2, 3" beside the title, and `access.js`
44
+ checks it with the plan's price and interval. Two plans may share a rank —
45
+ a monthly and a yearly Gold are both rank 1.
46
+ - The route that opens checkout (`/subscribe` in `stripe-subscriptions`, the
47
+ pass checkout in § 6) copies `rank` from the plan record onto the pending
48
+ membership beside the price, exactly as it copies the amount. The browser
49
+ names a plan; the rank, like the price, is the server's reading of it.
50
+ - `access.js` checks a new membership's `rank` is a whole number from 1 to
51
+ `MAX_RANK`, and every later change of it goes through `ctx.requireBackend()`
52
+ with the rest of the membership.
53
+
54
+ ## 2. A higher tier opens everything below it
55
+
56
+ A member of rank N holds every tier channel from tier-1 to tier-N, so a higher tier opens everything below it: the access function grants them from the membership record's rank while it is entitled.
57
+
58
+ ```js
59
+ const MAX_RANK = 5;
60
+ // tier-1 … tier-<rank>: Platinum (rank 2) reads Gold's posts and its own.
61
+ const tiersUpTo = (rank) => Array.from({ length: Math.min(rank, MAX_RANK) }, (_, i) => `tier-${i + 1}`);
62
+ ```
63
+
64
+ The membership case of the access function grants `tiersUpTo(doc.rank)` in
65
+ place of the single `members` channel the payment recipe grants, and only
66
+ while `doc.entitled === true`; the rewrite that says otherwise takes every
67
+ tier away on the next sync. The owner holds every tier through the role grant
68
+ (`roles: { owner: tiersUpTo(MAX_RANK) }`), so the owner reads every room.
69
+
70
+ The page reads the same facts for display: `access.hasChannel("tier-2")`
71
+ shows the Platinum room's door open, and a Gold member sees it with
72
+ "Platinum members" and the Join button for that plan. Display never decides
73
+ access; the grant does.
74
+
75
+ ## 3. Every members-only thing names its lowest tier
76
+
77
+ Every members-only document — a post, a room, a message, a file — names the lowest tier that reads it in minRank, and the access function routes it to that tier's channel.
78
+
79
+ - A **post** the owner writes carries `minRank` (0 for public): the access
80
+ function checks `ctx.requireRole("owner")` and routes it to
81
+ `minRank > 0 ? \`tier-${minRank}\` : "public"`. The owner's post form picks
82
+ the tier from the plans that exist, by title.
83
+ - A **room** is the owner's: `_id` is `room-<minRank>-<slug>`, written only by
84
+ the owner, with a title and a line about what it is for. A Gold room and a
85
+ Platinum room are two rooms.
86
+ - A file a member downloads (a pattern, a recording) is a post with the file
87
+ on it, so it follows the same rule.
88
+
89
+ ## 4. The discussion: members post where their tier reads
90
+
91
+ A member posts to the discussion only into a room their tier reads: the access function checks the author is the signed-in member and calls ctx.requireAccess on the room's tier channel.
92
+
93
+ A `message` carries `roomId`, `minRank`, `authorHandle`, `text` and
94
+ `createdAt`. The access function can read only the document in front of it,
95
+ so the room's tier is written into the room's id and the message proves it
96
+ carries the same one:
97
+
98
+ ```js
99
+ if (doc.type === "message") {
100
+ if (!Number.isInteger(doc.minRank) || doc.minRank < 1 || !doc.roomId?.startsWith(`room-${doc.minRank}-`)) {
101
+ throw { forbidden: "a message carries its room's tier" };
102
+ }
103
+ if (oldDoc && (oldDoc.authorHandle !== doc.authorHandle || oldDoc.roomId !== doc.roomId)) throw { forbidden: "a message keeps its author and its room" };
104
+ if (oldDoc && doc.authorHandle !== user.userHandle) {
105
+ // The owner's moderation: hiding someone else's message, never rewriting it.
106
+ ctx.requireRole("owner");
107
+ if (doc.text !== oldDoc.text) throw { forbidden: "the owner hides a message, never rewrites it" };
108
+ } else {
109
+ if (doc.authorHandle !== user.userHandle) throw { forbidden: "a message is its author's" };
110
+ // The writer holds the room's tier right now: a lapsed member reads nothing and posts nothing.
111
+ ctx.requireAccess(`tier-${doc.minRank}`);
112
+ }
113
+ return { channels: [`tier-${doc.minRank}`] };
114
+ }
115
+ ```
116
+
117
+ The owner hides any message with a `hidden: true` rewrite the page filters
118
+ out; a member edits only their own. The page lists a room's
119
+ messages with a live query on `roomId`, newest last, with the composer gated
120
+ on `can.create(...)` for that room — so a lapsed member sees the room's door,
121
+ "Rejoin to post", and no composer.
122
+
123
+ ## 5. Members-only tools run in backend.js
124
+
125
+ A members-only tool runs in backend.js: the route reads the caller's own membership record and answers 403 unless it is entitled at the tool's rank, before it calls ctx.callAI or anything else that costs the owner.
126
+
127
+ The tool is often the reason the top tier exists — a sewing-pattern advisor
128
+ that knows the owner's own fitting rules, a critique of a member's draft in
129
+ the owner's voice, a calculator built on the owner's method. Its prompt and
130
+ its know-how are the owner's work, so they live in `backend.js`, where no
131
+ browser reads them, and the page sends only the member's question.
132
+
133
+ ```js
134
+ // The owner's tools, each with the lowest tier that runs it.
135
+ const TOOLS = { "pattern-advisor": { minRank: 2 } };
136
+
137
+ async function memberRank(ctx, mode) {
138
+ const me = ctx.userInfo?.userHandle;
139
+ if (!me) return 0;
140
+ if (me === ctx.appInfo.ownerHandle) return MAX_RANK; // the owner runs every tool, as the page shows them
141
+ const m = await ctx.db.get(`membership-${mode}-${me}`, { db: DB });
142
+ return m?.entitled === true && Number.isInteger(m.rank) ? m.rank : 0;
143
+ }
144
+
145
+ // inside fetch(request, ctx):
146
+ if (url.pathname === "/tool/pattern-advisor" && request.method === "POST") {
147
+ const { mode } = await checkoutMode(ctx);
148
+ if ((await memberRank(ctx, mode)) < TOOLS["pattern-advisor"].minRank) {
149
+ return json({ ok: false, reason: "tier", minRank: TOOLS["pattern-advisor"].minRank }, 403);
150
+ }
151
+ const { question } = await request.json();
152
+ const answer = await ctx.callAI(`${ADVISOR_PROMPT}\n\nThe member asks: ${String(question).slice(0, 4000)}`, { max_tokens: 900 });
153
+ return json({ ok: true, answer });
154
+ }
155
+ ```
156
+
157
+ - The route reads **one** record, the caller's own membership in the app's
158
+ current mode, so it sits under the `unfilteredReads` declaration the payment
159
+ recipe already makes; add the tool routes to its `why`.
160
+ - The page calls it with `apiFetch`, shows the tool to a member whose tier
161
+ runs it, and shows a member below it the tool's name, what it does and the
162
+ plan that opens it. A 403 with `reason: "tier"` reads the same way.
163
+ - `ctx.callAI` in a `fetch` route runs on the signed-in caller's credits; a
164
+ tool that saves its answers writes them to the member's own channel
165
+ (`user:<handle>`), so each member's history is theirs.
166
+
167
+ ## 6. Passes: a tier on Square, or on Stripe once
168
+
169
+ On Square, which takes one payment at a time, a tier is a pass: each paid order moves the membership's paidThrough forward by the plan's period, and backend.js writes entitled from paidThrough and the clock.
170
+
171
+ - The plan is the payment recipe's product record with `rank` and an
172
+ `interval` of `month` or `year`; a pass order is one line, that plan, priced
173
+ from the record like every other line.
174
+ - A pass membership is named for the payment's mode as well as the member,
175
+ `membership-<mode>-<handle>` (Stripe's `test` or `live`, Square's `sandbox`
176
+ or `production`), exactly as the payment recipe keeps its orders apart: a
177
+ test pass grants nothing once the app takes real money, and the tool check
178
+ and the page read the record for the app's current mode only.
179
+ - When the recipe's settle marks a pass order paid, the same settle rewrites
180
+ the buyer's membership record in the order's own mode: `paidThrough` becomes
181
+ `max(now, paidThrough) + one interval`, `rank` becomes the plan's, and
182
+ `entitled` is `paidThrough > now`. A member who buys early keeps every day
183
+ they already paid for.
184
+ - The recipe's scheduled sweep also reads every entitled membership and
185
+ rewrites `entitled: false` once `paidThrough` has passed, so a lapsed pass
186
+ closes the tiers on its own. Three days before, the sweep tells the member
187
+ with `ctx.notify` (dedupeKey `renew-<handle>-<paidThrough>`) that their pass
188
+ runs to that date, with the app's link to buy the next one.
189
+ - A pass order needs the buyer signed in, because the membership is theirs:
190
+ the Join button asks for sign-in first, and the order records
191
+ `buyerHandle`.
192
+ - Moving up a tier on a pass is buying the higher pass: the new rank applies
193
+ at once, and the days left carry over.
194
+
195
+ ## 7. The front door is a link the owner shares
196
+
197
+ The owner finds their people somewhere else — a video's description, a
198
+ newsletter, a pinned post — so the public page is the one they link. It reads
199
+ well to someone arriving cold: the owner's name and what the community is
200
+ for, each tier's title, price and what it opens (the rooms and tools at that
201
+ rank, read from the records), a Join per tier, and one public post or a
202
+ sample of the tool's output that shows what members get. The owner's **Share**
203
+ button copies that link with `?from=` set to where they will post it
204
+ (`youtube`, `newsletter`), and the membership records that `from` once, so the
205
+ **Members** page can say where each member came from.
206
+
207
+ **Changing tier on a renewing plan.** On `stripe-subscriptions` the app does
208
+ not change a live subscription's price, so a member holds one tier per
209
+ subscription. The page says which tier they hold and when it renews, and a
210
+ member who wants another tier cancels in the Customer Portal — which keeps
211
+ their tier to the end of the period they paid for — and joins the other tier
212
+ from the app once that period ends.
package/llms/square.md CHANGED
@@ -36,7 +36,9 @@ page).
36
36
  **One-time payments.** A payment link takes one payment for one order. Sell a
37
37
  period as a one-time item (a season pass, this month's class) and say so; a
38
38
  renewing Square subscription needs plans in the owner's Square catalog, which
39
- is beyond this recipe.
39
+ is beyond this recipe. A members' area on Square sells **passes** — a month of
40
+ Gold, a year of Platinum — and the `member-area` skill, beside this one,
41
+ turns each paid pass into a membership with a paid-through date.
40
42
 
41
43
  **The first sale is real money.** The owner's production token charges real
42
44
  cards, so the Setup screen says so plainly and suggests the owner buy their
@@ -22,7 +22,9 @@ a ticket, a deposit — is the `stripe` skill, not this one.
22
22
  **One merchant, many members.** Every member pays the Stripe account the owner
23
23
  connected. A member is a signed-in person whose membership is a record between
24
24
  them and the owner, and the members-only content is a channel that record
25
- grants. An app where each visitor sells their own subscriptions is a
25
+ grants. Tiers (gold and platinum), a members' discussion and members-only
26
+ tools are the `member-area` skill, which loads beside this one and swaps the
27
+ single `members` channel for a ladder of tier channels. An app where each visitor sells their own subscriptions is a
26
28
  marketplace, a bigger thing than this recipe — say so and build the
27
29
  one-merchant half.
28
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/prompts",
3
- "version": "14.3.342",
3
+ "version": "14.3.344",
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.342",
43
- "@vibes.diy/call-ai-v2": "14.3.342",
44
- "@vibes.diy/identity": "14.3.342",
45
- "@vibes.diy/use-vibes-types": "14.3.342",
42
+ "@vibes.diy/api-types": "14.3.344",
43
+ "@vibes.diy/call-ai-v2": "14.3.344",
44
+ "@vibes.diy/identity": "14.3.344",
45
+ "@vibes.diy/use-vibes-types": "14.3.344",
46
46
  "arktype": "~2.2.9",
47
47
  "json-schema-faker": "~0.6.4"
48
48
  },