semiotic 3.9.2 → 3.10.1
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 +97 -76
- package/agent-skill/semiotic-charts/SKILL.md +13 -7
- package/ai/artifact-contract-reference.md +408 -0
- package/ai/artifact-surface-inventory.json +5586 -0
- package/ai/behaviorContracts.cjs +24 -2
- package/ai/cli.js +480 -56
- package/ai/componentMetadata.cjs +3 -1
- package/ai/dist/mcp-server.js +68 -68
- package/ai/examples.md +68 -1
- package/ai/reference.md +105 -14
- package/ai/schema.json +6646 -18
- package/ai/surface-manifest.json +34 -6
- package/ai/system-prompt.md +2 -0
- package/ai/task-packets/compare-category-totals.json +301 -0
- package/ai/task-packets/compare-category-totals.md +188 -0
- package/ai/task-packets/correct-published-chart.json +271 -0
- package/ai/task-packets/correct-published-chart.md +597 -0
- package/ai/task-packets/index.json +40 -0
- package/ai/task-packets/update-live-chart.json +289 -0
- package/ai/task-packets/update-live-chart.md +424 -0
- package/dist/c-2N7IU2NY.min.js +1 -0
- package/dist/c-2RL2QPZJ.min.js +1 -0
- package/dist/c-2WK7YJLL.min.js +1 -0
- package/dist/c-42PLDTX7.min.js +1 -0
- package/dist/c-45CQWZZ6.min.js +1 -0
- package/dist/c-4BRHKVKV.min.js +1 -0
- package/dist/c-7242NXSG.min.js +1 -0
- package/dist/c-7DVPSB5C.min.js +1 -0
- package/dist/c-7EGHJU2F.min.js +1 -0
- package/dist/c-A7OGOFSL.min.js +1 -0
- package/dist/c-AFBSWT77.min.js +1 -0
- package/dist/c-AH5HWZWS.min.js +1 -0
- package/dist/c-AJ7EC32V.min.js +1 -0
- package/dist/c-AQADQNY7.min.js +1 -0
- package/dist/c-ATM475SA.min.js +1 -0
- package/dist/c-AVO3Q7T7.min.js +1 -0
- package/dist/c-B7GW7IHJ.min.js +1 -0
- package/dist/c-BNFJMDHN.min.js +1 -0
- package/dist/c-BOHCQILI.min.js +1 -0
- package/dist/c-C3TZLTZK.min.js +1 -0
- package/dist/c-CGQAQWBV.min.js +1 -0
- package/dist/c-CPV4N35K.min.js +1 -0
- package/dist/c-D6HAAPTX.min.js +1 -0
- package/dist/c-DIPEYUOW.min.js +1 -0
- package/dist/c-E4JDJH4I.min.js +1 -0
- package/dist/c-E72OTUZU.min.js +1 -0
- package/dist/c-E7I2L7CU.min.js +1 -0
- package/dist/c-ELDWAO2V.min.js +1 -0
- package/dist/c-EUBTECGM.min.js +1 -0
- package/dist/c-EUMPMDCS.min.js +1 -0
- package/dist/c-EZZT2WAE.min.js +1 -0
- package/dist/c-FHBVFCQB.min.js +1 -0
- package/dist/c-G4HCO2IQ.min.js +1 -0
- package/dist/c-G5VIJEOK.min.js +1 -0
- package/dist/c-GHVOXAYH.min.js +1 -0
- package/dist/c-GNTXRXRN.min.js +1 -0
- package/dist/c-GXV3C3MO.min.js +1 -0
- package/dist/c-HHTK2R75.min.js +1 -0
- package/dist/c-HLLFJYTY.min.js +1 -0
- package/dist/c-HP4ZFM47.min.js +1 -0
- package/dist/c-HPOYKCCG.min.js +1 -0
- package/dist/c-HYDTS5OP.min.js +1 -0
- package/dist/c-I4QJ6YLM.min.js +1 -0
- package/dist/c-IK33LNZ6.min.js +1 -0
- package/dist/c-IK3PZHRY.min.js +1 -0
- package/dist/c-J6DVC236.min.js +1 -0
- package/dist/c-JIMJF6F6.min.js +1 -0
- package/dist/c-JUKIWTBJ.min.js +1 -0
- package/dist/c-KKPMHAZC.min.js +1 -0
- package/dist/c-L6WNDBHV.min.js +1 -0
- package/dist/c-LDEX5OFW.min.js +1 -0
- package/dist/c-LESEUVC5.min.js +1 -0
- package/dist/c-LYQMZMZQ.min.js +1 -0
- package/dist/c-MB6CV5NC.min.js +1 -0
- package/dist/c-MOKJOIPE.min.js +1 -0
- package/dist/c-MVR3RWF3.min.js +1 -0
- package/dist/c-N3FXLRNT.min.js +1 -0
- package/dist/c-N5NPTJVJ.min.js +1 -0
- package/dist/c-NHBL4J67.min.js +1 -0
- package/dist/c-ODG6TFSY.min.js +1 -0
- package/dist/c-ORLEBW72.min.js +1 -0
- package/dist/c-P65V6HLO.min.js +1 -0
- package/dist/c-PRIKOLTE.min.js +1 -0
- package/dist/c-PSKKFZNP.min.js +1 -0
- package/dist/c-PSNI6KAZ.min.js +1 -0
- package/dist/c-QA3HMQJP.min.js +1 -0
- package/dist/c-R2P4RR7Q.min.js +1 -0
- package/dist/c-RFC7UAG7.min.js +1 -0
- package/dist/c-S3AZX5PP.min.js +1 -0
- package/dist/c-SGAURYHG.min.js +1 -0
- package/dist/c-SJMWU6UX.min.js +1 -0
- package/dist/c-STIIGQOD.min.js +1 -0
- package/dist/c-T2ASIJVZ.min.js +1 -0
- package/dist/c-T2V7O2LO.min.js +1 -0
- package/dist/c-TKG2NP7G.min.js +1 -0
- package/dist/c-TX3THUTO.min.js +1 -0
- package/dist/c-TX7XJM3Z.min.js +1 -0
- package/dist/c-UC7SIU2W.min.js +1 -0
- package/dist/c-UMXSJIOV.min.js +1 -0
- package/dist/c-VJTDST2R.min.js +1 -0
- package/dist/c-VRSXMLYF.min.js +1 -0
- package/dist/c-VSLWSAN2.min.js +1 -0
- package/dist/c-VXLOLYTO.min.js +1 -0
- package/dist/c-W4ZUKSEQ.min.js +1 -0
- package/dist/c-WCBRPILW.min.js +1 -0
- package/dist/c-WGHT7OCY.min.js +1 -0
- package/dist/c-WUWXGQYA.min.js +1 -0
- package/dist/c-WWCW3APR.min.js +1 -0
- package/dist/{c-CKLIFCGN.min.js → c-XSB27XPS.min.js} +1 -1
- package/dist/c-Y6PYUMFU.min.js +1 -0
- package/dist/c-YDECTEUW.min.js +1 -0
- package/dist/c-YF3YKVQI.min.js +1 -0
- package/dist/c-YLZIV3VS.min.js +1 -0
- package/dist/c-ZIVPFTOC.min.js +1 -0
- package/dist/components/Annotation.d.ts +2 -1
- package/dist/components/ai/chartRecipeRegistry.d.ts +6 -1
- package/dist/components/ai/chartRecipes.d.ts +4 -0
- package/dist/components/ai/describePhysicsProjection.d.ts +18 -0
- package/dist/components/ai/describePhysicsSource.d.ts +13 -0
- package/dist/components/artifact/ArtifactInspector.d.ts +26 -0
- package/dist/components/artifact/ArtifactInspectorContextSections.d.ts +18 -0
- package/dist/components/artifact/artifactContractDiff.d.ts +8 -0
- package/dist/components/artifact/artifactInspectorSummary.d.ts +53 -0
- package/dist/components/artifact/artifactRevision.d.ts +54 -0
- package/dist/components/artifact/artifactTestFixtures.d.ts +17 -0
- package/dist/components/artifact/attachmentAudit.d.ts +13 -0
- package/dist/components/artifact/claimCorrections.d.ts +3 -0
- package/dist/components/artifact/claimGraph.d.ts +5 -0
- package/dist/components/artifact/claimLifecycle.d.ts +32 -0
- package/dist/components/artifact/claims.d.ts +24 -0
- package/dist/components/artifact/collection.d.ts +10 -0
- package/dist/components/artifact/collectionCorrectionScope.d.ts +4 -0
- package/dist/components/artifact/collectionImpact.d.ts +11 -0
- package/dist/components/artifact/collectionLineage.d.ts +3 -0
- package/dist/components/artifact/collectionOperations.d.ts +8 -0
- package/dist/components/artifact/collectionPolicy.d.ts +22 -0
- package/dist/components/artifact/collectionTypes.d.ts +117 -0
- package/dist/components/artifact/configurationRepair.d.ts +8 -0
- package/dist/components/artifact/contract.d.ts +30 -0
- package/dist/components/artifact/evaluateArtifact.d.ts +12 -0
- package/dist/components/artifact/evaluateArtifactTypes.d.ts +78 -0
- package/dist/components/artifact/evaluationPresentation.d.ts +9 -0
- package/dist/components/artifact/evidenceSample.d.ts +8 -0
- package/dist/components/artifact/exportPaths.d.ts +8 -0
- package/dist/components/artifact/fieldPolicies.d.ts +12 -0
- package/dist/components/artifact/fingerprint.d.ts +36 -0
- package/dist/components/artifact/grounding.d.ts +51 -0
- package/dist/components/artifact/groundingBudget.d.ts +38 -0
- package/dist/components/artifact/hostTransfer.d.ts +13 -0
- package/dist/components/artifact/identity.d.ts +19 -0
- package/dist/components/artifact/inheritance.d.ts +48 -0
- package/dist/components/artifact/inheritanceIntegrity.d.ts +3 -0
- package/dist/components/artifact/jsonCompatibility.d.ts +2 -0
- package/dist/components/artifact/obligations.d.ts +3 -0
- package/dist/components/artifact/policies.d.ts +45 -0
- package/dist/components/artifact/policyRelations.d.ts +3 -0
- package/dist/components/artifact/recordProjection.d.ts +7 -0
- package/dist/components/artifact/representation.d.ts +50 -0
- package/dist/components/artifact/serialization.d.ts +40 -0
- package/dist/components/artifact/temporal.d.ts +32 -0
- package/dist/components/artifact/temporalAdapters.d.ts +75 -0
- package/dist/components/artifact/temporalAuditHelpers.d.ts +12 -0
- package/dist/components/artifact/temporalPresentation.d.ts +8 -0
- package/dist/components/artifact/types.d.ts +341 -0
- package/dist/components/artifact/validation.d.ts +13 -0
- package/dist/components/artifact/validationFieldStatus.d.ts +7 -0
- package/dist/components/artifact/validationPrimitives.d.ts +24 -0
- package/dist/components/artifact/validationSurfaces.d.ts +7 -0
- package/dist/components/artifact/validationTemporal.d.ts +3 -0
- package/dist/components/charts/geo/FlowMap.d.ts +7 -0
- package/dist/components/charts/geo/flowMapLineStyle.d.ts +18 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +2 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +6 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +2 -0
- package/dist/components/charts/ordinal/RadarChart.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +6 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
- package/dist/components/charts/physics/EventDropChart.d.ts +3 -1
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +4 -2
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +6 -0
- package/dist/components/charts/physics/UnitPileChart.d.ts +2 -1
- package/dist/components/charts/physics/collisionSwarmPacking.d.ts +14 -0
- package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +1 -0
- package/dist/components/charts/physics/eventDropAdmission.d.ts +32 -0
- package/dist/components/charts/physics/eventDropPhysics.d.ts +22 -1
- package/dist/components/charts/physics/galtonBoardPhysics.d.ts +2 -9
- package/dist/components/charts/physics/physicsChartReconcile.d.ts +4 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +1 -1
- package/dist/components/charts/physics/physicsGaltonData.d.ts +10 -0
- package/dist/components/charts/physics/physicsHocHandle.d.ts +2 -0
- package/dist/components/charts/physics/physicsPileData.d.ts +11 -0
- package/dist/components/charts/physics/physicsPilePhysics.d.ts +5 -12
- package/dist/components/charts/physics/physicsProjectionOverlays.d.ts +1 -1
- package/dist/components/charts/physics/physicsSourceRows.d.ts +8 -0
- package/dist/components/charts/physics/usePhysicsChartData.d.ts +19 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +4 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +14 -6
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +4 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +4 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +4 -0
- package/dist/components/charts/realtime/realtimeAccessors.d.ts +4 -0
- package/dist/components/charts/realtime/realtimeChartRuntime.d.ts +8 -7
- package/dist/components/charts/realtime/realtimeChartTypes.d.ts +7 -0
- package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +17 -11
- package/dist/components/charts/shared/GaugeReadout.d.ts +9 -0
- package/dist/components/charts/shared/ThresholdAnnotation.d.ts +18 -0
- package/dist/components/charts/shared/ThresholdEndCap.d.ts +7 -0
- package/dist/components/charts/shared/auditAccessibilityText.d.ts +4 -2
- package/dist/components/charts/shared/chartDataProps.d.ts +3 -0
- package/dist/components/charts/shared/chartSpecAtlasSchemas.d.ts +5 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +4 -0
- package/dist/components/charts/shared/chartSpecsAtlas.d.ts +2 -0
- package/dist/components/charts/shared/hooks.d.ts +3 -1
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/numericTickFormatter.d.ts +2 -0
- package/dist/components/charts/shared/radialCenterContent.d.ts +10 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +1 -1
- package/dist/components/charts/shared/useChartLegend.d.ts +4 -0
- package/dist/components/charts/shared/useXYPointStyle.d.ts +2 -0
- package/dist/components/charts/xy/BubbleChart.d.ts +7 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +7 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +7 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +7 -0
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +7 -0
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +6 -0
- package/dist/components/charts/xy/WaterfallChart.d.ts +8 -0
- package/dist/components/charts/xy/differenceMarkStyle.d.ts +28 -0
- package/dist/components/charts/xy/multiAxisFields.d.ts +23 -0
- package/dist/components/charts/xy/scatterplotMatrixCells.d.ts +50 -0
- package/dist/components/evidence/chartEvidenceEnvelope.d.ts +16 -8
- package/dist/components/evidence/evidenceEnvelopeInput.d.ts +8 -0
- package/dist/components/evidence/evidenceEnvelopeValidation.d.ts +11 -0
- package/dist/components/evidence/evidenceGate.d.ts +3 -1
- package/dist/components/evidence/renderedSceneHash.d.ts +23 -0
- package/dist/components/evidence/stableJsonHash.d.ts +4 -0
- package/dist/components/export/chartConfig.d.ts +40 -5
- package/dist/components/export/chartConfigArtifact.d.ts +6 -0
- package/dist/components/legendLayout.d.ts +18 -0
- package/dist/components/legendStyles.d.ts +4 -0
- package/dist/components/recipes/atlas/DependencyForestChart.d.ts +20 -0
- package/dist/components/recipes/atlas/DependencyMatrix.d.ts +7 -0
- package/dist/components/recipes/atlas/FlowCircuitChart.d.ts +20 -0
- package/dist/components/recipes/atlas/MotifBraidChart.d.ts +17 -0
- package/dist/components/recipes/atlas/atlasChartOptions.d.ts +11 -0
- package/dist/components/recipes/atlas/braid.d.ts +62 -0
- package/dist/components/recipes/atlas/capsules.d.ts +18 -0
- package/dist/components/recipes/atlas/compare.d.ts +4 -0
- package/dist/components/recipes/atlas/completeness.d.ts +2 -0
- package/dist/components/recipes/atlas/dependencyForest.d.ts +32 -0
- package/dist/components/recipes/atlas/dependencyForestChartProps.d.ts +58 -0
- package/dist/components/recipes/atlas/dependencyForestLayout.d.ts +17 -0
- package/dist/components/recipes/atlas/dependencyQueries.d.ts +20 -0
- package/dist/components/recipes/atlas/dependencyTypes.d.ts +21 -0
- package/dist/components/recipes/atlas/directedGraph.d.ts +9 -0
- package/dist/components/recipes/atlas/entityCounts.d.ts +3 -0
- package/dist/components/recipes/atlas/flowCircuit.d.ts +32 -0
- package/dist/components/recipes/atlas/flowCircuitChartProps.d.ts +72 -0
- package/dist/components/recipes/atlas/flowCircuitChrome.d.ts +18 -0
- package/dist/components/recipes/atlas/flowCircuitGeometry.d.ts +11 -0
- package/dist/components/recipes/atlas/flowCircuitLayout.d.ts +20 -0
- package/dist/components/recipes/atlas/flowCircuitSemantics.d.ts +26 -0
- package/dist/components/recipes/atlas/flowCircuitTape.d.ts +22 -0
- package/dist/components/recipes/atlas/flowCircuitTypes.d.ts +144 -0
- package/dist/components/recipes/atlas/forests.d.ts +11 -0
- package/dist/components/recipes/atlas/ids.d.ts +6 -0
- package/dist/components/recipes/atlas/index.d.ts +26 -0
- package/dist/components/recipes/atlas/ledger.d.ts +7 -0
- package/dist/components/recipes/atlas/motifBraidChartProps.d.ts +51 -0
- package/dist/components/recipes/atlas/motifBraidGeometry.d.ts +5 -0
- package/dist/components/recipes/atlas/motifBraidLayout.d.ts +11 -0
- package/dist/components/recipes/atlas/motifs.d.ts +3 -0
- package/dist/components/recipes/atlas/prefixForest.d.ts +9 -0
- package/dist/components/recipes/atlas/prepare.d.ts +14 -0
- package/dist/components/recipes/atlas/prepareAsync.d.ts +7 -0
- package/dist/components/recipes/atlas/profile.d.ts +19 -0
- package/dist/components/recipes/atlas/publish.d.ts +10 -0
- package/dist/components/recipes/atlas/queries.d.ts +34 -0
- package/dist/components/recipes/atlas/requiredPaths.d.ts +9 -0
- package/dist/components/recipes/atlas/rootedForest.d.ts +4 -0
- package/dist/components/recipes/atlas/sections.d.ts +3 -0
- package/dist/components/recipes/atlas/support.d.ts +7 -0
- package/dist/components/recipes/atlas/types.d.ts +278 -0
- package/dist/components/recipes/atlas/validate.d.ts +12 -0
- package/dist/components/recipes/firstAvailableTrack.d.ts +17 -0
- package/dist/components/recipes/intervals.d.ts +1 -1
- package/dist/components/semiotic-ai-core.d.ts +33 -22
- package/dist/components/semiotic-ai.d.ts +15 -3
- package/dist/components/semiotic-artifact-react.d.ts +10 -0
- package/dist/components/semiotic-artifact.d.ts +23 -0
- package/dist/components/semiotic-atlas-core.d.ts +20 -0
- package/dist/components/semiotic-atlas.d.ts +8 -0
- package/dist/components/semiotic-experimental.d.ts +1 -1
- package/dist/components/semiotic-physics.d.ts +4 -4
- package/dist/components/semiotic-recipes-core.d.ts +9 -0
- package/dist/components/semiotic-text.d.ts +2 -0
- package/dist/components/semiotic-utils-core.d.ts +18 -18
- package/dist/components/semiotic.d.ts +3 -3
- package/dist/components/server/renderEvidence.d.ts +12 -0
- package/dist/components/server/renderToStaticSVG.d.ts +3 -0
- package/dist/components/server/serverChartConfigs.d.ts +3 -0
- package/dist/components/server/serverChartConfigsAtlas.d.ts +4 -0
- package/dist/components/server/staticSVGChrome.d.ts +1 -4
- package/dist/components/server/staticXYAxisTicks.d.ts +2 -38
- package/dist/components/server/staticXYGrid.d.ts +1 -1
- package/dist/components/server/svgSizing.d.ts +6 -0
- package/dist/components/shared/svgRoot.d.ts +17 -0
- package/dist/components/store/selectionProvenance.d.ts +6 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +4 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +1 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -0
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +4 -0
- package/dist/components/stream/SVGOverlay.d.ts +4 -0
- package/dist/components/stream/SceneToSVG.d.ts +4 -19
- package/dist/components/stream/SceneToSVGXY.d.ts +13 -0
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -2
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -2
- package/dist/components/stream/XYGrid.d.ts +11 -0
- package/dist/components/stream/axisTickUtils.d.ts +0 -1
- package/dist/components/stream/canvasSetup.d.ts +1 -2
- package/dist/components/stream/fontLoading.d.ts +4 -0
- package/dist/components/stream/hitTestUtils.d.ts +2 -0
- package/dist/components/stream/networkCustomLayout.d.ts +8 -0
- package/dist/components/stream/networkCustomLayoutCache.d.ts +12 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +0 -7
- package/dist/components/stream/overlayAccessibleText.d.ts +18 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +1 -1
- package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +5 -4
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +9 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +3 -0
- package/dist/components/stream/physics/physicsCanvasCoordinates.d.ts +5 -0
- package/dist/components/stream/physics/physicsFixedPosition.d.ts +16 -0
- package/dist/components/stream/physics/physicsKernelCloning.d.ts +6 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +2 -0
- package/dist/components/stream/physics/physicsPipelineSettle.d.ts +15 -9
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +8 -17
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +11 -0
- package/dist/components/stream/physics/usePhysicsCanvasPointer.d.ts +3 -1
- package/dist/components/stream/physics/usePhysicsSemanticNavigation.d.ts +2 -0
- package/dist/components/stream/pipelineConfig.d.ts +4 -0
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +1 -1
- package/dist/components/stream/resolveXYAxes.d.ts +13 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +2 -1
- package/dist/components/stream/seriesGeometry.d.ts +13 -0
- package/dist/components/stream/shallowEqual.d.ts +2 -0
- package/dist/components/stream/streamEncodingTypes.d.ts +53 -0
- package/dist/components/stream/types.d.ts +4 -53
- package/dist/components/stream/useEnsureCustomXYRenderers.d.ts +4 -2
- package/dist/components/stream/useGeoFrameHandle.d.ts +16 -0
- package/dist/components/stream/useOrdinalFrameHandle.d.ts +15 -0
- package/dist/components/stream/useXYFrameHandle.d.ts +15 -0
- package/dist/components/stream/xyAxisTicks.d.ts +25 -0
- package/dist/components/stream/xyDateTicks.d.ts +3 -2
- package/dist/components/stream/xyFrameAxisTypes.d.ts +2 -0
- package/dist/components/stream/xySceneBuilders/ribbonScene.d.ts +1 -1
- package/dist/components/stream/xySceneBuilders/types.d.ts +1 -0
- package/dist/components/text/annotationTextLayout.d.ts +28 -0
- package/dist/components/text/pretextAnnotationLayout.d.ts +29 -0
- package/dist/components/text/usePretextAnnotations.d.ts +12 -0
- package/dist/controls.module.min.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +1 -1
- package/dist/physics-rapier.module.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/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-access.module.min.js +1 -1
- package/dist/semiotic-ai-artifact-policy-constants.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +33 -22
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai-hash-primitives.module.min.js +2 -0
- package/dist/semiotic-ai.d.ts +15 -3
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-artifact-react.d.ts +10 -0
- package/dist/semiotic-artifact-react.min.js +2 -0
- package/dist/semiotic-artifact-react.module.min.js +2 -0
- package/dist/semiotic-artifact.d.ts +23 -0
- package/dist/semiotic-artifact.min.js +1 -0
- package/dist/semiotic-artifact.module.min.js +1 -0
- package/dist/semiotic-atlas-core.d.ts +20 -0
- package/dist/semiotic-atlas-core.min.js +1 -0
- package/dist/semiotic-atlas-core.module.min.js +1 -0
- package/dist/semiotic-atlas-selection.module.min.js +2 -0
- package/dist/semiotic-atlas.d.ts +8 -0
- package/dist/semiotic-atlas.min.js +2 -0
- package/dist/semiotic-atlas.module.min.js +2 -0
- package/dist/semiotic-client-cjs-shared.min.js +1 -1
- package/dist/semiotic-client-glyph.module.min.js +1 -1
- package/dist/semiotic-client-responsive.module.min.js +1 -1
- package/dist/semiotic-client-shared.module.min.js +1 -1
- package/dist/semiotic-custom-layout-selection-cjs-shared.min.js +1 -1
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-evidence.min.js +1 -1
- package/dist/semiotic-evidence.module.min.js +1 -1
- package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
- package/dist/semiotic-experimental-react-shared.module.min.js +1 -1
- 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-line.module.min.js +1 -1
- package/dist/semiotic-physics.d.ts +4 -4
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +9 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes-geo-cjs.min.js +1 -1
- package/dist/semiotic-recipes-react.min.js +1 -1
- package/dist/semiotic-server-edge-node.module.min.js +1 -1
- 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-text.d.ts +2 -0
- package/dist/semiotic-text.min.js +2 -0
- package/dist/semiotic-text.module.min.js +2 -0
- package/dist/semiotic-themes-core.min.js +1 -1
- package/dist/semiotic-themes-core.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 +18 -18
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic.d.ts +3 -3
- 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.module.min.js +1 -1
- package/package.json +70 -14
- package/spec/README.md +8 -3
- package/spec/v0.1/artifact-contract.schema.json +2299 -0
- package/spec/v0.1/examples/artifact-contract-full.json +369 -0
- package/spec/v0.1/examples/artifact-contract-unknown-state.json +46 -0
- package/dist/c-3BLJEQNG.min.js +0 -1
- package/dist/c-3SCUN5HI.min.js +0 -1
- package/dist/c-3VVKFA4M.min.js +0 -1
- package/dist/c-43TJZS3F.min.js +0 -1
- package/dist/c-4DTZPSUD.min.js +0 -1
- package/dist/c-4ES5367Y.min.js +0 -1
- package/dist/c-52TEGIUJ.min.js +0 -1
- package/dist/c-54IRWOGM.min.js +0 -1
- package/dist/c-5D2S4RMI.min.js +0 -1
- package/dist/c-5JWCTX3G.min.js +0 -1
- package/dist/c-6CMMSN6N.min.js +0 -1
- package/dist/c-6HRB2L7H.min.js +0 -1
- package/dist/c-6O5EVOPH.min.js +0 -1
- package/dist/c-7W4SV36A.min.js +0 -1
- package/dist/c-A4WRGZFX.min.js +0 -1
- package/dist/c-AG7WWVIH.min.js +0 -1
- package/dist/c-AH6J4MTN.min.js +0 -1
- package/dist/c-AKAF6JAD.min.js +0 -1
- package/dist/c-ALYR5LKK.min.js +0 -1
- package/dist/c-BBKITSXB.min.js +0 -1
- package/dist/c-BYDPC44I.min.js +0 -1
- package/dist/c-CFFIU2MW.min.js +0 -1
- package/dist/c-CGNHBHCE.min.js +0 -1
- package/dist/c-CJYSXIFV.min.js +0 -1
- package/dist/c-CZF7MV67.min.js +0 -1
- package/dist/c-D53OKBSY.min.js +0 -1
- package/dist/c-DADXPJXV.min.js +0 -1
- package/dist/c-DBQ2V7CH.min.js +0 -1
- package/dist/c-DPMVAUAW.min.js +0 -1
- package/dist/c-ECJCKLYY.min.js +0 -1
- package/dist/c-EGATGOWJ.min.js +0 -1
- package/dist/c-EGR6VYBW.min.js +0 -1
- package/dist/c-ESNR43AN.min.js +0 -1
- package/dist/c-F3LIKINL.min.js +0 -1
- package/dist/c-F5ZB5GJ6.min.js +0 -1
- package/dist/c-G36WS6LN.min.js +0 -1
- package/dist/c-G3VYMHKE.min.js +0 -1
- package/dist/c-GGISSW5E.min.js +0 -1
- package/dist/c-GR6MOEQC.min.js +0 -1
- package/dist/c-GSVCN34B.min.js +0 -1
- package/dist/c-GYOQCEFP.min.js +0 -1
- package/dist/c-H3DNMTCC.min.js +0 -1
- package/dist/c-I6J3FEZE.min.js +0 -1
- package/dist/c-IGH6MGJ5.min.js +0 -1
- package/dist/c-II2EEAJN.min.js +0 -1
- package/dist/c-IUHFPMHD.min.js +0 -1
- package/dist/c-J6M4JHRS.min.js +0 -1
- package/dist/c-JM3MGLQV.min.js +0 -1
- package/dist/c-KM3N7F7R.min.js +0 -1
- package/dist/c-LF5BZFNC.min.js +0 -1
- package/dist/c-LKBSGFQC.min.js +0 -1
- package/dist/c-MNF2S4AA.min.js +0 -1
- package/dist/c-MT3WBK7M.min.js +0 -1
- package/dist/c-NDJADPIF.min.js +0 -1
- package/dist/c-NVPQCIL5.min.js +0 -1
- package/dist/c-NY3JWV2K.min.js +0 -1
- package/dist/c-OFWJBEE5.min.js +0 -1
- package/dist/c-OYFHP5F5.min.js +0 -1
- package/dist/c-PGKQGGQ2.min.js +0 -1
- package/dist/c-PPWDL5ZI.min.js +0 -1
- package/dist/c-Q2IPZ3MU.min.js +0 -1
- package/dist/c-QKHMBE2E.min.js +0 -1
- package/dist/c-QMVM3AY6.min.js +0 -1
- package/dist/c-QSGWX53A.min.js +0 -1
- package/dist/c-RJKEKZOO.min.js +0 -1
- package/dist/c-RSVIHIQ4.min.js +0 -1
- package/dist/c-S6U5CGT5.min.js +0 -1
- package/dist/c-SFDIIU5G.min.js +0 -1
- package/dist/c-SLGMUBUL.min.js +0 -1
- package/dist/c-SRTBCRVE.min.js +0 -1
- package/dist/c-T6UAIKBH.min.js +0 -1
- package/dist/c-TMCTEVVW.min.js +0 -1
- package/dist/c-TMOSJLT3.min.js +0 -1
- package/dist/c-TZW3JGJ5.min.js +0 -1
- package/dist/c-U6ESPM7V.min.js +0 -1
- package/dist/c-UC5PTTFI.min.js +0 -1
- package/dist/c-USFMFKIH.min.js +0 -1
- package/dist/c-VGKUEZBC.min.js +0 -1
- package/dist/c-VGW3VG3I.min.js +0 -1
- package/dist/c-VN2HG5BS.min.js +0 -1
- package/dist/c-VPZDY5Q4.min.js +0 -1
- package/dist/c-VRXUB2F2.min.js +0 -1
- package/dist/c-VUBQNQJH.min.js +0 -1
- package/dist/c-VUH4PGZY.min.js +0 -1
- package/dist/c-W3CE4A4S.min.js +0 -1
- package/dist/c-X5UBGU2V.min.js +0 -1
- package/dist/c-XDRV7RKW.min.js +0 -1
- package/dist/c-YGZHURXZ.min.js +0 -1
- package/dist/c-YZVRZGX2.min.js +0 -1
- /package/dist/{c-N4G2L7ID.min.js → c-HYW2XA4Q.min.js} +0 -0
- /package/dist/{c-ENF72HU5.min.js → c-QAVFOEUY.min.js} +0 -0
- /package/dist/{c-OCI56QF2.min.js → c-V4XMSLC3.min.js} +0 -0
package/ai/cli.js
CHANGED
|
@@ -10,17 +10,17 @@ const {
|
|
|
10
10
|
componentIndexFromSchema,
|
|
11
11
|
findComponent,
|
|
12
12
|
metadataForComponent,
|
|
13
|
-
schemaEntries
|
|
13
|
+
schemaEntries
|
|
14
14
|
} = require("./componentMetadata.cjs")
|
|
15
15
|
const {
|
|
16
16
|
formatSuggestionReport,
|
|
17
|
-
suggestCharts
|
|
17
|
+
suggestCharts
|
|
18
18
|
} = require("./chartSuggestions.cjs")
|
|
19
19
|
const {
|
|
20
20
|
behaviorContractsFor,
|
|
21
21
|
dataRequiredForUsageMode,
|
|
22
22
|
formatDoctorBehaviorContracts,
|
|
23
|
-
normalizeUsageMode
|
|
23
|
+
normalizeUsageMode
|
|
24
24
|
} = require("./behaviorContracts.cjs")
|
|
25
25
|
|
|
26
26
|
const FILES = {
|
|
@@ -29,6 +29,12 @@ const FILES = {
|
|
|
29
29
|
"--compact": path.join(__dirname, "system-prompt.md"),
|
|
30
30
|
"--examples": path.join(__dirname, "examples.md"),
|
|
31
31
|
"--skill": path.join(pkgRoot, "agent-skill", "semiotic-charts", "SKILL.md"),
|
|
32
|
+
"--artifact-schema": path.join(
|
|
33
|
+
pkgRoot,
|
|
34
|
+
"spec",
|
|
35
|
+
"v0.1",
|
|
36
|
+
"artifact-contract.schema.json"
|
|
37
|
+
)
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
function errorMessage(err) {
|
|
@@ -49,6 +55,8 @@ Usage:
|
|
|
49
55
|
npx semiotic-ai --compact Print ai/system-prompt.md (compact prompt)
|
|
50
56
|
npx semiotic-ai --examples Print ai/examples.md (copy-paste examples)
|
|
51
57
|
npx semiotic-ai --skill Print the portable Semiotic Agent Skill
|
|
58
|
+
npx semiotic-ai --artifact-schema
|
|
59
|
+
Print the portable Artifact Contract schema
|
|
52
60
|
npx semiotic-ai --doctor Validate { component, props, usageMode? } JSON from stdin
|
|
53
61
|
(exits nonzero on errors; add --json for a machine-readable report)
|
|
54
62
|
npx semiotic-ai --audit-a11y Audit { component, props, inChartContainer?, describe?, navigable? }
|
|
@@ -56,6 +64,15 @@ Usage:
|
|
|
56
64
|
JSON against Chartability (POUR-CAF) accessibility heuristics
|
|
57
65
|
npx semiotic-ai --evaluate Evaluate { component, props, data?, inChartContainer?, describe?, navigable? }
|
|
58
66
|
with data, deception, and accessibility checks (add --json for a machine-readable report)
|
|
67
|
+
npx semiotic-ai --audit-artifact
|
|
68
|
+
Evaluate { component, props, contract, data?, policy?, exceptions?, now? }
|
|
69
|
+
npx semiotic-ai --recommend-representation
|
|
70
|
+
Choose a chart, table, text, wait, or refusal outcome
|
|
71
|
+
npx semiotic-ai --repair-artifact
|
|
72
|
+
Propose repairs; add applySafeIdentityRepairs=true to fill missing identity fields only
|
|
73
|
+
Artifact exit 0 may mean conditional: inspect status before publication
|
|
74
|
+
npx semiotic-ai --explain-refusal
|
|
75
|
+
Explain why { component, props, contract, data?, policy?, exceptions?, now? } is refused
|
|
59
76
|
npx semiotic-ai --help Show this help message
|
|
60
77
|
`.trim()
|
|
61
78
|
|
|
@@ -76,7 +93,9 @@ function printComponentList(asJSON) {
|
|
|
76
93
|
return
|
|
77
94
|
}
|
|
78
95
|
|
|
79
|
-
console.log(
|
|
96
|
+
console.log(
|
|
97
|
+
`Semiotic components (${index.totalComponents} total, ${index.renderableComponents} renderable)`
|
|
98
|
+
)
|
|
80
99
|
for (const category of CATEGORY_ORDER) {
|
|
81
100
|
const names = index.categories[category] || []
|
|
82
101
|
if (names.length === 0) continue
|
|
@@ -93,7 +112,10 @@ function printSingleComponentSchema(componentName) {
|
|
|
93
112
|
const schema = loadSchema()
|
|
94
113
|
const component = findComponent(schema, componentName)
|
|
95
114
|
if (!component) {
|
|
96
|
-
const available = schemaEntries(schema)
|
|
115
|
+
const available = schemaEntries(schema)
|
|
116
|
+
.map((entry) => entry.name)
|
|
117
|
+
.sort()
|
|
118
|
+
.join(", ")
|
|
97
119
|
console.error(`Unknown component: ${componentName}`)
|
|
98
120
|
console.error(`Available components: ${available}`)
|
|
99
121
|
process.exit(1)
|
|
@@ -106,15 +128,18 @@ function printSingleComponentSchema(componentName) {
|
|
|
106
128
|
usageModes: {
|
|
107
129
|
static: {
|
|
108
130
|
dataRequired: dataRequiredForUsageMode(component.name, "static"),
|
|
109
|
-
note: "Use for renderChart, MCP previews, SSR snapshots, and static JSX examples."
|
|
131
|
+
note: "Use for renderChart, MCP previews, SSR snapshots, and static JSX examples."
|
|
110
132
|
},
|
|
111
133
|
push: {
|
|
112
134
|
dataRequired: dataRequiredForUsageMode(component.name, "push"),
|
|
113
|
-
note: "Use for ref-based React HOCs. Omit data and push via ref.current when supported."
|
|
114
|
-
}
|
|
115
|
-
}
|
|
135
|
+
note: "Use for ref-based React HOCs. Omit data and push via ref.current when supported."
|
|
136
|
+
}
|
|
137
|
+
}
|
|
116
138
|
},
|
|
117
|
-
behaviorContracts: behaviorContractsFor({
|
|
139
|
+
behaviorContracts: behaviorContractsFor({
|
|
140
|
+
component: component.name,
|
|
141
|
+
props: {}
|
|
142
|
+
})
|
|
118
143
|
}
|
|
119
144
|
console.log(JSON.stringify(payload, null, 2))
|
|
120
145
|
}
|
|
@@ -124,10 +149,13 @@ function printSingleComponentSchema(componentName) {
|
|
|
124
149
|
// neither guards null here. CodeQL flags the dead branches if they return.
|
|
125
150
|
|
|
126
151
|
function schemaTypeMatches(value, expectedType) {
|
|
127
|
-
const expectedTypes = Array.isArray(expectedType)
|
|
152
|
+
const expectedTypes = Array.isArray(expectedType)
|
|
153
|
+
? expectedType
|
|
154
|
+
: [expectedType]
|
|
128
155
|
return expectedTypes.some((type) => {
|
|
129
156
|
if (type === "array") return Array.isArray(value)
|
|
130
|
-
if (type === "object")
|
|
157
|
+
if (type === "object")
|
|
158
|
+
return typeof value === "object" && !Array.isArray(value)
|
|
131
159
|
return typeof value === type
|
|
132
160
|
})
|
|
133
161
|
}
|
|
@@ -138,22 +166,31 @@ function describeActualType(value) {
|
|
|
138
166
|
}
|
|
139
167
|
|
|
140
168
|
function shouldSkipMissingRequiredProp(componentName, propName, usageMode) {
|
|
141
|
-
return
|
|
169
|
+
return (
|
|
170
|
+
propName === "data" && !dataRequiredForUsageMode(componentName, usageMode)
|
|
171
|
+
)
|
|
142
172
|
}
|
|
143
173
|
|
|
144
174
|
function filterUsageModeErrors(componentName, errors, usageMode) {
|
|
145
175
|
if (dataRequiredForUsageMode(componentName, usageMode)) return errors
|
|
146
|
-
return errors.filter(
|
|
176
|
+
return errors.filter(
|
|
177
|
+
(err) => err !== `"data" is required for ${componentName}.`
|
|
178
|
+
)
|
|
147
179
|
}
|
|
148
180
|
|
|
149
181
|
function validatePropsWithSchema(componentName, props, usageMode = "static") {
|
|
150
182
|
const schema = loadSchema()
|
|
151
183
|
const component = findComponent(schema, componentName)
|
|
152
184
|
if (!component) {
|
|
153
|
-
const available = schemaEntries(schema)
|
|
185
|
+
const available = schemaEntries(schema)
|
|
186
|
+
.map((entry) => entry.name)
|
|
187
|
+
.sort()
|
|
188
|
+
.join(", ")
|
|
154
189
|
return {
|
|
155
190
|
valid: false,
|
|
156
|
-
errors: [
|
|
191
|
+
errors: [
|
|
192
|
+
`Unknown component "${componentName}". Available components: ${available}`
|
|
193
|
+
]
|
|
157
194
|
}
|
|
158
195
|
}
|
|
159
196
|
|
|
@@ -163,7 +200,8 @@ function validatePropsWithSchema(componentName, props, usageMode = "static") {
|
|
|
163
200
|
const errors = []
|
|
164
201
|
|
|
165
202
|
for (const propName of required) {
|
|
166
|
-
if (shouldSkipMissingRequiredProp(component.name, propName, usageMode))
|
|
203
|
+
if (shouldSkipMissingRequiredProp(component.name, propName, usageMode))
|
|
204
|
+
continue
|
|
167
205
|
if (props[propName] === undefined || props[propName] === null) {
|
|
168
206
|
errors.push(`"${propName}" is required for ${component.name}.`)
|
|
169
207
|
}
|
|
@@ -198,20 +236,31 @@ function validatePropsWithSchema(componentName, props, usageMode = "static") {
|
|
|
198
236
|
// wire `type` keyword is standards-valid JSON Schema and never lists
|
|
199
237
|
// "function"; the runtime extension carries it. Falls back to `type` for
|
|
200
238
|
// props with no runtime-only alternatives.
|
|
201
|
-
const effectiveType =
|
|
239
|
+
const effectiveType =
|
|
240
|
+
propSchema["x-semiotic-runtime-types"] || propSchema.type
|
|
202
241
|
if (effectiveType && !schemaTypeMatches(value, effectiveType)) {
|
|
203
|
-
const expected = Array.isArray(effectiveType)
|
|
204
|
-
|
|
242
|
+
const expected = Array.isArray(effectiveType)
|
|
243
|
+
? effectiveType.join(" | ")
|
|
244
|
+
: effectiveType
|
|
245
|
+
errors.push(
|
|
246
|
+
`"${propName}" should be ${expected}, got ${describeActualType(value)}.`
|
|
247
|
+
)
|
|
205
248
|
}
|
|
206
249
|
|
|
207
|
-
if (
|
|
208
|
-
|
|
250
|
+
if (
|
|
251
|
+
propSchema.enum &&
|
|
252
|
+
typeof value === "string" &&
|
|
253
|
+
!propSchema.enum.includes(value)
|
|
254
|
+
) {
|
|
255
|
+
errors.push(
|
|
256
|
+
`"${propName}" value "${value}" is not valid. Expected one of: ${propSchema.enum.join(", ")}.`
|
|
257
|
+
)
|
|
209
258
|
}
|
|
210
259
|
}
|
|
211
260
|
|
|
212
261
|
return {
|
|
213
262
|
valid: errors.length === 0,
|
|
214
|
-
errors
|
|
263
|
+
errors
|
|
215
264
|
}
|
|
216
265
|
}
|
|
217
266
|
|
|
@@ -220,7 +269,9 @@ function validatePropsWithSchema(componentName, props, usageMode = "static") {
|
|
|
220
269
|
function printSchemaOnlyDoctorResult(component, props, usageMode) {
|
|
221
270
|
const result = validatePropsWithSchema(component, props, usageMode)
|
|
222
271
|
if (usageMode === "push") {
|
|
223
|
-
console.log(
|
|
272
|
+
console.log(
|
|
273
|
+
` Usage mode: push (data prop may be omitted; use a ref to push data)`
|
|
274
|
+
)
|
|
224
275
|
}
|
|
225
276
|
if (result.valid) {
|
|
226
277
|
console.log(`✓ ${component}: schema-only validation passed.`)
|
|
@@ -247,7 +298,9 @@ function printDoctorBehaviorContracts(component, props) {
|
|
|
247
298
|
function readJSONInput(usage) {
|
|
248
299
|
// Skip flag tokens (e.g. `--json`) so `--doctor --json` still reads the JSON
|
|
249
300
|
// from stdin rather than trying to parse the flag as the input.
|
|
250
|
-
const positional = process.argv
|
|
301
|
+
const positional = process.argv
|
|
302
|
+
.slice(3)
|
|
303
|
+
.filter((arg) => !arg.startsWith("--"))
|
|
251
304
|
if (positional.length > 0) {
|
|
252
305
|
return positional.join(" ")
|
|
253
306
|
}
|
|
@@ -259,6 +312,182 @@ function readJSONInput(usage) {
|
|
|
259
312
|
process.exit(1)
|
|
260
313
|
}
|
|
261
314
|
|
|
315
|
+
function loadArtifactRuntime() {
|
|
316
|
+
const distPath = path.join(pkgRoot, "dist", "semiotic-artifact.min.js")
|
|
317
|
+
const serverPath = path.join(pkgRoot, "dist", "server.min.js")
|
|
318
|
+
try {
|
|
319
|
+
if (!process.env.SEMIOTIC_AI_SCHEMA_ONLY) {
|
|
320
|
+
const artifactRuntime = require(distPath)
|
|
321
|
+
try {
|
|
322
|
+
const { renderChartWithEvidence } = require(serverPath)
|
|
323
|
+
return { ...artifactRuntime, renderChartWithEvidence }
|
|
324
|
+
} catch (e) {
|
|
325
|
+
return artifactRuntime
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
} catch (e) {
|
|
329
|
+
// The caller-facing error below explains the supported recovery path.
|
|
330
|
+
}
|
|
331
|
+
return null
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const ARTIFACT_BULK_PROP_KEYS = new Set([
|
|
335
|
+
"data",
|
|
336
|
+
"nodes",
|
|
337
|
+
"edges",
|
|
338
|
+
"points",
|
|
339
|
+
"areas",
|
|
340
|
+
"lines",
|
|
341
|
+
"flows"
|
|
342
|
+
])
|
|
343
|
+
|
|
344
|
+
function redactArtifactCliValue(
|
|
345
|
+
value,
|
|
346
|
+
path = "$",
|
|
347
|
+
insideProps = false,
|
|
348
|
+
omittedPaths = []
|
|
349
|
+
) {
|
|
350
|
+
if (Array.isArray(value)) {
|
|
351
|
+
return value.map((entry, index) =>
|
|
352
|
+
redactArtifactCliValue(
|
|
353
|
+
entry,
|
|
354
|
+
`${path}[${index}]`,
|
|
355
|
+
insideProps,
|
|
356
|
+
omittedPaths
|
|
357
|
+
)
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
if (!value || typeof value !== "object") return value
|
|
361
|
+
|
|
362
|
+
const output = {}
|
|
363
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
364
|
+
const childPath = `${path}.${key}`
|
|
365
|
+
if (
|
|
366
|
+
(insideProps && ARTIFACT_BULK_PROP_KEYS.has(key)) ||
|
|
367
|
+
(key === "sample" && path.includes("evidence["))
|
|
368
|
+
) {
|
|
369
|
+
omittedPaths.push(childPath)
|
|
370
|
+
continue
|
|
371
|
+
}
|
|
372
|
+
output[key] = redactArtifactCliValue(
|
|
373
|
+
nested,
|
|
374
|
+
childPath,
|
|
375
|
+
insideProps || key === "props",
|
|
376
|
+
omittedPaths
|
|
377
|
+
)
|
|
378
|
+
}
|
|
379
|
+
return output
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function artifactObligationSummary(obligations) {
|
|
383
|
+
const summary = {
|
|
384
|
+
pass: 0,
|
|
385
|
+
fail: 0,
|
|
386
|
+
warn: 0,
|
|
387
|
+
manual: 0,
|
|
388
|
+
unknown: 0,
|
|
389
|
+
notApplicable: 0
|
|
390
|
+
}
|
|
391
|
+
for (const obligation of obligations || []) {
|
|
392
|
+
const key =
|
|
393
|
+
obligation.status === "not-applicable"
|
|
394
|
+
? "notApplicable"
|
|
395
|
+
: obligation.status
|
|
396
|
+
if (Object.hasOwn(summary, key)) summary[key] += 1
|
|
397
|
+
}
|
|
398
|
+
return summary
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function compactArtifactEvaluation(evaluation) {
|
|
402
|
+
const openObligations = (evaluation.obligations || []).filter(
|
|
403
|
+
({ status }) => status !== "pass" && status !== "not-applicable"
|
|
404
|
+
)
|
|
405
|
+
return {
|
|
406
|
+
status: evaluation.status,
|
|
407
|
+
policy: evaluation.policy,
|
|
408
|
+
validation: evaluation.validation,
|
|
409
|
+
obligationSummary: artifactObligationSummary(evaluation.obligations),
|
|
410
|
+
obligations: openObligations.slice(0, 25),
|
|
411
|
+
...(evaluation.recommendation
|
|
412
|
+
? {
|
|
413
|
+
recommendation: {
|
|
414
|
+
status: evaluation.recommendation.status,
|
|
415
|
+
selected: evaluation.recommendation.selected,
|
|
416
|
+
reasons: evaluation.recommendation.reasons.slice(0, 12)
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
: {}),
|
|
420
|
+
repairs: (evaluation.repairs || []).slice(0, 25),
|
|
421
|
+
manualChecks: (evaluation.manualChecks || []).slice(0, 25)
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function safeArtifactRepairOutput(runtime, result) {
|
|
426
|
+
const serialized = runtime.serializeArtifactContract(result.contract, {
|
|
427
|
+
excludeEvidenceSamples: true
|
|
428
|
+
})
|
|
429
|
+
const contractBytes = serialized.contract
|
|
430
|
+
? Buffer.byteLength(JSON.stringify(serialized.contract), "utf8")
|
|
431
|
+
: 0
|
|
432
|
+
const contractWithinLimit = contractBytes <= 32 * 1024
|
|
433
|
+
const prepared = {
|
|
434
|
+
status: result.status,
|
|
435
|
+
component: result.component,
|
|
436
|
+
props: result.props,
|
|
437
|
+
...(serialized.contract && contractWithinLimit
|
|
438
|
+
? { contract: serialized.contract }
|
|
439
|
+
: {}),
|
|
440
|
+
contractTransfer: {
|
|
441
|
+
...serialized.transfer,
|
|
442
|
+
...(!contractWithinLimit
|
|
443
|
+
? {
|
|
444
|
+
status: "excluded",
|
|
445
|
+
omittedPaths: [...serialized.transfer.omittedPaths, "$"],
|
|
446
|
+
warnings: [
|
|
447
|
+
...serialized.transfer.warnings,
|
|
448
|
+
"The repaired contract exceeded the 32 KiB CLI response limit and was excluded."
|
|
449
|
+
]
|
|
450
|
+
}
|
|
451
|
+
: {})
|
|
452
|
+
},
|
|
453
|
+
before: compactArtifactEvaluation(result.before),
|
|
454
|
+
after: compactArtifactEvaluation(result.after),
|
|
455
|
+
ledger: result.ledger.slice(0, 50)
|
|
456
|
+
}
|
|
457
|
+
const omittedPaths = serialized.transfer.omittedPaths.map(
|
|
458
|
+
(path) => `$.contract${path.startsWith("$.") ? path.slice(1) : `.${path}`}`
|
|
459
|
+
)
|
|
460
|
+
if (!contractWithinLimit) omittedPaths.push("$.contract")
|
|
461
|
+
const output = redactArtifactCliValue(prepared, "$", false, omittedPaths)
|
|
462
|
+
output.outputTransfer = {
|
|
463
|
+
status: omittedPaths.length > 0 ? "excluded" : "preserved",
|
|
464
|
+
omittedPaths: [...new Set(omittedPaths)],
|
|
465
|
+
warnings:
|
|
466
|
+
omittedPaths.length > 0
|
|
467
|
+
? [
|
|
468
|
+
"Bulk chart rows and bounded evidence samples are excluded from CLI repair output."
|
|
469
|
+
]
|
|
470
|
+
: []
|
|
471
|
+
}
|
|
472
|
+
return output
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
function writeArtifactJsonAndExit(value, exitCode) {
|
|
476
|
+
fs.writeSync(1, `${JSON.stringify(value, null, 2)}\n`)
|
|
477
|
+
process.exit(exitCode)
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function readArtifactRequest(flagName) {
|
|
481
|
+
const input = readJSONInput(
|
|
482
|
+
`Usage: npx semiotic-ai ${flagName} '{"component":"LineChart","props":{"data":[...]},"contract":{...}}'`
|
|
483
|
+
)
|
|
484
|
+
const parsed = JSON.parse(input)
|
|
485
|
+
if (!parsed.component || !parsed.props || !parsed.contract) {
|
|
486
|
+
throw new Error("Input must include { component, props, contract }.")
|
|
487
|
+
}
|
|
488
|
+
return parsed
|
|
489
|
+
}
|
|
490
|
+
|
|
262
491
|
if (flag === "--help" || flag === "-h") {
|
|
263
492
|
console.log(HELP)
|
|
264
493
|
process.exit(0)
|
|
@@ -280,7 +509,9 @@ if (flag === "--skill") {
|
|
|
280
509
|
}
|
|
281
510
|
|
|
282
511
|
if (flag === "--suggest") {
|
|
283
|
-
const input = readJSONInput(
|
|
512
|
+
const input = readJSONInput(
|
|
513
|
+
'Usage: npx semiotic-ai --suggest \'{"data":[{"category":"A","value":10}],"intent":"comparison"}\''
|
|
514
|
+
)
|
|
284
515
|
try {
|
|
285
516
|
const args = JSON.parse(input)
|
|
286
517
|
const result = suggestCharts(args)
|
|
@@ -294,7 +525,9 @@ if (flag === "--suggest") {
|
|
|
294
525
|
|
|
295
526
|
// --doctor: validate component + props from stdin or argv
|
|
296
527
|
if (flag === "--doctor") {
|
|
297
|
-
const input = readJSONInput(
|
|
528
|
+
const input = readJSONInput(
|
|
529
|
+
'Usage: npx semiotic-ai --doctor \'{"component":"LineChart","props":{"data":[...]},"usageMode":"static"}\'\n echo \'{"component":"LineChart","props":{"xAccessor":"x","yAccessor":"y"},"usageMode":"push"}\' | npx semiotic-ai --doctor'
|
|
530
|
+
)
|
|
298
531
|
|
|
299
532
|
// `--json` emits a stable machine-readable report instead of the human text.
|
|
300
533
|
const asJson = process.argv.includes("--json")
|
|
@@ -303,7 +536,8 @@ if (flag === "--doctor") {
|
|
|
303
536
|
const { component, props, usageMode: rawUsageMode } = JSON.parse(input)
|
|
304
537
|
if (!component || !props) {
|
|
305
538
|
const msg = "Input must be JSON with { component, props } fields."
|
|
306
|
-
if (asJson)
|
|
539
|
+
if (asJson)
|
|
540
|
+
console.log(JSON.stringify({ ok: false, error: msg }, null, 2))
|
|
307
541
|
else console.error(msg)
|
|
308
542
|
process.exit(1)
|
|
309
543
|
}
|
|
@@ -331,29 +565,57 @@ if (flag === "--doctor") {
|
|
|
331
565
|
if (asJson) {
|
|
332
566
|
const result = validatePropsWithSchema(component, props, usageMode)
|
|
333
567
|
ok = result.valid
|
|
334
|
-
console.log(
|
|
568
|
+
console.log(
|
|
569
|
+
JSON.stringify(
|
|
570
|
+
{
|
|
571
|
+
component,
|
|
572
|
+
usageMode,
|
|
573
|
+
mode: "schema-only",
|
|
574
|
+
ok,
|
|
575
|
+
errors: result.errors
|
|
576
|
+
},
|
|
577
|
+
null,
|
|
578
|
+
2
|
|
579
|
+
)
|
|
580
|
+
)
|
|
335
581
|
} else {
|
|
336
582
|
ok = printSchemaOnlyDoctorResult(component, props, usageMode)
|
|
337
583
|
}
|
|
338
584
|
} else if (diagnoseConfig) {
|
|
339
585
|
// Use the full anti-pattern detector
|
|
340
586
|
const result = diagnoseConfig(component, props)
|
|
341
|
-
const diagnoses =
|
|
342
|
-
|
|
343
|
-
|
|
587
|
+
const diagnoses =
|
|
588
|
+
usageMode === "push"
|
|
589
|
+
? result.diagnoses.filter(
|
|
590
|
+
(d) =>
|
|
591
|
+
d.code !== "VALIDATION" ||
|
|
592
|
+
!shouldSkipMissingRequiredProp(component, "data", usageMode) ||
|
|
593
|
+
d.message !== `"data" is required for ${component}.`
|
|
594
|
+
)
|
|
595
|
+
: result.diagnoses
|
|
344
596
|
ok = diagnoses.every((d) => d.severity === "warning")
|
|
345
597
|
|
|
346
598
|
if (asJson) {
|
|
347
|
-
console.log(
|
|
599
|
+
console.log(
|
|
600
|
+
JSON.stringify(
|
|
601
|
+
{ component, usageMode, mode: "diagnose", ok, diagnoses },
|
|
602
|
+
null,
|
|
603
|
+
2
|
|
604
|
+
)
|
|
605
|
+
)
|
|
348
606
|
} else {
|
|
349
607
|
if (usageMode === "push") {
|
|
350
|
-
console.log(
|
|
608
|
+
console.log(
|
|
609
|
+
` Usage mode: push (data prop may be omitted; use a ref to push data)`
|
|
610
|
+
)
|
|
351
611
|
}
|
|
352
612
|
|
|
353
613
|
// Show data shape summary
|
|
354
614
|
if (props.data && Array.isArray(props.data) && props.data.length > 0) {
|
|
355
615
|
const sample = props.data[0]
|
|
356
|
-
console.log(
|
|
616
|
+
console.log(
|
|
617
|
+
` Data shape: ${props.data.length} items, keys: [${Object.keys(sample).join(", ")}]`
|
|
618
|
+
)
|
|
357
619
|
}
|
|
358
620
|
|
|
359
621
|
if (ok && diagnoses.length === 0) {
|
|
@@ -380,10 +642,18 @@ if (flag === "--doctor") {
|
|
|
380
642
|
const errors = filterUsageModeErrors(component, result.errors, usageMode)
|
|
381
643
|
ok = errors.length === 0
|
|
382
644
|
if (asJson) {
|
|
383
|
-
console.log(
|
|
645
|
+
console.log(
|
|
646
|
+
JSON.stringify(
|
|
647
|
+
{ component, usageMode, mode: "validate", ok, errors },
|
|
648
|
+
null,
|
|
649
|
+
2
|
|
650
|
+
)
|
|
651
|
+
)
|
|
384
652
|
} else {
|
|
385
653
|
if (usageMode === "push") {
|
|
386
|
-
console.log(
|
|
654
|
+
console.log(
|
|
655
|
+
` Usage mode: push (data prop may be omitted; use a ref to push data)`
|
|
656
|
+
)
|
|
387
657
|
}
|
|
388
658
|
if (ok) {
|
|
389
659
|
console.log(`✓ ${component}: props are valid.`)
|
|
@@ -409,10 +679,13 @@ if (flag === "--doctor") {
|
|
|
409
679
|
|
|
410
680
|
// --audit-a11y: grade component + props against Chartability heuristics
|
|
411
681
|
if (flag === "--audit-a11y") {
|
|
412
|
-
const input = readJSONInput(
|
|
682
|
+
const input = readJSONInput(
|
|
683
|
+
'Usage: npx semiotic-ai --audit-a11y \'{"component":"LineChart","props":{"data":[...],"xAccessor":"x","yAccessor":"y"}}\'\n echo \'{"component":"BarChart","props":{...},"inChartContainer":true}\' | npx semiotic-ai --audit-a11y'
|
|
684
|
+
)
|
|
413
685
|
|
|
414
686
|
try {
|
|
415
|
-
const { component, props, inChartContainer, describe, navigable } =
|
|
687
|
+
const { component, props, inChartContainer, describe, navigable } =
|
|
688
|
+
JSON.parse(input)
|
|
416
689
|
if (!component || !props) {
|
|
417
690
|
console.error("Input must be JSON with { component, props } fields.")
|
|
418
691
|
process.exit(1)
|
|
@@ -433,11 +706,17 @@ if (flag === "--audit-a11y") {
|
|
|
433
706
|
}
|
|
434
707
|
|
|
435
708
|
if (!auditAccessibility || !formatAccessibilityAudit) {
|
|
436
|
-
console.error(
|
|
709
|
+
console.error(
|
|
710
|
+
"Accessibility audit requires the built library. Run `npm run dist` first, or use the MCP `auditAccessibility` tool."
|
|
711
|
+
)
|
|
437
712
|
process.exit(2)
|
|
438
713
|
}
|
|
439
714
|
|
|
440
|
-
const result = auditAccessibility(component, props, {
|
|
715
|
+
const result = auditAccessibility(component, props, {
|
|
716
|
+
inChartContainer: inChartContainer === true,
|
|
717
|
+
describe: describe === true,
|
|
718
|
+
navigable: navigable === true
|
|
719
|
+
})
|
|
441
720
|
console.log(formatAccessibilityAudit(result))
|
|
442
721
|
process.exit(result.ok ? 0 : 1)
|
|
443
722
|
} catch (err) {
|
|
@@ -448,10 +727,13 @@ if (flag === "--audit-a11y") {
|
|
|
448
727
|
|
|
449
728
|
// --audit-mobile: grade component + props for mobile visualization risks
|
|
450
729
|
if (flag === "--audit-mobile") {
|
|
451
|
-
const input = readJSONInput(
|
|
730
|
+
const input = readJSONInput(
|
|
731
|
+
'Usage: npx semiotic-ai --audit-mobile \'{"component":"LineChart","props":{"data":[...],"xAccessor":"x","yAccessor":"y"},"viewportWidth":390}\'\n echo \'{"component":"Scatterplot","props":{...},"targetSize":44}\' | npx semiotic-ai --audit-mobile'
|
|
732
|
+
)
|
|
452
733
|
|
|
453
734
|
try {
|
|
454
|
-
const { component, props, viewportWidth, targetSize, inChartContainer } =
|
|
735
|
+
const { component, props, viewportWidth, targetSize, inChartContainer } =
|
|
736
|
+
JSON.parse(input)
|
|
455
737
|
if (!component || !props) {
|
|
456
738
|
console.error("Input must be JSON with { component, props } fields.")
|
|
457
739
|
process.exit(1)
|
|
@@ -470,14 +752,17 @@ if (flag === "--audit-mobile") {
|
|
|
470
752
|
}
|
|
471
753
|
|
|
472
754
|
if (!auditMobileVisualization || !formatMobileVisualizationAudit) {
|
|
473
|
-
console.error(
|
|
755
|
+
console.error(
|
|
756
|
+
"Mobile visualization audit requires the built library. Run `npm run dist` first, or use the MCP `auditMobileVisualization` tool."
|
|
757
|
+
)
|
|
474
758
|
process.exit(2)
|
|
475
759
|
}
|
|
476
760
|
|
|
477
761
|
const result = auditMobileVisualization(component, props, {
|
|
478
|
-
viewportWidth:
|
|
762
|
+
viewportWidth:
|
|
763
|
+
typeof viewportWidth === "number" ? viewportWidth : undefined,
|
|
479
764
|
targetSize: typeof targetSize === "number" ? targetSize : undefined,
|
|
480
|
-
inChartContainer: inChartContainer === true
|
|
765
|
+
inChartContainer: inChartContainer === true
|
|
481
766
|
})
|
|
482
767
|
console.log(formatMobileVisualizationAudit(result))
|
|
483
768
|
process.exit(result.ok ? 0 : 1)
|
|
@@ -489,14 +774,18 @@ if (flag === "--audit-mobile") {
|
|
|
489
774
|
|
|
490
775
|
// --evaluate: run the unified data/deception/accessibility evaluator
|
|
491
776
|
if (flag === "--evaluate") {
|
|
492
|
-
const input = readJSONInput(
|
|
777
|
+
const input = readJSONInput(
|
|
778
|
+
'Usage: npx semiotic-ai --evaluate \'{"component":"LineChart","props":{"xAccessor":"x","yAccessor":"y"},"data":[...]}\''
|
|
779
|
+
)
|
|
493
780
|
const asJson = process.argv.includes("--json")
|
|
494
781
|
|
|
495
782
|
try {
|
|
496
|
-
const { component, props, data, inChartContainer, describe, navigable } =
|
|
783
|
+
const { component, props, data, inChartContainer, describe, navigable } =
|
|
784
|
+
JSON.parse(input)
|
|
497
785
|
if (!component || !props) {
|
|
498
786
|
const msg = "Input must be JSON with { component, props } fields."
|
|
499
|
-
if (asJson)
|
|
787
|
+
if (asJson)
|
|
788
|
+
console.log(JSON.stringify({ ok: false, error: msg }, null, 2))
|
|
500
789
|
else console.error(msg)
|
|
501
790
|
process.exit(1)
|
|
502
791
|
}
|
|
@@ -514,17 +803,24 @@ if (flag === "--evaluate") {
|
|
|
514
803
|
}
|
|
515
804
|
|
|
516
805
|
if (!evaluateChart || !formatEvaluateChart) {
|
|
517
|
-
const msg =
|
|
518
|
-
|
|
806
|
+
const msg =
|
|
807
|
+
"Chart evaluation requires the built library. Run `npm run dist` first, or use the MCP `evaluateChart` tool."
|
|
808
|
+
if (asJson)
|
|
809
|
+
console.log(JSON.stringify({ ok: false, error: msg }, null, 2))
|
|
519
810
|
else console.error(msg)
|
|
520
811
|
process.exit(2)
|
|
521
812
|
}
|
|
522
813
|
|
|
523
|
-
const result = evaluateChart(
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
814
|
+
const result = evaluateChart(
|
|
815
|
+
component,
|
|
816
|
+
props,
|
|
817
|
+
Array.isArray(data) ? data : undefined,
|
|
818
|
+
{
|
|
819
|
+
inChartContainer: inChartContainer === true,
|
|
820
|
+
describe: describe === true,
|
|
821
|
+
navigable: navigable === true
|
|
822
|
+
}
|
|
823
|
+
)
|
|
528
824
|
if (asJson) console.log(JSON.stringify(result, null, 2))
|
|
529
825
|
else console.log(formatEvaluateChart(result))
|
|
530
826
|
process.exit(result.ok ? 0 : 1)
|
|
@@ -536,6 +832,134 @@ if (flag === "--evaluate") {
|
|
|
536
832
|
}
|
|
537
833
|
}
|
|
538
834
|
|
|
835
|
+
if (
|
|
836
|
+
[
|
|
837
|
+
"--audit-artifact",
|
|
838
|
+
"--recommend-representation",
|
|
839
|
+
"--repair-artifact",
|
|
840
|
+
"--explain-refusal"
|
|
841
|
+
].includes(flag)
|
|
842
|
+
) {
|
|
843
|
+
const asJson = process.argv.includes("--json")
|
|
844
|
+
try {
|
|
845
|
+
const request = readArtifactRequest(flag)
|
|
846
|
+
const runtime = loadArtifactRuntime()
|
|
847
|
+
if (!runtime) {
|
|
848
|
+
const message =
|
|
849
|
+
"Artifact evaluation requires the built library. Run `npm run dist` first, or use the equivalent MCP tool."
|
|
850
|
+
if (asJson)
|
|
851
|
+
console.log(JSON.stringify({ ok: false, error: message }, null, 2))
|
|
852
|
+
else console.error(message)
|
|
853
|
+
process.exit(2)
|
|
854
|
+
}
|
|
855
|
+
const validation = runtime.validateArtifactContract(request.contract)
|
|
856
|
+
if (!validation.valid) {
|
|
857
|
+
const message = validation.errors
|
|
858
|
+
.map(
|
|
859
|
+
({ path: errorPath, message: detail }) => `${errorPath}: ${detail}`
|
|
860
|
+
)
|
|
861
|
+
.join("\n")
|
|
862
|
+
if (asJson) {
|
|
863
|
+
console.log(
|
|
864
|
+
JSON.stringify(
|
|
865
|
+
{ ok: false, error: "Invalid artifact contract", validation },
|
|
866
|
+
null,
|
|
867
|
+
2
|
|
868
|
+
)
|
|
869
|
+
)
|
|
870
|
+
} else {
|
|
871
|
+
console.error(`Invalid artifact contract:\n${message}`)
|
|
872
|
+
}
|
|
873
|
+
process.exit(1)
|
|
874
|
+
}
|
|
875
|
+
const options = {
|
|
876
|
+
data: Array.isArray(request.data) ? request.data : undefined,
|
|
877
|
+
policy: request.policy,
|
|
878
|
+
exceptions: Array.isArray(request.exceptions)
|
|
879
|
+
? request.exceptions
|
|
880
|
+
: undefined,
|
|
881
|
+
now: request.now,
|
|
882
|
+
...(typeof runtime.renderChartWithEvidence === "function"
|
|
883
|
+
? { render: runtime.renderChartWithEvidence }
|
|
884
|
+
: {}),
|
|
885
|
+
inChartContainer: request.inChartContainer === true,
|
|
886
|
+
describe: request.describe === true,
|
|
887
|
+
navigable: request.navigable === true
|
|
888
|
+
}
|
|
889
|
+
if (flag === "--recommend-representation") {
|
|
890
|
+
const data =
|
|
891
|
+
options.data ??
|
|
892
|
+
(Array.isArray(request.props.data) ? request.props.data : [])
|
|
893
|
+
const result = runtime.recommendRepresentation(data, request.contract, {
|
|
894
|
+
policy: request.policy,
|
|
895
|
+
exceptions: options.exceptions,
|
|
896
|
+
preferredComponent: request.component,
|
|
897
|
+
intent: request.intent,
|
|
898
|
+
now: request.now
|
|
899
|
+
})
|
|
900
|
+
console.log(JSON.stringify(result, null, 2))
|
|
901
|
+
process.exit(result.status === "refuse" ? 1 : 0)
|
|
902
|
+
}
|
|
903
|
+
if (flag === "--repair-artifact") {
|
|
904
|
+
const result = runtime.repairArtifact(
|
|
905
|
+
request.component,
|
|
906
|
+
request.props,
|
|
907
|
+
request.contract,
|
|
908
|
+
{
|
|
909
|
+
...options,
|
|
910
|
+
applySafeIdentityRepairs: request.applySafeIdentityRepairs === true
|
|
911
|
+
}
|
|
912
|
+
)
|
|
913
|
+
writeArtifactJsonAndExit(
|
|
914
|
+
safeArtifactRepairOutput(runtime, result),
|
|
915
|
+
result.after.status === "refuse" ? 1 : 0
|
|
916
|
+
)
|
|
917
|
+
}
|
|
918
|
+
const result = runtime.evaluateArtifact(
|
|
919
|
+
request.component,
|
|
920
|
+
request.props,
|
|
921
|
+
request.contract,
|
|
922
|
+
options
|
|
923
|
+
)
|
|
924
|
+
if (flag === "--explain-refusal") {
|
|
925
|
+
const explanation = runtime.explainArtifactRefusal(result)
|
|
926
|
+
if (asJson) {
|
|
927
|
+
console.log(
|
|
928
|
+
JSON.stringify(
|
|
929
|
+
{
|
|
930
|
+
status: result.status === "refuse" ? "refuse" : "not-refused",
|
|
931
|
+
evaluationStatus: result.status,
|
|
932
|
+
policy: result.policy,
|
|
933
|
+
explanation,
|
|
934
|
+
failures: result.obligations
|
|
935
|
+
.filter(({ status }) => status === "fail")
|
|
936
|
+
.slice(0, 20),
|
|
937
|
+
repairs: result.repairs.slice(0, 20)
|
|
938
|
+
},
|
|
939
|
+
null,
|
|
940
|
+
2
|
|
941
|
+
)
|
|
942
|
+
)
|
|
943
|
+
} else {
|
|
944
|
+
console.log(explanation)
|
|
945
|
+
}
|
|
946
|
+
} else if (asJson) {
|
|
947
|
+
console.log(JSON.stringify(result, null, 2))
|
|
948
|
+
} else {
|
|
949
|
+
console.log(
|
|
950
|
+
`Artifact status: ${result.status}\n${runtime.formatObligations(result.obligations)}`
|
|
951
|
+
)
|
|
952
|
+
}
|
|
953
|
+
process.exit(result.status === "refuse" ? 1 : 0)
|
|
954
|
+
} catch (err) {
|
|
955
|
+
const message = errorMessage(err)
|
|
956
|
+
if (asJson)
|
|
957
|
+
console.log(JSON.stringify({ ok: false, error: message }, null, 2))
|
|
958
|
+
else console.error(message)
|
|
959
|
+
process.exit(1)
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
|
|
539
963
|
const filePath = flag ? FILES[flag] : FILES.default
|
|
540
964
|
|
|
541
965
|
if (!filePath) {
|