@mulmoclaude/shapescript-plugin 2.7.1 → 3.0.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/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/publish.d.ts +23 -8
- package/dist/core/publish.d.ts.map +1 -1
- package/dist/{core-Bt3MvxL7.js → core-7JKG8RwN.js} +44 -36
- package/dist/core-Z6twLrfC.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/lang/de.d.ts.map +1 -1
- package/dist/lang/en.d.ts.map +1 -1
- package/dist/lang/es.d.ts.map +1 -1
- package/dist/lang/fr.d.ts.map +1 -1
- package/dist/lang/ja.d.ts.map +1 -1
- package/dist/lang/ko.d.ts.map +1 -1
- package/dist/lang/messages.d.ts +4 -0
- package/dist/lang/messages.d.ts.map +1 -1
- package/dist/lang/ptBR.d.ts.map +1 -1
- package/dist/lang/zh.d.ts.map +1 -1
- package/dist/render/index.d.ts +1 -1
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/tool.d.ts +6 -0
- package/dist/render/tool.d.ts.map +1 -1
- package/dist/render.cjs +5 -5
- package/dist/render.js +23 -23
- package/dist/style.css +1 -1
- package/dist/vue/View.vue.d.ts.map +1 -1
- package/dist/vue.cjs +3 -3
- package/dist/vue.js +369 -338
- package/package.json +3 -3
- package/dist/core-B3GMdzSM.cjs +0 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { isPresentableShapePath, isShapeArtifactPath, shapeArtifactPath, usdzArt
|
|
|
10
10
|
export { sceneToUsdz, shapeScriptToUsdz, USDZ_MIME_TYPE, USDZ_EXTENSION } from "../export/usdz";
|
|
11
11
|
export { resolveShapeSource, executeExportShapeScriptUsdz, EXPORT_USDZ_TOOL_NAME, EXPORT_USDZ_DESCRIPTION, EXPORT_USDZ_PROMPT, EXPORT_USDZ_SCHEMA, EXPORT_USDZ_TOOL_TIMEOUT_MS, } from "../export/tool";
|
|
12
12
|
export type { ExportUsdzResult } from "../export/tool";
|
|
13
|
-
export { executePublishShapeScript, shapePostFrom, shapePostUrl, normalizeKeywords as normalizeShapeKeywords, PUBLISH_TOOL_NAME, PUBLISH_DESCRIPTION, PUBLISH_PROMPT, PUBLISH_SCHEMA, SHAPE_GALLERY_URL, SHAPE_POST_KEYS, SHAPE_POST_LIMITS, NOT_CONNECTED_MESSAGE, } from "./publish";
|
|
13
|
+
export { executePublishShapeScript, shapePostFrom, shapePostUrl, normalizeKeywords as normalizeShapeKeywords, PUBLISH_TOOL_NAME, PUBLISH_DESCRIPTION, PUBLISH_PROMPT, PUBLISH_SCHEMA, SHAPE_GALLERY_URL, SHAPE_POST_KEYS, SHAPE_POST_LIMITS, SHAPE_SCRIPT_CONTENT_TYPE, SHAPE_OBJECT_CACHE_CONTROL, requireScriptBytes, NOT_CONNECTED_MESSAGE, } from "./publish";
|
|
14
14
|
export type { PublishShapeScriptContext, PublishShapeResult, ShapeGalleryWriter, ShapePostDoc } from "./publish";
|
|
15
15
|
export { samples } from "./samples";
|
|
16
16
|
export { parseShapeScript } from "../shapescript/parser";
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrF,YAAY,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EA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AAmB,EACnB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACrE,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/core/publish.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ export declare const SHAPE_GALLERY_URL = "https://server.mulmocast.com";
|
|
|
7
7
|
export declare const SHAPE_POST_LIMITS: {
|
|
8
8
|
readonly titleMax: 120;
|
|
9
9
|
readonly descriptionMax: 2000;
|
|
10
|
-
|
|
10
|
+
/** In UTF-8 BYTES — the script is a Storage object and the gallery's Storage rule caps one
|
|
11
|
+
* at 10 MiB (`request.resource.size`); a script with Japanese comments is up to three bytes
|
|
12
|
+
* a character. This is the transport ceiling; what a phone can draw is the practical one. */
|
|
13
|
+
readonly scriptMax: number;
|
|
11
14
|
readonly promptMax: 4000;
|
|
12
15
|
readonly authorNameMax: 80;
|
|
13
16
|
readonly keywordsMax: 10;
|
|
@@ -57,13 +60,14 @@ export declare const PUBLISH_SCHEMA: {
|
|
|
57
60
|
/** The document a post is, minus the two server-stamped times the host adds
|
|
58
61
|
* (`createdAt` / `updatedAt` must be `serverTimestamp()` — the rules refuse
|
|
59
62
|
* anything else). Every key present with a value: the rules pin the set and
|
|
60
|
-
* Firestore rejects `undefined`.
|
|
63
|
+
* Firestore rejects `undefined`. The script is `scriptId`, the Storage object
|
|
64
|
+
* `uploadScript` returned — never the text. */
|
|
61
65
|
export interface ShapePostDoc {
|
|
62
66
|
uid: string;
|
|
63
67
|
authorName: string;
|
|
64
68
|
title: string;
|
|
65
69
|
description: string;
|
|
66
|
-
|
|
70
|
+
scriptId: string;
|
|
67
71
|
source: "prompt";
|
|
68
72
|
prompt: string;
|
|
69
73
|
photoIds: string[];
|
|
@@ -73,7 +77,7 @@ export interface ShapePostDoc {
|
|
|
73
77
|
published: boolean;
|
|
74
78
|
}
|
|
75
79
|
/** The key set mulmoserver's rules accept, in the rules' own order. */
|
|
76
|
-
export declare const SHAPE_POST_KEYS: readonly ["uid", "authorName", "title", "description", "
|
|
80
|
+
export declare const SHAPE_POST_KEYS: readonly ["uid", "authorName", "title", "description", "scriptId", "source", "prompt", "photoIds", "thumbnailId", "forkedFrom", "keywords", "published"];
|
|
77
81
|
/** What a host supplies: who is posting, and the writes, over its own
|
|
78
82
|
* signed-in session — the Firestore document and the Storage object the
|
|
79
83
|
* gallery card shows. */
|
|
@@ -88,7 +92,10 @@ export interface ShapeGalleryWriter {
|
|
|
88
92
|
createPost: (id: string, doc: ShapePostDoc) => Promise<void>;
|
|
89
93
|
/** Store a PNG under the post and return the object id the document carries. */
|
|
90
94
|
uploadThumbnail: (id: string, png: Uint8Array) => Promise<string>;
|
|
91
|
-
/**
|
|
95
|
+
/** Store the ShapeScript source under the post as `SHAPE_SCRIPT_CONTENT_TYPE` and return
|
|
96
|
+
* the object id the document carries as `scriptId`. */
|
|
97
|
+
uploadScript: (id: string, script: string) => Promise<string>;
|
|
98
|
+
/** Remove an object under the post — the thumbnail or script of a post that was never written. */
|
|
92
99
|
deleteObject: (id: string, objectId: string) => Promise<void>;
|
|
93
100
|
}
|
|
94
101
|
export interface PublishShapeScriptContext extends ShapeScriptDispatchContext {
|
|
@@ -113,6 +120,11 @@ export interface PublishShapeResult {
|
|
|
113
120
|
/** Whether a thumbnail was attached. */
|
|
114
121
|
thumbnail: boolean;
|
|
115
122
|
}
|
|
123
|
+
/** What a host uploads the script as; the gallery's Storage rule admits `text/plain.*`. */
|
|
124
|
+
export declare const SHAPE_SCRIPT_CONTENT_TYPE = "text/plain; charset=utf-8";
|
|
125
|
+
/** The header a host puts on every object it uploads under a post. Each has a random id and
|
|
126
|
+
* is never rewritten, so a browser — and the gallery's CDN, when it has one — may keep it. */
|
|
127
|
+
export declare const SHAPE_OBJECT_CACHE_CONTROL = "public, max-age=31536000, immutable";
|
|
116
128
|
export declare const NOT_CONNECTED_MESSAGE = "Not connected to the gallery: publishing posts under the user's Google account, which needs the app's Remote Host connected (sign in with Google in the Remote Host control), then try again.";
|
|
117
129
|
/** Keywords as the gallery stores them: trimmed, lowercased, deduplicated,
|
|
118
130
|
* each cut to `keywordMax`, at most `keywordsMax`. The same rule as
|
|
@@ -120,12 +132,15 @@ export declare const NOT_CONNECTED_MESSAGE = "Not connected to the gallery: publ
|
|
|
120
132
|
* here can never be two spellings of one word. A comma-separated string is
|
|
121
133
|
* accepted too, since a model sometimes sends one. */
|
|
122
134
|
export declare function normalizeKeywords(raw: unknown): string[];
|
|
135
|
+
/** The script's limit is in UTF-8 bytes, measured as the Storage rule measures it. */
|
|
136
|
+
export declare function requireScriptBytes(value: string): string;
|
|
123
137
|
/** The document for one post, built field by field so nothing the caller
|
|
124
138
|
* passed can reach Firestore uninvited. Throws on a limit the rules would
|
|
125
139
|
* refuse, naming the field. */
|
|
126
140
|
export declare function shapePostFrom(writer: Pick<ShapeGalleryWriter, "uid" | "authorName">, fields: {
|
|
127
141
|
title: string;
|
|
128
|
-
|
|
142
|
+
/** The object id `uploadScript` returned. */
|
|
143
|
+
scriptId: string;
|
|
129
144
|
description?: string | undefined;
|
|
130
145
|
prompt?: string | undefined;
|
|
131
146
|
keywords?: unknown;
|
|
@@ -138,8 +153,8 @@ export declare function shapePostUrl(id: string, siteUrl?: string): string;
|
|
|
138
153
|
* Run one `publishShapeScript` call. Throws on a missing session, a missing or
|
|
139
154
|
* invalid source, a limit the gallery would refuse, and on ShapeScript errors
|
|
140
155
|
* — the host's error path reports those to the model as it does for
|
|
141
|
-
* `renderShapeScript`. Everything that can be refused is checked BEFORE
|
|
142
|
-
*
|
|
156
|
+
* `renderShapeScript`. Everything that can be refused is checked BEFORE
|
|
157
|
+
* anything is uploaded, so a refusal writes nothing.
|
|
143
158
|
*/
|
|
144
159
|
export declare function executePublishShapeScript(context: PublishShapeScriptContext, args: Record<string, unknown>): Promise<PublishShapeResult>;
|
|
145
160
|
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/core/publish.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/core/publish.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,iCAAiC,CAAC;AAEhE;kEACkE;AAClE,eAAO,MAAM,iBAAiB;;;IAG5B;;kGAE8F;;;;;;CAMtF,CAAC;AAEX,eAAO,MAAM,mBAAmB,0fAC+c,CAAC;AAEhf,eAAO,MAAM,cAAc,moBACkmB,CAAC;AAE9nB;4EAC4E;AAC5E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC1B,CAAC;AAEF;;;;gDAIgD;AAChD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,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|
55
55
|
titleMax: 120,
|
|
56
56
|
descriptionMax: 2e3,
|
|
57
|
-
scriptMax:
|
|
57
|
+
scriptMax: 10485760,
|
|
58
58
|
promptMax: 4e3,
|
|
59
59
|
authorNameMax: 80,
|
|
60
60
|
keywordsMax: 10,
|
|
@@ -98,7 +98,7 @@ var g = "publishShapeScript", _ = "https://server.mulmocast.com", v = {
|
|
|
98
98
|
"authorName",
|
|
99
99
|
"title",
|
|
100
100
|
"description",
|
|
101
|
-
"
|
|
101
|
+
"scriptId",
|
|
102
102
|
"source",
|
|
103
103
|
"prompt",
|
|
104
104
|
"photoIds",
|
|
@@ -106,81 +106,89 @@ var g = "publishShapeScript", _ = "https://server.mulmocast.com", v = {
|
|
|
106
106
|
"forkedFrom",
|
|
107
107
|
"keywords",
|
|
108
108
|
"published"
|
|
109
|
-
], C = "Not connected to the gallery: publishing posts under the user's Google account, which needs the app's Remote Host connected (sign in with Google in the Remote Host control), then try again.",
|
|
110
|
-
function
|
|
111
|
-
let t = (Array.isArray(e) ? e : typeof e == "string" ? e.split(",") : []).map(
|
|
109
|
+
], C = "text/plain; charset=utf-8", w = "public, max-age=31536000, immutable", T = "Not connected to the gallery: publishing posts under the user's Google account, which needs the app's Remote Host connected (sign in with Google in the Remote Host control), then try again.", E = (e) => typeof e == "string" && e.trim() !== "" ? e : void 0, D = (e) => typeof e == "string" ? e.trim().toLowerCase().slice(0, v.keywordMax) : "";
|
|
110
|
+
function O(e) {
|
|
111
|
+
let t = (Array.isArray(e) ? e : typeof e == "string" ? e.split(",") : []).map(D).filter((e) => e !== "");
|
|
112
112
|
return [...new Set(t)].slice(0, v.keywordsMax);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function k(e, t, n, r = 0) {
|
|
115
115
|
if (t.length < r) throw Error(`\`${e}\` is required`);
|
|
116
116
|
if (t.length > n) throw Error(`\`${e}\` is too long (${t.length} characters; the gallery allows ${n})`);
|
|
117
117
|
return t;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function A(e) {
|
|
120
|
+
if (e.length < 1) throw Error("`script` is required");
|
|
121
|
+
let t = new TextEncoder().encode(e).length;
|
|
122
|
+
if (t > v.scriptMax) throw Error(`\`script\` is too long (${t} bytes; the gallery allows ${v.scriptMax})`);
|
|
123
|
+
return e;
|
|
124
|
+
}
|
|
125
|
+
function j(e, t) {
|
|
120
126
|
return {
|
|
121
127
|
uid: e.uid,
|
|
122
128
|
authorName: e.authorName.slice(0, v.authorNameMax),
|
|
123
|
-
title:
|
|
124
|
-
description:
|
|
125
|
-
|
|
129
|
+
title: k("title", t.title.trim(), v.titleMax, 1),
|
|
130
|
+
description: k("description", t.description ?? "", v.descriptionMax),
|
|
131
|
+
scriptId: t.scriptId,
|
|
126
132
|
source: "prompt",
|
|
127
|
-
prompt:
|
|
133
|
+
prompt: k("prompt", t.prompt ?? "", v.promptMax),
|
|
128
134
|
photoIds: [],
|
|
129
135
|
thumbnailId: t.thumbnailId ?? "",
|
|
130
136
|
forkedFrom: null,
|
|
131
|
-
keywords:
|
|
137
|
+
keywords: O(t.keywords),
|
|
132
138
|
published: t.published !== !1
|
|
133
139
|
};
|
|
134
140
|
}
|
|
135
|
-
function
|
|
141
|
+
function M(e, t = _) {
|
|
136
142
|
return `${t.endsWith("/") ? t.slice(0, -1) : t}/shapes/${e}`;
|
|
137
143
|
}
|
|
138
|
-
function
|
|
144
|
+
function N(e) {
|
|
139
145
|
r(i(a(e)));
|
|
140
146
|
}
|
|
141
|
-
var
|
|
142
|
-
async function
|
|
147
|
+
var P = (e) => e instanceof Error ? e.message : String(e);
|
|
148
|
+
async function F(e, t, n, r) {
|
|
143
149
|
try {
|
|
144
150
|
let i = await e.renderThumbnail(r);
|
|
145
151
|
return i ? await t.uploadThumbnail(n, i) : "";
|
|
146
152
|
} catch (t) {
|
|
147
|
-
return e.onWarning?.(`thumbnail skipped: ${
|
|
153
|
+
return e.onWarning?.(`thumbnail skipped: ${P(t)}`), "";
|
|
148
154
|
}
|
|
149
155
|
}
|
|
150
|
-
async function
|
|
156
|
+
async function I(e, t, n, r) {
|
|
151
157
|
try {
|
|
152
158
|
await t.createPost(n, r);
|
|
153
159
|
} catch (i) {
|
|
154
|
-
|
|
160
|
+
let a = [r.scriptId, r.thumbnailId].filter((e) => e !== "");
|
|
161
|
+
throw await Promise.all(a.map((r) => t.deleteObject(n, r).catch((t) => e.onWarning?.(`orphaned object ${r}: ${P(t)}`)))), i;
|
|
155
162
|
}
|
|
156
163
|
}
|
|
157
|
-
var
|
|
158
|
-
async function
|
|
164
|
+
var L = () => globalThis.crypto.randomUUID();
|
|
165
|
+
async function R(e, t) {
|
|
159
166
|
let n = e.gallery;
|
|
160
|
-
if (!n) throw Error(
|
|
161
|
-
let r =
|
|
167
|
+
if (!n) throw Error(T);
|
|
168
|
+
let r = E(t.title);
|
|
162
169
|
if (!r) throw Error("`title` is required");
|
|
163
170
|
let { script: i } = await m(e, t);
|
|
164
|
-
A(i);
|
|
165
|
-
let a =
|
|
171
|
+
A(i), N(i);
|
|
172
|
+
let a = j(n, {
|
|
166
173
|
title: r,
|
|
167
|
-
|
|
168
|
-
description:
|
|
169
|
-
prompt:
|
|
174
|
+
scriptId: "",
|
|
175
|
+
description: E(t.description),
|
|
176
|
+
prompt: E(t.prompt),
|
|
170
177
|
keywords: t.keywords,
|
|
171
178
|
published: t.published !== !1
|
|
172
|
-
}), o =
|
|
179
|
+
}), o = L(), s = await n.uploadScript(o, i), c = await F(e, n, o, i), l = {
|
|
173
180
|
...a,
|
|
174
|
-
thumbnailId:
|
|
181
|
+
thumbnailId: c,
|
|
182
|
+
scriptId: s
|
|
175
183
|
};
|
|
176
|
-
await
|
|
177
|
-
let
|
|
184
|
+
await I(e, n, o, l);
|
|
185
|
+
let u = M(o, n.siteUrl), d = l.published ? "Published" : "Saved as a draft (only the user can see it, under My models)", f = c ? "" : " No thumbnail could be attached; the gallery shows a placeholder until the user edits the post.";
|
|
178
186
|
return {
|
|
179
|
-
message: `${
|
|
187
|
+
message: `${d}: "${l.title}" is at ${u}.${f}`,
|
|
180
188
|
id: o,
|
|
181
|
-
url:
|
|
182
|
-
thumbnail:
|
|
189
|
+
url: u,
|
|
190
|
+
thumbnail: c !== ""
|
|
183
191
|
};
|
|
184
192
|
}
|
|
185
193
|
//#endregion
|
|
186
|
-
export {
|
|
194
|
+
export { m as S, u as _, g as a, c as b, S as c, R as d, O as f, l as g, M as h, x as i, v as l, j as m, y as n, _ as o, A as p, b as r, w as s, T as t, C as u, d as v, h as x, s as y };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./samples-BO-oAFPZ.cjs"),t=require("./toThreeJS-CDRtoJt7.cjs");var n=`exportShapeScriptUsdz`,r=t.t+3e4,i="Export a ShapeScript model to a USDZ file (Apple's AR / 3D format, openable with AR Quick Look on iPhone, iPad and Mac) and save it under artifacts/shapes/. Returns the saved path. Takes the same source as presentShapeScript: inline `script`, or `path` to a saved .shape file. USDZ units are metres, so a `size 1` cube becomes a one-metre object in AR — scale the model in the script if that is not what the user wants.",a=`Use exportShapeScriptUsdz when the user wants to take a 3D model out of the chat — to view it in AR, open it in a 3D app, or share the file. It saves a .usdz next to the model's .shape file and returns the path; tell the user where it is. The user can also press "Download USDZ" in the model's view themselves.`,o={type:`object`,properties:{script:{type:`string`,description:"ShapeScript source to export. Provide either this or `path`, not both."},path:{type:`string`,description:`Path to an existing .shape file to export (e.g. one presentShapeScript saved under artifacts/shapes/).`},title:{type:`string`,description:"Name for the exported file; it is slugified into the filename. Defaults to the .shape file's own name when `path` is given."}},required:[]};function s(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function c(e){return(e.split(/[\\/]/).pop()??e).replace(/\.shape$/i,``)}async function l(t,n){let r=s(n.script),i=s(n.path),a=s(n.title);if(r&&i)throw Error("Provide either `script` or `path`, not both");if(r)return{script:r,title:a};if(!i)throw Error("Provide either `script` (inline source) or `path` (an existing .shape file)");let o=e.u(t,i);if(!o)throw Error("`path` must name a .shape file, without `.` / `..` segments");if(!await o.files.exists(o.rel))throw Error(`No ShapeScript exists at ${i}`);return{script:await o.files.read(o.rel),title:a??c(i)}}async function u(t,n){let{script:r,title:i}=await l(t,n),a=await e.a(r),{relPath:o,filePath:s}=e._(i);return await t.files.artifacts.write(o,a),{message:`Saved USDZ to ${s} (${a.byteLength} bytes). Open it with AR Quick Look or any USD viewer.`,filePath:s,bytes:a.byteLength}}var d=`publishShapeScript`,f=`https://server.mulmocast.com`,p={titleMax:120,descriptionMax:2e3,scriptMax:10485760,promptMax:4e3,authorNameMax:80,keywordsMax:10,keywordMax:30},m="Publish a ShapeScript model to the public gallery at server.mulmocast.com/shapes, where anyone can view it in 3D, read the source, download the USDZ and fork it. Takes the same source as presentShapeScript: inline `script`, or `path` to a saved .shape file. Posts under the user's own Google account — the app must be connected to Remote Host (signed in) first — and returns the model's URL. A thumbnail is rendered and attached when the host can rasterise; the post still lands without one.",h="Use publishShapeScript ONLY when the user asks to publish, post or share a model to the gallery — never on your own initiative, since it makes the model public under their name. Before calling it, make sure the model previews correctly (presentShapeScript / renderShapeScript) and give it a short title, a sentence of description and a few lowercase keywords someone would search for. Pass the user's original request as `prompt` so the post records how the model was made. If the tool answers that Remote Host is not connected, tell the user to connect it (the Remote Host control in the app, Google sign-in) and offer to try again.",g={type:`object`,properties:{title:{type:`string`,description:`The model's title (1–${p.titleMax} characters).`},script:{type:`string`,description:"ShapeScript source to publish. Provide either this or `path`, not both."},path:{type:`string`,description:"Path to an existing .shape file — an `artifacts/shapes/...` path presentShapeScript saved, or any .shape the host can read. Provide either this or `script`, not both."},description:{type:`string`,description:`What the model is, for the gallery page (up to ${p.descriptionMax} characters). Optional.`},keywords:{type:`array`,items:{type:`string`},description:`Up to ${p.keywordsMax} short lowercase tags someone would search for. Optional.`},prompt:{type:`string`,description:`The request the model was made from, recorded as its provenance (up to ${p.promptMax} characters). Optional.`},published:{type:`boolean`,description:`false saves a draft only the user can see in the gallery's My models. Default true.`}},required:[`title`]},_=[`uid`,`authorName`,`title`,`description`,`scriptId`,`source`,`prompt`,`photoIds`,`thumbnailId`,`forkedFrom`,`keywords`,`published`],v=`text/plain; charset=utf-8`,y=`public, max-age=31536000, immutable`,b=`Not connected to the gallery: publishing posts under the user's Google account, which needs the app's Remote Host connected (sign in with Google in the Remote Host control), then try again.`,x=e=>typeof e==`string`&&e.trim()!==``?e:void 0,S=e=>typeof e==`string`?e.trim().toLowerCase().slice(0,p.keywordMax):``;function C(e){let t=(Array.isArray(e)?e:typeof e==`string`?e.split(`,`):[]).map(S).filter(e=>e!==``);return[...new Set(t)].slice(0,p.keywordsMax)}function w(e,t,n,r=0){if(t.length<r)throw Error(`\`${e}\` is required`);if(t.length>n)throw Error(`\`${e}\` is too long (${t.length} characters; the gallery allows ${n})`);return t}function T(e){if(e.length<1)throw Error("`script` is required");let t=new TextEncoder().encode(e).length;if(t>p.scriptMax)throw Error(`\`script\` is too long (${t} bytes; the gallery allows ${p.scriptMax})`);return e}function E(e,t){return{uid:e.uid,authorName:e.authorName.slice(0,p.authorNameMax),title:w(`title`,t.title.trim(),p.titleMax,1),description:w(`description`,t.description??``,p.descriptionMax),scriptId:t.scriptId,source:`prompt`,prompt:w(`prompt`,t.prompt??``,p.promptMax),photoIds:[],thumbnailId:t.thumbnailId??``,forkedFrom:null,keywords:C(t.keywords),published:t.published!==!1}}function D(e,t=f){return`${t.endsWith(`/`)?t.slice(0,-1):t}/shapes/${e}`}function O(e){t.a(t.r(t.s(e)))}var k=e=>e instanceof Error?e.message:String(e);async function A(e,t,n,r){try{let i=await e.renderThumbnail(r);return i?await t.uploadThumbnail(n,i):``}catch(t){return e.onWarning?.(`thumbnail skipped: ${k(t)}`),``}}async function j(e,t,n,r){try{await t.createPost(n,r)}catch(i){let a=[r.scriptId,r.thumbnailId].filter(e=>e!==``);throw await Promise.all(a.map(r=>t.deleteObject(n,r).catch(t=>e.onWarning?.(`orphaned object ${r}: ${k(t)}`)))),i}}var M=()=>globalThis.crypto.randomUUID();async function N(e,t){let n=e.gallery;if(!n)throw Error(b);let r=x(t.title);if(!r)throw Error("`title` is required");let{script:i}=await l(e,t);T(i),O(i);let a=E(n,{title:r,scriptId:``,description:x(t.description),prompt:x(t.prompt),keywords:t.keywords,published:t.published!==!1}),o=M(),s=await n.uploadScript(o,i),c=await A(e,n,o,i),u={...a,thumbnailId:c,scriptId:s};await j(e,n,o,u);let d=D(o,n.siteUrl),f=u.published?`Published`:`Saved as a draft (only the user can see it, under My models)`,p=c?``:` No thumbnail could be attached; the gallery shows a placeholder until the user edits the post.`;return{message:`${f}: "${u.title}" is at ${d}.${p}`,id:o,url:d,thumbnail:c!==``}}Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return n}});
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-BO-oAFPZ.cjs"),t=require("./toThreeJS-CDRtoJt7.cjs"),n=require("./core-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-BO-oAFPZ.cjs"),t=require("./toThreeJS-CDRtoJt7.cjs"),n=require("./core-Z6twLrfC.cjs");exports.EXPORT_USDZ_DESCRIPTION=n.g,exports.EXPORT_USDZ_PROMPT=n._,exports.EXPORT_USDZ_SCHEMA=n.v,exports.EXPORT_USDZ_TOOL_NAME=n.y,exports.EXPORT_USDZ_TOOL_TIMEOUT_MS=n.b,exports.NOT_CONNECTED_MESSAGE=n.t,exports.PUBLISH_DESCRIPTION=n.n,exports.PUBLISH_PROMPT=n.r,exports.PUBLISH_SCHEMA=n.i,exports.PUBLISH_TOOL_NAME=n.a,exports.SHAPE_EXTENSIONS=e.d,exports.SHAPE_GALLERY_URL=n.o,exports.SHAPE_OBJECT_CACHE_CONTROL=n.s,exports.SHAPE_POST_KEYS=n.c,exports.SHAPE_POST_LIMITS=n.l,exports.SHAPE_SCRIPT_CONTENT_TYPE=n.u,exports.TOOL_DEFINITION=e.v,exports.TOOL_NAME=e.y,exports.USDZ_EXTENSION=e.n,exports.USDZ_MIME_TYPE=e.r,exports.astToThreeJS=t.r,exports.executeExportShapeScriptUsdz=n.x,exports.executePresentShapeScript=e.o,exports.executePublishShapeScript=n.d,exports.executeShapeScriptDispatch=e.l,exports.isPresentableShapePath=e.f,exports.isShapeArtifactPath=e.p,exports.isShapeScriptDispatchArgs=t.Vn,exports.locateShape=e.u,exports.normalizeShapeKeywords=n.f,exports.parseShapeScript=t.s,exports.pluginCore=e.s,exports.presentShapeScript=e.c,exports.readLoadShapeResult=t.Hn,exports.readSaveShapeResult=t.Un,exports.requireScriptBytes=n.p,exports.resolveShapeSource=n.S,exports.samples=e.t,exports.sceneInfoOf=t.i,exports.sceneToUsdz=e.i,exports.shapeArtifactPath=e.m,exports.shapePostFrom=n.m,exports.shapePostUrl=n.h,exports.shapeScriptToUsdz=e.a,exports.toArtifactsRelative=e.g,exports.usdzArtifactPath=e._;
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { _ as e, a as t, c as n, d as r, f as i, g as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h, v as g, y as _ } from "./samples-CfppG9Bk.js";
|
|
2
2
|
import { Hn as v, Un as y, Vn as b, i as x, r as S, s as C } from "./toThreeJS-MMc_OzvN.js";
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { S as w, _ as T, a as E, b as D, c as O, d as k, f as A, g as j, h as M, i as N, l as P, m as F, n as I, o as L, p as R, r as z, s as B, t as V, u as H, v as U, x as W, y as G } from "./core-7JKG8RwN.js";
|
|
4
|
+
export { j as EXPORT_USDZ_DESCRIPTION, T as EXPORT_USDZ_PROMPT, U as EXPORT_USDZ_SCHEMA, G as EXPORT_USDZ_TOOL_NAME, D as EXPORT_USDZ_TOOL_TIMEOUT_MS, V as NOT_CONNECTED_MESSAGE, I as PUBLISH_DESCRIPTION, z as PUBLISH_PROMPT, N as PUBLISH_SCHEMA, E as PUBLISH_TOOL_NAME, r as SHAPE_EXTENSIONS, L as SHAPE_GALLERY_URL, B as SHAPE_OBJECT_CACHE_CONTROL, O as SHAPE_POST_KEYS, P as SHAPE_POST_LIMITS, H as SHAPE_SCRIPT_CONTENT_TYPE, g as TOOL_DEFINITION, _ as TOOL_NAME, l as USDZ_EXTENSION, f as USDZ_MIME_TYPE, S as astToThreeJS, W as executeExportShapeScriptUsdz, u as executePresentShapeScript, k as executePublishShapeScript, s as executeShapeScriptDispatch, i as isPresentableShapePath, d as isShapeArtifactPath, b as isShapeScriptDispatchArgs, h as locateShape, A as normalizeShapeKeywords, C as parseShapeScript, p as pluginCore, n as presentShapeScript, v as readLoadShapeResult, y as readSaveShapeResult, R as requireScriptBytes, w as resolveShapeSource, m as samples, x as sceneInfoOf, o as sceneToUsdz, c as shapeArtifactPath, F as shapePostFrom, M as shapePostUrl, t as shapeScriptToUsdz, a as toArtifactsRelative, e as usdzArtifactPath };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-BO-oAFPZ.cjs"),t=require("./toThreeJS-CDRtoJt7.cjs"),n=require("./core-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./samples-BO-oAFPZ.cjs"),t=require("./toThreeJS-CDRtoJt7.cjs"),n=require("./core-Z6twLrfC.cjs");exports.EXPORT_USDZ_DESCRIPTION=n.g,exports.EXPORT_USDZ_PROMPT=n._,exports.EXPORT_USDZ_SCHEMA=n.v,exports.EXPORT_USDZ_TOOL_NAME=n.y,exports.EXPORT_USDZ_TOOL_TIMEOUT_MS=n.b,exports.NOT_CONNECTED_MESSAGE=n.t,exports.PUBLISH_DESCRIPTION=n.n,exports.PUBLISH_PROMPT=n.r,exports.PUBLISH_SCHEMA=n.i,exports.PUBLISH_TOOL_NAME=n.a,exports.SHAPE_EXTENSIONS=e.d,exports.SHAPE_GALLERY_URL=n.o,exports.SHAPE_OBJECT_CACHE_CONTROL=n.s,exports.SHAPE_POST_KEYS=n.c,exports.SHAPE_POST_LIMITS=n.l,exports.SHAPE_SCRIPT_CONTENT_TYPE=n.u,exports.TOOL_DEFINITION=e.v,exports.TOOL_NAME=e.y,exports.USDZ_EXTENSION=e.n,exports.USDZ_MIME_TYPE=e.r,exports.astToThreeJS=t.r,exports.executeExportShapeScriptUsdz=n.x,exports.executePresentShapeScript=e.o,exports.executePublishShapeScript=n.d,exports.executeShapeScriptDispatch=e.l,exports.isPresentableShapePath=e.f,exports.isShapeArtifactPath=e.p,exports.isShapeScriptDispatchArgs=t.Vn,exports.locateShape=e.u,exports.normalizeShapeKeywords=n.f,exports.parseShapeScript=t.s,exports.pluginCore=e.s,exports.presentShapeScript=e.c,exports.readLoadShapeResult=t.Hn,exports.readSaveShapeResult=t.Un,exports.requireScriptBytes=n.p,exports.resolveShapeSource=n.S,exports.samples=e.t,exports.sceneInfoOf=t.i,exports.sceneToUsdz=e.i,exports.shapeArtifactPath=e.m,exports.shapePostFrom=n.m,exports.shapePostUrl=n.h,exports.shapeScriptToUsdz=e.a,exports.toArtifactsRelative=e.g,exports.usdzArtifactPath=e._;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { _ as e, a as t, c as n, d as r, f as i, g as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h, v as g, y as _ } from "./samples-CfppG9Bk.js";
|
|
2
2
|
import { Hn as v, Un as y, Vn as b, i as x, r as S, s as C } from "./toThreeJS-MMc_OzvN.js";
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { S as w, _ as T, a as E, b as D, c as O, d as k, f as A, g as j, h as M, i as N, l as P, m as F, n as I, o as L, p as R, r as z, s as B, t as V, u as H, v as U, x as W, y as G } from "./core-7JKG8RwN.js";
|
|
4
|
+
export { j as EXPORT_USDZ_DESCRIPTION, T as EXPORT_USDZ_PROMPT, U as EXPORT_USDZ_SCHEMA, G as EXPORT_USDZ_TOOL_NAME, D as EXPORT_USDZ_TOOL_TIMEOUT_MS, V as NOT_CONNECTED_MESSAGE, I as PUBLISH_DESCRIPTION, z as PUBLISH_PROMPT, N as PUBLISH_SCHEMA, E as PUBLISH_TOOL_NAME, r as SHAPE_EXTENSIONS, L as SHAPE_GALLERY_URL, B as SHAPE_OBJECT_CACHE_CONTROL, O as SHAPE_POST_KEYS, P as SHAPE_POST_LIMITS, H as SHAPE_SCRIPT_CONTENT_TYPE, g as TOOL_DEFINITION, _ as TOOL_NAME, l as USDZ_EXTENSION, f as USDZ_MIME_TYPE, S as astToThreeJS, W as executeExportShapeScriptUsdz, u as executePresentShapeScript, k as executePublishShapeScript, s as executeShapeScriptDispatch, i as isPresentableShapePath, d as isShapeArtifactPath, b as isShapeScriptDispatchArgs, h as locateShape, A as normalizeShapeKeywords, C as parseShapeScript, p as pluginCore, n as presentShapeScript, v as readLoadShapeResult, y as readSaveShapeResult, R as requireScriptBytes, w as resolveShapeSource, m as samples, x as sceneInfoOf, o as sceneToUsdz, c as shapeArtifactPath, F as shapePostFrom, M as shapePostUrl, t as shapeScriptToUsdz, a as toArtifactsRelative, e as usdzArtifactPath };
|
package/dist/lang/de.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../src/lang/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../src/lang/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAgBT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/en.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/lang/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/lang/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAgBT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/es.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/lang/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/lang/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAgBT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/fr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/lang/fr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/lang/fr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAgBT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/ja.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ja.d.ts","sourceRoot":"","sources":["../../src/lang/ja.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ja.d.ts","sourceRoot":"","sources":["../../src/lang/ja.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAgBT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/ko.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ko.d.ts","sourceRoot":"","sources":["../../src/lang/ko.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ko.d.ts","sourceRoot":"","sources":["../../src/lang/ko.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAgBT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/messages.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ export interface Messages {
|
|
|
10
10
|
saveError: string;
|
|
11
11
|
downloadUsdz: string;
|
|
12
12
|
exportError: string;
|
|
13
|
+
/** Copies the ShapeScript source to the clipboard. */
|
|
14
|
+
copyScript: string;
|
|
15
|
+
/** Transient label after a successful copy. */
|
|
16
|
+
copied: string;
|
|
13
17
|
/** Heading for commands the script used that this viewer does not draw. */
|
|
14
18
|
sceneWarnings: string;
|
|
15
19
|
/** Heading for the script's `print` lines. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/lang/messages.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,aAAa,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/lang/messages.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,aAAa,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/lang/ptBR.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ptBR.d.ts","sourceRoot":"","sources":["../../src/lang/ptBR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"ptBR.d.ts","sourceRoot":"","sources":["../../src/lang/ptBR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,IAAI,EAAE,QAgBX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/lang/zh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh.d.ts","sourceRoot":"","sources":["../../src/lang/zh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"zh.d.ts","sourceRoot":"","sources":["../../src/lang/zh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAgBT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/render/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { renderShapeScriptSheet, RenderUnavailableError, CHROMIUM_HINT, RENDER_T
|
|
|
2
2
|
export type { RenderShapeScriptOptions } from "./renderer";
|
|
3
3
|
export { buildRenderPage, gridFor } from "./page";
|
|
4
4
|
export type { ViewAngle, RenderPageOptions } from "./page";
|
|
5
|
-
export { executeRenderShapeScript, viewAngles, RENDER_SHAPE_SCRIPT_TOOL_NAME, RENDER_SHAPE_SCRIPT_DESCRIPTION, RENDER_SHAPE_SCRIPT_PROMPT, RENDER_SHAPE_SCRIPT_SCHEMA, RENDER_TOOL_TIMEOUT_MS, renderOptionsFrom, savedMessage, } from "./tool";
|
|
5
|
+
export { executeRenderShapeScript, viewAngles, RENDER_SHAPE_SCRIPT_TOOL_NAME, RENDER_SHAPE_SCRIPT_DESCRIPTION, RENDER_SHAPE_SCRIPT_PROMPT, RENDER_SHAPE_SCRIPT_SCHEMA, RENDER_TOOL_TIMEOUT_MS, PUBLISH_TOOL_TIMEOUT_MS, renderOptionsFrom, savedMessage, } from "./tool";
|
|
6
6
|
export type { RenderToolDeps, RenderToolResult } from "./tool";
|
|
7
7
|
export { renderShapeThumbnail } from "./thumbnail";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnJ,YAAY,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,6BAA6B,EAC7B,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,GACb,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/render/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnJ,YAAY,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,6BAA6B,EAC7B,+BAA+B,EAC/B,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,GACb,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/render/tool.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ import type { ViewAngle } from "./page";
|
|
|
4
4
|
* the scene and writing the PNG. A transport sized to the render alone aborts a
|
|
5
5
|
* call that was about to succeed. */
|
|
6
6
|
export declare const RENDER_TOOL_TIMEOUT_MS: number;
|
|
7
|
+
/** Milliseconds a host must allow `publishShapeScript`: the thumbnail render
|
|
8
|
+
* above, plus the two Storage uploads — the script may be 10 MiB on a slow
|
|
9
|
+
* link. A transport sized to the render alone aborts the caller while the
|
|
10
|
+
* uploads and the document write go on, so the post lands after the user was
|
|
11
|
+
* told it failed. */
|
|
12
|
+
export declare const PUBLISH_TOOL_TIMEOUT_MS: number;
|
|
7
13
|
export declare const RENDER_SHAPE_SCRIPT_TOOL_NAME = "renderShapeScript";
|
|
8
14
|
export declare const RENDER_SHAPE_SCRIPT_DESCRIPTION = "Render a ShapeScript model to a PNG image and save it, so you can LOOK at the model you wrote and check it before showing it to the user. Returns the image path \u2014 read that file to see the result. By default it renders four camera angles onto one sheet, because a single view cannot settle what is in front of what. Takes the same source as presentShapeScript: inline `script`, or `path` to a saved .shape file.";
|
|
9
15
|
export declare const RENDER_SHAPE_SCRIPT_PROMPT = "Use renderShapeScript to CHECK a 3D model you wrote before presenting it \u2014 it saves a PNG and returns the path, which you then read to see what the model actually looks like. Fix what you see and re-render. Rendering needs a local headless browser; if it reports one is missing, say so and continue with presentShapeScript rather than retrying.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/render/tool.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAcxC;;;sCAGsC;AACtC,eAAO,MAAM,sBAAsB,QAA4B,CAAC;AAEhE,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AAEjE,eAAO,MAAM,+BAA+B,qaACmX,C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AAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;0BAAf,MAAM,KAAK,IAAI;;;;;;;EAUlJ;AAED;;gEAEgE;AAChE,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAInF;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiB7H"}
|
package/dist/render.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./toThreeJS-CDRtoJt7.cjs");let l=require("node:fs/promises"),u=require("node:module"),d=require("node:url"),f=require("node:path");f=s(f,1);function p(e){let t=Math.ceil(Math.sqrt(e));return{columns:t,rows:Math.ceil(e/t)}}function
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./toThreeJS-CDRtoJt7.cjs");let l=require("node:fs/promises"),u=require("node:module"),d=require("node:url"),f=require("node:path");f=s(f,1);function p(e){let t=Math.ceil(Math.sqrt(e));return{columns:t,rows:Math.ceil(e/t)}}function m(e,t,n){return`import { AmbientLight, Box3, Color, DirectionalLight, GridHelper, MathUtils, ObjectLoader, OrthographicCamera, PerspectiveCamera, Scene, Sphere, Vector3, WebGLRenderer } from ${JSON.stringify(e)};
|
|
2
2
|
|
|
3
3
|
const config = ${t};
|
|
4
4
|
const { columns, rows } = ${n};
|
|
@@ -40,7 +40,7 @@ scene.add(headlight, fill, new AmbientLight(0xffffff, 0.9));
|
|
|
40
40
|
const floor = new GridHelper(radius * 4, 12, 0xc0c0c0, 0xe4e4e4);
|
|
41
41
|
floor.position.y = bounds.min.y;
|
|
42
42
|
scene.add(floor);
|
|
43
|
-
`}function
|
|
43
|
+
`}function h(){return`
|
|
44
44
|
const aspect = config.width / config.height;
|
|
45
45
|
const distance = (radius * 3.2) / Math.max(config.zoom, 0.01);
|
|
46
46
|
|
|
@@ -77,10 +77,10 @@ config.views.forEach((angle, index) => {
|
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
renderer.dispose();
|
|
80
|
-
window.__shapeSheet = sheet.toDataURL("image/png");`}function
|
|
80
|
+
window.__shapeSheet = sheet.toDataURL("image/png");`}function g(e){let{threeUrl:t,sceneJson:n,views:r,width:i,height:a,zoom:o,projection:s}=e;return`<!doctype html>
|
|
81
81
|
<meta charset="utf-8">
|
|
82
82
|
<style>html,body{margin:0;background:#ffffff}</style>
|
|
83
83
|
<canvas id="sheet"></canvas>
|
|
84
84
|
<script type="module">
|
|
85
|
-
${`${
|
|
86
|
-
<\/script>`}var
|
|
85
|
+
${`${m(t,JSON.stringify({views:r,width:i,height:a,zoom:o,projection:s,scene:n}),JSON.stringify(p(r.length)))}\n${h()}`}
|
|
86
|
+
<\/script>`}var _=1e3;function v(e){return e instanceof Error?e.message:String(e)}var y=60*_,b=30*_,x=9e4,S="renderShapeScript needs Puppeteer's headless Chromium, which this host does not have. Run `npx puppeteer browsers install chrome`, then retry. Everything else, including presentShapeScript, works without it.",C=class extends Error{};function w(e,t){try{e?.(t)}catch{}}function T(){let e={}.url;if(typeof e==`string`&&e.length>0)return e;if(typeof __filename==`string`)return(0,d.pathToFileURL)(__filename).href;throw Error(`shapescript render: cannot locate this module to resolve three from`)}var E=(0,u.createRequire)(T());function D(e){return c.Bn(e)&&typeof e.launch==`function`}async function ee(){try{let e=await import(`puppeteer`);return D(e)?e:c.Bn(e)&&D(e.default)?e.default:null}catch{return null}}function O(){try{return(0,u.createRequire)(E.resolve(`@mulmoclaude/shapescript-plugin/package.json`))}catch{return E}}function k(){let e=O().resolve(`three`);return e.endsWith(`three.cjs`)?e.replace(/three\.cjs$/,`three.module.js`):e}var A=`https://shapescript.invalid`,j=`${A}/render.html`,M=`./three.module.js`;async function N(e,t,n){let r;try{r=new URL(e)}catch{return null}if(r.origin!==A)return null;let i=f.default.posix.basename(r.pathname);return i===`render.html`?{contentType:`text/html; charset=utf-8`,body:t}:/^three[\w.-]*\.js$/.test(i)?{contentType:`text/javascript; charset=utf-8`,body:await(0,l.readFile)(f.default.join(n,i),`utf-8`)}:null}async function P(e,t){let n=f.default.dirname(k());await e.setRequestInterception(!0),e.on(`request`,e=>{(async()=>{try{let r=await N(e.url(),t,n);await(r?e.respond({status:200,...r}):e.abort())}catch{}})()})}async function F(e){let t=await ee();if(!t)throw new C(S);let n=c.r(c.s(e.script)).toJSON(),r=g({...e,threeUrl:M,sceneJson:n}),i;try{i=await t.launch({headless:!0,timeout:b,args:[`--enable-unsafe-swiftshader`,`--use-gl=swiftshader`]})}catch(e){throw new C(`${S} (launch failed: ${v(e)})`)}try{let e=await i.newPage();await e.setViewport({width:800,height:600});let t=[];e.on(`pageerror`,e=>t.push(e.message)),await P(e,r),await e.goto(j,{waitUntil:`load`});try{await e.waitForFunction(`typeof window.__shapeSheet === 'string'`,{timeout:y})}catch(e){let n=t.length>0?`the render page failed: ${t.join(`; `)}`:v(e);throw Error(n,{cause:e})}let n=await e.evaluate(`window.__shapeSheet`);if(typeof n!=`string`||!n.startsWith(`data:image/png;base64,`))throw Error(`the render page produced no image`);return n.slice(22)}finally{await i.close().catch(t=>w(e.onWarning,`chromium close failed: ${v(t)}`))}}var I=30,L=25,te=1,R=480,z=900,B=160,V=85,H=x+3e4,U=H+6e4,W=`renderShapeScript`,G="Render a ShapeScript model to a PNG image and save it, so you can LOOK at the model you wrote and check it before showing it to the user. Returns the image path — read that file to see the result. By default it renders four camera angles onto one sheet, because a single view cannot settle what is in front of what. Takes the same source as presentShapeScript: inline `script`, or `path` to a saved .shape file.",K=`Use renderShapeScript to CHECK a 3D model you wrote before presenting it — it saves a PNG and returns the path, which you then read to see what the model actually looks like. Fix what you see and re-render. Rendering needs a local headless browser; if it reports one is missing, say so and continue with presentShapeScript rather than retrying.`,q={type:`object`,properties:{script:{type:`string`,description:"ShapeScript source to render. Provide either this or `path`, not both."},path:{type:`string`,description:`Path to an existing .shape file to render (e.g. one presentShapeScript saved under artifacts/shapes/).`},azimuth:{type:`number`,description:`Camera rotation around the model in degrees, 0 = looking from +Z. Default ${I}. In the default four-view sheet this is the FIRST view's angle; the others are offset from it.`},elevation:{type:`number`,description:`Camera height in degrees above the horizon, 90 = straight down. Default ${L}. Avoid 0 and 90 for the main view — an axis-aligned shot flattens depth.`},zoom:{type:`number`,description:`Multiplier on the automatic framing, which fits the whole model. 1 = fit (default), 2 = twice as close, 0.5 = further out. Prefer this over guessing a camera distance: it means the same thing at any model scale.`},views:{type:`string`,enum:[`quad`,`single`],description:"`quad` (default) renders four angles on one sheet — use it to judge shape and layout. `single` renders only `azimuth`/`elevation`, for a close look at one detail."},projection:{type:`string`,enum:[`perspective`,`orthographic`],description:"`perspective` (default) looks natural; `orthographic` keeps parallel edges parallel, which is better for comparing proportions."},width:{type:`number`,description:`Pixel width of ONE view. Default ${R}, clamped to ${B}–${z}.`},height:{type:`number`,description:`Pixel height of ONE view. Default ${R}, clamped to ${B}–${z}.`}},required:[]};function J(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.min(z,Math.max(B,Math.round(e)))}function Y(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}var X=e=>`${Math.round(e)}°`;function Z(e,t,n){let r=(e,t,n)=>({azimuth:e,elevation:t,label:`${n} — az ${X(e)}, el ${X(t)}`});return n?[r(e,t,`view`)]:[r(e,t,`front-right`),r(e+90,t,`back-right`),r(e+180,t,`back-left`),r(e,V,`top`)]}async function ne(e,t){let n=typeof t.script==`string`&&t.script.trim()!==``?t.script:void 0,r=typeof t.path==`string`&&t.path.trim()!==``?t.path:void 0;if(n&&r)throw Error("Provide either `script` or `path`, not both");if(n)return n;if(r)return e.readShape(r);throw Error("Provide either `script` (inline source) or `path` (an existing .shape file)")}function Q(e,t,n,r){return{script:t,views:n,width:J(e.width,R),height:J(e.height,R),zoom:Math.max(Y(e.zoom,te),.01),projection:e.projection===`orthographic`?`orthographic`:`perspective`,...r?{onWarning:r}:{}}}function $(e,t){let n=t.map(e=>e.label).join(`; `);return`Saved render to ${e} (${t.length===1?`1 view`:`${t.length} views`}: ${n}). Read that file to see the model.`}async function re(e,t){let n=await ne(e,t),r=Z(Y(t.azimuth,I),Y(t.elevation,L),t.views===`single`);try{let i=await F(Q(t,n,r,e.onWarning));return{message:$(await e.saveImage(i),r),rendered:!0}}catch(t){if(t instanceof C)return w(e.onWarning,`renderShapeScript: unavailable — ${t.message}`),{message:t.message,rendered:!1};throw t}}var ie=640,ae=480,oe=30,se=25;async function ce(e,t){try{let n=await F({script:e,views:[{azimuth:oe,elevation:se,label:``}],width:ie,height:ae,zoom:1,projection:`perspective`,...t?{onWarning:t}:{}});return new Uint8Array(Buffer.from(n,`base64`))}catch(e){if(e instanceof C)return null;throw e}}exports.CHROMIUM_HINT=S,exports.LAUNCH_TIMEOUT_MS=b,exports.PUBLISH_TOOL_TIMEOUT_MS=U,exports.RENDER_BUDGET_MS=x,exports.RENDER_SHAPE_SCRIPT_DESCRIPTION=G,exports.RENDER_SHAPE_SCRIPT_PROMPT=K,exports.RENDER_SHAPE_SCRIPT_SCHEMA=q,exports.RENDER_SHAPE_SCRIPT_TOOL_NAME=W,exports.RENDER_TIMEOUT_MS=y,exports.RENDER_TOOL_TIMEOUT_MS=H,exports.RenderUnavailableError=C,exports.buildRenderPage=g,exports.executeRenderShapeScript=re,exports.gridFor=p,exports.renderOptionsFrom=Q,exports.renderShapeScriptSheet=F,exports.renderShapeThumbnail=ce,exports.savedMessage=$,exports.viewAngles=Z;
|