@imgly/codesign-mcp 0.1.5 → 0.1.6
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.md +51 -1
- package/assets/docs/guide/SKILL.md +45 -53
- package/assets/docs/guide/animation/create/base.md +234 -243
- package/assets/docs/guide/animation/create/text.md +250 -231
- package/assets/docs/guide/animation/create.md +197 -231
- package/assets/docs/guide/animation/edit.md +196 -271
- package/assets/docs/guide/animation/types.md +182 -185
- package/assets/docs/guide/animation.md +9 -6
- package/assets/docs/guide/api/AssetAPI.md +7 -53
- package/assets/docs/guide/api/BlockAPI.md +725 -648
- package/assets/docs/guide/api/CreativeEngine.md +7 -16
- package/assets/docs/guide/api/EditorAPI.md +32 -93
- package/assets/docs/guide/api/EventAPI.md +1 -2
- package/assets/docs/guide/api/SceneAPI.md +47 -98
- package/assets/docs/guide/api/VariableAPI.md +1 -4
- package/assets/docs/guide/api/node/classes/assetapi.md +1090 -0
- package/assets/docs/guide/api/node/classes/blockapi.md +12965 -0
- package/assets/docs/guide/api/node/classes/creativeengine.md +319 -0
- package/assets/docs/guide/api/node/classes/editorapi.md +3417 -0
- package/assets/docs/guide/api/node/classes/engineactions.md +319 -0
- package/assets/docs/guide/api/node/classes/eventapi.md +56 -0
- package/assets/docs/guide/api/node/classes/sceneapi.md +1370 -0
- package/assets/docs/guide/api/node/classes/variableapi.md +143 -0
- package/assets/docs/guide/api/node/enumerations/compressionformat.md +23 -0
- package/assets/docs/guide/api/node/enumerations/compressionlevel.md +24 -0
- package/assets/docs/guide/api/node/functions/iscmykcolor.md +30 -0
- package/assets/docs/guide/api/node/functions/isrgbacolor.md +30 -0
- package/assets/docs/guide/api/node/functions/isspotcolor.md +30 -0
- package/assets/docs/guide/api/node/interfaces/addvideooptions.md +31 -0
- package/assets/docs/guide/api/node/interfaces/applyassetoptions.md +31 -0
- package/assets/docs/guide/api/node/interfaces/asset.md +30 -0
- package/assets/docs/guide/api/node/interfaces/assetbooleanproperty.md +25 -0
- package/assets/docs/guide/api/node/interfaces/assetcmykcolor.md +26 -0
- package/assets/docs/guide/api/node/interfaces/assetcolorproperty.md +25 -0
- package/assets/docs/guide/api/node/interfaces/assetcontentaspectratio.md +23 -0
- package/assets/docs/guide/api/node/interfaces/assetdefinition.md +31 -0
- package/assets/docs/guide/api/node/interfaces/assetenumproperty.md +26 -0
- package/assets/docs/guide/api/node/interfaces/assetfixedaspectratio.md +24 -0
- package/assets/docs/guide/api/node/interfaces/assetfixedsize.md +25 -0
- package/assets/docs/guide/api/node/interfaces/assetfreeaspectratio.md +22 -0
- package/assets/docs/guide/api/node/interfaces/assetnumberproperty.md +28 -0
- package/assets/docs/guide/api/node/interfaces/assetpayload.md +27 -0
- package/assets/docs/guide/api/node/interfaces/assetquerydata.md +32 -0
- package/assets/docs/guide/api/node/interfaces/assetresult.md +46 -0
- package/assets/docs/guide/api/node/interfaces/assetrgbcolor.md +25 -0
- package/assets/docs/guide/api/node/interfaces/assetsource.md +111 -0
- package/assets/docs/guide/api/node/interfaces/assetspotcolor.md +25 -0
- package/assets/docs/guide/api/node/interfaces/assetsqueryresult.md +31 -0
- package/assets/docs/guide/api/node/interfaces/assetstringproperty.md +25 -0
- package/assets/docs/guide/api/node/interfaces/assetstylepreset.md +39 -0
- package/assets/docs/guide/api/node/interfaces/assetstylepresetanimation.md +23 -0
- package/assets/docs/guide/api/node/interfaces/audiotrackinfo.md +32 -0
- package/assets/docs/guide/api/node/interfaces/blockevent.md +26 -0
- package/assets/docs/guide/api/node/interfaces/blockstateerror.md +26 -0
- package/assets/docs/guide/api/node/interfaces/blockstatepending.md +26 -0
- package/assets/docs/guide/api/node/interfaces/blockstateready.md +25 -0
- package/assets/docs/guide/api/node/interfaces/buffer.md +26 -0
- package/assets/docs/guide/api/node/interfaces/characterinkbox.md +29 -0
- package/assets/docs/guide/api/node/interfaces/cmykcolor.md +34 -0
- package/assets/docs/guide/api/node/interfaces/completeassetresult.md +46 -0
- package/assets/docs/guide/api/node/interfaces/configuration.md +38 -0
- package/assets/docs/guide/api/node/interfaces/dominantcolor.md +25 -0
- package/assets/docs/guide/api/node/interfaces/dominantcolorsoptions.md +23 -0
- package/assets/docs/guide/api/node/interfaces/engineactioninfo.md +24 -0
- package/assets/docs/guide/api/node/interfaces/engineactionsregistry.md +18 -0
- package/assets/docs/guide/api/node/interfaces/engineplugin.md +30 -0
- package/assets/docs/guide/api/node/interfaces/font.md +27 -0
- package/assets/docs/guide/api/node/interfaces/fontmetrics.md +32 -0
- package/assets/docs/guide/api/node/interfaces/gradientcolorstop.md +28 -0
- package/assets/docs/guide/api/node/interfaces/logger.md +39 -0
- package/assets/docs/guide/api/node/interfaces/pageduration.md +23 -0
- package/assets/docs/guide/api/node/interfaces/range.md +23 -0
- package/assets/docs/guide/api/node/interfaces/rgbacolor.md +32 -0
- package/assets/docs/guide/api/node/interfaces/rgbcolor.md +30 -0
- package/assets/docs/guide/api/node/interfaces/settings.md +126 -0
- package/assets/docs/guide/api/node/interfaces/size2.md +21 -0
- package/assets/docs/guide/api/node/interfaces/source.md +24 -0
- package/assets/docs/guide/api/node/interfaces/spotcolor.md +30 -0
- package/assets/docs/guide/api/node/interfaces/textdecorationconfig.md +31 -0
- package/assets/docs/guide/api/node/interfaces/textfontsizeoptions.md +24 -0
- package/assets/docs/guide/api/node/interfaces/textruninfo.md +33 -0
- package/assets/docs/guide/api/node/interfaces/transientresource.md +26 -0
- package/assets/docs/guide/api/node/interfaces/typeface.md +23 -0
- package/assets/docs/guide/api/node/interfaces/vec2.md +21 -0
- package/assets/docs/guide/api/node/interfaces/vec3.md +22 -0
- package/assets/docs/guide/api/node/type-aliases/addimageoptions.md +36 -0
- package/assets/docs/guide/api/node/type-aliases/animationbaselinedirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationblockswipetextdirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationeasing.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationentry.md +28 -0
- package/assets/docs/guide/api/node/type-aliases/animationgrowdirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationjumploopdirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationkenburnsdirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationmergetextdirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationoptions.md +28 -0
- package/assets/docs/guide/api/node/type-aliases/animationspindirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationspinloopdirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationtype.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/animationtypelonghand.md +21 -0
- package/assets/docs/guide/api/node/type-aliases/animationtypeshorthand.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationtypewritertextwritingstyle.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/animationwipedirection.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/applicationmimetype.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/assetcolor.md +23 -0
- package/assets/docs/guide/api/node/type-aliases/assetfilter.md +47 -0
- package/assets/docs/guide/api/node/type-aliases/assetgroups.md +25 -0
- package/assets/docs/guide/api/node/type-aliases/assetmetadata.md +42 -0
- package/assets/docs/guide/api/node/type-aliases/assetproperty.md +25 -0
- package/assets/docs/guide/api/node/type-aliases/assetpropertyfilter.md +41 -0
- package/assets/docs/guide/api/node/type-aliases/assetpropertypath.md +26 -0
- package/assets/docs/guide/api/node/type-aliases/assetstylepresetanimationproperties.md +34 -0
- package/assets/docs/guide/api/node/type-aliases/assetstylepresetproperties.md +29 -0
- package/assets/docs/guide/api/node/type-aliases/assetstylepresetpropertyvalue.md +29 -0
- package/assets/docs/guide/api/node/type-aliases/assetstylepresetscalableproperty.md +28 -0
- package/assets/docs/guide/api/node/type-aliases/assettransformpreset.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/asyncuriresolver.md +36 -0
- package/assets/docs/guide/api/node/type-aliases/audioexportoptions.md +43 -0
- package/assets/docs/guide/api/node/type-aliases/audiofromvideooptions.md +27 -0
- package/assets/docs/guide/api/node/type-aliases/audiomimetype.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/blendmode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/blockenumtype.md +63 -0
- package/assets/docs/guide/api/node/type-aliases/blockstate.md +26 -0
- package/assets/docs/guide/api/node/type-aliases/blurtype.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/blurtypelonghand.md +21 -0
- package/assets/docs/guide/api/node/type-aliases/blurtypeshorthand.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/booleanoperation.md +27 -0
- package/assets/docs/guide/api/node/type-aliases/boolpropertyname.md +79 -0
- package/assets/docs/guide/api/node/type-aliases/cameraclampingovershootmode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/captionhorizontalalignment.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/captionverticalalignment.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/cmyk.md +23 -0
- package/assets/docs/guide/api/node/type-aliases/color.md +23 -0
- package/assets/docs/guide/api/node/type-aliases/colorpickercolormode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/colorpropertyname.md +31 -0
- package/assets/docs/guide/api/node/type-aliases/colorspace.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/contentfillmode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/controlgizmomovehandlevisibility.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/controlgizmoresizehandlesvisibility.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/controlgizmorotatehandlesvisibility.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/controlgizmoscalehandlesvisibility.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/createsceneoptions.md +30 -0
- package/assets/docs/guide/api/node/type-aliases/cutoutoperation.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/cutouttype.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/defaultassetsourceid.md +37 -0
- package/assets/docs/guide/api/node/type-aliases/demoassetsourceid.md +33 -0
- package/assets/docs/guide/api/node/type-aliases/designblockid.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/designblocktype.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/designblocktypelonghand.md +21 -0
- package/assets/docs/guide/api/node/type-aliases/designblocktypeshorthand.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/designunit.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/doubleclickselectionmode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/doublepropertyname.md +26 -0
- package/assets/docs/guide/api/node/type-aliases/dropshadowoptions.md +32 -0
- package/assets/docs/guide/api/node/type-aliases/editmode.md +27 -0
- package/assets/docs/guide/api/node/type-aliases/effecttype.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/effecttypelonghand.md +21 -0
- package/assets/docs/guide/api/node/type-aliases/effecttypeshorthand.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/engineactionid.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/enginecustomactionfunction.md +30 -0
- package/assets/docs/guide/api/node/type-aliases/engineplugincontext.md +30 -0
- package/assets/docs/guide/api/node/type-aliases/enumpropertyname.md +59 -0
- package/assets/docs/guide/api/node/type-aliases/enumvalues.md +59 -0
- package/assets/docs/guide/api/node/type-aliases/exportoptions.md +57 -0
- package/assets/docs/guide/api/node/type-aliases/fillpixelstreamorientation.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/filltype.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/filltypelonghand.md +21 -0
- package/assets/docs/guide/api/node/type-aliases/filltypeshorthand.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/floatpropertyname.md +184 -0
- package/assets/docs/guide/api/node/type-aliases/fontsizeunit.md +23 -0
- package/assets/docs/guide/api/node/type-aliases/fontstyle.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/fontweight.md +30 -0
- package/assets/docs/guide/api/node/type-aliases/gradientstoprgba.md +23 -0
- package/assets/docs/guide/api/node/type-aliases/heightmode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/hexcolorstring.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/historyid.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/historyupdate.md +25 -0
- package/assets/docs/guide/api/node/type-aliases/horizontalblockalignment.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/horizontalcontentfillalignment.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/horizontaltextalignment.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/imagemimetype.md +25 -0
- package/assets/docs/guide/api/node/type-aliases/intpropertyname.md +26 -0
- package/assets/docs/guide/api/node/type-aliases/liststyle.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/locale.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/loglevel.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/mimetype.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/objecttype.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/objecttypelonghand.md +27 -0
- package/assets/docs/guide/api/node/type-aliases/objecttypeshorthand.md +27 -0
- package/assets/docs/guide/api/node/type-aliases/optionalprefix.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/pageguidessource.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/palettecolor.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/positionmode.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/positionxmode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/positionymode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/propertytype.md +31 -0
- package/assets/docs/guide/api/node/type-aliases/rgba.md +23 -0
- package/assets/docs/guide/api/node/type-aliases/rolestring.md +23 -0
- package/assets/docs/guide/api/node/type-aliases/scenefontsizeunit.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/scenelayout.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/scenemode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/scope.md +50 -0
- package/assets/docs/guide/api/node/type-aliases/settingboolpropertyname.md +62 -0
- package/assets/docs/guide/api/node/type-aliases/settingcolorpropertyname.md +38 -0
- package/assets/docs/guide/api/node/type-aliases/settingenumpropertyname.md +29 -0
- package/assets/docs/guide/api/node/type-aliases/settingenumtype.md +33 -0
- package/assets/docs/guide/api/node/type-aliases/settingenumvalues.md +29 -0
- package/assets/docs/guide/api/node/type-aliases/settingfloatpropertyname.md +25 -0
- package/assets/docs/guide/api/node/type-aliases/settingintpropertyname.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/settingkey.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/settingsbool.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/settingscolor.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/settingscolorrgba.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/settingsenum.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/settingsfloat.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/settingsint.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/settingsstring.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/settingstringpropertyname.md +28 -0
- package/assets/docs/guide/api/node/type-aliases/settingtype.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/settingvaluetype.md +26 -0
- package/assets/docs/guide/api/node/type-aliases/shapetype.md +24 -0
- package/assets/docs/guide/api/node/type-aliases/shapetypelonghand.md +21 -0
- package/assets/docs/guide/api/node/type-aliases/shapetypeshorthand.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/shapevectorpathfillrule.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/sizemode.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/sortingorder.md +21 -0
- package/assets/docs/guide/api/node/type-aliases/sourcesetpropertyname.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/splitoptions.md +28 -0
- package/assets/docs/guide/api/node/type-aliases/stringpropertyname.md +43 -0
- package/assets/docs/guide/api/node/type-aliases/strokecap.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/strokecornergeometry.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/strokedashendcap.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/strokedashstartcap.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/strokeendcap.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/strokeposition.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/strokestartcap.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/strokestyle.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/syncuriresolver.md +31 -0
- package/assets/docs/guide/api/node/type-aliases/textanimationwritingstyle.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/textcase.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/textdecorationline.md +27 -0
- package/assets/docs/guide/api/node/type-aliases/textdecorationstyle.md +26 -0
- package/assets/docs/guide/api/node/type-aliases/textverticalalignment.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/timelinetrackvisibility.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/touchpinchaction.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/touchrotateaction.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/typefacedefinition.md +41 -0
- package/assets/docs/guide/api/node/type-aliases/verticalblockalignment.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/verticalcontentfillalignment.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/videoexportoptions.md +54 -0
- package/assets/docs/guide/api/node/type-aliases/videomimetype.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/widthmode.md +18 -0
- package/assets/docs/guide/api/node/type-aliases/xywh.md +23 -0
- package/assets/docs/guide/api/node/type-aliases/zoomautofitaxis.md +20 -0
- package/assets/docs/guide/api/node/type-aliases/zoomoptions.md +27 -0
- package/assets/docs/guide/api/node/variables/animation_types.md +21 -0
- package/assets/docs/guide/api/node/variables/animationbaselinedirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationblockswipetextdirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationeasingvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationgrowdirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationjumploopdirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationkenburnsdirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationmergetextdirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationspindirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationspinloopdirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationtypewritertextwritingstylevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/animationwipedirectionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/blendmodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/blur_types.md +21 -0
- package/assets/docs/guide/api/node/variables/cameraclampingovershootmodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/captionhorizontalalignmentvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/captionverticalalignmentvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/colorpickercolormodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/contentfillmodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/controlgizmomovehandlevisibilityvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/controlgizmoresizehandlesvisibilityvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/controlgizmorotatehandlesvisibilityvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/controlgizmoscalehandlesvisibilityvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/cutouttypevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/design_block_types.md +21 -0
- package/assets/docs/guide/api/node/variables/doubleclickselectionmodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/effect_types.md +21 -0
- package/assets/docs/guide/api/node/variables/fill_types.md +21 -0
- package/assets/docs/guide/api/node/variables/fillpixelstreamorientationvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/heightmodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/horizontalcontentfillalignmentvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/loglevel.md +37 -0
- package/assets/docs/guide/api/node/variables/mimetype.md +41 -0
- package/assets/docs/guide/api/node/variables/pageguidessourcevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/positionxmodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/positionymodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/scenedesignunitvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/scenefontsizeunitvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/scenelayoutvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/scenemodevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/shape_types.md +21 -0
- package/assets/docs/guide/api/node/variables/shapevectorpathfillrulevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/strokecapvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/strokecornergeometryvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/strokedashendcapvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/strokedashstartcapvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/strokeendcapvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/strokepositionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/strokestartcapvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/strokestylevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/textanimationwritingstylevalues.md +18 -0
- package/assets/docs/guide/api/node/variables/texthorizontalalignmentvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/textverticalalignmentvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/timelinetrackvisibilityvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/touchpinchactionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/touchrotateactionvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/verticalcontentfillalignmentvalues.md +18 -0
- package/assets/docs/guide/api/node/variables/widthmodevalues.md +18 -0
- package/assets/docs/guide/api/types.md +5 -9
- package/assets/docs/guide/api-reference/overview.md +7 -7
- package/assets/docs/guide/automation/auto-resize.md +263 -300
- package/assets/docs/guide/automation/data-merge.md +246 -275
- package/assets/docs/guide/automation/design-generation.md +102 -31
- package/assets/docs/guide/automation/multi-image-generation.md +758 -0
- package/assets/docs/guide/automation/overview.md +21 -4
- package/assets/docs/guide/automation.md +10 -5
- package/assets/docs/guide/capabilities.md +6 -4
- package/assets/docs/guide/colors/adjust.md +247 -249
- package/assets/docs/guide/colors/apply.md +127 -138
- package/assets/docs/guide/colors/basics.md +126 -150
- package/assets/docs/guide/colors/conversion.md +171 -177
- package/assets/docs/guide/colors/create-color-palette.md +244 -245
- package/assets/docs/guide/colors/extract-colors.md +144 -0
- package/assets/docs/guide/colors/for-print/cmyk.md +292 -352
- package/assets/docs/guide/colors/for-print/spot.md +521 -578
- package/assets/docs/guide/colors/for-print.md +9 -4
- package/assets/docs/guide/colors/for-screen/p3.md +12 -10
- package/assets/docs/guide/colors/for-screen/srgb.md +107 -133
- package/assets/docs/guide/colors/for-screen.md +9 -4
- package/assets/docs/guide/colors/overview.md +6 -4
- package/assets/docs/guide/colors/replace.md +381 -419
- package/assets/docs/guide/colors.md +9 -4
- package/assets/docs/guide/compatibility.md +7 -5
- package/assets/docs/guide/concepts/architecture.md +17 -15
- package/assets/docs/guide/concepts/assets.md +152 -140
- package/assets/docs/guide/concepts/blocks.md +227 -323
- package/assets/docs/guide/concepts/buffers.md +147 -276
- package/assets/docs/guide/concepts/design-units.md +95 -145
- package/assets/docs/guide/concepts/editing-workflow.md +69 -183
- package/assets/docs/guide/concepts/events.md +80 -122
- package/assets/docs/guide/concepts/headless-mode.md +237 -0
- package/assets/docs/guide/concepts/pages.md +137 -127
- package/assets/docs/guide/concepts/resources.md +156 -217
- package/assets/docs/guide/concepts/scenes.md +191 -210
- package/assets/docs/guide/concepts/templating.md +118 -74
- package/assets/docs/guide/concepts/terminology.md +49 -47
- package/assets/docs/guide/concepts/undo-and-history.md +229 -303
- package/assets/docs/guide/concepts.md +9 -7
- package/assets/docs/guide/configuration.md +252 -380
- package/assets/docs/guide/conversion/overview.md +33 -4
- package/assets/docs/guide/conversion/to-base64.md +127 -167
- package/assets/docs/guide/conversion/to-pdf.md +24 -474
- package/assets/docs/guide/conversion/to-png.md +168 -211
- package/assets/docs/guide/conversion.md +9 -4
- package/assets/docs/guide/create-audio/audio/add-music.md +301 -327
- package/assets/docs/guide/create-audio/audio/add-sound-effects.md +475 -359
- package/assets/docs/guide/create-audio/audio/loop.md +232 -272
- package/assets/docs/guide/create-composition/add-background.md +237 -239
- package/assets/docs/guide/create-composition/blend-modes.md +118 -209
- package/assets/docs/guide/create-composition/collage.md +538 -320
- package/assets/docs/guide/create-composition/group-and-ungroup.md +216 -261
- package/assets/docs/guide/create-composition/layer-management.md +219 -257
- package/assets/docs/guide/create-composition/layout.md +513 -315
- package/assets/docs/guide/create-composition/lock-design.md +90 -109
- package/assets/docs/guide/create-composition/multi-page.md +133 -113
- package/assets/docs/guide/create-composition/overview.md +16 -4
- package/assets/docs/guide/create-composition/programmatic.md +288 -344
- package/assets/docs/guide/create-composition.md +10 -5
- package/assets/docs/guide/create-templates/add-dynamic-content/placeholders.md +443 -569
- package/assets/docs/guide/create-templates/add-dynamic-content/set-editing-constraints.md +567 -470
- package/assets/docs/guide/create-templates/add-dynamic-content/text-variables.md +179 -516
- package/assets/docs/guide/create-templates/add-dynamic-content.md +226 -224
- package/assets/docs/guide/create-templates/add-to-template-library.md +183 -193
- package/assets/docs/guide/create-templates/edit-or-remove.md +297 -303
- package/assets/docs/guide/create-templates/from-scratch.md +207 -268
- package/assets/docs/guide/create-templates/import/from-scene-file.md +158 -236
- package/assets/docs/guide/create-templates/import.md +145 -161
- package/assets/docs/guide/create-templates/lock.md +42 -295
- package/assets/docs/guide/create-templates/overview.md +33 -4
- package/assets/docs/guide/create-templates.md +9 -5
- package/assets/docs/guide/create-video/audio/adjust-speed.md +157 -207
- package/assets/docs/guide/create-video/audio/adjust-volume.md +116 -227
- package/assets/docs/guide/create-video/control.md +352 -193
- package/assets/docs/guide/create-video/limitations.md +175 -280
- package/assets/docs/guide/create-video.md +11 -10
- package/assets/docs/guide/edit-image/add-watermark.md +283 -330
- package/assets/docs/guide/edit-image/overview.md +29 -4
- package/assets/docs/guide/edit-image/remove-bg.md +283 -337
- package/assets/docs/guide/edit-image/replace-colors.md +424 -502
- package/assets/docs/guide/edit-image/transform/crop.md +463 -402
- package/assets/docs/guide/edit-image/transform/flip.md +353 -0
- package/assets/docs/guide/edit-image/transform/move.md +143 -100
- package/assets/docs/guide/edit-image/transform/resize.md +118 -88
- package/assets/docs/guide/edit-image/transform/rotate.md +132 -165
- package/assets/docs/guide/edit-image/transform/scale.md +230 -228
- package/assets/docs/guide/edit-image/transform.md +10 -5
- package/assets/docs/guide/edit-image.md +11 -7
- package/assets/docs/guide/edit-video/add-captions.md +344 -421
- package/assets/docs/guide/edit-video/add-watermark.md +312 -258
- package/assets/docs/guide/edit-video/join-and-arrange.md +237 -371
- package/assets/docs/guide/edit-video/redaction.md +419 -385
- package/assets/docs/guide/edit-video/split.md +243 -493
- package/assets/docs/guide/edit-video/transform/crop.md +21 -352
- package/assets/docs/guide/edit-video/transform/flip.md +102 -76
- package/assets/docs/guide/edit-video/transform/move.md +258 -310
- package/assets/docs/guide/edit-video/transform/resize.md +264 -428
- package/assets/docs/guide/edit-video/transform/rotate.md +265 -228
- package/assets/docs/guide/edit-video/transform/scale.md +320 -417
- package/assets/docs/guide/edit-video/transform.md +10 -6
- package/assets/docs/guide/edit-video/trim.md +448 -494
- package/assets/docs/guide/engine-interface.md +51 -62
- package/assets/docs/guide/export-save-publish/create-thumbnail.md +148 -184
- package/assets/docs/guide/export-save-publish/export/compress.md +161 -559
- package/assets/docs/guide/export-save-publish/export/overview.md +224 -373
- package/assets/docs/guide/export-save-publish/export/partial-export.md +386 -577
- package/assets/docs/guide/export-save-publish/export/size-limits.md +215 -310
- package/assets/docs/guide/export-save-publish/export/to-jpeg.md +132 -213
- package/assets/docs/guide/export-save-publish/export/to-pdf.md +139 -267
- package/assets/docs/guide/export-save-publish/export/to-png.md +121 -165
- package/assets/docs/guide/export-save-publish/export/to-raw-data.md +187 -234
- package/assets/docs/guide/export-save-publish/export/to-webp.md +160 -190
- package/assets/docs/guide/export-save-publish/export/with-color-mask.md +359 -203
- package/assets/docs/guide/export-save-publish/export.md +14 -11
- package/assets/docs/guide/export-save-publish/for-printing.md +141 -237
- package/assets/docs/guide/export-save-publish/for-social-media.md +124 -261
- package/assets/docs/guide/export-save-publish/pre-export-validation.md +436 -522
- package/assets/docs/guide/export-save-publish/save.md +167 -226
- package/assets/docs/guide/export-save-publish/store-custom-metadata.md +97 -162
- package/assets/docs/guide/file-format-support.md +9 -9
- package/assets/docs/guide/fills/color.md +370 -347
- package/assets/docs/guide/fills/image.md +167 -196
- package/assets/docs/guide/fills/overview.md +6 -4
- package/assets/docs/guide/fills/video.md +286 -438
- package/assets/docs/guide/fills.md +12 -8
- package/assets/docs/guide/filters-and-effects/apply.md +598 -664
- package/assets/docs/guide/filters-and-effects/blur.md +261 -159
- package/assets/docs/guide/filters-and-effects/chroma-key-green-screen.md +194 -293
- package/assets/docs/guide/filters-and-effects/create-custom-filters.md +548 -466
- package/assets/docs/guide/filters-and-effects/create-custom-lut-filter.md +176 -244
- package/assets/docs/guide/filters-and-effects/distortion.md +317 -384
- package/assets/docs/guide/filters-and-effects/duotone.md +221 -217
- package/assets/docs/guide/filters-and-effects/gradients.md +670 -813
- package/assets/docs/guide/filters-and-effects/overview.md +7 -7
- package/assets/docs/guide/filters-and-effects/support.md +97 -132
- package/assets/docs/guide/filters-and-effects.md +11 -6
- package/assets/docs/guide/get-started/agent-skills.md +20 -18
- package/assets/docs/guide/get-started/build-with-ai.md +7 -4
- package/assets/docs/guide/get-started/bun.md +219 -0
- package/assets/docs/guide/get-started/deno.md +161 -0
- package/assets/docs/guide/get-started/mcp-server.md +6 -4
- package/assets/docs/guide/get-started/overview.md +11 -6
- package/assets/docs/guide/get-started/vanilla-aws-lambda.md +506 -0
- package/assets/docs/guide/get-started/vanilla-clone-github-project.md +124 -0
- package/assets/docs/guide/get-started/vanilla.md +235 -0
- package/assets/docs/guide/guides/export-save-publish/export/audio.md +80 -66
- package/assets/docs/guide/guides.md +10 -9
- package/assets/docs/guide/import-media/asset-panel/refresh-assets.md +259 -288
- package/assets/docs/guide/import-media/concepts.md +20 -38
- package/assets/docs/guide/import-media/content-json-schema.md +145 -125
- package/assets/docs/guide/import-media/default-assets.md +113 -161
- package/assets/docs/guide/import-media/edit-or-remove-assets.md +391 -395
- package/assets/docs/guide/import-media/file-format-support.md +78 -61
- package/assets/docs/guide/import-media/from-remote-source/asset-versioning.md +273 -244
- package/assets/docs/guide/import-media/from-remote-source/remote-asset.md +152 -222
- package/assets/docs/guide/import-media/from-remote-source.md +9 -11
- package/assets/docs/guide/import-media/overview.md +5 -5
- package/assets/docs/guide/import-media/retrieve-mimetype.md +216 -108
- package/assets/docs/guide/import-media/size-limits.md +6 -4
- package/assets/docs/guide/import-media/source-sets.md +190 -251
- package/assets/docs/guide/import-media.md +10 -8
- package/assets/docs/guide/insert-media/audio.md +202 -195
- package/assets/docs/guide/insert-media/images.md +190 -188
- package/assets/docs/guide/insert-media/position-and-align.md +284 -551
- package/assets/docs/guide/insert-media/shapes-or-stickers.md +402 -418
- package/assets/docs/guide/insert-media/videos.md +236 -203
- package/assets/docs/guide/insert-media.md +10 -5
- package/assets/docs/guide/key-capabilities.md +36 -4
- package/assets/docs/guide/key-concepts.md +6 -4
- package/assets/docs/guide/licensing.md +6 -4
- package/assets/docs/guide/llms-txt.md +11 -7
- package/assets/docs/guide/open-the-editor/blank-canvas.md +102 -63
- package/assets/docs/guide/open-the-editor/from-image.md +157 -127
- package/assets/docs/guide/open-the-editor/from-template.md +131 -92
- package/assets/docs/guide/open-the-editor/from-video.md +204 -212
- package/assets/docs/guide/open-the-editor/import-design/from-archive.md +310 -360
- package/assets/docs/guide/open-the-editor/import-design/from-indesign.md +716 -513
- package/assets/docs/guide/open-the-editor/import-design/from-photoshop.md +667 -695
- package/assets/docs/guide/open-the-editor/import-design.md +228 -266
- package/assets/docs/guide/open-the-editor/load-scene.md +72 -68
- package/assets/docs/guide/open-the-editor/overview.md +6 -4
- package/assets/docs/guide/open-the-editor/uri-resolver.md +160 -251
- package/assets/docs/guide/open-the-editor.md +11 -9
- package/assets/docs/guide/outlines/overview.md +12 -4
- package/assets/docs/guide/outlines/shadows-and-glows.md +105 -410
- package/assets/docs/guide/outlines/strokes.md +218 -166
- package/assets/docs/guide/outlines.md +9 -4
- package/assets/docs/guide/overview.md +14 -6
- package/assets/docs/guide/performance.md +220 -113
- package/assets/docs/guide/plugins/print-ready-pdf.md +273 -368
- package/assets/docs/guide/plugins.md +10 -16
- package/assets/docs/guide/rules/asset-handling.md +7 -18
- package/assets/docs/guide/rules/common-pitfalls.md +25 -42
- package/assets/docs/guide/rules/content-fill-mode.md +4 -4
- package/assets/docs/guide/rules/enforce-brand-guidelines.md +398 -567
- package/assets/docs/guide/rules/lock-content.md +188 -231
- package/assets/docs/guide/rules/moderate-content.md +580 -571
- package/assets/docs/guide/rules/overview.md +345 -380
- package/assets/docs/guide/rules/silent-init-errors.md +4 -1
- package/assets/docs/guide/rules/verify-properties-before-use.md +2 -11
- package/assets/docs/guide/rules.md +10 -5
- package/assets/docs/guide/security.md +7 -5
- package/assets/docs/guide/serve-assets.md +57 -284
- package/assets/docs/guide/settings.md +96 -74
- package/assets/docs/guide/shapes.md +10 -5
- package/assets/docs/guide/stickers-and-shapes/combine.md +397 -583
- package/assets/docs/guide/stickers-and-shapes/create-cutout.md +181 -268
- package/assets/docs/guide/stickers-and-shapes/create-edit/create-shapes.md +418 -431
- package/assets/docs/guide/stickers-and-shapes/create-edit/create-stickers.md +147 -226
- package/assets/docs/guide/stickers-and-shapes/create-edit/edit-shapes.md +138 -123
- package/assets/docs/guide/stickers-and-shapes/insert-qr-code.md +151 -149
- package/assets/docs/guide/stickers.md +9 -4
- package/assets/docs/guide/text/add.md +470 -482
- package/assets/docs/guide/text/adjust-spacing.md +179 -214
- package/assets/docs/guide/text/auto-size.md +210 -271
- package/assets/docs/guide/text/edit.md +294 -309
- package/assets/docs/guide/text/effects.md +154 -190
- package/assets/docs/guide/text/emojis.md +199 -232
- package/assets/docs/guide/text/language-support.md +369 -382
- package/assets/docs/guide/text/overview.md +41 -4
- package/assets/docs/guide/text/styling.md +239 -273
- package/assets/docs/guide/text/text-designs.md +405 -544
- package/assets/docs/guide/text.md +10 -9
- package/assets/docs/guide/to-v1-19.md +12 -10
- package/assets/docs/guide/upgrade.md +8 -9
- package/assets/docs/guide/use-templates/apply-template.md +174 -163
- package/assets/docs/guide/use-templates/generate.md +171 -152
- package/assets/docs/guide/use-templates/overview.md +32 -4
- package/assets/docs/guide/use-templates/programmatic.md +266 -301
- package/assets/docs/guide/use-templates/replace-content.md +181 -171
- package/assets/docs/guide/what-is-cesdk.md +71 -282
- package/assets/docs/handbook/SKILL.md +24 -0
- package/dist/assets/inline.generated.d.ts.map +1 -1
- package/dist/assets/inline.generated.js +544 -406
- package/dist/assets/inline.generated.js.map +1 -1
- package/dist/assets/load-browser.d.ts +1 -1
- package/dist/assets/load-browser.js +1 -1
- package/dist/assets/load-browser.js.map +1 -1
- package/dist/assets/load-node.d.ts +1 -1
- package/dist/assets/load-node.js +1 -1
- package/dist/assets/load-node.js.map +1 -1
- package/dist/cli/http.d.ts.map +1 -1
- package/dist/cli/http.js +4 -28
- package/dist/cli/http.js.map +1 -1
- package/dist/cli/redirect-console.d.ts +1 -1
- package/dist/cli/redirect-console.d.ts.map +1 -1
- package/dist/cli/redirect-console.js +12 -3
- package/dist/cli/redirect-console.js.map +1 -1
- package/dist/cli/resolve-license.d.ts.map +1 -1
- package/dist/cli/resolve-license.js +8 -6
- package/dist/cli/resolve-license.js.map +1 -1
- package/dist/cli/stdio.d.ts +9 -0
- package/dist/cli/stdio.d.ts.map +1 -1
- package/dist/cli/stdio.js +48 -4
- package/dist/cli/stdio.js.map +1 -1
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +11 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +20 -1
- package/dist/config.js.map +1 -1
- package/dist/diagnostics/bundle.d.ts +10 -0
- package/dist/diagnostics/bundle.d.ts.map +1 -0
- package/dist/diagnostics/bundle.js +148 -0
- package/dist/diagnostics/bundle.js.map +1 -0
- package/dist/diagnostics/compose.d.ts +3 -0
- package/dist/diagnostics/compose.d.ts.map +1 -0
- package/dist/diagnostics/compose.js +15 -0
- package/dist/diagnostics/compose.js.map +1 -0
- package/dist/diagnostics/events.d.ts +34 -0
- package/dist/diagnostics/events.d.ts.map +1 -0
- package/dist/diagnostics/events.js +3 -0
- package/dist/diagnostics/events.js.map +1 -0
- package/dist/diagnostics/file-sink.d.ts +38 -0
- package/dist/diagnostics/file-sink.d.ts.map +1 -0
- package/dist/diagnostics/file-sink.js +157 -0
- package/dist/diagnostics/file-sink.js.map +1 -0
- package/dist/diagnostics/redact.d.ts +7 -0
- package/dist/diagnostics/redact.d.ts.map +1 -0
- package/dist/diagnostics/redact.js +43 -0
- package/dist/diagnostics/redact.js.map +1 -0
- package/dist/diagnostics/tool-call-adapter.d.ts +4 -0
- package/dist/diagnostics/tool-call-adapter.d.ts.map +1 -0
- package/dist/diagnostics/tool-call-adapter.js +21 -0
- package/dist/diagnostics/tool-call-adapter.js.map +1 -0
- package/dist/engine/cesdk-adapter.d.ts +5 -1
- package/dist/engine/cesdk-adapter.d.ts.map +1 -1
- package/dist/engine/cesdk-adapter.js +9 -2
- package/dist/engine/cesdk-adapter.js.map +1 -1
- package/dist/engine/index.d.ts +1 -0
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +4 -0
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/scene-resource-schemes.d.ts +2 -0
- package/dist/engine/scene-resource-schemes.d.ts.map +1 -0
- package/dist/engine/scene-resource-schemes.js +20 -0
- package/dist/engine/scene-resource-schemes.js.map +1 -0
- package/dist/http/server.d.ts +0 -6
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +1 -2
- package/dist/http/server.js.map +1 -1
- package/dist/server.d.ts +0 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -60
- package/dist/server.js.map +1 -1
- package/dist/test/scripts/changelog-add.d.ts +8 -0
- package/dist/test/scripts/changelog-add.d.ts.map +1 -0
- package/dist/test/scripts/changelog-add.js +50 -0
- package/dist/test/scripts/changelog-add.js.map +1 -0
- package/dist/test/scripts/changelog-collate.d.ts +38 -0
- package/dist/test/scripts/changelog-collate.d.ts.map +1 -0
- package/dist/test/scripts/changelog-collate.js +171 -0
- package/dist/test/scripts/changelog-collate.js.map +1 -0
- package/dist/test/test/changelog.test.d.ts +2 -0
- package/dist/test/test/changelog.test.d.ts.map +1 -0
- package/dist/test/test/changelog.test.js +293 -0
- package/dist/test/test/changelog.test.js.map +1 -0
- package/dist/test/test/cli/dispatcher.test.js +10 -3
- package/dist/test/test/cli/dispatcher.test.js.map +1 -1
- package/dist/test/test/cli/redirect-console.test.js +31 -0
- package/dist/test/test/cli/redirect-console.test.js.map +1 -1
- package/dist/test/test/cli/resolve-license.test.js +10 -1
- package/dist/test/test/cli/resolve-license.test.js.map +1 -1
- package/dist/test/test/cli/stdio-diagnostics.test.d.ts +2 -0
- package/dist/test/test/cli/stdio-diagnostics.test.d.ts.map +1 -0
- package/dist/test/test/cli/stdio-diagnostics.test.js +31 -0
- package/dist/test/test/cli/stdio-diagnostics.test.js.map +1 -0
- package/dist/test/test/config.test.js +17 -13
- package/dist/test/test/config.test.js.map +1 -1
- package/dist/test/test/diagnostics/bundle.test.d.ts +2 -0
- package/dist/test/test/diagnostics/bundle.test.d.ts.map +1 -0
- package/dist/test/test/diagnostics/bundle.test.js +53 -0
- package/dist/test/test/diagnostics/bundle.test.js.map +1 -0
- package/dist/test/test/diagnostics/compose.test.d.ts +2 -0
- package/dist/test/test/diagnostics/compose.test.d.ts.map +1 -0
- package/dist/test/test/diagnostics/compose.test.js +31 -0
- package/dist/test/test/diagnostics/compose.test.js.map +1 -0
- package/dist/test/test/diagnostics/file-sink.test.d.ts +2 -0
- package/dist/test/test/diagnostics/file-sink.test.d.ts.map +1 -0
- package/dist/test/test/diagnostics/file-sink.test.js +113 -0
- package/dist/test/test/diagnostics/file-sink.test.js.map +1 -0
- package/dist/test/test/diagnostics/redact.test.d.ts +2 -0
- package/dist/test/test/diagnostics/redact.test.d.ts.map +1 -0
- package/dist/test/test/diagnostics/redact.test.js +59 -0
- package/dist/test/test/diagnostics/redact.test.js.map +1 -0
- package/dist/test/test/diagnostics/tool-call-adapter.test.d.ts +2 -0
- package/dist/test/test/diagnostics/tool-call-adapter.test.d.ts.map +1 -0
- package/dist/test/test/diagnostics/tool-call-adapter.test.js +34 -0
- package/dist/test/test/diagnostics/tool-call-adapter.test.js.map +1 -0
- package/dist/test/test/engine/cesdk-adapter.test.d.ts +2 -0
- package/dist/test/test/engine/cesdk-adapter.test.d.ts.map +1 -0
- package/dist/test/test/engine/cesdk-adapter.test.js +32 -0
- package/dist/test/test/engine/cesdk-adapter.test.js.map +1 -0
- package/dist/test/test/handbook-contract.test.js +6 -2
- package/dist/test/test/handbook-contract.test.js.map +1 -1
- package/dist/test/test/http/server.test.js +0 -36
- package/dist/test/test/http/server.test.js.map +1 -1
- package/dist/test/test/http/workspace-auth.test.js +0 -1
- package/dist/test/test/http/workspace-auth.test.js.map +1 -1
- package/dist/test/test/server.test.js +0 -40
- package/dist/test/test/server.test.js.map +1 -1
- package/dist/test/test/tools/edit-harness.d.ts +14 -0
- package/dist/test/test/tools/edit-harness.d.ts.map +1 -0
- package/dist/test/test/tools/edit-harness.js +30 -0
- package/dist/test/test/tools/edit-harness.js.map +1 -0
- package/dist/test/test/tools/edit.telemetry.test.d.ts +2 -0
- package/dist/test/test/tools/edit.telemetry.test.d.ts.map +1 -0
- package/dist/test/test/tools/edit.telemetry.test.js +46 -0
- package/dist/test/test/tools/edit.telemetry.test.js.map +1 -0
- package/dist/test/test/tools/export-harness.d.ts +13 -0
- package/dist/test/test/tools/export-harness.d.ts.map +1 -0
- package/dist/test/test/tools/export-harness.js +27 -0
- package/dist/test/test/tools/export-harness.js.map +1 -0
- package/dist/test/test/tools/export.telemetry.test.d.ts +2 -0
- package/dist/test/test/tools/export.telemetry.test.d.ts.map +1 -0
- package/dist/test/test/tools/export.telemetry.test.js +65 -0
- package/dist/test/test/tools/export.telemetry.test.js.map +1 -0
- package/dist/test/test/tools/import.test.d.ts +2 -0
- package/dist/test/test/tools/import.test.d.ts.map +1 -0
- package/dist/test/test/tools/import.test.js +122 -0
- package/dist/test/test/tools/import.test.js.map +1 -0
- package/dist/test/test/tools/index.test.js +78 -16
- package/dist/test/test/tools/index.test.js.map +1 -1
- package/dist/test/test/tools/load.integration.test.d.ts +2 -0
- package/dist/test/test/tools/load.integration.test.d.ts.map +1 -0
- package/dist/test/test/tools/load.integration.test.js +165 -0
- package/dist/test/test/tools/load.integration.test.js.map +1 -0
- package/dist/test/test/tools/load.test.d.ts +2 -0
- package/dist/test/test/tools/load.test.d.ts.map +1 -0
- package/dist/test/test/tools/load.test.js +387 -0
- package/dist/test/test/tools/load.test.js.map +1 -0
- package/dist/test/test/tools/preview-harness.d.ts +9 -0
- package/dist/test/test/tools/preview-harness.d.ts.map +1 -0
- package/dist/test/test/tools/preview-harness.js +23 -0
- package/dist/test/test/tools/preview-harness.js.map +1 -0
- package/dist/test/test/tools/preview.telemetry.test.d.ts +2 -0
- package/dist/test/test/tools/preview.telemetry.test.d.ts.map +1 -0
- package/dist/test/test/tools/preview.telemetry.test.js +36 -0
- package/dist/test/test/tools/preview.telemetry.test.js.map +1 -0
- package/dist/test/test/tools/schema-best-practices.d.ts +13 -0
- package/dist/test/test/tools/schema-best-practices.d.ts.map +1 -0
- package/dist/test/test/tools/schema-best-practices.js +169 -0
- package/dist/test/test/tools/schema-best-practices.js.map +1 -0
- package/dist/test/test/tools/schema-best-practices.test.d.ts +3 -0
- package/dist/test/test/tools/schema-best-practices.test.d.ts.map +1 -0
- package/dist/test/test/tools/schema-best-practices.test.js +194 -0
- package/dist/test/test/tools/schema-best-practices.test.js.map +1 -0
- package/dist/test/test/tools/spans.test.d.ts +2 -0
- package/dist/test/test/tools/spans.test.d.ts.map +1 -0
- package/dist/test/test/tools/spans.test.js +84 -0
- package/dist/test/test/tools/spans.test.js.map +1 -0
- package/dist/test/test/viewer/cesdk-cdn.test.d.ts +2 -0
- package/dist/test/test/viewer/cesdk-cdn.test.d.ts.map +1 -0
- package/dist/test/test/viewer/cesdk-cdn.test.js +19 -0
- package/dist/test/test/viewer/cesdk-cdn.test.js.map +1 -0
- package/dist/test/test/viewer/config-route.test.d.ts +2 -0
- package/dist/test/test/viewer/config-route.test.d.ts.map +1 -0
- package/dist/test/test/viewer/config-route.test.js +28 -0
- package/dist/test/test/viewer/config-route.test.js.map +1 -0
- package/dist/test/test/viewer/spa-version.test.d.ts +2 -0
- package/dist/test/test/viewer/spa-version.test.d.ts.map +1 -0
- package/dist/test/test/viewer/spa-version.test.js +14 -0
- package/dist/test/test/viewer/spa-version.test.js.map +1 -0
- package/dist/test/test/workspace/content-hash.test.d.ts +2 -0
- package/dist/test/test/workspace/content-hash.test.d.ts.map +1 -0
- package/dist/test/test/workspace/content-hash.test.js +17 -0
- package/dist/test/test/workspace/content-hash.test.js.map +1 -0
- package/dist/test/tsconfig.test.tsbuildinfo +1 -1
- package/dist/test/vitest.config.js +1 -1
- package/dist/test/vitest.config.js.map +1 -1
- package/dist/tools/asset-generate.d.ts.map +1 -1
- package/dist/tools/asset-generate.js +1 -8
- package/dist/tools/asset-generate.js.map +1 -1
- package/dist/tools/edit.d.ts +3 -0
- package/dist/tools/edit.d.ts.map +1 -1
- package/dist/tools/edit.js +145 -96
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/export.d.ts +3 -0
- package/dist/tools/export.d.ts.map +1 -1
- package/dist/tools/export.js +146 -108
- package/dist/tools/export.js.map +1 -1
- package/dist/tools/import.d.ts +12 -0
- package/dist/tools/import.d.ts.map +1 -0
- package/dist/tools/import.js +144 -0
- package/dist/tools/import.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +44 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/load.d.ts +26 -0
- package/dist/tools/load.d.ts.map +1 -0
- package/dist/tools/load.js +400 -0
- package/dist/tools/load.js.map +1 -0
- package/dist/tools/preview.d.ts +3 -0
- package/dist/tools/preview.d.ts.map +1 -1
- package/dist/tools/preview.js +79 -44
- package/dist/tools/preview.js.map +1 -1
- package/dist/tools/result.d.ts +1 -1
- package/dist/tools/result.js +2 -2
- package/dist/tools/result.js.map +1 -1
- package/dist/tools/spans.d.ts +45 -0
- package/dist/tools/spans.d.ts.map +1 -0
- package/dist/tools/spans.js +77 -0
- package/dist/tools/spans.js.map +1 -0
- package/dist/tools/telemetry-wrapper.d.ts +4 -0
- package/dist/tools/telemetry-wrapper.d.ts.map +1 -0
- package/dist/tools/telemetry-wrapper.js +43 -0
- package/dist/tools/telemetry-wrapper.js.map +1 -0
- package/dist/viewer/cesdk-cdn.d.ts +16 -0
- package/dist/viewer/cesdk-cdn.d.ts.map +1 -0
- package/dist/viewer/cesdk-cdn.js +30 -0
- package/dist/viewer/cesdk-cdn.js.map +1 -0
- package/dist/viewer/router.d.ts +6 -0
- package/dist/viewer/router.d.ts.map +1 -1
- package/dist/viewer/router.js +4 -1
- package/dist/viewer/router.js.map +1 -1
- package/dist/viewer/spa-assets.generated.d.ts.map +1 -1
- package/dist/viewer/spa-assets.generated.js +2 -3
- package/dist/viewer/spa-assets.generated.js.map +1 -1
- package/dist/workspace/content-hash.d.ts +2 -0
- package/dist/workspace/content-hash.d.ts.map +1 -0
- package/dist/workspace/content-hash.js +15 -0
- package/dist/workspace/content-hash.js.map +1 -0
- package/package.json +18 -9
- package/assets/docs/guide/actions.md +0 -1038
- package/assets/docs/guide/animation/overview.md +0 -22
- package/assets/docs/guide/automation/batch-processing.md +0 -474
- package/assets/docs/guide/browser-support.md +0 -38
- package/assets/docs/guide/concepts/edit-modes.md +0 -431
- package/assets/docs/guide/concepts/headless-mode/browser.md +0 -291
- package/assets/docs/guide/create-audio/audio.md +0 -336
- package/assets/docs/guide/create-video/overview.md +0 -224
- package/assets/docs/guide/create-video/timeline-editor.md +0 -622
- package/assets/docs/guide/create-video/update-caption-presets.md +0 -676
- package/assets/docs/guide/edit-image/vectorize.md +0 -204
- package/assets/docs/guide/export-save-publish/export/to-html5.md +0 -474
- package/assets/docs/guide/export-save-publish/export/to-mp4.md +0 -364
- package/assets/docs/guide/get-started/vanilla-js/quickstart.md +0 -175
- package/assets/docs/guide/grid-and-rulers.md +0 -222
- package/assets/docs/guide/guides/text/rendering-internals.md +0 -796
- package/assets/docs/guide/import-media/asset-library.md +0 -23
- package/assets/docs/guide/import-media/asset-panel/basics.md +0 -324
- package/assets/docs/guide/import-media/asset-panel/customize.md +0 -478
- package/assets/docs/guide/import-media/asset-panel/thumbnails.md +0 -633
- package/assets/docs/guide/import-media/capture-from-camera/record-video.md +0 -137
- package/assets/docs/guide/import-media/capture-from-camera.md +0 -20
- package/assets/docs/guide/import-media/from-local-source/user-upload.md +0 -438
- package/assets/docs/guide/import-media/from-local-source.md +0 -20
- package/assets/docs/guide/import-media/from-remote-source/getty-images.md +0 -627
- package/assets/docs/guide/import-media/from-remote-source/imgly-premium-assets.md +0 -625
- package/assets/docs/guide/import-media/from-remote-source/pexels.md +0 -692
- package/assets/docs/guide/import-media/from-remote-source/soundstripe.md +0 -497
- package/assets/docs/guide/import-media/from-remote-source/third-party.md +0 -51
- package/assets/docs/guide/import-media/from-remote-source/unsplash.md +0 -914
- package/assets/docs/guide/import-media/from-remote-source/your-server.md +0 -764
- package/assets/docs/guide/open-the-editor/from-htmlcanvas.md +0 -228
- package/assets/docs/guide/open-the-editor/set-zoom-level.md +0 -303
- package/assets/docs/guide/plugins/asset-sources.md +0 -553
- package/assets/docs/guide/starterkits/3d-mockup-editor.md +0 -748
- package/assets/docs/guide/starterkits/advanced-editor.md +0 -698
- package/assets/docs/guide/starterkits/advanced-video-editor.md +0 -696
- package/assets/docs/guide/starterkits/ai-editor.md +0 -749
- package/assets/docs/guide/starterkits/airtable-image-editor.md +0 -672
- package/assets/docs/guide/starterkits/apparel-ui.md +0 -188
- package/assets/docs/guide/starterkits/assets.md +0 -27
- package/assets/docs/guide/starterkits/auto-resize.md +0 -586
- package/assets/docs/guide/starterkits/automated-video-generation.md +0 -692
- package/assets/docs/guide/starterkits/background-removal-editor.md +0 -480
- package/assets/docs/guide/starterkits/content-moderation.md +0 -863
- package/assets/docs/guide/starterkits/creative-automation.md +0 -28
- package/assets/docs/guide/starterkits/custom-built-uis.md +0 -26
- package/assets/docs/guide/starterkits/customization.md +0 -29
- package/assets/docs/guide/starterkits/cutout-lines-editor.md +0 -470
- package/assets/docs/guide/starterkits/data-merge.md +0 -850
- package/assets/docs/guide/starterkits/design-editor.md +0 -698
- package/assets/docs/guide/starterkits/design-generation.md +0 -719
- package/assets/docs/guide/starterkits/design-validation.md +0 -808
- package/assets/docs/guide/starterkits/editor-ui-configurations.md +0 -14
- package/assets/docs/guide/starterkits/export-options.md +0 -724
- package/assets/docs/guide/starterkits/export-using-renderer.md +0 -708
- package/assets/docs/guide/starterkits/extensibility.md +0 -28
- package/assets/docs/guide/starterkits/force-crop-editor.md +0 -675
- package/assets/docs/guide/starterkits/form-based-template-adoption.md +0 -522
- package/assets/docs/guide/starterkits/getty-images-editor.md +0 -700
- package/assets/docs/guide/starterkits/html5-ads-exporter.md +0 -719
- package/assets/docs/guide/starterkits/indesign-template-import.md +0 -580
- package/assets/docs/guide/starterkits/layouts-editor.md +0 -724
- package/assets/docs/guide/starterkits/mobile-ui.md +0 -185
- package/assets/docs/guide/starterkits/mockup-editor.md +0 -745
- package/assets/docs/guide/starterkits/multi-image-generation.md +0 -542
- package/assets/docs/guide/starterkits/page-sizes-editor.md +0 -657
- package/assets/docs/guide/starterkits/pexels-image-editor.md +0 -665
- package/assets/docs/guide/starterkits/photo-editor.md +0 -755
- package/assets/docs/guide/starterkits/photo-ui.md +0 -186
- package/assets/docs/guide/starterkits/photobook-ui.md +0 -188
- package/assets/docs/guide/starterkits/placeholders.md +0 -678
- package/assets/docs/guide/starterkits/player.md +0 -405
- package/assets/docs/guide/starterkits/plugins.md +0 -25
- package/assets/docs/guide/starterkits/postcard-editor.md +0 -202
- package/assets/docs/guide/starterkits/pptx-template-import.md +0 -581
- package/assets/docs/guide/starterkits/print-ready-pdf-editor.md +0 -746
- package/assets/docs/guide/starterkits/product-editor.md +0 -773
- package/assets/docs/guide/starterkits/psd-template-import.md +0 -580
- package/assets/docs/guide/starterkits/qr-code-editor.md +0 -470
- package/assets/docs/guide/starterkits/single-page-editor.md +0 -661
- package/assets/docs/guide/starterkits/start-with-image.md +0 -684
- package/assets/docs/guide/starterkits/start-with-video.md +0 -651
- package/assets/docs/guide/starterkits/t-shirt-designer.md +0 -742
- package/assets/docs/guide/starterkits/templating.md +0 -23
- package/assets/docs/guide/starterkits/theming.md +0 -662
- package/assets/docs/guide/starterkits/translation-internationalization.md +0 -662
- package/assets/docs/guide/starterkits/unsplash-editor.md +0 -839
- package/assets/docs/guide/starterkits/vectorizer-editor.md +0 -466
- package/assets/docs/guide/starterkits/version-history.md +0 -745
- package/assets/docs/guide/starterkits/video-animations.md +0 -853
- package/assets/docs/guide/starterkits/video-captions.md +0 -884
- package/assets/docs/guide/starterkits/video-editing.md +0 -25
- package/assets/docs/guide/starterkits/video-editor.md +0 -696
- package/assets/docs/guide/starterkits/video-export-options.md +0 -676
- package/assets/docs/guide/starterkits/viewer.md +0 -400
- package/assets/docs/guide/starterkits.md +0 -41
- package/assets/docs/guide/stickers-and-shapes/create-edit/vector-edit.md +0 -362
- package/assets/docs/guide/text/custom-fonts.md +0 -401
- package/assets/docs/guide/text/decorations.md +0 -330
- package/assets/docs/guide/text/enumerations.md +0 -258
- package/assets/docs/guide/to-v1-10.md +0 -131
- package/assets/docs/guide/to-v1-13.md +0 -165
- package/assets/docs/guide/to-v1-32.md +0 -110
- package/assets/docs/guide/to-v1-69.md +0 -468
- package/assets/docs/guide/to-v1-72.md +0 -193
- package/assets/docs/guide/use-templates/library.md +0 -450
- package/assets/docs/guide/user-interface/ai-integration/audio-generation.md +0 -428
- package/assets/docs/guide/user-interface/ai-integration/auto-captions.md +0 -337
- package/assets/docs/guide/user-interface/ai-integration/custom-provider.md +0 -853
- package/assets/docs/guide/user-interface/ai-integration/gateway-provider.md +0 -1045
- package/assets/docs/guide/user-interface/ai-integration/image-generation.md +0 -641
- package/assets/docs/guide/user-interface/ai-integration/integrate.md +0 -966
- package/assets/docs/guide/user-interface/ai-integration/proxy-server.md +0 -99
- package/assets/docs/guide/user-interface/ai-integration/text-generation.md +0 -498
- package/assets/docs/guide/user-interface/ai-integration/video-generation.md +0 -493
- package/assets/docs/guide/user-interface/ai-integration.md +0 -30
- package/assets/docs/guide/user-interface/appearance/change-ui-font.md +0 -316
- package/assets/docs/guide/user-interface/appearance/custom-labels.md +0 -509
- package/assets/docs/guide/user-interface/appearance/icons.md +0 -373
- package/assets/docs/guide/user-interface/appearance/theming.md +0 -665
- package/assets/docs/guide/user-interface/appearance.md +0 -23
- package/assets/docs/guide/user-interface/build-your-own-ui.md +0 -620
- package/assets/docs/guide/user-interface/customization/canvas-menu.md +0 -412
- package/assets/docs/guide/user-interface/customization/canvas.md +0 -281
- package/assets/docs/guide/user-interface/customization/color-palette.md +0 -413
- package/assets/docs/guide/user-interface/customization/crop-presets.md +0 -384
- package/assets/docs/guide/user-interface/customization/disable-or-enable.md +0 -676
- package/assets/docs/guide/user-interface/customization/dock.md +0 -399
- package/assets/docs/guide/user-interface/customization/force-crop.md +0 -289
- package/assets/docs/guide/user-interface/customization/inspector-bar.md +0 -371
- package/assets/docs/guide/user-interface/customization/navigation-bar.md +0 -516
- package/assets/docs/guide/user-interface/customization/page-format.md +0 -436
- package/assets/docs/guide/user-interface/customization/panel.md +0 -605
- package/assets/docs/guide/user-interface/customization/quick-start/add-action-buttons.md +0 -531
- package/assets/docs/guide/user-interface/customization/quick-start/add-dock-buttons.md +0 -358
- package/assets/docs/guide/user-interface/customization/quick-start/create-custom-components.md +0 -374
- package/assets/docs/guide/user-interface/customization/quick-start/reorder-components.md +0 -323
- package/assets/docs/guide/user-interface/customization/quick-start/show-hide-components.md +0 -294
- package/assets/docs/guide/user-interface/customization/quick-start.md +0 -12
- package/assets/docs/guide/user-interface/customization/reference/component-order-api.md +0 -519
- package/assets/docs/guide/user-interface/customization/reference/component-reference.md +0 -333
- package/assets/docs/guide/user-interface/customization/reference.md +0 -12
- package/assets/docs/guide/user-interface/customization.md +0 -39
- package/assets/docs/guide/user-interface/localization.md +0 -633
- package/assets/docs/guide/user-interface/overview.md +0 -167
- package/assets/docs/guide/user-interface/ui-extensions/add-custom-feature.md +0 -411
- package/assets/docs/guide/user-interface/ui-extensions/asset-library.md +0 -721
- package/assets/docs/guide/user-interface/ui-extensions/create-custom-panel.md +0 -331
- package/assets/docs/guide/user-interface/ui-extensions/customize-behaviour.md +0 -553
- package/assets/docs/guide/user-interface/ui-extensions/notifications-and-dialogs.md +0 -672
- package/assets/docs/guide/user-interface/ui-extensions/quick-actions.md +0 -415
- package/assets/docs/guide/user-interface/ui-extensions/register-new-component.md +0 -521
- package/assets/docs/guide/user-interface/ui-extensions.md +0 -26
- package/assets/docs/guide/user-interface.md +0 -25
- package/assets/prompts/evals-assetGenerate.md +0 -12
- package/assets/prompts/evals-brutalistCore.md +0 -34
- package/assets/prompts/evals-danskCatalogue.md +0 -31
- package/assets/prompts/evals-exportRoundTrip.md +0 -12
- package/assets/prompts/evals-inspectPriorCode.md +0 -16
- package/assets/prompts/evals-listProjectFiles.md +0 -6
- package/assets/prompts/evals-readAndExplainScript.md +0 -6
- package/assets/prompts/evals-resumeAcrossRestart.md +0 -15
- package/assets/prompts/evals-rewindRecovery.md +0 -10
- package/assets/prompts/evals-searchAcrossFiles.md +0 -6
- package/assets/prompts/evals-weddingCard.md +0 -20
- package/assets/prompts/explain.md +0 -6
- package/assets/prompts/review.md +0 -6
- package/dist/frontmatter.d.ts +0 -15
- package/dist/frontmatter.d.ts.map +0 -1
- package/dist/frontmatter.js +0 -46
- package/dist/frontmatter.js.map +0 -1
- package/dist/test/test/frontmatter.test.d.ts +0 -2
- package/dist/test/test/frontmatter.test.d.ts.map +0 -1
- package/dist/test/test/frontmatter.test.js +0 -55
- package/dist/test/test/frontmatter.test.js.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// packages/codesign-mcp/src/diagnostics/redact.ts
|
|
2
|
+
//
|
|
3
|
+
// Executable form of .claude/rules/no-secrets.md. Two entry points: redactText
|
|
4
|
+
// for raw log lines (pattern scrub + home-path), redactValue for structured
|
|
5
|
+
// events (drop secret-named keys + recurse + pattern scrub every string).
|
|
6
|
+
// Both are pure and total; callers that persist/externalise apply them.
|
|
7
|
+
import { homedir } from 'node:os';
|
|
8
|
+
const REDACTED = '[REDACTED]';
|
|
9
|
+
/** Key names whose VALUE is always dropped, matched case-insensitively. */
|
|
10
|
+
export const SECRET_KEY_RE = /(license|api[-_]?key|secret|token|password|authorization)/i;
|
|
11
|
+
/** Substrings shaped like a credential; scrubbed out of any string. */
|
|
12
|
+
export const SECRET_PATTERNS = [
|
|
13
|
+
/sk-(?:or|ant|proj|cl)-[A-Za-z0-9_-]{20,}/g,
|
|
14
|
+
/sk-[A-Za-z0-9_-]{20,}/g,
|
|
15
|
+
/xai-[A-Za-z0-9]{20,}/g,
|
|
16
|
+
/AKIA[0-9A-Z]{16}/g,
|
|
17
|
+
/gh[posur]_[A-Za-z0-9]{20,}/g,
|
|
18
|
+
/AIza[0-9A-Za-z_-]{35}/g
|
|
19
|
+
];
|
|
20
|
+
export function redactText(text) {
|
|
21
|
+
let out = text;
|
|
22
|
+
for (const re of SECRET_PATTERNS)
|
|
23
|
+
out = out.replace(re, REDACTED);
|
|
24
|
+
const home = homedir();
|
|
25
|
+
if (home && home !== '/')
|
|
26
|
+
out = out.split(home).join('~');
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
export function redactValue(value) {
|
|
30
|
+
if (typeof value === 'string')
|
|
31
|
+
return redactText(value);
|
|
32
|
+
if (Array.isArray(value))
|
|
33
|
+
return value.map(redactValue);
|
|
34
|
+
if (value && typeof value === 'object') {
|
|
35
|
+
const out = {};
|
|
36
|
+
for (const [k, v] of Object.entries(value)) {
|
|
37
|
+
out[k] = SECRET_KEY_RE.test(k) ? REDACTED : redactValue(v);
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/diagnostics/redact.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,0EAA0E;AAC1E,wEAAwE;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,QAAQ,GAAG,YAAY,CAAC;AAE9B,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GACxB,4DAA4D,CAAC;AAE/D,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC,2CAA2C;IAC3C,wBAAwB;IACxB,uBAAuB;IACvB,mBAAmB;IACnB,6BAA6B;IAC7B,wBAAwB;CACzB,CAAC;AAEF,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,KAAK,MAAM,EAAE,IAAI,eAAe;QAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClE,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,IAAI,IAAI,IAAI,IAAI,KAAK,GAAG;QAAE,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACxD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YACtE,GAAG,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// packages/codesign-mcp/src/diagnostics/redact.ts\n//\n// Executable form of .claude/rules/no-secrets.md. Two entry points: redactText\n// for raw log lines (pattern scrub + home-path), redactValue for structured\n// events (drop secret-named keys + recurse + pattern scrub every string).\n// Both are pure and total; callers that persist/externalise apply them.\nimport { homedir } from 'node:os';\n\nconst REDACTED = '[REDACTED]';\n\n/** Key names whose VALUE is always dropped, matched case-insensitively. */\nexport const SECRET_KEY_RE =\n /(license|api[-_]?key|secret|token|password|authorization)/i;\n\n/** Substrings shaped like a credential; scrubbed out of any string. */\nexport const SECRET_PATTERNS: RegExp[] = [\n /sk-(?:or|ant|proj|cl)-[A-Za-z0-9_-]{20,}/g,\n /sk-[A-Za-z0-9_-]{20,}/g,\n /xai-[A-Za-z0-9]{20,}/g,\n /AKIA[0-9A-Z]{16}/g,\n /gh[posur]_[A-Za-z0-9]{20,}/g,\n /AIza[0-9A-Za-z_-]{35}/g\n];\n\nexport function redactText(text: string): string {\n let out = text;\n for (const re of SECRET_PATTERNS) out = out.replace(re, REDACTED);\n const home = homedir();\n if (home && home !== '/') out = out.split(home).join('~');\n return out;\n}\n\nexport function redactValue(value: unknown): unknown {\n if (typeof value === 'string') return redactText(value);\n if (Array.isArray(value)) return value.map(redactValue);\n if (value && typeof value === 'object') {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n out[k] = SECRET_KEY_RE.test(k) ? REDACTED : redactValue(v);\n }\n return out;\n }\n return value;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-call-adapter.d.ts","sourceRoot":"","sources":["../../src/diagnostics/tool-call-adapter.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,mBAAmB,CAAC;AAEvE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,eAAe,EACrB,GAAG,GAAE,MAAM,MAAyB,GACnC,aAAa,CAmBf"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function toolCallSink(diag, now = () => Date.now()) {
|
|
2
|
+
return {
|
|
3
|
+
record(report) {
|
|
4
|
+
const event = {
|
|
5
|
+
kind: 'tool_call',
|
|
6
|
+
timestamp: now(),
|
|
7
|
+
tool: report.tool,
|
|
8
|
+
succeeded: report.succeeded,
|
|
9
|
+
totalMs: report.totalMs,
|
|
10
|
+
spans: report.spans,
|
|
11
|
+
...(report.error ? { error: report.error } : {}),
|
|
12
|
+
...(report.args !== undefined ? { args: report.args } : {}),
|
|
13
|
+
...(report.result !== undefined ? { result: report.result } : {}),
|
|
14
|
+
...(report.revision ? { revision: report.revision } : {}),
|
|
15
|
+
...(report.session ? { session: report.session } : {})
|
|
16
|
+
};
|
|
17
|
+
diag.emit(event);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=tool-call-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-call-adapter.js","sourceRoot":"","sources":["../../src/diagnostics/tool-call-adapter.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,YAAY,CAC1B,IAAqB,EACrB,MAAoB,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IAEpC,OAAO;QACL,MAAM,CAAC,MAAsB;YAC3B,MAAM,KAAK,GAAoB;gBAC7B,IAAI,EAAE,WAAW;gBACjB,SAAS,EAAE,GAAG,EAAE;gBAChB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAChD,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3D,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjE,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACvD,CAAC;YACF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// packages/codesign-mcp/src/diagnostics/tool-call-adapter.ts\n//\n// The one bridge between the tool-owned TelemetrySink port and the unified\n// diagnostics stream: a ToolCallReport becomes a { kind: 'tool_call' } event,\n// timestamped and emitted. Redaction of args happens downstream in the sink.\nimport type { DiagnosticEvent, DiagnosticsSink } from './events.js';\nimport type { TelemetrySink, ToolCallReport } from '../tools/spans.js';\n\nexport function toolCallSink(\n diag: DiagnosticsSink,\n now: () => number = () => Date.now()\n): TelemetrySink {\n return {\n record(report: ToolCallReport): void {\n const event: DiagnosticEvent = {\n kind: 'tool_call',\n timestamp: now(),\n tool: report.tool,\n succeeded: report.succeeded,\n totalMs: report.totalMs,\n spans: report.spans,\n ...(report.error ? { error: report.error } : {}),\n ...(report.args !== undefined ? { args: report.args } : {}),\n ...(report.result !== undefined ? { result: report.result } : {}),\n ...(report.revision ? { revision: report.revision } : {}),\n ...(report.session ? { session: report.session } : {})\n };\n diag.emit(event);\n }\n };\n}\n"]}
|
|
@@ -2,9 +2,13 @@ import type CreativeEngine from '@cesdk/engine';
|
|
|
2
2
|
import type { EngineAdapter } from './session.js';
|
|
3
3
|
/**
|
|
4
4
|
* Adapts a `@cesdk/engine` CreativeEngine instance to the EngineSession's
|
|
5
|
-
* generic EngineAdapter shape. One-to-one mapping;
|
|
5
|
+
* generic EngineAdapter shape. One-to-one mapping; two quirks. First, `reset`
|
|
6
6
|
* (CE.SDK has no `reset()` — we wipe by creating a new scene via the same
|
|
7
7
|
* patched create path `ensureHeadlessEngine` installed for the design-unit fix).
|
|
8
|
+
* Second, `saveToString` passes an explicit `allowedResourceSchemes`: the
|
|
9
|
+
* engine default rejects our durable `workspace://` scheme, so an edit commit
|
|
10
|
+
* of a scene referencing workspace assets would fail without it (see
|
|
11
|
+
* scene-resource-schemes.ts, CODE-3).
|
|
8
12
|
*
|
|
9
13
|
* `engine` may be a Promise: the stdio transport defers engine init off the
|
|
10
14
|
* MCP-handshake path and hands the in-flight promise here. EngineSession only
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cesdk-adapter.d.ts","sourceRoot":"","sources":["../../src/engine/cesdk-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cesdk-adapter.d.ts","sourceRoot":"","sources":["../../src/engine/cesdk-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,GAC/C,aAAa,CAAC,cAAc,CAAC,CAc/B"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { SCENE_ALLOWED_RESOURCE_SCHEMES } from './scene-resource-schemes.js';
|
|
1
2
|
/**
|
|
2
3
|
* Adapts a `@cesdk/engine` CreativeEngine instance to the EngineSession's
|
|
3
|
-
* generic EngineAdapter shape. One-to-one mapping;
|
|
4
|
+
* generic EngineAdapter shape. One-to-one mapping; two quirks. First, `reset`
|
|
4
5
|
* (CE.SDK has no `reset()` — we wipe by creating a new scene via the same
|
|
5
6
|
* patched create path `ensureHeadlessEngine` installed for the design-unit fix).
|
|
7
|
+
* Second, `saveToString` passes an explicit `allowedResourceSchemes`: the
|
|
8
|
+
* engine default rejects our durable `workspace://` scheme, so an edit commit
|
|
9
|
+
* of a scene referencing workspace assets would fail without it (see
|
|
10
|
+
* scene-resource-schemes.ts, CODE-3).
|
|
6
11
|
*
|
|
7
12
|
* `engine` may be a Promise: the stdio transport defers engine init off the
|
|
8
13
|
* MCP-handshake path and hands the in-flight promise here. EngineSession only
|
|
@@ -19,7 +24,9 @@ export function cesdkAdapter(engine) {
|
|
|
19
24
|
loadFromString: async (eng, scene) => {
|
|
20
25
|
await eng.scene.loadFromString(scene);
|
|
21
26
|
},
|
|
22
|
-
saveToString: async (eng) => eng.scene.saveToString(
|
|
27
|
+
saveToString: async (eng) => eng.scene.saveToString({
|
|
28
|
+
allowedResourceSchemes: SCENE_ALLOWED_RESOURCE_SCHEMES
|
|
29
|
+
})
|
|
23
30
|
};
|
|
24
31
|
}
|
|
25
32
|
//# sourceMappingURL=cesdk-adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cesdk-adapter.js","sourceRoot":"","sources":["../../src/engine/cesdk-adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cesdk-adapter.js","sourceRoot":"","sources":["../../src/engine/cesdk-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAG7E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAgD;IAEhD,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,gFAAgF;QACtG,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YACnB,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,4EAA4E;QAClG,CAAC;QACD,cAAc,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;YACnC,MAAM,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;QACD,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAC1B,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC;YACrB,sBAAsB,EAAE,8BAA8B;SACvD,CAAC;KACL,CAAC;AACJ,CAAC","sourcesContent":["import type CreativeEngine from '@cesdk/engine';\nimport { SCENE_ALLOWED_RESOURCE_SCHEMES } from './scene-resource-schemes.js';\nimport type { EngineAdapter } from './session.js';\n\n/**\n * Adapts a `@cesdk/engine` CreativeEngine instance to the EngineSession's\n * generic EngineAdapter shape. One-to-one mapping; two quirks. First, `reset`\n * (CE.SDK has no `reset()` — we wipe by creating a new scene via the same\n * patched create path `ensureHeadlessEngine` installed for the design-unit fix).\n * Second, `saveToString` passes an explicit `allowedResourceSchemes`: the\n * engine default rejects our durable `workspace://` scheme, so an edit commit\n * of a scene referencing workspace assets would fail without it (see\n * scene-resource-schemes.ts, CODE-3).\n *\n * `engine` may be a Promise: the stdio transport defers engine init off the\n * MCP-handshake path and hands the in-flight promise here. EngineSession only\n * calls `create()` on the first slot (first edit), awaiting it then — by which\n * point init is usually already settled. The other methods receive the resolved\n * engine from EngineSession, so they never touch the promise.\n */\nexport function cesdkAdapter(\n engine: CreativeEngine | Promise<CreativeEngine>\n): EngineAdapter<CreativeEngine> {\n return {\n create: () => engine, // single-engine adapter: always the same instance (awaited lazily if a promise)\n reset: async (eng) => {\n eng.scene.create(); // wipes the active scene; design-unit patch from tools/engine.ts re-applies\n },\n loadFromString: async (eng, scene) => {\n await eng.scene.loadFromString(scene);\n },\n saveToString: async (eng) =>\n eng.scene.saveToString({\n allowedResourceSchemes: SCENE_ALLOWED_RESOURCE_SCHEMES\n })\n };\n}\n"]}
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/engine/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export { cesdkAdapter } from './cesdk-adapter.js';
|
|
2
2
|
export { EngineSession } from './session.js';
|
|
3
|
+
// A headless CE.SDK engine (design-unit-patched). Exposed so consumers outside
|
|
4
|
+
// the MCP server — e.g. eval harnesses re-opening a produced artifact — can
|
|
5
|
+
// spin one up without reimplementing the @cesdk/node WASM/worker require dance.
|
|
6
|
+
export { ensureHeadlessEngine } from '../tools/engine.js';
|
|
3
7
|
//# sourceMappingURL=index.js.map
|
package/dist/engine/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAEL,aAAa,EAGd,MAAM,cAAc,CAAC","sourcesContent":["export { cesdkAdapter } from './cesdk-adapter.js';\nexport {\n type EngineAdapter,\n EngineSession,\n type EngineSessionOptions,\n type EngineSlot\n} from './session.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAEL,aAAa,EAGd,MAAM,cAAc,CAAC;AACtB,+EAA+E;AAC/E,4EAA4E;AAC5E,gFAAgF;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { cesdkAdapter } from './cesdk-adapter.js';\nexport {\n type EngineAdapter,\n EngineSession,\n type EngineSessionOptions,\n type EngineSlot\n} from './session.js';\n// A headless CE.SDK engine (design-unit-patched). Exposed so consumers outside\n// the MCP server — e.g. eval harnesses re-opening a produced artifact — can\n// spin one up without reimplementing the @cesdk/node WASM/worker require dance.\nexport { ensureHeadlessEngine } from '../tools/engine.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-resource-schemes.d.ts","sourceRoot":"","sources":["../../src/engine/scene-resource-schemes.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,8BAA8B,UAQ1C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// packages/codesign-mcp/src/engine/scene-resource-schemes.ts
|
|
2
|
+
//
|
|
3
|
+
// The resource-URL schemes allowed to appear in a PERSISTED scene string.
|
|
4
|
+
// CE.SDK's scene.saveToString default omits `workspace` — our durable scheme
|
|
5
|
+
// for content-addressed assets (see uri-resolver.ts) — and the engine checks
|
|
6
|
+
// the RAW stored URL, not the resolved one (verified empirically, CODE-3).
|
|
7
|
+
// Every scene-serialization path (edit commits via cesdk-adapter, load's
|
|
8
|
+
// archive explode) must use this list, or a scene referencing workspace://
|
|
9
|
+
// assets fails to save. `buffer` stays excluded deliberately: a transient
|
|
10
|
+
// resource in a persisted scene is silent data loss — fail loudly instead.
|
|
11
|
+
export const SCENE_ALLOWED_RESOURCE_SCHEMES = [
|
|
12
|
+
'blob',
|
|
13
|
+
'bundle',
|
|
14
|
+
'file',
|
|
15
|
+
'http',
|
|
16
|
+
'https',
|
|
17
|
+
'opfs',
|
|
18
|
+
'workspace'
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=scene-resource-schemes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-resource-schemes.js","sourceRoot":"","sources":["../../src/engine/scene-resource-schemes.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,WAAW;CACZ,CAAC","sourcesContent":["// packages/codesign-mcp/src/engine/scene-resource-schemes.ts\n//\n// The resource-URL schemes allowed to appear in a PERSISTED scene string.\n// CE.SDK's scene.saveToString default omits `workspace` — our durable scheme\n// for content-addressed assets (see uri-resolver.ts) — and the engine checks\n// the RAW stored URL, not the resolved one (verified empirically, CODE-3).\n// Every scene-serialization path (edit commits via cesdk-adapter, load's\n// archive explode) must use this list, or a scene referencing workspace://\n// assets fails to save. `buffer` stays excluded deliberately: a transient\n// resource in a persisted scene is silent data loss — fail loudly instead.\nexport const SCENE_ALLOWED_RESOURCE_SCHEMES = [\n 'blob',\n 'bundle',\n 'file',\n 'http',\n 'https',\n 'opfs',\n 'workspace'\n];\n"]}
|
package/dist/http/server.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { type CorsOptions } from 'cors';
|
|
|
3
3
|
import { type Express, type Request, type RequestHandler } from 'express';
|
|
4
4
|
import { type CodesignMcpToolRegistration, createCodesignMcpServer } from '../server.js';
|
|
5
5
|
import { SessionManager } from './session-manager.js';
|
|
6
|
-
import type { MetricsRecorder } from '../metrics/recorder.js';
|
|
7
6
|
/**
|
|
8
7
|
* Per-session state held by the SessionManager: the engine, the MCP server,
|
|
9
8
|
* and the per-session HTTP transport. Every incoming request with this
|
|
@@ -46,11 +45,6 @@ export interface CreateCodesignHttpServerOptions {
|
|
|
46
45
|
}>;
|
|
47
46
|
/** Optional: mount additional routes (viewer router, dashboards) before MCP. */
|
|
48
47
|
mountExtras?: (app: Express) => void;
|
|
49
|
-
/**
|
|
50
|
-
* Optional metrics recorder, DI'd into every session's MCP server so tool
|
|
51
|
-
* calls are timed at the single dispatch chokepoint. Absent → no timing.
|
|
52
|
-
*/
|
|
53
|
-
metrics?: MetricsRecorder;
|
|
54
48
|
/** Build identity reported as `serverInfo.version`. Default `'dev'`. */
|
|
55
49
|
buildId?: string;
|
|
56
50
|
/** Optional auth middleware — runs before MCP routing. Default: no-op. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/http/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAa,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAgB,EACd,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,2BAA2B,EAChC,uBAAuB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA2B,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/http/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAa,EAAE,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAgB,EACd,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,2BAA2B,EAChC,uBAAuB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA2B,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG/E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;I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B,wBAAwB,CAC5C,IAAI,EAAE,+BAA+B,GACpC,OAAO,CAAC,kBAAkB,CAAC,CAuL7B"}
|
package/dist/http/server.js
CHANGED
|
@@ -22,8 +22,7 @@ export async function createCodesignHttpServer(opts) {
|
|
|
22
22
|
assets: opts.assets,
|
|
23
23
|
resourceScheme: opts.resourceScheme,
|
|
24
24
|
tools,
|
|
25
|
-
...(opts.buildId ? { buildId: opts.buildId } : {})
|
|
26
|
-
...(opts.metrics ? { metrics: opts.metrics } : {})
|
|
25
|
+
...(opts.buildId ? { buildId: opts.buildId } : {})
|
|
27
26
|
});
|
|
28
27
|
const transport = new StreamableHTTPServerTransport({
|
|
29
28
|
sessionIdGenerator: () => id,
|
package/dist/http/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/http/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,IAA0B,MAAM,MAAM,CAAC;AAC9C,OAAO,OAKN,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,uBAAuB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AA2EzD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,IAAqC;IAErC,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAExE,MAAM,UAAU,GAAG,IAAI,cAAc,CAGnC;QACA,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YACpB,IAAI,CAAC,G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gBAClE,EAAE,EAAE,IAAI;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,oBAAoB,SAAS,EAAE,EAAE;gBACjE,EAAE,EAAE,IAAI;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5B,MAAM,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,IAAI,IAAI,CAAC,WAAW;QAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAE5C,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE3B,GAAG,CAAC,QAAQ,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';\nimport cors, { type CorsOptions } from 'cors';\nimport express, {\n type Express,\n type Request,\n type RequestHandler,\n type Response\n} from 'express';\nimport {\n type CodesignMcpToolRegistration,\n createCodesignMcpServer\n} from '../server.js';\nimport { SessionCapExceededError, SessionManager } from './session-manager.js';\nimport { WorkspaceAuthError } from './workspace-auth.js';\nimport type { MetricsRecorder } from '../metrics/recorder.js';\n\n/**\n * Per-session state held by the SessionManager: the engine, the MCP server,\n * and the per-session HTTP transport. Every incoming request with this\n * session's id is routed to `transport.handleRequest`.\n */\nexport interface CodesignHttpSession {\n id: string;\n engine: unknown;\n server: ReturnType<typeof createCodesignMcpServer>;\n transport: StreamableHTTPServerTransport;\n dispose?: () => Promise<void>;\n}\n\nexport interface CreateCodesignHttpServerOptions {\n assets: Record<string, string>;\n resourceScheme?: string;\n maxSessions: number;\n idleTimeoutMs: number;\n /**\n * Resolve the front-asserted workspaceId for a new MCP session. Receives the\n * freshly-minted session id (so `session` mode can derive `s/<id>`). May throw\n * WorkspaceAuthError → 401. Default: a fixed \"default\" workspace.\n */\n resolveWorkspaceId?: (req: Request, sessionId: string) => string;\n /**\n * When set, an `initialize` request carrying this (case-insensitive) header uses\n * its value as the MCP session id instead of minting one. The Worker/front\n * mints the id so it can route follow-ups to the same warm instance (spec §3).\n * The front MUST strip any client-supplied value of this header — same trust\n * posture as the workspace header. Absent header → mint as normal.\n */\n trustedSessionIdHeader?: string;\n /** Build everything needed for one session in one go. */\n createSession: (ctx: { sessionId: string; workspaceId: string }) => Promise<{\n engine: unknown;\n tools: CodesignMcpToolRegistration[];\n dispose?: () => Promise<void>;\n }>;\n /** Optional: mount additional routes (viewer router, dashboards) before MCP. */\n mountExtras?: (app: Express) => void;\n /**\n * Optional metrics recorder, DI'd into every session's MCP server so tool\n * calls are timed at the single dispatch chokepoint. Absent → no timing.\n */\n metrics?: MetricsRecorder;\n /** Build identity reported as `serverInfo.version`. Default `'dev'`. */\n buildId?: string;\n /** Optional auth middleware — runs before MCP routing. Default: no-op. */\n auth?: RequestHandler;\n /** Optional CORS options. Default: disabled. */\n cors?: CorsOptions | false;\n}\n\n/**\n * Express app exposing MCP over Streamable HTTP at /mcp. Stateful sessions:\n * each MCP `initialize` call spawns a fresh session (engine + server +\n * transport); follow-up requests carry `Mcp-Session-Id` to route back. The\n * underlying SessionManager enforces idle eviction and a session cap.\n *\n * The returned object exposes:\n * .listen / .use / etc. — Express's surface (composes into larger apps)\n * .sessions — the SessionManager (testing + ops insight)\n * .shutdown() — destroy every active session, dispose engines\n */\nexport interface CodesignHttpServer extends Express {\n sessions: SessionManager<\n CodesignHttpSession,\n { sessionId: string; workspaceId: string }\n >;\n shutdown(): Promise<void>;\n}\n\nexport async function createCodesignHttpServer(\n opts: CreateCodesignHttpServerOptions\n): Promise<CodesignHttpServer> {\n const resolveWorkspaceId = opts.resolveWorkspaceId ?? (() => 'default');\n\n const sessionMgr = new SessionManager<\n CodesignHttpSession,\n { sessionId: string; workspaceId: string }\n >({\n maxSessions: opts.maxSessions,\n idleTimeoutMs: opts.idleTimeoutMs,\n create: async (ctx) => {\n if (!ctx)\n throw new Error(\n 'createCodesignHttpServer: session context is required'\n );\n const id = ctx.sessionId;\n const { engine, tools, dispose } = await opts.createSession({\n sessionId: id,\n workspaceId: ctx.workspaceId\n });\n const server = createCodesignMcpServer({\n assets: opts.assets,\n resourceScheme: opts.resourceScheme,\n tools,\n ...(opts.buildId ? { buildId: opts.buildId } : {}),\n ...(opts.metrics ? { metrics: opts.metrics } : {})\n });\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: () => id,\n // A client `DELETE /mcp` (graceful termination) fires this before the\n // transport closes itself. Bridge it to the SessionManager so the slot\n // and its engine are reclaimed immediately instead of squatting until\n // idle eviction. Only fires on the DELETE path — not from transport\n // `close()` during `destroy` — so there is no re-entrancy: `delete`\n // removes the map entry first, then runs `destroy` (a redundant,\n // idempotent second `transport.close()`).\n onsessionclosed: (sid) => {\n void sessionMgr.delete(sid).catch(() => {\n // Already gone (idle-evicted, or a duplicate close) — nothing to do.\n });\n }\n });\n await server.connect(transport);\n return { id, engine, server, transport, dispose };\n },\n destroy: async (s) => {\n try {\n await s.transport.close();\n } catch {\n // ignore — best-effort\n }\n try {\n await s.server.close();\n } catch {\n // ignore\n }\n // Call the session's dispose callback if provided (e.g. engine teardown).\n try {\n await s.dispose?.();\n } catch {\n // ignore\n }\n }\n });\n\n const app = express() as CodesignHttpServer;\n app.sessions = sessionMgr;\n\n if (opts.cors !== false) {\n app.use(cors(opts.cors));\n }\n if (opts.auth) {\n app.use(opts.auth);\n }\n app.use(express.json({ limit: '16mb' }));\n\n /** Narrow `code` out of an unknown thrown value without `as any`. */\n function errCode(e: unknown): string | undefined {\n return typeof e === 'object' && e !== null && 'code' in e\n ? ((e as { code?: unknown }).code as string | undefined)\n : undefined;\n }\n\n const handle = async (req: Request, res: Response): Promise<void> => {\n const sessionId = req.header('mcp-session-id');\n\n // Initialization (POST without session id) → spawn a new session.\n if (req.method === 'POST' && !sessionId) {\n const injected = opts.trustedSessionIdHeader\n ? req.header(opts.trustedSessionIdHeader)?.trim() || undefined\n : undefined;\n const newSessionId = injected ?? randomUUID();\n let workspaceId: string;\n try {\n workspaceId = resolveWorkspaceId(req, newSessionId);\n } catch (err) {\n if (err instanceof WorkspaceAuthError) {\n res.status(401).json({\n jsonrpc: '2.0',\n error: { code: -32002, message: err.message },\n id: null\n });\n return;\n }\n res.status(500).json({\n jsonrpc: '2.0',\n error: { code: -32603, message: 'internal error' },\n id: null\n });\n return;\n }\n let session: CodesignHttpSession;\n try {\n session = await sessionMgr.create({\n sessionId: newSessionId,\n workspaceId\n });\n } catch (err) {\n if (err instanceof SessionCapExceededError) {\n res\n .status(503)\n .set('Retry-After', '30')\n .json({\n jsonrpc: '2.0',\n error: { code: -32000, message: err.message },\n id: null\n });\n return;\n }\n if (errCode(err) === 'EINVAL') {\n res.status(400).json({\n jsonrpc: '2.0',\n error: {\n code: -32602,\n message:\n err instanceof Error ? err.message : 'invalid workspaceId'\n },\n id: null\n });\n return;\n }\n res.status(500).json({\n jsonrpc: '2.0',\n error: { code: -32603, message: 'internal error' },\n id: null\n });\n return;\n }\n await session.transport.handleRequest(req, res, req.body);\n return;\n }\n\n // Subsequent requests must carry a known session id.\n if (!sessionId) {\n res.status(400).json({\n jsonrpc: '2.0',\n error: { code: -32600, message: 'Mcp-Session-Id header required' },\n id: null\n });\n return;\n }\n const session = sessionMgr.get(sessionId);\n if (!session) {\n res.status(404).json({\n jsonrpc: '2.0',\n error: { code: -32001, message: `unknown session: ${sessionId}` },\n id: null\n });\n return;\n }\n sessionMgr.touch(sessionId);\n await session.transport.handleRequest(req, res, req.body);\n };\n\n if (opts.mountExtras) opts.mountExtras(app);\n\n app.post('/mcp', handle);\n app.get('/mcp', handle);\n app.delete('/mcp', handle);\n\n app.shutdown = async () => {\n await sessionMgr.destroyAll();\n };\n\n return app;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/http/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,IAA0B,MAAM,MAAM,CAAC;AAC9C,OAAO,OAKN,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,uBAAuB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAqEzD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,IAAqC;IAErC,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAExE,MAAM,UAAU,GAAG,IAAI,cAAc,CAGnC;QACA,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YACpB,IAAI,CAAC,GAAG;gBACN,MAAM,IAAI,KAAK,CACb,uDAAuD,CACxD,CAAC;YACJ,MAAM,EAAE,GAAG,GAAG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C,IAAI,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,oBAAoB,SAAS,EAAE,EAAE;gBACjE,EAAE,EAAE,IAAI;aACT,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC5B,MAAM,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,IAAI,IAAI,CAAC,WAAW;QAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAE5C,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE3B,GAAG,CAAC,QAAQ,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';\nimport cors, { type CorsOptions } from 'cors';\nimport express, {\n type Express,\n type Request,\n type RequestHandler,\n type Response\n} from 'express';\nimport {\n type CodesignMcpToolRegistration,\n createCodesignMcpServer\n} from '../server.js';\nimport { SessionCapExceededError, SessionManager } from './session-manager.js';\nimport { WorkspaceAuthError } from './workspace-auth.js';\n\n/**\n * Per-session state held by the SessionManager: the engine, the MCP server,\n * and the per-session HTTP transport. Every incoming request with this\n * session's id is routed to `transport.handleRequest`.\n */\nexport interface CodesignHttpSession {\n id: string;\n engine: unknown;\n server: ReturnType<typeof createCodesignMcpServer>;\n transport: StreamableHTTPServerTransport;\n dispose?: () => Promise<void>;\n}\n\nexport interface CreateCodesignHttpServerOptions {\n assets: Record<string, string>;\n resourceScheme?: string;\n maxSessions: number;\n idleTimeoutMs: number;\n /**\n * Resolve the front-asserted workspaceId for a new MCP session. Receives the\n * freshly-minted session id (so `session` mode can derive `s/<id>`). May throw\n * WorkspaceAuthError → 401. Default: a fixed \"default\" workspace.\n */\n resolveWorkspaceId?: (req: Request, sessionId: string) => string;\n /**\n * When set, an `initialize` request carrying this (case-insensitive) header uses\n * its value as the MCP session id instead of minting one. The Worker/front\n * mints the id so it can route follow-ups to the same warm instance (spec §3).\n * The front MUST strip any client-supplied value of this header — same trust\n * posture as the workspace header. Absent header → mint as normal.\n */\n trustedSessionIdHeader?: string;\n /** Build everything needed for one session in one go. */\n createSession: (ctx: { sessionId: string; workspaceId: string }) => Promise<{\n engine: unknown;\n tools: CodesignMcpToolRegistration[];\n dispose?: () => Promise<void>;\n }>;\n /** Optional: mount additional routes (viewer router, dashboards) before MCP. */\n mountExtras?: (app: Express) => void;\n /** Build identity reported as `serverInfo.version`. Default `'dev'`. */\n buildId?: string;\n /** Optional auth middleware — runs before MCP routing. Default: no-op. */\n auth?: RequestHandler;\n /** Optional CORS options. Default: disabled. */\n cors?: CorsOptions | false;\n}\n\n/**\n * Express app exposing MCP over Streamable HTTP at /mcp. Stateful sessions:\n * each MCP `initialize` call spawns a fresh session (engine + server +\n * transport); follow-up requests carry `Mcp-Session-Id` to route back. The\n * underlying SessionManager enforces idle eviction and a session cap.\n *\n * The returned object exposes:\n * .listen / .use / etc. — Express's surface (composes into larger apps)\n * .sessions — the SessionManager (testing + ops insight)\n * .shutdown() — destroy every active session, dispose engines\n */\nexport interface CodesignHttpServer extends Express {\n sessions: SessionManager<\n CodesignHttpSession,\n { sessionId: string; workspaceId: string }\n >;\n shutdown(): Promise<void>;\n}\n\nexport async function createCodesignHttpServer(\n opts: CreateCodesignHttpServerOptions\n): Promise<CodesignHttpServer> {\n const resolveWorkspaceId = opts.resolveWorkspaceId ?? (() => 'default');\n\n const sessionMgr = new SessionManager<\n CodesignHttpSession,\n { sessionId: string; workspaceId: string }\n >({\n maxSessions: opts.maxSessions,\n idleTimeoutMs: opts.idleTimeoutMs,\n create: async (ctx) => {\n if (!ctx)\n throw new Error(\n 'createCodesignHttpServer: session context is required'\n );\n const id = ctx.sessionId;\n const { engine, tools, dispose } = await opts.createSession({\n sessionId: id,\n workspaceId: ctx.workspaceId\n });\n const server = createCodesignMcpServer({\n assets: opts.assets,\n resourceScheme: opts.resourceScheme,\n tools,\n ...(opts.buildId ? { buildId: opts.buildId } : {})\n });\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: () => id,\n // A client `DELETE /mcp` (graceful termination) fires this before the\n // transport closes itself. Bridge it to the SessionManager so the slot\n // and its engine are reclaimed immediately instead of squatting until\n // idle eviction. Only fires on the DELETE path — not from transport\n // `close()` during `destroy` — so there is no re-entrancy: `delete`\n // removes the map entry first, then runs `destroy` (a redundant,\n // idempotent second `transport.close()`).\n onsessionclosed: (sid) => {\n void sessionMgr.delete(sid).catch(() => {\n // Already gone (idle-evicted, or a duplicate close) — nothing to do.\n });\n }\n });\n await server.connect(transport);\n return { id, engine, server, transport, dispose };\n },\n destroy: async (s) => {\n try {\n await s.transport.close();\n } catch {\n // ignore — best-effort\n }\n try {\n await s.server.close();\n } catch {\n // ignore\n }\n // Call the session's dispose callback if provided (e.g. engine teardown).\n try {\n await s.dispose?.();\n } catch {\n // ignore\n }\n }\n });\n\n const app = express() as CodesignHttpServer;\n app.sessions = sessionMgr;\n\n if (opts.cors !== false) {\n app.use(cors(opts.cors));\n }\n if (opts.auth) {\n app.use(opts.auth);\n }\n app.use(express.json({ limit: '16mb' }));\n\n /** Narrow `code` out of an unknown thrown value without `as any`. */\n function errCode(e: unknown): string | undefined {\n return typeof e === 'object' && e !== null && 'code' in e\n ? ((e as { code?: unknown }).code as string | undefined)\n : undefined;\n }\n\n const handle = async (req: Request, res: Response): Promise<void> => {\n const sessionId = req.header('mcp-session-id');\n\n // Initialization (POST without session id) → spawn a new session.\n if (req.method === 'POST' && !sessionId) {\n const injected = opts.trustedSessionIdHeader\n ? req.header(opts.trustedSessionIdHeader)?.trim() || undefined\n : undefined;\n const newSessionId = injected ?? randomUUID();\n let workspaceId: string;\n try {\n workspaceId = resolveWorkspaceId(req, newSessionId);\n } catch (err) {\n if (err instanceof WorkspaceAuthError) {\n res.status(401).json({\n jsonrpc: '2.0',\n error: { code: -32002, message: err.message },\n id: null\n });\n return;\n }\n res.status(500).json({\n jsonrpc: '2.0',\n error: { code: -32603, message: 'internal error' },\n id: null\n });\n return;\n }\n let session: CodesignHttpSession;\n try {\n session = await sessionMgr.create({\n sessionId: newSessionId,\n workspaceId\n });\n } catch (err) {\n if (err instanceof SessionCapExceededError) {\n res\n .status(503)\n .set('Retry-After', '30')\n .json({\n jsonrpc: '2.0',\n error: { code: -32000, message: err.message },\n id: null\n });\n return;\n }\n if (errCode(err) === 'EINVAL') {\n res.status(400).json({\n jsonrpc: '2.0',\n error: {\n code: -32602,\n message:\n err instanceof Error ? err.message : 'invalid workspaceId'\n },\n id: null\n });\n return;\n }\n res.status(500).json({\n jsonrpc: '2.0',\n error: { code: -32603, message: 'internal error' },\n id: null\n });\n return;\n }\n await session.transport.handleRequest(req, res, req.body);\n return;\n }\n\n // Subsequent requests must carry a known session id.\n if (!sessionId) {\n res.status(400).json({\n jsonrpc: '2.0',\n error: { code: -32600, message: 'Mcp-Session-Id header required' },\n id: null\n });\n return;\n }\n const session = sessionMgr.get(sessionId);\n if (!session) {\n res.status(404).json({\n jsonrpc: '2.0',\n error: { code: -32001, message: `unknown session: ${sessionId}` },\n id: null\n });\n return;\n }\n sessionMgr.touch(sessionId);\n await session.transport.handleRequest(req, res, req.body);\n };\n\n if (opts.mountExtras) opts.mountExtras(app);\n\n app.post('/mcp', handle);\n app.get('/mcp', handle);\n app.delete('/mcp', handle);\n\n app.shutdown = async () => {\n await sessionMgr.destroyAll();\n };\n\n return app;\n}\n"]}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
-
import type { MetricsRecorder } from './metrics/recorder.js';
|
|
3
2
|
/**
|
|
4
3
|
* One tool the server exposes via tools/list + tools/call. Caller-supplied so
|
|
5
4
|
* the engine-bound implementations live near the surface that owns the engine
|
|
@@ -28,7 +27,6 @@ export interface CodesignMcpServerOptions {
|
|
|
28
27
|
* Asset bundle. Keys are forward-slash paths under one of:
|
|
29
28
|
* "docs/<doc>/SKILL.md" — entry point for handbook / api / guide
|
|
30
29
|
* "docs/<doc>/<file>" — sub-files reachable via the doc tools
|
|
31
|
-
* "prompts/<name>.md" — slash-command prompts
|
|
32
30
|
* Values are file contents.
|
|
33
31
|
*/
|
|
34
32
|
assets: Record<string, string>;
|
|
@@ -36,8 +34,6 @@ export interface CodesignMcpServerOptions {
|
|
|
36
34
|
resourceScheme?: string;
|
|
37
35
|
/** Tools to expose via tools/list + tools/call. */
|
|
38
36
|
tools?: CodesignMcpToolRegistration[];
|
|
39
|
-
/** Optional metrics sink. Absent → tool calls are not timed (no-op). */
|
|
40
|
-
metrics?: MetricsRecorder;
|
|
41
37
|
/**
|
|
42
38
|
* Build identity reported as `serverInfo.version` on `initialize`. A client
|
|
43
39
|
* (the deploy smoketest) can assert it to confirm it's talking to the
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE;;;;;GAKG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;QAC/B,OAAO,EAAE,KAAK,CACV;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,GAC9B;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CACpD,CAAC;QACF,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,KAAK,CAAC,EAAE,2BAA2B,EAAE,CAAC;IACtC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,wBAAwB,GAC7B,MAAM,CAmIR"}
|
package/dist/server.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
-
import { CallToolRequestSchema, ErrorCode,
|
|
2
|
+
import { CallToolRequestSchema, ErrorCode, ListResourcesRequestSchema, ListToolsRequestSchema, McpError, ReadResourceRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
import { rewriteSkillLinks } from './cross-ref.js';
|
|
4
|
-
import { parseFrontmatter } from './frontmatter.js';
|
|
5
4
|
import { buildSkillReadTools } from './skill-tools.js';
|
|
6
|
-
import { performance } from 'node:perf_hooks';
|
|
7
5
|
const DOC_FILE = /^docs\/([^/]+)\/(.+)$/;
|
|
8
|
-
const PROMPT_FILE = /^prompts\/([^/]+)\.md$/;
|
|
9
6
|
export function createCodesignMcpServer(opts) {
|
|
10
7
|
const scheme = opts.resourceScheme ?? 'codesign';
|
|
11
8
|
const assets = opts.assets;
|
|
12
9
|
// `instructions` is intentionally short — it tells the model what the
|
|
13
10
|
// server is and STRONGLY directs it to call `codesign_read_codesign_system`
|
|
14
|
-
// before its first
|
|
11
|
+
// before its first edit. Skills are now first-class tools (not MCP
|
|
15
12
|
// resources buried in an XML block), so discovery happens via tools/list
|
|
16
13
|
// on every host without needing ReadMcpResourceTool support.
|
|
17
14
|
//
|
|
@@ -66,21 +63,8 @@ export function createCodesignMcpServer(opts) {
|
|
|
66
63
|
const uri = `${scheme}://docs/${doc}/${rest}`;
|
|
67
64
|
rewrittenContent.set(uri, rewriteSkillLinks(content, doc, scheme));
|
|
68
65
|
}
|
|
69
|
-
// Index prompts by name (frontmatter `name`, falling back to filename).
|
|
70
|
-
const prompts = new Map();
|
|
71
|
-
for (const [key, content] of Object.entries(assets)) {
|
|
72
|
-
const m = key.match(PROMPT_FILE);
|
|
73
|
-
if (!m)
|
|
74
|
-
continue;
|
|
75
|
-
const front = parseFrontmatter(content);
|
|
76
|
-
const name = front.name ?? m[1];
|
|
77
|
-
prompts.set(name, {
|
|
78
|
-
description: front.description ?? '',
|
|
79
|
-
body: front.body
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
66
|
const server = new Server({ name: 'codesign', version: opts.buildId ?? 'dev' }, {
|
|
83
|
-
capabilities: { resources: {},
|
|
67
|
+
capabilities: { resources: {}, tools: {} },
|
|
84
68
|
instructions
|
|
85
69
|
});
|
|
86
70
|
// `resources/list` advertises only the per-skill SKILL.md (the entry
|
|
@@ -106,26 +90,6 @@ export function createCodesignMcpServer(opts) {
|
|
|
106
90
|
contents: [{ uri: req.params.uri, mimeType: 'text/markdown', text }]
|
|
107
91
|
};
|
|
108
92
|
});
|
|
109
|
-
server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
110
|
-
prompts: Array.from(prompts.entries()).map(([name, p]) => ({
|
|
111
|
-
name,
|
|
112
|
-
description: p.description
|
|
113
|
-
}))
|
|
114
|
-
}));
|
|
115
|
-
server.setRequestHandler(GetPromptRequestSchema, async (req) => {
|
|
116
|
-
const p = prompts.get(req.params.name);
|
|
117
|
-
if (!p) {
|
|
118
|
-
throw new McpError(ErrorCode.InvalidParams, `Unknown prompt: ${req.params.name}`);
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
messages: [
|
|
122
|
-
{
|
|
123
|
-
role: 'user',
|
|
124
|
-
content: { type: 'text', text: p.body }
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
93
|
// Tools registered with the server: caller-supplied design tools + the
|
|
130
94
|
// auto-generated skill-read tools (one per skill in the asset bundle).
|
|
131
95
|
// The skill tools always come first so Level 1 wording in the design tool
|
|
@@ -148,27 +112,7 @@ export function createCodesignMcpServer(opts) {
|
|
|
148
112
|
if (!t) {
|
|
149
113
|
throw new McpError(ErrorCode.InvalidParams, `Unknown tool: ${req.params.name}`);
|
|
150
114
|
}
|
|
151
|
-
|
|
152
|
-
if (!opts.metrics)
|
|
153
|
-
return await t.call(req.params.arguments ?? {});
|
|
154
|
-
const startedAt = performance.now();
|
|
155
|
-
let ok = true;
|
|
156
|
-
try {
|
|
157
|
-
const res = await t.call(req.params.arguments ?? {});
|
|
158
|
-
ok = res.isError !== true;
|
|
159
|
-
return res;
|
|
160
|
-
}
|
|
161
|
-
catch (err) {
|
|
162
|
-
ok = false;
|
|
163
|
-
throw err;
|
|
164
|
-
}
|
|
165
|
-
finally {
|
|
166
|
-
opts.metrics.record({
|
|
167
|
-
tool: req.params.name,
|
|
168
|
-
durationMs: performance.now() - startedAt,
|
|
169
|
-
ok
|
|
170
|
-
});
|
|
171
|
-
}
|
|
115
|
+
return await t.call(req.params.arguments ?? {});
|
|
172
116
|
});
|
|
173
117
|
return server;
|
|
174
118
|
}
|
package/dist/server.js.map
C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M,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;YACrD,EAAE,GAAG,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC;YAC1B,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,EAAE,GAAG,KAAK,CAAC;YACX,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;gBAClB,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI;gBACrB,UAAU,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;gBACzC,EAAE;aACH,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport {\n CallToolRequestSchema,\n ErrorCode,\n GetPromptRequestSchema,\n ListPromptsRequestSchema,\n ListResourcesRequestSchema,\n ListToolsRequestSchema,\n McpError,\n ReadResourceRequestSchema\n} from '@modelcontextprotocol/sdk/types.js';\nimport { rewriteSkillLinks } from './cross-ref.js';\nimport { parseFrontmatter } from './frontmatter.js';\nimport { buildSkillReadTools } from './skill-tools.js';\nimport { performance } from 'node:perf_hooks';\nimport type { MetricsRecorder } from './metrics/recorder.js';\n\n/**\n * One tool the server exposes via tools/list + tools/call. Caller-supplied so\n * the engine-bound implementations live near the surface that owns the engine\n * (the demo passes its existing `createDesignTools` output adapted to this\n * shape; an external bootstrap could pass server-side equivalents).\n */\nexport interface CodesignMcpToolRegistration {\n name: string;\n description?: string;\n /** JSON Schema describing the tool's input arguments. */\n inputSchema: unknown;\n call: (args: unknown) => Promise<{\n content: Array<\n | { type: 'text'; text: string }\n | { type: 'image'; data: string; mimeType: string }\n >;\n isError?: boolean;\n }>;\n}\n\nexport interface CodesignMcpServerOptions {\n /**\n * Asset bundle. Keys are forward-slash paths under one of:\n * \"docs/<doc>/SKILL.md\" — entry point for handbook / api / guide\n * \"docs/<doc>/<file>\" — sub-files reachable via the doc tools\n * \"prompts/<name>.md\" — slash-command prompts\n * Values are file contents.\n */\n assets: Record<string, string>;\n /** URI scheme for resources. Default: \"codesign\". */\n resourceScheme?: string;\n /** Tools to expose via tools/list + tools/call. */\n tools?: CodesignMcpToolRegistration[];\n /** Optional metrics sink. Absent → tool calls are not timed (no-op). */\n metrics?: MetricsRecorder;\n /**\n * Build identity reported as `serverInfo.version` on `initialize`. A client\n * (the deploy smoketest) can assert it to confirm it's talking to the\n * just-deployed build, not a stale container. Default `'dev'`.\n */\n buildId?: string;\n}\n\nconst DOC_FILE = /^docs\\/([^/]+)\\/(.+)$/;\nconst PROMPT_FILE = /^prompts\\/([^/]+)\\.md$/;\n\nexport function createCodesignMcpServer(\n opts: CodesignMcpServerOptions\n): Server {\n const scheme = opts.resourceScheme ?? 'codesign';\n const assets = opts.assets;\n\n // `instructions` is intentionally short — it tells the model what the\n // server is and STRONGLY directs it to call `codesign_read_codesign_system`\n // before its first design_exec. Skills are now first-class tools (not MCP\n // resources buried in an XML block), so discovery happens via tools/list\n // on every host without needing ReadMcpResourceTool support.\n //\n // Why short: Claude Code wraps MCP `instructions` in a <system-reminder>\n // and truncates long ones mid-stream. Keeping `instructions` under ~1.5 KB\n // ensures the whole pointer survives any sane truncation.\n //\n // The asset-generation hint is included only when an `asset_generate` tool\n // is actually registered (Local hides it without an API_KEY), so we never\n // advertise a tool the model can't see in tools/list.\n const hasAssetGenerate = (opts.tools ?? []).some(\n (t) => t.name === 'asset_generate'\n );\n const instructions = [\n 'This is the **codesign** MCP server. It hosts a CE.SDK CreativeEngine and a persistent design workspace (revision DAG) for vector design + print-quality PDF output.',\n '',\n '**Required first step** — before any `edit`, call `handbook` (no args). It teaches the mandatory `parent` argument, dirty-on-throw safety, rewind recovery via `list`/`history`, the typeface schema setFont requires, and the runtime quirks that bite first attempts. Skipping it produces broken output.',\n '',\n 'Reference docs, on demand:',\n '- `api({ path?, offset?, limit? })` — CE.SDK TypeScript signatures.',\n '- `guide({ path? })` — CE.SDK Vanilla JS reference docs / topic guides.',\n '',\n 'Design tools (after reading the handbook):',\n '- `edit({ parent, code, title?, note? })` — mutate the canvas; `parent` is REQUIRED (revision id, or null for a new design).',\n '- `preview({ blockId, revision? })` — render a block to an inline image.',\n '- `export({ target, format, revision, blockId })` — render a block to pdf/image and write it into the workspace.',\n '- `save({ revision, outPath? })` — write a self-contained `.zip` archive (scene + assets) of a revision into the workspace.',\n '',\n 'Workspace tools (for resuming + navigating across designs):',\n '- `list()` — every design in the workspace, newest first.',\n '- `history({ revision })` — walk back to the root; how you re-ground after a rewind.',\n '- `inspect({ revision })` — read one revision in full, including the code that produced it (patterns, not block ids).',\n '- `rename({ revision, title })` — rename a design.',\n '- `open_editor({ revision? })` — URL the human can open to view the design.',\n '- `asset_search({ sourceId?, query? })` — browse asset sources; apply results in `edit`.'\n ]\n .concat(\n hasAssetGenerate\n ? [\n '',\n 'Asset generation:',\n \"- `asset_generate({ kind: 'image', prompt, width?, height? })` — opt-in (Local needs API_KEY); Hosted is cost-gated.\"\n ]\n : []\n )\n .join('\\n');\n\n // Build the resource map up-front: URI → rewritten markdown body. Cross-refs\n // inside doc content are rewritten to absolute MCP URIs so the model never\n // has to resolve a relative path against a doc dir.\n const rewrittenContent = new Map<string, string>();\n for (const [key, content] of Object.entries(assets)) {\n const m = key.match(DOC_FILE);\n if (!m) continue;\n const [, doc, rest] = m;\n const uri = `${scheme}://docs/${doc}/${rest}`;\n rewrittenContent.set(uri, rewriteSkillLinks(content, doc, scheme));\n }\n\n // Index prompts by name (frontmatter `name`, falling back to filename).\n const prompts = new Map<string, { description: string; body: string }>();\n for (const [key, content] of Object.entries(assets)) {\n const m = key.match(PROMPT_FILE);\n if (!m) continue;\n const front = parseFrontmatter(content);\n const name = front.name ?? m[1];\n prompts.set(name, {\n description: front.description ?? '',\n body: front.body\n });\n }\n\n const server = new Server(\n { name: 'codesign', version: opts.buildId ?? 'dev' },\n {\n capabilities: { resources: {}, prompts: {}, tools: {} },\n instructions\n }\n );\n\n // `resources/list` advertises only the per-skill SKILL.md (the entry\n // point), not the 392 nested cesdk-guide files. Sub-files stay readable\n // via `resources/read` against any cached URI, but skill content discovery\n // happens through the codesign_read_* tools — those are the universal\n // surface across MCP hosts.\n server.setRequestHandler(ListResourcesRequestSchema, async () => ({\n resources: Array.from(rewrittenContent.keys())\n .filter((uri) => uri.endsWith('/SKILL.md'))\n .map((uri) => ({\n uri,\n mimeType: 'text/markdown',\n name: uri.replace(`${scheme}://`, '')\n }))\n }));\n\n server.setRequestHandler(ReadResourceRequestSchema, async (req) => {\n const text = rewrittenContent.get(req.params.uri);\n if (text === undefined) {\n throw new McpError(\n ErrorCode.InvalidParams,\n `Unknown resource: ${req.params.uri}`\n );\n }\n return {\n contents: [{ uri: req.params.uri, mimeType: 'text/markdown', text }]\n };\n });\n\n server.setRequestHandler(ListPromptsRequestSchema, async () => ({\n prompts: Array.from(prompts.entries()).map(([name, p]) => ({\n name,\n description: p.description\n }))\n }));\n\n server.setRequestHandler(GetPromptRequestSchema, async (req) => {\n const p = prompts.get(req.params.name);\n if (!p) {\n throw new McpError(\n ErrorCode.InvalidParams,\n `Unknown prompt: ${req.params.name}`\n );\n }\n return {\n messages: [\n {\n role: 'user',\n content: { type: 'text', text: p.body }\n }\n ]\n };\n });\n\n // Tools registered with the server: caller-supplied design tools + the\n // auto-generated skill-read tools (one per skill in the asset bundle).\n // The skill tools always come first so Level 1 wording in the design tool\n // descriptions (\"call codesign_read_codesign_system first\") points at\n // something the model already sees in tools/list.\n const tools = new Map<string, CodesignMcpToolRegistration>();\n for (const t of buildSkillReadTools(assets)) tools.set(t.name, t);\n for (const t of opts.tools ?? []) tools.set(t.name, t);\n\n server.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: Array.from(tools.values()).map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema as never\n }))\n }));\n\n server.setRequestHandler(CallToolRequestSchema, async (req) => {\n const t = tools.get(req.params.name);\n if (!t) {\n throw new McpError(\n ErrorCode.InvalidParams,\n `Unknown tool: ${req.params.name}`\n );\n }\n // No recorder → byte-for-byte the original behaviour (the off-switch).\n if (!opts.metrics) return await t.call(req.params.arguments ?? {});\n\n const startedAt = performance.now();\n let ok = true;\n try {\n const res = await t.call(req.params.arguments ?? {});\n ok = res.isError !== true;\n return res;\n } catch (err) {\n ok = false;\n throw err;\n } finally {\n opts.metrics.record({\n tool: req.params.name,\n durationMs: performance.now() - startedAt,\n ok\n });\n }\n });\n\n return server;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,0BAA0B,EAC1B,sBAAsB,EACtB,QAAQ,EACR,yBAAyB,EAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AA0CvD,MAAM,QAAQ,GAAG,uBAAuB,CAAC;AAEzC,MAAM,UAAU,uBAAuB,CACrC,IAA8B;IAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,IAAI,UAAU,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAE3B,sEAAsE;IACtE,4EAA4E;IAC5E,mEAAmE;IACnE,yEAAyE;IACzE,6DAA6D;IAC7D,EAAE;IACF,yEAAyE;IACzE,2EAA2E;IAC3E,0DAA0D;IAC1D,EAAE;IACF,2EAA2E;IAC3E,0EAA0E;IAC1E,sDAAsD;IACtD,MAAM,gBAAgB,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAC9C,CAAC,CAAC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estSchema,\n McpError,\n ReadResourceRequestSchema\n} from '@modelcontextprotocol/sdk/types.js';\nimport { rewriteSkillLinks } from './cross-ref.js';\nimport { buildSkillReadTools } from './skill-tools.js';\n\n/**\n * One tool the server exposes via tools/list + tools/call. Caller-supplied so\n * the engine-bound implementations live near the surface that owns the engine\n * (the demo passes its existing `createDesignTools` output adapted to this\n * shape; an external bootstrap could pass server-side equivalents).\n */\nexport interface CodesignMcpToolRegistration {\n name: string;\n description?: string;\n /** JSON Schema describing the tool's input arguments. */\n inputSchema: unknown;\n call: (args: unknown) => Promise<{\n content: Array<\n | { type: 'text'; text: string }\n | { type: 'image'; data: string; mimeType: string }\n >;\n isError?: boolean;\n }>;\n}\n\nexport interface CodesignMcpServerOptions {\n /**\n * Asset bundle. Keys are forward-slash paths under one of:\n * \"docs/<doc>/SKILL.md\" — entry point for handbook / api / guide\n * \"docs/<doc>/<file>\" — sub-files reachable via the doc tools\n * Values are file contents.\n */\n assets: Record<string, string>;\n /** URI scheme for resources. Default: \"codesign\". */\n resourceScheme?: string;\n /** Tools to expose via tools/list + tools/call. */\n tools?: CodesignMcpToolRegistration[];\n /**\n * Build identity reported as `serverInfo.version` on `initialize`. A client\n * (the deploy smoketest) can assert it to confirm it's talking to the\n * just-deployed build, not a stale container. Default `'dev'`.\n */\n buildId?: string;\n}\n\nconst DOC_FILE = /^docs\\/([^/]+)\\/(.+)$/;\n\nexport function createCodesignMcpServer(\n opts: CodesignMcpServerOptions\n): Server {\n const scheme = opts.resourceScheme ?? 'codesign';\n const assets = opts.assets;\n\n // `instructions` is intentionally short — it tells the model what the\n // server is and STRONGLY directs it to call `codesign_read_codesign_system`\n // before its first edit. Skills are now first-class tools (not MCP\n // resources buried in an XML block), so discovery happens via tools/list\n // on every host without needing ReadMcpResourceTool support.\n //\n // Why short: Claude Code wraps MCP `instructions` in a <system-reminder>\n // and truncates long ones mid-stream. Keeping `instructions` under ~1.5 KB\n // ensures the whole pointer survives any sane truncation.\n //\n // The asset-generation hint is included only when an `asset_generate` tool\n // is actually registered (Local hides it without an API_KEY), so we never\n // advertise a tool the model can't see in tools/list.\n const hasAssetGenerate = (opts.tools ?? []).some(\n (t) => t.name === 'asset_generate'\n );\n const instructions = [\n 'This is the **codesign** MCP server. It hosts a CE.SDK CreativeEngine and a persistent design workspace (revision DAG) for vector design + print-quality PDF output.',\n '',\n '**Required first step** — before any `edit`, call `handbook` (no args). It teaches the mandatory `parent` argument, dirty-on-throw safety, rewind recovery via `list`/`history`, the typeface schema setFont requires, and the runtime quirks that bite first attempts. Skipping it produces broken output.',\n '',\n 'Reference docs, on demand:',\n '- `api({ path?, offset?, limit? })` — CE.SDK TypeScript signatures.',\n '- `guide({ path? })` — CE.SDK Vanilla JS reference docs / topic guides.',\n '',\n 'Design tools (after reading the handbook):',\n '- `edit({ parent, code, title?, note? })` — mutate the canvas; `parent` is REQUIRED (revision id, or null for a new design).',\n '- `preview({ blockId, revision? })` — render a block to an inline image.',\n '- `export({ target, format, revision, blockId })` — render a block to pdf/image and write it into the workspace.',\n '- `save({ revision, outPath? })` — write a self-contained `.zip` archive (scene + assets) of a revision into the workspace.',\n '',\n 'Workspace tools (for resuming + navigating across designs):',\n '- `list()` — every design in the workspace, newest first.',\n '- `history({ revision })` — walk back to the root; how you re-ground after a rewind.',\n '- `inspect({ revision })` — read one revision in full, including the code that produced it (patterns, not block ids).',\n '- `rename({ revision, title })` — rename a design.',\n '- `open_editor({ revision? })` — URL the human can open to view the design.',\n '- `asset_search({ sourceId?, query? })` — browse asset sources; apply results in `edit`.'\n ]\n .concat(\n hasAssetGenerate\n ? [\n '',\n 'Asset generation:',\n \"- `asset_generate({ kind: 'image', prompt, width?, height? })` — opt-in (Local needs API_KEY); Hosted is cost-gated.\"\n ]\n : []\n )\n .join('\\n');\n\n // Build the resource map up-front: URI → rewritten markdown body. Cross-refs\n // inside doc content are rewritten to absolute MCP URIs so the model never\n // has to resolve a relative path against a doc dir.\n const rewrittenContent = new Map<string, string>();\n for (const [key, content] of Object.entries(assets)) {\n const m = key.match(DOC_FILE);\n if (!m) continue;\n const [, doc, rest] = m;\n const uri = `${scheme}://docs/${doc}/${rest}`;\n rewrittenContent.set(uri, rewriteSkillLinks(content, doc, scheme));\n }\n\n const server = new Server(\n { name: 'codesign', version: opts.buildId ?? 'dev' },\n {\n capabilities: { resources: {}, tools: {} },\n instructions\n }\n );\n\n // `resources/list` advertises only the per-skill SKILL.md (the entry\n // point), not the 392 nested cesdk-guide files. Sub-files stay readable\n // via `resources/read` against any cached URI, but skill content discovery\n // happens through the codesign_read_* tools — those are the universal\n // surface across MCP hosts.\n server.setRequestHandler(ListResourcesRequestSchema, async () => ({\n resources: Array.from(rewrittenContent.keys())\n .filter((uri) => uri.endsWith('/SKILL.md'))\n .map((uri) => ({\n uri,\n mimeType: 'text/markdown',\n name: uri.replace(`${scheme}://`, '')\n }))\n }));\n\n server.setRequestHandler(ReadResourceRequestSchema, async (req) => {\n const text = rewrittenContent.get(req.params.uri);\n if (text === undefined) {\n throw new McpError(\n ErrorCode.InvalidParams,\n `Unknown resource: ${req.params.uri}`\n );\n }\n return {\n contents: [{ uri: req.params.uri, mimeType: 'text/markdown', text }]\n };\n });\n\n // Tools registered with the server: caller-supplied design tools + the\n // auto-generated skill-read tools (one per skill in the asset bundle).\n // The skill tools always come first so Level 1 wording in the design tool\n // descriptions (\"call codesign_read_codesign_system first\") points at\n // something the model already sees in tools/list.\n const tools = new Map<string, CodesignMcpToolRegistration>();\n for (const t of buildSkillReadTools(assets)) tools.set(t.name, t);\n for (const t of opts.tools ?? []) tools.set(t.name, t);\n\n server.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: Array.from(tools.values()).map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema as never\n }))\n }));\n\n server.setRequestHandler(CallToolRequestSchema, async (req) => {\n const t = tools.get(req.params.name);\n if (!t) {\n throw new McpError(\n ErrorCode.InvalidParams,\n `Unknown tool: ${req.params.name}`\n );\n }\n return await t.call(req.params.arguments ?? {});\n });\n\n return server;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog-add.d.ts","sourceRoot":"","sources":["../../../scripts/changelog-add.ts"],"names":[],"mappings":";AAOA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAWlB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Create a new changelog-next entry from the template.
|
|
3
|
+
// Run via `node --experimental-strip-types` (see package.json).
|
|
4
|
+
import { copyFile, access } from 'node:fs/promises';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
|
+
export function entryFileName(name) {
|
|
8
|
+
const sanitized = name
|
|
9
|
+
.replace(/[\\/]/g, '-')
|
|
10
|
+
.replace(/^-+/, '')
|
|
11
|
+
.replace(/\.md$/i, '');
|
|
12
|
+
return `${sanitized}.md`;
|
|
13
|
+
}
|
|
14
|
+
export async function addEntry(opts) {
|
|
15
|
+
const target = join(opts.entriesDir, entryFileName(opts.name));
|
|
16
|
+
let exists = true;
|
|
17
|
+
try {
|
|
18
|
+
await access(target);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
exists = false;
|
|
22
|
+
}
|
|
23
|
+
if (exists)
|
|
24
|
+
throw new Error(`entry already exists: ${target}`);
|
|
25
|
+
await copyFile(opts.templatePath, target);
|
|
26
|
+
return target;
|
|
27
|
+
}
|
|
28
|
+
async function main() {
|
|
29
|
+
const name = process.argv[2];
|
|
30
|
+
if (!name) {
|
|
31
|
+
console.error('usage: node --experimental-strip-types scripts/changelog-add.ts <name>');
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
35
|
+
const entriesDir = join(here, '..', 'changelog-next');
|
|
36
|
+
const target = await addEntry({
|
|
37
|
+
templatePath: join(entriesDir, '-template.md'),
|
|
38
|
+
entriesDir,
|
|
39
|
+
name
|
|
40
|
+
});
|
|
41
|
+
console.log(`created ${target} — edit it and commit.`);
|
|
42
|
+
}
|
|
43
|
+
if (process.argv[1] &&
|
|
44
|
+
import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
45
|
+
main().catch((err) => {
|
|
46
|
+
console.error(err instanceof Error ? err.message : String(err));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=changelog-add.js.map
|