@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,832 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GroupedToolBuilder — Fluent API for MCP Tool Construction
|
|
3
|
+
*
|
|
4
|
+
* The primary entry point for building grouped MCP tools. Consolidates
|
|
5
|
+
* multiple related actions behind a single discriminator field, reducing
|
|
6
|
+
* tool count and improving LLM routing accuracy.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createTool, success, error } from 'vurb';
|
|
11
|
+
* import { z } from 'zod';
|
|
12
|
+
*
|
|
13
|
+
* const projects = createTool<AppContext>('projects')
|
|
14
|
+
* .description('Manage workspace projects')
|
|
15
|
+
* .commonSchema(z.object({
|
|
16
|
+
* workspace_id: z.string().describe('Workspace identifier'),
|
|
17
|
+
* }))
|
|
18
|
+
* .action({
|
|
19
|
+
* name: 'list',
|
|
20
|
+
* readOnly: true,
|
|
21
|
+
* schema: z.object({ status: z.enum(['active', 'archived']).optional() }),
|
|
22
|
+
* handler: async (ctx, args) => {
|
|
23
|
+
* const projects = await ctx.db.projects.findMany({
|
|
24
|
+
* where: { workspaceId: args.workspace_id, status: args.status },
|
|
25
|
+
* });
|
|
26
|
+
* return success(projects);
|
|
27
|
+
* },
|
|
28
|
+
* })
|
|
29
|
+
* .action({
|
|
30
|
+
* name: 'delete',
|
|
31
|
+
* destructive: true,
|
|
32
|
+
* schema: z.object({ project_id: z.string() }),
|
|
33
|
+
* handler: async (ctx, args) => {
|
|
34
|
+
* await ctx.db.projects.delete({ where: { id: args.project_id } });
|
|
35
|
+
* return success('Deleted');
|
|
36
|
+
* },
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @see {@link createTool} for the recommended factory function
|
|
41
|
+
* @see {@link ToolRegistry} for registration and server attachment
|
|
42
|
+
* @see {@link ActionGroupBuilder} for hierarchical group configuration
|
|
43
|
+
*
|
|
44
|
+
* @module
|
|
45
|
+
*/
|
|
46
|
+
import { type ZodObject, type ZodRawShape } from 'zod';
|
|
47
|
+
import { type Tool as McpTool } from '@modelcontextprotocol/sdk/types.js';
|
|
48
|
+
import { type ToolResponse, type ToolBuilder, type ActionMetadata, type InternalAction, type MiddlewareFn, type ActionConfig, type StateSyncHint } from '../types.js';
|
|
49
|
+
import { type DebugObserverFn } from '../../observability/DebugObserver.js';
|
|
50
|
+
import { type TelemetrySink } from '../../observability/TelemetryEvent.js';
|
|
51
|
+
import { type MiddlewareDefinition } from '../middleware/ContextDerivation.js';
|
|
52
|
+
import { type VurbTracer } from '../../observability/Tracing.js';
|
|
53
|
+
import { type ProgressSink } from '../execution/ProgressHelper.js';
|
|
54
|
+
import { type ConcurrencyConfig } from '../execution/ConcurrencyGuard.js';
|
|
55
|
+
import { type SandboxConfig } from '../../sandbox/SandboxEngine.js';
|
|
56
|
+
import { type GroupConfigurator } from './ActionGroupBuilder.js';
|
|
57
|
+
export { ActionGroupBuilder } from './ActionGroupBuilder.js';
|
|
58
|
+
export type { GroupConfigurator } from './ActionGroupBuilder.js';
|
|
59
|
+
/**
|
|
60
|
+
* Create a new grouped tool builder.
|
|
61
|
+
*
|
|
62
|
+
* This is the **recommended entry point** for building MCP tools.
|
|
63
|
+
* Equivalent to `new GroupedToolBuilder<TContext>(name)` but more
|
|
64
|
+
* concise and idiomatic.
|
|
65
|
+
*
|
|
66
|
+
* @typeParam TContext - Application context type passed to every handler.
|
|
67
|
+
* Use `void` (default) if your handlers don't need context.
|
|
68
|
+
*
|
|
69
|
+
* @param name - Tool name as it appears in the MCP `tools/list` response.
|
|
70
|
+
* Must be unique across all registered tools.
|
|
71
|
+
*
|
|
72
|
+
* @returns A new {@link GroupedToolBuilder} configured with the given name.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* // Simple tool (no context)
|
|
77
|
+
* const echo = createTool('echo')
|
|
78
|
+
* .action({
|
|
79
|
+
* name: 'say',
|
|
80
|
+
* schema: z.object({ message: z.string() }),
|
|
81
|
+
* handler: async (_ctx, args) => success(args.message),
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* // With application context
|
|
85
|
+
* const users = createTool<AppContext>('users')
|
|
86
|
+
* .description('User management')
|
|
87
|
+
* .use(requireAuth)
|
|
88
|
+
* .action({
|
|
89
|
+
* name: 'list',
|
|
90
|
+
* readOnly: true,
|
|
91
|
+
* handler: async (ctx, _args) => success(await ctx.db.users.findMany()),
|
|
92
|
+
* });
|
|
93
|
+
*
|
|
94
|
+
* // With hierarchical groups
|
|
95
|
+
* const platform = createTool<AppContext>('platform')
|
|
96
|
+
* .tags('core')
|
|
97
|
+
* .group('users', 'User management', g => {
|
|
98
|
+
* g.action({ name: 'list', readOnly: true, handler: listUsers });
|
|
99
|
+
* })
|
|
100
|
+
* .group('billing', 'Billing operations', g => {
|
|
101
|
+
* g.action({ name: 'refund', destructive: true, schema: refundSchema, handler: issueRefund });
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @see {@link GroupedToolBuilder} for the full builder API
|
|
106
|
+
* @see {@link ToolRegistry.register} for tool registration
|
|
107
|
+
*/
|
|
108
|
+
export declare function createTool<TContext = void, TName extends string = string>(name: TName): GroupedToolBuilder<TContext, Record<string, never>, TName>;
|
|
109
|
+
/**
|
|
110
|
+
* Fluent builder for creating consolidated MCP tools.
|
|
111
|
+
*
|
|
112
|
+
* Groups multiple related operations behind a single discriminator field
|
|
113
|
+
* (default: `"action"`), producing one MCP tool definition with a
|
|
114
|
+
* union schema and auto-generated descriptions.
|
|
115
|
+
*
|
|
116
|
+
* @typeParam TContext - Application context passed to every handler
|
|
117
|
+
* @typeParam TCommon - Shape of the common schema (inferred automatically)
|
|
118
|
+
* @typeParam TName - Tool name literal (inferred by createTool)
|
|
119
|
+
* @typeParam TRouterMap - Accumulated action entries for InferRouter (phantom type)
|
|
120
|
+
*
|
|
121
|
+
* @see {@link createTool} for the recommended factory function
|
|
122
|
+
*/
|
|
123
|
+
export declare class GroupedToolBuilder<TContext = void, TCommon extends Record<string, unknown> = Record<string, never>, TName extends string = string, TRouterMap extends Record<string, unknown> = Record<string, never>> implements ToolBuilder<TContext> {
|
|
124
|
+
private readonly _name;
|
|
125
|
+
private _description?;
|
|
126
|
+
private _discriminator;
|
|
127
|
+
private _annotations?;
|
|
128
|
+
private _tags;
|
|
129
|
+
private _commonSchema?;
|
|
130
|
+
private _middlewares;
|
|
131
|
+
private _actions;
|
|
132
|
+
private _hasFlat;
|
|
133
|
+
private _hasGroup;
|
|
134
|
+
private _toonMode;
|
|
135
|
+
private _selectEnabled;
|
|
136
|
+
private _frozen;
|
|
137
|
+
private _debug?;
|
|
138
|
+
private _tracer?;
|
|
139
|
+
private _telemetry?;
|
|
140
|
+
private _concurrencyGuard?;
|
|
141
|
+
private _egressMaxBytes?;
|
|
142
|
+
private _sandboxConfig?;
|
|
143
|
+
private _mutationSerializer?;
|
|
144
|
+
private readonly _stateSyncHints;
|
|
145
|
+
private _fsmStates?;
|
|
146
|
+
private _fsmTransition?;
|
|
147
|
+
private _cachedTool?;
|
|
148
|
+
private _executionContext?;
|
|
149
|
+
constructor(name: string);
|
|
150
|
+
/**
|
|
151
|
+
* Set the discriminator field name.
|
|
152
|
+
*
|
|
153
|
+
* The discriminator is the field the LLM uses to select which action
|
|
154
|
+
* to execute. Defaults to `"action"`.
|
|
155
|
+
*
|
|
156
|
+
* @param field - Field name for the discriminator enum
|
|
157
|
+
* @returns `this` for chaining
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* // Custom discriminator
|
|
162
|
+
* const builder = createTool('projects')
|
|
163
|
+
* .discriminator('operation')
|
|
164
|
+
* .action({ name: 'list', handler: listProjects });
|
|
165
|
+
* // LLM sends: { operation: 'list' }
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @defaultValue `"action"`
|
|
169
|
+
*/
|
|
170
|
+
discriminator(field: string): this;
|
|
171
|
+
/**
|
|
172
|
+
* Set the tool description.
|
|
173
|
+
*
|
|
174
|
+
* Appears as the first line in the auto-generated tool description
|
|
175
|
+
* that the LLM sees.
|
|
176
|
+
*
|
|
177
|
+
* @param desc - Human-readable description of what this tool does
|
|
178
|
+
* @returns `this` for chaining
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```typescript
|
|
182
|
+
* createTool('projects')
|
|
183
|
+
* .description('Manage workspace projects')
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
description(desc: string): this;
|
|
187
|
+
/**
|
|
188
|
+
* Set MCP tool annotations.
|
|
189
|
+
*
|
|
190
|
+
* Manual override for tool-level annotations. If not set,
|
|
191
|
+
* annotations are automatically aggregated from per-action properties.
|
|
192
|
+
*
|
|
193
|
+
* @param a - Annotation key-value pairs
|
|
194
|
+
* @returns `this` for chaining
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* createTool('admin')
|
|
199
|
+
* .annotations({ openWorldHint: true, returnDirect: false })
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @see {@link https://modelcontextprotocol.io/specification/2025-03-26/server/tools#annotations | MCP Tool Annotations}
|
|
203
|
+
*/
|
|
204
|
+
annotations(a: Record<string, unknown>): this;
|
|
205
|
+
/**
|
|
206
|
+
* Set capability tags for selective tool exposure.
|
|
207
|
+
*
|
|
208
|
+
* Tags control which tools the LLM sees via
|
|
209
|
+
* {@link ToolRegistry.attachToServer}'s `filter` option.
|
|
210
|
+
* Use tags to implement per-session context gating.
|
|
211
|
+
*
|
|
212
|
+
* @param tags - One or more string tags
|
|
213
|
+
* @returns `this` for chaining
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const users = createTool<AppContext>('users').tags('core');
|
|
218
|
+
* const admin = createTool<AppContext>('admin').tags('admin', 'internal');
|
|
219
|
+
*
|
|
220
|
+
* // Expose only 'core' tools to the LLM:
|
|
221
|
+
* registry.attachToServer(server, { filter: { tags: ['core'] } });
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* @see {@link ToolRegistry.getTools} for filtered tool retrieval
|
|
225
|
+
*/
|
|
226
|
+
tags(...tags: string[]): this;
|
|
227
|
+
/**
|
|
228
|
+
* Set a common schema shared by all actions.
|
|
229
|
+
*
|
|
230
|
+
* Fields from this schema are injected into every action's input
|
|
231
|
+
* and marked as `(always required)` in the auto-generated description.
|
|
232
|
+
* The return type narrows to propagate types to all handlers.
|
|
233
|
+
*
|
|
234
|
+
* @typeParam TSchema - Zod object schema type (inferred)
|
|
235
|
+
* @param schema - A `z.object()` defining shared fields
|
|
236
|
+
* @returns A narrowed builder with `TCommon` set to `TSchema["_output"]`
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```typescript
|
|
240
|
+
* createTool<AppContext>('projects')
|
|
241
|
+
* .commonSchema(z.object({
|
|
242
|
+
* workspace_id: z.string().describe('Workspace identifier'),
|
|
243
|
+
* }))
|
|
244
|
+
* .action({
|
|
245
|
+
* name: 'list',
|
|
246
|
+
* handler: async (ctx, args) => {
|
|
247
|
+
* // ✅ args.workspace_id is typed as string
|
|
248
|
+
* const projects = await ctx.db.projects.findMany({
|
|
249
|
+
* where: { workspaceId: args.workspace_id },
|
|
250
|
+
* });
|
|
251
|
+
* return success(projects);
|
|
252
|
+
* },
|
|
253
|
+
* });
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
commonSchema<TSchema extends ZodObject<ZodRawShape>>(schema: TSchema): GroupedToolBuilder<TContext, TSchema["_output"], TName, TRouterMap>;
|
|
257
|
+
/**
|
|
258
|
+
* Enable TOON-formatted descriptions for token optimization.
|
|
259
|
+
*
|
|
260
|
+
* Uses TOON (Token-Oriented Object Notation) to encode action metadata
|
|
261
|
+
* in a compact tabular format, reducing description token count by ~30-50%.
|
|
262
|
+
*
|
|
263
|
+
* @returns `this` for chaining
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* createTool('projects')
|
|
268
|
+
* .toonDescription() // Compact descriptions
|
|
269
|
+
* .action({ name: 'list', handler: listProjects })
|
|
270
|
+
* ```
|
|
271
|
+
*
|
|
272
|
+
* @see {@link toonSuccess} for TOON-encoded responses
|
|
273
|
+
*/
|
|
274
|
+
toonDescription(): this;
|
|
275
|
+
/**
|
|
276
|
+
* Declare glob patterns invalidated when this tool succeeds.
|
|
277
|
+
*
|
|
278
|
+
* Eliminates manual `stateSync.policies` configuration —
|
|
279
|
+
* the framework auto-collects hints from all builders.
|
|
280
|
+
*
|
|
281
|
+
* @param patterns - Glob patterns (e.g. `'sprints.*'`, `'tasks.*'`)
|
|
282
|
+
* @returns `this` for chaining
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```typescript
|
|
286
|
+
* createTool('tasks')
|
|
287
|
+
* .invalidates('tasks.*', 'sprints.*')
|
|
288
|
+
* .action({ name: 'update', handler: updateTask });
|
|
289
|
+
* ```
|
|
290
|
+
*
|
|
291
|
+
* @see {@link StateSyncConfig} for centralized configuration
|
|
292
|
+
*/
|
|
293
|
+
invalidates(...patterns: string[]): this;
|
|
294
|
+
/**
|
|
295
|
+
* Mark this tool's data as immutable (safe to cache forever).
|
|
296
|
+
*
|
|
297
|
+
* Use for reference data: countries, currencies, ICD-10 codes.
|
|
298
|
+
* Equivalent to `cacheControl: 'immutable'` in manual policies.
|
|
299
|
+
*
|
|
300
|
+
* @returns `this` for chaining
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```typescript
|
|
304
|
+
* createTool('countries')
|
|
305
|
+
* .cached()
|
|
306
|
+
* .action({ name: 'list', readOnly: true, handler: listCountries });
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
cached(): this;
|
|
310
|
+
/**
|
|
311
|
+
* Mark this tool's data as volatile (never cache).
|
|
312
|
+
*
|
|
313
|
+
* Equivalent to `cacheControl: 'no-store'` in manual policies.
|
|
314
|
+
* Use for dynamic data that changes frequently.
|
|
315
|
+
*
|
|
316
|
+
* @returns `this` for chaining
|
|
317
|
+
*/
|
|
318
|
+
stale(): this;
|
|
319
|
+
/** @internal */
|
|
320
|
+
private _setCacheDirective;
|
|
321
|
+
/**
|
|
322
|
+
* Enable `_select` reflection for context window optimization.
|
|
323
|
+
*
|
|
324
|
+
* When enabled, actions that use a Presenter with a Zod schema
|
|
325
|
+
* expose an optional `_select` parameter in the input schema.
|
|
326
|
+
* The AI can send `_select: ['status', 'amount']` to receive
|
|
327
|
+
* only the specified top-level fields in the data payload,
|
|
328
|
+
* reducing context window usage without developer effort.
|
|
329
|
+
*
|
|
330
|
+
* **Disabled by default** — opt-in to avoid changing existing
|
|
331
|
+
* tool schemas.
|
|
332
|
+
*
|
|
333
|
+
* **Late Guillotine**: UI blocks, system rules, and action
|
|
334
|
+
* suggestions are always computed with the **full** validated
|
|
335
|
+
* data. Only the wire-facing data block is filtered.
|
|
336
|
+
*
|
|
337
|
+
* **Shallow (top-level only)**: Nested objects are returned
|
|
338
|
+
* whole. If the AI selects `'user'`, it gets the entire `user`
|
|
339
|
+
* object. No recursive GraphQL-style traversal.
|
|
340
|
+
*
|
|
341
|
+
* @returns `this` for chaining
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* createTool<AppContext>('invoices')
|
|
346
|
+
* .enableSelect() // Expose _select in input schema
|
|
347
|
+
* .action({
|
|
348
|
+
* name: 'get',
|
|
349
|
+
* returns: InvoicePresenter,
|
|
350
|
+
* handler: async (ctx, args) => ctx.db.invoices.findUnique(args.id),
|
|
351
|
+
* });
|
|
352
|
+
* // AI sends: { action: 'get', id: '123', _select: ['status'] }
|
|
353
|
+
* // Returns: { status: 'paid' } instead of full invoice
|
|
354
|
+
* ```
|
|
355
|
+
*
|
|
356
|
+
* @see {@link Presenter.getSchemaKeys} for introspection
|
|
357
|
+
*/
|
|
358
|
+
enableSelect(): this;
|
|
359
|
+
/**
|
|
360
|
+
* Set concurrency limits for this tool (Semaphore + Queue pattern).
|
|
361
|
+
*
|
|
362
|
+
* Prevents thundering-herd scenarios where the LLM fires N
|
|
363
|
+
* concurrent calls in the same millisecond. Implements a
|
|
364
|
+
* semaphore with backpressure queue and load shedding.
|
|
365
|
+
*
|
|
366
|
+
* When all active slots are occupied, new calls enter the queue.
|
|
367
|
+
* When the queue is full, calls are immediately rejected with
|
|
368
|
+
* a self-healing `SERVER_BUSY` error.
|
|
369
|
+
*
|
|
370
|
+
* **MCP Spec Compliance**: The MCP specification requires servers
|
|
371
|
+
* to rate-limit tool invocations. This method fulfills that requirement.
|
|
372
|
+
*
|
|
373
|
+
* **Zero overhead** when not configured — no semaphore exists.
|
|
374
|
+
*
|
|
375
|
+
* @param config - Concurrency configuration
|
|
376
|
+
* @returns `this` for chaining
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```typescript
|
|
380
|
+
* createTool<AppContext>('billing')
|
|
381
|
+
* .concurrency({ maxActive: 5, maxQueue: 20 })
|
|
382
|
+
* .action({ name: 'process_invoice', handler: processInvoice });
|
|
383
|
+
* // 5 concurrent executions, 20 queued, rest rejected
|
|
384
|
+
* ```
|
|
385
|
+
*
|
|
386
|
+
* @see {@link ConcurrencyConfig} for configuration options
|
|
387
|
+
*/
|
|
388
|
+
concurrency(config: ConcurrencyConfig): this;
|
|
389
|
+
/**
|
|
390
|
+
* Set maximum payload size for tool responses (Egress Guard).
|
|
391
|
+
*
|
|
392
|
+
* Prevents oversized responses from crashing the Node process
|
|
393
|
+
* with OOM or overflowing the LLM context window.
|
|
394
|
+
*
|
|
395
|
+
* When a response exceeds the limit, the text content is truncated
|
|
396
|
+
* and a system intervention message is injected, forcing the LLM
|
|
397
|
+
* to use pagination or filters.
|
|
398
|
+
*
|
|
399
|
+
* This is a **brute-force safety net**. For domain-aware truncation
|
|
400
|
+
* with guidance, use Presenter `.agentLimit()` instead.
|
|
401
|
+
*
|
|
402
|
+
* **Zero overhead** when not configured.
|
|
403
|
+
*
|
|
404
|
+
* @param bytes - Maximum payload size in bytes
|
|
405
|
+
* @returns `this` for chaining
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```typescript
|
|
409
|
+
* createTool<AppContext>('logs')
|
|
410
|
+
* .maxPayloadBytes(2 * 1024 * 1024) // 2MB
|
|
411
|
+
* .action({ name: 'search', handler: searchLogs });
|
|
412
|
+
* ```
|
|
413
|
+
*
|
|
414
|
+
* @see {@link Presenter.agentLimit} for domain-level truncation
|
|
415
|
+
*/
|
|
416
|
+
maxPayloadBytes(bytes: number): this;
|
|
417
|
+
/**
|
|
418
|
+
* Enable zero-trust sandboxed execution for this tool.
|
|
419
|
+
*
|
|
420
|
+
* Stores the sandbox configuration so that tools built with
|
|
421
|
+
* `.sandboxed()` on the FluentToolBuilder can propagate it.
|
|
422
|
+
*
|
|
423
|
+
* @param config - Sandbox configuration (timeout, memory, output size)
|
|
424
|
+
* @returns `this` for chaining
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```typescript
|
|
428
|
+
* createTool<AppContext>('analytics')
|
|
429
|
+
* .sandbox({ timeout: 5000, memoryLimit: 128 })
|
|
430
|
+
* .action({ name: 'compute', handler: computeHandler });
|
|
431
|
+
* ```
|
|
432
|
+
*
|
|
433
|
+
* @see {@link SandboxConfig} for configuration options
|
|
434
|
+
* @see {@link SandboxEngine} for the execution engine
|
|
435
|
+
*/
|
|
436
|
+
sandbox(config: SandboxConfig): this;
|
|
437
|
+
/**
|
|
438
|
+
* Get the sandbox configuration (if any).
|
|
439
|
+
*
|
|
440
|
+
* **Important**: This is metadata only — it does NOT auto-create a
|
|
441
|
+
* `SandboxEngine` nor inject it into the execution pipeline.
|
|
442
|
+
* The developer must create the engine manually (e.g. via `f.sandbox()`).
|
|
443
|
+
* This accessor exists for introspection, testing, and contract tooling.
|
|
444
|
+
*
|
|
445
|
+
* @returns The stored `SandboxConfig`, or `undefined` if `.sandbox()` was not called
|
|
446
|
+
*/
|
|
447
|
+
getSandboxConfig(): SandboxConfig | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* Bind this tool to specific FSM states.
|
|
450
|
+
*
|
|
451
|
+
* When a `StateMachineGate` is configured, this tool is only
|
|
452
|
+
* visible in `tools/list` when the FSM is in one of the specified states.
|
|
453
|
+
*
|
|
454
|
+
* @param states - FSM state(s) where this tool is visible
|
|
455
|
+
* @param transition - Event to send on successful execution
|
|
456
|
+
* @returns `this` for chaining
|
|
457
|
+
*/
|
|
458
|
+
bindState(states: string[], transition?: string): this;
|
|
459
|
+
/**
|
|
460
|
+
* Get the FSM binding metadata (if any).
|
|
461
|
+
* Used by `ToolRegistry` and `ServerAttachment` for FSM gating.
|
|
462
|
+
*/
|
|
463
|
+
getFsmBinding(): {
|
|
464
|
+
states: string[];
|
|
465
|
+
transition?: string;
|
|
466
|
+
} | undefined;
|
|
467
|
+
/**
|
|
468
|
+
* Get the tool name.
|
|
469
|
+
* Used by framework internals for tool routing and FSM binding.
|
|
470
|
+
*/
|
|
471
|
+
getToolName(): string;
|
|
472
|
+
/**
|
|
473
|
+
* Add middleware to the execution chain.
|
|
474
|
+
*
|
|
475
|
+
* Middleware runs in **registration order** (first registered = outermost).
|
|
476
|
+
* Chains are pre-compiled at build time — zero runtime assembly cost.
|
|
477
|
+
*
|
|
478
|
+
* Accepts both `MiddlewareDefinition` from `f.middleware()` and
|
|
479
|
+
* raw `MiddlewareFn` functions.
|
|
480
|
+
*
|
|
481
|
+
* @param mw - Middleware function or MiddlewareDefinition
|
|
482
|
+
* @returns `this` for chaining
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```typescript
|
|
486
|
+
* const requireAuth: MiddlewareFn<AppContext> = async (ctx, args, next) => {
|
|
487
|
+
* if (!ctx.user) return error('Unauthorized');
|
|
488
|
+
* return next();
|
|
489
|
+
* };
|
|
490
|
+
*
|
|
491
|
+
* createTool<AppContext>('projects')
|
|
492
|
+
* .use(requireAuth) // Runs on every action
|
|
493
|
+
* .action({ name: 'list', handler: listProjects });
|
|
494
|
+
* ```
|
|
495
|
+
*
|
|
496
|
+
* @see {@link MiddlewareFn} for the middleware signature
|
|
497
|
+
* @see {@link ActionGroupBuilder.use} for group-scoped middleware
|
|
498
|
+
*/
|
|
499
|
+
use(mw: MiddlewareFn<TContext> | MiddlewareDefinition<TContext, Record<string, unknown>>): this;
|
|
500
|
+
/**
|
|
501
|
+
* Register a flat action.
|
|
502
|
+
*
|
|
503
|
+
* Flat actions use simple keys (e.g. `"list"`, `"create"`).
|
|
504
|
+
* Cannot be mixed with `.group()` on the same builder.
|
|
505
|
+
*
|
|
506
|
+
* When a `schema` is provided, the handler args are fully typed as
|
|
507
|
+
* `TSchema["_output"] & TCommon` — no type assertions needed.
|
|
508
|
+
*
|
|
509
|
+
* @param config - Action configuration
|
|
510
|
+
* @returns `this` for chaining
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* ```typescript
|
|
514
|
+
* createTool<AppContext>('projects')
|
|
515
|
+
* .action({
|
|
516
|
+
* name: 'list',
|
|
517
|
+
* description: 'List all projects',
|
|
518
|
+
* readOnly: true,
|
|
519
|
+
* schema: z.object({ status: z.enum(['active', 'archived']).optional() }),
|
|
520
|
+
* handler: async (ctx, args) => {
|
|
521
|
+
* // args: { status?: 'active' | 'archived' } — fully typed
|
|
522
|
+
* return success(await ctx.db.projects.findMany({ where: args }));
|
|
523
|
+
* },
|
|
524
|
+
* })
|
|
525
|
+
* .action({
|
|
526
|
+
* name: 'delete',
|
|
527
|
+
* destructive: true,
|
|
528
|
+
* schema: z.object({ id: z.string() }),
|
|
529
|
+
* handler: async (ctx, args) => {
|
|
530
|
+
* await ctx.db.projects.delete({ where: { id: args.id } });
|
|
531
|
+
* return success('Deleted');
|
|
532
|
+
* },
|
|
533
|
+
* });
|
|
534
|
+
* ```
|
|
535
|
+
*
|
|
536
|
+
* @see {@link ActionConfig} for all configuration options
|
|
537
|
+
* @see {@link GroupedToolBuilder.group} for hierarchical grouping
|
|
538
|
+
*/
|
|
539
|
+
action<TActionName extends string, TSchema extends ZodObject<ZodRawShape>, TOmit extends keyof TCommon = never>(config: {
|
|
540
|
+
name: TActionName;
|
|
541
|
+
description?: string;
|
|
542
|
+
schema: TSchema;
|
|
543
|
+
destructive?: boolean;
|
|
544
|
+
idempotent?: boolean;
|
|
545
|
+
readOnly?: boolean;
|
|
546
|
+
omitCommon?: TOmit[];
|
|
547
|
+
handler: (ctx: TContext, args: TSchema["_output"] & Omit<TCommon, TOmit>) => Promise<ToolResponse>;
|
|
548
|
+
}): GroupedToolBuilder<TContext, TCommon, TName, TRouterMap & {
|
|
549
|
+
[K in `${TName}.${TActionName}`]: TSchema["_output"] & Omit<TCommon, TOmit>;
|
|
550
|
+
}>;
|
|
551
|
+
/** Register a flat action (untyped: no schema, args default to Record<string, unknown>) */
|
|
552
|
+
action<TActionName extends string>(config: ActionConfig<TContext> & {
|
|
553
|
+
name: TActionName;
|
|
554
|
+
}): GroupedToolBuilder<TContext, TCommon, TName, TRouterMap & {
|
|
555
|
+
[K in `${TName}.${TActionName}`]: TCommon extends Record<string, never> ? Record<string, unknown> : TCommon;
|
|
556
|
+
}>;
|
|
557
|
+
/**
|
|
558
|
+
* Register a group of actions under a namespace.
|
|
559
|
+
*
|
|
560
|
+
* Group actions use compound keys (e.g. `"users.create"`, `"billing.refund"`).
|
|
561
|
+
* Cannot be mixed with `.action()` on the same builder.
|
|
562
|
+
*
|
|
563
|
+
* @param name - Group name (must not contain dots)
|
|
564
|
+
* @param configure - Callback that receives an {@link ActionGroupBuilder}
|
|
565
|
+
* @returns `this` for chaining
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```typescript
|
|
569
|
+
* createTool<AppContext>('platform')
|
|
570
|
+
* .group('users', 'User management', g => {
|
|
571
|
+
* g.use(requireAdmin) // Group-scoped middleware
|
|
572
|
+
* .action({ name: 'list', readOnly: true, handler: listUsers })
|
|
573
|
+
* .action({ name: 'ban', destructive: true, schema: banSchema, handler: banUser });
|
|
574
|
+
* })
|
|
575
|
+
* .group('billing', g => {
|
|
576
|
+
* g.action({ name: 'refund', destructive: true, schema: refundSchema, handler: issueRefund });
|
|
577
|
+
* });
|
|
578
|
+
* // Discriminator enum: "users.list" | "users.ban" | "billing.refund"
|
|
579
|
+
* ```
|
|
580
|
+
*
|
|
581
|
+
* @see {@link ActionGroupBuilder} for group-level configuration
|
|
582
|
+
* @see {@link GroupedToolBuilder.action} for flat actions
|
|
583
|
+
*/
|
|
584
|
+
group(name: string, configure: GroupConfigurator<TContext, TCommon>): this;
|
|
585
|
+
group(name: string, description: string, configure: GroupConfigurator<TContext, TCommon>): this;
|
|
586
|
+
/**
|
|
587
|
+
* Generate the MCP Tool definition.
|
|
588
|
+
*
|
|
589
|
+
* Compiles all actions into a single MCP tool with auto-generated
|
|
590
|
+
* description, union schema, and aggregated annotations. Caches
|
|
591
|
+
* the result and permanently freezes the builder.
|
|
592
|
+
*
|
|
593
|
+
* Called automatically by {@link execute} if not called explicitly.
|
|
594
|
+
*
|
|
595
|
+
* @returns The compiled MCP Tool object
|
|
596
|
+
* @throws If no actions are registered
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```typescript
|
|
600
|
+
* const tool = builder.buildToolDefinition();
|
|
601
|
+
* console.log(tool.name); // "projects"
|
|
602
|
+
* console.log(tool.description); // Auto-generated
|
|
603
|
+
* console.log(tool.inputSchema); // Union of all action schemas
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
buildToolDefinition(): McpTool;
|
|
607
|
+
/**
|
|
608
|
+
* Enable debug observability for this tool.
|
|
609
|
+
*
|
|
610
|
+
* When enabled, structured {@link DebugEvent} events are emitted at
|
|
611
|
+
* each step of the execution pipeline.
|
|
612
|
+
*
|
|
613
|
+
* When disabled (the default), there is **zero runtime overhead** —
|
|
614
|
+
* no conditionals, no timing, no object allocations in the hot path.
|
|
615
|
+
*
|
|
616
|
+
* @param observer - A {@link DebugObserverFn} created by `createDebugObserver()`
|
|
617
|
+
* @returns `this` for chaining
|
|
618
|
+
*
|
|
619
|
+
* @example
|
|
620
|
+
* ```typescript
|
|
621
|
+
* import { createTool, createDebugObserver, success } from 'vurb';
|
|
622
|
+
*
|
|
623
|
+
* const debug = createDebugObserver();
|
|
624
|
+
*
|
|
625
|
+
* const tool = createTool<void>('users')
|
|
626
|
+
* .debug(debug) // ← enable observability
|
|
627
|
+
* .action({ name: 'list', handler: async () => success([]) });
|
|
628
|
+
* ```
|
|
629
|
+
*/
|
|
630
|
+
debug(observer: DebugObserverFn): this;
|
|
631
|
+
/**
|
|
632
|
+
* Enable out-of-band telemetry emission for Inspector TUI.
|
|
633
|
+
*
|
|
634
|
+
* When set, `validate`, `middleware`, `presenter.slice`, and
|
|
635
|
+
* `presenter.rules` events are emitted to the TelemetrySink
|
|
636
|
+
* (Shadow Socket IPC), enabling real-time monitoring in the
|
|
637
|
+
* Inspector dashboard.
|
|
638
|
+
*
|
|
639
|
+
* **Zero overhead** when not configured — no conditionals in
|
|
640
|
+
* the hot path.
|
|
641
|
+
*
|
|
642
|
+
* @param sink - A {@link TelemetrySink} from `startServer()` or `TelemetryBus`
|
|
643
|
+
* @returns `this` for chaining
|
|
644
|
+
*/
|
|
645
|
+
telemetry(sink: TelemetrySink): this;
|
|
646
|
+
/**
|
|
647
|
+
* Enable OpenTelemetry-compatible tracing for this tool.
|
|
648
|
+
*
|
|
649
|
+
* When enabled, each `execute()` call creates a single span with
|
|
650
|
+
* structured events for each pipeline step (`mcp.route`, `mcp.validate`,
|
|
651
|
+
* `mcp.middleware`, `mcp.execute`).
|
|
652
|
+
*
|
|
653
|
+
* **Zero overhead** when disabled — the fast path has no conditionals.
|
|
654
|
+
*
|
|
655
|
+
* **OTel direct pass-through**: The `VurbTracer` interface is a
|
|
656
|
+
* structural subtype of OTel's `Tracer`, so you can pass an OTel
|
|
657
|
+
* tracer directly without any adapter:
|
|
658
|
+
*
|
|
659
|
+
* ```typescript
|
|
660
|
+
* import { trace } from '@opentelemetry/api';
|
|
661
|
+
*
|
|
662
|
+
* const tool = createTool<AppContext>('projects')
|
|
663
|
+
* .tracing(trace.getTracer('vurb'))
|
|
664
|
+
* .action({ name: 'list', handler: listProjects });
|
|
665
|
+
* ```
|
|
666
|
+
*
|
|
667
|
+
* **Error classification**:
|
|
668
|
+
* - Validation failures → `SpanStatusCode.UNSET` + `mcp.error_type` attribute
|
|
669
|
+
* - Handler exceptions → `SpanStatusCode.ERROR` + `recordException()`
|
|
670
|
+
*
|
|
671
|
+
* **Context propagation limitation**: Since Vurb does not depend
|
|
672
|
+
* on `@opentelemetry/api`, it cannot call `context.with(trace.setSpan(...))`.
|
|
673
|
+
* Auto-instrumented downstream calls (Prisma, HTTP, Redis) inside handlers
|
|
674
|
+
* will appear as siblings, not children, of the MCP span.
|
|
675
|
+
*
|
|
676
|
+
* @param tracer - A {@link VurbTracer} (or OTel `Tracer`) instance
|
|
677
|
+
* @returns `this` for chaining
|
|
678
|
+
*
|
|
679
|
+
* @see {@link VurbTracer} for the interface contract
|
|
680
|
+
* @see {@link SpanStatusCode} for status code semantics
|
|
681
|
+
*/
|
|
682
|
+
tracing(tracer: VurbTracer): this;
|
|
683
|
+
/**
|
|
684
|
+
* Route a tool call to the correct action handler.
|
|
685
|
+
*
|
|
686
|
+
* Pipeline: `parseDiscriminator → resolveAction → validateArgs → runChain`
|
|
687
|
+
*
|
|
688
|
+
* Auto-calls {@link buildToolDefinition} if not called yet.
|
|
689
|
+
* If a debug observer is active, structured events are emitted
|
|
690
|
+
* at each pipeline step with timing information.
|
|
691
|
+
*
|
|
692
|
+
* @param ctx - Application context
|
|
693
|
+
* @param args - Raw arguments from the LLM (includes discriminator)
|
|
694
|
+
* @param progressSink - Optional callback for streaming progress notifications.
|
|
695
|
+
* When attached via `attachToServer()`, this is automatically wired to
|
|
696
|
+
* MCP `notifications/progress`. When omitted, progress events are silently consumed.
|
|
697
|
+
* @param signal - Optional AbortSignal from the MCP SDK protocol layer.
|
|
698
|
+
* Fired when the client sends `notifications/cancelled` or the connection drops.
|
|
699
|
+
* The framework checks this signal before handler execution and during
|
|
700
|
+
* generator iteration, aborting zombie operations immediately.
|
|
701
|
+
* @returns The handler's {@link ToolResponse}
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* ```typescript
|
|
705
|
+
* // Direct execution (useful in tests)
|
|
706
|
+
* const result = await builder.execute(ctx, {
|
|
707
|
+
* action: 'list',
|
|
708
|
+
* workspace_id: 'ws_123',
|
|
709
|
+
* });
|
|
710
|
+
* ```
|
|
711
|
+
*/
|
|
712
|
+
execute(ctx: TContext, args: Record<string, unknown>, progressSink?: ProgressSink, signal?: AbortSignal): Promise<ToolResponse>;
|
|
713
|
+
/**
|
|
714
|
+
* Internal: execute with the appropriate observability path.
|
|
715
|
+
* Extracted to keep the concurrency/egress guards clean.
|
|
716
|
+
*/
|
|
717
|
+
private _executeWithObservability;
|
|
718
|
+
/**
|
|
719
|
+
* Pipeline hooks for observability instrumentation.
|
|
720
|
+
*
|
|
721
|
+
* Each hook is called at the corresponding pipeline step.
|
|
722
|
+
* The fast path passes `undefined` (zero overhead).
|
|
723
|
+
* Debug and traced paths supply their hooks via factory methods.
|
|
724
|
+
*/
|
|
725
|
+
private _executePipeline;
|
|
726
|
+
/**
|
|
727
|
+
* Build debug hooks: lightweight event emission.
|
|
728
|
+
*/
|
|
729
|
+
private _buildDebugHooks;
|
|
730
|
+
/**
|
|
731
|
+
* Build traced hooks: OpenTelemetry-compatible span creation.
|
|
732
|
+
*
|
|
733
|
+
* Creates ONE span per tool call with events for pipeline steps.
|
|
734
|
+
* Uses wrapResponse for leak-proof span closure.
|
|
735
|
+
* AI errors → UNSET, system errors → ERROR.
|
|
736
|
+
*/
|
|
737
|
+
private _buildTracedHooks;
|
|
738
|
+
/**
|
|
739
|
+
* Build telemetry hooks: Shadow Socket event emission for Inspector TUI.
|
|
740
|
+
*
|
|
741
|
+
* Emits `validate`, `middleware`, and `execute` TelemetryEvents
|
|
742
|
+
* to the IPC sink so that `vurb inspect` shows real pipeline data.
|
|
743
|
+
*/
|
|
744
|
+
private _buildTelemetryHooks;
|
|
745
|
+
/** Get the tool name. */
|
|
746
|
+
getName(): string;
|
|
747
|
+
/** Get a copy of the capability tags. */
|
|
748
|
+
getTags(): string[];
|
|
749
|
+
/** Get all registered action keys (e.g. `["list", "create"]` or `["users.list", "users.ban"]`). */
|
|
750
|
+
getActionNames(): string[];
|
|
751
|
+
/** Get the discriminator field name (e.g. `"action"`). Used by the Exposition Compiler. */
|
|
752
|
+
getDiscriminator(): string;
|
|
753
|
+
/**
|
|
754
|
+
* Get all registered internal actions.
|
|
755
|
+
* Used by the Exposition Compiler for atomic tool expansion.
|
|
756
|
+
* @returns Read-only array of internal action definitions
|
|
757
|
+
*/
|
|
758
|
+
getActions(): readonly InternalAction<TContext>[];
|
|
759
|
+
/**
|
|
760
|
+
* Get the common schema shared across all actions.
|
|
761
|
+
* Used by the Exposition Compiler for schema purification.
|
|
762
|
+
* @returns The common Zod schema, or undefined if not set
|
|
763
|
+
*/
|
|
764
|
+
getCommonSchema(): ZodObject<ZodRawShape> | undefined;
|
|
765
|
+
/** Check if `_select` reflection is enabled. Used by the Exposition Compiler. */
|
|
766
|
+
getSelectEnabled(): boolean;
|
|
767
|
+
/** Get per-action state sync hints for auto-policy generation. */
|
|
768
|
+
getStateSyncHints(): ReadonlyMap<string, StateSyncHint>;
|
|
769
|
+
/**
|
|
770
|
+
* Preview the exact MCP protocol payload that the LLM will receive.
|
|
771
|
+
*
|
|
772
|
+
* Builds the tool definition if not already built, then renders
|
|
773
|
+
* a human-readable preview of the complete tool including:
|
|
774
|
+
* - Tool name and description
|
|
775
|
+
* - Input schema (JSON)
|
|
776
|
+
* - Annotations (if any)
|
|
777
|
+
* - Approximate token count (~4 chars per token, GPT-5.2 heuristic)
|
|
778
|
+
*
|
|
779
|
+
* Call this from your dev environment to optimize token usage
|
|
780
|
+
* and verify the LLM-facing prompt without starting an MCP server.
|
|
781
|
+
*
|
|
782
|
+
* @returns Formatted string showing the exact MCP payload + token estimate
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```typescript
|
|
786
|
+
* const projects = defineTool<AppContext>('projects', { ... });
|
|
787
|
+
* console.log(projects.previewPrompt());
|
|
788
|
+
*
|
|
789
|
+
* // Output:
|
|
790
|
+
* // ┌─────────────────────────────────────────┐
|
|
791
|
+
* // │ MCP Tool Preview: projects │
|
|
792
|
+
* // ├─────────────────────────────────────────┤
|
|
793
|
+
* // │ Name: projects │
|
|
794
|
+
* // │ Actions: 3 (list, create, delete) │
|
|
795
|
+
* // │ Tags: api, admin │
|
|
796
|
+
* // ├─── Description ─────────────────────────┤
|
|
797
|
+
* // │ Manage workspace projects. ... │
|
|
798
|
+
* // ├─── Input Schema ────────────────────────┤
|
|
799
|
+
* // │ { "type": "object", ... } │
|
|
800
|
+
* // ├─── Annotations ─────────────────────────┤
|
|
801
|
+
* // │ readOnlyHint: false │
|
|
802
|
+
* // │ destructiveHint: true │
|
|
803
|
+
* // ├─── Token Estimate ──────────────────────┤
|
|
804
|
+
* // │ ~342 tokens (1,368 chars) │
|
|
805
|
+
* // └─────────────────────────────────────────┘
|
|
806
|
+
* ```
|
|
807
|
+
*
|
|
808
|
+
* @see {@link buildToolDefinition} for the raw MCP Tool object
|
|
809
|
+
*/
|
|
810
|
+
previewPrompt(): string;
|
|
811
|
+
/**
|
|
812
|
+
* Get metadata for all registered actions.
|
|
813
|
+
*
|
|
814
|
+
* Useful for programmatic documentation, compliance audits,
|
|
815
|
+
* dashboard generation, or runtime observability.
|
|
816
|
+
*
|
|
817
|
+
* @returns Array of {@link ActionMetadata} objects
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```typescript
|
|
821
|
+
* const meta = builder.getActionMetadata();
|
|
822
|
+
* for (const action of meta) {
|
|
823
|
+
* console.log(`${action.key}: destructive=${action.destructive}, fields=${action.requiredFields}`);
|
|
824
|
+
* }
|
|
825
|
+
* ```
|
|
826
|
+
*
|
|
827
|
+
* @see {@link ActionMetadata} for the metadata shape
|
|
828
|
+
*/
|
|
829
|
+
getActionMetadata(): ActionMetadata[];
|
|
830
|
+
private _assertNotFrozen;
|
|
831
|
+
}
|
|
832
|
+
//# sourceMappingURL=GroupedToolBuilder.d.ts.map
|