@pinepaper.studio/mcp-server 1.6.16 → 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.
- package/README.de.md +1 -1
- package/README.es.md +1 -1
- package/README.fr.md +1 -1
- package/README.hi.md +1 -1
- package/README.ja.md +1 -1
- package/README.ko.md +1 -1
- package/README.md +50 -4
- package/README.pt-BR.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/build-info.json +2 -2
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +60 -12
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/engine-methods.d.ts.map +1 -1
- package/dist/tools/engine-methods.js +4 -0
- package/dist/tools/engine-methods.js.map +1 -1
- package/dist/tools/handlers/beats.d.ts +64 -0
- package/dist/tools/handlers/beats.d.ts.map +1 -0
- package/dist/tools/handlers/beats.js +83 -0
- package/dist/tools/handlers/beats.js.map +1 -0
- package/dist/tools/handlers.d.ts.map +1 -1
- package/dist/tools/handlers.js +40 -5
- package/dist/tools/handlers.js.map +1 -1
- package/dist/tools/minimal-descriptions.d.ts.map +1 -1
- package/dist/tools/minimal-descriptions.js +2 -0
- package/dist/tools/minimal-descriptions.js.map +1 -1
- package/dist/tools/toolkits.d.ts.map +1 -1
- package/dist/tools/toolkits.js +2 -0
- package/dist/tools/toolkits.js.map +1 -1
- package/dist/types/code-generator.d.ts +23 -0
- package/dist/types/code-generator.d.ts.map +1 -1
- package/dist/types/code-generator.js +274 -24
- package/dist/types/code-generator.js.map +1 -1
- package/dist/types/schemas.d.ts +87 -0
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +34 -14
- package/dist/types/schemas.js.map +1 -1
- package/dist/utils/a11y.d.ts +2 -0
- package/dist/utils/a11y.d.ts.map +1 -1
- package/dist/utils/a11y.js +1 -1
- package/dist/utils/a11y.js.map +1 -1
- package/dist/utils/beats.d.ts +58 -0
- package/dist/utils/beats.d.ts.map +1 -0
- package/dist/utils/beats.js +110 -0
- package/dist/utils/beats.js.map +1 -0
- package/dist/utils/svg-size.d.ts +22 -0
- package/dist/utils/svg-size.d.ts.map +1 -0
- package/dist/utils/svg-size.js +43 -0
- package/dist/utils/svg-size.js.map +1 -0
- package/manifest.json +9 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-methods.d.ts","sourceRoot":"","sources":["../../src/tools/engine-methods.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"engine-methods.d.ts","sourceRoot":"","sources":["../../src/tools/engine-methods.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAoNpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAwCpD,CAAC"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* it one call at a time.
|
|
17
17
|
*/
|
|
18
18
|
export const REQUIRED_ENGINE_METHODS = [
|
|
19
|
+
'addAnimation',
|
|
19
20
|
'addComment',
|
|
20
21
|
'addOnFrameCallback',
|
|
21
22
|
'addPhysicsBody3D',
|
|
@@ -242,6 +243,8 @@ export const OPTIONAL_ENGINE_METHODS = [
|
|
|
242
243
|
'activeWindowOf',
|
|
243
244
|
'audioLayer.setVolume',
|
|
244
245
|
'authoredRotation',
|
|
246
|
+
'awaitMediaAt',
|
|
247
|
+
'captureFramesAtAsync',
|
|
245
248
|
'checkFont',
|
|
246
249
|
'clearCanvas',
|
|
247
250
|
'ensureFontsLoaded',
|
|
@@ -252,6 +255,7 @@ export const OPTIONAL_ENGINE_METHODS = [
|
|
|
252
255
|
'getCanvasSize',
|
|
253
256
|
'getCutoutStylePresets',
|
|
254
257
|
'getDPI',
|
|
258
|
+
'getInterpolatedState',
|
|
255
259
|
'hashFrame',
|
|
256
260
|
'instantiateOntology',
|
|
257
261
|
'itemRegistry.rebind',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-methods.js","sourceRoot":"","sources":["../../src/tools/engine-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,YAAY;IACZ,oBAAoB;IACpB,kBAAkB;IAClB,aAAa;IACb,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,oBAAoB;IACpB,eAAe;IACf,kBAAkB;IAClB,uBAAuB;IACvB,qBAAqB;IACrB,gBAAgB;IAChB,yBAAyB;IACzB,iBAAiB;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,iBAAiB;IACjB,iBAAiB;IACjB,sBAAsB;IACtB,WAAW;IACX,YAAY;IACZ,cAAc;IACd,cAAc;IACd,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;IACrB,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,sBAAsB;IACtB,QAAQ;IACR,mBAAmB;IACnB,oBAAoB;IACpB,aAAa;IACb,kBAAkB;IAClB,aAAa;IACb,eAAe;IACf,eAAe;IACf,WAAW;IACX,iBAAiB;IACjB,eAAe;IACf,YAAY;IACZ,iBAAiB;IACjB,yBAAyB;IACzB,eAAe;IACf,oBAAoB;IACpB,mBAAmB;IACnB,gBAAgB;IAChB,kBAAkB;IAClB,oBAAoB;IACpB,oBAAoB;IACpB,WAAW;IACX,iBAAiB;IACjB,gCAAgC;IAChC,6BAA6B;IAC7B,4BAA4B;IAC5B,+BAA+B;IAC/B,0BAA0B;IAC1B,yBAAyB;IACzB,4BAA4B;IAC5B,4BAA4B;IAC5B,mCAAmC;IACnC,WAAW;IACX,cAAc;IACd,mBAAmB;IACnB,eAAe;IACf,eAAe;IACf,UAAU;I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,aAAa;IACb,qBAAqB;IACrB,sBAAsB;IACtB,aAAa;IACb,oBAAoB;IACpB,eAAe;IACf,sBAAsB;IACtB,iBAAiB;IACjB,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,kBAAkB;IAClB,uBAAuB;IACvB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,UAAU;IACV,WAAW;IACX,eAAe;IACf,cAAc;IACd,eAAe;IACf,aAAa;IACb,UAAU;IACV,aAAa;IACb,eAAe;IACf,YAAY;IACZ,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,YAAY;IACZ,6BAA6B;IAC7B,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,kBAAkB;IAClB,eAAe;IACf,UAAU;CACX,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,0BAA0B;IAC1B,YAAY;IACZ,gBAAgB;IAChB,0BAA0B;IAC1B,gBAAgB;IAChB,sBAAsB;IACtB,kBAAkB;IAClB,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,2BAA2B;IAC3B,6BAA6B;IAC7B,SAAS;IACT,mCAAmC;IACnC,eAAe;IACf,uBAAuB;IACvB,QAAQ;IACR,WAAW;IACX,qBAAqB;IACrB,qBAAqB;IACrB,uBAAuB;IACvB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,uBAAuB;IACvB,4BAA4B;IAC5B,cAAc;IACd,gCAAgC;IAChC,0BAA0B;IAC1B,2BAA2B;IAC3B,SAAS;IACT,sBAAsB;IACtB,oBAAoB;IACpB,eAAe;IACf,aAAa;IACb,oBAAoB;CACrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"engine-methods.js","sourceRoot":"","sources":["../../src/tools/engine-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uB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mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,UAAU;IACV,WAAW;IACX,eAAe;IACf,cAAc;IACd,eAAe;IACf,aAAa;IACb,UAAU;IACV,aAAa;IACb,eAAe;IACf,YAAY;IACZ,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,YAAY;IACZ,6BAA6B;IAC7B,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,kBAAkB;IAClB,eAAe;IACf,UAAU;CACX,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,0BAA0B;IAC1B,YAAY;IACZ,gBAAgB;IAChB,0BAA0B;IAC1B,gBAAgB;IAChB,sBAAsB;IACtB,kBAAkB;IAClB,cAAc;IACd,sBAAsB;IACtB,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,2BAA2B;IAC3B,6BAA6B;IAC7B,SAAS;IACT,mCAAmC;IACnC,eAAe;IACf,uBAAuB;IACvB,QAAQ;IACR,sBAAsB;IACtB,WAAW;IACX,qBAAqB;IACrB,qBAAqB;IACrB,uBAAuB;IACvB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,uBAAuB;IACvB,4BAA4B;IAC5B,cAAc;IACd,gCAAgC;IAChC,0BAA0B;IAC1B,2BAA2B;IAC3B,SAAS;IACT,sBAAsB;IACtB,oBAAoB;IACpB,eAAe;IACf,aAAa;IACb,oBAAoB;CACrB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pinepaper_beat_cuts (plan B2): music → audio_beats analysis → a beat grid →
|
|
3
|
+
* cut points on beats or bars, and optionally a clip split at each one.
|
|
4
|
+
*
|
|
5
|
+
* Orchestrated here through the real tools (audio_beats analyze, media
|
|
6
|
+
* split), so their checks apply: large sources are staged, ids resolve,
|
|
7
|
+
* a refused split is named.
|
|
8
|
+
*/
|
|
9
|
+
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { type HandlerOptions } from '../handlers.js';
|
|
12
|
+
export declare const BeatCutsArgsSchema: z.ZodEffects<z.ZodObject<{
|
|
13
|
+
source: z.ZodOptional<z.ZodString>;
|
|
14
|
+
beats: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
15
|
+
bpm: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
bpmHint: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
17
|
+
every: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["beat", "bar"]>, z.ZodNumber]>>;
|
|
18
|
+
beatsPerBar: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
range: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
20
|
+
clipId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
includeOnsets: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
every?: number | "bar" | "beat" | undefined;
|
|
24
|
+
source?: string | undefined;
|
|
25
|
+
beats?: number[] | undefined;
|
|
26
|
+
range?: [number, number] | undefined;
|
|
27
|
+
bpm?: number | undefined;
|
|
28
|
+
bpmHint?: [number, number] | undefined;
|
|
29
|
+
includeOnsets?: boolean | undefined;
|
|
30
|
+
beatsPerBar?: number | undefined;
|
|
31
|
+
clipId?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
every?: number | "bar" | "beat" | undefined;
|
|
34
|
+
source?: string | undefined;
|
|
35
|
+
beats?: number[] | undefined;
|
|
36
|
+
range?: [number, number] | undefined;
|
|
37
|
+
bpm?: number | undefined;
|
|
38
|
+
bpmHint?: [number, number] | undefined;
|
|
39
|
+
includeOnsets?: boolean | undefined;
|
|
40
|
+
beatsPerBar?: number | undefined;
|
|
41
|
+
clipId?: string | undefined;
|
|
42
|
+
}>, {
|
|
43
|
+
every?: number | "bar" | "beat" | undefined;
|
|
44
|
+
source?: string | undefined;
|
|
45
|
+
beats?: number[] | undefined;
|
|
46
|
+
range?: [number, number] | undefined;
|
|
47
|
+
bpm?: number | undefined;
|
|
48
|
+
bpmHint?: [number, number] | undefined;
|
|
49
|
+
includeOnsets?: boolean | undefined;
|
|
50
|
+
beatsPerBar?: number | undefined;
|
|
51
|
+
clipId?: string | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
every?: number | "bar" | "beat" | undefined;
|
|
54
|
+
source?: string | undefined;
|
|
55
|
+
beats?: number[] | undefined;
|
|
56
|
+
range?: [number, number] | undefined;
|
|
57
|
+
bpm?: number | undefined;
|
|
58
|
+
bpmHint?: [number, number] | undefined;
|
|
59
|
+
includeOnsets?: boolean | undefined;
|
|
60
|
+
beatsPerBar?: number | undefined;
|
|
61
|
+
clipId?: string | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
export declare const beatHandlers: Record<string, (args: Record<string, unknown>, options: HandlerOptions) => Promise<CallToolResult>>;
|
|
64
|
+
//# sourceMappingURL=beats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beats.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/beats.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAiD,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIpG,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU2F,CAAC;AAO3H,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,cAAc,CAAC,CA2D5H,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { errorResult, getExecutionMode, handleToolCall } from '../handlers.js';
|
|
3
|
+
import { ErrorCodes } from '../../types/schemas.js';
|
|
4
|
+
import { beatGrid, cutPoints, tempoCandidates } from '../../utils/beats.js';
|
|
5
|
+
export const BeatCutsArgsSchema = z.object({
|
|
6
|
+
source: z.string().min(1).optional(),
|
|
7
|
+
beats: z.array(z.number().min(0)).optional(),
|
|
8
|
+
bpm: z.number().positive().max(400).optional(),
|
|
9
|
+
bpmHint: z.tuple([z.number().positive(), z.number().positive()]).optional(),
|
|
10
|
+
every: z.union([z.enum(['beat', 'bar']), z.number().int().min(1).max(64)]).optional(),
|
|
11
|
+
beatsPerBar: z.number().int().min(1).max(16).optional(),
|
|
12
|
+
range: z.tuple([z.number().min(0), z.number().min(0)]).optional(),
|
|
13
|
+
clipId: z.string().min(1).optional(),
|
|
14
|
+
includeOnsets: z.boolean().optional(),
|
|
15
|
+
}).refine((v) => !!(v.source || v.beats), { message: 'give source (music to analyse) or beats (times you already have)' });
|
|
16
|
+
const firstJson = (r) => {
|
|
17
|
+
const c = r.content?.[0];
|
|
18
|
+
try {
|
|
19
|
+
return c && 'text' in c ? JSON.parse(c.text) : null;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export const beatHandlers = {
|
|
26
|
+
'pinepaper_beat_cuts': async (args, options) => {
|
|
27
|
+
const a = BeatCutsArgsSchema.parse(args);
|
|
28
|
+
let beats = a.beats ? [...a.beats].sort((x, y) => x - y) : null;
|
|
29
|
+
let bpm = a.bpm ?? null;
|
|
30
|
+
let grid = null;
|
|
31
|
+
if (!beats) {
|
|
32
|
+
if ((options.executionMode ?? getExecutionMode()) === 'code' || !options.executeInBrowser) {
|
|
33
|
+
return errorResult(ErrorCodes.VALIDATION_ERROR, 'beat_cuts analyses the music in the studio, so it needs a live studio — or pass beats (times in seconds) you already have.');
|
|
34
|
+
}
|
|
35
|
+
const analysed = await handleToolCall('pinepaper_audio_beats', { action: 'analyze', source: a.source }, options);
|
|
36
|
+
const body = firstJson(analysed);
|
|
37
|
+
const r = body?.result ?? body;
|
|
38
|
+
if (analysed.isError || !r || r.success === false || !Array.isArray(r.onsets) || !(r.bpm > 0)) {
|
|
39
|
+
return errorResult(ErrorCodes.EXECUTION_ERROR, `the music could not be analysed: ${(r && r.error) || JSON.stringify(body).slice(0, 300)}`);
|
|
40
|
+
}
|
|
41
|
+
const duration = Number(r.duration) || Math.max(...r.onsets, 0);
|
|
42
|
+
// The studio's tempo can lock onto a related one (a 120 track read as
|
|
43
|
+
// 162 = 4:3). Its usual confusions are scored against the onsets and
|
|
44
|
+
// the best is used — or the caller's bpm, or the best inside bpmHint.
|
|
45
|
+
const candidates = tempoCandidates(r.onsets, r.bpm, duration, a.bpmHint);
|
|
46
|
+
const chosen = a.bpm ?? candidates[0]?.bpm ?? r.bpm;
|
|
47
|
+
const g = beatGrid(r.onsets, chosen, duration);
|
|
48
|
+
beats = g.beats;
|
|
49
|
+
bpm = g.bpm;
|
|
50
|
+
const conf = candidates.find((c) => c.bpm === Math.round(chosen * 10) / 10)?.confidence ?? null;
|
|
51
|
+
grid = { bpm: g.bpm, phase: g.phase, period: Math.round(g.period * 1000) / 1000, confidence: conf, detected: { bpm: r.bpm, confidence: r.confidence }, duration: r.duration,
|
|
52
|
+
candidates: candidates.slice(0, 4), ...(a.includeOnsets ? { onsets: r.onsets } : {}), ...(a.bpm ? { bpmFrom: 'caller' } : a.bpmHint ? { bpmFrom: 'bpmHint' } : { bpmFrom: 'best candidate' }) };
|
|
53
|
+
if (!a.bpm && (conf === null || conf < 0.4)) {
|
|
54
|
+
grid.lowConfidence = true;
|
|
55
|
+
grid.warning = `the tempo is uncertain (confidence ${conf ?? 'unknown'} at ${g.bpm} bpm; the studio detected ${r.bpm} at ${r.confidence}). If you know it, pass bpm (or bpmHint: [min, max]); the candidates above are the likely alternatives.`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const cuts = cutPoints(beats, a.every ?? 'beat', a.beatsPerBar ?? 4, a.range);
|
|
59
|
+
const out = { success: true, every: a.every ?? 'beat', ...(bpm ? { bpm } : {}), ...(grid ? { grid } : {}), cuts, count: cuts.length };
|
|
60
|
+
// Split a clip at each cut, in order: each split leaves the rest of the clip
|
|
61
|
+
// on the right-hand piece, which is where the next cut falls.
|
|
62
|
+
if (a.clipId && cuts.length) {
|
|
63
|
+
const pieces = [a.clipId];
|
|
64
|
+
let current = a.clipId;
|
|
65
|
+
const refused = [];
|
|
66
|
+
for (const at of cuts) {
|
|
67
|
+
const r = await handleToolCall('pinepaper_media', { action: 'split', id: current, at }, options);
|
|
68
|
+
const body = firstJson(r);
|
|
69
|
+
const res = body?.result ?? body;
|
|
70
|
+
if (r.isError || !res || res.success === false) {
|
|
71
|
+
const e = res?.error;
|
|
72
|
+
refused.push({ at, reason: typeof e === 'string' ? e : (e?.message ?? JSON.stringify(e ?? 'refused')) });
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
current = res.rightId ?? current;
|
|
76
|
+
pieces.push(current);
|
|
77
|
+
}
|
|
78
|
+
out.split = { clipId: a.clipId, pieces, made: pieces.length - 1, ...(refused.length ? { skipped: refused, note: 'cuts outside the clip (before its start or after its end) are skipped.' } : {}) };
|
|
79
|
+
}
|
|
80
|
+
return { content: [{ type: 'text', text: JSON.stringify(out, null, 2) }] };
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=beats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beats.js","sourceRoot":"","sources":["../../../src/tools/handlers/beats.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAuB,MAAM,gBAAgB,CAAC;AACpG,OAAO,E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E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAoBzB"}
|
package/dist/tools/handlers.js
CHANGED
|
@@ -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
|
|
@@ -47,6 +47,7 @@ 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
49
|
import { generateHandlers } from './handlers/generate.js';
|
|
50
|
+
import { beatHandlers } from './handlers/beats.js';
|
|
50
51
|
import { planCharacter, generateCharacterCode } from './handlers/character.js';
|
|
51
52
|
import { buildZip } from '../utils/zip.js';
|
|
52
53
|
import { buildScc } from '../utils/scc.js';
|
|
@@ -66,6 +67,7 @@ function getDomainHandlers() {
|
|
|
66
67
|
ontologyHandlers,
|
|
67
68
|
exportHandlers,
|
|
68
69
|
generateHandlers,
|
|
70
|
+
beatHandlers,
|
|
69
71
|
];
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
@@ -1093,6 +1095,8 @@ const IGNORED_ARGUMENT_SCHEMAS = {
|
|
|
1093
1095
|
// common slip here (round 7 retest, 1.63).
|
|
1094
1096
|
pinepaper_create_item: CreateItemInputSchema,
|
|
1095
1097
|
pinepaper_modify_item: ModifyItemInputSchema,
|
|
1098
|
+
// Its options live in `options` / `spec`; a key beside them was dropped.
|
|
1099
|
+
pinepaper_sound: SoundInputSchema,
|
|
1096
1100
|
};
|
|
1097
1101
|
const IGNORED_ARGUMENT_HINTS = {
|
|
1098
1102
|
pinepaper_create_item: Object.fromEntries(['width', 'height', 'radius', 'color', 'fillColor', 'strokeColor', 'strokeWidth', 'content', 'fontSize', 'fontFamily', 'opacity', 'rotation', 'x', 'y']
|
|
@@ -1615,6 +1619,11 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
|
|
|
1615
1619
|
const code = codeGenerator.generateAudioBeats({ ...input, source: staged ? `__ppStage:${stageKey}` : source });
|
|
1616
1620
|
return executeOrGenerate(code, `Audio: ${input.action}`, options, 'pinepaper_audio_beats', staged ? { [stageKey]: source } : undefined);
|
|
1617
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');
|
|
1626
|
+
}
|
|
1618
1627
|
case 'pinepaper_accessibility_check': {
|
|
1619
1628
|
const input = AccessibilityCheckInputSchema.parse(args);
|
|
1620
1629
|
const code = codeGenerator.generateAccessibilityCheck(input);
|
|
@@ -1632,9 +1641,23 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
|
|
|
1632
1641
|
const report = {};
|
|
1633
1642
|
const page = parseCssColor(m.page);
|
|
1634
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).
|
|
1635
1647
|
const c = checkContrast(m.texts, page);
|
|
1636
|
-
|
|
1637
|
-
|
|
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.' };
|
|
1638
1661
|
}
|
|
1639
1662
|
if (m.flashUnavailable)
|
|
1640
1663
|
report.flash = { checked: false, reason: m.flashUnavailable };
|
|
@@ -1644,7 +1667,9 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
|
|
|
1644
1667
|
frames: m.series.length, fps: m.fps,
|
|
1645
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).' };
|
|
1646
1669
|
}
|
|
1647
|
-
|
|
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;
|
|
1648
1673
|
return dataResult({ success: true, pass, ...report });
|
|
1649
1674
|
}
|
|
1650
1675
|
case 'pinepaper_render_batch': {
|
|
@@ -2904,6 +2929,16 @@ You can now start creating new items on a clean canvas.`,
|
|
|
2904
2929
|
}
|
|
2905
2930
|
}
|
|
2906
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
|
+
}
|
|
2907
2942
|
const input = AgentExportInputSchema.parse(args);
|
|
2908
2943
|
const code = codeGenerator.generateAgentExport(input);
|
|
2909
2944
|
const description = `Smart export for ${input.platform} as ${input.format || 'auto'}`;
|