semiotic 3.8.8 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -66
- package/agent-skill/semiotic-charts/SKILL.md +11 -2
- package/ai/behaviorContracts.cjs +33 -3
- package/ai/cli.js +53 -2
- package/ai/componentMetadata.cjs +15 -0
- package/ai/dist/mcp-server.js +1530 -611
- package/ai/examples.md +48 -42
- package/{CLAUDE.md → ai/reference.md} +46 -24
- package/ai/schema.json +10704 -825
- package/ai/surface-manifest.json +643 -2
- package/ai/system-prompt.md +83 -130
- package/dist/c-3BLJEQNG.min.js +1 -0
- package/dist/c-3KZD6AXJ.min.js +1 -0
- package/dist/c-4TWEX5HG.min.js +1 -0
- package/dist/c-52TEGIUJ.min.js +1 -0
- package/dist/c-5YCIX3VZ.min.js +1 -0
- package/dist/c-6FEKTA3U.min.js +1 -0
- package/dist/c-6O5EVOPH.min.js +1 -0
- package/dist/c-74HEEZGK.min.js +1 -0
- package/dist/c-AKAF6JAD.min.js +1 -0
- package/dist/c-BBKITSXB.min.js +1 -0
- package/dist/c-BWNB6USU.min.js +1 -0
- package/dist/c-C25ENHIK.min.js +1 -0
- package/dist/c-CDR5AO3R.min.js +1 -0
- package/dist/c-COHXCW3Q.min.js +1 -0
- package/dist/{chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js → c-DADXPJXV.min.js} +0 -1
- package/dist/c-E3JFRRMI.min.js +1 -0
- package/dist/c-EBFPQHHO.min.js +1 -0
- package/dist/c-G36WS6LN.min.js +1 -0
- package/dist/c-GIKRQI4X.min.js +1 -0
- package/dist/c-GPYOFETM.min.js +1 -0
- package/dist/c-IDUHYYSI.min.js +1 -0
- package/dist/{chunk-chunk-FQPKOAIH.module.min.js → c-IUHFPMHD.min.js} +0 -1
- package/dist/c-J5G56TUH.min.js +1 -0
- package/dist/c-JAZ73J32.min.js +1 -0
- package/dist/c-KG3NXHAL.min.js +1 -0
- package/dist/c-KII3PLZE.min.js +1 -0
- package/dist/c-LIXGXMNS.min.js +1 -0
- package/dist/c-LVEY6D6B.min.js +1 -0
- package/dist/c-M4Y3BHFR.min.js +1 -0
- package/dist/c-MAIICR2Z.min.js +1 -0
- package/dist/c-MG5DM6VE.min.js +1 -0
- package/dist/{chunk-minimapBrushOverlay-JU57U7NM.module.min.js → c-MNF2S4AA.min.js} +0 -1
- package/dist/c-MT3WBK7M.min.js +1 -0
- package/dist/c-NY3JWV2K.min.js +1 -0
- package/dist/c-O6U6K4CW.min.js +1 -0
- package/dist/c-OCI56QF2.min.js +1 -0
- package/dist/c-OQ7M4AGV.min.js +1 -0
- package/dist/c-OXYMVK7Q.min.js +1 -0
- package/dist/c-PPWDL5ZI.min.js +1 -0
- package/dist/c-QHF5YON3.min.js +1 -0
- package/dist/c-RR3GO5SW.min.js +1 -0
- package/dist/{chunk-chunk-J5QD4RAM.module.min.js → c-RSVIHIQ4.min.js} +0 -1
- package/dist/{chunk-chunk-EMO5NUGE.module.min.js → c-S2BXNNJN.min.js} +0 -1
- package/dist/{chunk-chunk-YCQYG6J5.module.min.js → c-SLGMUBUL.min.js} +0 -1
- package/dist/c-SUILCHWU.min.js +1 -0
- package/dist/c-TZW3JGJ5.min.js +1 -0
- package/dist/c-US5ZFT6E.min.js +1 -0
- package/dist/{chunk-chunk-RZH7VZYS.module.min.js → c-USFMFKIH.min.js} +0 -1
- package/dist/c-UUKVD4WB.min.js +1 -0
- package/dist/{chunk-chunk-SV4XAZ3Q.module.min.js → c-VGW3VG3I.min.js} +0 -1
- package/dist/c-W3CE4A4S.min.js +1 -0
- package/dist/{chunk-chunk-2NVFEB7P.module.min.js → c-WJCD5EUY.min.js} +0 -1
- package/dist/{chunk-chunk-2JGJ5GUG.module.min.js → c-X5UBGU2V.min.js} +0 -1
- package/dist/c-YDAY2WFR.min.js +1 -0
- package/dist/c-ZOWWU34K.min.js +1 -0
- package/dist/components/AccessibleNavTree.d.ts +1 -1
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/GradientLegend.d.ts +14 -0
- package/dist/components/Legend.d.ts +2 -7
- package/dist/components/LinkedCharts.d.ts +1 -1
- package/dist/components/MobileAnnotationCalloutList.d.ts +1 -1
- package/dist/components/ObservationReadout.d.ts +45 -0
- package/dist/components/ThemeProvider.d.ts +4 -4
- package/dist/components/Tooltip/FlippingTooltip.d.ts +5 -7
- package/dist/components/Tooltip/Tooltip.d.ts +83 -5
- package/dist/components/Tooltip/tooltipChrome.d.ts +43 -0
- package/dist/components/ai/chartCapabilityTypes.d.ts +86 -2
- package/dist/components/ai/chartClinic.d.ts +2 -0
- package/dist/components/ai/deriveProfileFields.d.ts +40 -0
- package/dist/components/ai/evaluateChart.d.ts +85 -0
- package/dist/components/ai/fieldPolicy.d.ts +7 -0
- package/dist/components/ai/fieldRoles.d.ts +24 -0
- package/dist/components/ai/generativeChart.d.ts +18 -2
- package/dist/components/ai/inferIntent.d.ts +26 -2
- package/dist/components/ai/intents.d.ts +35 -0
- package/dist/components/ai/navigationTree.d.ts +2 -2
- package/dist/components/ai/observedSceneAudit.d.ts +2 -1
- package/dist/components/ai/profileData.d.ts +11 -0
- package/dist/components/ai/repairChartConfig.d.ts +2 -3
- package/dist/components/ai/semanticEvidence.d.ts +4 -0
- package/dist/components/ai/semanticViability.d.ts +11 -0
- package/dist/components/ai/semanticViabilityRegistry.d.ts +5 -0
- package/dist/components/ai/streamingTypes.d.ts +4 -0
- package/dist/components/ai/suggestCharts.d.ts +5 -6
- package/dist/components/ai/suggestDashboard.d.ts +2 -3
- package/dist/components/ai/suggestStreamCharts.d.ts +1 -1
- package/dist/components/ai/suggestStretchCharts.d.ts +2 -3
- package/dist/components/ai/suggestionPropContracts.d.ts +20 -0
- package/dist/components/ai/variantDiscovery.d.ts +3 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +3 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +3 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +1 -1
- package/dist/components/charts/geo/ChoroplethMap.d.ts +3 -1
- package/dist/components/charts/geo/DistanceCartogram.d.ts +2 -7
- package/dist/components/charts/geo/cartogramOverlay.d.ts +28 -0
- package/dist/components/charts/index.d.ts +4 -3
- package/dist/components/charts/network/ProcessSankey.d.ts +2 -136
- package/dist/components/charts/network/ProcessSankeyProps.d.ts +139 -0
- package/dist/components/charts/network/Treemap.d.ts +2 -1
- package/dist/components/charts/network/processSankey/boundaryHubOrdering.d.ts +23 -0
- package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +2 -0
- package/dist/components/charts/network/processSankey/ordering.d.ts +3 -41
- package/dist/components/charts/network/processSankey/orderingTypes.d.ts +32 -0
- package/dist/components/charts/network/processSankey/packing.d.ts +1 -1
- package/dist/components/charts/network/processSankey/packingCache.d.ts +1 -1
- package/dist/components/charts/network/processSankey/packingOptimization.d.ts +72 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +4 -3
- package/dist/components/charts/ordinal/FunnelChart.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -2
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +4 -3
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +2 -2
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +2 -9
- package/dist/components/charts/physics/GauntletChart.d.ts +10 -41
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +1 -1
- package/dist/components/charts/physics/chainReactionAccessibleTable.d.ts +9 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +2 -1
- package/dist/components/charts/physics/chainReactionTypes.d.ts +6 -1
- package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +2 -2
- package/dist/components/charts/physics/crucibleClone.d.ts +6 -0
- package/dist/components/charts/physics/crucibleEffects.d.ts +1 -2
- package/dist/components/charts/physics/crucibleRecord.d.ts +7 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +4 -4
- package/dist/components/charts/physics/gauntletPhysics.d.ts +1 -0
- package/dist/components/charts/physics/gauntletPublic.d.ts +4 -0
- package/dist/components/charts/physics/packetFlowOverlay.d.ts +7 -0
- package/dist/components/charts/physics/physicsChartLayout.d.ts +8 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +3 -1
- package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
- package/dist/components/charts/physics/physicsHocUtils.d.ts +26 -13
- package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +24 -0
- package/dist/components/charts/physics/processFlowOverlays.d.ts +9 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +17 -12
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +12 -7
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +37 -14
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +23 -14
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +22 -13
- package/dist/components/charts/realtime/aggregate.d.ts +4 -1
- package/dist/components/charts/realtime/eventTime.d.ts +4 -0
- package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +27 -0
- package/dist/components/charts/realtime/realtimeChartTypes.d.ts +30 -0
- package/dist/components/charts/realtime/useRealtimeCategoryColors.d.ts +30 -0
- package/dist/components/charts/shared/FrameTextAnnotationSVG.d.ts +10 -0
- package/dist/components/charts/shared/annotationActivation.d.ts +3 -7
- package/dist/components/charts/shared/annotationBandFill.d.ts +6 -0
- package/dist/components/charts/shared/annotationDispatch.d.ts +31 -0
- package/dist/components/charts/shared/annotationIdentity.d.ts +8 -0
- package/dist/components/charts/shared/annotationRules.d.ts +1 -15
- package/dist/components/charts/shared/boundedCategoryRegistry.d.ts +8 -0
- package/dist/components/charts/shared/chainReactionChartSpec.d.ts +3 -0
- package/dist/components/charts/shared/chartMode.d.ts +3 -2
- package/dist/components/charts/shared/chartSpecCore.d.ts +1 -0
- package/dist/components/charts/shared/formatUtils.d.ts +40 -9
- package/dist/components/charts/shared/frameTextAnnotation.d.ts +63 -0
- package/dist/components/charts/shared/gradient.d.ts +16 -0
- package/dist/components/charts/shared/hatchFill.d.ts +15 -0
- package/dist/components/charts/shared/hooks.d.ts +4 -4
- package/dist/components/charts/shared/legendUtils.d.ts +1 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +3 -1
- package/dist/components/charts/shared/styleRules.d.ts +9 -2
- package/dist/components/charts/shared/styleRulesWireSchema.d.ts +353 -0
- package/dist/components/charts/shared/types.d.ts +26 -10
- package/dist/components/charts/shared/useChartLegend.d.ts +43 -9
- package/dist/components/charts/shared/useChartSetup.d.ts +3 -1
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +5 -2
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +5 -1
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +3 -3
- package/dist/components/charts/shared/useStreamingLegend.d.ts +6 -1
- package/dist/components/charts/value/types.d.ts +1 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
- package/dist/components/charts/xy/BumpChart.capability.d.ts +14 -1
- package/dist/components/charts/xy/BumpChart.d.ts +13 -73
- package/dist/components/charts/xy/BumpChart.semanticViability.d.ts +5 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +2 -2
- package/dist/components/charts/xy/LineChart.d.ts +2 -2
- package/dist/components/charts/xy/Scatterplot.d.ts +1 -1
- package/dist/components/charts/xy/bumpData.d.ts +44 -0
- package/dist/components/charts/xy/bumpIdentity.d.ts +2 -0
- package/dist/components/charts/xy/bumpLayout.d.ts +45 -0
- package/dist/components/charts/xy/bumpTooltip.d.ts +20 -0
- package/dist/components/legendLayout.d.ts +131 -4
- package/dist/components/realtime/ReorderBuffer.d.ts +2 -0
- package/dist/components/realtime/types.d.ts +10 -1
- package/dist/components/recipes/balanceSnapshotsToFlows.d.ts +42 -0
- package/dist/components/recipes/directedReachability.d.ts +14 -0
- package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +6 -6
- package/dist/components/recipes/gridObservatory.d.ts +1 -1
- package/dist/components/recipes/networkAnalysis.d.ts +1 -18
- package/dist/components/recipes/physics.d.ts +7 -4
- package/dist/components/recipes/processPhysics.d.ts +0 -1
- package/dist/components/recipes/waffle.d.ts +7 -4
- package/dist/components/semiotic-ai-core.d.ts +13 -4
- package/dist/components/semiotic-ai-observations.d.ts +3 -0
- package/dist/components/semiotic-ai.d.ts +16 -9
- package/dist/components/semiotic-client-shared.d.ts +10 -0
- package/dist/components/semiotic-experimental.d.ts +1 -1
- package/dist/components/semiotic-geo.d.ts +4 -1
- package/dist/components/semiotic-network.d.ts +7 -4
- package/dist/components/semiotic-ordinal.d.ts +4 -1
- package/dist/components/semiotic-physics.d.ts +11 -4
- package/dist/components/semiotic-realtime-core.d.ts +11 -4
- package/dist/components/semiotic-realtime-react.d.ts +4 -3
- package/dist/components/semiotic-realtime.d.ts +3 -1
- package/dist/components/semiotic-recipes-core.d.ts +7 -5
- package/dist/components/semiotic-server-edge.d.ts +3 -2
- package/dist/components/semiotic-server.d.ts +3 -2
- package/dist/components/semiotic-themes-core.d.ts +5 -48
- package/dist/components/semiotic-utils-core.d.ts +11 -5
- package/dist/components/semiotic-utils-react.d.ts +2 -0
- package/dist/components/semiotic-xy.d.ts +4 -1
- package/dist/components/semiotic.d.ts +68 -25
- package/dist/components/server/animatedGif.d.ts +1 -1
- package/dist/components/server/renderEvidence.d.ts +25 -2
- package/dist/components/server/renderToStaticSVG.d.ts +15 -7
- package/dist/components/server/serverChartConfigShared.d.ts +8 -1
- package/dist/components/server/serverChartConfigs.d.ts +1 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +3 -3
- package/dist/components/server/serverChartConfigsNetworkChord.d.ts +2 -0
- package/dist/components/server/serverChartConfigsNetworkForce.d.ts +2 -0
- package/dist/components/server/serverChartConfigsNetworkHierarchy.d.ts +3 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +3 -3
- package/dist/components/server/serverChartConfigsXYBubble.d.ts +5 -0
- package/dist/components/server/serverChartConfigsXYBump.d.ts +7 -0
- package/dist/components/server/serverChartConfigsXYScatter.d.ts +5 -0
- package/dist/components/server/staticAnnotationFallbacks.d.ts +10 -0
- package/dist/components/server/staticAnnotations.d.ts +28 -1
- package/dist/components/server/staticAxisTickLabel.d.ts +13 -0
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticLegendMargin.d.ts +41 -0
- package/dist/components/server/staticOrdinal.d.ts +8 -2
- package/dist/components/server/staticPhysics.d.ts +13 -1
- package/dist/components/server/staticPhysicsChrome.d.ts +20 -0
- package/dist/components/server/staticRawLegend.d.ts +15 -0
- package/dist/components/server/staticSVGChrome.d.ts +16 -55
- package/dist/components/server/staticXYAxes.d.ts +27 -0
- package/dist/components/server/staticXYAxisTicks.d.ts +39 -0
- package/dist/components/server/staticXYGrid.d.ts +11 -0
- package/dist/components/server/themeResolver.d.ts +5 -1
- package/dist/components/store/ThemeStore.d.ts +2 -98
- package/dist/components/store/designTokens.d.ts +1 -1
- package/dist/components/store/themeCSSVariables.d.ts +10 -0
- package/dist/components/store/themeCore.d.ts +91 -0
- package/dist/components/store/themePresets.d.ts +81 -0
- package/dist/components/store/themeSerialization.d.ts +2 -1
- package/dist/components/stream/AccessibleDataTable.d.ts +12 -14
- package/dist/components/stream/AccessibleTablePortalImpl.d.ts +6 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +3 -0
- package/dist/components/stream/NetworkCanvasHitTester.d.ts +3 -1
- package/dist/components/stream/NetworkSSRFrame.d.ts +2 -1
- package/dist/components/stream/NetworkSVGOverlay.d.ts +3 -31
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -0
- package/dist/components/stream/SVGChartTitle.d.ts +9 -0
- package/dist/components/stream/SVGOverlay.d.ts +1 -21
- package/dist/components/stream/SVGUnderlay.d.ts +24 -0
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +1 -1
- package/dist/components/stream/accessibleDataRows.d.ts +11 -0
- package/dist/components/stream/accessibleDataTableModel.d.ts +40 -0
- package/dist/components/stream/accessibleTableTypes.d.ts +11 -0
- package/dist/components/stream/axisTickUtils.d.ts +19 -0
- package/dist/components/stream/canvasBackground.d.ts +10 -0
- package/dist/components/stream/canvasSetup.d.ts +24 -4
- package/dist/components/stream/frameCursorInteraction.d.ts +25 -0
- package/dist/components/stream/frameDefaultMargins.d.ts +37 -0
- package/dist/components/stream/frameGraphics.d.ts +18 -0
- package/dist/components/stream/frameGraphicsSubscription.d.ts +26 -0
- package/dist/components/stream/frameLegendOptions.d.ts +18 -0
- package/dist/components/stream/geoFrameCursorInteraction.d.ts +9 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +29 -1
- package/dist/components/stream/geoTypes.d.ts +12 -11
- package/dist/components/stream/hitTarget.d.ts +61 -2
- package/dist/components/stream/moduleWorkerSession.d.ts +6 -0
- package/dist/components/stream/networkAnnotationAnchors.d.ts +37 -0
- package/dist/components/stream/networkCustomLayout.d.ts +2 -2
- package/dist/components/stream/networkFrameCursorInteraction.d.ts +12 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +2 -0
- package/dist/components/stream/networkFramePaint.d.ts +15 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +1 -1
- package/dist/components/stream/networkTypes.d.ts +32 -32
- package/dist/components/stream/normalizeXYData.d.ts +7 -0
- package/dist/components/stream/ordinalFrameCursorInteraction.d.ts +7 -0
- package/dist/components/stream/ordinalFrameInteraction.d.ts +29 -0
- package/dist/components/stream/ordinalSceneSVG.d.ts +10 -0
- package/dist/components/stream/ordinalTypes.d.ts +12 -4
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +9 -1
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +0 -3
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +4 -1
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +3 -24
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +9 -21
- package/dist/components/stream/physics/PhysicsSettledSVGElement.d.ts +37 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +7 -3
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +1 -1
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +25 -4
- package/dist/components/stream/physics/physicsAnnotationContext.d.ts +19 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +4 -0
- package/dist/components/stream/physics/physicsSettledChrome.d.ts +7 -0
- package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +32 -0
- package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +36 -0
- package/dist/components/stream/pipelineConfig.d.ts +8 -17
- package/dist/components/stream/pipelineDomainResolution.d.ts +2 -2
- package/dist/components/stream/renderBackend.d.ts +2 -0
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +13 -2
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +7 -0
- package/dist/components/stream/responsiveSize.d.ts +17 -0
- package/dist/components/stream/sceneCursor.d.ts +41 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +1 -1
- package/dist/components/stream/svgOverlayUtils.d.ts +22 -1
- package/dist/components/stream/types.d.ts +33 -13
- package/dist/components/stream/useCanvasFrameHost.d.ts +12 -1
- package/dist/components/stream/useFrame.d.ts +24 -1
- package/dist/components/stream/useResponsiveSize.d.ts +6 -1
- package/dist/components/stream/useStalenessCheck.d.ts +1 -1
- package/dist/components/stream/xyFrameAxisTypes.d.ts +20 -4
- package/dist/components/stream/xyFrameCursorInteraction.d.ts +6 -0
- package/dist/components/stream/xySceneBuilders/swarmScene.d.ts +1 -1
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -26
- package/dist/components/types/legendTypes.d.ts +6 -0
- package/dist/components/types/marginType.d.ts +7 -8
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/forceLayoutWorker.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/processSankeyLayoutWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.d.ts +13 -4
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +16 -9
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +1 -0
- package/dist/semiotic-client-glyph.module.min.js +2 -0
- package/dist/semiotic-client-responsive.module.min.js +2 -0
- package/dist/semiotic-client-shared.module.min.js +2 -0
- package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental-auxiliary.module.min.js +2 -0
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +2 -0
- package/dist/semiotic-experimental-node.module.min.js +2 -0
- package/dist/semiotic-experimental-react-shared.module.min.js +2 -0
- package/dist/semiotic-experimental-vacp.min.js +1 -1
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +4 -1
- package/dist/semiotic-network.d.ts +7 -4
- package/dist/semiotic-ordinal.d.ts +4 -1
- package/dist/semiotic-physics.d.ts +11 -4
- package/dist/semiotic-realtime-core.d.ts +11 -4
- package/dist/semiotic-realtime-core.min.js +2 -1
- package/dist/semiotic-realtime-core.module.min.js +2 -1
- package/dist/semiotic-realtime-react.d.ts +4 -3
- package/dist/semiotic-realtime-react.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +3 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -0
- package/dist/semiotic-recipes-core.d.ts +7 -5
- package/dist/semiotic-recipes-core.min.js +9 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-geo-cjs.min.js +1 -0
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-recipes-react.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +7 -1
- package/dist/semiotic-recipes.module.min.js +2 -1
- package/dist/semiotic-server-edge-node.module.min.js +1 -0
- package/dist/semiotic-server-edge.d.ts +3 -2
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-server.d.ts +3 -2
- package/dist/semiotic-themes-core.d.ts +5 -48
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils-core.d.ts +11 -5
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils-react.d.ts +2 -0
- package/dist/semiotic-utils-react.min.js +1 -1
- package/dist/semiotic-utils-react.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +2 -1
- package/dist/semiotic-utils.module.min.js +2 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +4 -1
- package/dist/semiotic.d.ts +68 -25
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +53 -19
- package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +0 -20
- package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +0 -2
- package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +0 -1
- package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +0 -2
- package/dist/chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js +0 -2
- package/dist/chunk-chunk-2B3AIKUZ.module.min.js +0 -2
- package/dist/chunk-chunk-2CXCXRB4.module.min.js +0 -1
- package/dist/chunk-chunk-3GCILWPB.module.min.js +0 -2
- package/dist/chunk-chunk-46KRGJQP.module.min.js +0 -1
- package/dist/chunk-chunk-4ITOQRXM.module.min.js +0 -2
- package/dist/chunk-chunk-4MLLQUGW.module.min.js +0 -2
- package/dist/chunk-chunk-57RBPDBQ.module.min.js +0 -2
- package/dist/chunk-chunk-5UKL5W76.module.min.js +0 -2
- package/dist/chunk-chunk-5VVNW5AZ.module.min.js +0 -1
- package/dist/chunk-chunk-66PCWJUG.module.min.js +0 -1
- package/dist/chunk-chunk-6V5VQVCT.module.min.js +0 -2
- package/dist/chunk-chunk-7LE56WAE.module.min.js +0 -2
- package/dist/chunk-chunk-7T25U75Z.module.min.js +0 -2
- package/dist/chunk-chunk-ACLDBMRH.module.min.js +0 -2
- package/dist/chunk-chunk-AF53TBSN.module.min.js +0 -2
- package/dist/chunk-chunk-BTZYH2IE.module.min.js +0 -1
- package/dist/chunk-chunk-BWV55BZK.module.min.js +0 -2
- package/dist/chunk-chunk-BZNOAHJV.module.min.js +0 -2
- package/dist/chunk-chunk-CD6PVVS3.module.min.js +0 -2
- package/dist/chunk-chunk-DTSNLGRK.module.min.js +0 -2
- package/dist/chunk-chunk-FC3NZWYR.module.min.js +0 -2
- package/dist/chunk-chunk-FEPXDKJP.module.min.js +0 -1
- package/dist/chunk-chunk-FJ76HWQZ.module.min.js +0 -1
- package/dist/chunk-chunk-FRGBMTZR.module.min.js +0 -1
- package/dist/chunk-chunk-G75OPF5N.module.min.js +0 -2
- package/dist/chunk-chunk-H5IFO6CU.module.min.js +0 -2
- package/dist/chunk-chunk-HADHLMY5.module.min.js +0 -1
- package/dist/chunk-chunk-HBFA4NN6.module.min.js +0 -1
- package/dist/chunk-chunk-HCNDE26Q.module.min.js +0 -2
- package/dist/chunk-chunk-IY7RYD4S.module.min.js +0 -1
- package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
- package/dist/chunk-chunk-J3XWETBJ.module.min.js +0 -2
- package/dist/chunk-chunk-JJ4BSUYL.module.min.js +0 -2
- package/dist/chunk-chunk-JRHXQGEV.module.min.js +0 -2
- package/dist/chunk-chunk-KTWEBFMX.module.min.js +0 -2
- package/dist/chunk-chunk-L6FFYGYS.module.min.js +0 -1
- package/dist/chunk-chunk-LJDH3WV3.module.min.js +0 -2
- package/dist/chunk-chunk-LSJUXBMF.module.min.js +0 -1
- package/dist/chunk-chunk-N3Q33XCB.module.min.js +0 -2
- package/dist/chunk-chunk-NWIGA3UK.module.min.js +0 -1
- package/dist/chunk-chunk-OG3TTJGJ.module.min.js +0 -2
- package/dist/chunk-chunk-OZK46A5U.module.min.js +0 -1
- package/dist/chunk-chunk-PMR47KRY.module.min.js +0 -2
- package/dist/chunk-chunk-Q2YADC2V.module.min.js +0 -2
- package/dist/chunk-chunk-QQJNG23C.module.min.js +0 -2
- package/dist/chunk-chunk-RGJ6TKAH.module.min.js +0 -2
- package/dist/chunk-chunk-ROP4HI7H.module.min.js +0 -2
- package/dist/chunk-chunk-SFLUSZ73.module.min.js +0 -2
- package/dist/chunk-chunk-TCMHJWFJ.module.min.js +0 -1
- package/dist/chunk-chunk-TSCFL235.module.min.js +0 -1
- package/dist/chunk-chunk-U66USBWU.module.min.js +0 -1
- package/dist/chunk-chunk-UEZ6SHW5.module.min.js +0 -2
- package/dist/chunk-chunk-UOQRPGPK.module.min.js +0 -2
- package/dist/chunk-chunk-VUWYT7DY.module.min.js +0 -2
- package/dist/chunk-chunk-W5HWGQMD.module.min.js +0 -2
- package/dist/chunk-chunk-WFHZHWT7.module.min.js +0 -1
- package/dist/chunk-chunk-WGROBM3I.module.min.js +0 -2
- package/dist/chunk-chunk-WSDJFBKX.module.min.js +0 -2
- package/dist/chunk-chunk-YHNZCPOZ.module.min.js +0 -2
- package/dist/chunk-chunk-YWZB3KPI.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +0 -2
- package/dist/components/stream/test-utils/frameScheduler.d.ts +0 -12
- package/dist/components/stream/test-utils/revisionConsumption.d.ts +0 -13
- package/dist/test-utils/canvasMock.d.ts +0 -86
- package/dist/test-utils/capturedFrameProps.d.ts +0 -67
- package/dist/test-utils/frameMock.d.ts +0 -81
- package/dist/test-utils/ordinalFixtures.d.ts +0 -48
- /package/dist/{chunk-chunk-JJ2OOIET.module.min.js → c-GGISSW5E.min.js} +0 -0
- /package/dist/{chunk-chunk-SIRIJ3DY.module.min.js → c-N4G2L7ID.min.js} +0 -0
- /package/dist/{chunk-chunk-CA3YDW6F.module.min.js → c-S6U5CGT5.min.js} +0 -0
- /package/dist/components/recipes/{mobileAnnotationStrategy.d.ts → mobileAnnotationBehavior.d.ts} +0 -0
package/ai/dist/mcp-server.js
CHANGED
|
@@ -411,11 +411,11 @@ var require_codegen = __commonJS({
|
|
|
411
411
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
412
412
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
413
413
|
}
|
|
414
|
-
optimizeNames(names,
|
|
414
|
+
optimizeNames(names, constants2) {
|
|
415
415
|
if (!names[this.name.str])
|
|
416
416
|
return;
|
|
417
417
|
if (this.rhs)
|
|
418
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
418
|
+
this.rhs = optimizeExpr(this.rhs, names, constants2);
|
|
419
419
|
return this;
|
|
420
420
|
}
|
|
421
421
|
get names() {
|
|
@@ -432,10 +432,10 @@ var require_codegen = __commonJS({
|
|
|
432
432
|
render({ _n }) {
|
|
433
433
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
434
434
|
}
|
|
435
|
-
optimizeNames(names,
|
|
435
|
+
optimizeNames(names, constants2) {
|
|
436
436
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
437
437
|
return;
|
|
438
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
438
|
+
this.rhs = optimizeExpr(this.rhs, names, constants2);
|
|
439
439
|
return this;
|
|
440
440
|
}
|
|
441
441
|
get names() {
|
|
@@ -496,8 +496,8 @@ var require_codegen = __commonJS({
|
|
|
496
496
|
optimizeNodes() {
|
|
497
497
|
return `${this.code}` ? this : void 0;
|
|
498
498
|
}
|
|
499
|
-
optimizeNames(names,
|
|
500
|
-
this.code = optimizeExpr(this.code, names,
|
|
499
|
+
optimizeNames(names, constants2) {
|
|
500
|
+
this.code = optimizeExpr(this.code, names, constants2);
|
|
501
501
|
return this;
|
|
502
502
|
}
|
|
503
503
|
get names() {
|
|
@@ -526,12 +526,12 @@ var require_codegen = __commonJS({
|
|
|
526
526
|
}
|
|
527
527
|
return nodes.length > 0 ? this : void 0;
|
|
528
528
|
}
|
|
529
|
-
optimizeNames(names,
|
|
529
|
+
optimizeNames(names, constants2) {
|
|
530
530
|
const { nodes } = this;
|
|
531
531
|
let i = nodes.length;
|
|
532
532
|
while (i--) {
|
|
533
533
|
const n = nodes[i];
|
|
534
|
-
if (n.optimizeNames(names,
|
|
534
|
+
if (n.optimizeNames(names, constants2))
|
|
535
535
|
continue;
|
|
536
536
|
subtractNames(names, n.names);
|
|
537
537
|
nodes.splice(i, 1);
|
|
@@ -584,12 +584,12 @@ var require_codegen = __commonJS({
|
|
|
584
584
|
return void 0;
|
|
585
585
|
return this;
|
|
586
586
|
}
|
|
587
|
-
optimizeNames(names,
|
|
587
|
+
optimizeNames(names, constants2) {
|
|
588
588
|
var _a2;
|
|
589
|
-
this.else = (_a2 = this.else) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names,
|
|
590
|
-
if (!(super.optimizeNames(names,
|
|
589
|
+
this.else = (_a2 = this.else) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names, constants2);
|
|
590
|
+
if (!(super.optimizeNames(names, constants2) || this.else))
|
|
591
591
|
return;
|
|
592
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
592
|
+
this.condition = optimizeExpr(this.condition, names, constants2);
|
|
593
593
|
return this;
|
|
594
594
|
}
|
|
595
595
|
get names() {
|
|
@@ -612,10 +612,10 @@ var require_codegen = __commonJS({
|
|
|
612
612
|
render(opts) {
|
|
613
613
|
return `for(${this.iteration})` + super.render(opts);
|
|
614
614
|
}
|
|
615
|
-
optimizeNames(names,
|
|
616
|
-
if (!super.optimizeNames(names,
|
|
615
|
+
optimizeNames(names, constants2) {
|
|
616
|
+
if (!super.optimizeNames(names, constants2))
|
|
617
617
|
return;
|
|
618
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
618
|
+
this.iteration = optimizeExpr(this.iteration, names, constants2);
|
|
619
619
|
return this;
|
|
620
620
|
}
|
|
621
621
|
get names() {
|
|
@@ -651,10 +651,10 @@ var require_codegen = __commonJS({
|
|
|
651
651
|
render(opts) {
|
|
652
652
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
653
653
|
}
|
|
654
|
-
optimizeNames(names,
|
|
655
|
-
if (!super.optimizeNames(names,
|
|
654
|
+
optimizeNames(names, constants2) {
|
|
655
|
+
if (!super.optimizeNames(names, constants2))
|
|
656
656
|
return;
|
|
657
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
657
|
+
this.iterable = optimizeExpr(this.iterable, names, constants2);
|
|
658
658
|
return this;
|
|
659
659
|
}
|
|
660
660
|
get names() {
|
|
@@ -696,11 +696,11 @@ var require_codegen = __commonJS({
|
|
|
696
696
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
697
697
|
return this;
|
|
698
698
|
}
|
|
699
|
-
optimizeNames(names,
|
|
699
|
+
optimizeNames(names, constants2) {
|
|
700
700
|
var _a2, _b;
|
|
701
|
-
super.optimizeNames(names,
|
|
702
|
-
(_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names,
|
|
703
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
701
|
+
super.optimizeNames(names, constants2);
|
|
702
|
+
(_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names, constants2);
|
|
703
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants2);
|
|
704
704
|
return this;
|
|
705
705
|
}
|
|
706
706
|
get names() {
|
|
@@ -1001,7 +1001,7 @@ var require_codegen = __commonJS({
|
|
|
1001
1001
|
function addExprNames(names, from) {
|
|
1002
1002
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
1003
1003
|
}
|
|
1004
|
-
function optimizeExpr(expr, names,
|
|
1004
|
+
function optimizeExpr(expr, names, constants2) {
|
|
1005
1005
|
if (expr instanceof code_1.Name)
|
|
1006
1006
|
return replaceName(expr);
|
|
1007
1007
|
if (!canOptimize(expr))
|
|
@@ -1016,14 +1016,14 @@ var require_codegen = __commonJS({
|
|
|
1016
1016
|
return items;
|
|
1017
1017
|
}, []));
|
|
1018
1018
|
function replaceName(n) {
|
|
1019
|
-
const c =
|
|
1019
|
+
const c = constants2[n.str];
|
|
1020
1020
|
if (c === void 0 || names[n.str] !== 1)
|
|
1021
1021
|
return n;
|
|
1022
1022
|
delete names[n.str];
|
|
1023
1023
|
return c;
|
|
1024
1024
|
}
|
|
1025
1025
|
function canOptimize(e) {
|
|
1026
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
1026
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants2[c.str] !== void 0);
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
1029
|
function subtractNames(names, from) {
|
|
@@ -6916,6 +6916,110 @@ var require_dist = __commonJS({
|
|
|
6916
6916
|
}
|
|
6917
6917
|
});
|
|
6918
6918
|
|
|
6919
|
+
// node_modules/content-type/index.js
|
|
6920
|
+
var require_content_type = __commonJS({
|
|
6921
|
+
"node_modules/content-type/index.js"(exports2) {
|
|
6922
|
+
"use strict";
|
|
6923
|
+
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
6924
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
6925
|
+
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
6926
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
6927
|
+
var QUOTE_REGEXP = /([\\"])/g;
|
|
6928
|
+
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
6929
|
+
exports2.format = format;
|
|
6930
|
+
exports2.parse = parse3;
|
|
6931
|
+
function format(obj) {
|
|
6932
|
+
if (!obj || typeof obj !== "object") {
|
|
6933
|
+
throw new TypeError("argument obj is required");
|
|
6934
|
+
}
|
|
6935
|
+
var parameters = obj.parameters;
|
|
6936
|
+
var type = obj.type;
|
|
6937
|
+
if (!type || !TYPE_REGEXP.test(type)) {
|
|
6938
|
+
throw new TypeError("invalid type");
|
|
6939
|
+
}
|
|
6940
|
+
var string4 = type;
|
|
6941
|
+
if (parameters && typeof parameters === "object") {
|
|
6942
|
+
var param;
|
|
6943
|
+
var params = Object.keys(parameters).sort();
|
|
6944
|
+
for (var i = 0; i < params.length; i++) {
|
|
6945
|
+
param = params[i];
|
|
6946
|
+
if (!TOKEN_REGEXP.test(param)) {
|
|
6947
|
+
throw new TypeError("invalid parameter name");
|
|
6948
|
+
}
|
|
6949
|
+
string4 += "; " + param + "=" + qstring(parameters[param]);
|
|
6950
|
+
}
|
|
6951
|
+
}
|
|
6952
|
+
return string4;
|
|
6953
|
+
}
|
|
6954
|
+
function parse3(string4) {
|
|
6955
|
+
if (!string4) {
|
|
6956
|
+
throw new TypeError("argument string is required");
|
|
6957
|
+
}
|
|
6958
|
+
var header = typeof string4 === "object" ? getcontenttype(string4) : string4;
|
|
6959
|
+
if (typeof header !== "string") {
|
|
6960
|
+
throw new TypeError("argument string is required to be a string");
|
|
6961
|
+
}
|
|
6962
|
+
var index = header.indexOf(";");
|
|
6963
|
+
var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
6964
|
+
if (!TYPE_REGEXP.test(type)) {
|
|
6965
|
+
throw new TypeError("invalid media type");
|
|
6966
|
+
}
|
|
6967
|
+
var obj = new ContentType(type.toLowerCase());
|
|
6968
|
+
if (index !== -1) {
|
|
6969
|
+
var key;
|
|
6970
|
+
var match;
|
|
6971
|
+
var value;
|
|
6972
|
+
PARAM_REGEXP.lastIndex = index;
|
|
6973
|
+
while (match = PARAM_REGEXP.exec(header)) {
|
|
6974
|
+
if (match.index !== index) {
|
|
6975
|
+
throw new TypeError("invalid parameter format");
|
|
6976
|
+
}
|
|
6977
|
+
index += match[0].length;
|
|
6978
|
+
key = match[1].toLowerCase();
|
|
6979
|
+
value = match[2];
|
|
6980
|
+
if (value.charCodeAt(0) === 34) {
|
|
6981
|
+
value = value.slice(1, -1);
|
|
6982
|
+
if (value.indexOf("\\") !== -1) {
|
|
6983
|
+
value = value.replace(QESC_REGEXP, "$1");
|
|
6984
|
+
}
|
|
6985
|
+
}
|
|
6986
|
+
obj.parameters[key] = value;
|
|
6987
|
+
}
|
|
6988
|
+
if (index !== header.length) {
|
|
6989
|
+
throw new TypeError("invalid parameter format");
|
|
6990
|
+
}
|
|
6991
|
+
}
|
|
6992
|
+
return obj;
|
|
6993
|
+
}
|
|
6994
|
+
function getcontenttype(obj) {
|
|
6995
|
+
var header;
|
|
6996
|
+
if (typeof obj.getHeader === "function") {
|
|
6997
|
+
header = obj.getHeader("content-type");
|
|
6998
|
+
} else if (typeof obj.headers === "object") {
|
|
6999
|
+
header = obj.headers && obj.headers["content-type"];
|
|
7000
|
+
}
|
|
7001
|
+
if (typeof header !== "string") {
|
|
7002
|
+
throw new TypeError("content-type header is missing from object");
|
|
7003
|
+
}
|
|
7004
|
+
return header;
|
|
7005
|
+
}
|
|
7006
|
+
function qstring(val) {
|
|
7007
|
+
var str = String(val);
|
|
7008
|
+
if (TOKEN_REGEXP.test(str)) {
|
|
7009
|
+
return str;
|
|
7010
|
+
}
|
|
7011
|
+
if (str.length > 0 && !TEXT_REGEXP.test(str)) {
|
|
7012
|
+
throw new TypeError("invalid parameter value");
|
|
7013
|
+
}
|
|
7014
|
+
return '"' + str.replace(QUOTE_REGEXP, "\\$1") + '"';
|
|
7015
|
+
}
|
|
7016
|
+
function ContentType(type) {
|
|
7017
|
+
this.parameters = /* @__PURE__ */ Object.create(null);
|
|
7018
|
+
this.type = type;
|
|
7019
|
+
}
|
|
7020
|
+
}
|
|
7021
|
+
});
|
|
7022
|
+
|
|
6919
7023
|
// ai/componentMetadata.cjs
|
|
6920
7024
|
var require_componentMetadata = __commonJS({
|
|
6921
7025
|
"ai/componentMetadata.cjs"(exports2, module2) {
|
|
@@ -7000,6 +7104,9 @@ var require_componentMetadata = __commonJS({
|
|
|
7000
7104
|
COMPONENT_TO_CATEGORY.set(name, category);
|
|
7001
7105
|
}
|
|
7002
7106
|
}
|
|
7107
|
+
var AI_EXPORT_ONLY_CATEGORIES = {
|
|
7108
|
+
PhysicsCustomChart: "physics"
|
|
7109
|
+
};
|
|
7003
7110
|
function schemaEntries(schema2) {
|
|
7004
7111
|
return schema2.tools.map((tool) => tool.function);
|
|
7005
7112
|
}
|
|
@@ -7010,6 +7117,9 @@ var require_componentMetadata = __commonJS({
|
|
|
7010
7117
|
}
|
|
7011
7118
|
return category;
|
|
7012
7119
|
}
|
|
7120
|
+
function categoryForAIExport(name) {
|
|
7121
|
+
return COMPONENT_TO_CATEGORY.get(name) ?? AI_EXPORT_ONLY_CATEGORIES[name];
|
|
7122
|
+
}
|
|
7013
7123
|
function importPathForCategory(category) {
|
|
7014
7124
|
if (category === "physics") return "semiotic/physics";
|
|
7015
7125
|
return category === "geo" ? "semiotic/geo" : `semiotic/${category}`;
|
|
@@ -7023,6 +7133,7 @@ var require_componentMetadata = __commonJS({
|
|
|
7023
7133
|
category,
|
|
7024
7134
|
importPath: importPathForCategory(category),
|
|
7025
7135
|
renderable: !isPushOnly,
|
|
7136
|
+
requiresLiveData: isPushOnly,
|
|
7026
7137
|
description: typeof entryOrName === "string" ? void 0 : entryOrName.description
|
|
7027
7138
|
};
|
|
7028
7139
|
}
|
|
@@ -7050,6 +7161,7 @@ var require_componentMetadata = __commonJS({
|
|
|
7050
7161
|
totalComponents: components.length,
|
|
7051
7162
|
renderableComponents: components.filter((component) => component.renderable).length,
|
|
7052
7163
|
browserOnlyComponents: components.filter((component) => !component.renderable).length,
|
|
7164
|
+
requiresLiveDataComponents: components.filter((component) => component.requiresLiveData).length,
|
|
7053
7165
|
categories,
|
|
7054
7166
|
components
|
|
7055
7167
|
};
|
|
@@ -7058,6 +7170,7 @@ var require_componentMetadata = __commonJS({
|
|
|
7058
7170
|
CATEGORY_ORDER,
|
|
7059
7171
|
COMPONENTS_BY_CATEGORY,
|
|
7060
7172
|
categoryForComponent,
|
|
7173
|
+
categoryForAIExport,
|
|
7061
7174
|
componentIndexFromSchema: componentIndexFromSchema2,
|
|
7062
7175
|
findComponent,
|
|
7063
7176
|
importPathForCategory,
|
|
@@ -7093,9 +7206,9 @@ var require_chartSuggestions = __commonJS({
|
|
|
7093
7206
|
];
|
|
7094
7207
|
for (const candidate of candidates) {
|
|
7095
7208
|
try {
|
|
7096
|
-
const
|
|
7097
|
-
if (
|
|
7098
|
-
_capabilityMatrix =
|
|
7209
|
+
const json3 = require(candidate);
|
|
7210
|
+
if (json3 && json3.charts) {
|
|
7211
|
+
_capabilityMatrix = json3.charts;
|
|
7099
7212
|
_capabilityMatrixLoaded = true;
|
|
7100
7213
|
return _capabilityMatrix;
|
|
7101
7214
|
}
|
|
@@ -7603,7 +7716,19 @@ var require_behaviorContracts = __commonJS({
|
|
|
7603
7716
|
severity: "warning",
|
|
7604
7717
|
appliesTo: {},
|
|
7605
7718
|
summary: "High-level charts expose title for the visible name, description for a concise accessible description, summary for a screen-reader-only takeaway and interaction guidance, and accessibleTable for the data-table fallback.",
|
|
7606
|
-
agentAction:
|
|
7719
|
+
agentAction: 'Put title, description, summary, and accessibleTable directly on the chart component when they appear in its schema. If a consumer-owned role=img wraps the chart, use accessibleTable: { portalTarget: "element-id" } and render that target outside the image. For generated L1\u2013L3 description or a navigable chart tree, use ChartContainer with chartConfig plus describe and/or navigable; do not invent frameProps fields.'
|
|
7720
|
+
},
|
|
7721
|
+
{
|
|
7722
|
+
id: "interaction.cursor-is-presentation-only",
|
|
7723
|
+
category: "interaction",
|
|
7724
|
+
title: "Cursor styling does not create behavior",
|
|
7725
|
+
severity: "warning",
|
|
7726
|
+
appliesTo: {
|
|
7727
|
+
propsAny: ["cursor"],
|
|
7728
|
+
propPathsAny: [["styleRules", "*", "style", "cursor"]]
|
|
7729
|
+
},
|
|
7730
|
+
summary: "Cursor values in realtime props, retained mark styles, styleRules, and custom hit targets change pointer presentation only. They do not install click handlers, keyboard activation, observations, or accessibility semantics.",
|
|
7731
|
+
agentAction: "Use an actionable cursor only when the application separately supplies documented click or observation behavior and an accessible activation path. Treat cursor in serialized/static output as visual metadata, never as proof that a mark is interactive."
|
|
7607
7732
|
},
|
|
7608
7733
|
{
|
|
7609
7734
|
id: "props.data-required-by-usage-mode",
|
|
@@ -7756,8 +7881,20 @@ var require_behaviorContracts = __commonJS({
|
|
|
7756
7881
|
}
|
|
7757
7882
|
function appliesToProps(contract, props) {
|
|
7758
7883
|
const propsAny = contract.appliesTo?.propsAny;
|
|
7759
|
-
|
|
7760
|
-
|
|
7884
|
+
const propPathsAny = contract.appliesTo?.propPathsAny;
|
|
7885
|
+
if ((!propsAny || propsAny.length === 0) && (!propPathsAny || propPathsAny.length === 0))
|
|
7886
|
+
return true;
|
|
7887
|
+
if (propsAny?.some((prop) => hasOwn(props, prop) && props[prop] !== void 0)) return true;
|
|
7888
|
+
return propPathsAny?.some((path3) => hasDefinedPath(props, path3)) ?? false;
|
|
7889
|
+
}
|
|
7890
|
+
function hasDefinedPath(value, path3) {
|
|
7891
|
+
if (path3.length === 0) return value !== void 0;
|
|
7892
|
+
if (value === null || typeof value !== "object") return false;
|
|
7893
|
+
const [segment, ...rest] = path3;
|
|
7894
|
+
if (segment === "*") {
|
|
7895
|
+
return Array.isArray(value) && value.some((item) => hasDefinedPath(item, rest));
|
|
7896
|
+
}
|
|
7897
|
+
return hasOwn(value, segment) && hasDefinedPath(value[segment], rest);
|
|
7761
7898
|
}
|
|
7762
7899
|
function behaviorContractsFor2({ component, props } = {}) {
|
|
7763
7900
|
const normalizedProps = normalizeProps(props);
|
|
@@ -22720,29 +22857,29 @@ var formatMap = {
|
|
|
22720
22857
|
// do not set
|
|
22721
22858
|
};
|
|
22722
22859
|
var stringProcessor = (schema2, ctx, _json, _params) => {
|
|
22723
|
-
const
|
|
22724
|
-
|
|
22860
|
+
const json3 = _json;
|
|
22861
|
+
json3.type = "string";
|
|
22725
22862
|
const { minimum, maximum, format, patterns, contentEncoding } = schema2._zod.bag;
|
|
22726
22863
|
if (typeof minimum === "number")
|
|
22727
|
-
|
|
22864
|
+
json3.minLength = minimum;
|
|
22728
22865
|
if (typeof maximum === "number")
|
|
22729
|
-
|
|
22866
|
+
json3.maxLength = maximum;
|
|
22730
22867
|
if (format) {
|
|
22731
|
-
|
|
22732
|
-
if (
|
|
22733
|
-
delete
|
|
22868
|
+
json3.format = formatMap[format] ?? format;
|
|
22869
|
+
if (json3.format === "")
|
|
22870
|
+
delete json3.format;
|
|
22734
22871
|
if (format === "time") {
|
|
22735
|
-
delete
|
|
22872
|
+
delete json3.format;
|
|
22736
22873
|
}
|
|
22737
22874
|
}
|
|
22738
22875
|
if (contentEncoding)
|
|
22739
|
-
|
|
22876
|
+
json3.contentEncoding = contentEncoding;
|
|
22740
22877
|
if (patterns && patterns.size > 0) {
|
|
22741
22878
|
const regexes = [...patterns];
|
|
22742
22879
|
if (regexes.length === 1)
|
|
22743
|
-
|
|
22880
|
+
json3.pattern = regexes[0].source;
|
|
22744
22881
|
else if (regexes.length > 1) {
|
|
22745
|
-
|
|
22882
|
+
json3.allOf = [
|
|
22746
22883
|
...regexes.map((regex) => ({
|
|
22747
22884
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
22748
22885
|
pattern: regex.source
|
|
@@ -22752,51 +22889,51 @@ var stringProcessor = (schema2, ctx, _json, _params) => {
|
|
|
22752
22889
|
}
|
|
22753
22890
|
};
|
|
22754
22891
|
var numberProcessor = (schema2, ctx, _json, _params) => {
|
|
22755
|
-
const
|
|
22892
|
+
const json3 = _json;
|
|
22756
22893
|
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema2._zod.bag;
|
|
22757
22894
|
if (typeof format === "string" && format.includes("int"))
|
|
22758
|
-
|
|
22895
|
+
json3.type = "integer";
|
|
22759
22896
|
else
|
|
22760
|
-
|
|
22897
|
+
json3.type = "number";
|
|
22761
22898
|
if (typeof exclusiveMinimum === "number") {
|
|
22762
22899
|
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
22763
|
-
|
|
22764
|
-
|
|
22900
|
+
json3.minimum = exclusiveMinimum;
|
|
22901
|
+
json3.exclusiveMinimum = true;
|
|
22765
22902
|
} else {
|
|
22766
|
-
|
|
22903
|
+
json3.exclusiveMinimum = exclusiveMinimum;
|
|
22767
22904
|
}
|
|
22768
22905
|
}
|
|
22769
22906
|
if (typeof minimum === "number") {
|
|
22770
|
-
|
|
22907
|
+
json3.minimum = minimum;
|
|
22771
22908
|
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
22772
22909
|
if (exclusiveMinimum >= minimum)
|
|
22773
|
-
delete
|
|
22910
|
+
delete json3.minimum;
|
|
22774
22911
|
else
|
|
22775
|
-
delete
|
|
22912
|
+
delete json3.exclusiveMinimum;
|
|
22776
22913
|
}
|
|
22777
22914
|
}
|
|
22778
22915
|
if (typeof exclusiveMaximum === "number") {
|
|
22779
22916
|
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
22780
|
-
|
|
22781
|
-
|
|
22917
|
+
json3.maximum = exclusiveMaximum;
|
|
22918
|
+
json3.exclusiveMaximum = true;
|
|
22782
22919
|
} else {
|
|
22783
|
-
|
|
22920
|
+
json3.exclusiveMaximum = exclusiveMaximum;
|
|
22784
22921
|
}
|
|
22785
22922
|
}
|
|
22786
22923
|
if (typeof maximum === "number") {
|
|
22787
|
-
|
|
22924
|
+
json3.maximum = maximum;
|
|
22788
22925
|
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
22789
22926
|
if (exclusiveMaximum <= maximum)
|
|
22790
|
-
delete
|
|
22927
|
+
delete json3.maximum;
|
|
22791
22928
|
else
|
|
22792
|
-
delete
|
|
22929
|
+
delete json3.exclusiveMaximum;
|
|
22793
22930
|
}
|
|
22794
22931
|
}
|
|
22795
22932
|
if (typeof multipleOf === "number")
|
|
22796
|
-
|
|
22933
|
+
json3.multipleOf = multipleOf;
|
|
22797
22934
|
};
|
|
22798
|
-
var booleanProcessor = (_schema, _ctx,
|
|
22799
|
-
|
|
22935
|
+
var booleanProcessor = (_schema, _ctx, json3, _params) => {
|
|
22936
|
+
json3.type = "boolean";
|
|
22800
22937
|
};
|
|
22801
22938
|
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
22802
22939
|
if (ctx.unrepresentable === "throw") {
|
|
@@ -22808,13 +22945,13 @@ var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
|
22808
22945
|
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
22809
22946
|
}
|
|
22810
22947
|
};
|
|
22811
|
-
var nullProcessor = (_schema, ctx,
|
|
22948
|
+
var nullProcessor = (_schema, ctx, json3, _params) => {
|
|
22812
22949
|
if (ctx.target === "openapi-3.0") {
|
|
22813
|
-
|
|
22814
|
-
|
|
22815
|
-
|
|
22950
|
+
json3.type = "string";
|
|
22951
|
+
json3.nullable = true;
|
|
22952
|
+
json3.enum = [null];
|
|
22816
22953
|
} else {
|
|
22817
|
-
|
|
22954
|
+
json3.type = "null";
|
|
22818
22955
|
}
|
|
22819
22956
|
};
|
|
22820
22957
|
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
@@ -22827,8 +22964,8 @@ var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
|
22827
22964
|
throw new Error("Void cannot be represented in JSON Schema");
|
|
22828
22965
|
}
|
|
22829
22966
|
};
|
|
22830
|
-
var neverProcessor = (_schema, _ctx,
|
|
22831
|
-
|
|
22967
|
+
var neverProcessor = (_schema, _ctx, json3, _params) => {
|
|
22968
|
+
json3.not = {};
|
|
22832
22969
|
};
|
|
22833
22970
|
var anyProcessor = (_schema, _ctx, _json, _params) => {
|
|
22834
22971
|
};
|
|
@@ -22839,16 +22976,16 @@ var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
|
22839
22976
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
22840
22977
|
}
|
|
22841
22978
|
};
|
|
22842
|
-
var enumProcessor = (schema2, _ctx,
|
|
22979
|
+
var enumProcessor = (schema2, _ctx, json3, _params) => {
|
|
22843
22980
|
const def = schema2._zod.def;
|
|
22844
22981
|
const values = getEnumValues(def.entries);
|
|
22845
22982
|
if (values.every((v) => typeof v === "number"))
|
|
22846
|
-
|
|
22983
|
+
json3.type = "number";
|
|
22847
22984
|
if (values.every((v) => typeof v === "string"))
|
|
22848
|
-
|
|
22849
|
-
|
|
22985
|
+
json3.type = "string";
|
|
22986
|
+
json3.enum = values;
|
|
22850
22987
|
};
|
|
22851
|
-
var literalProcessor = (schema2, ctx,
|
|
22988
|
+
var literalProcessor = (schema2, ctx, json3, _params) => {
|
|
22852
22989
|
const def = schema2._zod.def;
|
|
22853
22990
|
const vals = [];
|
|
22854
22991
|
for (const val of def.values) {
|
|
@@ -22870,22 +23007,22 @@ var literalProcessor = (schema2, ctx, json2, _params) => {
|
|
|
22870
23007
|
if (vals.length === 0) {
|
|
22871
23008
|
} else if (vals.length === 1) {
|
|
22872
23009
|
const val = vals[0];
|
|
22873
|
-
|
|
23010
|
+
json3.type = val === null ? "null" : typeof val;
|
|
22874
23011
|
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
22875
|
-
|
|
23012
|
+
json3.enum = [val];
|
|
22876
23013
|
} else {
|
|
22877
|
-
|
|
23014
|
+
json3.const = val;
|
|
22878
23015
|
}
|
|
22879
23016
|
} else {
|
|
22880
23017
|
if (vals.every((v) => typeof v === "number"))
|
|
22881
|
-
|
|
23018
|
+
json3.type = "number";
|
|
22882
23019
|
if (vals.every((v) => typeof v === "string"))
|
|
22883
|
-
|
|
23020
|
+
json3.type = "string";
|
|
22884
23021
|
if (vals.every((v) => typeof v === "boolean"))
|
|
22885
|
-
|
|
23022
|
+
json3.type = "boolean";
|
|
22886
23023
|
if (vals.every((v) => v === null))
|
|
22887
|
-
|
|
22888
|
-
|
|
23024
|
+
json3.type = "null";
|
|
23025
|
+
json3.enum = vals;
|
|
22889
23026
|
}
|
|
22890
23027
|
};
|
|
22891
23028
|
var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
@@ -22893,16 +23030,16 @@ var nanProcessor = (_schema, ctx, _json, _params) => {
|
|
|
22893
23030
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
22894
23031
|
}
|
|
22895
23032
|
};
|
|
22896
|
-
var templateLiteralProcessor = (schema2, _ctx,
|
|
22897
|
-
const _json =
|
|
23033
|
+
var templateLiteralProcessor = (schema2, _ctx, json3, _params) => {
|
|
23034
|
+
const _json = json3;
|
|
22898
23035
|
const pattern = schema2._zod.pattern;
|
|
22899
23036
|
if (!pattern)
|
|
22900
23037
|
throw new Error("Pattern not found in template literal");
|
|
22901
23038
|
_json.type = "string";
|
|
22902
23039
|
_json.pattern = pattern.source;
|
|
22903
23040
|
};
|
|
22904
|
-
var fileProcessor = (schema2, _ctx,
|
|
22905
|
-
const _json =
|
|
23041
|
+
var fileProcessor = (schema2, _ctx, json3, _params) => {
|
|
23042
|
+
const _json = json3;
|
|
22906
23043
|
const file2 = {
|
|
22907
23044
|
type: "string",
|
|
22908
23045
|
format: "binary",
|
|
@@ -22925,8 +23062,8 @@ var fileProcessor = (schema2, _ctx, json2, _params) => {
|
|
|
22925
23062
|
Object.assign(_json, file2);
|
|
22926
23063
|
}
|
|
22927
23064
|
};
|
|
22928
|
-
var successProcessor = (_schema, _ctx,
|
|
22929
|
-
|
|
23065
|
+
var successProcessor = (_schema, _ctx, json3, _params) => {
|
|
23066
|
+
json3.type = "boolean";
|
|
22930
23067
|
};
|
|
22931
23068
|
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
22932
23069
|
if (ctx.unrepresentable === "throw") {
|
|
@@ -22954,24 +23091,24 @@ var setProcessor = (_schema, ctx, _json, _params) => {
|
|
|
22954
23091
|
}
|
|
22955
23092
|
};
|
|
22956
23093
|
var arrayProcessor = (schema2, ctx, _json, params) => {
|
|
22957
|
-
const
|
|
23094
|
+
const json3 = _json;
|
|
22958
23095
|
const def = schema2._zod.def;
|
|
22959
23096
|
const { minimum, maximum } = schema2._zod.bag;
|
|
22960
23097
|
if (typeof minimum === "number")
|
|
22961
|
-
|
|
23098
|
+
json3.minItems = minimum;
|
|
22962
23099
|
if (typeof maximum === "number")
|
|
22963
|
-
|
|
22964
|
-
|
|
22965
|
-
|
|
23100
|
+
json3.maxItems = maximum;
|
|
23101
|
+
json3.type = "array";
|
|
23102
|
+
json3.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
22966
23103
|
};
|
|
22967
23104
|
var objectProcessor = (schema2, ctx, _json, params) => {
|
|
22968
|
-
const
|
|
23105
|
+
const json3 = _json;
|
|
22969
23106
|
const def = schema2._zod.def;
|
|
22970
|
-
|
|
22971
|
-
|
|
23107
|
+
json3.type = "object";
|
|
23108
|
+
json3.properties = {};
|
|
22972
23109
|
const shape = def.shape;
|
|
22973
23110
|
for (const key in shape) {
|
|
22974
|
-
|
|
23111
|
+
json3.properties[key] = process2(shape[key], ctx, {
|
|
22975
23112
|
...params,
|
|
22976
23113
|
path: [...params.path, "properties", key]
|
|
22977
23114
|
});
|
|
@@ -22986,21 +23123,21 @@ var objectProcessor = (schema2, ctx, _json, params) => {
|
|
|
22986
23123
|
}
|
|
22987
23124
|
}));
|
|
22988
23125
|
if (requiredKeys.size > 0) {
|
|
22989
|
-
|
|
23126
|
+
json3.required = Array.from(requiredKeys);
|
|
22990
23127
|
}
|
|
22991
23128
|
if (def.catchall?._zod.def.type === "never") {
|
|
22992
|
-
|
|
23129
|
+
json3.additionalProperties = false;
|
|
22993
23130
|
} else if (!def.catchall) {
|
|
22994
23131
|
if (ctx.io === "output")
|
|
22995
|
-
|
|
23132
|
+
json3.additionalProperties = false;
|
|
22996
23133
|
} else if (def.catchall) {
|
|
22997
|
-
|
|
23134
|
+
json3.additionalProperties = process2(def.catchall, ctx, {
|
|
22998
23135
|
...params,
|
|
22999
23136
|
path: [...params.path, "additionalProperties"]
|
|
23000
23137
|
});
|
|
23001
23138
|
}
|
|
23002
23139
|
};
|
|
23003
|
-
var unionProcessor = (schema2, ctx,
|
|
23140
|
+
var unionProcessor = (schema2, ctx, json3, params) => {
|
|
23004
23141
|
const def = schema2._zod.def;
|
|
23005
23142
|
const isExclusive = def.inclusive === false;
|
|
23006
23143
|
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
@@ -23008,12 +23145,12 @@ var unionProcessor = (schema2, ctx, json2, params) => {
|
|
|
23008
23145
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
23009
23146
|
}));
|
|
23010
23147
|
if (isExclusive) {
|
|
23011
|
-
|
|
23148
|
+
json3.oneOf = options;
|
|
23012
23149
|
} else {
|
|
23013
|
-
|
|
23150
|
+
json3.anyOf = options;
|
|
23014
23151
|
}
|
|
23015
23152
|
};
|
|
23016
|
-
var intersectionProcessor = (schema2, ctx,
|
|
23153
|
+
var intersectionProcessor = (schema2, ctx, json3, params) => {
|
|
23017
23154
|
const def = schema2._zod.def;
|
|
23018
23155
|
const a = process2(def.left, ctx, {
|
|
23019
23156
|
...params,
|
|
@@ -23028,12 +23165,12 @@ var intersectionProcessor = (schema2, ctx, json2, params) => {
|
|
|
23028
23165
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
23029
23166
|
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
23030
23167
|
];
|
|
23031
|
-
|
|
23168
|
+
json3.allOf = allOf;
|
|
23032
23169
|
};
|
|
23033
23170
|
var tupleProcessor = (schema2, ctx, _json, params) => {
|
|
23034
|
-
const
|
|
23171
|
+
const json3 = _json;
|
|
23035
23172
|
const def = schema2._zod.def;
|
|
23036
|
-
|
|
23173
|
+
json3.type = "array";
|
|
23037
23174
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
23038
23175
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
23039
23176
|
const prefixItems = def.items.map((x, i) => process2(x, ctx, {
|
|
@@ -23045,37 +23182,37 @@ var tupleProcessor = (schema2, ctx, _json, params) => {
|
|
|
23045
23182
|
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
23046
23183
|
}) : null;
|
|
23047
23184
|
if (ctx.target === "draft-2020-12") {
|
|
23048
|
-
|
|
23185
|
+
json3.prefixItems = prefixItems;
|
|
23049
23186
|
if (rest) {
|
|
23050
|
-
|
|
23187
|
+
json3.items = rest;
|
|
23051
23188
|
}
|
|
23052
23189
|
} else if (ctx.target === "openapi-3.0") {
|
|
23053
|
-
|
|
23190
|
+
json3.items = {
|
|
23054
23191
|
anyOf: prefixItems
|
|
23055
23192
|
};
|
|
23056
23193
|
if (rest) {
|
|
23057
|
-
|
|
23194
|
+
json3.items.anyOf.push(rest);
|
|
23058
23195
|
}
|
|
23059
|
-
|
|
23196
|
+
json3.minItems = prefixItems.length;
|
|
23060
23197
|
if (!rest) {
|
|
23061
|
-
|
|
23198
|
+
json3.maxItems = prefixItems.length;
|
|
23062
23199
|
}
|
|
23063
23200
|
} else {
|
|
23064
|
-
|
|
23201
|
+
json3.items = prefixItems;
|
|
23065
23202
|
if (rest) {
|
|
23066
|
-
|
|
23203
|
+
json3.additionalItems = rest;
|
|
23067
23204
|
}
|
|
23068
23205
|
}
|
|
23069
23206
|
const { minimum, maximum } = schema2._zod.bag;
|
|
23070
23207
|
if (typeof minimum === "number")
|
|
23071
|
-
|
|
23208
|
+
json3.minItems = minimum;
|
|
23072
23209
|
if (typeof maximum === "number")
|
|
23073
|
-
|
|
23210
|
+
json3.maxItems = maximum;
|
|
23074
23211
|
};
|
|
23075
23212
|
var recordProcessor = (schema2, ctx, _json, params) => {
|
|
23076
|
-
const
|
|
23213
|
+
const json3 = _json;
|
|
23077
23214
|
const def = schema2._zod.def;
|
|
23078
|
-
|
|
23215
|
+
json3.type = "object";
|
|
23079
23216
|
const keyType = def.keyType;
|
|
23080
23217
|
const keyBag = keyType._zod.bag;
|
|
23081
23218
|
const patterns = keyBag?.patterns;
|
|
@@ -23084,18 +23221,18 @@ var recordProcessor = (schema2, ctx, _json, params) => {
|
|
|
23084
23221
|
...params,
|
|
23085
23222
|
path: [...params.path, "patternProperties", "*"]
|
|
23086
23223
|
});
|
|
23087
|
-
|
|
23224
|
+
json3.patternProperties = {};
|
|
23088
23225
|
for (const pattern of patterns) {
|
|
23089
|
-
|
|
23226
|
+
json3.patternProperties[pattern.source] = valueSchema;
|
|
23090
23227
|
}
|
|
23091
23228
|
} else {
|
|
23092
23229
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
23093
|
-
|
|
23230
|
+
json3.propertyNames = process2(def.keyType, ctx, {
|
|
23094
23231
|
...params,
|
|
23095
23232
|
path: [...params.path, "propertyNames"]
|
|
23096
23233
|
});
|
|
23097
23234
|
}
|
|
23098
|
-
|
|
23235
|
+
json3.additionalProperties = process2(def.valueType, ctx, {
|
|
23099
23236
|
...params,
|
|
23100
23237
|
path: [...params.path, "additionalProperties"]
|
|
23101
23238
|
});
|
|
@@ -23104,19 +23241,19 @@ var recordProcessor = (schema2, ctx, _json, params) => {
|
|
|
23104
23241
|
if (keyValues) {
|
|
23105
23242
|
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
23106
23243
|
if (validKeyValues.length > 0) {
|
|
23107
|
-
|
|
23244
|
+
json3.required = validKeyValues;
|
|
23108
23245
|
}
|
|
23109
23246
|
}
|
|
23110
23247
|
};
|
|
23111
|
-
var nullableProcessor = (schema2, ctx,
|
|
23248
|
+
var nullableProcessor = (schema2, ctx, json3, params) => {
|
|
23112
23249
|
const def = schema2._zod.def;
|
|
23113
23250
|
const inner = process2(def.innerType, ctx, params);
|
|
23114
23251
|
const seen = ctx.seen.get(schema2);
|
|
23115
23252
|
if (ctx.target === "openapi-3.0") {
|
|
23116
23253
|
seen.ref = def.innerType;
|
|
23117
|
-
|
|
23254
|
+
json3.nullable = true;
|
|
23118
23255
|
} else {
|
|
23119
|
-
|
|
23256
|
+
json3.anyOf = [inner, { type: "null" }];
|
|
23120
23257
|
}
|
|
23121
23258
|
};
|
|
23122
23259
|
var nonoptionalProcessor = (schema2, ctx, _json, params) => {
|
|
@@ -23125,22 +23262,22 @@ var nonoptionalProcessor = (schema2, ctx, _json, params) => {
|
|
|
23125
23262
|
const seen = ctx.seen.get(schema2);
|
|
23126
23263
|
seen.ref = def.innerType;
|
|
23127
23264
|
};
|
|
23128
|
-
var defaultProcessor = (schema2, ctx,
|
|
23265
|
+
var defaultProcessor = (schema2, ctx, json3, params) => {
|
|
23129
23266
|
const def = schema2._zod.def;
|
|
23130
23267
|
process2(def.innerType, ctx, params);
|
|
23131
23268
|
const seen = ctx.seen.get(schema2);
|
|
23132
23269
|
seen.ref = def.innerType;
|
|
23133
|
-
|
|
23270
|
+
json3.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
23134
23271
|
};
|
|
23135
|
-
var prefaultProcessor = (schema2, ctx,
|
|
23272
|
+
var prefaultProcessor = (schema2, ctx, json3, params) => {
|
|
23136
23273
|
const def = schema2._zod.def;
|
|
23137
23274
|
process2(def.innerType, ctx, params);
|
|
23138
23275
|
const seen = ctx.seen.get(schema2);
|
|
23139
23276
|
seen.ref = def.innerType;
|
|
23140
23277
|
if (ctx.io === "input")
|
|
23141
|
-
|
|
23278
|
+
json3._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
23142
23279
|
};
|
|
23143
|
-
var catchProcessor = (schema2, ctx,
|
|
23280
|
+
var catchProcessor = (schema2, ctx, json3, params) => {
|
|
23144
23281
|
const def = schema2._zod.def;
|
|
23145
23282
|
process2(def.innerType, ctx, params);
|
|
23146
23283
|
const seen = ctx.seen.get(schema2);
|
|
@@ -23151,7 +23288,7 @@ var catchProcessor = (schema2, ctx, json2, params) => {
|
|
|
23151
23288
|
} catch {
|
|
23152
23289
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
23153
23290
|
}
|
|
23154
|
-
|
|
23291
|
+
json3.default = catchValue;
|
|
23155
23292
|
};
|
|
23156
23293
|
var pipeProcessor = (schema2, ctx, _json, params) => {
|
|
23157
23294
|
const def = schema2._zod.def;
|
|
@@ -23160,12 +23297,12 @@ var pipeProcessor = (schema2, ctx, _json, params) => {
|
|
|
23160
23297
|
const seen = ctx.seen.get(schema2);
|
|
23161
23298
|
seen.ref = innerType;
|
|
23162
23299
|
};
|
|
23163
|
-
var readonlyProcessor = (schema2, ctx,
|
|
23300
|
+
var readonlyProcessor = (schema2, ctx, json3, params) => {
|
|
23164
23301
|
const def = schema2._zod.def;
|
|
23165
23302
|
process2(def.innerType, ctx, params);
|
|
23166
23303
|
const seen = ctx.seen.get(schema2);
|
|
23167
23304
|
seen.ref = def.innerType;
|
|
23168
|
-
|
|
23305
|
+
json3.readOnly = true;
|
|
23169
23306
|
};
|
|
23170
23307
|
var promiseProcessor = (schema2, ctx, _json, params) => {
|
|
23171
23308
|
const def = schema2._zod.def;
|
|
@@ -23467,17 +23604,33 @@ function normalizeObjectSchema(schema2) {
|
|
|
23467
23604
|
}
|
|
23468
23605
|
return void 0;
|
|
23469
23606
|
}
|
|
23607
|
+
function getDotPath(path2) {
|
|
23608
|
+
if (path2.length === 0) {
|
|
23609
|
+
return "object root";
|
|
23610
|
+
}
|
|
23611
|
+
return path2.reduce((acc, seg, index) => {
|
|
23612
|
+
if (index === 0) {
|
|
23613
|
+
return String(seg);
|
|
23614
|
+
}
|
|
23615
|
+
if (typeof seg === "number") {
|
|
23616
|
+
return `${acc}[${seg}]`;
|
|
23617
|
+
}
|
|
23618
|
+
return `${acc}.${seg}`;
|
|
23619
|
+
}, "");
|
|
23620
|
+
}
|
|
23470
23621
|
function getParseErrorMessage(error48) {
|
|
23471
23622
|
if (error48 && typeof error48 === "object") {
|
|
23623
|
+
if ("issues" in error48 && Array.isArray(error48.issues) && error48.issues.length > 0) {
|
|
23624
|
+
return error48.issues.map((i) => {
|
|
23625
|
+
if (!i.path?.length) {
|
|
23626
|
+
return i.message;
|
|
23627
|
+
}
|
|
23628
|
+
return `${i.message} at ${getDotPath(i.path)}`;
|
|
23629
|
+
}).join("\n");
|
|
23630
|
+
}
|
|
23472
23631
|
if ("message" in error48 && typeof error48.message === "string") {
|
|
23473
23632
|
return error48.message;
|
|
23474
23633
|
}
|
|
23475
|
-
if ("issues" in error48 && Array.isArray(error48.issues) && error48.issues.length > 0) {
|
|
23476
|
-
const firstIssue = error48.issues[0];
|
|
23477
|
-
if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
|
|
23478
|
-
return String(firstIssue.message);
|
|
23479
|
-
}
|
|
23480
|
-
}
|
|
23481
23634
|
try {
|
|
23482
23635
|
return JSON.stringify(error48);
|
|
23483
23636
|
} catch {
|
|
@@ -24153,7 +24306,7 @@ var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
24153
24306
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
24154
24307
|
$ZodString.init(inst, def);
|
|
24155
24308
|
ZodType2.init(inst, def);
|
|
24156
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24309
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => stringProcessor(inst, ctx, json3, params);
|
|
24157
24310
|
const bag = inst._zod.bag;
|
|
24158
24311
|
inst.format = bag.format ?? null;
|
|
24159
24312
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -24392,7 +24545,7 @@ function hash(alg, params) {
|
|
|
24392
24545
|
var ZodNumber2 = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
24393
24546
|
$ZodNumber.init(inst, def);
|
|
24394
24547
|
ZodType2.init(inst, def);
|
|
24395
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24548
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => numberProcessor(inst, ctx, json3, params);
|
|
24396
24549
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
24397
24550
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
24398
24551
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -24440,7 +24593,7 @@ function uint32(params) {
|
|
|
24440
24593
|
var ZodBoolean2 = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
24441
24594
|
$ZodBoolean.init(inst, def);
|
|
24442
24595
|
ZodType2.init(inst, def);
|
|
24443
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24596
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => booleanProcessor(inst, ctx, json3, params);
|
|
24444
24597
|
});
|
|
24445
24598
|
function boolean2(params) {
|
|
24446
24599
|
return _boolean(ZodBoolean2, params);
|
|
@@ -24448,7 +24601,7 @@ function boolean2(params) {
|
|
|
24448
24601
|
var ZodBigInt2 = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
24449
24602
|
$ZodBigInt.init(inst, def);
|
|
24450
24603
|
ZodType2.init(inst, def);
|
|
24451
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24604
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => bigintProcessor(inst, ctx, json3, params);
|
|
24452
24605
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
24453
24606
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
24454
24607
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
@@ -24483,7 +24636,7 @@ function uint64(params) {
|
|
|
24483
24636
|
var ZodSymbol2 = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
24484
24637
|
$ZodSymbol.init(inst, def);
|
|
24485
24638
|
ZodType2.init(inst, def);
|
|
24486
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24639
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => symbolProcessor(inst, ctx, json3, params);
|
|
24487
24640
|
});
|
|
24488
24641
|
function symbol(params) {
|
|
24489
24642
|
return _symbol(ZodSymbol2, params);
|
|
@@ -24491,7 +24644,7 @@ function symbol(params) {
|
|
|
24491
24644
|
var ZodUndefined2 = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
24492
24645
|
$ZodUndefined.init(inst, def);
|
|
24493
24646
|
ZodType2.init(inst, def);
|
|
24494
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24647
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => undefinedProcessor(inst, ctx, json3, params);
|
|
24495
24648
|
});
|
|
24496
24649
|
function _undefined3(params) {
|
|
24497
24650
|
return _undefined2(ZodUndefined2, params);
|
|
@@ -24499,7 +24652,7 @@ function _undefined3(params) {
|
|
|
24499
24652
|
var ZodNull2 = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
24500
24653
|
$ZodNull.init(inst, def);
|
|
24501
24654
|
ZodType2.init(inst, def);
|
|
24502
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24655
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nullProcessor(inst, ctx, json3, params);
|
|
24503
24656
|
});
|
|
24504
24657
|
function _null3(params) {
|
|
24505
24658
|
return _null2(ZodNull2, params);
|
|
@@ -24507,7 +24660,7 @@ function _null3(params) {
|
|
|
24507
24660
|
var ZodAny2 = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
24508
24661
|
$ZodAny.init(inst, def);
|
|
24509
24662
|
ZodType2.init(inst, def);
|
|
24510
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24663
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => anyProcessor(inst, ctx, json3, params);
|
|
24511
24664
|
});
|
|
24512
24665
|
function any() {
|
|
24513
24666
|
return _any(ZodAny2);
|
|
@@ -24515,7 +24668,7 @@ function any() {
|
|
|
24515
24668
|
var ZodUnknown2 = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
24516
24669
|
$ZodUnknown.init(inst, def);
|
|
24517
24670
|
ZodType2.init(inst, def);
|
|
24518
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24671
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unknownProcessor(inst, ctx, json3, params);
|
|
24519
24672
|
});
|
|
24520
24673
|
function unknown() {
|
|
24521
24674
|
return _unknown(ZodUnknown2);
|
|
@@ -24523,7 +24676,7 @@ function unknown() {
|
|
|
24523
24676
|
var ZodNever2 = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
24524
24677
|
$ZodNever.init(inst, def);
|
|
24525
24678
|
ZodType2.init(inst, def);
|
|
24526
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24679
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => neverProcessor(inst, ctx, json3, params);
|
|
24527
24680
|
});
|
|
24528
24681
|
function never(params) {
|
|
24529
24682
|
return _never(ZodNever2, params);
|
|
@@ -24531,7 +24684,7 @@ function never(params) {
|
|
|
24531
24684
|
var ZodVoid2 = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
24532
24685
|
$ZodVoid.init(inst, def);
|
|
24533
24686
|
ZodType2.init(inst, def);
|
|
24534
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24687
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => voidProcessor(inst, ctx, json3, params);
|
|
24535
24688
|
});
|
|
24536
24689
|
function _void2(params) {
|
|
24537
24690
|
return _void(ZodVoid2, params);
|
|
@@ -24539,7 +24692,7 @@ function _void2(params) {
|
|
|
24539
24692
|
var ZodDate2 = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
24540
24693
|
$ZodDate.init(inst, def);
|
|
24541
24694
|
ZodType2.init(inst, def);
|
|
24542
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24695
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => dateProcessor(inst, ctx, json3, params);
|
|
24543
24696
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
24544
24697
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
24545
24698
|
const c = inst._zod.bag;
|
|
@@ -24552,7 +24705,7 @@ function date3(params) {
|
|
|
24552
24705
|
var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
24553
24706
|
$ZodArray.init(inst, def);
|
|
24554
24707
|
ZodType2.init(inst, def);
|
|
24555
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24708
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => arrayProcessor(inst, ctx, json3, params);
|
|
24556
24709
|
inst.element = def.element;
|
|
24557
24710
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
24558
24711
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -24570,7 +24723,7 @@ function keyof(schema2) {
|
|
|
24570
24723
|
var ZodObject2 = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
24571
24724
|
$ZodObjectJIT.init(inst, def);
|
|
24572
24725
|
ZodType2.init(inst, def);
|
|
24573
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24726
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => objectProcessor(inst, ctx, json3, params);
|
|
24574
24727
|
util_exports.defineLazy(inst, "shape", () => {
|
|
24575
24728
|
return def.shape;
|
|
24576
24729
|
});
|
|
@@ -24619,7 +24772,7 @@ function looseObject(shape, params) {
|
|
|
24619
24772
|
var ZodUnion2 = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
24620
24773
|
$ZodUnion.init(inst, def);
|
|
24621
24774
|
ZodType2.init(inst, def);
|
|
24622
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24775
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
|
|
24623
24776
|
inst.options = def.options;
|
|
24624
24777
|
});
|
|
24625
24778
|
function union(options, params) {
|
|
@@ -24632,7 +24785,7 @@ function union(options, params) {
|
|
|
24632
24785
|
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
24633
24786
|
ZodUnion2.init(inst, def);
|
|
24634
24787
|
$ZodXor.init(inst, def);
|
|
24635
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24788
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
|
|
24636
24789
|
inst.options = def.options;
|
|
24637
24790
|
});
|
|
24638
24791
|
function xor(options, params) {
|
|
@@ -24658,7 +24811,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
24658
24811
|
var ZodIntersection2 = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
24659
24812
|
$ZodIntersection.init(inst, def);
|
|
24660
24813
|
ZodType2.init(inst, def);
|
|
24661
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24814
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => intersectionProcessor(inst, ctx, json3, params);
|
|
24662
24815
|
});
|
|
24663
24816
|
function intersection(left, right) {
|
|
24664
24817
|
return new ZodIntersection2({
|
|
@@ -24670,7 +24823,7 @@ function intersection(left, right) {
|
|
|
24670
24823
|
var ZodTuple2 = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
24671
24824
|
$ZodTuple.init(inst, def);
|
|
24672
24825
|
ZodType2.init(inst, def);
|
|
24673
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24826
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => tupleProcessor(inst, ctx, json3, params);
|
|
24674
24827
|
inst.rest = (rest) => inst.clone({
|
|
24675
24828
|
...inst._zod.def,
|
|
24676
24829
|
rest
|
|
@@ -24690,7 +24843,7 @@ function tuple(items, _paramsOrRest, _params) {
|
|
|
24690
24843
|
var ZodRecord2 = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
24691
24844
|
$ZodRecord.init(inst, def);
|
|
24692
24845
|
ZodType2.init(inst, def);
|
|
24693
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24846
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => recordProcessor(inst, ctx, json3, params);
|
|
24694
24847
|
inst.keyType = def.keyType;
|
|
24695
24848
|
inst.valueType = def.valueType;
|
|
24696
24849
|
});
|
|
@@ -24724,7 +24877,7 @@ function looseRecord(keyType, valueType, params) {
|
|
|
24724
24877
|
var ZodMap2 = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
24725
24878
|
$ZodMap.init(inst, def);
|
|
24726
24879
|
ZodType2.init(inst, def);
|
|
24727
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24880
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => mapProcessor(inst, ctx, json3, params);
|
|
24728
24881
|
inst.keyType = def.keyType;
|
|
24729
24882
|
inst.valueType = def.valueType;
|
|
24730
24883
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
@@ -24743,7 +24896,7 @@ function map(keyType, valueType, params) {
|
|
|
24743
24896
|
var ZodSet2 = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
24744
24897
|
$ZodSet.init(inst, def);
|
|
24745
24898
|
ZodType2.init(inst, def);
|
|
24746
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24899
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => setProcessor(inst, ctx, json3, params);
|
|
24747
24900
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
24748
24901
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
24749
24902
|
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
@@ -24759,7 +24912,7 @@ function set(valueType, params) {
|
|
|
24759
24912
|
var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
24760
24913
|
$ZodEnum.init(inst, def);
|
|
24761
24914
|
ZodType2.init(inst, def);
|
|
24762
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24915
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => enumProcessor(inst, ctx, json3, params);
|
|
24763
24916
|
inst.enum = def.entries;
|
|
24764
24917
|
inst.options = Object.values(def.entries);
|
|
24765
24918
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -24812,7 +24965,7 @@ function nativeEnum(entries, params) {
|
|
|
24812
24965
|
var ZodLiteral2 = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
24813
24966
|
$ZodLiteral.init(inst, def);
|
|
24814
24967
|
ZodType2.init(inst, def);
|
|
24815
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24968
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => literalProcessor(inst, ctx, json3, params);
|
|
24816
24969
|
inst.values = new Set(def.values);
|
|
24817
24970
|
Object.defineProperty(inst, "value", {
|
|
24818
24971
|
get() {
|
|
@@ -24833,7 +24986,7 @@ function literal(value, params) {
|
|
|
24833
24986
|
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
24834
24987
|
$ZodFile.init(inst, def);
|
|
24835
24988
|
ZodType2.init(inst, def);
|
|
24836
|
-
inst._zod.processJSONSchema = (ctx,
|
|
24989
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => fileProcessor(inst, ctx, json3, params);
|
|
24837
24990
|
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
24838
24991
|
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
24839
24992
|
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
@@ -24844,7 +24997,7 @@ function file(params) {
|
|
|
24844
24997
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
24845
24998
|
$ZodTransform.init(inst, def);
|
|
24846
24999
|
ZodType2.init(inst, def);
|
|
24847
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25000
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => transformProcessor(inst, ctx, json3, params);
|
|
24848
25001
|
inst._zod.parse = (payload, _ctx) => {
|
|
24849
25002
|
if (_ctx.direction === "backward") {
|
|
24850
25003
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -24882,7 +25035,7 @@ function transform(fn) {
|
|
|
24882
25035
|
var ZodOptional2 = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
24883
25036
|
$ZodOptional.init(inst, def);
|
|
24884
25037
|
ZodType2.init(inst, def);
|
|
24885
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25038
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
|
|
24886
25039
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
24887
25040
|
});
|
|
24888
25041
|
function optional(innerType) {
|
|
@@ -24894,7 +25047,7 @@ function optional(innerType) {
|
|
|
24894
25047
|
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
24895
25048
|
$ZodExactOptional.init(inst, def);
|
|
24896
25049
|
ZodType2.init(inst, def);
|
|
24897
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25050
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
|
|
24898
25051
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
24899
25052
|
});
|
|
24900
25053
|
function exactOptional(innerType) {
|
|
@@ -24906,7 +25059,7 @@ function exactOptional(innerType) {
|
|
|
24906
25059
|
var ZodNullable2 = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
24907
25060
|
$ZodNullable.init(inst, def);
|
|
24908
25061
|
ZodType2.init(inst, def);
|
|
24909
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25062
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nullableProcessor(inst, ctx, json3, params);
|
|
24910
25063
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
24911
25064
|
});
|
|
24912
25065
|
function nullable(innerType) {
|
|
@@ -24921,7 +25074,7 @@ function nullish2(innerType) {
|
|
|
24921
25074
|
var ZodDefault2 = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
24922
25075
|
$ZodDefault.init(inst, def);
|
|
24923
25076
|
ZodType2.init(inst, def);
|
|
24924
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25077
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => defaultProcessor(inst, ctx, json3, params);
|
|
24925
25078
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
24926
25079
|
inst.removeDefault = inst.unwrap;
|
|
24927
25080
|
});
|
|
@@ -24937,7 +25090,7 @@ function _default2(innerType, defaultValue) {
|
|
|
24937
25090
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
24938
25091
|
$ZodPrefault.init(inst, def);
|
|
24939
25092
|
ZodType2.init(inst, def);
|
|
24940
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25093
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => prefaultProcessor(inst, ctx, json3, params);
|
|
24941
25094
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
24942
25095
|
});
|
|
24943
25096
|
function prefault(innerType, defaultValue) {
|
|
@@ -24952,7 +25105,7 @@ function prefault(innerType, defaultValue) {
|
|
|
24952
25105
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
24953
25106
|
$ZodNonOptional.init(inst, def);
|
|
24954
25107
|
ZodType2.init(inst, def);
|
|
24955
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25108
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nonoptionalProcessor(inst, ctx, json3, params);
|
|
24956
25109
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
24957
25110
|
});
|
|
24958
25111
|
function nonoptional(innerType, params) {
|
|
@@ -24965,7 +25118,7 @@ function nonoptional(innerType, params) {
|
|
|
24965
25118
|
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
24966
25119
|
$ZodSuccess.init(inst, def);
|
|
24967
25120
|
ZodType2.init(inst, def);
|
|
24968
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25121
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => successProcessor(inst, ctx, json3, params);
|
|
24969
25122
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
24970
25123
|
});
|
|
24971
25124
|
function success(innerType) {
|
|
@@ -24977,7 +25130,7 @@ function success(innerType) {
|
|
|
24977
25130
|
var ZodCatch2 = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
24978
25131
|
$ZodCatch.init(inst, def);
|
|
24979
25132
|
ZodType2.init(inst, def);
|
|
24980
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25133
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => catchProcessor(inst, ctx, json3, params);
|
|
24981
25134
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
24982
25135
|
inst.removeCatch = inst.unwrap;
|
|
24983
25136
|
});
|
|
@@ -24991,7 +25144,7 @@ function _catch2(innerType, catchValue) {
|
|
|
24991
25144
|
var ZodNaN2 = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
24992
25145
|
$ZodNaN.init(inst, def);
|
|
24993
25146
|
ZodType2.init(inst, def);
|
|
24994
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25147
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => nanProcessor(inst, ctx, json3, params);
|
|
24995
25148
|
});
|
|
24996
25149
|
function nan(params) {
|
|
24997
25150
|
return _nan(ZodNaN2, params);
|
|
@@ -24999,7 +25152,7 @@ function nan(params) {
|
|
|
24999
25152
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
25000
25153
|
$ZodPipe.init(inst, def);
|
|
25001
25154
|
ZodType2.init(inst, def);
|
|
25002
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25155
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => pipeProcessor(inst, ctx, json3, params);
|
|
25003
25156
|
inst.in = def.in;
|
|
25004
25157
|
inst.out = def.out;
|
|
25005
25158
|
});
|
|
@@ -25027,7 +25180,7 @@ function codec(in_, out, params) {
|
|
|
25027
25180
|
var ZodReadonly2 = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
25028
25181
|
$ZodReadonly.init(inst, def);
|
|
25029
25182
|
ZodType2.init(inst, def);
|
|
25030
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25183
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => readonlyProcessor(inst, ctx, json3, params);
|
|
25031
25184
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
25032
25185
|
});
|
|
25033
25186
|
function readonly(innerType) {
|
|
@@ -25039,7 +25192,7 @@ function readonly(innerType) {
|
|
|
25039
25192
|
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
25040
25193
|
$ZodTemplateLiteral.init(inst, def);
|
|
25041
25194
|
ZodType2.init(inst, def);
|
|
25042
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25195
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => templateLiteralProcessor(inst, ctx, json3, params);
|
|
25043
25196
|
});
|
|
25044
25197
|
function templateLiteral(parts, params) {
|
|
25045
25198
|
return new ZodTemplateLiteral({
|
|
@@ -25051,7 +25204,7 @@ function templateLiteral(parts, params) {
|
|
|
25051
25204
|
var ZodLazy2 = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
25052
25205
|
$ZodLazy.init(inst, def);
|
|
25053
25206
|
ZodType2.init(inst, def);
|
|
25054
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25207
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => lazyProcessor(inst, ctx, json3, params);
|
|
25055
25208
|
inst.unwrap = () => inst._zod.def.getter();
|
|
25056
25209
|
});
|
|
25057
25210
|
function lazy(getter) {
|
|
@@ -25063,7 +25216,7 @@ function lazy(getter) {
|
|
|
25063
25216
|
var ZodPromise2 = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
25064
25217
|
$ZodPromise.init(inst, def);
|
|
25065
25218
|
ZodType2.init(inst, def);
|
|
25066
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25219
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => promiseProcessor(inst, ctx, json3, params);
|
|
25067
25220
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
25068
25221
|
});
|
|
25069
25222
|
function promise(innerType) {
|
|
@@ -25075,7 +25228,7 @@ function promise(innerType) {
|
|
|
25075
25228
|
var ZodFunction2 = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
25076
25229
|
$ZodFunction.init(inst, def);
|
|
25077
25230
|
ZodType2.init(inst, def);
|
|
25078
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25231
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => functionProcessor(inst, ctx, json3, params);
|
|
25079
25232
|
});
|
|
25080
25233
|
function _function(params) {
|
|
25081
25234
|
return new ZodFunction2({
|
|
@@ -25087,7 +25240,7 @@ function _function(params) {
|
|
|
25087
25240
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
25088
25241
|
$ZodCustom.init(inst, def);
|
|
25089
25242
|
ZodType2.init(inst, def);
|
|
25090
|
-
inst._zod.processJSONSchema = (ctx,
|
|
25243
|
+
inst._zod.processJSONSchema = (ctx, json3, params) => customProcessor(inst, ctx, json3, params);
|
|
25091
25244
|
});
|
|
25092
25245
|
function check(fn) {
|
|
25093
25246
|
const ch = new $ZodCheck({
|
|
@@ -29873,16 +30026,7 @@ var Server = class extends Protocol {
|
|
|
29873
30026
|
if (!methodSchema) {
|
|
29874
30027
|
throw new Error("Schema is missing a method literal");
|
|
29875
30028
|
}
|
|
29876
|
-
|
|
29877
|
-
if (isZ4Schema(methodSchema)) {
|
|
29878
|
-
const v4Schema = methodSchema;
|
|
29879
|
-
const v4Def = v4Schema._zod?.def;
|
|
29880
|
-
methodValue = v4Def?.value ?? v4Schema.value;
|
|
29881
|
-
} else {
|
|
29882
|
-
const v3Schema = methodSchema;
|
|
29883
|
-
const legacyDef = v3Schema._def;
|
|
29884
|
-
methodValue = legacyDef?.value ?? v3Schema.value;
|
|
29885
|
-
}
|
|
30029
|
+
const methodValue = getLiteralValue(methodSchema);
|
|
29886
30030
|
if (typeof methodValue !== "string") {
|
|
29887
30031
|
throw new Error("Schema method literal must be a string");
|
|
29888
30032
|
}
|
|
@@ -31070,8 +31214,17 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
31070
31214
|
var import_node_process = __toESM(require("node:process"), 1);
|
|
31071
31215
|
|
|
31072
31216
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
31217
|
+
var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
|
|
31073
31218
|
var ReadBuffer = class {
|
|
31219
|
+
constructor(options) {
|
|
31220
|
+
this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
|
|
31221
|
+
}
|
|
31074
31222
|
append(chunk) {
|
|
31223
|
+
const newSize = (this._buffer?.length ?? 0) + chunk.length;
|
|
31224
|
+
if (newSize > this._maxBufferSize) {
|
|
31225
|
+
this.clear();
|
|
31226
|
+
throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
|
|
31227
|
+
}
|
|
31075
31228
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
31076
31229
|
}
|
|
31077
31230
|
readMessage() {
|
|
@@ -31099,18 +31252,24 @@ function serializeMessage(message) {
|
|
|
31099
31252
|
|
|
31100
31253
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
31101
31254
|
var StdioServerTransport = class {
|
|
31102
|
-
constructor(_stdin = import_node_process.default.stdin, _stdout = import_node_process.default.stdout) {
|
|
31255
|
+
constructor(_stdin = import_node_process.default.stdin, _stdout = import_node_process.default.stdout, options) {
|
|
31103
31256
|
this._stdin = _stdin;
|
|
31104
31257
|
this._stdout = _stdout;
|
|
31105
|
-
this._readBuffer = new ReadBuffer();
|
|
31106
31258
|
this._started = false;
|
|
31107
31259
|
this._ondata = (chunk) => {
|
|
31108
|
-
|
|
31109
|
-
|
|
31260
|
+
try {
|
|
31261
|
+
this._readBuffer.append(chunk);
|
|
31262
|
+
this.processReadBuffer();
|
|
31263
|
+
} catch (error48) {
|
|
31264
|
+
this.onerror?.(error48);
|
|
31265
|
+
this.close().catch(() => {
|
|
31266
|
+
});
|
|
31267
|
+
}
|
|
31110
31268
|
};
|
|
31111
31269
|
this._onerror = (error48) => {
|
|
31112
31270
|
this.onerror?.(error48);
|
|
31113
31271
|
};
|
|
31272
|
+
this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
|
|
31114
31273
|
}
|
|
31115
31274
|
/**
|
|
31116
31275
|
* Starts listening for messages on stdin.
|
|
@@ -31148,8 +31307,8 @@ var StdioServerTransport = class {
|
|
|
31148
31307
|
}
|
|
31149
31308
|
send(message) {
|
|
31150
31309
|
return new Promise((resolve2) => {
|
|
31151
|
-
const
|
|
31152
|
-
if (this._stdout.write(
|
|
31310
|
+
const json3 = serializeMessage(message);
|
|
31311
|
+
if (this._stdout.write(json3)) {
|
|
31153
31312
|
resolve2();
|
|
31154
31313
|
} else {
|
|
31155
31314
|
this._stdout.once("drain", resolve2);
|
|
@@ -31158,49 +31317,136 @@ var StdioServerTransport = class {
|
|
|
31158
31317
|
}
|
|
31159
31318
|
};
|
|
31160
31319
|
|
|
31320
|
+
// node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
31321
|
+
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
31322
|
+
|
|
31323
|
+
// node_modules/@hono/node-server/dist/index.mjs
|
|
31324
|
+
var import_node_http2 = require("node:http2");
|
|
31325
|
+
var import_node_stream = require("node:stream");
|
|
31326
|
+
|
|
31327
|
+
// node_modules/hono/dist/helper/websocket/index.js
|
|
31328
|
+
var defineWebSocketHelper = (handler) => {
|
|
31329
|
+
return ((...args) => {
|
|
31330
|
+
if (typeof args[0] === "function") {
|
|
31331
|
+
const [createEvents, options] = args;
|
|
31332
|
+
return async function upgradeWebSocket2(c, next) {
|
|
31333
|
+
const events = await createEvents(c);
|
|
31334
|
+
const result = await handler(c, events, options);
|
|
31335
|
+
if (result) {
|
|
31336
|
+
return result;
|
|
31337
|
+
}
|
|
31338
|
+
await next();
|
|
31339
|
+
};
|
|
31340
|
+
} else {
|
|
31341
|
+
const [c, events, options] = args;
|
|
31342
|
+
return (async () => {
|
|
31343
|
+
const upgraded = await handler(c, events, options);
|
|
31344
|
+
if (!upgraded) {
|
|
31345
|
+
throw new Error("Failed to upgrade WebSocket");
|
|
31346
|
+
}
|
|
31347
|
+
return upgraded;
|
|
31348
|
+
})();
|
|
31349
|
+
}
|
|
31350
|
+
});
|
|
31351
|
+
};
|
|
31352
|
+
|
|
31161
31353
|
// node_modules/@hono/node-server/dist/index.mjs
|
|
31162
|
-
var import_http2 = require("http2");
|
|
31163
|
-
var import_http22 = require("http2");
|
|
31164
|
-
var import_stream = require("stream");
|
|
31165
|
-
var import_crypto = __toESM(require("crypto"), 1);
|
|
31166
31354
|
var RequestError = class extends Error {
|
|
31167
31355
|
constructor(message, options) {
|
|
31168
31356
|
super(message, options);
|
|
31169
31357
|
this.name = "RequestError";
|
|
31170
31358
|
}
|
|
31171
31359
|
};
|
|
31172
|
-
var
|
|
31173
|
-
|
|
31174
|
-
|
|
31360
|
+
var reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
|
|
31361
|
+
var reDotSegment = /\/\.\.?(?:[/?#]|$)/;
|
|
31362
|
+
var reValidHost = /^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/;
|
|
31363
|
+
var buildUrl = (scheme, host2, incomingUrl) => {
|
|
31364
|
+
const url2 = `${scheme}://${host2}${incomingUrl}`;
|
|
31365
|
+
if (!reValidHost.test(host2)) {
|
|
31366
|
+
const urlObj = new URL(url2);
|
|
31367
|
+
if (urlObj.hostname.length !== host2.length && urlObj.hostname !== (host2.includes(":") ? host2.replace(/:\d+$/, "") : host2).toLowerCase()) throw new RequestError("Invalid host header");
|
|
31368
|
+
return urlObj.href;
|
|
31369
|
+
} else if (incomingUrl.length === 0) return url2 + "/";
|
|
31370
|
+
else {
|
|
31371
|
+
if (incomingUrl.charCodeAt(0) !== 47) throw new RequestError("Invalid URL");
|
|
31372
|
+
if (!reValidRequestUrl.test(incomingUrl) || reDotSegment.test(incomingUrl)) return new URL(url2).href;
|
|
31373
|
+
return url2;
|
|
31175
31374
|
}
|
|
31375
|
+
};
|
|
31376
|
+
var toRequestError = (e) => {
|
|
31377
|
+
if (e instanceof RequestError) return e;
|
|
31176
31378
|
return new RequestError(e.message, { cause: e });
|
|
31177
31379
|
};
|
|
31178
31380
|
var GlobalRequest = global.Request;
|
|
31179
|
-
var Request = class extends GlobalRequest {
|
|
31381
|
+
var Request$1 = class extends GlobalRequest {
|
|
31180
31382
|
constructor(input, options) {
|
|
31181
31383
|
if (typeof input === "object" && getRequestCache in input) {
|
|
31384
|
+
const hasReplacementBody = options !== void 0 && "body" in options && options.body != null;
|
|
31385
|
+
if (input[bodyConsumedDirectlyKey] && !hasReplacementBody) throw new TypeError("Cannot construct a Request with a Request object that has already been used.");
|
|
31182
31386
|
input = input[getRequestCache]();
|
|
31183
31387
|
}
|
|
31184
|
-
if (typeof options?.body?.getReader !== "undefined")
|
|
31185
|
-
;
|
|
31186
|
-
options.duplex ??= "half";
|
|
31187
|
-
}
|
|
31388
|
+
if (typeof options?.body?.getReader !== "undefined") options.duplex ??= "half";
|
|
31188
31389
|
super(input, options);
|
|
31189
31390
|
}
|
|
31190
31391
|
};
|
|
31191
31392
|
var newHeadersFromIncoming = (incoming) => {
|
|
31192
31393
|
const headerRecord = [];
|
|
31193
31394
|
const rawHeaders = incoming.rawHeaders;
|
|
31194
|
-
for (let i = 0
|
|
31195
|
-
const
|
|
31196
|
-
if (key.charCodeAt(0) !==
|
|
31197
|
-
58) {
|
|
31198
|
-
headerRecord.push([key, value]);
|
|
31199
|
-
}
|
|
31395
|
+
for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
|
|
31396
|
+
const key = rawHeaders[i];
|
|
31397
|
+
if (key.charCodeAt(0) !== 58) headerRecord.push([key, rawHeaders[i + 1]]);
|
|
31200
31398
|
}
|
|
31201
31399
|
return new Headers(headerRecord);
|
|
31202
31400
|
};
|
|
31203
31401
|
var wrapBodyStream = /* @__PURE__ */ Symbol("wrapBodyStream");
|
|
31402
|
+
var byteExactEncodings = /* @__PURE__ */ new Set([
|
|
31403
|
+
"latin1",
|
|
31404
|
+
"binary",
|
|
31405
|
+
"hex",
|
|
31406
|
+
"base64",
|
|
31407
|
+
"base64url"
|
|
31408
|
+
]);
|
|
31409
|
+
var isByteExactEncoding = (encoding) => encoding === null || byteExactEncodings.has(encoding);
|
|
31410
|
+
var bodyBufferedBeforeDisconnectKey = /* @__PURE__ */ Symbol("bodyBufferedBeforeDisconnect");
|
|
31411
|
+
var bodyBufferedLengthBeforeDisconnectKey = /* @__PURE__ */ Symbol("bodyBufferedLengthBeforeDisconnect");
|
|
31412
|
+
var toBufferChunk = (chunk, encoding) => Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding ?? "utf8");
|
|
31413
|
+
var isRecoverableDisconnectedIncoming = (incoming) => !(incoming instanceof import_node_http2.Http2ServerRequest) && !!incoming.complete && !!incoming.readableAborted && typeof incoming.read === "function" && isByteExactEncoding(incoming.readableEncoding);
|
|
31414
|
+
var recordBodyBufferedBeforeDisconnect = (incoming) => {
|
|
31415
|
+
if (incoming.readableDidRead || !isRecoverableDisconnectedIncoming(incoming)) return;
|
|
31416
|
+
const incomingWithRecovery = incoming;
|
|
31417
|
+
incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] ??= incoming.readableLength;
|
|
31418
|
+
};
|
|
31419
|
+
var readBodyBufferedBeforeDisconnect = (incoming, chunks) => {
|
|
31420
|
+
if (incoming.readableDidRead && !chunks || !isRecoverableDisconnectedIncoming(incoming)) return;
|
|
31421
|
+
const incomingWithRecovery = incoming;
|
|
31422
|
+
if (incomingWithRecovery[bodyBufferedBeforeDisconnectKey] !== void 0) return incomingWithRecovery[bodyBufferedBeforeDisconnectKey];
|
|
31423
|
+
let result;
|
|
31424
|
+
const errored = incoming.errored;
|
|
31425
|
+
if (errored && errored.code !== "ECONNRESET") result = errored;
|
|
31426
|
+
else if (incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey] !== void 0 && incoming.readableLength !== incomingWithRecovery[bodyBufferedLengthBeforeDisconnectKey]) result = newBodyUnusableError();
|
|
31427
|
+
else {
|
|
31428
|
+
const bodyChunks = chunks ?? [];
|
|
31429
|
+
const chunk = incoming.read();
|
|
31430
|
+
if (chunk !== null) bodyChunks.push(toBufferChunk(chunk, incoming.readableEncoding));
|
|
31431
|
+
const buffer = bodyChunks.length === 1 ? bodyChunks[0] : Buffer.concat(bodyChunks);
|
|
31432
|
+
result = buffer;
|
|
31433
|
+
const contentLength = incoming.headers["content-length"];
|
|
31434
|
+
if (typeof contentLength === "string" && /^\d+$/.test(contentLength)) {
|
|
31435
|
+
const expectedLength = Number(contentLength);
|
|
31436
|
+
if (Number.isSafeInteger(expectedLength) && buffer.length !== expectedLength) result = newBodyUnusableError();
|
|
31437
|
+
}
|
|
31438
|
+
}
|
|
31439
|
+
incomingWithRecovery[bodyBufferedBeforeDisconnectKey] = result;
|
|
31440
|
+
return result;
|
|
31441
|
+
};
|
|
31442
|
+
var enqueueBufferedBody = (controller, buffered) => {
|
|
31443
|
+
if (buffered instanceof Error) {
|
|
31444
|
+
controller.error(buffered);
|
|
31445
|
+
return;
|
|
31446
|
+
}
|
|
31447
|
+
if (buffered.length > 0) controller.enqueue(buffered);
|
|
31448
|
+
controller.close();
|
|
31449
|
+
};
|
|
31204
31450
|
var newRequestFromIncoming = (method, url2, headers, incoming, abortController) => {
|
|
31205
31451
|
const init = {
|
|
31206
31452
|
method,
|
|
@@ -31209,55 +31455,224 @@ var newRequestFromIncoming = (method, url2, headers, incoming, abortController)
|
|
|
31209
31455
|
};
|
|
31210
31456
|
if (method === "TRACE") {
|
|
31211
31457
|
init.method = "GET";
|
|
31212
|
-
const req = new Request(url2, init);
|
|
31213
|
-
Object.defineProperty(req, "method", {
|
|
31214
|
-
|
|
31215
|
-
|
|
31216
|
-
}
|
|
31217
|
-
});
|
|
31458
|
+
const req = new Request$1(url2, init);
|
|
31459
|
+
Object.defineProperty(req, "method", { get() {
|
|
31460
|
+
return "TRACE";
|
|
31461
|
+
} });
|
|
31218
31462
|
return req;
|
|
31219
31463
|
}
|
|
31220
|
-
if (!(method === "GET" || method === "HEAD")) {
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
|
|
31226
|
-
|
|
31227
|
-
|
|
31228
|
-
|
|
31229
|
-
|
|
31230
|
-
|
|
31231
|
-
|
|
31232
|
-
|
|
31233
|
-
reader ||= import_stream.Readable.toWeb(incoming).getReader();
|
|
31234
|
-
const { done, value } = await reader.read();
|
|
31235
|
-
if (done) {
|
|
31236
|
-
controller.close();
|
|
31237
|
-
} else {
|
|
31238
|
-
controller.enqueue(value);
|
|
31239
|
-
}
|
|
31240
|
-
} catch (error48) {
|
|
31241
|
-
controller.error(error48);
|
|
31464
|
+
if (!(method === "GET" || method === "HEAD")) if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) init.body = new ReadableStream({ start(controller) {
|
|
31465
|
+
controller.enqueue(incoming.rawBody);
|
|
31466
|
+
controller.close();
|
|
31467
|
+
} });
|
|
31468
|
+
else if (incoming[wrapBodyStream]) {
|
|
31469
|
+
let reader;
|
|
31470
|
+
init.body = new ReadableStream({ async pull(controller) {
|
|
31471
|
+
try {
|
|
31472
|
+
if (!reader) {
|
|
31473
|
+
const buffered = readBodyBufferedBeforeDisconnect(incoming);
|
|
31474
|
+
if (buffered !== void 0) {
|
|
31475
|
+
enqueueBufferedBody(controller, buffered);
|
|
31476
|
+
return;
|
|
31242
31477
|
}
|
|
31243
31478
|
}
|
|
31244
|
-
|
|
31245
|
-
|
|
31246
|
-
|
|
31247
|
-
|
|
31479
|
+
reader ||= import_node_stream.Readable.toWeb(incoming).getReader();
|
|
31480
|
+
const { done, value } = await reader.read();
|
|
31481
|
+
if (done) controller.close();
|
|
31482
|
+
else controller.enqueue(value);
|
|
31483
|
+
} catch (error48) {
|
|
31484
|
+
controller.error(error48);
|
|
31485
|
+
}
|
|
31486
|
+
} });
|
|
31487
|
+
} else {
|
|
31488
|
+
const buffered = readBodyBufferedBeforeDisconnect(incoming);
|
|
31489
|
+
if (buffered !== void 0) init.body = new ReadableStream({ start(controller) {
|
|
31490
|
+
enqueueBufferedBody(controller, buffered);
|
|
31491
|
+
} });
|
|
31492
|
+
else init.body = import_node_stream.Readable.toWeb(incoming);
|
|
31248
31493
|
}
|
|
31249
|
-
return new Request(url2, init);
|
|
31494
|
+
return new Request$1(url2, init);
|
|
31250
31495
|
};
|
|
31251
31496
|
var getRequestCache = /* @__PURE__ */ Symbol("getRequestCache");
|
|
31252
31497
|
var requestCache = /* @__PURE__ */ Symbol("requestCache");
|
|
31253
31498
|
var incomingKey = /* @__PURE__ */ Symbol("incomingKey");
|
|
31254
31499
|
var urlKey = /* @__PURE__ */ Symbol("urlKey");
|
|
31500
|
+
var methodKey = /* @__PURE__ */ Symbol("methodKey");
|
|
31255
31501
|
var headersKey = /* @__PURE__ */ Symbol("headersKey");
|
|
31256
31502
|
var abortControllerKey = /* @__PURE__ */ Symbol("abortControllerKey");
|
|
31257
31503
|
var getAbortController = /* @__PURE__ */ Symbol("getAbortController");
|
|
31504
|
+
var abortRequest = /* @__PURE__ */ Symbol("abortRequest");
|
|
31505
|
+
var bodyBufferKey = /* @__PURE__ */ Symbol("bodyBuffer");
|
|
31506
|
+
var bodyReadPromiseKey = /* @__PURE__ */ Symbol("bodyReadPromise");
|
|
31507
|
+
var bodyConsumedDirectlyKey = /* @__PURE__ */ Symbol("bodyConsumedDirectly");
|
|
31508
|
+
var bodyLockReaderKey = /* @__PURE__ */ Symbol("bodyLockReader");
|
|
31509
|
+
var abortReasonKey = /* @__PURE__ */ Symbol("abortReason");
|
|
31510
|
+
var newBodyUnusableError = () => {
|
|
31511
|
+
return /* @__PURE__ */ new TypeError("Body is unusable");
|
|
31512
|
+
};
|
|
31513
|
+
var rejectBodyUnusable = () => {
|
|
31514
|
+
return Promise.reject(newBodyUnusableError());
|
|
31515
|
+
};
|
|
31516
|
+
var textDecoder = new TextDecoder();
|
|
31517
|
+
var consumeBodyDirectOnce = (request) => {
|
|
31518
|
+
if (request[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
|
|
31519
|
+
request[bodyConsumedDirectlyKey] = true;
|
|
31520
|
+
};
|
|
31521
|
+
var toArrayBuffer = (buf) => {
|
|
31522
|
+
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
|
|
31523
|
+
};
|
|
31524
|
+
var contentType = (request) => {
|
|
31525
|
+
return (request[headersKey] ||= newHeadersFromIncoming(request[incomingKey])).get("content-type") || "";
|
|
31526
|
+
};
|
|
31527
|
+
var methodTokenRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
31528
|
+
var normalizeIncomingMethod = (method) => {
|
|
31529
|
+
if (typeof method !== "string" || method.length === 0) return "GET";
|
|
31530
|
+
switch (method) {
|
|
31531
|
+
case "DELETE":
|
|
31532
|
+
case "GET":
|
|
31533
|
+
case "HEAD":
|
|
31534
|
+
case "OPTIONS":
|
|
31535
|
+
case "PATCH":
|
|
31536
|
+
case "POST":
|
|
31537
|
+
case "PUT":
|
|
31538
|
+
case "QUERY":
|
|
31539
|
+
return method;
|
|
31540
|
+
}
|
|
31541
|
+
const upper = method.toUpperCase();
|
|
31542
|
+
switch (upper) {
|
|
31543
|
+
case "DELETE":
|
|
31544
|
+
case "GET":
|
|
31545
|
+
case "HEAD":
|
|
31546
|
+
case "OPTIONS":
|
|
31547
|
+
case "POST":
|
|
31548
|
+
case "PUT":
|
|
31549
|
+
return upper;
|
|
31550
|
+
default:
|
|
31551
|
+
return method;
|
|
31552
|
+
}
|
|
31553
|
+
};
|
|
31554
|
+
var validateDirectReadMethod = (method) => {
|
|
31555
|
+
if (!methodTokenRegExp.test(method)) return /* @__PURE__ */ new TypeError(`'${method}' is not a valid HTTP method.`);
|
|
31556
|
+
const normalized = method.toUpperCase();
|
|
31557
|
+
if (normalized === "CONNECT" || normalized === "TRACK" || normalized === "TRACE" && method !== "TRACE") return /* @__PURE__ */ new TypeError(`'${method}' HTTP method is unsupported.`);
|
|
31558
|
+
};
|
|
31559
|
+
var readBodyWithFastPath = (request, method, fromBuffer) => {
|
|
31560
|
+
if (request[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
|
|
31561
|
+
const methodName = request.method;
|
|
31562
|
+
if (methodName === "GET" || methodName === "HEAD") return request[getRequestCache]()[method]();
|
|
31563
|
+
const methodValidationError = validateDirectReadMethod(methodName);
|
|
31564
|
+
if (methodValidationError) return Promise.reject(methodValidationError);
|
|
31565
|
+
if (request[requestCache]) {
|
|
31566
|
+
if (methodName !== "TRACE") return request[requestCache][method]();
|
|
31567
|
+
}
|
|
31568
|
+
const alreadyUsedError = consumeBodyDirectOnce(request);
|
|
31569
|
+
if (alreadyUsedError) return alreadyUsedError;
|
|
31570
|
+
const raw = readRawBodyIfAvailable(request);
|
|
31571
|
+
if (raw) {
|
|
31572
|
+
const result = Promise.resolve(fromBuffer(raw, request));
|
|
31573
|
+
request[bodyBufferKey] = void 0;
|
|
31574
|
+
return result;
|
|
31575
|
+
}
|
|
31576
|
+
return readBodyDirect(request).then((buf) => {
|
|
31577
|
+
const result = fromBuffer(buf, request);
|
|
31578
|
+
request[bodyBufferKey] = void 0;
|
|
31579
|
+
return result;
|
|
31580
|
+
});
|
|
31581
|
+
};
|
|
31582
|
+
var readRawBodyIfAvailable = (request) => {
|
|
31583
|
+
const incoming = request[incomingKey];
|
|
31584
|
+
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) return incoming.rawBody;
|
|
31585
|
+
};
|
|
31586
|
+
var normalizeAbortError = (request, incoming) => {
|
|
31587
|
+
if (incoming.errored) return incoming.errored;
|
|
31588
|
+
const reason = request[abortReasonKey];
|
|
31589
|
+
if (reason !== void 0) return reason instanceof Error ? reason : new Error(String(reason));
|
|
31590
|
+
return /* @__PURE__ */ new Error("Client connection prematurely closed.");
|
|
31591
|
+
};
|
|
31592
|
+
var readBodyDirect = (request) => {
|
|
31593
|
+
if (request[bodyBufferKey]) return Promise.resolve(request[bodyBufferKey]);
|
|
31594
|
+
if (request[bodyReadPromiseKey]) return request[bodyReadPromiseKey];
|
|
31595
|
+
const incoming = request[incomingKey];
|
|
31596
|
+
if (incoming.readableDidRead) return rejectBodyUnusable();
|
|
31597
|
+
const buffered = readBodyBufferedBeforeDisconnect(incoming);
|
|
31598
|
+
if (buffered !== void 0) {
|
|
31599
|
+
if (buffered instanceof Error) return Promise.reject(buffered);
|
|
31600
|
+
request[bodyBufferKey] = buffered;
|
|
31601
|
+
return Promise.resolve(buffered);
|
|
31602
|
+
}
|
|
31603
|
+
const promise2 = new Promise((resolve2, reject) => {
|
|
31604
|
+
const chunks = [];
|
|
31605
|
+
let settled = false;
|
|
31606
|
+
const finish = (callback) => {
|
|
31607
|
+
if (settled) return;
|
|
31608
|
+
settled = true;
|
|
31609
|
+
cleanup();
|
|
31610
|
+
callback();
|
|
31611
|
+
};
|
|
31612
|
+
const recoverCompleteBodyAfterDisconnect = (error48) => {
|
|
31613
|
+
const streamError = incoming.errored ?? error48;
|
|
31614
|
+
if (!isRecoverableDisconnectedIncoming(incoming) || streamError && streamError.code !== "ECONNRESET") return false;
|
|
31615
|
+
finish(() => {
|
|
31616
|
+
const recovered = readBodyBufferedBeforeDisconnect(incoming, chunks);
|
|
31617
|
+
if (recovered instanceof Error) reject(recovered);
|
|
31618
|
+
else if (recovered === void 0) reject(error48 ?? normalizeAbortError(request, incoming));
|
|
31619
|
+
else {
|
|
31620
|
+
request[bodyBufferKey] = recovered;
|
|
31621
|
+
resolve2(recovered);
|
|
31622
|
+
}
|
|
31623
|
+
});
|
|
31624
|
+
return true;
|
|
31625
|
+
};
|
|
31626
|
+
const onData = (chunk) => {
|
|
31627
|
+
chunks.push(toBufferChunk(chunk, incoming.readableEncoding));
|
|
31628
|
+
};
|
|
31629
|
+
const onEnd = () => {
|
|
31630
|
+
finish(() => {
|
|
31631
|
+
const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks);
|
|
31632
|
+
request[bodyBufferKey] = buffer;
|
|
31633
|
+
resolve2(buffer);
|
|
31634
|
+
});
|
|
31635
|
+
};
|
|
31636
|
+
const onError = (error48) => {
|
|
31637
|
+
if (recoverCompleteBodyAfterDisconnect(error48)) return;
|
|
31638
|
+
finish(() => {
|
|
31639
|
+
reject(error48);
|
|
31640
|
+
});
|
|
31641
|
+
};
|
|
31642
|
+
const onClose = () => {
|
|
31643
|
+
if (incoming.readableEnded) {
|
|
31644
|
+
onEnd();
|
|
31645
|
+
return;
|
|
31646
|
+
}
|
|
31647
|
+
if (recoverCompleteBodyAfterDisconnect()) return;
|
|
31648
|
+
finish(() => {
|
|
31649
|
+
reject(normalizeAbortError(request, incoming));
|
|
31650
|
+
});
|
|
31651
|
+
};
|
|
31652
|
+
const cleanup = () => {
|
|
31653
|
+
incoming.off("data", onData);
|
|
31654
|
+
incoming.off("end", onEnd);
|
|
31655
|
+
incoming.off("error", onError);
|
|
31656
|
+
incoming.off("close", onClose);
|
|
31657
|
+
request[bodyReadPromiseKey] = void 0;
|
|
31658
|
+
};
|
|
31659
|
+
incoming.on("data", onData);
|
|
31660
|
+
incoming.on("end", onEnd);
|
|
31661
|
+
incoming.on("error", onError);
|
|
31662
|
+
incoming.on("close", onClose);
|
|
31663
|
+
queueMicrotask(() => {
|
|
31664
|
+
if (settled) return;
|
|
31665
|
+
if (incoming.readableEnded) onEnd();
|
|
31666
|
+
else if (incoming.errored) onError(incoming.errored);
|
|
31667
|
+
else if (incoming.destroyed) onClose();
|
|
31668
|
+
});
|
|
31669
|
+
});
|
|
31670
|
+
request[bodyReadPromiseKey] = promise2;
|
|
31671
|
+
return promise2;
|
|
31672
|
+
};
|
|
31258
31673
|
var requestPrototype = {
|
|
31259
31674
|
get method() {
|
|
31260
|
-
return this[
|
|
31675
|
+
return this[methodKey];
|
|
31261
31676
|
},
|
|
31262
31677
|
get url() {
|
|
31263
31678
|
return this[urlKey];
|
|
@@ -31265,24 +31680,57 @@ var requestPrototype = {
|
|
|
31265
31680
|
get headers() {
|
|
31266
31681
|
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
|
31267
31682
|
},
|
|
31683
|
+
[abortRequest](reason) {
|
|
31684
|
+
if (this[abortReasonKey] === void 0) this[abortReasonKey] = reason;
|
|
31685
|
+
const abortController = this[abortControllerKey];
|
|
31686
|
+
if (abortController && !abortController.signal.aborted) abortController.abort(reason);
|
|
31687
|
+
},
|
|
31268
31688
|
[getAbortController]() {
|
|
31269
|
-
this[
|
|
31689
|
+
this[abortControllerKey] ||= new AbortController();
|
|
31690
|
+
if (this[abortReasonKey] !== void 0 && !this[abortControllerKey].signal.aborted) this[abortControllerKey].abort(this[abortReasonKey]);
|
|
31270
31691
|
return this[abortControllerKey];
|
|
31271
31692
|
},
|
|
31272
31693
|
[getRequestCache]() {
|
|
31273
|
-
this[
|
|
31274
|
-
|
|
31275
|
-
|
|
31276
|
-
|
|
31277
|
-
this
|
|
31278
|
-
|
|
31279
|
-
|
|
31280
|
-
|
|
31694
|
+
const abortController = this[getAbortController]();
|
|
31695
|
+
if (this[requestCache]) return this[requestCache];
|
|
31696
|
+
const method = this.method;
|
|
31697
|
+
if (this[bodyConsumedDirectlyKey] && !(method === "GET" || method === "HEAD")) {
|
|
31698
|
+
this[bodyBufferKey] = void 0;
|
|
31699
|
+
const init = {
|
|
31700
|
+
method: method === "TRACE" ? "GET" : method,
|
|
31701
|
+
headers: this.headers,
|
|
31702
|
+
signal: abortController.signal
|
|
31703
|
+
};
|
|
31704
|
+
if (method !== "TRACE") {
|
|
31705
|
+
init.body = new ReadableStream({ start(c) {
|
|
31706
|
+
c.close();
|
|
31707
|
+
} });
|
|
31708
|
+
init.duplex = "half";
|
|
31709
|
+
}
|
|
31710
|
+
const req = new Request$1(this[urlKey], init);
|
|
31711
|
+
if (method === "TRACE") Object.defineProperty(req, "method", { get() {
|
|
31712
|
+
return "TRACE";
|
|
31713
|
+
} });
|
|
31714
|
+
return this[requestCache] = req;
|
|
31715
|
+
}
|
|
31716
|
+
return this[requestCache] = newRequestFromIncoming(this.method, this[urlKey], this.headers, this[incomingKey], abortController);
|
|
31717
|
+
},
|
|
31718
|
+
get body() {
|
|
31719
|
+
if (!this[bodyConsumedDirectlyKey]) return this[getRequestCache]().body;
|
|
31720
|
+
const request = this[getRequestCache]();
|
|
31721
|
+
if (!this[bodyLockReaderKey] && request.body) this[bodyLockReaderKey] = request.body.getReader();
|
|
31722
|
+
return request.body;
|
|
31723
|
+
},
|
|
31724
|
+
get bodyUsed() {
|
|
31725
|
+
if (this[bodyConsumedDirectlyKey]) return true;
|
|
31726
|
+
if (this[requestCache]) return this[requestCache].bodyUsed;
|
|
31727
|
+
return false;
|
|
31281
31728
|
}
|
|
31282
31729
|
};
|
|
31730
|
+
Object.defineProperty(requestPrototype, "signal", { get() {
|
|
31731
|
+
return this[getAbortController]().signal;
|
|
31732
|
+
} });
|
|
31283
31733
|
[
|
|
31284
|
-
"body",
|
|
31285
|
-
"bodyUsed",
|
|
31286
31734
|
"cache",
|
|
31287
31735
|
"credentials",
|
|
31288
31736
|
"destination",
|
|
@@ -31291,111 +31739,120 @@ var requestPrototype = {
|
|
|
31291
31739
|
"redirect",
|
|
31292
31740
|
"referrer",
|
|
31293
31741
|
"referrerPolicy",
|
|
31294
|
-
"signal",
|
|
31295
31742
|
"keepalive"
|
|
31296
31743
|
].forEach((k) => {
|
|
31297
|
-
Object.defineProperty(requestPrototype, k, {
|
|
31298
|
-
|
|
31299
|
-
|
|
31300
|
-
|
|
31301
|
-
|
|
31302
|
-
|
|
31303
|
-
[
|
|
31304
|
-
|
|
31305
|
-
|
|
31306
|
-
|
|
31307
|
-
|
|
31308
|
-
});
|
|
31309
|
-
});
|
|
31310
|
-
Object.defineProperty(requestPrototype,
|
|
31311
|
-
|
|
31312
|
-
|
|
31313
|
-
|
|
31314
|
-
|
|
31315
|
-
|
|
31316
|
-
|
|
31317
|
-
|
|
31318
|
-
|
|
31319
|
-
|
|
31320
|
-
|
|
31321
|
-
|
|
31744
|
+
Object.defineProperty(requestPrototype, k, { get() {
|
|
31745
|
+
return this[getRequestCache]()[k];
|
|
31746
|
+
} });
|
|
31747
|
+
});
|
|
31748
|
+
["clone", "formData"].forEach((k) => {
|
|
31749
|
+
Object.defineProperty(requestPrototype, k, { value: function() {
|
|
31750
|
+
if (this[bodyConsumedDirectlyKey]) {
|
|
31751
|
+
if (k === "clone") throw newBodyUnusableError();
|
|
31752
|
+
return rejectBodyUnusable();
|
|
31753
|
+
}
|
|
31754
|
+
return this[getRequestCache]()[k]();
|
|
31755
|
+
} });
|
|
31756
|
+
});
|
|
31757
|
+
Object.defineProperty(requestPrototype, "text", { value: function() {
|
|
31758
|
+
return readBodyWithFastPath(this, "text", (buf) => textDecoder.decode(buf));
|
|
31759
|
+
} });
|
|
31760
|
+
Object.defineProperty(requestPrototype, "arrayBuffer", { value: function() {
|
|
31761
|
+
return readBodyWithFastPath(this, "arrayBuffer", (buf) => toArrayBuffer(buf));
|
|
31762
|
+
} });
|
|
31763
|
+
Object.defineProperty(requestPrototype, "blob", { value: function() {
|
|
31764
|
+
return readBodyWithFastPath(this, "blob", (buf, request) => {
|
|
31765
|
+
const type = contentType(request);
|
|
31766
|
+
const init = type ? { headers: { "content-type": type } } : void 0;
|
|
31767
|
+
return new Response(buf, init).blob();
|
|
31768
|
+
});
|
|
31769
|
+
} });
|
|
31770
|
+
Object.defineProperty(requestPrototype, "json", { value: function() {
|
|
31771
|
+
if (this[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
|
|
31772
|
+
return this.text().then(JSON.parse);
|
|
31773
|
+
} });
|
|
31774
|
+
Object.defineProperty(requestPrototype, /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
|
|
31775
|
+
return `Request (lightweight) ${inspectFn({
|
|
31776
|
+
method: this.method,
|
|
31777
|
+
url: this.url,
|
|
31778
|
+
headers: this.headers,
|
|
31779
|
+
nativeRequest: this[requestCache]
|
|
31780
|
+
}, {
|
|
31781
|
+
...options,
|
|
31782
|
+
depth: depth == null ? null : depth - 1
|
|
31783
|
+
})}`;
|
|
31784
|
+
} });
|
|
31785
|
+
Object.setPrototypeOf(requestPrototype, Request$1.prototype);
|
|
31322
31786
|
var newRequest = (incoming, defaultHostname) => {
|
|
31323
31787
|
const req = Object.create(requestPrototype);
|
|
31324
31788
|
req[incomingKey] = incoming;
|
|
31789
|
+
req[methodKey] = normalizeIncomingMethod(incoming.method);
|
|
31325
31790
|
const incomingUrl = incoming.url || "";
|
|
31326
|
-
if (incomingUrl[0] !== "/" &&
|
|
31327
|
-
|
|
31328
|
-
if (incoming instanceof import_http22.Http2ServerRequest) {
|
|
31329
|
-
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
|
31330
|
-
}
|
|
31791
|
+
if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
|
31792
|
+
if (incoming instanceof import_node_http2.Http2ServerRequest) throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
|
31331
31793
|
try {
|
|
31332
|
-
|
|
31333
|
-
req[urlKey] = url22.href;
|
|
31794
|
+
req[urlKey] = new URL(incomingUrl).href;
|
|
31334
31795
|
} catch (e) {
|
|
31335
31796
|
throw new RequestError("Invalid absolute URL", { cause: e });
|
|
31336
31797
|
}
|
|
31337
31798
|
return req;
|
|
31338
31799
|
}
|
|
31339
|
-
const host2 = (incoming instanceof
|
|
31340
|
-
if (!host2)
|
|
31341
|
-
throw new RequestError("Missing host header");
|
|
31342
|
-
}
|
|
31800
|
+
const host2 = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
|
31801
|
+
if (!host2) throw new RequestError("Missing host header");
|
|
31343
31802
|
let scheme;
|
|
31344
|
-
if (incoming instanceof
|
|
31803
|
+
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
|
31345
31804
|
scheme = incoming.scheme;
|
|
31346
|
-
if (!(scheme === "http" || scheme === "https"))
|
|
31347
|
-
|
|
31348
|
-
|
|
31349
|
-
|
|
31350
|
-
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
if (url2.hostname.length !== host2.length && url2.hostname !== host2.replace(/:\d+$/, "")) {
|
|
31354
|
-
throw new RequestError("Invalid host header");
|
|
31805
|
+
if (!(scheme === "http" || scheme === "https")) throw new RequestError("Unsupported scheme");
|
|
31806
|
+
} else scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
|
31807
|
+
try {
|
|
31808
|
+
req[urlKey] = buildUrl(scheme, host2, incomingUrl);
|
|
31809
|
+
} catch (e) {
|
|
31810
|
+
if (e instanceof RequestError) throw e;
|
|
31811
|
+
else throw new RequestError("Invalid URL", { cause: e });
|
|
31355
31812
|
}
|
|
31356
|
-
req[urlKey] = url2.href;
|
|
31357
31813
|
return req;
|
|
31358
31814
|
};
|
|
31815
|
+
var defaultContentType = "text/plain; charset=UTF-8";
|
|
31359
31816
|
var responseCache = /* @__PURE__ */ Symbol("responseCache");
|
|
31360
31817
|
var getResponseCache = /* @__PURE__ */ Symbol("getResponseCache");
|
|
31361
31818
|
var cacheKey = /* @__PURE__ */ Symbol("cache");
|
|
31362
31819
|
var GlobalResponse = global.Response;
|
|
31363
|
-
var
|
|
31820
|
+
var Response$1 = class Response$12 {
|
|
31364
31821
|
#body;
|
|
31365
31822
|
#init;
|
|
31366
31823
|
[getResponseCache]() {
|
|
31824
|
+
const cache = this[cacheKey];
|
|
31825
|
+
const liveHeaders = cache && cache[2] instanceof Headers ? cache[2] : void 0;
|
|
31367
31826
|
delete this[cacheKey];
|
|
31368
|
-
return this[responseCache] ||= new GlobalResponse(this.#body,
|
|
31827
|
+
return this[responseCache] ||= new GlobalResponse(this.#body, liveHeaders ? {
|
|
31828
|
+
status: this.#init?.status,
|
|
31829
|
+
statusText: this.#init?.statusText,
|
|
31830
|
+
headers: liveHeaders
|
|
31831
|
+
} : this.#init);
|
|
31369
31832
|
}
|
|
31370
31833
|
constructor(body, init) {
|
|
31371
31834
|
let headers;
|
|
31372
31835
|
this.#body = body;
|
|
31373
|
-
if (init instanceof
|
|
31836
|
+
if (init instanceof GlobalResponse) {
|
|
31374
31837
|
const cachedGlobalResponse = init[responseCache];
|
|
31375
31838
|
if (cachedGlobalResponse) {
|
|
31376
31839
|
this.#init = cachedGlobalResponse;
|
|
31377
31840
|
this[getResponseCache]();
|
|
31378
31841
|
return;
|
|
31379
|
-
} else {
|
|
31380
|
-
this.#init = init.#init;
|
|
31381
|
-
headers = new Headers(init.#init.headers);
|
|
31382
31842
|
}
|
|
31383
|
-
|
|
31384
|
-
|
|
31385
|
-
}
|
|
31386
|
-
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array)
|
|
31387
|
-
|
|
31388
|
-
|
|
31389
|
-
|
|
31843
|
+
this.#init = init instanceof Response$12 ? init.#init : init;
|
|
31844
|
+
headers = new Headers(init.headers);
|
|
31845
|
+
} else this.#init = init;
|
|
31846
|
+
if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
|
|
31847
|
+
init?.status || 200,
|
|
31848
|
+
body ?? null,
|
|
31849
|
+
headers || init?.headers
|
|
31850
|
+
];
|
|
31390
31851
|
}
|
|
31391
31852
|
get headers() {
|
|
31392
31853
|
const cache = this[cacheKey];
|
|
31393
31854
|
if (cache) {
|
|
31394
|
-
if (!(cache[2] instanceof Headers)) {
|
|
31395
|
-
cache[2] = new Headers(
|
|
31396
|
-
cache[2] || { "content-type": "text/plain; charset=UTF-8" }
|
|
31397
|
-
);
|
|
31398
|
-
}
|
|
31855
|
+
if (!(cache[2] instanceof Headers)) cache[2] = new Headers(cache[2] || (cache[1] === null ? void 0 : { "content-type": defaultContentType }));
|
|
31399
31856
|
return cache[2];
|
|
31400
31857
|
}
|
|
31401
31858
|
return this[getResponseCache]().headers;
|
|
@@ -31408,33 +31865,87 @@ var Response2 = class _Response {
|
|
|
31408
31865
|
return status >= 200 && status < 300;
|
|
31409
31866
|
}
|
|
31410
31867
|
};
|
|
31411
|
-
[
|
|
31412
|
-
|
|
31413
|
-
|
|
31414
|
-
|
|
31415
|
-
|
|
31416
|
-
|
|
31417
|
-
|
|
31418
|
-
|
|
31419
|
-
|
|
31420
|
-
|
|
31421
|
-
|
|
31422
|
-
|
|
31423
|
-
});
|
|
31868
|
+
[
|
|
31869
|
+
"body",
|
|
31870
|
+
"bodyUsed",
|
|
31871
|
+
"redirected",
|
|
31872
|
+
"statusText",
|
|
31873
|
+
"trailers",
|
|
31874
|
+
"type",
|
|
31875
|
+
"url"
|
|
31876
|
+
].forEach((k) => {
|
|
31877
|
+
Object.defineProperty(Response$1.prototype, k, { get() {
|
|
31878
|
+
return this[getResponseCache]()[k];
|
|
31879
|
+
} });
|
|
31424
31880
|
});
|
|
31425
|
-
|
|
31426
|
-
|
|
31427
|
-
|
|
31428
|
-
|
|
31429
|
-
|
|
31430
|
-
|
|
31431
|
-
|
|
31432
|
-
|
|
31433
|
-
|
|
31434
|
-
|
|
31881
|
+
[
|
|
31882
|
+
"arrayBuffer",
|
|
31883
|
+
"blob",
|
|
31884
|
+
"clone",
|
|
31885
|
+
"formData",
|
|
31886
|
+
"json",
|
|
31887
|
+
"text"
|
|
31888
|
+
].forEach((k) => {
|
|
31889
|
+
Object.defineProperty(Response$1.prototype, k, { value: function() {
|
|
31890
|
+
return this[getResponseCache]()[k]();
|
|
31891
|
+
} });
|
|
31892
|
+
});
|
|
31893
|
+
Object.defineProperty(Response$1.prototype, /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
|
|
31894
|
+
return `Response (lightweight) ${inspectFn({
|
|
31895
|
+
status: this.status,
|
|
31896
|
+
headers: this.headers,
|
|
31897
|
+
ok: this.ok,
|
|
31898
|
+
nativeResponse: this[responseCache]
|
|
31899
|
+
}, {
|
|
31900
|
+
...options,
|
|
31901
|
+
depth: depth == null ? null : depth - 1
|
|
31902
|
+
})}`;
|
|
31903
|
+
} });
|
|
31904
|
+
Object.setPrototypeOf(Response$1, GlobalResponse);
|
|
31905
|
+
Object.setPrototypeOf(Response$1.prototype, GlobalResponse.prototype);
|
|
31906
|
+
var validRedirectUrl = /^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/;
|
|
31907
|
+
var parseRedirectUrl = (url2) => {
|
|
31908
|
+
if (url2 instanceof URL) return url2.href;
|
|
31909
|
+
if (validRedirectUrl.test(url2)) return url2;
|
|
31910
|
+
return new URL(url2).href;
|
|
31911
|
+
};
|
|
31912
|
+
var validRedirectStatuses = /* @__PURE__ */ new Set([
|
|
31913
|
+
301,
|
|
31914
|
+
302,
|
|
31915
|
+
303,
|
|
31916
|
+
307,
|
|
31917
|
+
308
|
|
31918
|
+
]);
|
|
31919
|
+
Object.defineProperty(Response$1, "redirect", {
|
|
31920
|
+
value: function redirect(url2, status = 302) {
|
|
31921
|
+
if (!validRedirectStatuses.has(status)) throw new RangeError("Invalid status code");
|
|
31922
|
+
return new Response$1(null, {
|
|
31923
|
+
status,
|
|
31924
|
+
headers: { location: parseRedirectUrl(url2) }
|
|
31925
|
+
});
|
|
31926
|
+
},
|
|
31927
|
+
writable: true,
|
|
31928
|
+
configurable: true
|
|
31929
|
+
});
|
|
31930
|
+
Object.defineProperty(Response$1, "json", {
|
|
31931
|
+
value: function json2(data, init) {
|
|
31932
|
+
const body = JSON.stringify(data);
|
|
31933
|
+
if (body === void 0) throw new TypeError("The data is not JSON serializable");
|
|
31934
|
+
const initHeaders = init?.headers;
|
|
31935
|
+
let headers;
|
|
31936
|
+
if (initHeaders) {
|
|
31937
|
+
headers = new Headers(initHeaders);
|
|
31938
|
+
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
31939
|
+
} else headers = { "content-type": "application/json" };
|
|
31940
|
+
return new Response$1(body, {
|
|
31941
|
+
status: init?.status ?? 200,
|
|
31942
|
+
statusText: init?.statusText,
|
|
31943
|
+
headers
|
|
31944
|
+
});
|
|
31945
|
+
},
|
|
31946
|
+
writable: true,
|
|
31947
|
+
configurable: true
|
|
31435
31948
|
});
|
|
31436
|
-
Object.setPrototypeOf(Response2, GlobalResponse);
|
|
31437
|
-
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
|
31438
31949
|
async function readWithoutBlocking(readPromise) {
|
|
31439
31950
|
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
|
31440
31951
|
}
|
|
@@ -31451,72 +31962,49 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
|
|
|
31451
31962
|
writable.off("error", cancel);
|
|
31452
31963
|
});
|
|
31453
31964
|
function handleStreamError(error48) {
|
|
31454
|
-
if (error48)
|
|
31455
|
-
writable.destroy(error48);
|
|
31456
|
-
}
|
|
31965
|
+
if (error48) writable.destroy(error48);
|
|
31457
31966
|
}
|
|
31458
31967
|
function onDrain() {
|
|
31459
31968
|
reader.read().then(flow, handleStreamError);
|
|
31460
31969
|
}
|
|
31461
31970
|
function flow({ done, value }) {
|
|
31462
31971
|
try {
|
|
31463
|
-
if (done)
|
|
31464
|
-
|
|
31465
|
-
|
|
31466
|
-
writable.once("drain", onDrain);
|
|
31467
|
-
} else {
|
|
31468
|
-
return reader.read().then(flow, handleStreamError);
|
|
31469
|
-
}
|
|
31972
|
+
if (done) writable.end();
|
|
31973
|
+
else if (!writable.write(value)) writable.once("drain", onDrain);
|
|
31974
|
+
else return reader.read().then(flow, handleStreamError);
|
|
31470
31975
|
} catch (e) {
|
|
31471
31976
|
handleStreamError(e);
|
|
31472
31977
|
}
|
|
31473
31978
|
}
|
|
31474
31979
|
}
|
|
31475
31980
|
function writeFromReadableStream(stream, writable) {
|
|
31476
|
-
if (stream.locked)
|
|
31477
|
-
|
|
31478
|
-
} else if (writable.destroyed) {
|
|
31479
|
-
return;
|
|
31480
|
-
}
|
|
31981
|
+
if (stream.locked) throw new TypeError("ReadableStream is locked.");
|
|
31982
|
+
else if (writable.destroyed) return;
|
|
31481
31983
|
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
|
31482
31984
|
}
|
|
31483
|
-
var buildOutgoingHttpHeaders = (headers) => {
|
|
31985
|
+
var buildOutgoingHttpHeaders = (headers, defaultContentType2) => {
|
|
31484
31986
|
const res = {};
|
|
31485
|
-
if (!(headers instanceof Headers))
|
|
31486
|
-
|
|
31487
|
-
|
|
31488
|
-
|
|
31489
|
-
|
|
31490
|
-
if (
|
|
31491
|
-
|
|
31492
|
-
|
|
31493
|
-
res[k] = v;
|
|
31494
|
-
}
|
|
31495
|
-
}
|
|
31496
|
-
if (cookies.length > 0) {
|
|
31497
|
-
res["set-cookie"] = cookies;
|
|
31498
|
-
}
|
|
31499
|
-
res["content-type"] ??= "text/plain; charset=UTF-8";
|
|
31987
|
+
if (!(headers instanceof Headers)) headers = new Headers(headers ?? void 0);
|
|
31988
|
+
if (headers.has("set-cookie")) {
|
|
31989
|
+
const cookies = [];
|
|
31990
|
+
for (const [k, v] of headers) if (k === "set-cookie") cookies.push(v);
|
|
31991
|
+
else res[k] = v;
|
|
31992
|
+
if (cookies.length > 0) res["set-cookie"] = cookies;
|
|
31993
|
+
} else for (const [k, v] of headers) res[k] = v;
|
|
31994
|
+
if (defaultContentType2) res["content-type"] ??= defaultContentType2;
|
|
31500
31995
|
return res;
|
|
31501
31996
|
};
|
|
31502
|
-
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
31503
|
-
if (typeof global.crypto === "undefined") {
|
|
31504
|
-
global.crypto = import_crypto.default;
|
|
31505
|
-
}
|
|
31506
31997
|
var outgoingEnded = /* @__PURE__ */ Symbol("outgoingEnded");
|
|
31507
31998
|
var incomingDraining = /* @__PURE__ */ Symbol("incomingDraining");
|
|
31508
31999
|
var DRAIN_TIMEOUT_MS = 500;
|
|
31509
32000
|
var MAX_DRAIN_BYTES = 64 * 1024 * 1024;
|
|
31510
32001
|
var drainIncoming = (incoming) => {
|
|
31511
32002
|
const incomingWithDrainState = incoming;
|
|
31512
|
-
if (incoming.destroyed || incomingWithDrainState[incomingDraining])
|
|
31513
|
-
return;
|
|
31514
|
-
}
|
|
32003
|
+
if (incoming.destroyed || incomingWithDrainState[incomingDraining]) return;
|
|
31515
32004
|
incomingWithDrainState[incomingDraining] = true;
|
|
31516
|
-
if (incoming instanceof
|
|
32005
|
+
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
|
31517
32006
|
try {
|
|
31518
|
-
;
|
|
31519
|
-
incoming.stream?.close?.(import_http2.constants.NGHTTP2_NO_ERROR);
|
|
32007
|
+
incoming.stream?.close?.(import_node_http2.constants.NGHTTP2_NO_ERROR);
|
|
31520
32008
|
} catch {
|
|
31521
32009
|
}
|
|
31522
32010
|
return;
|
|
@@ -31532,110 +32020,126 @@ var drainIncoming = (incoming) => {
|
|
|
31532
32020
|
cleanup();
|
|
31533
32021
|
const socket = incoming.socket;
|
|
31534
32022
|
if (socket && !socket.destroyed) {
|
|
31535
|
-
socket.destroySoon();
|
|
32023
|
+
if (typeof socket.destroySoon === "function") socket.destroySoon();
|
|
32024
|
+
else if (typeof socket.destroy === "function") socket.destroy();
|
|
31536
32025
|
}
|
|
31537
32026
|
};
|
|
31538
32027
|
const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
|
|
31539
32028
|
timer.unref?.();
|
|
31540
32029
|
const onData = (chunk) => {
|
|
31541
32030
|
bytesRead += chunk.length;
|
|
31542
|
-
if (bytesRead > MAX_DRAIN_BYTES)
|
|
31543
|
-
forceClose();
|
|
31544
|
-
}
|
|
32031
|
+
if (bytesRead > MAX_DRAIN_BYTES) forceClose();
|
|
31545
32032
|
};
|
|
31546
32033
|
incoming.on("data", onData);
|
|
31547
32034
|
incoming.on("end", cleanup);
|
|
31548
32035
|
incoming.on("error", cleanup);
|
|
31549
32036
|
incoming.resume();
|
|
31550
32037
|
};
|
|
31551
|
-
var
|
|
31552
|
-
|
|
31553
|
-
|
|
31554
|
-
|
|
31555
|
-
|
|
31556
|
-
|
|
32038
|
+
var makeCloseHandler = (req, incoming, outgoing, needsBodyCleanup) => () => {
|
|
32039
|
+
if (incoming.errored) {
|
|
32040
|
+
recordBodyBufferedBeforeDisconnect(incoming);
|
|
32041
|
+
req[abortRequest](incoming.errored.toString());
|
|
32042
|
+
} else if (!outgoing.writableFinished) {
|
|
32043
|
+
recordBodyBufferedBeforeDisconnect(incoming);
|
|
32044
|
+
req[abortRequest]("Client connection prematurely closed.");
|
|
32045
|
+
}
|
|
32046
|
+
if (needsBodyCleanup && !incoming.readableEnded) setTimeout(() => {
|
|
32047
|
+
if (!incoming.readableEnded) setTimeout(() => {
|
|
32048
|
+
drainIncoming(incoming);
|
|
32049
|
+
});
|
|
32050
|
+
});
|
|
32051
|
+
};
|
|
32052
|
+
var isImmediateCacheableResponse = (res) => {
|
|
32053
|
+
if (!(cacheKey in res)) return false;
|
|
32054
|
+
const body = res[cacheKey][1];
|
|
32055
|
+
return body === null || typeof body === "string" || body instanceof Uint8Array;
|
|
32056
|
+
};
|
|
32057
|
+
var handleRequestError = () => new Response(null, { status: 400 });
|
|
32058
|
+
var handleFetchError = (e) => new Response(null, { status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 });
|
|
31557
32059
|
var handleResponseError = (e, outgoing) => {
|
|
31558
32060
|
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
|
31559
|
-
if (err.code === "ERR_STREAM_PREMATURE_CLOSE")
|
|
31560
|
-
|
|
31561
|
-
} else {
|
|
32061
|
+
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") console.info("The user aborted a request.");
|
|
32062
|
+
else {
|
|
31562
32063
|
console.error(e);
|
|
31563
|
-
if (!outgoing.headersSent) {
|
|
31564
|
-
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
|
31565
|
-
}
|
|
32064
|
+
if (!outgoing.headersSent) outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
|
31566
32065
|
outgoing.end(`Error: ${err.message}`);
|
|
31567
32066
|
outgoing.destroy(err);
|
|
31568
32067
|
}
|
|
31569
32068
|
};
|
|
31570
32069
|
var flushHeaders = (outgoing) => {
|
|
31571
|
-
if ("flushHeaders" in outgoing && outgoing.writable)
|
|
31572
|
-
outgoing.flushHeaders();
|
|
31573
|
-
}
|
|
32070
|
+
if ("flushHeaders" in outgoing && outgoing.writable) outgoing.flushHeaders();
|
|
31574
32071
|
};
|
|
31575
32072
|
var responseViaCache = async (res, outgoing) => {
|
|
31576
32073
|
let [status, body, header] = res[cacheKey];
|
|
31577
|
-
let hasContentLength = false;
|
|
31578
32074
|
if (!header) {
|
|
31579
|
-
|
|
31580
|
-
|
|
32075
|
+
if (body === null) {
|
|
32076
|
+
outgoing.writeHead(status);
|
|
32077
|
+
outgoing.end();
|
|
32078
|
+
} else if (typeof body === "string") {
|
|
32079
|
+
outgoing.writeHead(status, {
|
|
32080
|
+
"Content-Type": defaultContentType,
|
|
32081
|
+
"Content-Length": Buffer.byteLength(body)
|
|
32082
|
+
});
|
|
32083
|
+
outgoing.end(body);
|
|
32084
|
+
} else if (body instanceof Uint8Array) {
|
|
32085
|
+
outgoing.writeHead(status, {
|
|
32086
|
+
"Content-Type": defaultContentType,
|
|
32087
|
+
"Content-Length": body.byteLength
|
|
32088
|
+
});
|
|
32089
|
+
outgoing.end(body);
|
|
32090
|
+
} else if (body instanceof Blob) {
|
|
32091
|
+
outgoing.writeHead(status, {
|
|
32092
|
+
"Content-Type": defaultContentType,
|
|
32093
|
+
"Content-Length": body.size
|
|
32094
|
+
});
|
|
32095
|
+
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
|
32096
|
+
} else {
|
|
32097
|
+
outgoing.writeHead(status, { "Content-Type": defaultContentType });
|
|
32098
|
+
flushHeaders(outgoing);
|
|
32099
|
+
await writeFromReadableStream(body, outgoing)?.catch((e) => handleResponseError(e, outgoing));
|
|
32100
|
+
}
|
|
32101
|
+
outgoing[outgoingEnded]?.();
|
|
32102
|
+
return;
|
|
32103
|
+
}
|
|
32104
|
+
let hasContentLength = false;
|
|
32105
|
+
if (header instanceof Headers) {
|
|
31581
32106
|
hasContentLength = header.has("content-length");
|
|
31582
|
-
header = buildOutgoingHttpHeaders(header);
|
|
32107
|
+
header = buildOutgoingHttpHeaders(header, body === null ? void 0 : defaultContentType);
|
|
31583
32108
|
} else if (Array.isArray(header)) {
|
|
31584
32109
|
const headerObj = new Headers(header);
|
|
31585
32110
|
hasContentLength = headerObj.has("content-length");
|
|
31586
|
-
header = buildOutgoingHttpHeaders(headerObj);
|
|
31587
|
-
} else {
|
|
31588
|
-
|
|
31589
|
-
|
|
31590
|
-
hasContentLength = true;
|
|
31591
|
-
break;
|
|
31592
|
-
}
|
|
31593
|
-
}
|
|
32111
|
+
header = buildOutgoingHttpHeaders(headerObj, body === null ? void 0 : defaultContentType);
|
|
32112
|
+
} else for (const key in header) if (key.length === 14 && key.toLowerCase() === "content-length") {
|
|
32113
|
+
hasContentLength = true;
|
|
32114
|
+
break;
|
|
31594
32115
|
}
|
|
31595
32116
|
if (!hasContentLength) {
|
|
31596
|
-
if (typeof body === "string")
|
|
31597
|
-
|
|
31598
|
-
|
|
31599
|
-
header["Content-Length"] = body.byteLength;
|
|
31600
|
-
} else if (body instanceof Blob) {
|
|
31601
|
-
header["Content-Length"] = body.size;
|
|
31602
|
-
}
|
|
32117
|
+
if (typeof body === "string") header["Content-Length"] = Buffer.byteLength(body);
|
|
32118
|
+
else if (body instanceof Uint8Array) header["Content-Length"] = body.byteLength;
|
|
32119
|
+
else if (body instanceof Blob) header["Content-Length"] = body.size;
|
|
31603
32120
|
}
|
|
31604
32121
|
outgoing.writeHead(status, header);
|
|
31605
|
-
if (
|
|
31606
|
-
|
|
31607
|
-
|
|
31608
|
-
|
|
31609
|
-
} else {
|
|
32122
|
+
if (body == null) outgoing.end();
|
|
32123
|
+
else if (typeof body === "string" || body instanceof Uint8Array) outgoing.end(body);
|
|
32124
|
+
else if (body instanceof Blob) outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
|
32125
|
+
else {
|
|
31610
32126
|
flushHeaders(outgoing);
|
|
31611
|
-
await writeFromReadableStream(body, outgoing)?.catch(
|
|
31612
|
-
(e) => handleResponseError(e, outgoing)
|
|
31613
|
-
);
|
|
32127
|
+
await writeFromReadableStream(body, outgoing)?.catch((e) => handleResponseError(e, outgoing));
|
|
31614
32128
|
}
|
|
31615
|
-
;
|
|
31616
32129
|
outgoing[outgoingEnded]?.();
|
|
31617
32130
|
};
|
|
31618
32131
|
var isPromise = (res) => typeof res.then === "function";
|
|
31619
32132
|
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
31620
|
-
if (isPromise(res)) {
|
|
31621
|
-
|
|
31622
|
-
|
|
31623
|
-
|
|
31624
|
-
|
|
31625
|
-
|
|
31626
|
-
if (!errRes) {
|
|
31627
|
-
return;
|
|
31628
|
-
}
|
|
31629
|
-
res = errRes;
|
|
31630
|
-
}
|
|
31631
|
-
} else {
|
|
31632
|
-
res = await res.catch(handleFetchError);
|
|
31633
|
-
}
|
|
31634
|
-
}
|
|
31635
|
-
if (cacheKey in res) {
|
|
31636
|
-
return responseViaCache(res, outgoing);
|
|
32133
|
+
if (isPromise(res)) if (options.errorHandler) try {
|
|
32134
|
+
res = await res;
|
|
32135
|
+
} catch (err) {
|
|
32136
|
+
const errRes = await options.errorHandler(err);
|
|
32137
|
+
if (!errRes) return;
|
|
32138
|
+
res = errRes;
|
|
31637
32139
|
}
|
|
31638
|
-
|
|
32140
|
+
else res = await res.catch(handleFetchError);
|
|
32141
|
+
if (cacheKey in res) return responseViaCache(res, outgoing);
|
|
32142
|
+
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers, res.body === null ? void 0 : defaultContentType);
|
|
31639
32143
|
if (res.body) {
|
|
31640
32144
|
const reader = res.body.getReader();
|
|
31641
32145
|
const values = [];
|
|
@@ -31658,29 +32162,21 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
31658
32162
|
break;
|
|
31659
32163
|
}
|
|
31660
32164
|
currentReadPromise = void 0;
|
|
31661
|
-
if (chunk.value)
|
|
31662
|
-
values.push(chunk.value);
|
|
31663
|
-
}
|
|
32165
|
+
if (chunk.value) values.push(chunk.value);
|
|
31664
32166
|
if (chunk.done) {
|
|
31665
32167
|
done = true;
|
|
31666
32168
|
break;
|
|
31667
32169
|
}
|
|
31668
32170
|
}
|
|
31669
|
-
if (done && !("content-length" in resHeaderRecord))
|
|
31670
|
-
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
|
31671
|
-
}
|
|
32171
|
+
if (done && !("content-length" in resHeaderRecord)) resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
|
31672
32172
|
}
|
|
31673
32173
|
outgoing.writeHead(res.status, resHeaderRecord);
|
|
31674
32174
|
values.forEach((value) => {
|
|
31675
|
-
;
|
|
31676
32175
|
outgoing.write(value);
|
|
31677
32176
|
});
|
|
31678
|
-
if (done)
|
|
31679
|
-
|
|
31680
|
-
|
|
31681
|
-
if (values.length === 0) {
|
|
31682
|
-
flushHeaders(outgoing);
|
|
31683
|
-
}
|
|
32177
|
+
if (done) outgoing.end();
|
|
32178
|
+
else {
|
|
32179
|
+
if (values.length === 0) flushHeaders(outgoing);
|
|
31684
32180
|
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
|
31685
32181
|
}
|
|
31686
32182
|
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
|
@@ -31688,88 +32184,56 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
31688
32184
|
outgoing.writeHead(res.status, resHeaderRecord);
|
|
31689
32185
|
outgoing.end();
|
|
31690
32186
|
}
|
|
31691
|
-
;
|
|
31692
32187
|
outgoing[outgoingEnded]?.();
|
|
31693
32188
|
};
|
|
31694
32189
|
var getRequestListener = (fetchCallback, options = {}) => {
|
|
31695
32190
|
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
|
31696
|
-
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
|
31697
|
-
Object.defineProperty(global, "Request", {
|
|
31698
|
-
|
|
31699
|
-
});
|
|
31700
|
-
Object.defineProperty(global, "Response", {
|
|
31701
|
-
value: Response2
|
|
31702
|
-
});
|
|
32191
|
+
if (options.overrideGlobalObjects !== false && global.Request !== Request$1) {
|
|
32192
|
+
Object.defineProperty(global, "Request", { value: Request$1 });
|
|
32193
|
+
Object.defineProperty(global, "Response", { value: Response$1 });
|
|
31703
32194
|
}
|
|
31704
32195
|
return async (incoming, outgoing) => {
|
|
31705
32196
|
let res, req;
|
|
32197
|
+
let needsBodyCleanup = false;
|
|
32198
|
+
let closeHandlerAttached = false;
|
|
32199
|
+
const ensureCloseHandler = () => {
|
|
32200
|
+
if (!req || closeHandlerAttached) return;
|
|
32201
|
+
closeHandlerAttached = true;
|
|
32202
|
+
outgoing.on("close", makeCloseHandler(req, incoming, outgoing, needsBodyCleanup));
|
|
32203
|
+
};
|
|
31706
32204
|
try {
|
|
31707
32205
|
req = newRequest(incoming, options.hostname);
|
|
31708
|
-
|
|
31709
|
-
if (
|
|
31710
|
-
;
|
|
32206
|
+
needsBodyCleanup = autoCleanupIncoming && !(incoming.method === "GET" || incoming.method === "HEAD");
|
|
32207
|
+
if (needsBodyCleanup) {
|
|
31711
32208
|
incoming[wrapBodyStream] = true;
|
|
31712
|
-
incoming.
|
|
31713
|
-
|
|
31714
|
-
|
|
31715
|
-
|
|
31716
|
-
|
|
31717
|
-
|
|
31718
|
-
if (!incomingEnded) {
|
|
31719
|
-
setTimeout(() => {
|
|
31720
|
-
if (!incomingEnded) {
|
|
31721
|
-
setTimeout(() => {
|
|
31722
|
-
drainIncoming(incoming);
|
|
31723
|
-
});
|
|
31724
|
-
}
|
|
31725
|
-
});
|
|
31726
|
-
}
|
|
31727
|
-
};
|
|
31728
|
-
}
|
|
31729
|
-
outgoing.on("finish", () => {
|
|
31730
|
-
if (!incomingEnded) {
|
|
31731
|
-
drainIncoming(incoming);
|
|
31732
|
-
}
|
|
31733
|
-
});
|
|
31734
|
-
}
|
|
31735
|
-
outgoing.on("close", () => {
|
|
31736
|
-
const abortController = req[abortControllerKey];
|
|
31737
|
-
if (abortController) {
|
|
31738
|
-
if (incoming.errored) {
|
|
31739
|
-
req[abortControllerKey].abort(incoming.errored.toString());
|
|
31740
|
-
} else if (!outgoing.writableFinished) {
|
|
31741
|
-
req[abortControllerKey].abort("Client connection prematurely closed.");
|
|
31742
|
-
}
|
|
31743
|
-
}
|
|
31744
|
-
if (!incomingEnded) {
|
|
31745
|
-
setTimeout(() => {
|
|
31746
|
-
if (!incomingEnded) {
|
|
31747
|
-
setTimeout(() => {
|
|
31748
|
-
drainIncoming(incoming);
|
|
31749
|
-
});
|
|
31750
|
-
}
|
|
32209
|
+
if (incoming instanceof import_node_http2.Http2ServerRequest) outgoing[outgoingEnded] = () => {
|
|
32210
|
+
if (!incoming.readableEnded) setTimeout(() => {
|
|
32211
|
+
if (!incoming.readableEnded) setTimeout(() => {
|
|
32212
|
+
incoming.destroy();
|
|
32213
|
+
outgoing.destroy();
|
|
32214
|
+
});
|
|
31751
32215
|
});
|
|
31752
|
-
}
|
|
32216
|
+
};
|
|
32217
|
+
}
|
|
32218
|
+
res = fetchCallback(req, {
|
|
32219
|
+
incoming,
|
|
32220
|
+
outgoing
|
|
31753
32221
|
});
|
|
31754
|
-
res
|
|
31755
|
-
|
|
32222
|
+
if (!isPromise(res) && isImmediateCacheableResponse(res)) {
|
|
32223
|
+
if (needsBodyCleanup && !incoming.readableEnded) outgoing.once("finish", () => {
|
|
32224
|
+
if (!incoming.readableEnded) drainIncoming(incoming);
|
|
32225
|
+
});
|
|
31756
32226
|
return responseViaCache(res, outgoing);
|
|
31757
32227
|
}
|
|
32228
|
+
ensureCloseHandler();
|
|
31758
32229
|
} catch (e) {
|
|
31759
|
-
if (!res) {
|
|
31760
|
-
|
|
31761
|
-
|
|
31762
|
-
|
|
31763
|
-
|
|
31764
|
-
|
|
31765
|
-
|
|
31766
|
-
res = handleRequestError();
|
|
31767
|
-
} else {
|
|
31768
|
-
res = handleFetchError(e);
|
|
31769
|
-
}
|
|
31770
|
-
} else {
|
|
31771
|
-
return handleResponseError(e, outgoing);
|
|
31772
|
-
}
|
|
32230
|
+
if (!res) if (options.errorHandler) {
|
|
32231
|
+
ensureCloseHandler();
|
|
32232
|
+
res = await options.errorHandler(req ? e : toRequestError(e));
|
|
32233
|
+
if (!res) return;
|
|
32234
|
+
} else if (!req) res = handleRequestError();
|
|
32235
|
+
else res = handleFetchError(e);
|
|
32236
|
+
else return handleResponseError(e, outgoing);
|
|
31773
32237
|
}
|
|
31774
32238
|
try {
|
|
31775
32239
|
return await responseViaResponseObject(res, outgoing, options);
|
|
@@ -31778,6 +32242,154 @@ var getRequestListener = (fetchCallback, options = {}) => {
|
|
|
31778
32242
|
}
|
|
31779
32243
|
};
|
|
31780
32244
|
};
|
|
32245
|
+
var CloseEvent = globalThis.CloseEvent ?? class extends Event {
|
|
32246
|
+
#eventInitDict;
|
|
32247
|
+
constructor(type, eventInitDict = {}) {
|
|
32248
|
+
super(type, eventInitDict);
|
|
32249
|
+
this.#eventInitDict = eventInitDict;
|
|
32250
|
+
}
|
|
32251
|
+
get wasClean() {
|
|
32252
|
+
return this.#eventInitDict.wasClean ?? false;
|
|
32253
|
+
}
|
|
32254
|
+
get code() {
|
|
32255
|
+
return this.#eventInitDict.code ?? 0;
|
|
32256
|
+
}
|
|
32257
|
+
get reason() {
|
|
32258
|
+
return this.#eventInitDict.reason ?? "";
|
|
32259
|
+
}
|
|
32260
|
+
};
|
|
32261
|
+
var ErrorEvent = globalThis.ErrorEvent ?? class extends Event {
|
|
32262
|
+
#eventInitDict;
|
|
32263
|
+
constructor(type, eventInitDict = {}) {
|
|
32264
|
+
super(type, eventInitDict);
|
|
32265
|
+
this.#eventInitDict = eventInitDict;
|
|
32266
|
+
}
|
|
32267
|
+
get message() {
|
|
32268
|
+
return this.#eventInitDict.message ?? "";
|
|
32269
|
+
}
|
|
32270
|
+
get filename() {
|
|
32271
|
+
return this.#eventInitDict.filename ?? "";
|
|
32272
|
+
}
|
|
32273
|
+
get lineno() {
|
|
32274
|
+
return this.#eventInitDict.lineno ?? 0;
|
|
32275
|
+
}
|
|
32276
|
+
get colno() {
|
|
32277
|
+
return this.#eventInitDict.colno ?? 0;
|
|
32278
|
+
}
|
|
32279
|
+
get error() {
|
|
32280
|
+
return this.#eventInitDict.error ?? null;
|
|
32281
|
+
}
|
|
32282
|
+
};
|
|
32283
|
+
var generateConnectionSymbol = () => /* @__PURE__ */ Symbol("connection");
|
|
32284
|
+
var CONNECTION_SYMBOL_KEY = /* @__PURE__ */ Symbol("CONNECTION_SYMBOL_KEY");
|
|
32285
|
+
var WAIT_FOR_WEBSOCKET_SYMBOL = /* @__PURE__ */ Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");
|
|
32286
|
+
var upgradeWebSocket = defineWebSocketHelper(async (c, events, options) => {
|
|
32287
|
+
if (c.req.header("upgrade")?.toLowerCase() !== "websocket") return;
|
|
32288
|
+
const env = c.env;
|
|
32289
|
+
const waitForWebSocket = env[WAIT_FOR_WEBSOCKET_SYMBOL];
|
|
32290
|
+
if (!waitForWebSocket || !env.incoming) return new Response(null, { status: 500 });
|
|
32291
|
+
const connectionSymbol = generateConnectionSymbol();
|
|
32292
|
+
env[CONNECTION_SYMBOL_KEY] = connectionSymbol;
|
|
32293
|
+
(async () => {
|
|
32294
|
+
let ws;
|
|
32295
|
+
try {
|
|
32296
|
+
ws = await waitForWebSocket(env.incoming, connectionSymbol);
|
|
32297
|
+
} catch {
|
|
32298
|
+
return;
|
|
32299
|
+
}
|
|
32300
|
+
const messagesReceivedInStarting = [];
|
|
32301
|
+
const bufferMessage = (data, isBinary) => {
|
|
32302
|
+
messagesReceivedInStarting.push([data, isBinary]);
|
|
32303
|
+
};
|
|
32304
|
+
ws.on("message", bufferMessage);
|
|
32305
|
+
const ctx = {
|
|
32306
|
+
binaryType: "arraybuffer",
|
|
32307
|
+
close(code, reason) {
|
|
32308
|
+
ws.close(code, reason);
|
|
32309
|
+
},
|
|
32310
|
+
protocol: ws.protocol,
|
|
32311
|
+
raw: ws,
|
|
32312
|
+
get readyState() {
|
|
32313
|
+
return ws.readyState;
|
|
32314
|
+
},
|
|
32315
|
+
send(source, opts) {
|
|
32316
|
+
ws.send(source, { compress: opts?.compress });
|
|
32317
|
+
},
|
|
32318
|
+
url: new URL(c.req.url)
|
|
32319
|
+
};
|
|
32320
|
+
try {
|
|
32321
|
+
events?.onOpen?.(new Event("open"), ctx);
|
|
32322
|
+
} catch (e) {
|
|
32323
|
+
(options?.onError ?? console.error)(e);
|
|
32324
|
+
}
|
|
32325
|
+
const handleMessage = (data, isBinary) => {
|
|
32326
|
+
const datas = Array.isArray(data) ? data : [data];
|
|
32327
|
+
for (const data2 of datas) try {
|
|
32328
|
+
events?.onMessage?.(new MessageEvent("message", { data: isBinary ? data2 instanceof ArrayBuffer ? data2 : data2.buffer.slice(data2.byteOffset, data2.byteOffset + data2.byteLength) : typeof data2 === "string" ? data2 : Buffer.from(data2).toString("utf-8") }), ctx);
|
|
32329
|
+
} catch (e) {
|
|
32330
|
+
(options?.onError ?? console.error)(e);
|
|
32331
|
+
}
|
|
32332
|
+
};
|
|
32333
|
+
ws.off("message", bufferMessage);
|
|
32334
|
+
for (const message of messagesReceivedInStarting) handleMessage(...message);
|
|
32335
|
+
ws.on("message", (data, isBinary) => {
|
|
32336
|
+
handleMessage(data, isBinary);
|
|
32337
|
+
});
|
|
32338
|
+
ws.on("close", (code, reason) => {
|
|
32339
|
+
try {
|
|
32340
|
+
events?.onClose?.(new CloseEvent("close", {
|
|
32341
|
+
code,
|
|
32342
|
+
reason: reason.toString()
|
|
32343
|
+
}), ctx);
|
|
32344
|
+
} catch (e) {
|
|
32345
|
+
(options?.onError ?? console.error)(e);
|
|
32346
|
+
}
|
|
32347
|
+
});
|
|
32348
|
+
ws.on("error", (error48) => {
|
|
32349
|
+
try {
|
|
32350
|
+
events?.onError?.(new ErrorEvent("error", { error: error48 }), ctx);
|
|
32351
|
+
} catch (e) {
|
|
32352
|
+
(options?.onError ?? console.error)(e);
|
|
32353
|
+
}
|
|
32354
|
+
});
|
|
32355
|
+
})();
|
|
32356
|
+
return new Response();
|
|
32357
|
+
});
|
|
32358
|
+
|
|
32359
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js
|
|
32360
|
+
var import_content_type = __toESM(require_content_type(), 1);
|
|
32361
|
+
function mediaTypeEssence(header) {
|
|
32362
|
+
if (!header) {
|
|
32363
|
+
return void 0;
|
|
32364
|
+
}
|
|
32365
|
+
try {
|
|
32366
|
+
return import_content_type.default.parse(header).type;
|
|
32367
|
+
} catch {
|
|
32368
|
+
const essence = (header.split(";", 1)[0] ?? "").trim().toLowerCase();
|
|
32369
|
+
if (essence === "" || header.slice(essence.length).includes(",")) {
|
|
32370
|
+
return void 0;
|
|
32371
|
+
}
|
|
32372
|
+
return essence;
|
|
32373
|
+
}
|
|
32374
|
+
}
|
|
32375
|
+
function isJsonContentType(header) {
|
|
32376
|
+
if (header === "application/json") {
|
|
32377
|
+
return true;
|
|
32378
|
+
}
|
|
32379
|
+
return mediaTypeEssence(header) === "application/json";
|
|
32380
|
+
}
|
|
32381
|
+
|
|
32382
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js
|
|
32383
|
+
var DEFAULT_SSE_KEEP_ALIVE_MS = 15e3;
|
|
32384
|
+
var MAX_TIMER_DELAY_MS = 2 ** 31 - 1;
|
|
32385
|
+
function armSseKeepAlive(intervalMs, onTick) {
|
|
32386
|
+
if (!Number.isFinite(intervalMs) || intervalMs < 1) {
|
|
32387
|
+
return void 0;
|
|
32388
|
+
}
|
|
32389
|
+
const timer = setInterval(onTick, Math.min(intervalMs, MAX_TIMER_DELAY_MS));
|
|
32390
|
+
timer.unref?.();
|
|
32391
|
+
return timer;
|
|
32392
|
+
}
|
|
31781
32393
|
|
|
31782
32394
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
|
|
31783
32395
|
var WebStandardStreamableHTTPServerTransport = class {
|
|
@@ -31786,10 +32398,12 @@ var WebStandardStreamableHTTPServerTransport = class {
|
|
|
31786
32398
|
this._hasHandledRequest = false;
|
|
31787
32399
|
this._streamMapping = /* @__PURE__ */ new Map();
|
|
31788
32400
|
this._requestToStreamMapping = /* @__PURE__ */ new Map();
|
|
32401
|
+
this._resumableStreams = /* @__PURE__ */ new Set();
|
|
31789
32402
|
this._requestResponseMap = /* @__PURE__ */ new Map();
|
|
31790
32403
|
this._initialized = false;
|
|
31791
32404
|
this._enableJsonResponse = false;
|
|
31792
32405
|
this._standaloneSseStreamId = "_GET_stream";
|
|
32406
|
+
this._closed = false;
|
|
31793
32407
|
this.sessionIdGenerator = options.sessionIdGenerator;
|
|
31794
32408
|
this._enableJsonResponse = options.enableJsonResponse ?? false;
|
|
31795
32409
|
this._eventStore = options.eventStore;
|
|
@@ -31799,6 +32413,27 @@ var WebStandardStreamableHTTPServerTransport = class {
|
|
|
31799
32413
|
this._allowedOrigins = options.allowedOrigins;
|
|
31800
32414
|
this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false;
|
|
31801
32415
|
this._retryInterval = options.retryInterval;
|
|
32416
|
+
this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS;
|
|
32417
|
+
}
|
|
32418
|
+
/**
|
|
32419
|
+
* Arms a keep-alive interval for an SSE stream that periodically writes an SSE
|
|
32420
|
+
* comment frame so intermediaries and idle timeouts don't kill the connection.
|
|
32421
|
+
* The returned timer is owned by the stream it was armed for: the stream's
|
|
32422
|
+
* cancel/cleanup callbacks must clear it. The interval clears itself if a
|
|
32423
|
+
* write fails (stream already closed/cancelled).
|
|
32424
|
+
*/
|
|
32425
|
+
startKeepAlive(controller, encoder) {
|
|
32426
|
+
if (this._closed)
|
|
32427
|
+
return void 0;
|
|
32428
|
+
const timer = armSseKeepAlive(this._keepAliveMs, () => {
|
|
32429
|
+
try {
|
|
32430
|
+
controller.enqueue(encoder.encode(": keepalive\n\n"));
|
|
32431
|
+
} catch {
|
|
32432
|
+
if (timer !== void 0)
|
|
32433
|
+
clearInterval(timer);
|
|
32434
|
+
}
|
|
32435
|
+
});
|
|
32436
|
+
return timer;
|
|
31802
32437
|
}
|
|
31803
32438
|
/**
|
|
31804
32439
|
* Starts the transport. This is required by the Transport interface but is a no-op
|
|
@@ -31861,6 +32496,9 @@ var WebStandardStreamableHTTPServerTransport = class {
|
|
|
31861
32496
|
* Returns a Response object (Web Standard)
|
|
31862
32497
|
*/
|
|
31863
32498
|
async handleRequest(req, options) {
|
|
32499
|
+
if (this._closed) {
|
|
32500
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
32501
|
+
}
|
|
31864
32502
|
if (!this.sessionIdGenerator && this._hasHandledRequest) {
|
|
31865
32503
|
throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");
|
|
31866
32504
|
}
|
|
@@ -31905,6 +32543,7 @@ data:
|
|
|
31905
32543
|
`;
|
|
31906
32544
|
}
|
|
31907
32545
|
controller.enqueue(encoder.encode(primingEvent));
|
|
32546
|
+
this._resumableStreams.add(streamId);
|
|
31908
32547
|
}
|
|
31909
32548
|
/**
|
|
31910
32549
|
* Handles GET requests for SSE stream
|
|
@@ -31935,18 +32574,25 @@ data:
|
|
|
31935
32574
|
}
|
|
31936
32575
|
const encoder = new TextEncoder();
|
|
31937
32576
|
let streamController;
|
|
32577
|
+
let keepAliveTimer = void 0;
|
|
31938
32578
|
const readable = new ReadableStream({
|
|
31939
32579
|
start: (controller) => {
|
|
31940
32580
|
streamController = controller;
|
|
31941
32581
|
},
|
|
31942
32582
|
cancel: () => {
|
|
31943
|
-
|
|
32583
|
+
if (keepAliveTimer !== void 0) {
|
|
32584
|
+
clearInterval(keepAliveTimer);
|
|
32585
|
+
}
|
|
32586
|
+
if (this._streamMapping.get(this._standaloneSseStreamId)?.controller === streamController) {
|
|
32587
|
+
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
32588
|
+
}
|
|
31944
32589
|
}
|
|
31945
32590
|
});
|
|
31946
32591
|
const headers = {
|
|
31947
32592
|
"Content-Type": "text/event-stream",
|
|
31948
32593
|
"Cache-Control": "no-cache, no-transform",
|
|
31949
|
-
Connection: "keep-alive"
|
|
32594
|
+
Connection: "keep-alive",
|
|
32595
|
+
"X-Accel-Buffering": "no"
|
|
31950
32596
|
};
|
|
31951
32597
|
if (this.sessionId !== void 0) {
|
|
31952
32598
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -31955,6 +32601,9 @@ data:
|
|
|
31955
32601
|
controller: streamController,
|
|
31956
32602
|
encoder,
|
|
31957
32603
|
cleanup: () => {
|
|
32604
|
+
if (keepAliveTimer !== void 0) {
|
|
32605
|
+
clearInterval(keepAliveTimer);
|
|
32606
|
+
}
|
|
31958
32607
|
this._streamMapping.delete(this._standaloneSseStreamId);
|
|
31959
32608
|
try {
|
|
31960
32609
|
streamController.close();
|
|
@@ -31962,6 +32611,7 @@ data:
|
|
|
31962
32611
|
}
|
|
31963
32612
|
}
|
|
31964
32613
|
});
|
|
32614
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
31965
32615
|
return new Response(readable, { headers });
|
|
31966
32616
|
}
|
|
31967
32617
|
/**
|
|
@@ -31989,21 +32639,33 @@ data:
|
|
|
31989
32639
|
const headers = {
|
|
31990
32640
|
"Content-Type": "text/event-stream",
|
|
31991
32641
|
"Cache-Control": "no-cache, no-transform",
|
|
31992
|
-
Connection: "keep-alive"
|
|
32642
|
+
Connection: "keep-alive",
|
|
32643
|
+
"X-Accel-Buffering": "no"
|
|
31993
32644
|
};
|
|
31994
32645
|
if (this.sessionId !== void 0) {
|
|
31995
32646
|
headers["mcp-session-id"] = this.sessionId;
|
|
31996
32647
|
}
|
|
31997
32648
|
const encoder = new TextEncoder();
|
|
31998
32649
|
let streamController;
|
|
32650
|
+
let keepAliveTimer = void 0;
|
|
32651
|
+
let replayedStreamId = void 0;
|
|
32652
|
+
let cancelled = false;
|
|
31999
32653
|
const readable = new ReadableStream({
|
|
32000
32654
|
start: (controller) => {
|
|
32001
32655
|
streamController = controller;
|
|
32002
32656
|
},
|
|
32003
32657
|
cancel: () => {
|
|
32658
|
+
cancelled = true;
|
|
32659
|
+
if (keepAliveTimer !== void 0) {
|
|
32660
|
+
clearInterval(keepAliveTimer);
|
|
32661
|
+
}
|
|
32662
|
+
if (replayedStreamId !== void 0 && this._streamMapping.get(replayedStreamId)?.controller === streamController) {
|
|
32663
|
+
this._streamMapping.delete(replayedStreamId);
|
|
32664
|
+
}
|
|
32004
32665
|
}
|
|
32005
32666
|
});
|
|
32006
|
-
const
|
|
32667
|
+
const replayedEventIds = /* @__PURE__ */ new Set();
|
|
32668
|
+
replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, {
|
|
32007
32669
|
send: async (eventId, message) => {
|
|
32008
32670
|
const success2 = this.writeSSEEvent(streamController, encoder, message, eventId);
|
|
32009
32671
|
if (!success2) {
|
|
@@ -32012,13 +32674,27 @@ data:
|
|
|
32012
32674
|
streamController.close();
|
|
32013
32675
|
} catch {
|
|
32014
32676
|
}
|
|
32677
|
+
} else {
|
|
32678
|
+
replayedEventIds.add(eventId);
|
|
32015
32679
|
}
|
|
32016
32680
|
}
|
|
32017
32681
|
});
|
|
32682
|
+
if (this._closed || cancelled) {
|
|
32683
|
+
try {
|
|
32684
|
+
streamController.close();
|
|
32685
|
+
} catch {
|
|
32686
|
+
}
|
|
32687
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
32688
|
+
}
|
|
32689
|
+
this._streamMapping.get(replayedStreamId)?.cleanup();
|
|
32018
32690
|
this._streamMapping.set(replayedStreamId, {
|
|
32019
32691
|
controller: streamController,
|
|
32020
32692
|
encoder,
|
|
32693
|
+
replayedEventIds,
|
|
32021
32694
|
cleanup: () => {
|
|
32695
|
+
if (keepAliveTimer !== void 0) {
|
|
32696
|
+
clearInterval(keepAliveTimer);
|
|
32697
|
+
}
|
|
32022
32698
|
this._streamMapping.delete(replayedStreamId);
|
|
32023
32699
|
try {
|
|
32024
32700
|
streamController.close();
|
|
@@ -32026,6 +32702,8 @@ data:
|
|
|
32026
32702
|
}
|
|
32027
32703
|
}
|
|
32028
32704
|
});
|
|
32705
|
+
this._resumableStreams.add(replayedStreamId);
|
|
32706
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
32029
32707
|
return new Response(readable, { headers });
|
|
32030
32708
|
} catch (error48) {
|
|
32031
32709
|
this.onerror?.(error48);
|
|
@@ -32084,7 +32762,7 @@ data:
|
|
|
32084
32762
|
return this.createJsonErrorResponse(406, -32e3, "Not Acceptable: Client must accept both application/json and text/event-stream");
|
|
32085
32763
|
}
|
|
32086
32764
|
const ct = req.headers.get("content-type");
|
|
32087
|
-
if (!ct
|
|
32765
|
+
if (!isJsonContentType(ct)) {
|
|
32088
32766
|
this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json"));
|
|
32089
32767
|
return this.createJsonErrorResponse(415, -32e3, "Unsupported Media Type: Content-Type must be application/json");
|
|
32090
32768
|
}
|
|
@@ -32114,6 +32792,9 @@ data:
|
|
|
32114
32792
|
this.onerror?.(new Error("Parse error: Invalid JSON-RPC message"));
|
|
32115
32793
|
return this.createJsonErrorResponse(400, -32700, "Parse error: Invalid JSON-RPC message");
|
|
32116
32794
|
}
|
|
32795
|
+
if (this._closed) {
|
|
32796
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
32797
|
+
}
|
|
32117
32798
|
const isInitializationRequest = messages.some(isInitializeRequest);
|
|
32118
32799
|
if (isInitializationRequest) {
|
|
32119
32800
|
if (this._initialized && this.sessionId !== void 0) {
|
|
@@ -32140,6 +32821,9 @@ data:
|
|
|
32140
32821
|
return protocolError;
|
|
32141
32822
|
}
|
|
32142
32823
|
}
|
|
32824
|
+
if (this._closed) {
|
|
32825
|
+
return this.createJsonErrorResponse(404, -32001, "Session not found");
|
|
32826
|
+
}
|
|
32143
32827
|
const hasRequests = messages.some(isJSONRPCRequest);
|
|
32144
32828
|
if (!hasRequests) {
|
|
32145
32829
|
for (const message of messages) {
|
|
@@ -32170,18 +32854,25 @@ data:
|
|
|
32170
32854
|
}
|
|
32171
32855
|
const encoder = new TextEncoder();
|
|
32172
32856
|
let streamController;
|
|
32857
|
+
let keepAliveTimer = void 0;
|
|
32173
32858
|
const readable = new ReadableStream({
|
|
32174
32859
|
start: (controller) => {
|
|
32175
32860
|
streamController = controller;
|
|
32176
32861
|
},
|
|
32177
32862
|
cancel: () => {
|
|
32178
|
-
|
|
32863
|
+
if (keepAliveTimer !== void 0) {
|
|
32864
|
+
clearInterval(keepAliveTimer);
|
|
32865
|
+
}
|
|
32866
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
32867
|
+
this._streamMapping.delete(streamId);
|
|
32868
|
+
}
|
|
32179
32869
|
}
|
|
32180
32870
|
});
|
|
32181
32871
|
const headers = {
|
|
32182
32872
|
"Content-Type": "text/event-stream",
|
|
32183
|
-
"Cache-Control": "no-cache",
|
|
32184
|
-
Connection: "keep-alive"
|
|
32873
|
+
"Cache-Control": "no-cache, no-transform",
|
|
32874
|
+
Connection: "keep-alive",
|
|
32875
|
+
"X-Accel-Buffering": "no"
|
|
32185
32876
|
};
|
|
32186
32877
|
if (this.sessionId !== void 0) {
|
|
32187
32878
|
headers["mcp-session-id"] = this.sessionId;
|
|
@@ -32192,6 +32883,9 @@ data:
|
|
|
32192
32883
|
controller: streamController,
|
|
32193
32884
|
encoder,
|
|
32194
32885
|
cleanup: () => {
|
|
32886
|
+
if (keepAliveTimer !== void 0) {
|
|
32887
|
+
clearInterval(keepAliveTimer);
|
|
32888
|
+
}
|
|
32195
32889
|
this._streamMapping.delete(streamId);
|
|
32196
32890
|
try {
|
|
32197
32891
|
streamController.close();
|
|
@@ -32202,19 +32896,33 @@ data:
|
|
|
32202
32896
|
this._requestToStreamMapping.set(message.id, streamId);
|
|
32203
32897
|
}
|
|
32204
32898
|
}
|
|
32205
|
-
|
|
32206
|
-
|
|
32207
|
-
|
|
32208
|
-
|
|
32209
|
-
|
|
32210
|
-
|
|
32211
|
-
|
|
32212
|
-
|
|
32213
|
-
|
|
32214
|
-
|
|
32215
|
-
|
|
32899
|
+
try {
|
|
32900
|
+
await this.writePrimingEvent(streamController, encoder, streamId, clientProtocolVersion);
|
|
32901
|
+
for (const message of messages) {
|
|
32902
|
+
let closeSSEStream;
|
|
32903
|
+
let closeStandaloneSSEStream;
|
|
32904
|
+
if (isJSONRPCRequest(message) && this._eventStore && clientProtocolVersion >= "2025-11-25") {
|
|
32905
|
+
closeSSEStream = () => {
|
|
32906
|
+
this.closeSSEStream(message.id);
|
|
32907
|
+
};
|
|
32908
|
+
closeStandaloneSSEStream = () => {
|
|
32909
|
+
this.closeStandaloneSSEStream();
|
|
32910
|
+
};
|
|
32911
|
+
}
|
|
32912
|
+
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream });
|
|
32216
32913
|
}
|
|
32217
|
-
|
|
32914
|
+
} catch (error48) {
|
|
32915
|
+
this._streamMapping.get(streamId)?.cleanup();
|
|
32916
|
+
this._resumableStreams.delete(streamId);
|
|
32917
|
+
for (const message of messages) {
|
|
32918
|
+
if (isJSONRPCRequest(message)) {
|
|
32919
|
+
this._requestToStreamMapping.delete(message.id);
|
|
32920
|
+
}
|
|
32921
|
+
}
|
|
32922
|
+
throw error48;
|
|
32923
|
+
}
|
|
32924
|
+
if (this._streamMapping.get(streamId)?.controller === streamController) {
|
|
32925
|
+
keepAliveTimer = this.startKeepAlive(streamController, encoder);
|
|
32218
32926
|
}
|
|
32219
32927
|
return new Response(readable, { status: 200, headers });
|
|
32220
32928
|
} catch (error48) {
|
|
@@ -32234,9 +32942,12 @@ data:
|
|
|
32234
32942
|
if (protocolError) {
|
|
32235
32943
|
return protocolError;
|
|
32236
32944
|
}
|
|
32237
|
-
|
|
32238
|
-
|
|
32239
|
-
|
|
32945
|
+
try {
|
|
32946
|
+
await Promise.resolve(this._onsessionclosed?.(this.sessionId));
|
|
32947
|
+
return new Response(null, { status: 200 });
|
|
32948
|
+
} finally {
|
|
32949
|
+
await this.close();
|
|
32950
|
+
}
|
|
32240
32951
|
}
|
|
32241
32952
|
/**
|
|
32242
32953
|
* Validates session ID for non-initialization requests.
|
|
@@ -32283,11 +32994,16 @@ data:
|
|
|
32283
32994
|
return void 0;
|
|
32284
32995
|
}
|
|
32285
32996
|
async close() {
|
|
32997
|
+
if (this._closed) {
|
|
32998
|
+
return;
|
|
32999
|
+
}
|
|
33000
|
+
this._closed = true;
|
|
32286
33001
|
this._streamMapping.forEach(({ cleanup }) => {
|
|
32287
33002
|
cleanup();
|
|
32288
33003
|
});
|
|
32289
33004
|
this._streamMapping.clear();
|
|
32290
33005
|
this._requestResponseMap.clear();
|
|
33006
|
+
this._resumableStreams.clear();
|
|
32291
33007
|
this.onclose?.();
|
|
32292
33008
|
}
|
|
32293
33009
|
/**
|
|
@@ -32331,7 +33047,7 @@ data:
|
|
|
32331
33047
|
if (standaloneSse === void 0) {
|
|
32332
33048
|
return;
|
|
32333
33049
|
}
|
|
32334
|
-
if (standaloneSse.controller && standaloneSse.encoder) {
|
|
33050
|
+
if (standaloneSse.controller && standaloneSse.encoder && (eventId === void 0 || !standaloneSse.replayedEventIds?.has(eventId))) {
|
|
32335
33051
|
this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId);
|
|
32336
33052
|
}
|
|
32337
33053
|
return;
|
|
@@ -32340,13 +33056,19 @@ data:
|
|
|
32340
33056
|
if (!streamId) {
|
|
32341
33057
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
32342
33058
|
}
|
|
32343
|
-
|
|
32344
|
-
if (!this._enableJsonResponse
|
|
33059
|
+
let stream = this._streamMapping.get(streamId);
|
|
33060
|
+
if (!this._enableJsonResponse) {
|
|
32345
33061
|
let eventId;
|
|
32346
33062
|
if (this._eventStore) {
|
|
32347
33063
|
eventId = await this._eventStore.storeEvent(streamId, message);
|
|
33064
|
+
stream = this._streamMapping.get(streamId);
|
|
33065
|
+
}
|
|
33066
|
+
if (stream?.controller && stream?.encoder && (eventId === void 0 || !stream.replayedEventIds?.has(eventId))) {
|
|
33067
|
+
const written = this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
33068
|
+
if (written && eventId !== void 0) {
|
|
33069
|
+
this._resumableStreams.add(streamId);
|
|
33070
|
+
}
|
|
32348
33071
|
}
|
|
32349
|
-
this.writeSSEEvent(stream.controller, stream.encoder, message, eventId);
|
|
32350
33072
|
}
|
|
32351
33073
|
if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) {
|
|
32352
33074
|
this._requestResponseMap.set(requestId, message);
|
|
@@ -32354,6 +33076,25 @@ data:
|
|
|
32354
33076
|
const allResponsesReady = relatedIds.every((id) => this._requestResponseMap.has(id));
|
|
32355
33077
|
if (allResponsesReady) {
|
|
32356
33078
|
if (!stream) {
|
|
33079
|
+
if (this._closed) {
|
|
33080
|
+
for (const id of relatedIds) {
|
|
33081
|
+
this._requestResponseMap.delete(id);
|
|
33082
|
+
this._requestToStreamMapping.delete(id);
|
|
33083
|
+
}
|
|
33084
|
+
return;
|
|
33085
|
+
}
|
|
33086
|
+
if (!this._enableJsonResponse && this._eventStore && this._resumableStreams.has(streamId)) {
|
|
33087
|
+
for (const id of relatedIds) {
|
|
33088
|
+
this._requestResponseMap.delete(id);
|
|
33089
|
+
this._requestToStreamMapping.delete(id);
|
|
33090
|
+
}
|
|
33091
|
+
this._resumableStreams.delete(streamId);
|
|
33092
|
+
return;
|
|
33093
|
+
}
|
|
33094
|
+
for (const id of relatedIds) {
|
|
33095
|
+
this._requestResponseMap.delete(id);
|
|
33096
|
+
this._requestToStreamMapping.delete(id);
|
|
33097
|
+
}
|
|
32357
33098
|
throw new Error(`No connection established for request ID: ${String(requestId)}`);
|
|
32358
33099
|
}
|
|
32359
33100
|
if (this._enableJsonResponse && stream.resolveJson) {
|
|
@@ -32376,6 +33117,7 @@ data:
|
|
|
32376
33117
|
this._requestResponseMap.delete(id);
|
|
32377
33118
|
this._requestToStreamMapping.delete(id);
|
|
32378
33119
|
}
|
|
33120
|
+
this._resumableStreams.delete(streamId);
|
|
32379
33121
|
}
|
|
32380
33122
|
}
|
|
32381
33123
|
}
|
|
@@ -33066,7 +33808,7 @@ function boundedEvidenceStrings(value, limits) {
|
|
|
33066
33808
|
function createWidgetEvidencePreview(evidence, limits = resolveMcpRenderOutputLimits()) {
|
|
33067
33809
|
if (!evidence) return null;
|
|
33068
33810
|
const preview = {};
|
|
33069
|
-
for (const key of ["component", "frameType", "status", "ariaLabel"]) {
|
|
33811
|
+
for (const key of ["component", "frameType", "status", "semanticStatus", "ariaLabel"]) {
|
|
33070
33812
|
if (typeof evidence[key] === "string") {
|
|
33071
33813
|
preview[key] = truncateUtf8(evidence[key], limits.maxWidgetValueBytes);
|
|
33072
33814
|
}
|
|
@@ -33101,6 +33843,25 @@ function createWidgetEvidencePreview(evidence, limits = resolveMcpRenderOutputLi
|
|
|
33101
33843
|
preview.warnings = warnings.values;
|
|
33102
33844
|
if (warnings.truncated) preview.warningsTruncated = true;
|
|
33103
33845
|
}
|
|
33846
|
+
if (Array.isArray(evidence.semanticDiagnostics)) {
|
|
33847
|
+
const sourceDiagnostics = evidence.semanticDiagnostics;
|
|
33848
|
+
const semanticDiagnostics = sourceDiagnostics.slice(0, WIDGET_EVIDENCE_ARRAY_ITEMS).filter(isRecord).map((diagnostic) => {
|
|
33849
|
+
const bounded = {};
|
|
33850
|
+
for (const key of ["code", "severity", "message", "fix"]) {
|
|
33851
|
+
if (typeof diagnostic[key] === "string") {
|
|
33852
|
+
bounded[key] = truncateUtf8(
|
|
33853
|
+
diagnostic[key],
|
|
33854
|
+
key === "code" || key === "severity" ? WIDGET_COLUMN_LABEL_BYTES : limits.maxWidgetValueBytes
|
|
33855
|
+
);
|
|
33856
|
+
}
|
|
33857
|
+
}
|
|
33858
|
+
return bounded;
|
|
33859
|
+
});
|
|
33860
|
+
preview.semanticDiagnostics = semanticDiagnostics;
|
|
33861
|
+
if (sourceDiagnostics.length > semanticDiagnostics.length) {
|
|
33862
|
+
preview.semanticDiagnosticsTruncated = true;
|
|
33863
|
+
}
|
|
33864
|
+
}
|
|
33104
33865
|
if (isRecord(evidence.markCountByType)) {
|
|
33105
33866
|
const markCountByType = {};
|
|
33106
33867
|
const entries = Object.entries(evidence.markCountByType).sort(([left], [right]) => left.localeCompare(right)).slice(0, WIDGET_EVIDENCE_OBJECT_KEYS);
|
|
@@ -33219,6 +33980,42 @@ var import_ai3 = require("semiotic/ai");
|
|
|
33219
33980
|
var import_componentMetadata = __toESM(require_componentMetadata());
|
|
33220
33981
|
var import_chartSuggestions = __toESM(require_chartSuggestions());
|
|
33221
33982
|
var import_behaviorContracts = __toESM(require_behaviorContracts());
|
|
33983
|
+
var MCP_PROFILE_HINT_INPUT = {
|
|
33984
|
+
identifiers: external_exports3.array(external_exports3.string()).optional().describe("Fields that identify records and must not be used as visual encodings or measures."),
|
|
33985
|
+
fieldRoles: external_exports3.record(
|
|
33986
|
+
external_exports3.string(),
|
|
33987
|
+
external_exports3.union([
|
|
33988
|
+
external_exports3.enum([
|
|
33989
|
+
"identifier",
|
|
33990
|
+
"measure",
|
|
33991
|
+
"dimension",
|
|
33992
|
+
"temporal",
|
|
33993
|
+
"x",
|
|
33994
|
+
"y",
|
|
33995
|
+
"size",
|
|
33996
|
+
"category",
|
|
33997
|
+
"series",
|
|
33998
|
+
"time",
|
|
33999
|
+
"ignore"
|
|
34000
|
+
]),
|
|
34001
|
+
external_exports3.array(
|
|
34002
|
+
external_exports3.enum([
|
|
34003
|
+
"identifier",
|
|
34004
|
+
"measure",
|
|
34005
|
+
"dimension",
|
|
34006
|
+
"temporal",
|
|
34007
|
+
"x",
|
|
34008
|
+
"y",
|
|
34009
|
+
"size",
|
|
34010
|
+
"category",
|
|
34011
|
+
"series",
|
|
34012
|
+
"time",
|
|
34013
|
+
"ignore"
|
|
34014
|
+
])
|
|
34015
|
+
)
|
|
34016
|
+
])
|
|
34017
|
+
).optional().describe("Per-field semantic or exact encoding-role hints used before chart ranking.")
|
|
34018
|
+
};
|
|
33222
34019
|
var {
|
|
33223
34020
|
componentIndexFromSchema,
|
|
33224
34021
|
metadataForComponent
|
|
@@ -33939,7 +34736,8 @@ async function getSchemaHandler(args) {
|
|
|
33939
34736
|
const component = args.component;
|
|
33940
34737
|
const availableComponents = allComponentNames.map((name) => ({
|
|
33941
34738
|
name,
|
|
33942
|
-
renderable: metadataForComponent(name).renderable
|
|
34739
|
+
renderable: metadataForComponent(name).renderable,
|
|
34740
|
+
requiresLiveData: metadataForComponent(name).requiresLiveData
|
|
33943
34741
|
}));
|
|
33944
34742
|
if (!component) {
|
|
33945
34743
|
const list = availableComponents.map(
|
|
@@ -33953,7 +34751,7 @@ ${list.join(", ")}
|
|
|
33953
34751
|
|
|
33954
34752
|
Components marked [renderable] can be rendered to SVG via renderChart (pass theme parameter for styled output). Others (Realtime*) require a browser environment.
|
|
33955
34753
|
|
|
33956
|
-
For
|
|
34754
|
+
For compact guidance, read semiotic://system-prompt and semiotic://behavior-contracts. Retrieve semiotic://examples only when a nearby working pattern is needed; the complete schema and surface manifest are discovery/debugging resources, not default context.
|
|
33957
34755
|
|
|
33958
34756
|
All charts support CSS custom properties for theming (--semiotic-bg, --semiotic-text, --semiotic-grid, etc.) and <ThemeProvider>. Use COLOR_BLIND_SAFE_CATEGORICAL (import from semiotic/themes) for accessible color palettes.
|
|
33959
34757
|
|
|
@@ -33982,6 +34780,7 @@ Pass { component: '<name>' } to get the prop schema for a specific component.`
|
|
|
33982
34780
|
};
|
|
33983
34781
|
}
|
|
33984
34782
|
const renderable = metadataForComponent(component).renderable;
|
|
34783
|
+
const requiresLiveData = metadataForComponent(component).requiresLiveData;
|
|
33985
34784
|
const renderableNote = renderable ? "This component can be rendered to SVG via renderChart." : "This component requires a browser environment and cannot be rendered via renderChart.";
|
|
33986
34785
|
const contracts = behaviorContractsFor({
|
|
33987
34786
|
component,
|
|
@@ -34002,6 +34801,7 @@ ${JSON.stringify(entry, null, 2)}${contractText}`
|
|
|
34002
34801
|
status: "component-schema",
|
|
34003
34802
|
component,
|
|
34004
34803
|
renderable,
|
|
34804
|
+
requiresLiveData,
|
|
34005
34805
|
schema: entry,
|
|
34006
34806
|
accessibility: schemaAccessibilityGuidance(entry),
|
|
34007
34807
|
behaviorContracts: contracts
|
|
@@ -34046,8 +34846,10 @@ async function renderChartHandler(args, context = {}) {
|
|
|
34046
34846
|
}
|
|
34047
34847
|
if (!COMPONENT_REGISTRY[component]) {
|
|
34048
34848
|
if (schemaByComponent[component]) {
|
|
34849
|
+
const metadata = metadataForComponent(component);
|
|
34850
|
+
const environment = metadata.requiresLiveData ? "live-data browser" : "browser";
|
|
34049
34851
|
return capRenderChartResult({
|
|
34050
|
-
content: [{ type: "text", text: `Component "${component}" is known but cannot be rendered via renderChart. It requires a
|
|
34852
|
+
content: [{ type: "text", text: `Component "${component}" is known but cannot be rendered via renderChart. It requires a ${environment} environment. Renderable components: ${componentNames.join(", ")}` }],
|
|
34051
34853
|
isError: true
|
|
34052
34854
|
});
|
|
34053
34855
|
}
|
|
@@ -34295,6 +35097,26 @@ async function auditAccessibilityHandler(args) {
|
|
|
34295
35097
|
isError: !result.ok
|
|
34296
35098
|
};
|
|
34297
35099
|
}
|
|
35100
|
+
async function evaluateChartHandler(args) {
|
|
35101
|
+
const component = args.component;
|
|
35102
|
+
const props = args.props ?? {};
|
|
35103
|
+
if (!component) {
|
|
35104
|
+
return {
|
|
35105
|
+
content: [{ type: "text", text: "Missing 'component' field. Provide { component: 'LineChart', props: { ... }, data?: [...] }." }],
|
|
35106
|
+
isError: true
|
|
35107
|
+
};
|
|
35108
|
+
}
|
|
35109
|
+
const result = (0, import_ai3.evaluateChart)(component, props, args.data, {
|
|
35110
|
+
inChartContainer: args.inChartContainer === true,
|
|
35111
|
+
describe: args.describe === true,
|
|
35112
|
+
navigable: args.navigable === true
|
|
35113
|
+
});
|
|
35114
|
+
return {
|
|
35115
|
+
content: [{ type: "text", text: (0, import_ai3.formatEvaluateChart)(result) }],
|
|
35116
|
+
structuredContent: result,
|
|
35117
|
+
isError: !result.ok
|
|
35118
|
+
};
|
|
35119
|
+
}
|
|
34298
35120
|
async function auditMobileVisualizationHandler(args) {
|
|
34299
35121
|
const component = args.component;
|
|
34300
35122
|
const props = args.props ?? {};
|
|
@@ -34446,41 +35268,54 @@ function buildVariantProposalProps(proposal, profile, audience) {
|
|
|
34446
35268
|
const variant = proposal.variantKey ? capability?.variants?.find((v) => v.key === proposal.variantKey) : void 0;
|
|
34447
35269
|
return capability ? capability.buildProps(profile, variant) : {};
|
|
34448
35270
|
}
|
|
34449
|
-
|
|
34450
|
-
const { component, intent, maxResults, audience } = args;
|
|
35271
|
+
function rankVariantProposals(component, profile, options = {}) {
|
|
34451
35272
|
const capability = (0, import_ai3.getCapability)(component);
|
|
34452
|
-
if (!capability) {
|
|
34453
|
-
return {
|
|
34454
|
-
content: [{ type: "text", text: `No chart capability registered for "${component}". Call suggestCharts first to pick from known capability components.` }],
|
|
34455
|
-
isError: true
|
|
34456
|
-
};
|
|
34457
|
-
}
|
|
34458
|
-
const { data, rawInput } = profileInputFromVariantArgs(args);
|
|
34459
|
-
const profile = (0, import_ai3.profileData)(data, { rawInput });
|
|
34460
|
-
const intentArg = Array.isArray(intent) ? intent : intent ? [intent] : void 0;
|
|
34461
|
-
const fitReason = capability.fits(profile);
|
|
35273
|
+
if (!capability) return { fitReason: void 0, proposals: [] };
|
|
34462
35274
|
const proposals = (0, import_ai3.proposeVariant)(component, capability, {
|
|
34463
35275
|
profile,
|
|
34464
|
-
audience,
|
|
34465
|
-
intent:
|
|
35276
|
+
audience: options.audience,
|
|
35277
|
+
intent: options.intent,
|
|
34466
35278
|
existingVariants: capability.variants
|
|
34467
35279
|
});
|
|
34468
35280
|
const ranked = proposals.map((proposal) => {
|
|
34469
|
-
const score = (0, import_ai3.evaluateVariantProposal)(proposal, profile, audience, {
|
|
34470
|
-
intent:
|
|
35281
|
+
const score = (0, import_ai3.evaluateVariantProposal)(proposal, profile, options.audience, {
|
|
35282
|
+
intent: options.intent,
|
|
34471
35283
|
baselineComponent: component
|
|
34472
35284
|
});
|
|
34473
35285
|
const { buildProps: _buildProps, ...proposalMeta } = proposal;
|
|
34474
35286
|
return {
|
|
34475
35287
|
proposal: proposalMeta,
|
|
34476
35288
|
score,
|
|
34477
|
-
props: buildVariantProposalProps(proposal, profile, audience)
|
|
35289
|
+
props: buildVariantProposalProps(proposal, profile, options.audience)
|
|
34478
35290
|
};
|
|
34479
|
-
}).sort((a, b) => {
|
|
35291
|
+
}).filter((entry) => !entry.score.rejected).sort((a, b) => {
|
|
34480
35292
|
if (b.score.fit !== a.score.fit) return b.score.fit - a.score.fit;
|
|
34481
35293
|
if (a.score.risk !== b.score.risk) return a.score.risk - b.score.risk;
|
|
34482
35294
|
return b.score.novelty - a.score.novelty;
|
|
34483
|
-
}).slice(0, maxResults ?? 8);
|
|
35295
|
+
}).slice(0, options.maxResults ?? 8);
|
|
35296
|
+
return { fitReason: capability.fits(profile), proposals: ranked };
|
|
35297
|
+
}
|
|
35298
|
+
async function proposeChartVariantsHandler(args) {
|
|
35299
|
+
const { component, intent, maxResults, audience } = args;
|
|
35300
|
+
const capability = (0, import_ai3.getCapability)(component);
|
|
35301
|
+
if (!capability) {
|
|
35302
|
+
return {
|
|
35303
|
+
content: [{ type: "text", text: `No chart capability registered for "${component}". Call suggestCharts first to pick from known capability components.` }],
|
|
35304
|
+
isError: true
|
|
35305
|
+
};
|
|
35306
|
+
}
|
|
35307
|
+
const { data, rawInput } = profileInputFromVariantArgs(args);
|
|
35308
|
+
const profile = (0, import_ai3.profileData)(data, {
|
|
35309
|
+
rawInput,
|
|
35310
|
+
identifiers: args.identifiers,
|
|
35311
|
+
fieldRoles: args.fieldRoles
|
|
35312
|
+
});
|
|
35313
|
+
const intentArg = Array.isArray(intent) ? intent : intent ? [intent] : void 0;
|
|
35314
|
+
const { fitReason, proposals: ranked } = rankVariantProposals(component, profile, {
|
|
35315
|
+
audience,
|
|
35316
|
+
intent: intentArg,
|
|
35317
|
+
maxResults
|
|
35318
|
+
});
|
|
34484
35319
|
const lines = [
|
|
34485
35320
|
`${ranked.length} variant proposal${ranked.length === 1 ? "" : "s"} for ${component}${intentArg ? ` (intent: ${intentArg.join(", ")})` : ""}:`,
|
|
34486
35321
|
...fitReason ? [`Base chart fit warning: ${fitReason}`] : [],
|
|
@@ -34512,15 +35347,30 @@ async function proposeChartVariantsHandler(args) {
|
|
|
34512
35347
|
};
|
|
34513
35348
|
}
|
|
34514
35349
|
async function suggestChartsHandler(args) {
|
|
34515
|
-
const {
|
|
35350
|
+
const {
|
|
35351
|
+
data,
|
|
35352
|
+
intent,
|
|
35353
|
+
maxResults,
|
|
35354
|
+
allow,
|
|
35355
|
+
deny,
|
|
35356
|
+
audience,
|
|
35357
|
+
identifiers,
|
|
35358
|
+
fieldRoles
|
|
35359
|
+
} = args;
|
|
34516
35360
|
const intentArg = Array.isArray(intent) ? intent : intent ? [intent] : void 0;
|
|
34517
|
-
const
|
|
35361
|
+
const suggestionOptions = {
|
|
34518
35362
|
intent: intentArg,
|
|
34519
35363
|
allow,
|
|
34520
35364
|
deny,
|
|
34521
35365
|
maxResults: maxResults ?? 8,
|
|
34522
|
-
audience
|
|
34523
|
-
|
|
35366
|
+
audience,
|
|
35367
|
+
identifiers,
|
|
35368
|
+
fieldRoles
|
|
35369
|
+
};
|
|
35370
|
+
const suggestions = (0, import_ai3.suggestCharts)(
|
|
35371
|
+
data,
|
|
35372
|
+
suggestionOptions
|
|
35373
|
+
);
|
|
34524
35374
|
const lines = [
|
|
34525
35375
|
`${suggestions.length} suggestion${suggestions.length === 1 ? "" : "s"} for ${data.length} rows${intentArg ? ` (intent: ${intentArg.join(", ")})` : ""}:`,
|
|
34526
35376
|
"",
|
|
@@ -34630,12 +35480,14 @@ async function suggestStreamChartsHandler(args) {
|
|
|
34630
35480
|
};
|
|
34631
35481
|
}
|
|
34632
35482
|
async function suggestDashboardHandler(args) {
|
|
34633
|
-
const { data, intents, maxPanels, diversifyByFamily, audience } = args;
|
|
35483
|
+
const { data, intents, maxPanels, diversifyByFamily, audience, identifiers, fieldRoles } = args;
|
|
34634
35484
|
const dashboard = (0, import_ai3.suggestDashboard)(data, {
|
|
34635
35485
|
intents,
|
|
34636
35486
|
maxPanels: maxPanels ?? 6,
|
|
34637
35487
|
diversifyByFamily: diversifyByFamily !== false,
|
|
34638
|
-
audience
|
|
35488
|
+
audience,
|
|
35489
|
+
identifiers,
|
|
35490
|
+
fieldRoles
|
|
34639
35491
|
});
|
|
34640
35492
|
const lines = [];
|
|
34641
35493
|
lines.push(`Dashboard: ${dashboard.panels.length} panels covering ${dashboard.intentsCovered.join(", ") || "\u2014"}`);
|
|
@@ -34663,12 +35515,14 @@ async function suggestDashboardHandler(args) {
|
|
|
34663
35515
|
};
|
|
34664
35516
|
}
|
|
34665
35517
|
async function suggestStretchChartsHandler(args) {
|
|
34666
|
-
const { data, audience, intent, maxResults } = args;
|
|
35518
|
+
const { data, audience, intent, maxResults, identifiers, fieldRoles } = args;
|
|
34667
35519
|
const intentArg = Array.isArray(intent) ? intent : intent ? [intent] : void 0;
|
|
34668
35520
|
const stretches = (0, import_ai3.suggestStretchCharts)(data, {
|
|
34669
35521
|
audience,
|
|
34670
35522
|
intent: intentArg,
|
|
34671
|
-
maxResults: maxResults ?? 5
|
|
35523
|
+
maxResults: maxResults ?? 5,
|
|
35524
|
+
identifiers,
|
|
35525
|
+
fieldRoles
|
|
34672
35526
|
});
|
|
34673
35527
|
const lines = [
|
|
34674
35528
|
`${stretches.length} stretch pick${stretches.length === 1 ? "" : "s"} for "${audience.name ?? "audience"}":`,
|
|
@@ -34686,11 +35540,13 @@ async function suggestStretchChartsHandler(args) {
|
|
|
34686
35540
|
};
|
|
34687
35541
|
}
|
|
34688
35542
|
async function repairChartConfigHandler(args) {
|
|
34689
|
-
const { component, data, intent, maxAlternatives } = args;
|
|
35543
|
+
const { component, data, intent, maxAlternatives, identifiers, fieldRoles } = args;
|
|
34690
35544
|
const intentArg = Array.isArray(intent) ? intent : intent ? [intent] : void 0;
|
|
34691
35545
|
const result = (0, import_ai3.repairChartConfig)(component, data, {
|
|
34692
35546
|
intent: intentArg,
|
|
34693
|
-
maxAlternatives: maxAlternatives ?? 3
|
|
35547
|
+
maxAlternatives: maxAlternatives ?? 3,
|
|
35548
|
+
identifiers,
|
|
35549
|
+
fieldRoles
|
|
34694
35550
|
});
|
|
34695
35551
|
const lines = [];
|
|
34696
35552
|
if (result.status === "ok") {
|
|
@@ -34779,7 +35635,13 @@ function compactPublicSuggestion(suggestion) {
|
|
|
34779
35635
|
}
|
|
34780
35636
|
async function createChartHandler(args, context = {}) {
|
|
34781
35637
|
const intent = Array.isArray(args.intent) ? args.intent : args.intent ? [args.intent] : void 0;
|
|
34782
|
-
const suggestions = (0, import_ai3.suggestCharts)(args.data, {
|
|
35638
|
+
const suggestions = (0, import_ai3.suggestCharts)(args.data, {
|
|
35639
|
+
intent,
|
|
35640
|
+
audience: args.audience,
|
|
35641
|
+
maxResults: 40,
|
|
35642
|
+
identifiers: args.identifiers,
|
|
35643
|
+
fieldRoles: args.fieldRoles
|
|
35644
|
+
}).filter((suggestion) => metadataForComponent(suggestion.component).renderable).slice(0, 8);
|
|
34783
35645
|
const selected = args.component ? suggestions.find((suggestion) => suggestion.component === args.component) : suggestions[0];
|
|
34784
35646
|
if (!selected) {
|
|
34785
35647
|
return {
|
|
@@ -34841,12 +35703,20 @@ async function createChartHandler(args, context = {}) {
|
|
|
34841
35703
|
};
|
|
34842
35704
|
}
|
|
34843
35705
|
async function improveChartHandler(args) {
|
|
34844
|
-
const data
|
|
35706
|
+
const { data, rawInput } = profileInputFromVariantArgs(args);
|
|
34845
35707
|
const intent = Array.isArray(args.intent) ? args.intent : args.intent ? [args.intent] : void 0;
|
|
34846
35708
|
const diagnosis = (0, import_ai3.diagnoseConfig)(args.component, args.props);
|
|
34847
|
-
const repair = (0, import_ai3.repairChartConfig)(args.component, data, {
|
|
34848
|
-
|
|
34849
|
-
|
|
35709
|
+
const repair = (0, import_ai3.repairChartConfig)(args.component, data, {
|
|
35710
|
+
intent,
|
|
35711
|
+
identifiers: args.identifiers,
|
|
35712
|
+
fieldRoles: args.fieldRoles
|
|
35713
|
+
});
|
|
35714
|
+
const profile = (0, import_ai3.profileData)(data, {
|
|
35715
|
+
rawInput,
|
|
35716
|
+
identifiers: args.identifiers,
|
|
35717
|
+
fieldRoles: args.fieldRoles
|
|
35718
|
+
});
|
|
35719
|
+
const { proposals: variants } = rankVariantProposals(args.component, profile, { intent });
|
|
34850
35720
|
const accessibility = accessibilityRecommendation(args.component, args.props, data);
|
|
34851
35721
|
return {
|
|
34852
35722
|
content: [{ type: "text", text: `Improvement analysis for ${args.component}: ${diagnosis.diagnoses.length} diagnosis item(s), repair status ${repair.status}, ${variants.length} variant proposal(s).` }],
|
|
@@ -34962,7 +35832,7 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
34962
35832
|
"semiotic://examples",
|
|
34963
35833
|
{
|
|
34964
35834
|
title: "Semiotic AI Examples",
|
|
34965
|
-
description: "
|
|
35835
|
+
description: "On-demand copy-paste examples for common Semiotic chart data shapes.",
|
|
34966
35836
|
mimeType: "text/markdown"
|
|
34967
35837
|
},
|
|
34968
35838
|
(uri) => textResource(uri, "text/markdown", readAIFile("examples.md"))
|
|
@@ -35013,8 +35883,8 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35013
35883
|
"4. Call getSchema for the selected component before writing JSX or renderChart props.",
|
|
35014
35884
|
'5. Call diagnoseConfig with usageMode="static" for renderChart/static data, or usageMode="push" for ref-based React code that intentionally omits data.',
|
|
35015
35885
|
"6. Fix all diagnoseConfig errors before presenting code.",
|
|
35016
|
-
"7. If the component is renderable and has static data, call renderChart
|
|
35017
|
-
"8.
|
|
35886
|
+
"7. If the component is renderable and has static data, call renderChart and verify its render evidence is non-empty and accessible.",
|
|
35887
|
+
"8. Use the chart family's sub-path in production code (for example semiotic/xy); import generation helpers from semiotic/ai or semiotic/ai/core.",
|
|
35018
35888
|
"",
|
|
35019
35889
|
"Return the final JSX or renderChart call plus any assumptions about fields, accessors, or aggregation."
|
|
35020
35890
|
].join("\n"))
|
|
@@ -35043,7 +35913,7 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35043
35913
|
'3. Call diagnoseConfig with usageMode="push" if the code intentionally omits data for a ref-push HOC; otherwise use usageMode="static".',
|
|
35044
35914
|
"4. Treat diagnoseConfig errors as blockers and warnings as review items.",
|
|
35045
35915
|
"5. If renderable and static data is available, call renderChart with a minimal reproduction to separate configuration issues from rendering bugs.",
|
|
35046
|
-
"6.
|
|
35916
|
+
"6. If schema and diagnostics are insufficient, check the relevant section of semiotic://examples for a nearby working pattern before inventing props.",
|
|
35047
35917
|
"7. If the result looks like a Semiotic bug, call reportIssue with the component, props summary, diagnoseConfig output, and renderChart result.",
|
|
35048
35918
|
"",
|
|
35049
35919
|
"Return the smallest safe fix first, then mention any follow-up cleanup or issue-reporting step."
|
|
@@ -35057,6 +35927,7 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35057
35927
|
data: external_exports3.array(external_exports3.record(external_exports3.string(), external_exports3.unknown())).min(1),
|
|
35058
35928
|
intent: external_exports3.union([external_exports3.string(), external_exports3.array(external_exports3.string())]).optional(),
|
|
35059
35929
|
audience: external_exports3.object({ name: external_exports3.string().optional(), receptionModality: external_exports3.enum(["visual", "screen-reader", "sonified", "agent"]).optional() }).passthrough().optional(),
|
|
35930
|
+
...MCP_PROFILE_HINT_INPUT,
|
|
35060
35931
|
component: external_exports3.string().optional().describe("Optional chart preference; the fit-ranked result remains authoritative."),
|
|
35061
35932
|
props: external_exports3.record(external_exports3.string(), external_exports3.unknown()).optional().describe("Optional props to merge over the selected chart recipe."),
|
|
35062
35933
|
theme: external_exports3.record(external_exports3.string(), external_exports3.string()).optional()
|
|
@@ -35068,7 +35939,13 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35068
35939
|
srv.registerTool("improveChart", {
|
|
35069
35940
|
title: "Improve an existing chart",
|
|
35070
35941
|
description: "Diagnose a chart configuration, assess data fit, and propose repairs or variants.",
|
|
35071
|
-
inputSchema: {
|
|
35942
|
+
inputSchema: {
|
|
35943
|
+
component: external_exports3.string(),
|
|
35944
|
+
props: external_exports3.record(external_exports3.string(), external_exports3.unknown()),
|
|
35945
|
+
data: external_exports3.array(external_exports3.record(external_exports3.string(), external_exports3.unknown())).optional(),
|
|
35946
|
+
intent: external_exports3.union([external_exports3.string(), external_exports3.array(external_exports3.string())]).optional(),
|
|
35947
|
+
...MCP_PROFILE_HINT_INPUT
|
|
35948
|
+
},
|
|
35072
35949
|
outputSchema: {
|
|
35073
35950
|
status: external_exports3.enum(["reviewed", "repair-needed"]),
|
|
35074
35951
|
component: external_exports3.string(),
|
|
@@ -35226,6 +36103,20 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35226
36103
|
READ_ONLY_TOOL_ANNOTATIONS,
|
|
35227
36104
|
auditAccessibilityHandler
|
|
35228
36105
|
);
|
|
36106
|
+
srv.tool(
|
|
36107
|
+
"evaluateChart",
|
|
36108
|
+
"Evaluate a Semiotic chart through one deterministic quality pass: numeric data contracts, configuration and representation/deception checks, and static Chartability accessibility heuristics. Returns the independent audit reports plus a severity-ranked findings list and notification feed. Pass data separately when it should override props.data; use inChartContainer, describe, or navigable to describe the intended accessibility wrapper. This is static analysis and does not replace manual assistive-technology testing or render evidence.",
|
|
36109
|
+
{
|
|
36110
|
+
component: external_exports3.string().describe("Chart component name, e.g. 'LineChart'."),
|
|
36111
|
+
props: external_exports3.record(external_exports3.string(), external_exports3.unknown()).optional().describe("Chart props/config, including accessors and optional data."),
|
|
36112
|
+
data: external_exports3.array(external_exports3.record(external_exports3.string(), external_exports3.unknown())).optional().describe("Optional explicit dataset. When supplied, this is used as the effective props.data for evaluation."),
|
|
36113
|
+
inChartContainer: external_exports3.boolean().optional().describe("Whether the chart will be wrapped in ChartContainer or an equivalent control surface."),
|
|
36114
|
+
describe: external_exports3.boolean().optional().describe("Whether ChartContainer's generated description is enabled."),
|
|
36115
|
+
navigable: external_exports3.boolean().optional().describe("Whether ChartContainer's structured navigation tree is enabled.")
|
|
36116
|
+
},
|
|
36117
|
+
READ_ONLY_TOOL_ANNOTATIONS,
|
|
36118
|
+
evaluateChartHandler
|
|
36119
|
+
);
|
|
35229
36120
|
srv.tool(
|
|
35230
36121
|
"auditMobileVisualization",
|
|
35231
36122
|
"Audit a Semiotic chart configuration for mobile visualization risks. Use before generating phone-sized charts or when adapting a desktop chart to mobile. Flags fixed desktop widths, rough mark-density overload, hover-only detail, small touch targets, complex gestures without controls, legend dependence, annotation overload, and missing mobile transformation hints. Static analysis only: still verify rendered charts at phone widths.",
|
|
@@ -35319,7 +36210,22 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35319
36210
|
data: external_exports3.array(external_exports3.record(external_exports3.string(), external_exports3.unknown())).describe("Row data \u2014 array of objects."),
|
|
35320
36211
|
intents: external_exports3.array(external_exports3.string()).optional().describe("Intents to cover. Omit to let the engine pick based on the data shape."),
|
|
35321
36212
|
maxPanels: external_exports3.number().int().min(1).max(12).optional().describe("Maximum panels (default 6)."),
|
|
35322
|
-
diversifyByFamily: external_exports3.boolean().optional().describe("Prefer not to repeat chart families across panels (default true).")
|
|
36213
|
+
diversifyByFamily: external_exports3.boolean().optional().describe("Prefer not to repeat chart families across panels (default true)."),
|
|
36214
|
+
...MCP_PROFILE_HINT_INPUT,
|
|
36215
|
+
audience: external_exports3.object({
|
|
36216
|
+
name: external_exports3.string().optional(),
|
|
36217
|
+
familiarity: external_exports3.record(external_exports3.string(), external_exports3.number()).optional(),
|
|
36218
|
+
targets: external_exports3.record(
|
|
36219
|
+
external_exports3.string(),
|
|
36220
|
+
external_exports3.object({
|
|
36221
|
+
direction: external_exports3.enum(["increase", "decrease"]),
|
|
36222
|
+
weight: external_exports3.number().int().min(1).max(3).optional(),
|
|
36223
|
+
reason: external_exports3.string().optional()
|
|
36224
|
+
})
|
|
36225
|
+
).optional(),
|
|
36226
|
+
exposureLevel: external_exports3.union([external_exports3.literal(0), external_exports3.literal(1), external_exports3.literal(2)]).optional(),
|
|
36227
|
+
receptionModality: external_exports3.enum(["visual", "screen-reader", "sonified", "agent"]).optional()
|
|
36228
|
+
}).optional().describe("Audience profile \u2014 familiarity, adoption targets, exposure level, and reception modality.")
|
|
35323
36229
|
},
|
|
35324
36230
|
READ_ONLY_TOOL_ANNOTATIONS,
|
|
35325
36231
|
suggestDashboardHandler
|
|
@@ -35358,7 +36264,8 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35358
36264
|
receptionModality: external_exports3.enum(["visual", "screen-reader", "sonified", "agent"]).optional().describe("Reception channel \u2014 see suggestCharts.")
|
|
35359
36265
|
}).describe("Audience profile \u2014 familiarity, targets, exposure level, reception modality."),
|
|
35360
36266
|
intent: external_exports3.union([external_exports3.string(), external_exports3.array(external_exports3.string())]).optional(),
|
|
35361
|
-
maxResults: external_exports3.number().int().min(1).max(20).optional()
|
|
36267
|
+
maxResults: external_exports3.number().int().min(1).max(20).optional(),
|
|
36268
|
+
...MCP_PROFILE_HINT_INPUT
|
|
35362
36269
|
},
|
|
35363
36270
|
READ_ONLY_TOOL_ANNOTATIONS,
|
|
35364
36271
|
suggestStretchChartsHandler
|
|
@@ -35372,7 +36279,8 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35372
36279
|
component: external_exports3.string().describe("Chart component name to validate, e.g. 'PieChart'"),
|
|
35373
36280
|
data: external_exports3.array(external_exports3.record(external_exports3.string(), external_exports3.unknown())).describe("Row data \u2014 array of objects."),
|
|
35374
36281
|
intent: external_exports3.union([external_exports3.string(), external_exports3.array(external_exports3.string())]).optional().describe("User intent \u2014 informs ranking of alternatives when the chart doesn't fit."),
|
|
35375
|
-
maxAlternatives: external_exports3.number().int().min(1).max(10).optional().describe("Cap on alternatives returned (default 3).")
|
|
36282
|
+
maxAlternatives: external_exports3.number().int().min(1).max(10).optional().describe("Cap on alternatives returned (default 3)."),
|
|
36283
|
+
...MCP_PROFILE_HINT_INPUT
|
|
35376
36284
|
},
|
|
35377
36285
|
outputSchema: {
|
|
35378
36286
|
status: external_exports3.enum(["ok", "alternative", "unknown"]),
|
|
@@ -35408,7 +36316,8 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35408
36316
|
).optional(),
|
|
35409
36317
|
exposureLevel: external_exports3.union([external_exports3.literal(0), external_exports3.literal(1), external_exports3.literal(2)]).optional(),
|
|
35410
36318
|
receptionModality: external_exports3.enum(["visual", "screen-reader", "sonified", "agent"]).optional().describe("Reception channel \u2014 see suggestCharts.")
|
|
35411
|
-
}).optional().describe("Audience profile \u2014 familiarity, adoption targets, exposure level, and reception modality.")
|
|
36319
|
+
}).optional().describe("Audience profile \u2014 familiarity, adoption targets, exposure level, and reception modality."),
|
|
36320
|
+
...MCP_PROFILE_HINT_INPUT
|
|
35412
36321
|
},
|
|
35413
36322
|
READ_ONLY_TOOL_ANNOTATIONS,
|
|
35414
36323
|
proposeChartVariantsHandler
|
|
@@ -35424,6 +36333,7 @@ function createServer2(profile = "developer", options = {}) {
|
|
|
35424
36333
|
maxResults: external_exports3.number().int().min(1).max(40).optional().describe("Cap on suggestions returned (default 8)."),
|
|
35425
36334
|
allow: external_exports3.array(external_exports3.string()).optional().describe("Restrict to these component names."),
|
|
35426
36335
|
deny: external_exports3.array(external_exports3.string()).optional().describe("Exclude these component names."),
|
|
36336
|
+
...MCP_PROFILE_HINT_INPUT,
|
|
35427
36337
|
audience: external_exports3.object({
|
|
35428
36338
|
name: external_exports3.string().optional(),
|
|
35429
36339
|
familiarity: external_exports3.record(external_exports3.string(), external_exports3.number()).optional(),
|
|
@@ -35786,3 +36696,12 @@ main().catch(() => {
|
|
|
35786
36696
|
mcpLogger.error("service_fatal", { reason: "service_startup_failure" });
|
|
35787
36697
|
process.exit(1);
|
|
35788
36698
|
});
|
|
36699
|
+
/*! Bundled license information:
|
|
36700
|
+
|
|
36701
|
+
content-type/index.js:
|
|
36702
|
+
(*!
|
|
36703
|
+
* content-type
|
|
36704
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
36705
|
+
* MIT Licensed
|
|
36706
|
+
*)
|
|
36707
|
+
*/
|