@womp/openai-plugin 0.13.0 → 0.15.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/README.md CHANGED
@@ -58,6 +58,27 @@ sign-in.
58
58
 
59
59
  ## Contract
60
60
 
61
+ ### Ownership
62
+
63
+ The host knows and does; the plugin decides and speaks. Each concern has one owner.
64
+
65
+ | Concern | Owner |
66
+ |---|---|
67
+ | Who the caller is (`subject`) | host |
68
+ | What is on offer, and each material's finishes, colour rule, prices and print look | host |
69
+ | What a scene measures: size, pieces, colours and their nearest Pantone coated shades, the Areas that print | host |
70
+ | What was finished, in which material and finish (`finishedAs`) | host |
71
+ | Designs, builds, checkouts, payments and orders, and every change to them | host |
72
+ | The print rules: when a design can be finished or ordered (`printability.ts`) | plugin |
73
+ | Everything the model reads: workflow, tool descriptions, results, failures and their fixes | plugin |
74
+ | The tools: names, schemas, and which backend call each makes when | plugin |
75
+ | What the cards show | plugin |
76
+
77
+ The plugin asks the host for facts, judges them with its rules, and asks the host to act only when they pass. The host
78
+ still guards each action, so it never stores, prices or charges anything invalid, with a short plain error and no
79
+ advice: a guard that fires is a bug. The host words a refusal for the model (`BackendRefusal`) only with a fact the
80
+ plugin cannot know, such as which Areas print.
81
+
61
82
  ### Host → plugin: `WompBackend`
62
83
 
63
84
  | Method | Does |
@@ -67,12 +88,12 @@ sign-in.
67
88
  | `runScript(subject, { designId, code, purpose })` | runs one script on the design; `purpose` becomes the current build's activity, its last screenshot or a fresh render its picture; a failed script returns `ok: false` |
68
89
  | `renderScene(subject, { designId, view?, targetId? })` | renders the design; the image also becomes the current build's picture |
69
90
  | `getMaterials(subject)` | the materials on offer to the caller, before any design exists: each with its label, whether it prints in one colour (`colorRequired`) and its finishes, the first the default; and the largest size checkout takes |
70
- | `analyzePrint(subject, { designId, longestSideCm?, parts? })` | the design as its scene is now, analysed as it prints at its own size, or scaled so its longest side is `longestSideCm`, changing nothing, leaving out Areas named `REFERENCE` (bought parts modelled only to show a fit); with `parts` (node ids of Areas that print), only those Areas, at the scale of the whole design: size, whether it fits the largest size, separate pieces, and the price per piece in each material on offer |
71
- | `finishScene(subject, { designId, title })` | marks the current build done, with this version's title; called only for a design that passed the print checks |
91
+ | `analyzePrint(subject, { designId, longestSideCm?, parts? })` | the design as its scene is now, analysed as it prints at its own size, or scaled so its longest side is `longestSideCm`, changing nothing, leaving out Areas named `REFERENCE` (bought parts modelled only to show a fit); with `parts` (node ids of Areas that print), only those Areas, at the scale of the whole design: size, whether it fits the largest size, separate pieces, the colours on the printed parts' surfaces with the nearest Pantone coated shade of each, the material and finish the last `finishScene` gave all these parts (`finishedAs`, until a script or a new build changes the design), and the price per piece in each material on offer |
92
+ | `finishScene(subject, { designId, title, items })` | marks the current build done, with this version's title, and prints each item `{ parts?, material, finish? }`, the Areas `parts` names or the whole design, in its material and finish: writes that look into the scene, as the web's print view shows it (a preset material's surface, in the parts' colour for a one-colour material; a full-colour material's finish over the parts' own colours), so the build's picture, the live view and every later render show the print, and records it as `analyzePrint`'s `finishedAs`; refuses a printed Area in no item or in two; called only when every item passed the print checks |
72
93
  | `liveView?(subject, { designId })` | optional: the caller's design live in 3D on `liveViewOrigin`, with a new key, made each time the design card opens its live view; a design that isn't the caller's is a `BackendRefusal`; undefined when it can't now; without it, or without `liveViewOrigin`, the design card offers no live view |
73
94
  | `claimLink?(subject)` | optional: a one-time link to a page that keeps the chat's designs in an account; without it the design card offers no button |
74
95
  | `getBuild(subject, { designId, buildId })` | a build's status, activity, title and picture; a build that isn't the caller's reads as empty |
75
- | `checkoutDesign(subject, { designId, items, longestSideCm?, shipTo? })` | freezes the design as quoted, at its own size or scaled to `longestSideCm`, and without its `REFERENCE` Areas, and returns the quote with one checkout link for all its `items`, each `{ parts?, material, color?, finish?, quantity? }`: the Areas `parts` names, or the whole design, priced on its own; with `shipTo`, also shipping to that address: from a host with `completeCheckout`, the order there as a payment-sheet `session`, else `shipping`, the cheapest shipping as the user's checkout on the web first offers it and the day it arrives; called only when every item passed the print checks |
96
+ | `checkoutDesign(subject, { designId, items, longestSideCm?, shipTo? })` | freezes the design as quoted, at its own size or scaled to `longestSideCm`, and without its `REFERENCE` Areas, and returns the quote with one checkout link for all its `items`, each `{ parts?, quantity? }`: the Areas `parts` names, or the whole design, priced on its own, in the material and finish `finishScene` gave them and in their colours in the scene, each item naming the Areas it prints, also for the whole design, so the quote card lists the printed parts; with `shipTo`, also shipping to that address: from a host with `completeCheckout`, the order there as a payment-sheet `session`, else `shipping`, the cheapest shipping as the user's checkout on the web first offers it and the day it arrives; called only when every item passed the print checks |
76
97
  | `checkoutLink?(subject, { url })` | optional: `url`, a checkout link `checkoutDesign` returned, as a one-time link that for a few minutes also signs a signed-out browser in to the caller's account; undefined when it can't now; without it, or then, the quote card's Checkout opens `url` as it is |
77
98
  | `completeCheckout?(subject, payment)` | optional: charges a payment made in ChatGPT's payment sheet and places the session's order; without it there is no `complete_checkout`, and a quote to an address carries `shipping` instead of a session |
78
99
  | `getOrderStatus(subject, { orderId? })` | the caller's paid orders, newest first, and the one to show, with no name, address, email or money |
@@ -84,13 +105,13 @@ changes an earlier one.
84
105
 
85
106
  - **Identity.** Every tool acts as `subject`, the signed-in Womp account. Tool arguments and client `_meta` are never read for identity. Without a subject every tool call fails; with `wwwAuthenticate`, the failure carries that challenge in `_meta["mcp/www_authenticate"]`, so ChatGPT offers to link the account.
86
107
  - **Brief and review.** `open_scene` requires a brief (a full one for a new design, an edit brief to reopen one) and `finish_scene` the critic's review. Both stay in the chat: the backend never receives them.
87
- - **Print checks.** `finish_scene` and `checkout_design` take the material, finish, colour and pieces, analyse the design as it is now (`analyzePrint`) and check it (`printability.ts`): the material and finish are on offer, a material that prints in one colour has it as `#rrggbb`, the size fits, and it prints as the pieces given (1 by default). `checkout_design` takes them for each of its items and checks each item on its own: the parts it names, or the whole design. Only a design that passes is finished (`finishScene`), and only when every item passes is it quoted (`checkoutDesign`).
108
+ - **Print checks.** `finish_scene` takes items, each the whole design or some of its parts with a material, finish and pieces; it analyses each item as it is now (`analyzePrint`) and checks it (`printability.ts`): the material and finish are on offer, in a material that prints in one colour the item's parts have one colour and it is a Pantone coated shade, the size fits, and it prints as the pieces given (1 by default); with several items, no item holds parts joined to parts in another, since joined parts print as one piece. Only when every item passes is the design finished (`finishScene`), which shows each part in its print material, so the card is the print. `checkout_design` takes items of parts, pieces and quantity, never a material: it checks each item again in the material and finish `finishScene` gave its parts (`finishedAs`), refuses parts not finished in one, checks that items naming separate parts split no joined parts, and only when every item passes is it quoted (`checkoutDesign`).
88
109
  - **Prompts** are five parts, each a template literal in its own tag, after one line on the workflow.
89
- - `<brief>` (`brief.ts`): what to build: research, size, parts, proportions, silhouette, the material and the pieces.
110
+ - `<brief>` (`brief.ts`): what to build: research, size, parts (each hard or soft), proportions, silhouette, the style, the material and the pieces; for a likeness, a character or an object shown only in a photo, a concept image to approve and then a front, side and back turnaround as the reference.
90
111
  - `<experience>` (`experience.ts`): the user, the conversation, the card, the product shot, the order of the tools, the print checks as they reach the user.
91
- - `<modelling>` (`modelling.ts`): building, inspecting and reviewing the scene, the Womp way and the critic pass.
112
+ - `<modelling>` (`modelling.ts`): building, inspecting and reviewing the scene: how Womp builds (distance fields, CSG, goop as a blend set by eye, Areas, colour across a goop join, resolution, Curves), the Womp way, detail in four layers, Womp craft recipes and the critic pass.
92
113
  - `<hardware>` (`hardware.ts`): cases for real devices: the fit model in `REFERENCE` Areas, the case around it, the build guide and the Womp price.
93
- - `<printability>` (`printability.ts`): the physical object: one material, real colours, the review before finishing, how each material prints, what finish_scene and checkout_design check, and a guide to minimums while building (walls by size, protrusions and loops, details, moving and separate parts).
114
+ - `<printability>` (`printability.ts`): the physical object: one material, real colours, the review before finishing, how each material prints, what finish_scene and checkout_design check, a guide to minimums while building (walls by size, protrusions and loops, details, moving and separate parts), the 2 mm detail floor for small prints, and pointers to Womp's docs and published design rules.
94
115
  - **Errors.** A `BackendRefusal` message reaches the model as is. Any other error is one generic failure, reported to `onError`.
95
116
  - **Tool metadata states facts.** Descriptions, input schemas and server instructions say what a tool does, never how the model should behave. Behaviour lives in `prompts/` and reaches the model in `load_scene_skill`'s result.
96
117
  - **Every tool** declares `ui.visibility`, explicit annotation hints, and `securitySchemes: oauth2` with the `mcp:generate` scope. Tools only a card calls are `ui.visibility: ["app"]`.
package/dist/index.d.ts CHANGED
@@ -62,15 +62,20 @@ interface MinimumOrder {
62
62
  }
63
63
  /** One material on offer for printing. */
64
64
  interface Material {
65
- /** The name finish_scene and checkout_design take, such as "resin-clear-tinted". */
65
+ /** The name finish_scene takes, such as "resin-clear-tinted". */
66
66
  material: string;
67
67
  /** Such as "Tinted clear". */
68
68
  label: string;
69
- /** The whole print is one dye colour, which the order names. */
69
+ /** Its parts print in one dye colour: their colour in the scene. */
70
70
  colorRequired: boolean;
71
71
  /** The finishes it is made in; the first is the default. */
72
72
  finishes: string[];
73
73
  }
74
+ /** A material and one of its finishes; `finish` is absent for a material without finishes. */
75
+ interface PrintMaterial {
76
+ material: string;
77
+ finish?: string;
78
+ }
74
79
  /** One material a design can be printed in, priced per piece. */
75
80
  interface PrintOption extends Material {
76
81
  /** Per piece, before shipping. */
@@ -86,6 +91,13 @@ interface PrintAnalysis {
86
91
  sizeCm: Size;
87
92
  /** How many separate pieces it prints as. */
88
93
  pieces: number;
94
+ /** Each colour on the printed parts' surfaces, as #rrggbb, with the nearest Pantone coated shade's. */
95
+ colors: {
96
+ hex: string;
97
+ pantone: string;
98
+ }[];
99
+ /** The material and finish the last finishScene gave all these parts, until a script or a new build changes the design; absent otherwise. */
100
+ finishedAs?: PrintMaterial;
89
101
  /** The largest size checkout takes, in cm, in any orientation. */
90
102
  maxSizeCm: [number, number, number];
91
103
  /** Whether `sizeCm` fits within `maxSizeCm`. */
@@ -115,7 +127,7 @@ interface Checkout {
115
127
  designId: string;
116
128
  title: string;
117
129
  items: {
118
- /** The names of the Areas it prints; empty for the whole design. */
130
+ /** The names of the Areas it prints, REFERENCE Areas left out, also for the whole design. */
119
131
  parts: string[];
120
132
  /** The item as an order lists it, such as "Tinted clear · #e11d48 · glossy · 4.0 × 3.0 × 1.0 cm". */
121
133
  summary: string;
@@ -280,9 +292,17 @@ interface WompBackend {
280
292
  longestSideCm?: number;
281
293
  parts?: number[];
282
294
  }): Promise<PrintAnalysis>;
295
+ /**
296
+ * Marks the current build done, with this version's title, and prints each item's parts, the Areas `parts` names or
297
+ * the whole design, in its material and finish: shows them so in the scene, its picture and live view, and records it
298
+ * for `analyzePrint` and `checkoutDesign`. A printed Area in no item or in two is refused.
299
+ */
283
300
  finishScene(subject: string, input: {
284
301
  designId: string;
285
302
  title: string;
303
+ items: ({
304
+ parts?: number[];
305
+ } & PrintMaterial)[];
286
306
  }): Promise<void>;
287
307
  /**
288
308
  * Optional: the design live in 3D with a new key, which the card asks for each time it opens the live view. A design
@@ -300,16 +320,14 @@ interface WompBackend {
300
320
  }): Promise<Build>;
301
321
  /**
302
322
  * Freezes the design as quoted, at `longestSideCm` when given, so its order prints it as it is now: every item in one
303
- * checkout, each the Areas its `parts` names or the whole design. With `shipTo`, the quote also prices shipping there:
323
+ * checkout, each the Areas its `parts` names or the whole design, in the material and finish finishScene gave them and
324
+ * their colour in the scene. With `shipTo`, the quote also prices shipping there:
304
325
  * as a `session` from a host with `completeCheckout`, else as `shipping`.
305
326
  */
306
327
  checkoutDesign(subject: string, input: {
307
328
  designId: string;
308
329
  items: {
309
330
  parts?: number[];
310
- material: string;
311
- color?: string;
312
- finish?: string;
313
331
  quantity?: number;
314
332
  }[];
315
333
  longestSideCm?: number;