@vurb/core 3.2.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 +677 -0
- package/dist/cli/args.d.ts +26 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +117 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/commands/create.d.ts +11 -0
- package/dist/cli/commands/create.d.ts.map +1 -0
- package/dist/cli/commands/create.js +121 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/deploy.d.ts +3 -0
- package/dist/cli/commands/deploy.d.ts.map +1 -0
- package/dist/cli/commands/deploy.js +268 -0
- package/dist/cli/commands/deploy.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +9 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +58 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/lock.d.ts +5 -0
- package/dist/cli/commands/lock.d.ts.map +1 -0
- package/dist/cli/commands/lock.js +94 -0
- package/dist/cli/commands/lock.js.map +1 -0
- package/dist/cli/commands/remote.d.ts +3 -0
- package/dist/cli/commands/remote.d.ts.map +1 -0
- package/dist/cli/commands/remote.js +37 -0
- package/dist/cli/commands/remote.js.map +1 -0
- package/dist/cli/constants.d.ts +18 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/constants.js +95 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/progress.d.ts +34 -0
- package/dist/cli/progress.d.ts.map +1 -0
- package/dist/cli/progress.js +102 -0
- package/dist/cli/progress.js.map +1 -0
- package/dist/cli/rc.d.ts +11 -0
- package/dist/cli/rc.d.ts.map +1 -0
- package/dist/cli/rc.js +75 -0
- package/dist/cli/rc.js.map +1 -0
- package/dist/cli/registry.d.ts +25 -0
- package/dist/cli/registry.d.ts.map +1 -0
- package/dist/cli/registry.js +86 -0
- package/dist/cli/registry.js.map +1 -0
- package/dist/cli/scaffold.d.ts +10 -0
- package/dist/cli/scaffold.d.ts.map +1 -0
- package/dist/cli/scaffold.js +105 -0
- package/dist/cli/scaffold.js.map +1 -0
- package/dist/cli/templates/config.d.ts +14 -0
- package/dist/cli/templates/config.d.ts.map +1 -0
- package/dist/cli/templates/config.js +133 -0
- package/dist/cli/templates/config.js.map +1 -0
- package/dist/cli/templates/constants.d.ts +9 -0
- package/dist/cli/templates/constants.d.ts.map +1 -0
- package/dist/cli/templates/constants.js +9 -0
- package/dist/cli/templates/constants.js.map +1 -0
- package/dist/cli/templates/core.d.ts +14 -0
- package/dist/cli/templates/core.d.ts.map +1 -0
- package/dist/cli/templates/core.js +186 -0
- package/dist/cli/templates/core.js.map +1 -0
- package/dist/cli/templates/cursor.d.ts +8 -0
- package/dist/cli/templates/cursor.d.ts.map +1 -0
- package/dist/cli/templates/cursor.js +13 -0
- package/dist/cli/templates/cursor.js.map +1 -0
- package/dist/cli/templates/index.d.ts +17 -0
- package/dist/cli/templates/index.d.ts.map +1 -0
- package/dist/cli/templates/index.js +27 -0
- package/dist/cli/templates/index.js.map +1 -0
- package/dist/cli/templates/middleware.d.ts +7 -0
- package/dist/cli/templates/middleware.d.ts.map +1 -0
- package/dist/cli/templates/middleware.js +34 -0
- package/dist/cli/templates/middleware.js.map +1 -0
- package/dist/cli/templates/presenter.d.ts +7 -0
- package/dist/cli/templates/presenter.d.ts.map +1 -0
- package/dist/cli/templates/presenter.js +46 -0
- package/dist/cli/templates/presenter.js.map +1 -0
- package/dist/cli/templates/prompt.d.ts +7 -0
- package/dist/cli/templates/prompt.d.ts.map +1 -0
- package/dist/cli/templates/prompt.js +42 -0
- package/dist/cli/templates/prompt.js.map +1 -0
- package/dist/cli/templates/readme.d.ts +8 -0
- package/dist/cli/templates/readme.d.ts.map +1 -0
- package/dist/cli/templates/readme.js +173 -0
- package/dist/cli/templates/readme.js.map +1 -0
- package/dist/cli/templates/testing.d.ts +11 -0
- package/dist/cli/templates/testing.d.ts.map +1 -0
- package/dist/cli/templates/testing.js +101 -0
- package/dist/cli/templates/testing.js.map +1 -0
- package/dist/cli/templates/tools.d.ts +13 -0
- package/dist/cli/templates/tools.d.ts.map +1 -0
- package/dist/cli/templates/tools.js +63 -0
- package/dist/cli/templates/tools.js.map +1 -0
- package/dist/cli/templates/vectors/database.d.ts +9 -0
- package/dist/cli/templates/vectors/database.d.ts.map +1 -0
- package/dist/cli/templates/vectors/database.js +82 -0
- package/dist/cli/templates/vectors/database.js.map +1 -0
- package/dist/cli/templates/vectors/index.d.ts +9 -0
- package/dist/cli/templates/vectors/index.d.ts.map +1 -0
- package/dist/cli/templates/vectors/index.js +9 -0
- package/dist/cli/templates/vectors/index.js.map +1 -0
- package/dist/cli/templates/vectors/oauth.d.ts +10 -0
- package/dist/cli/templates/vectors/oauth.d.ts.map +1 -0
- package/dist/cli/templates/vectors/oauth.js +76 -0
- package/dist/cli/templates/vectors/oauth.js.map +1 -0
- package/dist/cli/templates/vectors/openapi.d.ts +10 -0
- package/dist/cli/templates/vectors/openapi.d.ts.map +1 -0
- package/dist/cli/templates/vectors/openapi.js +106 -0
- package/dist/cli/templates/vectors/openapi.js.map +1 -0
- package/dist/cli/templates/vectors/workflow.d.ts +7 -0
- package/dist/cli/templates/vectors/workflow.d.ts.map +1 -0
- package/dist/cli/templates/vectors/workflow.js +49 -0
- package/dist/cli/templates/vectors/workflow.js.map +1 -0
- package/dist/cli/types.d.ts +36 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +10 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/utils.d.ts +27 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +73 -0
- package/dist/cli/utils.js.map +1 -0
- package/dist/cli/vurb.d.ts +15 -0
- package/dist/cli/vurb.d.ts.map +1 -0
- package/dist/cli/vurb.js +87 -0
- package/dist/cli/vurb.js.map +1 -0
- package/dist/client/InferRouter.d.ts +92 -0
- package/dist/client/InferRouter.d.ts.map +1 -0
- package/dist/client/InferRouter.js +31 -0
- package/dist/client/InferRouter.js.map +1 -0
- package/dist/client/VurbClient.d.ts +282 -0
- package/dist/client/VurbClient.d.ts.map +1 -0
- package/dist/client/VurbClient.js +287 -0
- package/dist/client/VurbClient.js.map +1 -0
- package/dist/client/createTypedRegistry.d.ts +25 -0
- package/dist/client/createTypedRegistry.d.ts.map +1 -0
- package/dist/client/createTypedRegistry.js +74 -0
- package/dist/client/createTypedRegistry.js.map +1 -0
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -0
- package/dist/converters/ConverterBase.d.ts +68 -0
- package/dist/converters/ConverterBase.d.ts.map +1 -0
- package/dist/converters/ConverterBase.js +62 -0
- package/dist/converters/ConverterBase.js.map +1 -0
- package/dist/converters/GroupConverter.d.ts +33 -0
- package/dist/converters/GroupConverter.d.ts.map +1 -0
- package/dist/converters/GroupConverter.js +26 -0
- package/dist/converters/GroupConverter.js.map +1 -0
- package/dist/converters/PromptConverter.d.ts +33 -0
- package/dist/converters/PromptConverter.d.ts.map +1 -0
- package/dist/converters/PromptConverter.js +26 -0
- package/dist/converters/PromptConverter.js.map +1 -0
- package/dist/converters/ResourceConverter.d.ts +35 -0
- package/dist/converters/ResourceConverter.d.ts.map +1 -0
- package/dist/converters/ResourceConverter.js +28 -0
- package/dist/converters/ResourceConverter.js.map +1 -0
- package/dist/converters/ToolAnnotationsConverter.d.ts +33 -0
- package/dist/converters/ToolAnnotationsConverter.d.ts.map +1 -0
- package/dist/converters/ToolAnnotationsConverter.js +26 -0
- package/dist/converters/ToolAnnotationsConverter.js.map +1 -0
- package/dist/converters/ToolConverter.d.ts +35 -0
- package/dist/converters/ToolConverter.d.ts.map +1 -0
- package/dist/converters/ToolConverter.js +28 -0
- package/dist/converters/ToolConverter.js.map +1 -0
- package/dist/converters/index.d.ts +7 -0
- package/dist/converters/index.d.ts.map +1 -0
- package/dist/converters/index.js +7 -0
- package/dist/converters/index.js.map +1 -0
- package/dist/core/StandardSchema.d.ts +178 -0
- package/dist/core/StandardSchema.d.ts.map +1 -0
- package/dist/core/StandardSchema.js +174 -0
- package/dist/core/StandardSchema.js.map +1 -0
- package/dist/core/builder/ActionGroupBuilder.d.ts +208 -0
- package/dist/core/builder/ActionGroupBuilder.d.ts.map +1 -0
- package/dist/core/builder/ActionGroupBuilder.js +193 -0
- package/dist/core/builder/ActionGroupBuilder.js.map +1 -0
- package/dist/core/builder/ErrorBuilder.d.ts +59 -0
- package/dist/core/builder/ErrorBuilder.d.ts.map +1 -0
- package/dist/core/builder/ErrorBuilder.js +99 -0
- package/dist/core/builder/ErrorBuilder.js.map +1 -0
- package/dist/core/builder/FluentRouter.d.ts +96 -0
- package/dist/core/builder/FluentRouter.d.ts.map +1 -0
- package/dist/core/builder/FluentRouter.js +116 -0
- package/dist/core/builder/FluentRouter.js.map +1 -0
- package/dist/core/builder/FluentSchemaHelpers.d.ts +237 -0
- package/dist/core/builder/FluentSchemaHelpers.d.ts.map +1 -0
- package/dist/core/builder/FluentSchemaHelpers.js +227 -0
- package/dist/core/builder/FluentSchemaHelpers.js.map +1 -0
- package/dist/core/builder/FluentToolBuilder.d.ts +419 -0
- package/dist/core/builder/FluentToolBuilder.d.ts.map +1 -0
- package/dist/core/builder/FluentToolBuilder.js +643 -0
- package/dist/core/builder/FluentToolBuilder.js.map +1 -0
- package/dist/core/builder/GroupedToolBuilder.d.ts +832 -0
- package/dist/core/builder/GroupedToolBuilder.d.ts.map +1 -0
- package/dist/core/builder/GroupedToolBuilder.js +1306 -0
- package/dist/core/builder/GroupedToolBuilder.js.map +1 -0
- package/dist/core/builder/ParamDescriptors.d.ts +142 -0
- package/dist/core/builder/ParamDescriptors.d.ts.map +1 -0
- package/dist/core/builder/ParamDescriptors.js +164 -0
- package/dist/core/builder/ParamDescriptors.js.map +1 -0
- package/dist/core/builder/ToolDefinitionCompiler.d.ts +37 -0
- package/dist/core/builder/ToolDefinitionCompiler.d.ts.map +1 -0
- package/dist/core/builder/ToolDefinitionCompiler.js +72 -0
- package/dist/core/builder/ToolDefinitionCompiler.js.map +1 -0
- package/dist/core/builder/defineTool.d.ts +180 -0
- package/dist/core/builder/defineTool.d.ts.map +1 -0
- package/dist/core/builder/defineTool.js +164 -0
- package/dist/core/builder/defineTool.js.map +1 -0
- package/dist/core/builder/index.d.ts +13 -0
- package/dist/core/builder/index.d.ts.map +1 -0
- package/dist/core/builder/index.js +13 -0
- package/dist/core/builder/index.js.map +1 -0
- package/dist/core/createGroup.d.ts +140 -0
- package/dist/core/createGroup.d.ts.map +1 -0
- package/dist/core/createGroup.js +144 -0
- package/dist/core/createGroup.js.map +1 -0
- package/dist/core/execution/ConcurrencyGuard.d.ts +103 -0
- package/dist/core/execution/ConcurrencyGuard.d.ts.map +1 -0
- package/dist/core/execution/ConcurrencyGuard.js +147 -0
- package/dist/core/execution/ConcurrencyGuard.js.map +1 -0
- package/dist/core/execution/EgressGuard.d.ts +72 -0
- package/dist/core/execution/EgressGuard.d.ts.map +1 -0
- package/dist/core/execution/EgressGuard.js +163 -0
- package/dist/core/execution/EgressGuard.js.map +1 -0
- package/dist/core/execution/ExecutionPipeline.d.ts +67 -0
- package/dist/core/execution/ExecutionPipeline.d.ts.map +1 -0
- package/dist/core/execution/ExecutionPipeline.js +176 -0
- package/dist/core/execution/ExecutionPipeline.js.map +1 -0
- package/dist/core/execution/MiddlewareCompiler.d.ts +35 -0
- package/dist/core/execution/MiddlewareCompiler.d.ts.map +1 -0
- package/dist/core/execution/MiddlewareCompiler.js +111 -0
- package/dist/core/execution/MiddlewareCompiler.js.map +1 -0
- package/dist/core/execution/MutationSerializer.d.ts +78 -0
- package/dist/core/execution/MutationSerializer.d.ts.map +1 -0
- package/dist/core/execution/MutationSerializer.js +106 -0
- package/dist/core/execution/MutationSerializer.js.map +1 -0
- package/dist/core/execution/PipelineHooks.d.ts +46 -0
- package/dist/core/execution/PipelineHooks.d.ts.map +1 -0
- package/dist/core/execution/PipelineHooks.js +66 -0
- package/dist/core/execution/PipelineHooks.js.map +1 -0
- package/dist/core/execution/ProgressHelper.d.ts +67 -0
- package/dist/core/execution/ProgressHelper.d.ts.map +1 -0
- package/dist/core/execution/ProgressHelper.js +59 -0
- package/dist/core/execution/ProgressHelper.js.map +1 -0
- package/dist/core/execution/ValidationErrorFormatter.d.ts +34 -0
- package/dist/core/execution/ValidationErrorFormatter.d.ts.map +1 -0
- package/dist/core/execution/ValidationErrorFormatter.js +193 -0
- package/dist/core/execution/ValidationErrorFormatter.js.map +1 -0
- package/dist/core/execution/index.d.ts +9 -0
- package/dist/core/execution/index.d.ts.map +1 -0
- package/dist/core/execution/index.js +9 -0
- package/dist/core/execution/index.js.map +1 -0
- package/dist/core/index.d.ts +34 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +29 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/initVurb.d.ts +295 -0
- package/dist/core/initVurb.d.ts.map +1 -0
- package/dist/core/initVurb.js +171 -0
- package/dist/core/initVurb.js.map +1 -0
- package/dist/core/middleware/ContextDerivation.d.ts +124 -0
- package/dist/core/middleware/ContextDerivation.d.ts.map +1 -0
- package/dist/core/middleware/ContextDerivation.js +117 -0
- package/dist/core/middleware/ContextDerivation.js.map +1 -0
- package/dist/core/middleware/index.d.ts +4 -0
- package/dist/core/middleware/index.d.ts.map +1 -0
- package/dist/core/middleware/index.js +3 -0
- package/dist/core/middleware/index.js.map +1 -0
- package/dist/core/registry/ToolFilterEngine.d.ts +27 -0
- package/dist/core/registry/ToolFilterEngine.d.ts.map +1 -0
- package/dist/core/registry/ToolFilterEngine.js +45 -0
- package/dist/core/registry/ToolFilterEngine.js.map +1 -0
- package/dist/core/registry/ToolRegistry.d.ts +259 -0
- package/dist/core/registry/ToolRegistry.d.ts.map +1 -0
- package/dist/core/registry/ToolRegistry.js +343 -0
- package/dist/core/registry/ToolRegistry.js.map +1 -0
- package/dist/core/registry/index.d.ts +4 -0
- package/dist/core/registry/index.d.ts.map +1 -0
- package/dist/core/registry/index.js +3 -0
- package/dist/core/registry/index.js.map +1 -0
- package/dist/core/response.d.ts +289 -0
- package/dist/core/response.d.ts.map +1 -0
- package/dist/core/response.js +286 -0
- package/dist/core/response.js.map +1 -0
- package/dist/core/result.d.ts +93 -0
- package/dist/core/result.d.ts.map +1 -0
- package/dist/core/result.js +66 -0
- package/dist/core/result.js.map +1 -0
- package/dist/core/schema/AnnotationAggregator.d.ts +11 -0
- package/dist/core/schema/AnnotationAggregator.d.ts.map +1 -0
- package/dist/core/schema/AnnotationAggregator.js +40 -0
- package/dist/core/schema/AnnotationAggregator.js.map +1 -0
- package/dist/core/schema/DescriptionGenerator.d.ts +12 -0
- package/dist/core/schema/DescriptionGenerator.d.ts.map +1 -0
- package/dist/core/schema/DescriptionGenerator.js +81 -0
- package/dist/core/schema/DescriptionGenerator.js.map +1 -0
- package/dist/core/schema/SchemaGenerator.d.ts +15 -0
- package/dist/core/schema/SchemaGenerator.d.ts.map +1 -0
- package/dist/core/schema/SchemaGenerator.js +192 -0
- package/dist/core/schema/SchemaGenerator.js.map +1 -0
- package/dist/core/schema/SchemaUtils.d.ts +26 -0
- package/dist/core/schema/SchemaUtils.d.ts.map +1 -0
- package/dist/core/schema/SchemaUtils.js +85 -0
- package/dist/core/schema/SchemaUtils.js.map +1 -0
- package/dist/core/schema/ToonDescriptionGenerator.d.ts +3 -0
- package/dist/core/schema/ToonDescriptionGenerator.d.ts.map +1 -0
- package/dist/core/schema/ToonDescriptionGenerator.js +65 -0
- package/dist/core/schema/ToonDescriptionGenerator.js.map +1 -0
- package/dist/core/schema/index.d.ts +7 -0
- package/dist/core/schema/index.d.ts.map +1 -0
- package/dist/core/schema/index.js +7 -0
- package/dist/core/schema/index.js.map +1 -0
- package/dist/core/serialization/JsonSerializer.d.ts +71 -0
- package/dist/core/serialization/JsonSerializer.d.ts.map +1 -0
- package/dist/core/serialization/JsonSerializer.js +192 -0
- package/dist/core/serialization/JsonSerializer.js.map +1 -0
- package/dist/core/serialization/index.d.ts +7 -0
- package/dist/core/serialization/index.d.ts.map +1 -0
- package/dist/core/serialization/index.js +7 -0
- package/dist/core/serialization/index.js.map +1 -0
- package/dist/core/types.d.ts +303 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +17 -0
- package/dist/core/types.js.map +1 -0
- package/dist/domain/Annotations.d.ts +42 -0
- package/dist/domain/Annotations.d.ts.map +1 -0
- package/dist/domain/Annotations.js +16 -0
- package/dist/domain/Annotations.js.map +1 -0
- package/dist/domain/BaseModel.d.ts +50 -0
- package/dist/domain/BaseModel.d.ts.map +1 -0
- package/dist/domain/BaseModel.js +41 -0
- package/dist/domain/BaseModel.js.map +1 -0
- package/dist/domain/Group.d.ts +99 -0
- package/dist/domain/Group.d.ts.map +1 -0
- package/dist/domain/Group.js +172 -0
- package/dist/domain/Group.js.map +1 -0
- package/dist/domain/GroupItem.d.ts +46 -0
- package/dist/domain/GroupItem.d.ts.map +1 -0
- package/dist/domain/GroupItem.js +58 -0
- package/dist/domain/GroupItem.js.map +1 -0
- package/dist/domain/Icon.d.ts +41 -0
- package/dist/domain/Icon.d.ts.map +1 -0
- package/dist/domain/Icon.js +15 -0
- package/dist/domain/Icon.js.map +1 -0
- package/dist/domain/Prompt.d.ts +49 -0
- package/dist/domain/Prompt.d.ts.map +1 -0
- package/dist/domain/Prompt.js +59 -0
- package/dist/domain/Prompt.js.map +1 -0
- package/dist/domain/PromptArgument.d.ts +23 -0
- package/dist/domain/PromptArgument.d.ts.map +1 -0
- package/dist/domain/PromptArgument.js +27 -0
- package/dist/domain/PromptArgument.js.map +1 -0
- package/dist/domain/Resource.d.ts +37 -0
- package/dist/domain/Resource.d.ts.map +1 -0
- package/dist/domain/Resource.js +39 -0
- package/dist/domain/Resource.js.map +1 -0
- package/dist/domain/Role.d.ts +23 -0
- package/dist/domain/Role.d.ts.map +1 -0
- package/dist/domain/Role.js +24 -0
- package/dist/domain/Role.js.map +1 -0
- package/dist/domain/Tool.d.ts +39 -0
- package/dist/domain/Tool.d.ts.map +1 -0
- package/dist/domain/Tool.js +41 -0
- package/dist/domain/Tool.js.map +1 -0
- package/dist/domain/ToolAnnotations.d.ts +48 -0
- package/dist/domain/ToolAnnotations.d.ts.map +1 -0
- package/dist/domain/ToolAnnotations.js +15 -0
- package/dist/domain/ToolAnnotations.js.map +1 -0
- package/dist/domain/index.d.ts +16 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +13 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/utils.d.ts +6 -0
- package/dist/domain/utils.d.ts.map +1 -0
- package/dist/domain/utils.js +12 -0
- package/dist/domain/utils.js.map +1 -0
- package/dist/edge-stub.d.ts +73 -0
- package/dist/edge-stub.d.ts.map +1 -0
- package/dist/edge-stub.js +83 -0
- package/dist/edge-stub.js.map +1 -0
- package/dist/exposition/ExpositionCompiler.d.ts +66 -0
- package/dist/exposition/ExpositionCompiler.d.ts.map +1 -0
- package/dist/exposition/ExpositionCompiler.js +279 -0
- package/dist/exposition/ExpositionCompiler.js.map +1 -0
- package/dist/exposition/index.d.ts +4 -0
- package/dist/exposition/index.d.ts.map +1 -0
- package/dist/exposition/index.js +2 -0
- package/dist/exposition/index.js.map +1 -0
- package/dist/exposition/types.d.ts +58 -0
- package/dist/exposition/types.d.ts.map +1 -0
- package/dist/exposition/types.js +11 -0
- package/dist/exposition/types.js.map +1 -0
- package/dist/fsm/StateMachineGate.d.ts +294 -0
- package/dist/fsm/StateMachineGate.d.ts.map +1 -0
- package/dist/fsm/StateMachineGate.js +400 -0
- package/dist/fsm/StateMachineGate.js.map +1 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +112 -0
- package/dist/index.js.map +1 -0
- package/dist/introspection/BehaviorDigest.d.ts +112 -0
- package/dist/introspection/BehaviorDigest.d.ts.map +1 -0
- package/dist/introspection/BehaviorDigest.js +149 -0
- package/dist/introspection/BehaviorDigest.js.map +1 -0
- package/dist/introspection/CapabilityLockfile.d.ts +261 -0
- package/dist/introspection/CapabilityLockfile.d.ts.map +1 -0
- package/dist/introspection/CapabilityLockfile.js +395 -0
- package/dist/introspection/CapabilityLockfile.js.map +1 -0
- package/dist/introspection/ContractAwareSelfHealing.d.ts +90 -0
- package/dist/introspection/ContractAwareSelfHealing.d.ts.map +1 -0
- package/dist/introspection/ContractAwareSelfHealing.js +132 -0
- package/dist/introspection/ContractAwareSelfHealing.js.map +1 -0
- package/dist/introspection/ContractDiff.d.ts +91 -0
- package/dist/introspection/ContractDiff.d.ts.map +1 -0
- package/dist/introspection/ContractDiff.js +466 -0
- package/dist/introspection/ContractDiff.js.map +1 -0
- package/dist/introspection/CryptoAttestation.d.ts +143 -0
- package/dist/introspection/CryptoAttestation.d.ts.map +1 -0
- package/dist/introspection/CryptoAttestation.js +192 -0
- package/dist/introspection/CryptoAttestation.js.map +1 -0
- package/dist/introspection/EntitlementScanner.d.ts +177 -0
- package/dist/introspection/EntitlementScanner.d.ts.map +1 -0
- package/dist/introspection/EntitlementScanner.js +459 -0
- package/dist/introspection/EntitlementScanner.js.map +1 -0
- package/dist/introspection/GovernanceObserver.d.ts +88 -0
- package/dist/introspection/GovernanceObserver.d.ts.map +1 -0
- package/dist/introspection/GovernanceObserver.js +136 -0
- package/dist/introspection/GovernanceObserver.js.map +1 -0
- package/dist/introspection/IntrospectionResource.d.ts +20 -0
- package/dist/introspection/IntrospectionResource.d.ts.map +1 -0
- package/dist/introspection/IntrospectionResource.js +112 -0
- package/dist/introspection/IntrospectionResource.js.map +1 -0
- package/dist/introspection/ManifestCompiler.d.ts +33 -0
- package/dist/introspection/ManifestCompiler.d.ts.map +1 -0
- package/dist/introspection/ManifestCompiler.js +88 -0
- package/dist/introspection/ManifestCompiler.js.map +1 -0
- package/dist/introspection/SemanticProbe.d.ts +207 -0
- package/dist/introspection/SemanticProbe.d.ts.map +1 -0
- package/dist/introspection/SemanticProbe.js +274 -0
- package/dist/introspection/SemanticProbe.js.map +1 -0
- package/dist/introspection/TokenEconomics.d.ts +210 -0
- package/dist/introspection/TokenEconomics.d.ts.map +1 -0
- package/dist/introspection/TokenEconomics.js +292 -0
- package/dist/introspection/TokenEconomics.js.map +1 -0
- package/dist/introspection/ToolContract.d.ts +161 -0
- package/dist/introspection/ToolContract.d.ts.map +1 -0
- package/dist/introspection/ToolContract.js +218 -0
- package/dist/introspection/ToolContract.js.map +1 -0
- package/dist/introspection/canonicalize.d.ts +35 -0
- package/dist/introspection/canonicalize.d.ts.map +1 -0
- package/dist/introspection/canonicalize.js +72 -0
- package/dist/introspection/canonicalize.js.map +1 -0
- package/dist/introspection/index.d.ts +26 -0
- package/dist/introspection/index.d.ts.map +1 -0
- package/dist/introspection/index.js +24 -0
- package/dist/introspection/index.js.map +1 -0
- package/dist/introspection/types.d.ts +120 -0
- package/dist/introspection/types.d.ts.map +1 -0
- package/dist/introspection/types.js +13 -0
- package/dist/introspection/types.js.map +1 -0
- package/dist/observability/DebugObserver.d.ts +185 -0
- package/dist/observability/DebugObserver.d.ts.map +1 -0
- package/dist/observability/DebugObserver.js +102 -0
- package/dist/observability/DebugObserver.js.map +1 -0
- package/dist/observability/TelemetryBus.d.ts +88 -0
- package/dist/observability/TelemetryBus.d.ts.map +1 -0
- package/dist/observability/TelemetryBus.js +463 -0
- package/dist/observability/TelemetryBus.js.map +1 -0
- package/dist/observability/TelemetryEvent.d.ts +177 -0
- package/dist/observability/TelemetryEvent.d.ts.map +1 -0
- package/dist/observability/TelemetryEvent.js +2 -0
- package/dist/observability/TelemetryEvent.js.map +1 -0
- package/dist/observability/Tracing.d.ts +155 -0
- package/dist/observability/Tracing.d.ts.map +1 -0
- package/dist/observability/Tracing.js +67 -0
- package/dist/observability/Tracing.js.map +1 -0
- package/dist/observability/index.d.ts +13 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +12 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/presenter/PostProcessor.d.ts +52 -0
- package/dist/presenter/PostProcessor.d.ts.map +1 -0
- package/dist/presenter/PostProcessor.js +148 -0
- package/dist/presenter/PostProcessor.js.map +1 -0
- package/dist/presenter/Presenter.d.ts +575 -0
- package/dist/presenter/Presenter.d.ts.map +1 -0
- package/dist/presenter/Presenter.js +768 -0
- package/dist/presenter/Presenter.js.map +1 -0
- package/dist/presenter/PresenterValidationError.d.ts +42 -0
- package/dist/presenter/PresenterValidationError.d.ts.map +1 -0
- package/dist/presenter/PresenterValidationError.js +55 -0
- package/dist/presenter/PresenterValidationError.js.map +1 -0
- package/dist/presenter/RedactEngine.d.ts +110 -0
- package/dist/presenter/RedactEngine.d.ts.map +1 -0
- package/dist/presenter/RedactEngine.js +128 -0
- package/dist/presenter/RedactEngine.js.map +1 -0
- package/dist/presenter/ResponseBuilder.d.ts +262 -0
- package/dist/presenter/ResponseBuilder.d.ts.map +1 -0
- package/dist/presenter/ResponseBuilder.js +374 -0
- package/dist/presenter/ResponseBuilder.js.map +1 -0
- package/dist/presenter/SelectUtils.d.ts +78 -0
- package/dist/presenter/SelectUtils.d.ts.map +1 -0
- package/dist/presenter/SelectUtils.js +141 -0
- package/dist/presenter/SelectUtils.js.map +1 -0
- package/dist/presenter/ZodDescriptionExtractor.d.ts +54 -0
- package/dist/presenter/ZodDescriptionExtractor.d.ts.map +1 -0
- package/dist/presenter/ZodDescriptionExtractor.js +131 -0
- package/dist/presenter/ZodDescriptionExtractor.js.map +1 -0
- package/dist/presenter/definePresenter.d.ts +193 -0
- package/dist/presenter/definePresenter.d.ts.map +1 -0
- package/dist/presenter/definePresenter.js +99 -0
- package/dist/presenter/definePresenter.js.map +1 -0
- package/dist/presenter/index.d.ts +21 -0
- package/dist/presenter/index.d.ts.map +1 -0
- package/dist/presenter/index.js +28 -0
- package/dist/presenter/index.js.map +1 -0
- package/dist/presenter/suggest.d.ts +39 -0
- package/dist/presenter/suggest.d.ts.map +1 -0
- package/dist/presenter/suggest.js +41 -0
- package/dist/presenter/suggest.js.map +1 -0
- package/dist/presenter/typeHelpers.d.ts +147 -0
- package/dist/presenter/typeHelpers.d.ts.map +1 -0
- package/dist/presenter/typeHelpers.js +152 -0
- package/dist/presenter/typeHelpers.js.map +1 -0
- package/dist/presenter/ui.d.ts +205 -0
- package/dist/presenter/ui.d.ts.map +1 -0
- package/dist/presenter/ui.js +222 -0
- package/dist/presenter/ui.js.map +1 -0
- package/dist/prompt/CursorCodec.d.ts +43 -0
- package/dist/prompt/CursorCodec.d.ts.map +1 -0
- package/dist/prompt/CursorCodec.js +171 -0
- package/dist/prompt/CursorCodec.js.map +1 -0
- package/dist/prompt/FluentPromptBuilder.d.ts +155 -0
- package/dist/prompt/FluentPromptBuilder.d.ts.map +1 -0
- package/dist/prompt/FluentPromptBuilder.js +195 -0
- package/dist/prompt/FluentPromptBuilder.js.map +1 -0
- package/dist/prompt/HydrationSandbox.d.ts +55 -0
- package/dist/prompt/HydrationSandbox.d.ts.map +1 -0
- package/dist/prompt/HydrationSandbox.js +122 -0
- package/dist/prompt/HydrationSandbox.js.map +1 -0
- package/dist/prompt/PromptExecutionPipeline.d.ts +61 -0
- package/dist/prompt/PromptExecutionPipeline.d.ts.map +1 -0
- package/dist/prompt/PromptExecutionPipeline.js +177 -0
- package/dist/prompt/PromptExecutionPipeline.js.map +1 -0
- package/dist/prompt/PromptMessage.d.ts +133 -0
- package/dist/prompt/PromptMessage.d.ts.map +1 -0
- package/dist/prompt/PromptMessage.js +182 -0
- package/dist/prompt/PromptMessage.js.map +1 -0
- package/dist/prompt/PromptRegistry.d.ts +236 -0
- package/dist/prompt/PromptRegistry.d.ts.map +1 -0
- package/dist/prompt/PromptRegistry.js +399 -0
- package/dist/prompt/PromptRegistry.js.map +1 -0
- package/dist/prompt/definePrompt.d.ts +111 -0
- package/dist/prompt/definePrompt.d.ts.map +1 -0
- package/dist/prompt/definePrompt.js +130 -0
- package/dist/prompt/definePrompt.js.map +1 -0
- package/dist/prompt/index.d.ts +12 -0
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/index.js +13 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/prompt/types.d.ts +425 -0
- package/dist/prompt/types.d.ts.map +1 -0
- package/dist/prompt/types.js +19 -0
- package/dist/prompt/types.js.map +1 -0
- package/dist/sandbox/SandboxEngine.d.ts +225 -0
- package/dist/sandbox/SandboxEngine.d.ts.map +1 -0
- package/dist/sandbox/SandboxEngine.js +437 -0
- package/dist/sandbox/SandboxEngine.js.map +1 -0
- package/dist/sandbox/SandboxGuard.d.ts +47 -0
- package/dist/sandbox/SandboxGuard.d.ts.map +1 -0
- package/dist/sandbox/SandboxGuard.js +127 -0
- package/dist/sandbox/SandboxGuard.js.map +1 -0
- package/dist/sandbox/index.d.ts +23 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +26 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/server/DevServer.d.ts +120 -0
- package/dist/server/DevServer.d.ts.map +1 -0
- package/dist/server/DevServer.js +252 -0
- package/dist/server/DevServer.js.map +1 -0
- package/dist/server/ServerAttachment.d.ts +354 -0
- package/dist/server/ServerAttachment.d.ts.map +1 -0
- package/dist/server/ServerAttachment.js +709 -0
- package/dist/server/ServerAttachment.js.map +1 -0
- package/dist/server/ServerResolver.d.ts +24 -0
- package/dist/server/ServerResolver.d.ts.map +1 -0
- package/dist/server/ServerResolver.js +50 -0
- package/dist/server/ServerResolver.js.map +1 -0
- package/dist/server/autoDiscover.d.ts +75 -0
- package/dist/server/autoDiscover.d.ts.map +1 -0
- package/dist/server/autoDiscover.js +164 -0
- package/dist/server/autoDiscover.js.map +1 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +11 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/startServer.d.ts +81 -0
- package/dist/server/startServer.d.ts.map +1 -0
- package/dist/server/startServer.js +143 -0
- package/dist/server/startServer.js.map +1 -0
- package/dist/state-sync/CausalEngine.d.ts +28 -0
- package/dist/state-sync/CausalEngine.d.ts.map +1 -0
- package/dist/state-sync/CausalEngine.js +17 -0
- package/dist/state-sync/CausalEngine.js.map +1 -0
- package/dist/state-sync/DescriptionDecorator.d.ts +31 -0
- package/dist/state-sync/DescriptionDecorator.d.ts.map +1 -0
- package/dist/state-sync/DescriptionDecorator.js +38 -0
- package/dist/state-sync/DescriptionDecorator.js.map +1 -0
- package/dist/state-sync/GlobMatcher.d.ts +29 -0
- package/dist/state-sync/GlobMatcher.d.ts.map +1 -0
- package/dist/state-sync/GlobMatcher.js +79 -0
- package/dist/state-sync/GlobMatcher.js.map +1 -0
- package/dist/state-sync/PolicyEngine.d.ts +75 -0
- package/dist/state-sync/PolicyEngine.d.ts.map +1 -0
- package/dist/state-sync/PolicyEngine.js +107 -0
- package/dist/state-sync/PolicyEngine.js.map +1 -0
- package/dist/state-sync/PolicyValidator.d.ts +67 -0
- package/dist/state-sync/PolicyValidator.d.ts.map +1 -0
- package/dist/state-sync/PolicyValidator.js +122 -0
- package/dist/state-sync/PolicyValidator.js.map +1 -0
- package/dist/state-sync/ResponseDecorator.d.ts +33 -0
- package/dist/state-sync/ResponseDecorator.d.ts.map +1 -0
- package/dist/state-sync/ResponseDecorator.js +20 -0
- package/dist/state-sync/ResponseDecorator.js.map +1 -0
- package/dist/state-sync/StateSyncBuilder.d.ts +77 -0
- package/dist/state-sync/StateSyncBuilder.d.ts.map +1 -0
- package/dist/state-sync/StateSyncBuilder.js +129 -0
- package/dist/state-sync/StateSyncBuilder.js.map +1 -0
- package/dist/state-sync/StateSyncLayer.d.ts +107 -0
- package/dist/state-sync/StateSyncLayer.d.ts.map +1 -0
- package/dist/state-sync/StateSyncLayer.js +158 -0
- package/dist/state-sync/StateSyncLayer.js.map +1 -0
- package/dist/state-sync/index.d.ts +27 -0
- package/dist/state-sync/index.d.ts.map +1 -0
- package/dist/state-sync/index.js +27 -0
- package/dist/state-sync/index.js.map +1 -0
- package/dist/state-sync/types.d.ts +174 -0
- package/dist/state-sync/types.d.ts.map +1 -0
- package/dist/state-sync/types.js +17 -0
- package/dist/state-sync/types.js.map +1 -0
- package/dist/testing/MvaMetaSymbol.d.ts +45 -0
- package/dist/testing/MvaMetaSymbol.d.ts.map +1 -0
- package/dist/testing/MvaMetaSymbol.js +34 -0
- package/dist/testing/MvaMetaSymbol.js.map +1 -0
- package/package.json +153 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JsonSerializer — AOT JSON Serialization Engine
|
|
3
|
+
*
|
|
4
|
+
* Compiles Zod schemas into hyper-fast stringify functions using
|
|
5
|
+
* `fast-json-stringify` (the Fastify serialization engine).
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* ┌──────────────────────────────────────────────────┐
|
|
9
|
+
* │ Boot / First Call (AOT / Lazy) │
|
|
10
|
+
* │ │
|
|
11
|
+
* │ ZodType ──► zod-to-json-schema ──► JSON Schema │
|
|
12
|
+
* │ │ │
|
|
13
|
+
* │ ▼ │
|
|
14
|
+
* │ fast-json-stringify │
|
|
15
|
+
* │ │ │
|
|
16
|
+
* │ ▼ │
|
|
17
|
+
* │ Compiled StringifyFn (C-like) │
|
|
18
|
+
* │ Cached via WeakMap<ZodType> │
|
|
19
|
+
* └──────────────────────────────────────────────────┘
|
|
20
|
+
*
|
|
21
|
+
* Properties:
|
|
22
|
+
* - 2-5x faster than `JSON.stringify` for known schemas
|
|
23
|
+
* - Lazy-by-default: compiles on first use, cached via WeakMap
|
|
24
|
+
* - Zero-risk fallback: if `fast-json-stringify` is missing or
|
|
25
|
+
* compilation fails, falls back to native `JSON.stringify`
|
|
26
|
+
* - Produces compact/minified JSON (no indentation) for max throughput
|
|
27
|
+
* - Safe optional/nullable handling via schema transformation
|
|
28
|
+
*
|
|
29
|
+
* @module
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
33
|
+
let _fjsBuild = null;
|
|
34
|
+
async function loadFastJsonStringify() {
|
|
35
|
+
if (_fjsBuild === false)
|
|
36
|
+
return null; // already tried, not available
|
|
37
|
+
if (_fjsBuild !== null)
|
|
38
|
+
return _fjsBuild;
|
|
39
|
+
try {
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
const mod = await import('fast-json-stringify');
|
|
42
|
+
_fjsBuild = (typeof mod === 'function' ? mod : mod.default);
|
|
43
|
+
return _fjsBuild;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
_fjsBuild = false; // mark as unavailable
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Synchronous version — uses the cached function if already loaded.
|
|
51
|
+
function getFjsBuild() {
|
|
52
|
+
if (_fjsBuild === false || _fjsBuild === null)
|
|
53
|
+
return null;
|
|
54
|
+
return _fjsBuild;
|
|
55
|
+
}
|
|
56
|
+
// ── Schema Cache ─────────────────────────────────────────
|
|
57
|
+
// WeakMap ensures schemas are compiled exactly once and can be GC'd
|
|
58
|
+
// when the schema reference is released.
|
|
59
|
+
const _cache = new WeakMap();
|
|
60
|
+
// ── JSON Schema Transformation ───────────────────────────
|
|
61
|
+
/**
|
|
62
|
+
* Transform a JSON Schema for safe use with fast-json-stringify.
|
|
63
|
+
*
|
|
64
|
+
* - Strips `$schema` (not supported by fjs)
|
|
65
|
+
* - Adds `additionalProperties: true` to objects so unknown fields
|
|
66
|
+
* are serialized instead of silently dropped
|
|
67
|
+
* - Wraps types with nullable variants where appropriate
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
function transformForFjs(jsonSchema) {
|
|
72
|
+
const schema = { ...jsonSchema };
|
|
73
|
+
// Remove $schema — fast-json-stringify doesn't support it
|
|
74
|
+
delete schema['$schema'];
|
|
75
|
+
// For object-type schemas, allow additional properties
|
|
76
|
+
// so dynamic/runtime fields are not silently dropped
|
|
77
|
+
if (schema['type'] === 'object') {
|
|
78
|
+
if (schema['additionalProperties'] === undefined) {
|
|
79
|
+
schema['additionalProperties'] = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Recursively transform nested properties
|
|
83
|
+
if (schema['properties'] && typeof schema['properties'] === 'object') {
|
|
84
|
+
const props = { ...schema['properties'] };
|
|
85
|
+
for (const [key, value] of Object.entries(props)) {
|
|
86
|
+
if (value && typeof value === 'object') {
|
|
87
|
+
props[key] = transformForFjs(value);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
schema['properties'] = props;
|
|
91
|
+
}
|
|
92
|
+
// Transform array items
|
|
93
|
+
if (schema['items'] && typeof schema['items'] === 'object') {
|
|
94
|
+
schema['items'] = transformForFjs(schema['items']);
|
|
95
|
+
}
|
|
96
|
+
// Handle anyOf / oneOf for nullable unions
|
|
97
|
+
for (const combiner of ['anyOf', 'oneOf', 'allOf']) {
|
|
98
|
+
if (Array.isArray(schema[combiner])) {
|
|
99
|
+
schema[combiner] = schema[combiner]
|
|
100
|
+
.map(s => (s && typeof s === 'object' ? transformForFjs(s) : s));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return schema;
|
|
104
|
+
}
|
|
105
|
+
// ── Compile Logic ────────────────────────────────────────
|
|
106
|
+
/**
|
|
107
|
+
* Core compilation: Zod schema → JSON Schema → fast-json-stringify function.
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
function compileSchema(schema) {
|
|
112
|
+
const build = getFjsBuild();
|
|
113
|
+
if (!build)
|
|
114
|
+
return undefined;
|
|
115
|
+
// Check cache first (schema as WeakMap key)
|
|
116
|
+
if (typeof schema === 'object' && schema !== null && _cache.has(schema)) {
|
|
117
|
+
return _cache.get(schema);
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
// Step 1: Zod → JSON Schema
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
122
|
+
const rawJsonSchema = zodToJsonSchema(schema, {
|
|
123
|
+
target: 'jsonSchema7',
|
|
124
|
+
$refStrategy: 'none',
|
|
125
|
+
});
|
|
126
|
+
// Step 2: Transform for fjs compatibility
|
|
127
|
+
const fjsSchema = transformForFjs(rawJsonSchema);
|
|
128
|
+
// Step 3: Compile the stringify function
|
|
129
|
+
const stringify = build(fjsSchema, {
|
|
130
|
+
largeArrayMechanism: 'json-stringify',
|
|
131
|
+
});
|
|
132
|
+
// Cache the compiled function
|
|
133
|
+
if (typeof schema === 'object' && schema !== null) {
|
|
134
|
+
_cache.set(schema, stringify);
|
|
135
|
+
}
|
|
136
|
+
return stringify;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// Compilation failed — fall back to native JSON.stringify
|
|
140
|
+
// This is expected for very complex schemas that fjs can't handle
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// ── Public Factory ───────────────────────────────────────
|
|
145
|
+
/**
|
|
146
|
+
* Create an AOT JSON serializer.
|
|
147
|
+
*
|
|
148
|
+
* The serializer lazy-loads `fast-json-stringify` and provides
|
|
149
|
+
* compile/stringify methods with automatic fallback.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const serializer = createSerializer();
|
|
154
|
+
* await serializer.init(); // optional: pre-load the fjs module
|
|
155
|
+
*
|
|
156
|
+
* const stringify = serializer.compile(myZodSchema);
|
|
157
|
+
* if (stringify) {
|
|
158
|
+
* const json = stringify(data); // 2-5x faster
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export function createSerializer() {
|
|
163
|
+
return {
|
|
164
|
+
async init() {
|
|
165
|
+
await loadFastJsonStringify();
|
|
166
|
+
},
|
|
167
|
+
compile(schema) {
|
|
168
|
+
return compileSchema(schema);
|
|
169
|
+
},
|
|
170
|
+
stringify(data, compiled) {
|
|
171
|
+
if (compiled) {
|
|
172
|
+
try {
|
|
173
|
+
return compiled(data);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
// Defensive: if compiled function fails at runtime
|
|
177
|
+
// (e.g., data shape mismatch), fall back to native
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return JSON.stringify(data);
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
// ── Singleton ────────────────────────────────────────────
|
|
185
|
+
/**
|
|
186
|
+
* Global singleton serializer.
|
|
187
|
+
*
|
|
188
|
+
* Shared across the engine so all Presenters and response helpers
|
|
189
|
+
* use the same cache and fjs module reference.
|
|
190
|
+
*/
|
|
191
|
+
export const defaultSerializer = createSerializer();
|
|
192
|
+
//# sourceMappingURL=JsonSerializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonSerializer.js","sourceRoot":"","sources":["../../../src/core/serialization/JsonSerializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAyDrD,IAAI,SAAS,GAA8B,IAAI,CAAC;AAEhD,KAAK,UAAU,qBAAqB;IAChC,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC,CAAC,+BAA+B;IACrE,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAEzC,IAAI,CAAC;QACD,8DAA8D;QAC9D,MAAM,GAAG,GAAQ,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;QACrD,SAAS,GAAG,CAAC,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAe,CAAC;QAC1E,OAAO,SAAS,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACL,SAAS,GAAG,KAAK,CAAC,CAAC,sBAAsB;QACzC,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED,oEAAo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AE;YAC/B,mBAAmB,EAAE,gBAAgB;SACxC,CAAgB,CAAC;QAElB,8BAA8B;QAC9B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAChD,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACL,0DAA0D;QAC1D,kEAAkE;QAClE,OAAO,SAAS,CAAC;IACrB,CAAC;AACL,CAAC;AAED,4DAA4D;AAE5D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB;IAC5B,OAAO;QACH,KAAK,CAAC,IAAI;YACN,MAAM,qBAAqB,EAAE,CAAC;QAClC,CAAC;QAED,OAAO,CAAC,MAAe;YACnB,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QAED,SAAS,CAAC,IAAa,EAAE,QAAsB;YAC3C,IAAI,QAAQ,EAAE,CAAC;gBACX,IAAI,CAAC;oBACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAC1B,CAAC;gBAAC,MAAM,CAAC;oBACL,mDAAmD;oBACnD,mDAAmD;gBACvD,CAAC;YACL,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KACJ,CAAC;AACN,CAAC;AAED,4DAA4D;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/serialization/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/serialization/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAGH,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Contracts & Shared Types
|
|
3
|
+
*
|
|
4
|
+
* Single-file type definitions following the consolidated contracts pattern.
|
|
5
|
+
* All interfaces, type aliases, and shared contracts live here.
|
|
6
|
+
*
|
|
7
|
+
* This module has ZERO runtime code — only type declarations.
|
|
8
|
+
* It may be imported by any module without circular dependency risk.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { type Tool as McpTool } from '@modelcontextprotocol/sdk/types.js';
|
|
13
|
+
import { type ZodObject, type ZodRawShape } from 'zod';
|
|
14
|
+
import { type Presenter } from '../presenter/Presenter.js';
|
|
15
|
+
import { type ProgressSink } from './execution/ProgressHelper.js';
|
|
16
|
+
export type { ToolResponse } from './response.js';
|
|
17
|
+
import { type ToolResponse } from './response.js';
|
|
18
|
+
/**
|
|
19
|
+
* Interface that all tool builders must implement.
|
|
20
|
+
*
|
|
21
|
+
* This is the abstraction that {@link ToolRegistry} depends on,
|
|
22
|
+
* following the Dependency Inversion Principle. You can create
|
|
23
|
+
* custom builders by implementing this interface.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam TContext - Application context passed to every handler
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // The built-in GroupedToolBuilder implements this interface:
|
|
30
|
+
* const builder: ToolBuilder<AppContext> = new GroupedToolBuilder<AppContext>('projects');
|
|
31
|
+
*
|
|
32
|
+
* // Register with the registry:
|
|
33
|
+
* const registry = new ToolRegistry<AppContext>();
|
|
34
|
+
* registry.register(builder);
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @see {@link GroupedToolBuilder} for the default implementation
|
|
38
|
+
* @see {@link ToolRegistry} for registration and routing
|
|
39
|
+
*/
|
|
40
|
+
export interface ToolBuilder<TContext = void> {
|
|
41
|
+
/** Get the tool name (used as the registration key) */
|
|
42
|
+
getName(): string;
|
|
43
|
+
/** Get the capability tags for selective exposure */
|
|
44
|
+
getTags(): string[];
|
|
45
|
+
/** Get all registered action keys */
|
|
46
|
+
getActionNames(): string[];
|
|
47
|
+
/** Get metadata for all registered actions */
|
|
48
|
+
getActionMetadata(): ActionMetadata[];
|
|
49
|
+
/** Build and return the MCP Tool definition. May cache internally. */
|
|
50
|
+
buildToolDefinition(): McpTool;
|
|
51
|
+
/** Execute a tool call with the given context and arguments */
|
|
52
|
+
execute(ctx: TContext, args: Record<string, unknown>, progressSink?: ProgressSink, signal?: AbortSignal): Promise<ToolResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Preview the exact MCP prompt payload that the LLM will receive.
|
|
55
|
+
*
|
|
56
|
+
* Returns a formatted string showing the compiled tool definition
|
|
57
|
+
* (name, description, input schema, annotations) with approximate
|
|
58
|
+
* token count. Auto-calls buildToolDefinition() if needed.
|
|
59
|
+
*
|
|
60
|
+
* Use this to optimize token usage and verify LLM-facing grammar
|
|
61
|
+
* without starting an MCP server.
|
|
62
|
+
*/
|
|
63
|
+
previewPrompt(): string;
|
|
64
|
+
/** Get all registered internal actions. Used by Exposition Compiler for atomic tool expansion. */
|
|
65
|
+
getActions?(): readonly InternalAction<TContext>[];
|
|
66
|
+
/** Get the discriminator field name (e.g. `"action"`). */
|
|
67
|
+
getDiscriminator?(): string;
|
|
68
|
+
/** Get the common schema shared across all actions. */
|
|
69
|
+
getCommonSchema?(): ZodObject<ZodRawShape> | undefined;
|
|
70
|
+
/** Check if `_select` reflection is enabled for context window optimization. */
|
|
71
|
+
getSelectEnabled?(): boolean;
|
|
72
|
+
/** Get per-action state sync hints declared via fluent `.invalidates()` / `.cached()`. */
|
|
73
|
+
getStateSyncHints?(): ReadonlyMap<string, StateSyncHint>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Per-action hint for automatic State Sync policy generation.
|
|
77
|
+
*
|
|
78
|
+
* Declared via fluent API (`.invalidates()`, `.cached()`) and
|
|
79
|
+
* collected by {@link ServerAttachment} to auto-generate
|
|
80
|
+
* `SyncPolicy[]` without manual configuration.
|
|
81
|
+
*
|
|
82
|
+
* @see {@link StateSyncConfig} for centralized configuration
|
|
83
|
+
*/
|
|
84
|
+
export interface StateSyncHint {
|
|
85
|
+
/** Cache directive for this action's description. */
|
|
86
|
+
readonly cacheControl?: 'no-store' | 'immutable';
|
|
87
|
+
/** Glob patterns of tools invalidated on successful execution. */
|
|
88
|
+
readonly invalidates?: readonly string[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Metadata for a single action within a grouped tool.
|
|
92
|
+
*
|
|
93
|
+
* Returned by {@link ToolBuilder.getActionMetadata} for
|
|
94
|
+
* introspection, compliance audits, or dashboard generation.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const meta = builder.getActionMetadata();
|
|
99
|
+
* for (const action of meta) {
|
|
100
|
+
* console.log(`${action.key}: destructive=${action.destructive}`);
|
|
101
|
+
* }
|
|
102
|
+
* // Output: "users.create: destructive=false"
|
|
103
|
+
* // "users.delete: destructive=true"
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @see {@link GroupedToolBuilder.getActionMetadata}
|
|
107
|
+
*/
|
|
108
|
+
export interface ActionMetadata {
|
|
109
|
+
/** Full action key (e.g. `"admin.create"` for grouped, `"list"` for flat) */
|
|
110
|
+
readonly key: string;
|
|
111
|
+
/** Action name within its group */
|
|
112
|
+
readonly actionName: string;
|
|
113
|
+
/** Group name (`undefined` for flat actions) */
|
|
114
|
+
readonly groupName: string | undefined;
|
|
115
|
+
/** Human-readable description */
|
|
116
|
+
readonly description: string | undefined;
|
|
117
|
+
/** Whether this action is destructive */
|
|
118
|
+
readonly destructive: boolean;
|
|
119
|
+
/** Whether this action is idempotent */
|
|
120
|
+
readonly idempotent: boolean;
|
|
121
|
+
/** Whether this action is read-only */
|
|
122
|
+
readonly readOnly: boolean;
|
|
123
|
+
/** Required field names from the Zod schema */
|
|
124
|
+
readonly requiredFields: readonly string[];
|
|
125
|
+
/** Whether this action has group/action-level middleware */
|
|
126
|
+
readonly hasMiddleware: boolean;
|
|
127
|
+
/** Presenter name (if MVA pattern is used via `returns: Presenter`) */
|
|
128
|
+
readonly presenterName: string | undefined;
|
|
129
|
+
/** Schema keys exposed by the Presenter (Zod shape keys) */
|
|
130
|
+
readonly presenterSchemaKeys: readonly string[] | undefined;
|
|
131
|
+
/** UI block types supported by the Presenter (e.g. 'echarts', 'mermaid') */
|
|
132
|
+
readonly presenterUiBlockTypes: readonly string[] | undefined;
|
|
133
|
+
/** Whether the Presenter has dynamic (context-aware) system rules */
|
|
134
|
+
readonly presenterHasContextualRules: boolean | undefined;
|
|
135
|
+
/** Static rule strings for fingerprinting (empty if rules are contextual) */
|
|
136
|
+
readonly presenterStaticRules: readonly string[] | undefined;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Internal representation of a registered action.
|
|
140
|
+
*
|
|
141
|
+
* This is the internal data structure used by the build-time
|
|
142
|
+
* strategies. You typically don't interact with this directly.
|
|
143
|
+
*
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
export interface InternalAction<TContext> {
|
|
147
|
+
/** Full key: `"name"` (flat) or `"group.name"` (grouped) */
|
|
148
|
+
readonly key: string;
|
|
149
|
+
/** Group name (`undefined` for flat actions) */
|
|
150
|
+
readonly groupName: string | undefined;
|
|
151
|
+
/** Group description */
|
|
152
|
+
readonly groupDescription: string | undefined;
|
|
153
|
+
/** Action name within the group */
|
|
154
|
+
readonly actionName: string;
|
|
155
|
+
/** Description */
|
|
156
|
+
readonly description: string | undefined;
|
|
157
|
+
/** Zod schema */
|
|
158
|
+
readonly schema: ZodObject<ZodRawShape> | undefined;
|
|
159
|
+
/** Whether this action is destructive */
|
|
160
|
+
readonly destructive: boolean | undefined;
|
|
161
|
+
/** Whether this action is idempotent */
|
|
162
|
+
readonly idempotent: boolean | undefined;
|
|
163
|
+
/** Whether this action is read-only */
|
|
164
|
+
readonly readOnly: boolean | undefined;
|
|
165
|
+
/** Per-action/group middleware (applied after global middleware) */
|
|
166
|
+
readonly middlewares: readonly MiddlewareFn<TContext>[] | undefined;
|
|
167
|
+
/** Common schema fields to omit for this action (LLM won't see them, validation skips them) */
|
|
168
|
+
readonly omitCommonFields: readonly string[] | undefined;
|
|
169
|
+
/** Presenter for MVA pattern — transforms raw handler output into rich multi-block responses */
|
|
170
|
+
readonly returns: Presenter<unknown> | undefined;
|
|
171
|
+
/** Handler — returns ToolResponse (classic) or raw data (MVA with `returns: Presenter`) */
|
|
172
|
+
readonly handler: (ctx: TContext, args: Record<string, unknown>) => Promise<unknown>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Middleware function signature.
|
|
176
|
+
*
|
|
177
|
+
* Follows the `next()` pattern (similar to Express/Koa). Middleware
|
|
178
|
+
* can inspect/modify args, short-circuit with an error, or wrap
|
|
179
|
+
* the handler with cross-cutting concerns.
|
|
180
|
+
*
|
|
181
|
+
* Middleware chains are **pre-compiled at build time** — there is
|
|
182
|
+
* zero chain assembly or closure allocation per request.
|
|
183
|
+
*
|
|
184
|
+
* @typeParam TContext - Application context
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* // Authentication middleware
|
|
189
|
+
* const requireAuth: MiddlewareFn<AppContext> = async (ctx, args, next) => {
|
|
190
|
+
* if (!ctx.user) return error('Unauthorized');
|
|
191
|
+
* return next();
|
|
192
|
+
* };
|
|
193
|
+
*
|
|
194
|
+
* // Logging middleware
|
|
195
|
+
* const logger: MiddlewareFn<AppContext> = async (ctx, args, next) => {
|
|
196
|
+
* const start = Date.now();
|
|
197
|
+
* const result = await next();
|
|
198
|
+
* console.log(`${args.action} took ${Date.now() - start}ms`);
|
|
199
|
+
* return result;
|
|
200
|
+
* };
|
|
201
|
+
*
|
|
202
|
+
* // Apply to a builder
|
|
203
|
+
* const builder = new GroupedToolBuilder<AppContext>('projects')
|
|
204
|
+
* .use(logger) // Global: runs on every action
|
|
205
|
+
* .use(requireAuth); // Global: runs after logger
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* @see {@link GroupedToolBuilder.use} for global middleware
|
|
209
|
+
* @see {@link ActionGroupBuilder.use} for group-scoped middleware
|
|
210
|
+
*/
|
|
211
|
+
export type MiddlewareFn<TContext> = (ctx: TContext, args: Record<string, unknown>, next: () => Promise<unknown>) => Promise<unknown>;
|
|
212
|
+
/**
|
|
213
|
+
* Configuration for a single action within a grouped tool.
|
|
214
|
+
*
|
|
215
|
+
* Pass this to {@link GroupedToolBuilder.action} or
|
|
216
|
+
* {@link ActionGroupBuilder.action} to register an action.
|
|
217
|
+
*
|
|
218
|
+
* @typeParam TContext - Application context
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* builder.action({
|
|
223
|
+
* name: 'create',
|
|
224
|
+
* description: 'Create a new project',
|
|
225
|
+
* schema: z.object({
|
|
226
|
+
* name: z.string().describe('Project name'),
|
|
227
|
+
* description: z.string().optional(),
|
|
228
|
+
* }),
|
|
229
|
+
* destructive: false,
|
|
230
|
+
* handler: async (ctx, args) => {
|
|
231
|
+
* const project = await ctx.db.projects.create(args);
|
|
232
|
+
* return success(project);
|
|
233
|
+
* },
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* @see {@link GroupedToolBuilder.action}
|
|
238
|
+
*/
|
|
239
|
+
export interface ActionConfig<TContext> {
|
|
240
|
+
/** Action name (must not contain dots in flat mode) */
|
|
241
|
+
name: string;
|
|
242
|
+
/** Human-readable description of what this action does */
|
|
243
|
+
description?: string;
|
|
244
|
+
/** Zod schema for this action's specific parameters */
|
|
245
|
+
schema?: ZodObject<ZodRawShape>;
|
|
246
|
+
/**
|
|
247
|
+
* Whether this action is destructive.
|
|
248
|
+
* When `true`, appends `[DESTRUCTIVE]` to the LLM description.
|
|
249
|
+
*/
|
|
250
|
+
destructive?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether this action is idempotent.
|
|
253
|
+
* Affects the aggregated `idempotentHint` annotation.
|
|
254
|
+
*/
|
|
255
|
+
idempotent?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Whether this action is read-only.
|
|
258
|
+
* Affects the aggregated `readOnlyHint` annotation.
|
|
259
|
+
*/
|
|
260
|
+
readOnly?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Common schema fields to omit for this specific action.
|
|
263
|
+
*
|
|
264
|
+
* Use when an action derives a common field from context (e.g. middleware)
|
|
265
|
+
* instead of requiring the LLM to provide it.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```typescript
|
|
269
|
+
* // workspace_id is derived from the JWT token for profile.me
|
|
270
|
+
* .action({
|
|
271
|
+
* name: 'me',
|
|
272
|
+
* omitCommon: ['workspace_id'],
|
|
273
|
+
* handler: async (ctx, args) => success(ctx.user),
|
|
274
|
+
* })
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
omitCommon?: string[];
|
|
278
|
+
/**
|
|
279
|
+
* Presenter for the MVA (Model-View-Agent) pattern.
|
|
280
|
+
*
|
|
281
|
+
* When set, the handler's return type changes from `Promise<ToolResponse>`
|
|
282
|
+
* to `Promise<TPresenterOutput>` (raw data). The framework intercepts the
|
|
283
|
+
* raw return value, pipes it through the Presenter (schema validation,
|
|
284
|
+
* system rules, UI blocks), and compiles the final multi-block response.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* .action({
|
|
289
|
+
* name: 'get_invoice',
|
|
290
|
+
* returns: InvoicePresenter,
|
|
291
|
+
* handler: async (ctx, args) => {
|
|
292
|
+
* return await db.invoices.find(args.id); // Raw data
|
|
293
|
+
* },
|
|
294
|
+
* })
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* @see {@link Presenter} for creating domain-level presenters
|
|
298
|
+
*/
|
|
299
|
+
returns?: Presenter<unknown>;
|
|
300
|
+
/** Handler function — return ToolResponse (classic) or raw data when using `returns: Presenter` */
|
|
301
|
+
handler: (ctx: TContext, args: Record<string, unknown>) => Promise<unknown>;
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,IAAI,IAAI,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAIlE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAIlD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,WAAW,CAAC,QAAQ,GAAG,IAAI;IACxC,uDAAuD;IACvD,OAAO,IAAI,MAAM,CAAC;IAElB,qDAAqD;IACrD,OAAO,IAAI,MAAM,EAAE,CAAC;IAEpB,qCAAqC;IACrC,cAAc,IAAI,MAAM,EAAE,CAAC;IAE3B,8CAA8C;IAC9C,iBAAiB,IAAI,cAAc,EAAE,CAAC;IAEtC,sEAAsE;IACtE,mBAAmB,IAAI,OAAO,CAAC;IAE/B,+DAA+D;IAC/D,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM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C,OAAO,CAAC,CAAC;IAC7B,mGAAmG;IACnG,OAAO,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework Contracts & Shared Types
|
|
3
|
+
*
|
|
4
|
+
* Single-file type definitions following the consolidated contracts pattern.
|
|
5
|
+
* All interfaces, type aliases, and shared contracts live here.
|
|
6
|
+
*
|
|
7
|
+
* This module has ZERO runtime code — only type declarations.
|
|
8
|
+
* It may be imported by any module without circular dependency risk.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import {} from '@modelcontextprotocol/sdk/types.js';
|
|
13
|
+
import {} from 'zod';
|
|
14
|
+
import {} from '../presenter/Presenter.js';
|
|
15
|
+
import {} from './execution/ProgressHelper.js';
|
|
16
|
+
import {} from './response.js';
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAwB,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAoC,MAAM,KAAK,CAAC;AACvD,OAAO,EAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAqB,MAAM,+BAA+B,CAAC;AAKlE,OAAO,EAAqB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Role } from './Role.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resource Annotations — audience, priority, and freshness metadata.
|
|
4
|
+
*
|
|
5
|
+
* Used on {@link Resource} instances to provide hints about who
|
|
6
|
+
* should see the resource and how important it is.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createAnnotations, Role } from 'vurb';
|
|
11
|
+
*
|
|
12
|
+
* const annotations = createAnnotations({
|
|
13
|
+
* audience: [Role.ASSISTANT],
|
|
14
|
+
* priority: 0.8,
|
|
15
|
+
* lastModified: '2025-01-15T10:30:00Z',
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @see {@link Resource} for usage on resources
|
|
20
|
+
* @see {@link createAnnotations} for the factory function
|
|
21
|
+
*/
|
|
22
|
+
export interface Annotations {
|
|
23
|
+
/** Target audience roles for this resource */
|
|
24
|
+
readonly audience?: readonly Role[];
|
|
25
|
+
/** Priority weight (0.0 = lowest, 1.0 = highest) */
|
|
26
|
+
readonly priority?: number;
|
|
27
|
+
/** ISO 8601 timestamp of last modification */
|
|
28
|
+
readonly lastModified?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create Annotations from partial properties.
|
|
32
|
+
*
|
|
33
|
+
* @param props - Annotation properties (all optional)
|
|
34
|
+
* @returns An Annotations instance
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const ann = createAnnotations({ priority: 0.5 });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function createAnnotations(props?: Annotations): Annotations;
|
|
42
|
+
//# sourceMappingURL=Annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Annotations.d.ts","sourceRoot":"","sources":["../../src/domain/Annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,WAAW;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IACpC,oDAAoD;IACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,WAAgB,GAAG,WAAW,CAEtE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {} from './Role.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create Annotations from partial properties.
|
|
4
|
+
*
|
|
5
|
+
* @param props - Annotation properties (all optional)
|
|
6
|
+
* @returns An Annotations instance
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const ann = createAnnotations({ priority: 0.5 });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export function createAnnotations(props = {}) {
|
|
14
|
+
return { ...props };
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Annotations.js","sourceRoot":"","sources":["../../src/domain/Annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,WAAW,CAAC;AA+BtC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAqB,EAAE;IACrD,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;AACxB,CAAC"}
|