planvortex 0.3.0 → 0.5.0

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/README.md CHANGED
@@ -102,7 +102,7 @@ for await (const publication of pv.publications.iterate(orgId, { state: ["ready"
102
102
 
103
103
  | Resource | Methods |
104
104
  | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
105
- | `pv.catalog` | `socialNetworks`, `socialLimits`, `socialCapabilities`, `socialCommentActions`, `allowedAspectRatios`, `publicationLimits`, `allowedSocialPublications`, `allowedSocialMessages` — all cached in memory per client |
105
+ | `pv.catalog` | `socialNetworks`, `socialLimits`, `socialCapabilities`, `socialCommentActions`, `allowedAspectRatios`, `publicationLimits`, `allowedSocialPublications`, `allowedSocialMessages`, `plannerTemplates` — all cached in memory per client |
106
106
  | `pv.clients` | `list`, `iterate`, `get`, `update`, `updateAiSettings`, `withOrganizations`, `organizations`, `iterateOrganizations`, `createOrganization`, `updateOrganization`, `deleteOrganization` |
107
107
  | `pv.organizations` | `get`, `update`, `remove`, `children`, `iterateChildren`, `createChild`, `limits`, `use`, `createConnectToken`, `updateAiContext`, `updateSocialCredentials`, `deleteSocialCredentials` |
108
108
  | `pv.accounts` | `list`, `iterate`, `get`, `update`, `remove`, `metrics`, `metricList`, `getPersistentMenu`, `setPersistentMenu`, `connectLinks`, `connect`, `enable` |
@@ -138,6 +138,54 @@ exception to "generated": every enumeration that grows
138
138
  with the product — `SocialNetwork`, `PublicationState`, `FileFormat` — is **open**. The known values
139
139
  autocomplete, and a network added to PlanVortex next month does not break your build.
140
140
 
141
+ ## AI plans, and what they are generated from
142
+
143
+ A plan is a **week** of drafts written by a model: you queue it, a job generates it, and what comes
144
+ out are ordinary publications in `draft` that you edit and validate. `template` says what the
145
+ content is generated FROM, and it is the only thing that changes between one plan and another —
146
+ publish days, language, tone and images stay cross-cutting options, and each template declares which
147
+ of them it accepts.
148
+
149
+ ```ts
150
+ // The list, the prices and the fields of the source step. Cached, like the rest of the catalogue.
151
+ const templates = await pv.catalog.plannerTemplates();
152
+
153
+ // A week written from the customer's own photos, in the order that tells the story.
154
+ const { ai_plan, estimate } = await pv.aiPlans.create(clientId, orgId, {
155
+ prompt: "Our autumn menu",
156
+ accounts: [accountId],
157
+ template: "from_images",
158
+ source: {
159
+ images: [
160
+ { id_upload: first, description: "Dough resting on the bench" },
161
+ { id_upload: second, description: "The loaf coming out of the oven" },
162
+ ],
163
+ },
164
+ });
165
+ console.log(estimate.images_target); // 0 — the pictures come from the source
166
+ ```
167
+
168
+ Four things worth knowing before you build the screen:
169
+
170
+ - **The template that does not generate images does not spend image credits, and images are 94 % of
171
+ a plan.** The same week — 7 publications, a picture on each — costs 519 credits as `standard` and
172
+ **48** as `from_images`. Say it before the plan is created, not after it is charged.
173
+ - **`regenerate("image")` is per template**, not just per plan: the one that did not generate the
174
+ picture cannot regenerate it. Read `regenerate.image` from the catalogue before you draw the
175
+ button — on `from_images` it would charge 70 credits to replace the user's own photo with an
176
+ invented one.
177
+ - **The source is validated when the plan is CREATED**, not when it is generated: the article is
178
+ downloaded, the catalogue is read live and the product pictures are copied inside that call. So a
179
+ broken source fails while your user is still there (2112 to 2116), and what gets stored is a
180
+ snapshot — a `retry` three days later does not depend on the article still being online.
181
+ - **A plan is weekly and the source does not extend it.** Twelve photos with six slots left publish
182
+ six, and the plan carries warning **2117** in `ai_plan.warnings` — a notice on a plan that
183
+ generated fine, not an error. The slots are your publish days times your accounts, so you can say
184
+ it in advance.
185
+
186
+ Do not hardcode the list, the costs or the field limits: `GET /planner_templates` publishes them
187
+ because the server is what charges them.
188
+
141
189
  ## The inbox
142
190
 
143
191
  Comments and messages are two different sections, not one: a comment hangs off a **publication** and