@womp/openai-plugin 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -44,4 +44,4 @@ ${t.logs.join(`
44
44
  `);return a.length>O?`${a.slice(0,O)}
45
45
  \u2026 (cut)`:a}var E=(n,t)=>`A render of design ${n}${t?` from the ${t} view`:""} is this result's image item. The card shows it too.`,R=(n,t)=>`Design ${n} is done on its card, as "${t}".`;var u=require("zod");var Z=["Conversation and card experience Give the user an experience like image generation: a brief, natural acknowledgement when useful and one","build card progressing to the inspected render. Build with sensible defaults when the request is sufficiently clear. Ask a concise question","before building when essential information or a reference is missing. For a requested likeness, obtain the necessary reference rather than","inventing a substitute. When starting a build or edit, call open_scene to open this request's card. Supply the existing designId when","continuing a design; finish_scene completes the same card. Answer questions and resolve clarifications without starting an unnecessary build.","Supply a short, user-friendly purpose for each script. The card reflects actual tool activity and owns its labels and progress presentation.","Editing and inspection may repeat. Do not invent percentages, timings or a fixed progression through the stages. Perform ordinary checks,","corrections and recoverable retries internally. Do not narrate scripts, geometry budgets or each repair attempt unless the user requests","diagnostics. Do not ask permission for routine repairs already covered by the request. Preserve unrelated work and respect explicit","dimensions and design choices. Ask one concise question when a meaningful design choice prevents completion. Explain the choice briefly and","offer alternatives compatible with the printing constraints and the host's actual capabilities. Preserve unresolved choices rather than","silently changing the design to satisfy them. When the result has been reviewed, call finish_scene once, after the latest","whole-design render_scene, with a short, natural title for this version. If a decision","remains, ask the question in chat; do not present it as ready to print. The","card already shows the render. Briefly explain meaningful adjustments after presenting the result, such as strengthening a thin attachment,","when they matter to the user. Avoid a duplicate image, geometry report, repair log or list of technical details. Offer a relevant next step","when useful. Do not generate a separate product image. The user edits by chatting,","using the existing card and conversation flow. If recovery cannot complete the request, explain the concrete obstacle and offer useful,","feasible alternatives. Describe the retained scene accurately; do not claim that failed edits left it unchanged unless verified. Use only","real backend information for manufacturing availability, price, checkout, delivery dates or manufacturing approval. Prices, checkout and","delivery dates come only from get_print_options and checkout_design. Do not claim a backend approval from the model's own review."].join(" ");var L=["Modelling and visual review Use only documented capabilities. Inspect the current scene before","editing, preserve work unrelated to the request, and keep the result editable. Use meaningful names within the permitted scene structure.","Build or change the scene with run_scene_script. Read commit receipts after errors: earlier accesses may have committed. Recover with fresh","state reads and corrected edits, preserving successful changes. Do not assume a failed script rolled back or blindly replay it. After","substantial edits, call render_scene and inspect the actual image returned. In the code environment a tool's images are the image items of",`its result's content_items; view each with image({ image_url: "data:<mimeType>;base64,<data>" }). Check silhouette, proportions, connections, intersections,`,"openings, materials and the user's requirements. Use additional views or detail views when needed. Measurements and geometry reports support","the review; they do not replace looking at the render. Resolve unintended problems and repeat the edit-render-review loop as needed. The","same tools may run many times; building, inspection and refinement are not a fixed one-way sequence. Review the current result against the","printability requirements as well as its appearance. Every further edit requires a fresh inspection before presentation. Never claim to have","seen an image that was not returned. Finish the review with a clear, well-framed view of the whole object."].join(" ");var M=["Printability and materials Create objects intended for physical printing. The completed design must contain exactly ONE Area in the scene","API, using exactly ONE supported printable material throughout. An Area is an outermost Union with no Union ancestor; it may contain","multiple primitives and nested modelling nodes. Verify the Area count and material assignment from scene API data, not the rendered image.","Do not count every node or nested Union as a separate printable object. One Area alone does not prove that its geometry forms one connected","physical piece. The entire object must fit the largest size get_print_options reports. Measure its complete bounds, including every","protrusion, attachment and loop. Convert scene units to millimetres and evaluate the bounds in the intended print orientation; do not assume","scene axes are printer axes. Respect user-specified dimensions. Dimensions exceeding that size are an unresolved design choice, not","permission to silently resize. When no size is specified, choose an appropriate size within the limits. Recheck bounds after size-changing","edits. Select one supported printable material for the whole object. Use get_print_options for the materials, colours and finishes on","offer, their permitted combinations and additional process-specific limits; not every combination is available. Do not infer a","single-colour restriction from the single-material requirement, or invent rules for mixing","finishes. Womp's ability to render an appearance does not establish that it can be manufactured. Use preview settings that approximate the","selected printable material. Do not assign different printable materials to different parts or introduce unsupported metallic, emissive,","transparent or other effects. Missing material or finish compatibility information remains unresolved when it affects the requested result.","Review dimensions, thickness of small features, attachments, intended connections, unintended loose pieces, intersections, openings,","cavities, clearances and access for support removal against the supplied manufacturing requirements. Use scene measurements where available.","Do not invent values or treat visual estimates as measured facts. Bounding-box and thickness heuristics are supporting evidence, not proof","of printability. Perform this printability review yourself using the images and scene data returned by the tools; do not assume another","agent or validator has approved the result. Correct ordinary problems and review again after changes. Missing essential manufacturing","information or measurements are unresolved checks, not passes. Do not claim print readiness while required checks remain unresolved, or","describe a model-based assessment as manufacturing certification."].join(" ");var q=[["Create printable 3D designs. Start each build or edit with open_scene; reuse its designId for edits.","Apply the printing constraints below. Repeat","run_scene_script and render_scene until reviewed, then use finish_scene to complete the same card. Keep routine","corrections internal; ask only for meaningful choices or essential missing information."].join(" "),Z,L,M].join(" ");var f=[{type:"noauth"}],h=n=>({content:[{type:"text",text:n}]}),g=(n,t)=>({"openai/toolInvocation/invoking":n,"openai/toolInvocation/invoked":t});var _=u.z.string().min(1).max(64).describe("The design's designId, from open_scene."),me=({status:n,activity:t,title:i,picture:a})=>({status:n,...t&&{activity:t},...i&&{title:i},picture:a&&{data:a.data,mimeType:a.mimeType,at:a.at}});function pe(n,t){if(!(!n||!t))try{return new URL(n.url).origin===t&&Number.isFinite(Date.parse(n.expiresAt))?{url:n.url,expiresAt:n.expiresAt}:void 0}catch{return}}function H(n,t,i,a){m(n,"open_scene",{title:"Design a 3D object",description:p.open_scene,inputSchema:{designId:u.z.string().max(64).optional().describe("Reopen this design instead of starting a new one."),title:u.z.string().max(100).optional().describe('A short name for a new design, such as "Star keychain".')},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},_meta:{ui:{visibility:["model"],resourceUri:$.design.uri},securitySchemes:f,...g("Opening your design\u2026","Design ready")}},i("open_scene",async(r,o)=>{let{designId:s,buildId:d,title:w,live:B}=await t.openScene(r,o),J={designId:s,buildId:d},S=pe(B,a);return{...h(T(s,w)),structuredContent:{...J},...S&&{_meta:{live:S}}}})),m(n,"load_scene_skill",{title:"Load the scene skill",description:p.load_scene_skill,inputSchema:{},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:["model"]},securitySchemes:f,...g("Reading the scene skill\u2026","Read the scene skill")}},i("load_scene_skill",async()=>({content:[{type:"text",text:q},{type:"text",text:A(await t.getSceneApi())}]}))),m(n,"run_scene_script",{title:"Build a 3D design",description:p.run_scene_script,inputSchema:{designId:_,purpose:u.z.string().max(240).describe('What this script does, in a few words, such as "Shaping the frog and hat".'),code:u.z.string().min(1).max(6e4).describe("A JavaScript body using the scene API from load_scene_skill.")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1},_meta:{ui:{visibility:["model"]},securitySchemes:f,...g("Building your design\u2026","Ran the script")}},i("run_scene_script",async(r,o)=>{let s=await t.runScript(r,o),d=s.images.map(w=>({type:"image",...w}));return{content:[...h(C(o.designId,s)).content,...d],isError:!s.ok}})),m(n,"render_scene",{title:"Render a 3D design",description:p.render_scene,inputSchema:{designId:_,view:u.z.enum(["front","back","left","right","top","bottom","isometric"]).optional().describe("The side to look from."),targetId:u.z.number().int().positive().optional().describe("The id of an Area, a Union or a Group to frame.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:["model"]},securitySchemes:f,...g("Rendering your design\u2026","Rendered your design")}},i("render_scene",async(r,o)=>{let s=await t.renderScene(r,o);return{content:[...h(E(o.designId,o.view)).content,{type:"image",...s}]}})),m(n,"finish_scene",{title:"Finish a 3D design",description:p.finish_scene,inputSchema:{designId:_,title:u.z.string().min(1).max(80).describe(`This version's title, such as "Red tinted clear".`)},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:["model"]},securitySchemes:f,...g("Finishing your design\u2026","Built and checked")}},i("finish_scene",async(r,o)=>(await t.finishScene(r,o),h(R(o.designId,o.title))))),m(n,"get_scene_progress",{title:"Design progress",description:p.get_scene_progress,inputSchema:{designId:_,buildId:u.z.string().min(1).max(64)},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},_meta:{ui:{visibility:["app"]},securitySchemes:f}},i("get_scene_progress",async(r,o)=>({content:[],structuredContent:{...me(await t.getBuild(r,o))}})))}var fe="There is no chat user for this request, so it has no designs.",he="The design service could not complete this request. Try again in a moment.";function ve(n){if(n)try{let t=new URL(n),i=/^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$/i.test(t.hostname);return t.protocol==="https:"&&i&&t.origin===n.replace(/\/$/,"")?t.origin:void 0}catch{return}}function F({backend:n,subject:t,onError:i,instructions:a,liveViewOrigin:r}){let o=ve(r),s=new V.McpServer({name:"3d-designs",version:"1"},{instructions:[j,a].filter(Boolean).join(`
46
46
 
47
- `)});return ge(s,o),be(s,n,ye(t,i),o),s}function ge(n,t){let i={csp:t?{frameDomains:[t]}:{},prefersBorder:!0},a=t?{"openai/widgetCSP":{connect_domains:[],resource_domains:[],frame_domains:[t]}}:{};for(let[r,{uri:o,html:s}]of Object.entries($)){let d=P[r];D(n,r,o,{mimeType:y,_meta:{ui:i}},async()=>({contents:[{uri:o,mimeType:y,text:s,_meta:{ui:i,...a,"openai/widgetDescription":d}}]}))}}function be(n,t,i,a){H(n,t,i,a)}function ye(n,t){let i=a=>({...h(a),isError:!0});return(a,r)=>async o=>{if(!n)return i(fe);try{return await r(n,o)}catch(s){return s instanceof v?i(s.message):(t?.(a,s),i(he))}}}0&&(module.exports={BackendRefusal,createServer});
47
+ `)});return ge(s,o),be(s,n,ye(t,i),o),s}function ge(n,t){let i={csp:t?{frameDomains:[t]}:{},prefersBorder:!1},a=t?{"openai/widgetCSP":{connect_domains:[],resource_domains:[],frame_domains:[t]}}:{};for(let[r,{uri:o,html:s}]of Object.entries($)){let d=P[r];D(n,r,o,{mimeType:y,_meta:{ui:i}},async()=>({contents:[{uri:o,mimeType:y,text:s,_meta:{ui:i,...a,"openai/widgetDescription":d}}]}))}}function be(n,t,i,a){H(n,t,i,a)}function ye(n,t){let i=a=>({...h(a),isError:!0});return(a,r)=>async o=>{if(!n)return i(fe);try{return await r(n,o)}catch(s){return s instanceof v?i(s.message):(t?.(a,s),i(he))}}}0&&(module.exports={BackendRefusal,createServer});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@womp/openai-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Womp in ChatGPT: the MCP tools, prompts and design card swan-backend serves.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "./dist/index.js",