@pinepaper.studio/mcp-server 1.6.20 → 1.6.21
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 +79 -5
- package/README.pt-BR.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/build-info.json +3 -3
- package/dist/ontology/upstream-vocabulary.d.ts +2 -2
- package/dist/ontology/upstream-vocabulary.js +3 -3
- package/dist/ontology/upstream-vocabulary.js.map +1 -1
- package/dist/ontology/vocabulary.js +1 -1
- package/dist/ontology/vocabulary.js.map +1 -1
- package/dist/tools/choreograph.d.ts.map +1 -1
- package/dist/tools/choreograph.js +10 -0
- package/dist/tools/choreograph.js.map +1 -1
- package/dist/tools/craft-tools.d.ts +55 -0
- package/dist/tools/craft-tools.d.ts.map +1 -0
- package/dist/tools/craft-tools.js +139 -0
- package/dist/tools/craft-tools.js.map +1 -0
- package/dist/tools/definitions.d.ts.map +1 -1
- package/dist/tools/definitions.js +117 -7
- package/dist/tools/definitions.js.map +1 -1
- package/dist/tools/effect-class.d.ts.map +1 -1
- package/dist/tools/effect-class.js +6 -0
- package/dist/tools/effect-class.js.map +1 -1
- package/dist/tools/engine-lists.d.ts +2 -2
- package/dist/tools/engine-lists.js +2 -2
- 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/engine-surface.d.ts +1 -1
- package/dist/tools/engine-surface.d.ts.map +1 -1
- package/dist/tools/engine-surface.js +38 -5
- package/dist/tools/engine-surface.js.map +1 -1
- package/dist/tools/handlers/generate.d.ts +28 -28
- package/dist/tools/handlers.d.ts.map +1 -1
- package/dist/tools/handlers.js +125 -1
- package/dist/tools/handlers.js.map +1 -1
- package/dist/tools/minimal-descriptions.d.ts.map +1 -1
- package/dist/tools/minimal-descriptions.js +7 -0
- package/dist/tools/minimal-descriptions.js.map +1 -1
- package/dist/tools/shape-params.d.ts +2 -2
- package/dist/tools/shape-params.d.ts.map +1 -1
- package/dist/tools/shape-params.js +3 -2
- package/dist/tools/shape-params.js.map +1 -1
- package/dist/tools/stick-vocabulary.d.ts +1 -1
- package/dist/tools/stick-vocabulary.js +1 -1
- package/dist/tools/toolkits.d.ts.map +1 -1
- package/dist/tools/toolkits.js +9 -0
- package/dist/tools/toolkits.js.map +1 -1
- package/dist/types/code-generator.d.ts +10 -1
- package/dist/types/code-generator.d.ts.map +1 -1
- package/dist/types/code-generator.js +605 -107
- package/dist/types/code-generator.js.map +1 -1
- package/dist/types/schemas.d.ts +1745 -582
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +144 -4
- package/dist/types/schemas.js.map +1 -1
- package/dist/vendor/design/design-style.d.ts +2 -2
- package/dist/vendor/design/design-style.d.ts.map +1 -1
- package/dist/vendor/design/design-style.js +7 -2
- package/dist/vendor/design/design-style.js.map +1 -1
- package/dist/vendor/design/subdivision-tool-schema.d.ts +16 -0
- package/dist/vendor/design/subdivision-tool-schema.d.ts.map +1 -0
- package/dist/vendor/design/subdivision-tool-schema.js +104 -0
- package/dist/vendor/design/subdivision-tool-schema.js.map +1 -0
- package/dist/vendor/design/textile-tool-schema.d.ts +14 -0
- package/dist/vendor/design/textile-tool-schema.d.ts.map +1 -0
- package/dist/vendor/design/textile-tool-schema.js +195 -0
- package/dist/vendor/design/textile-tool-schema.js.map +1 -0
- package/dist/vendor/design/ui-kit-runtime.d.ts +49 -0
- package/dist/vendor/design/ui-kit-runtime.d.ts.map +1 -0
- package/dist/vendor/design/ui-kit-runtime.js +761 -0
- package/dist/vendor/design/ui-kit-runtime.js.map +1 -0
- package/dist/vendor/design/ui-kit-tool-schema.d.ts +280 -0
- package/dist/vendor/design/ui-kit-tool-schema.d.ts.map +1 -0
- package/dist/vendor/design/ui-kit-tool-schema.js +209 -0
- package/dist/vendor/design/ui-kit-tool-schema.js.map +1 -0
- package/manifest.json +29 -1
- package/package.json +2 -2
- package/dist/assets/repositories/openclipart.d.ts +0 -41
- package/dist/assets/repositories/openclipart.d.ts.map +0 -1
- package/dist/assets/repositories/openclipart.js +0 -139
- package/dist/assets/repositories/openclipart.js.map +0 -1
- package/dist/assets/repositories/svgrepo.d.ts +0 -61
- package/dist/assets/repositories/svgrepo.d.ts.map +0 -1
- package/dist/assets/repositories/svgrepo.js +0 -276
- package/dist/assets/repositories/svgrepo.js.map +0 -1
package/dist/tools/handlers.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Supports i18n for localized error and success messages.
|
|
6
6
|
* Supports browser execution via Puppeteer.
|
|
7
7
|
*/
|
|
8
|
+
import { CRAFT_FRAME_JS, generateDrawWeave, generateDrawKnots, generateDrawSashiko, generateDrawSubdivision, generateUiKit, uiKitCallProblems, } from './craft-tools.js';
|
|
8
9
|
import { codeGenerator, generateQueryMutationsCode, SHEET_RUBRIC } from '../types/code-generator.js';
|
|
9
10
|
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, RelightInputSchema, ChoreographInputSchema, EmitterInputSchema, MorphSequenceInputSchema, OriginalCharacterInputSchema, LookInputSchema, RenderHookInputSchema, ShaderGraphInputSchema, 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
11
|
// Diagram schemas
|
|
@@ -27,7 +28,7 @@ ImportImageInputSchema,
|
|
|
27
28
|
// Scene management schemas
|
|
28
29
|
ManageScenesInputSchema, ScenePlaybackInputSchema, SceneGraphInputSchema, SequenceInputSchema, StaggerInputSchema, FlipInputSchema,
|
|
29
30
|
// New consolidated tool schemas
|
|
30
|
-
SelectionInputSchema, TransformInputSchema, HistoryInputSchema, ImageFilterInputSchema, LassoInputSchema, CutoutStyleInputSchema, PrecompInputSchema, BackgroundInputSchema, QueryInputSchema, QueryCapabilitiesInputSchema, DeformInputSchema, SpriteSheetInputSchema, InteractionInputSchema, ExportWidgetInputSchema, ExportWidgetHtmlInputSchema, CreateChartInputSchema, MagicInputSchema, PhysicsInputSchema, MeasurementInputSchema, PlaceOnSurfaceInputSchema, StyledSceneInputSchema, ErrorCodes, } from '../types/schemas.js';
|
|
31
|
+
SelectionInputSchema, TransformInputSchema, HistoryInputSchema, ImageFilterInputSchema, LassoInputSchema, CutoutStyleInputSchema, PrecompInputSchema, BackgroundInputSchema, QueryInputSchema, QueryCapabilitiesInputSchema, DeformInputSchema, HandDrawnInputSchema, PenFigureInputSchema, CreateCharacterInputSchema, CharacterActionInputSchema, CharacterPoseInputSchema, SpriteSheetInputSchema, InteractionInputSchema, ExportWidgetInputSchema, ExportWidgetHtmlInputSchema, CreateChartInputSchema, MagicInputSchema, PhysicsInputSchema, MeasurementInputSchema, PlaceOnSurfaceInputSchema, DrawWeaveInputSchema, DrawKnotsInputSchema, DrawSashikoInputSchema, DrawSubdivisionInputSchema, UiKitInputSchema, StyledSceneInputSchema, ErrorCodes, } from '../types/schemas.js';
|
|
31
32
|
import { ZodError, z } from 'zod';
|
|
32
33
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
33
34
|
import { effectClass } from './effect-class.js';
|
|
@@ -1099,6 +1100,24 @@ async function captureSheet(input, options) {
|
|
|
1099
1100
|
}],
|
|
1100
1101
|
};
|
|
1101
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* The canvas the craft tools fill when the call gives no bounds. Asked of the
|
|
1105
|
+
* studio, so a portrait or square canvas is filled rather than a 1280x720
|
|
1106
|
+
* corner of it; undefined (the generators' own default) without a studio.
|
|
1107
|
+
*/
|
|
1108
|
+
async function craftFrame(options) {
|
|
1109
|
+
const ctl = options.browserController;
|
|
1110
|
+
if (!options.executeInBrowser || !ctl || !ctl.connected)
|
|
1111
|
+
return undefined;
|
|
1112
|
+
try {
|
|
1113
|
+
const r = await ctl.executeCode(CRAFT_FRAME_JS, false);
|
|
1114
|
+
const f = r.success ? r.result : null;
|
|
1115
|
+
return f && f.width > 0 && f.height > 0 ? f : undefined;
|
|
1116
|
+
}
|
|
1117
|
+
catch {
|
|
1118
|
+
return undefined;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1102
1121
|
export async function executeOrGenerate(code, description, options, toolName,
|
|
1103
1122
|
/**
|
|
1104
1123
|
* Values too large to live inside the generated code. Written to
|
|
@@ -1788,6 +1807,17 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
|
|
|
1788
1807
|
const code = codeGenerator.generateDeform(input);
|
|
1789
1808
|
return executeOrGenerate(code, `Deform: ${input.action}`, options, 'pinepaper_deform');
|
|
1790
1809
|
}
|
|
1810
|
+
case 'pinepaper_hand_drawn': {
|
|
1811
|
+
const input = HandDrawnInputSchema.parse(args);
|
|
1812
|
+
const code = codeGenerator.generateHandDrawn(input);
|
|
1813
|
+
return executeOrGenerate(code, `Hand-drawn style: ${input.style ?? input.mode ?? 'sketchy'}`, options, 'pinepaper_hand_drawn');
|
|
1814
|
+
}
|
|
1815
|
+
case 'pinepaper_pen_figure': {
|
|
1816
|
+
const input = PenFigureInputSchema.parse(args);
|
|
1817
|
+
const code = codeGenerator.generatePenFigure(input);
|
|
1818
|
+
const what = input.action === 'list' ? 'List the pen figures' : `Draw ${typeof input.figure === 'string' ? input.figure : 'a figure'} with a pen`;
|
|
1819
|
+
return executeOrGenerate(code, what, options, 'pinepaper_pen_figure');
|
|
1820
|
+
}
|
|
1791
1821
|
case 'pinepaper_sprite_sheet': {
|
|
1792
1822
|
const input = SpriteSheetInputSchema.parse(args);
|
|
1793
1823
|
const code = codeGenerator.generateSpriteSheet(input);
|
|
@@ -1856,6 +1886,60 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
|
|
|
1856
1886
|
const description = `Places ${input.concept} as ${plan.parts.length} parts with ${plan.tracks} keyframe tracks`;
|
|
1857
1887
|
return executeOrGenerate(code, description, options, 'pinepaper_character');
|
|
1858
1888
|
}
|
|
1889
|
+
case 'pinepaper_create_character': {
|
|
1890
|
+
const input = CreateCharacterInputSchema.parse(args);
|
|
1891
|
+
// If layered bundle provided, use importLayeredCharacter
|
|
1892
|
+
if (input.bundle) {
|
|
1893
|
+
const bundleInfo = input.bundle.info || input.bundle;
|
|
1894
|
+
const bundleImages = input.bundle.images || {};
|
|
1895
|
+
const code = codeGenerator.generateImportLayeredCharacter({ info: bundleInfo, images: bundleImages });
|
|
1896
|
+
return executeOrGenerate(code, `Import layered character: ${input.name || input.characterId || 'bundle'}`, options, 'pinepaper_create_character');
|
|
1897
|
+
}
|
|
1898
|
+
// If concept/preset matches a planCharacter concept, plan it
|
|
1899
|
+
const conceptName = input.concept || input.preset;
|
|
1900
|
+
if (conceptName) {
|
|
1901
|
+
const formattedConcept = conceptName.startsWith('pp:') ? conceptName : `pp:${conceptName.charAt(0).toUpperCase() + conceptName.slice(1)}`;
|
|
1902
|
+
const plan = planCharacter({
|
|
1903
|
+
concept: formattedConcept,
|
|
1904
|
+
at: { x: input.x, y: input.y },
|
|
1905
|
+
scale: input.scale,
|
|
1906
|
+
});
|
|
1907
|
+
if (plan.ok) {
|
|
1908
|
+
const code = generateCharacterCode(plan, {
|
|
1909
|
+
generateCreateItem: (i) => codeGenerator.generateCreateItem(i),
|
|
1910
|
+
generateKeyframeAnimate: (i) => codeGenerator.generateKeyframeAnimate(i),
|
|
1911
|
+
}, {
|
|
1912
|
+
createItem: (a) => CreateItemInputSchema.parse(a),
|
|
1913
|
+
keyframeAnimate: (a) => KeyframeAnimateInputSchema.parse(a),
|
|
1914
|
+
});
|
|
1915
|
+
return executeOrGenerate(code, `Places character ${formattedConcept}`, options, 'pinepaper_create_character');
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
const code = codeGenerator.generateCreateCharacter(input);
|
|
1919
|
+
return executeOrGenerate(code, `Create character: ${input.name || input.characterId || 'Character'}`, options, 'pinepaper_create_character');
|
|
1920
|
+
}
|
|
1921
|
+
case 'pinepaper_character_action': {
|
|
1922
|
+
const input = CharacterActionInputSchema.parse(args);
|
|
1923
|
+
const act = String(input.action || 'walk').toLowerCase();
|
|
1924
|
+
const FACES = ['blink', 'frown', 'smile', 'surprise', 'talk', 'wink'];
|
|
1925
|
+
if (FACES.includes(act)) {
|
|
1926
|
+
return {
|
|
1927
|
+
content: [{
|
|
1928
|
+
type: 'text',
|
|
1929
|
+
text: `"${act}" is a facial expression — use pinepaper_character_pose with { expression: "${act}" }. Actions: walk, run, locomotion, wave, dance, jump, idle`,
|
|
1930
|
+
}],
|
|
1931
|
+
isError: true,
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
const code = codeGenerator.generateCharacterAction(input);
|
|
1935
|
+
return executeOrGenerate(code, `Character action: ${act}`, options, 'pinepaper_character_action');
|
|
1936
|
+
}
|
|
1937
|
+
case 'pinepaper_character_pose': {
|
|
1938
|
+
const input = CharacterPoseInputSchema.parse(args);
|
|
1939
|
+
const expr = String(input.expression || 'smile').toLowerCase();
|
|
1940
|
+
const code = codeGenerator.generateCharacterPose(input);
|
|
1941
|
+
return executeOrGenerate(code, `Character pose/expression: ${expr}`, options, 'pinepaper_character_pose');
|
|
1942
|
+
}
|
|
1859
1943
|
case 'pinepaper_batch_create': {
|
|
1860
1944
|
const input = BatchCreateInputSchema.parse(args);
|
|
1861
1945
|
const code = codeGenerator.generateBatchCreate(input);
|
|
@@ -2061,6 +2145,44 @@ async function handleToolCallInner(toolName, args, options, tracker, baseTimerId
|
|
|
2061
2145
|
const input = StyledSceneInputSchema.parse(args);
|
|
2062
2146
|
return executeOrGenerate(codeGenerator.generateStyledScene(input), `Styled scene${input.style ? `: ${input.style}` : ''}`, options, 'pinepaper_styled_scene');
|
|
2063
2147
|
}
|
|
2148
|
+
// The cloud's craft tools, shared (craft-tools.ts says what differs locally).
|
|
2149
|
+
case 'pinepaper_draw_weave': {
|
|
2150
|
+
const input = DrawWeaveInputSchema.parse(args);
|
|
2151
|
+
const code = generateDrawWeave(input, await craftFrame(options));
|
|
2152
|
+
return executeOrGenerate(code, `Draw a ${input.weave ?? 'plain'} weave`, options, 'pinepaper_draw_weave');
|
|
2153
|
+
}
|
|
2154
|
+
case 'pinepaper_draw_knots': {
|
|
2155
|
+
const input = DrawKnotsInputSchema.parse(args);
|
|
2156
|
+
if (!input.points?.length) {
|
|
2157
|
+
return {
|
|
2158
|
+
content: [{ type: 'text', text: 'pinepaper_draw_knots: give points — [{x, y}, …], one per knot. The tool places knots where you say and draws nothing without them.' }],
|
|
2159
|
+
isError: true,
|
|
2160
|
+
};
|
|
2161
|
+
}
|
|
2162
|
+
return executeOrGenerate(generateDrawKnots(input), `Draw ${input.points.length} embroidered knot(s)`, options, 'pinepaper_draw_knots');
|
|
2163
|
+
}
|
|
2164
|
+
case 'pinepaper_draw_sashiko': {
|
|
2165
|
+
const input = DrawSashikoInputSchema.parse(args);
|
|
2166
|
+
const code = generateDrawSashiko(input, await craftFrame(options));
|
|
2167
|
+
return executeOrGenerate(code, `Draw ${input.pattern ?? 'seigaiha'} sashiko`, options, 'pinepaper_draw_sashiko');
|
|
2168
|
+
}
|
|
2169
|
+
case 'pinepaper_draw_subdivision': {
|
|
2170
|
+
const input = DrawSubdivisionInputSchema.parse(args);
|
|
2171
|
+
const code = generateDrawSubdivision(input, await craftFrame(options));
|
|
2172
|
+
return executeOrGenerate(code, `Draw a ${input.preset ?? 'mondrian'} subdivision`, options, 'pinepaper_draw_subdivision');
|
|
2173
|
+
}
|
|
2174
|
+
case 'pinepaper_ui_kit': {
|
|
2175
|
+
const input = UiKitInputSchema.parse(args);
|
|
2176
|
+
const problems = uiKitCallProblems(input);
|
|
2177
|
+
const code = problems.length ? null : generateUiKit(input);
|
|
2178
|
+
if (!code) {
|
|
2179
|
+
return {
|
|
2180
|
+
content: [{ type: 'text', text: `pinepaper_ui_kit: ${problems.join(' ') || 'nothing to draw'}` }],
|
|
2181
|
+
isError: true,
|
|
2182
|
+
};
|
|
2183
|
+
}
|
|
2184
|
+
return executeOrGenerate(code, `UI kit: ${input.action}`, options, 'pinepaper_ui_kit');
|
|
2185
|
+
}
|
|
2064
2186
|
case 'pinepaper_place_on_surface': {
|
|
2065
2187
|
const input = PlaceOnSurfaceInputSchema.parse(args);
|
|
2066
2188
|
const code = codeGenerator.generatePlaceOnSurface(input);
|
|
@@ -4054,6 +4176,8 @@ You can now start creating new items on a clean canvas.${sizeNote}`,
|
|
|
4054
4176
|
'pinepaper_query_capabilities',
|
|
4055
4177
|
// Deformation, sprite sheets, interaction
|
|
4056
4178
|
'pinepaper_deform',
|
|
4179
|
+
'pinepaper_hand_drawn',
|
|
4180
|
+
'pinepaper_pen_figure',
|
|
4057
4181
|
'pinepaper_sprite_sheet',
|
|
4058
4182
|
'pinepaper_interaction',
|
|
4059
4183
|
// Widget export
|