@pinepaper.studio/mcp-server 1.6.15 → 1.6.17

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 (69) hide show
  1. package/README.de.md +1 -1
  2. package/README.es.md +1 -1
  3. package/README.fr.md +1 -1
  4. package/README.hi.md +1 -1
  5. package/README.ja.md +1 -1
  6. package/README.ko.md +1 -1
  7. package/README.md +110 -4
  8. package/README.pt-BR.md +1 -1
  9. package/README.zh-CN.md +1 -1
  10. package/dist/build-info.json +2 -2
  11. package/dist/ontology/upstream-vocabulary.d.ts +2 -2
  12. package/dist/ontology/upstream-vocabulary.js +2 -2
  13. package/dist/tools/definitions.d.ts.map +1 -1
  14. package/dist/tools/definitions.js +164 -19
  15. package/dist/tools/definitions.js.map +1 -1
  16. package/dist/tools/engine-methods.d.ts.map +1 -1
  17. package/dist/tools/engine-methods.js +4 -0
  18. package/dist/tools/engine-methods.js.map +1 -1
  19. package/dist/tools/engine-surface.d.ts +1 -1
  20. package/dist/tools/engine-surface.d.ts.map +1 -1
  21. package/dist/tools/engine-surface.js +30 -9
  22. package/dist/tools/engine-surface.js.map +1 -1
  23. package/dist/tools/handlers/beats.d.ts +64 -0
  24. package/dist/tools/handlers/beats.d.ts.map +1 -0
  25. package/dist/tools/handlers/beats.js +83 -0
  26. package/dist/tools/handlers/beats.js.map +1 -0
  27. package/dist/tools/handlers/camera.d.ts.map +1 -1
  28. package/dist/tools/handlers/camera.js +11 -0
  29. package/dist/tools/handlers/camera.js.map +1 -1
  30. package/dist/tools/handlers/generate.d.ts +324 -0
  31. package/dist/tools/handlers/generate.d.ts.map +1 -0
  32. package/dist/tools/handlers/generate.js +264 -0
  33. package/dist/tools/handlers/generate.js.map +1 -0
  34. package/dist/tools/handlers.d.ts.map +1 -1
  35. package/dist/tools/handlers.js +79 -9
  36. package/dist/tools/handlers.js.map +1 -1
  37. package/dist/tools/minimal-descriptions.d.ts.map +1 -1
  38. package/dist/tools/minimal-descriptions.js +5 -0
  39. package/dist/tools/minimal-descriptions.js.map +1 -1
  40. package/dist/tools/shape-params.d.ts +2 -2
  41. package/dist/tools/shape-params.js +2 -2
  42. package/dist/tools/stick-vocabulary.d.ts +1 -1
  43. package/dist/tools/stick-vocabulary.js +1 -1
  44. package/dist/tools/toolkits.d.ts.map +1 -1
  45. package/dist/tools/toolkits.js +5 -0
  46. package/dist/tools/toolkits.js.map +1 -1
  47. package/dist/types/code-generator.d.ts +38 -0
  48. package/dist/types/code-generator.d.ts.map +1 -1
  49. package/dist/types/code-generator.js +552 -44
  50. package/dist/types/code-generator.js.map +1 -1
  51. package/dist/types/schemas.d.ts +614 -82
  52. package/dist/types/schemas.d.ts.map +1 -1
  53. package/dist/types/schemas.js +53 -21
  54. package/dist/types/schemas.js.map +1 -1
  55. package/dist/utils/a11y.d.ts +2 -0
  56. package/dist/utils/a11y.d.ts.map +1 -1
  57. package/dist/utils/a11y.js +1 -1
  58. package/dist/utils/a11y.js.map +1 -1
  59. package/dist/utils/beats.d.ts +58 -0
  60. package/dist/utils/beats.d.ts.map +1 -0
  61. package/dist/utils/beats.js +110 -0
  62. package/dist/utils/beats.js.map +1 -0
  63. package/dist/utils/svg-size.d.ts +22 -0
  64. package/dist/utils/svg-size.d.ts.map +1 -0
  65. package/dist/utils/svg-size.js +43 -0
  66. package/dist/utils/svg-size.js.map +1 -0
  67. package/dist/vendor/design/design-style.js +1 -1
  68. package/manifest.json +21 -1
  69. package/package.json +1 -1
@@ -0,0 +1,264 @@
1
+ import { z } from 'zod';
2
+ import { errorResult, handleToolCall } from '../handlers.js';
3
+ import { ErrorCodes } from '../../types/schemas.js';
4
+ import { emitTextLayersPlacement } from '../../types/code-generator.js';
5
+ const GenerateInputSchema = z.object({
6
+ prompt: z.string().min(1),
7
+ aspect: z.enum(['16:9', '9:16', '1:1', '4:5']).optional(),
8
+ n: z.number().int().min(1).max(4).optional(),
9
+ seed: z.number().int().optional(),
10
+ negativePrompt: z.string().optional(),
11
+ // The cloud's own rule: https, or one of the org's own images as
12
+ // /scene-assets/<32 hex> — how a generated still becomes a video's start
13
+ // frame or a character reference without leaving the cloud.
14
+ imageUrls: z.array(z.string().refine((u) => /^https:\/\//.test(u) || /^\/scene-assets\/[0-9a-f]{32}$/.test(u), {
15
+ message: 'an https URL, or your own image as /scene-assets/<id> (the ref a generation returns)',
16
+ })).max(14).optional(),
17
+ // Video: clip length in seconds; each model allows its own set.
18
+ seconds: z.number().positive().max(60).optional(),
19
+ // WORDS ARE VECTOR: the plate comes back text-free and these come back as
20
+ // textLayers, to be added as real text. allowText (words drawn BY the model)
21
+ // is refused except on eval-tier models.
22
+ text: z.array(z.object({
23
+ content: z.string().min(1).max(500),
24
+ role: z.enum(['headline', 'subhead', 'caption', 'cta', 'label']).optional(),
25
+ font: z.string().max(80).optional(),
26
+ })).max(12).optional(),
27
+ allowText: z.boolean().optional(),
28
+ });
29
+ export const GenerateEstimateArgsSchema = z.object({
30
+ model: z.string().min(1).optional(),
31
+ useCase: z.string().min(1).optional(),
32
+ input: GenerateInputSchema.optional(),
33
+ listModels: z.boolean().optional(),
34
+ }).refine((v) => v.listModels || (v.input && (v.model || v.useCase)), { message: 'give input and a model or useCase — or listModels: true to see the models and their prices' });
35
+ export const GenerateArgsSchema = z.object({
36
+ model: z.string().min(1).optional(),
37
+ useCase: z.string().min(1).optional(),
38
+ input: GenerateInputSchema,
39
+ brief: z.string().max(2000).optional(),
40
+ designRef: z.object({ kind: z.string().min(1), id: z.string().min(1) }).optional(),
41
+ place: z.union([z.boolean(), z.enum(['cover', 'contain'])]).optional(),
42
+ timeoutSec: z.number().int().min(10).max(1800).optional(),
43
+ }).refine((v) => !!(v.model || v.useCase), { message: 'give a model (see pinepaper_generate_estimate listModels) or a useCase' });
44
+ /** Injectable for tests: the network and the clock. */
45
+ export const generateDeps = {
46
+ fetch: (url, init) => fetch(url, init),
47
+ sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
48
+ now: () => Date.now(),
49
+ };
50
+ function cloudConfig() {
51
+ const key = (process.env.PINEPAPER_API_KEY || '').trim();
52
+ const base = (process.env.PINEPAPER_CLOUD_URL || 'https://cloud.pinepaper.studio').replace(/\/+$/, '');
53
+ if (!key) {
54
+ return { error: 'generation runs in the PinePaper cloud and needs a service-account key: set PINEPAPER_API_KEY (pp_sa_…, with the render:create scope) in this server\'s environment. Generation is an internal beta, enabled per organisation (the ai-media feature).' };
55
+ }
56
+ return { base, key };
57
+ }
58
+ /** What a refusal means, in the caller's terms. Every one says whether anything was charged. */
59
+ function explain(status, body) {
60
+ const said = String(body?.error || body?.detail || body?.title || '').trim();
61
+ const code = String(body?.code || body?.type || '').toUpperCase();
62
+ if (status === 401)
63
+ return 'the cloud did not accept PINEPAPER_API_KEY (invalid or revoked). Nothing was charged.';
64
+ if (status === 403 && /INSUFFICIENT_SCOPE/.test(code))
65
+ return `this key lacks the render:create scope that generation needs. ${said} Nothing was charged.`;
66
+ if (status === 403)
67
+ return 'generation (ai-media) is not enabled for your organisation — it is an internal beta, granted per organisation. Ask the PinePaper team for access. Nothing was charged.';
68
+ if (status === 402)
69
+ return `${said || 'not enough credits, or a spend cap was reached'}. Nothing was charged.`;
70
+ if (status === 422)
71
+ return `the request was refused as invalid: ${said || 'check model, aspect, n and imageUrls'}.`;
72
+ if (status === 503)
73
+ return said || 'generation is unavailable on this deployment right now. Nothing was charged.';
74
+ return `${said || 'the cloud refused the request'} (HTTP ${status}).`;
75
+ }
76
+ async function call(cfg, method, path, body) {
77
+ let res;
78
+ try {
79
+ res = await generateDeps.fetch(cfg.base + path, {
80
+ method,
81
+ headers: { Authorization: `Bearer ${cfg.key}`, ...(body !== undefined ? { 'Content-Type': 'application/json' } : {}), 'User-Agent': 'PinePaper-MCP' },
82
+ ...(body !== undefined ? { body: JSON.stringify(body) } : {}),
83
+ });
84
+ }
85
+ catch (e) {
86
+ return { ok: false, message: `could not reach ${cfg.base}: ${e instanceof Error ? e.message : String(e)}. Nothing was charged.` };
87
+ }
88
+ let json = {};
89
+ try {
90
+ json = await res.json();
91
+ }
92
+ catch { /* a non-JSON body is described by its status */ }
93
+ if (!res.ok)
94
+ return { ok: false, status: res.status, code: json?.code, message: explain(res.status, json) };
95
+ return { ok: true, status: res.status, body: json };
96
+ }
97
+ const text = (v) => ({ content: [{ type: 'text', text: JSON.stringify(v, null, 2) }] });
98
+ const fail = (r) => errorResult(r.status === 422 ? ErrorCodes.INVALID_PARAMS : ErrorCodes.EXECUTION_ERROR, r.message, { ...(r.status ? { status: r.status } : {}), ...(r.code ? { code: r.code } : {}) });
99
+ const jobBody = (a) => ({
100
+ ...(a.model ? { model: a.model } : {}), ...(a.useCase ? { useCase: a.useCase } : {}), input: a.input,
101
+ });
102
+ /**
103
+ * Bring the first asset into the studio, fitted to the canvas: an image as an
104
+ * image item, a video (it has a duration) as a video layer. The fit is
105
+ * computed in the page from the placed item's own bounds, never from the
106
+ * requested aspect: models deliver their own sizes (2752x1536 is 1.79, not
107
+ * 16:9), and those are what fill the frame.
108
+ */
109
+ async function placeAsset(cfg, asset, mode, options) {
110
+ let res;
111
+ try {
112
+ res = await generateDeps.fetch(`${cfg.base}/v1/assets/${encodeURIComponent(asset.assetId)}`, { headers: { Authorization: `Bearer ${cfg.key}` } });
113
+ }
114
+ catch (e) {
115
+ return { placed: false, error: `could not download the asset: ${e instanceof Error ? e.message : String(e)}` };
116
+ }
117
+ if (!res.ok)
118
+ return { placed: false, error: `the cloud refused the asset download (HTTP ${res.status})` };
119
+ const type = (res.headers.get('content-type') || '').split(';')[0].trim();
120
+ const isVideo = typeof asset.durationSeconds === 'number' || type.startsWith('video/');
121
+ const dataUrl = `data:${type || (isVideo ? 'video/mp4' : 'image/png')};base64,${Buffer.from(await res.arrayBuffer()).toString('base64')}`;
122
+ const placedRes = isVideo
123
+ ? await handleToolCall('pinepaper_media', { action: 'upload_video', url: dataUrl }, options)
124
+ : await handleToolCall('pinepaper_import_image', { url: dataUrl }, options);
125
+ const placedText = (placedRes.content ?? []).map((c) => ('text' in c ? c.text : '')).join('\n');
126
+ const ref = isVideo
127
+ ? (/"registryId":\s*"([^"]+)"/.exec(placedText)?.[1] ?? /"id":\s*"([^"]+)"/.exec(placedText)?.[1])
128
+ : /"itemId":\s*"([^"]+)"/.exec(placedText)?.[1];
129
+ if (placedRes.isError || !ref)
130
+ return { placed: false, kind: isVideo ? 'video' : 'image', error: `generated, but could not be placed: ${placedText.slice(0, 300)}` };
131
+ // Cover fills the canvas (the overflow is outside the frame); contain fits
132
+ // inside it. Centred either way. A video's media id resolves to its item.
133
+ const fit = await handleToolCall('pinepaper_execute_custom_code', {
134
+ code: `let it = app.getItemById(${JSON.stringify(ref)});
135
+ if (!it && window.PinePaperAgent && typeof window.PinePaperAgent.listMedia === 'function') {
136
+ const m = window.PinePaperAgent.listMedia().find(function(x) { return x.id === ${JSON.stringify(ref)} || x.registryId === ${JSON.stringify(ref)}; });
137
+ if (m) it = app.getItemById(m.registryId);
138
+ }
139
+ const cs = app.getCanvasSize(); const b = it && it.bounds;
140
+ if (!it || !b || !(b.width > 0)) return { fitted: false };
141
+ const s = ${mode === 'cover' ? 'Math.max' : 'Math.min'}(cs.width / b.width, cs.height / b.height);
142
+ it.scale(s); it.position = new paper.Point(cs.width / 2, cs.height / 2);
143
+ return { fitted: true, width: Math.round(it.bounds.width), height: Math.round(it.bounds.height) };`,
144
+ }, options);
145
+ return {
146
+ placed: true, kind: isVideo ? 'video' : 'image', itemId: ref, fit: mode,
147
+ ...(isVideo ? { durationSeconds: asset.durationSeconds, ...(asset.fps ? { fps: asset.fps } : {}) } : {}),
148
+ ...(fit.isError ? { fitNote: 'placed at its own size; fitting it to the canvas failed' } : {}),
149
+ };
150
+ }
151
+ export const generateHandlers = {
152
+ 'pinepaper_generate_estimate': async (args) => {
153
+ const a = GenerateEstimateArgsSchema.parse(args);
154
+ const cfg = cloudConfig();
155
+ if ('error' in cfg)
156
+ return errorResult(ErrorCodes.INVALID_PARAMS, cfg.error);
157
+ const out = {};
158
+ if (a.listModels) {
159
+ const m = await call(cfg, 'GET', '/v1/generate/models');
160
+ if (!m.ok)
161
+ return fail(m);
162
+ out.models = m.body.models;
163
+ out.defaults = m.body.defaults;
164
+ out.available = m.body.available;
165
+ }
166
+ if (a.input) {
167
+ const e = await call(cfg, 'POST', '/v1/generate:estimate', jobBody(a));
168
+ if (!e.ok)
169
+ return fail(e);
170
+ out.estimate = e.body.estimate;
171
+ }
172
+ return text({ success: true, free: true, ...out });
173
+ },
174
+ 'pinepaper_generate': async (args, options) => {
175
+ const a = GenerateArgsSchema.parse(args);
176
+ const cfg = cloudConfig();
177
+ if ('error' in cfg)
178
+ return errorResult(ErrorCodes.INVALID_PARAMS, cfg.error);
179
+ // brief and designRef always travel: the cloud records each generation as
180
+ // a node in the design graph, and they are what tie it to the design.
181
+ const submitted = await call(cfg, 'POST', '/v1/generate', { ...jobBody(a), ...(a.brief ? { brief: a.brief } : {}), ...(a.designRef ? { designRef: a.designRef } : {}) });
182
+ if (!submitted.ok)
183
+ return fail(submitted);
184
+ const jobId = submitted.body?.job?.id;
185
+ const est = submitted.body?.estimate;
186
+ if (!jobId)
187
+ return errorResult(ErrorCodes.EXECUTION_ERROR, 'the cloud accepted the job but returned no id to poll', { response: submitted.body });
188
+ // Poll to a terminal state. Stills take seconds; video will take minutes,
189
+ // so the budget is the caller's (timeoutSec), backing off 2 s → 10 s.
190
+ const deadline = generateDeps.now() + (a.timeoutSec ?? 180) * 1000;
191
+ let wait = 2000;
192
+ let job = submitted.body.job;
193
+ while (!['done', 'failed', 'refused'].includes(job.status)) {
194
+ if (generateDeps.now() >= deadline) {
195
+ return text({ success: false, pending: true, jobId, status: job.status, estimate: est,
196
+ note: `still ${job.status} after ${a.timeoutSec ?? 180} s. It keeps running in the cloud and is charged only if it delivers; call pinepaper_generate_status {jobId: "${jobId}"} to collect it (or retry with a larger timeoutSec — video can take minutes).` });
197
+ }
198
+ await generateDeps.sleep(wait);
199
+ wait = Math.min(10_000, Math.round(wait * 1.5));
200
+ // Polling is a GET, safe to repeat: one retry on a 5xx or an unreachable
201
+ // cloud before it is reported (a transient 500 mid-job failed a run
202
+ // that the rerun passed).
203
+ let polled = await call(cfg, 'GET', `/v1/generate/${encodeURIComponent(jobId)}`);
204
+ if (!polled.ok && (polled.status === undefined || polled.status >= 500)) {
205
+ await generateDeps.sleep(3000);
206
+ polled = await call(cfg, 'GET', `/v1/generate/${encodeURIComponent(jobId)}`);
207
+ }
208
+ if (!polled.ok)
209
+ return fail({ ...polled, message: `${polled.message} The job ${jobId} may still finish: collect it with pinepaper_generate_status.` });
210
+ job = polled.body.job ?? job;
211
+ }
212
+ if (job.status !== 'done') {
213
+ return errorResult(job.status === 'refused' ? ErrorCodes.INVALID_PARAMS : ErrorCodes.EXECUTION_ERROR, String(job.error || (job.status === 'refused' ? "the model's safety filter refused this. Nothing was charged." : 'the generation failed. Nothing was charged.')), { jobId, status: job.status });
214
+ }
215
+ const assets = (job.assets ?? []);
216
+ const result = {
217
+ success: true, jobId, model: job.model, assets, chargedUsd: job.chargedUsd,
218
+ ...(job.filtered ? { filtered: job.filtered, filteredNote: `${job.filtered} output(s) were removed by the safety filter and not charged.` } : {}),
219
+ // A model may choose its own size for an aspect (nano-banana-pro: 928x1152
220
+ // for 4:5); the sizes above are the files', not the request's.
221
+ ...(est?.notes ? { notes: est.notes } : {}),
222
+ ...(Array.isArray(job.textLayers) && job.textLayers.length ? { textLayers: job.textLayers, hint: job.hint } : {}),
223
+ };
224
+ if (a.place && assets.length) {
225
+ const placement = await placeAsset(cfg, assets[0], a.place === 'contain' ? 'contain' : 'cover', options);
226
+ // The words, as real text over the plate (role layout, title-safe,
227
+ // contrast-checked against the plate). Their ids come back to restyle.
228
+ if (placement.placed && Array.isArray(job.textLayers) && job.textLayers.length) {
229
+ const laid = await handleToolCall('pinepaper_execute_custom_code', { code: emitTextLayersPlacement(job.textLayers, String(placement.itemId)) }, options);
230
+ // The first text block is the executed result as JSON: {success, result}.
231
+ const first = laid.content?.[0];
232
+ let body = null;
233
+ try {
234
+ body = first && 'text' in first ? JSON.parse(first.text) : null;
235
+ }
236
+ catch {
237
+ body = null;
238
+ }
239
+ const items = body?.result?.textItems;
240
+ placement.text = laid.isError || !Array.isArray(items)
241
+ ? { placed: false, error: (first && 'text' in first ? first.text : '').slice(0, 300) }
242
+ : { placed: true, items, ...(body?.result?.fonts?.length ? { fonts: body.result.fonts } : {}) };
243
+ }
244
+ result.placement = placement;
245
+ }
246
+ return text(result);
247
+ },
248
+ 'pinepaper_generate_status': async (args, options) => {
249
+ const a = z.object({ jobId: z.string().min(1), place: z.union([z.boolean(), z.enum(['cover', 'contain'])]).optional() }).parse(args);
250
+ const cfg = cloudConfig();
251
+ if ('error' in cfg)
252
+ return errorResult(ErrorCodes.INVALID_PARAMS, cfg.error);
253
+ const polled = await call(cfg, 'GET', `/v1/generate/${encodeURIComponent(a.jobId)}`);
254
+ if (!polled.ok)
255
+ return fail(polled);
256
+ const job = polled.body.job ?? {};
257
+ const out = { success: job.status === 'done', jobId: a.jobId, status: job.status, ...(job.assets ? { assets: job.assets } : {}),
258
+ ...(job.chargedUsd != null ? { chargedUsd: job.chargedUsd } : {}), ...(job.error ? { error: job.error } : {}) };
259
+ if (job.status === 'done' && a.place && job.assets?.length)
260
+ out.placement = await placeAsset(cfg, job.assets[0], a.place === 'contain' ? 'contain' : 'cover', options);
261
+ return text(out);
262
+ },
263
+ };
264
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/tools/handlers/generate.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAuB,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,MAAM,mBAAmB,GAAG,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;AAMD,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACtC,MAAM,CASR;AAiHD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAWnG;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAoBzB"}
@@ -5,8 +5,8 @@
5
5
  * Supports i18n for localized error and success messages.
6
6
  * Supports browser execution via Puppeteer.
7
7
  */
8
- import { codeGenerator } from '../types/code-generator.js';
9
- import { CreateItemInputSchema, ModifyItemInputSchema, DeleteItemInputSchema, AddRelationInputSchema, RemoveRelationInputSchema, QueryRelationsInputSchema, AnimateItemInputSchema, ImportMotionCaptureInputSchema, KeyframeAnimateInputSchema, ExecuteGeneratorInputSchema, ApplyEffectInputSchema, GetItemsInputSchema, PlayTimelineInputSchema, SetBackgroundColorInputSchema, SetCanvasSizeInputSchema, ImportSVGInputSchema, ImportMermaidInputSchema, AddFilterInputSchema, CreateGlossySphereInputSchema, CreateDiagonalStripesInputSchema, BatchCreateInputSchema, BatchModifyInputSchema, CreateGridInputSchema, GeometryInputSchema, EquationPathInputSchema, EventInputSchema, ConstructionSequenceInputSchema, ValidateSceneInputSchema, CaptureFramesInputSchema, InstantiateOntologyInputSchema, LintSceneInputSchema, MediaInputSchema, TextStyleInputSchema, TextEffectInputSchema, DesignMediumInputSchema, ShatterImageInputSchema, ImportLayeredCharacterInputSchema, CharacterInputSchema, GameInputSchema, World3DInputSchema, BrandKitInputSchema, ComponentInputSchema, ArtboardInputSchema, CommentInputSchema, ProvenanceInputSchema, SceneDiffInputSchema, AudioBeatsInputSchema, TemplateParamsInputSchema, RenderBatchInputSchema, AccessibilityCheckInputSchema, ComposeInputSchema, CropImageInputSchema, PathOpInputSchema, MotionInputSchema, SoundInputSchema, InterchangeInputSchema, StickInputSchema, DesignSystemInputSchema, StoryInputSchema, ChromaKeyInputSchema, RiggingInputSchema, GroupInputSchema, CameraDirectorInputSchema, DetectObjectsInputSchema, ExtractObjectInputSchema, ArrangeInputSchema, CreateSceneInputSchema, GetPerformanceMetricsInputSchema, DiagnosticReportInputSchema, SearchAssetsInputSchema, ImportAssetInputSchema, P5DrawInputSchema,
8
+ import { codeGenerator, generateQueryMutationsCode } from '../types/code-generator.js';
9
+ import { CreateItemInputSchema, ModifyItemInputSchema, DeleteItemInputSchema, AddRelationInputSchema, RemoveRelationInputSchema, QueryRelationsInputSchema, AnimateItemInputSchema, ImportMotionCaptureInputSchema, KeyframeAnimateInputSchema, ExecuteGeneratorInputSchema, ApplyEffectInputSchema, GetItemsInputSchema, PlayTimelineInputSchema, SetBackgroundColorInputSchema, SetCanvasSizeInputSchema, ImportSVGInputSchema, ImportMermaidInputSchema, AddFilterInputSchema, CreateGlossySphereInputSchema, CreateDiagonalStripesInputSchema, BatchCreateInputSchema, BatchModifyInputSchema, CreateGridInputSchema, GeometryInputSchema, EquationPathInputSchema, EventInputSchema, ConstructionSequenceInputSchema, ValidateSceneInputSchema, CaptureFramesInputSchema, InstantiateOntologyInputSchema, LintSceneInputSchema, MediaInputSchema, TextStyleInputSchema, TextEffectInputSchema, DesignMediumInputSchema, ShatterImageInputSchema, ImportLayeredCharacterInputSchema, CharacterInputSchema, GameInputSchema, World3DInputSchema, BrandKitInputSchema, ComponentInputSchema, ArtboardInputSchema, CommentInputSchema, ProvenanceInputSchema, SceneDiffInputSchema, AudioBeatsInputSchema, TemplateParamsInputSchema, RenderBatchInputSchema, AccessibilityCheckInputSchema, QueryMutationsInputSchema, ComposeInputSchema, CropImageInputSchema, PathOpInputSchema, MotionInputSchema, SoundInputSchema, InterchangeInputSchema, StickInputSchema, DesignSystemInputSchema, StoryInputSchema, ChromaKeyInputSchema, RiggingInputSchema, GroupInputSchema, CameraDirectorInputSchema, DetectObjectsInputSchema, ExtractObjectInputSchema, ArrangeInputSchema, CreateSceneInputSchema, GetPerformanceMetricsInputSchema, DiagnosticReportInputSchema, SearchAssetsInputSchema, ImportAssetInputSchema, P5DrawInputSchema,
10
10
  // Diagram schemas
11
11
  CreateDiagramShapeInputSchema, ConnectInputSchema, ConnectPortsInputSchema, AddPortsInputSchema, AutoLayoutInputSchema, GetDiagramShapesInputSchema, UpdateConnectorInputSchema, RemoveConnectorInputSchema, DiagramModeInputSchema,
12
12
  // Agent flow mode schemas
@@ -46,6 +46,8 @@ import { mapHandlers } from './handlers/maps.js';
46
46
  import { ontologyHandlers } from './handlers/ontology.js';
47
47
  import * as designSystems from '../design/design-systems.js';
48
48
  import { exportHandlers } from './handlers/export.js';
49
+ import { generateHandlers } from './handlers/generate.js';
50
+ import { beatHandlers } from './handlers/beats.js';
49
51
  import { planCharacter, generateCharacterCode } from './handlers/character.js';
50
52
  import { buildZip } from '../utils/zip.js';
51
53
  import { buildScc } from '../utils/scc.js';
@@ -64,6 +66,8 @@ function getDomainHandlers() {
64
66
  mapHandlers,
65
67
  ontologyHandlers,
66
68
  exportHandlers,
69
+ generateHandlers,
70
+ beatHandlers,
67
71
  ];
68
72
  }
69
73
  /**
@@ -592,6 +596,13 @@ function executedResult(code, result, screenshot, description, report) {
592
596
  const governor = {};
593
597
  if (warnings.length)
594
598
  governor.warnings = warnings;
599
+ // The engine's STRUCTURED warnings (GeneratedCodeRunner: report.warnings
600
+ // holds only their sentences; report.engineWarnings holds the objects —
601
+ // {message, code, droppedProperties, itemId, …}). Forwarded whole, so an
602
+ // agent can act on keyframe_track_replaced without parsing prose.
603
+ const engineWarnings = Array.isArray(report.engineWarnings) ? report.engineWarnings.filter((w) => w && typeof w === 'object') : [];
604
+ if (engineWarnings.length)
605
+ governor.engineWarnings = engineWarnings;
595
606
  if (items && typeof items.created === 'number')
596
607
  governor.itemsCreated = items.created;
597
608
  if (report.guard?.tripped)
@@ -1084,6 +1095,8 @@ const IGNORED_ARGUMENT_SCHEMAS = {
1084
1095
  // common slip here (round 7 retest, 1.63).
1085
1096
  pinepaper_create_item: CreateItemInputSchema,
1086
1097
  pinepaper_modify_item: ModifyItemInputSchema,
1098
+ // Its options live in `options` / `spec`; a key beside them was dropped.
1099
+ pinepaper_sound: SoundInputSchema,
1087
1100
  };
1088
1101
  const IGNORED_ARGUMENT_HINTS = {
1089
1102
  pinepaper_create_item: Object.fromEntries(['width', 'height', 'radius', 'color', 'fillColor', 'strokeColor', 'strokeWidth', 'content', 'fontSize', 'fontFamily', 'opacity', 'rotation', 'x', 'y']
@@ -1585,8 +1598,31 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
1585
1598
  }
1586
1599
  case 'pinepaper_audio_beats': {
1587
1600
  const input = AudioBeatsInputSchema.parse(args);
1588
- const code = codeGenerator.generateAudioBeats(input);
1589
- return executeOrGenerate(code, `Audio: ${input.action}`, options, 'pinepaper_audio_beats');
1601
+ // A LARGE SOURCE GOES BESIDE THE CODE (gap 5.5). A data: URL over
1602
+ // ~350 KB inlined into the generated code made the governor's
1603
+ // transform bail and the analysis answered success with no result.
1604
+ // Same route as pinepaper_media: URLs, file:// and local paths are
1605
+ // read HERE (a path used to fail "Unable to decode audio data"), and
1606
+ // anything large is staged. Upload / asset ids pass through.
1607
+ let source = input.source;
1608
+ const looksLikeFile = typeof source === 'string'
1609
+ && (/^(data:|https?:|file:)/i.test(source.trim()) || /\.(wav|mp3|ogg|oga|m4a|aac|flac|webm|mp4|mov)$/i.test(source.trim()));
1610
+ if (looksLikeFile) {
1611
+ const resolved = await resolveMediaSource(source);
1612
+ if ('error' in resolved) {
1613
+ return errorResult(ErrorCodes.INVALID_PARAMS, resolved.error, { source }, { toolName: 'pinepaper_audio_beats' });
1614
+ }
1615
+ source = resolved.src;
1616
+ }
1617
+ const staged = typeof source === 'string' && source.startsWith('data:') && source.length > 64_000;
1618
+ const stageKey = staged ? `audio_${Date.now().toString(36)}` : undefined;
1619
+ const code = codeGenerator.generateAudioBeats({ ...input, source: staged ? `__ppStage:${stageKey}` : source });
1620
+ return executeOrGenerate(code, `Audio: ${input.action}`, options, 'pinepaper_audio_beats', staged ? { [stageKey]: source } : undefined);
1621
+ }
1622
+ case 'pinepaper_query_mutations': {
1623
+ const input = QueryMutationsInputSchema.parse(args);
1624
+ const code = generateQueryMutationsCode(input.itemId, input.property, input.range, input.fps);
1625
+ return executeOrGenerate(code, `Keyframe series: ${input.itemId}`, options, 'pinepaper_query_mutations');
1590
1626
  }
1591
1627
  case 'pinepaper_accessibility_check': {
1592
1628
  const input = AccessibilityCheckInputSchema.parse(args);
@@ -1605,9 +1641,23 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
1605
1641
  const report = {};
1606
1642
  const page = parseCssColor(m.page);
1607
1643
  if (m.texts) {
1644
+ // Samples over time: each text judged at every moment it showed,
1645
+ // reported at its worst. Nothing visible at any sampled time is not
1646
+ // a pass — it was a vacuous one (round 12, 12.9).
1608
1647
  const c = checkContrast(m.texts, page);
1609
- report.contrast = { pass: c.failing.length === 0, checked: c.checked, failing: c.failing, skipped: c.skipped,
1610
- method: 'WCAG 1.4.3 AA (4.5:1, 3:1 for large text) between each text fill and the solid fill of the topmost item under its centre, or the page background' + (c.pageAssumed ? ' (none set, so white was assumed)' : '') + '. Approximate: text over a photo or gradient is not judged.' };
1648
+ const worst = new Map();
1649
+ for (const f of c.failing) {
1650
+ const prev = worst.get(f.id);
1651
+ if (!prev || f.ratio < prev.ratio)
1652
+ worst.set(f.id, f);
1653
+ }
1654
+ const ids = new Set(m.texts.filter((t) => t.fill).map((t) => t.id));
1655
+ const skippedIds = [...new Map(c.skipped.map((x) => [x.id, x])).values()];
1656
+ report.contrast = ids.size === 0
1657
+ ? { pass: null, checked: 0, sampledTimes: m.sampledTimes, skipped: skippedIds,
1658
+ note: 'no text was visible at any sampled time (0 s, each text\'s lifetime, keyframe times, every second of duration), so contrast was not checked — pass the scene duration, or check a frame where the text shows.' }
1659
+ : { pass: worst.size === 0, checked: ids.size, sampledTimes: m.sampledTimes, failing: [...worst.values()], skipped: skippedIds,
1660
+ method: 'WCAG 1.4.3 AA (4.5:1, 3:1 for large text) between each text fill and the solid fill of the topmost item under its centre, or the page background' + (c.pageAssumed ? ' (none set, so white was assumed)' : '') + ', at every sampled time the text showed; the worst is reported. Approximate: text over a photo or gradient is not judged.' };
1611
1661
  }
1612
1662
  if (m.flashUnavailable)
1613
1663
  report.flash = { checked: false, reason: m.flashUnavailable };
@@ -1617,7 +1667,9 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
1617
1667
  frames: m.series.length, fps: m.fps,
1618
1668
  method: 'WCAG 2.3.1 general flash: opposing luminance changes of >= 10% with the darker state below 0.8, over a 3 x 3 grid; more than 3 flashes in any second fails. A heuristic screen, not a certified PSE test (red flashes are not checked).' };
1619
1669
  }
1620
- const pass = Object.values(report).every((r) => r.pass !== false);
1670
+ // A check that could not run (pass: null) is not a pass.
1671
+ const verdicts = Object.values(report).map((r) => r.pass);
1672
+ const pass = verdicts.some((v) => v === false) ? false : verdicts.some((v) => v === null) ? null : true;
1621
1673
  return dataResult({ success: true, pass, ...report });
1622
1674
  }
1623
1675
  case 'pinepaper_render_batch': {
@@ -2570,7 +2622,12 @@ You can now start creating new items on a clean canvas.`,
2570
2622
  }
2571
2623
  // Import the SVG onto canvas using existing import_svg tool
2572
2624
  const code = codeGenerator.generateImportSVG(svg, undefined, input.position, input.scale);
2573
- const description = `Imported asset: ${metadata.title} (${metadata.license.name})`;
2625
+ // A URL import has no catalogue metadata (no title, no licence): this
2626
+ // line read metadata.license.name on it, so every URL import that
2627
+ // FETCHED fine then threw "Cannot read properties of undefined".
2628
+ const description = metadata?.source === 'url'
2629
+ ? `Imported SVG from ${metadata.url}`
2630
+ : `Imported asset: ${metadata?.title ?? input.assetId}${metadata?.license?.name ? ` (${metadata.license.name})` : ''}`;
2574
2631
  return executeOrGenerate(code, description, options, 'pinepaper_import_asset');
2575
2632
  }
2576
2633
  catch (error) {
@@ -2872,6 +2929,16 @@ You can now start creating new items on a clean canvas.`,
2872
2929
  }
2873
2930
  }
2874
2931
  case 'pinepaper_agent_export': {
2932
+ // Formats a DOOH / projection deliverable asks for that no browser
2933
+ // encoder can make (round 12, 12.12): named, with the route that works,
2934
+ // not a generic enum error.
2935
+ const askedFormat = String(args.format ?? '').toLowerCase();
2936
+ if (/^(prores|prores4444|prores422|hap|hapq|hap-alpha|dnxhd|dnxhr|cineform)$/.test(askedFormat)) {
2937
+ return errorResult(ErrorCodes.INVALID_PARAMS, `${askedFormat} is not supported: the studio encodes in the browser, which has no ${askedFormat.startsWith('hap') ? 'HAP' : askedFormat.startsWith('prores') ? 'ProRes' : askedFormat.toUpperCase()} encoder. `
2938
+ + 'Export a lossless png sequence (pinepaper_interchange export_png_sequence, transparent if you need alpha) and convert it, e.g. '
2939
+ + (askedFormat.startsWith('hap') ? 'ffmpeg -i frame_%05d.png -c:v hap -format hap_q out.mov' : 'ffmpeg -i frame_%05d.png -c:v prores_ks -profile:v 4444 out.mov')
2940
+ + ' — or webm / apng for alpha in the browser.');
2941
+ }
2875
2942
  const input = AgentExportInputSchema.parse(args);
2876
2943
  const code = codeGenerator.generateAgentExport(input);
2877
2944
  const description = `Smart export for ${input.platform} as ${input.format || 'auto'}`;
@@ -3130,7 +3197,10 @@ You can now start creating new items on a clean canvas.`,
3130
3197
  return executeOrGenerate(code, soundDescription, options, 'pinepaper_sound');
3131
3198
  }
3132
3199
  }
3133
- const wavResult = await soundController.executeCode(code, false);
3200
+ // A soundtrack render is an export: it gets the export budget, not the
3201
+ // governor's 10 s default, which cut off any soundtrack that took
3202
+ // longer to render (the patch downstream kept re-applying).
3203
+ const wavResult = await soundController.executeCode(code, false, { governorTimeoutMs: exportGovernorTimeoutMs() });
3134
3204
  if (!wavResult.success) {
3135
3205
  const canvasState = await captureCanvasState(soundController);
3136
3206
  return errorResult(ErrorCodes.EXECUTION_ERROR, wavResult.error || 'Rendering the soundtrack failed', { code }, { toolName: 'pinepaper_sound', canvasState: canvasState || undefined });