@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,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Block Helpers — Server-Side Rendering for AI Agents
|
|
3
|
+
*
|
|
4
|
+
* Deterministic helpers that wrap structured content into fenced
|
|
5
|
+
* code blocks (or raw markup) for LLM pass-through rendering.
|
|
6
|
+
*
|
|
7
|
+
* Today these produce `text` blocks with fenced syntax.
|
|
8
|
+
* If MCP adds native UI content types in the future, only
|
|
9
|
+
* the internal `fence()` wrapper needs to change — all Presenters
|
|
10
|
+
* and consumers stay intact.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { ui } from 'vurb';
|
|
15
|
+
*
|
|
16
|
+
* ui.echarts({ title: { text: 'Burndown' }, series: [...] });
|
|
17
|
+
* ui.mermaid('graph TD; A-->B');
|
|
18
|
+
* ui.markdown('| Col | Val |');
|
|
19
|
+
* ui.table(['ID', 'Status'], [['INV-1', '✅ Paid']]);
|
|
20
|
+
* ui.list(['Deploy', 'Migrate', 'Verify']);
|
|
21
|
+
* ui.json({ key: 'value' });
|
|
22
|
+
* ui.summary('3 items found. 2 active, 1 archived.');
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
// ── Internal Helpers ─────────────────────────────────────
|
|
28
|
+
/**
|
|
29
|
+
* Wrap content in a fenced code block.
|
|
30
|
+
*
|
|
31
|
+
* Single point of change for the fencing format. If MCP adds
|
|
32
|
+
* native block types in the future, only this function needs updating.
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
function fence(lang, body) {
|
|
37
|
+
return `\`\`\`${lang}\n${body}\n\`\`\``;
|
|
38
|
+
}
|
|
39
|
+
// ── Core 4 Helpers ───────────────────────────────────────
|
|
40
|
+
/**
|
|
41
|
+
* Generate an ECharts UI block from a configuration object.
|
|
42
|
+
*
|
|
43
|
+
* The config is serialized with `JSON.stringify(config, null, 2)` for
|
|
44
|
+
* deterministic, hallucination-free chart rendering.
|
|
45
|
+
*
|
|
46
|
+
* @param config - A valid ECharts option object
|
|
47
|
+
* @returns A {@link UiBlock} with fenced `echarts` code block
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* ui.echarts({
|
|
52
|
+
* title: { text: 'Sprint Burndown' },
|
|
53
|
+
* xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed'] },
|
|
54
|
+
* series: [{ type: 'line', data: [5, 3, 1] }]
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
function echarts(config) {
|
|
59
|
+
return { type: 'echarts', content: fence('echarts', JSON.stringify(config, null, 2)) };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Generate a Mermaid diagram UI block.
|
|
63
|
+
*
|
|
64
|
+
* @param diagram - Raw Mermaid diagram syntax
|
|
65
|
+
* @returns A {@link UiBlock} with fenced `mermaid` code block
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* ui.mermaid('graph TD; A["Start"] --> B["Process"] --> C["End"]');
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
function mermaid(diagram) {
|
|
73
|
+
return { type: 'mermaid', content: fence('mermaid', diagram) };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generate a raw Markdown UI block.
|
|
77
|
+
*
|
|
78
|
+
* Unlike other helpers, markdown content is **not** fenced —
|
|
79
|
+
* it's returned as-is for direct rendering.
|
|
80
|
+
*
|
|
81
|
+
* @param md - Raw Markdown string
|
|
82
|
+
* @returns A {@link UiBlock} with raw markdown content
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* ui.markdown('| Task | Status |\n|---|---|\n| Deploy | ✅ Done |');
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
function markdown(md) {
|
|
90
|
+
return { type: 'markdown', content: md };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Generate a generic fenced code block UI block.
|
|
94
|
+
*
|
|
95
|
+
* Fallback helper for structured content (logs, XML, raw JSON)
|
|
96
|
+
* that needs explicit language tagging.
|
|
97
|
+
*
|
|
98
|
+
* @param lang - Language identifier for syntax highlighting
|
|
99
|
+
* @param code - Code content
|
|
100
|
+
* @returns A {@link UiBlock} with fenced code block
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* ui.codeBlock('json', JSON.stringify(config, null, 2));
|
|
105
|
+
* ui.codeBlock('xml', '<root><item>value</item></root>');
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
function codeBlock(lang, code) {
|
|
109
|
+
return { type: lang, content: fence(lang, code) };
|
|
110
|
+
}
|
|
111
|
+
// ── DX Helpers ───────────────────────────────────────────
|
|
112
|
+
/**
|
|
113
|
+
* Generate a Markdown table UI block from headers and row data.
|
|
114
|
+
*
|
|
115
|
+
* The **#1 most common pattern** in data tools. Automatically
|
|
116
|
+
* generates a fully formatted markdown table with alignment
|
|
117
|
+
* separators — zero manual string concatenation needed.
|
|
118
|
+
*
|
|
119
|
+
* @param headers - Column header labels
|
|
120
|
+
* @param rows - Array of row arrays (each inner array = one row)
|
|
121
|
+
* @returns A {@link UiBlock} with formatted markdown table
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* ui.table(
|
|
126
|
+
* ['Invoice', 'Amount', 'Status'],
|
|
127
|
+
* [
|
|
128
|
+
* ['INV-001', '$4,500.00', '✅ Paid'],
|
|
129
|
+
* ['INV-002', '$1,200.00', '⚠️ Pending'],
|
|
130
|
+
* ],
|
|
131
|
+
* );
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
function table(headers, rows) {
|
|
135
|
+
const headerRow = `| ${headers.join(' | ')} |`;
|
|
136
|
+
const separator = `| ${headers.map(() => '---').join(' | ')} |`;
|
|
137
|
+
const bodyRows = rows.map(row => `| ${row.join(' | ')} |`).join('\n');
|
|
138
|
+
return { type: 'markdown', content: `${headerRow}\n${separator}\n${bodyRows}` };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Generate a Markdown bullet list UI block.
|
|
142
|
+
*
|
|
143
|
+
* Perfect for action items, checklists, or enumerated results.
|
|
144
|
+
*
|
|
145
|
+
* @param items - Array of list items (strings)
|
|
146
|
+
* @returns A {@link UiBlock} with markdown list content
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* ui.list(['Deploy API server', 'Run database migrations', 'Verify health checks']);
|
|
151
|
+
* // → "- Deploy API server\n- Run database migrations\n- Verify health checks"
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
function list(items) {
|
|
155
|
+
return { type: 'markdown', content: items.map(item => `- ${item}`).join('\n') };
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Generate a fenced JSON code block UI block.
|
|
159
|
+
*
|
|
160
|
+
* Shorthand for `ui.codeBlock('json', JSON.stringify(data, null, 2))`.
|
|
161
|
+
* Most developers reach for this pattern constantly.
|
|
162
|
+
*
|
|
163
|
+
* @param data - Any JSON-serializable value
|
|
164
|
+
* @returns A {@link UiBlock} with fenced `json` code block
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* ui.json({ host: 'api.example.com', port: 3000, ssl: true });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
function json(data) {
|
|
172
|
+
return { type: 'json', content: fence('json', JSON.stringify(data, null, 2)) };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Generate a summary UI block for collection overviews.
|
|
176
|
+
*
|
|
177
|
+
* Placed at the top of collection responses to give the LLM
|
|
178
|
+
* quick context about the dataset without parsing the full array.
|
|
179
|
+
*
|
|
180
|
+
* @param text - Human-readable summary of the collection
|
|
181
|
+
* @returns A {@link UiBlock} with summary content
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* ui.summary('3 invoices totaling $5,700.00. 2 paid, 1 pending.');
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
function summary(text) {
|
|
189
|
+
return { type: 'summary', content: `📊 **Summary**: ${text}` };
|
|
190
|
+
}
|
|
191
|
+
// ── Public Namespace ─────────────────────────────────────
|
|
192
|
+
/**
|
|
193
|
+
* UI block helpers for Server-Side Rendering (SSR) in Presenters.
|
|
194
|
+
*
|
|
195
|
+
* **Core helpers**: `echarts`, `mermaid`, `markdown`, `codeBlock`
|
|
196
|
+
* **DX helpers**: `table`, `list`, `json`, `summary`
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* import { ui } from 'vurb';
|
|
201
|
+
*
|
|
202
|
+
* // Quick table from arrays
|
|
203
|
+
* ui.table(['Name', 'Status'], [['Alice', 'Active'], ['Bob', 'Inactive']]);
|
|
204
|
+
*
|
|
205
|
+
* // Quick list
|
|
206
|
+
* ui.list(['Step 1: Deploy', 'Step 2: Verify']);
|
|
207
|
+
*
|
|
208
|
+
* // Quick JSON viewer
|
|
209
|
+
* ui.json({ config: { debug: true } });
|
|
210
|
+
*
|
|
211
|
+
* // Charts and diagrams
|
|
212
|
+
* ui.echarts(chartConfig);
|
|
213
|
+
* ui.mermaid('graph TD; A-->B');
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
export const ui = {
|
|
217
|
+
// Core 4
|
|
218
|
+
echarts, mermaid, markdown, codeBlock,
|
|
219
|
+
// DX helpers
|
|
220
|
+
table, list, json, summary,
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/presenter/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAiBH,4DAA4D;AAE5D;;;;;;;GAOG;AACH,SAAS,KAAK,CAAC,IAAY,EAAE,IAAY;IACrC,OAAO,SAAS,IAAI,KAAK,IAAI,UAAU,CAAC;AAC5C,CAAC;AAED,4DAA4D;AAE5D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,OAAO,CAAC,MAA+B;IAC5C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3F,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,OAAO,CAAC,OAAe;IAC5B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,QAAQ,CAAC,EAAU;IACxB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,IAAY;IACzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;AACtD,CAAC;AAED,4DAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAS,KAAK,CAAC,OA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EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS;IACrC,aAAa;IACb,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO;CACpB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface CursorPayload {
|
|
2
|
+
after: string;
|
|
3
|
+
}
|
|
4
|
+
export type CursorMode = 'signed' | 'encrypted';
|
|
5
|
+
export interface CursorCodecOptions {
|
|
6
|
+
/**
|
|
7
|
+
* 'signed' (default): HMAC signature appended to base64 payload. Payload is visible but tamper-proof.
|
|
8
|
+
* 'encrypted': AES-GCM encryption. Payload is completely hidden and tamper-proof.
|
|
9
|
+
*/
|
|
10
|
+
mode?: CursorMode;
|
|
11
|
+
/**
|
|
12
|
+
* Optional 32-byte secret key.
|
|
13
|
+
* If not provided, a random ephemeral key is generated per process.
|
|
14
|
+
*/
|
|
15
|
+
secret?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Stateless Cryptographic Cursor for pagination using Web Crypto API.
|
|
19
|
+
*
|
|
20
|
+
* Works in Node >= 16, Deno, Bun, and Cloudflare Workers.
|
|
21
|
+
*/
|
|
22
|
+
export declare class CursorCodec {
|
|
23
|
+
private readonly _mode;
|
|
24
|
+
private _secretBytes;
|
|
25
|
+
private _secretPromise;
|
|
26
|
+
private readonly _providedSecret;
|
|
27
|
+
private _hmacKey?;
|
|
28
|
+
private _aesKey?;
|
|
29
|
+
constructor(options?: CursorCodecOptions);
|
|
30
|
+
private ensureSecret;
|
|
31
|
+
private getHmacKey;
|
|
32
|
+
private getAesKey;
|
|
33
|
+
/**
|
|
34
|
+
* Asynchronously encodes a payload into a URL-safe cursor string.
|
|
35
|
+
*/
|
|
36
|
+
encode(payload: CursorPayload): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Asynchronously decodes and verifies a cursor string back into its payload.
|
|
39
|
+
* Returns undefined if the cursor is invalid, tampered with, or from a different process/key.
|
|
40
|
+
*/
|
|
41
|
+
decode(cursor: string): Promise<CursorPayload | undefined>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=CursorCodec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CursorCodec.d.ts","sourceRoot":"","sources":["../../src/prompt/CursorCodec.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAyDD;;;;GAIG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,cAAc,CAAkC;IACxD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAC,CAAY;gBAEhB,OAAO,CAAC,EAAE,kBAAkB;YAe1B,YAAY;YAYZ,UAAU;YAeV,SAAS;IAevB;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IA+BrD;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAsDnE"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazily resolves the Web Crypto API.
|
|
3
|
+
* Works in Node >= 16 (via node:crypto.webcrypto), Node >= 19 (globalThis.crypto),
|
|
4
|
+
* Deno, Bun, and Cloudflare Workers.
|
|
5
|
+
*/
|
|
6
|
+
let _resolvedCrypto;
|
|
7
|
+
async function getCrypto() {
|
|
8
|
+
if (_resolvedCrypto)
|
|
9
|
+
return _resolvedCrypto;
|
|
10
|
+
// globalThis.crypto.subtle is available in Node >= 19, Deno, Bun, CF Workers
|
|
11
|
+
if (typeof globalThis.crypto !== 'undefined' && globalThis.crypto.subtle) {
|
|
12
|
+
_resolvedCrypto = globalThis.crypto;
|
|
13
|
+
return _resolvedCrypto;
|
|
14
|
+
}
|
|
15
|
+
// Node.js 16-18 fallback — webcrypto available via node:crypto module
|
|
16
|
+
// Variable indirection prevents TypeScript from resolving the module statically (no @types/node)
|
|
17
|
+
try {
|
|
18
|
+
const mod = 'node:' + 'crypto';
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
20
|
+
const nodeCrypto = (await import(mod)).webcrypto;
|
|
21
|
+
if (nodeCrypto?.subtle) {
|
|
22
|
+
_resolvedCrypto = nodeCrypto;
|
|
23
|
+
return _resolvedCrypto;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch { /* not in Node */ }
|
|
27
|
+
throw new Error('CursorCodec requires the Web Crypto API. ' +
|
|
28
|
+
'Ensure globalThis.crypto.subtle is available or use Node >= 16.');
|
|
29
|
+
}
|
|
30
|
+
function base64UrlEncode(buffer) {
|
|
31
|
+
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
32
|
+
let binary = '';
|
|
33
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
34
|
+
binary += String.fromCharCode(bytes[i]);
|
|
35
|
+
}
|
|
36
|
+
return btoa(binary)
|
|
37
|
+
.replace(/\+/g, '-')
|
|
38
|
+
.replace(/\//g, '_')
|
|
39
|
+
.replace(/=/g, '');
|
|
40
|
+
}
|
|
41
|
+
function base64UrlDecode(base64) {
|
|
42
|
+
const s = base64.replace(/-/g, '+').replace(/_/g, '/');
|
|
43
|
+
const b = atob(s);
|
|
44
|
+
const bytes = new Uint8Array(b.length);
|
|
45
|
+
for (let i = 0; i < b.length; i++) {
|
|
46
|
+
bytes[i] = b.charCodeAt(i);
|
|
47
|
+
}
|
|
48
|
+
return bytes;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Stateless Cryptographic Cursor for pagination using Web Crypto API.
|
|
52
|
+
*
|
|
53
|
+
* Works in Node >= 16, Deno, Bun, and Cloudflare Workers.
|
|
54
|
+
*/
|
|
55
|
+
export class CursorCodec {
|
|
56
|
+
_mode;
|
|
57
|
+
_secretBytes;
|
|
58
|
+
_secretPromise;
|
|
59
|
+
_providedSecret;
|
|
60
|
+
_hmacKey;
|
|
61
|
+
_aesKey;
|
|
62
|
+
constructor(options) {
|
|
63
|
+
this._mode = options?.mode ?? 'signed';
|
|
64
|
+
this._providedSecret = options?.secret;
|
|
65
|
+
if (options?.secret) {
|
|
66
|
+
const encoder = new TextEncoder();
|
|
67
|
+
const buf = encoder.encode(options.secret);
|
|
68
|
+
if (buf.length !== 32) {
|
|
69
|
+
throw new Error('CursorCodec secret must be exactly 32 bytes (256 bits)');
|
|
70
|
+
}
|
|
71
|
+
this._secretBytes = buf;
|
|
72
|
+
}
|
|
73
|
+
// When no secret provided, _secretBytes is deferred to first use (async)
|
|
74
|
+
}
|
|
75
|
+
async ensureSecret() {
|
|
76
|
+
if (this._secretBytes)
|
|
77
|
+
return this._secretBytes;
|
|
78
|
+
if (!this._secretPromise) {
|
|
79
|
+
this._secretPromise = (async () => {
|
|
80
|
+
const crypto = await getCrypto();
|
|
81
|
+
this._secretBytes = crypto.getRandomValues(new Uint8Array(32));
|
|
82
|
+
return this._secretBytes;
|
|
83
|
+
})();
|
|
84
|
+
}
|
|
85
|
+
return this._secretPromise;
|
|
86
|
+
}
|
|
87
|
+
async getHmacKey() {
|
|
88
|
+
if (!this._hmacKey) {
|
|
89
|
+
const secret = await this.ensureSecret();
|
|
90
|
+
const crypto = await getCrypto();
|
|
91
|
+
this._hmacKey = await crypto.subtle.importKey('raw', secret, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign', 'verify']);
|
|
92
|
+
}
|
|
93
|
+
return this._hmacKey;
|
|
94
|
+
}
|
|
95
|
+
async getAesKey() {
|
|
96
|
+
if (!this._aesKey) {
|
|
97
|
+
const secret = await this.ensureSecret();
|
|
98
|
+
const crypto = await getCrypto();
|
|
99
|
+
this._aesKey = await crypto.subtle.importKey('raw', secret, 'AES-GCM', false, ['encrypt', 'decrypt']);
|
|
100
|
+
}
|
|
101
|
+
return this._aesKey;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Asynchronously encodes a payload into a URL-safe cursor string.
|
|
105
|
+
*/
|
|
106
|
+
async encode(payload) {
|
|
107
|
+
const data = JSON.stringify(payload);
|
|
108
|
+
const dataBuffer = new TextEncoder().encode(data);
|
|
109
|
+
if (this._mode === 'encrypted') {
|
|
110
|
+
const aesKey = await this.getAesKey();
|
|
111
|
+
const crypto = await getCrypto();
|
|
112
|
+
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
113
|
+
const encryptedBuf = await crypto.subtle.encrypt({ name: 'AES-GCM', iv: iv }, aesKey, dataBuffer);
|
|
114
|
+
// Web Crypto AES-GCM appends the 16-byte auth tag at the end of the ciphertext
|
|
115
|
+
return `${base64UrlEncode(iv)}.${base64UrlEncode(encryptedBuf)}`;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// Signed HMAC
|
|
119
|
+
const hmacKey = await this.getHmacKey();
|
|
120
|
+
const cryptoApi = await getCrypto();
|
|
121
|
+
const signatureBuf = await cryptoApi.subtle.sign('HMAC', hmacKey, dataBuffer);
|
|
122
|
+
return `${base64UrlEncode(dataBuffer)}.${base64UrlEncode(signatureBuf)}`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Asynchronously decodes and verifies a cursor string back into its payload.
|
|
127
|
+
* Returns undefined if the cursor is invalid, tampered with, or from a different process/key.
|
|
128
|
+
*/
|
|
129
|
+
async decode(cursor) {
|
|
130
|
+
try {
|
|
131
|
+
if (this._mode === 'encrypted') {
|
|
132
|
+
const parts = cursor.split('.');
|
|
133
|
+
if (parts.length !== 2)
|
|
134
|
+
return undefined;
|
|
135
|
+
const [ivStr, encryptedStr] = parts;
|
|
136
|
+
if (!ivStr || !encryptedStr)
|
|
137
|
+
return undefined;
|
|
138
|
+
const iv = base64UrlDecode(ivStr);
|
|
139
|
+
const encrypted = base64UrlDecode(encryptedStr);
|
|
140
|
+
const aesKey = await this.getAesKey();
|
|
141
|
+
const cryptoApi = await getCrypto();
|
|
142
|
+
const decryptedBuf = await cryptoApi.subtle.decrypt({ name: 'AES-GCM', iv: iv }, aesKey, encrypted);
|
|
143
|
+
const decrypted = new TextDecoder().decode(decryptedBuf);
|
|
144
|
+
return JSON.parse(decrypted);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// Signed HMAC
|
|
148
|
+
const parts = cursor.split('.');
|
|
149
|
+
if (parts.length !== 2)
|
|
150
|
+
return undefined;
|
|
151
|
+
const [dataB64, signatureB64] = parts;
|
|
152
|
+
if (!dataB64 || !signatureB64)
|
|
153
|
+
return undefined;
|
|
154
|
+
const dataBuffer = base64UrlDecode(dataB64);
|
|
155
|
+
const signatureBuf = base64UrlDecode(signatureB64);
|
|
156
|
+
const hmacKey = await this.getHmacKey();
|
|
157
|
+
const cryptoApi2 = await getCrypto();
|
|
158
|
+
const isValid = await cryptoApi2.subtle.verify('HMAC', hmacKey, signatureBuf, dataBuffer);
|
|
159
|
+
if (!isValid)
|
|
160
|
+
return undefined;
|
|
161
|
+
const decrypted = new TextDecoder().decode(dataBuffer);
|
|
162
|
+
return JSON.parse(decrypted);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// Catches Crypto errors (tampering), JSON parsing errors, Base64 errors
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=CursorCodec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AAC,OAAO,CAAC,CAAC;gBAC5C,MAAM,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;gBAEnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;gBAExC,MAAM,UAAU,GAAG,MAAM,SAAS,EAAE,CAAC;gBAErC,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAC1C,MAAM,EACN,OAAO,EACP,YAAmB,EACnB,UAAiB,CACpB,CAAC;gBAEF,IAAI,CAAC,OAAO;oBAAE,OAAO,SAAS,CAAC;gBAE/B,MAAM,SAAS,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBACvD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAkB,CAAC;YAClD,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACL,wEAAwE;YACxE,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FluentPromptBuilder — Chainable Prompt Definition API
|
|
3
|
+
*
|
|
4
|
+
* Provides a builder-pattern alternative to the config-bag `definePrompt()`.
|
|
5
|
+
* Follows the same architectural pattern as `FluentToolBuilder`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const greet = f.prompt('greet')
|
|
10
|
+
* .describe('Greet a user by name')
|
|
11
|
+
* .input({ name: f.string() })
|
|
12
|
+
* .handler(async (ctx, { name }) => ({
|
|
13
|
+
* messages: [PromptMessage.user(`Hello ${name}!`)],
|
|
14
|
+
* }));
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import { type ZodObject, type ZodRawShape } from 'zod';
|
|
20
|
+
import { type PromptBuilder, type PromptResult, type PromptParamsMap, type LoopbackContext } from './types.js';
|
|
21
|
+
import { type MiddlewareFn } from '../core/types.js';
|
|
22
|
+
/**
|
|
23
|
+
* Chainable builder for MCP Prompts.
|
|
24
|
+
*
|
|
25
|
+
* Each setter returns `this` for chaining. Finalisation happens lazily
|
|
26
|
+
* when the `PromptBuilder` interface methods are accessed — this means
|
|
27
|
+
* you can pass a `FluentPromptBuilder` directly to `PromptRegistry.register()`.
|
|
28
|
+
*
|
|
29
|
+
* @typeParam TContext - Application context type (inherited from `initVurb`)
|
|
30
|
+
* @typeParam TArgs - Inferred argument type from the schema
|
|
31
|
+
*/
|
|
32
|
+
export declare class FluentPromptBuilder<TContext = void, TArgs extends Record<string, unknown> = Record<string, unknown>> implements PromptBuilder<TContext> {
|
|
33
|
+
private readonly _name;
|
|
34
|
+
private _title?;
|
|
35
|
+
private _description?;
|
|
36
|
+
private _icons?;
|
|
37
|
+
private _tags;
|
|
38
|
+
private _middlewares;
|
|
39
|
+
private _args?;
|
|
40
|
+
private _hydrationTimeout?;
|
|
41
|
+
private _handler?;
|
|
42
|
+
/** @internal Cached delegate built on first access to PromptBuilder methods */
|
|
43
|
+
private _delegate;
|
|
44
|
+
constructor(name: string);
|
|
45
|
+
/**
|
|
46
|
+
* Set a human-readable title for UI display.
|
|
47
|
+
*
|
|
48
|
+
* @param title - The prompt title
|
|
49
|
+
* @returns `this` for chaining
|
|
50
|
+
*/
|
|
51
|
+
title(title: string): this;
|
|
52
|
+
/**
|
|
53
|
+
* Set the prompt description shown in the slash command palette.
|
|
54
|
+
*
|
|
55
|
+
* @param description - Human-readable description
|
|
56
|
+
* @returns `this` for chaining
|
|
57
|
+
*/
|
|
58
|
+
describe(description: string): this;
|
|
59
|
+
/**
|
|
60
|
+
* Set icons for light/dark themes.
|
|
61
|
+
*
|
|
62
|
+
* @param icons - Icon paths for light and/or dark themes
|
|
63
|
+
* @returns `this` for chaining
|
|
64
|
+
*/
|
|
65
|
+
icons(icons: {
|
|
66
|
+
light?: string;
|
|
67
|
+
dark?: string;
|
|
68
|
+
}): this;
|
|
69
|
+
/**
|
|
70
|
+
* Set capability tags for selective exposure.
|
|
71
|
+
*
|
|
72
|
+
* @param tags - Tag strings for filtering
|
|
73
|
+
* @returns `this` for chaining
|
|
74
|
+
*/
|
|
75
|
+
tags(...tags: string[]): this;
|
|
76
|
+
/**
|
|
77
|
+
* Define the input schema for prompt arguments.
|
|
78
|
+
*
|
|
79
|
+
* Accepts the same formats as `FluentToolBuilder.input()`:
|
|
80
|
+
* - Fluent param descriptors (`f.string()`, `f.number()`, etc.) — zero imports
|
|
81
|
+
* - Zod schema for power users
|
|
82
|
+
*
|
|
83
|
+
* @returns `this` for chaining
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // Fluent descriptors (recommended — zero Zod imports)
|
|
88
|
+
* f.prompt('greet')
|
|
89
|
+
* .input({ name: f.string(), age: f.number().optional() })
|
|
90
|
+
* .handler(async (ctx, { name, age }) => ({ ... }));
|
|
91
|
+
*
|
|
92
|
+
* // Zod schema (advanced)
|
|
93
|
+
* f.prompt('search')
|
|
94
|
+
* .input(z.object({ query: z.string().min(1) }))
|
|
95
|
+
* .handler(async (ctx, { query }) => ({ ... }));
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
input<S extends ZodRawShape>(schema: ZodObject<S>): FluentPromptBuilder<TContext, ZodObject<S>['_output']>;
|
|
99
|
+
input(params: PromptParamsMap): this;
|
|
100
|
+
/**
|
|
101
|
+
* Add middleware to the prompt's execution pipeline.
|
|
102
|
+
*
|
|
103
|
+
* Middleware runs in registration order around the handler
|
|
104
|
+
* (same onion model as tool middleware).
|
|
105
|
+
*
|
|
106
|
+
* @param fns - Middleware functions
|
|
107
|
+
* @returns `this` for chaining
|
|
108
|
+
*/
|
|
109
|
+
use(...fns: MiddlewareFn<TContext>[]): this;
|
|
110
|
+
/**
|
|
111
|
+
* Set the maximum hydration time in milliseconds.
|
|
112
|
+
*
|
|
113
|
+
* If the handler doesn't complete within this time,
|
|
114
|
+
* the framework returns a graceful SYSTEM ALERT.
|
|
115
|
+
*
|
|
116
|
+
* @param ms - Timeout in milliseconds
|
|
117
|
+
* @returns `this` for chaining
|
|
118
|
+
*/
|
|
119
|
+
timeout(ms: number): this;
|
|
120
|
+
/**
|
|
121
|
+
* Set the hydration handler.
|
|
122
|
+
*
|
|
123
|
+
* This is the terminal method — after calling `.handler()`,
|
|
124
|
+
* the builder is ready to be registered.
|
|
125
|
+
*
|
|
126
|
+
* @param fn - Handler function receiving `(ctx, args)` → `PromptResult`
|
|
127
|
+
* @returns `this` for chaining
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* .handler(async (ctx, { name }) => ({
|
|
132
|
+
* messages: [PromptMessage.user(`Hello ${name}!`)],
|
|
133
|
+
* }))
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
handler(fn: (ctx: TContext & LoopbackContext, args: TArgs) => Promise<PromptResult>): this;
|
|
137
|
+
/** @internal Build the underlying PromptBuilder delegate lazily */
|
|
138
|
+
private _build;
|
|
139
|
+
getName(): string;
|
|
140
|
+
getDescription(): string | undefined;
|
|
141
|
+
getTags(): string[];
|
|
142
|
+
hasMiddleware(): boolean;
|
|
143
|
+
getHydrationTimeout(): number | undefined;
|
|
144
|
+
buildPromptDefinition(): {
|
|
145
|
+
name: string;
|
|
146
|
+
description?: string;
|
|
147
|
+
arguments?: Array<{
|
|
148
|
+
name: string;
|
|
149
|
+
description?: string;
|
|
150
|
+
required?: boolean;
|
|
151
|
+
}>;
|
|
152
|
+
};
|
|
153
|
+
execute(ctx: TContext, args: Record<string, string>): Promise<PromptResult>;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=FluentPromptBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FluentPromptBuilder.d.ts","sourceRoot":"","sources":["../../src/prompt/FluentPromptBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAi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