@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,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createGroup() — Functional Tool Group Compiler
|
|
3
|
+
*
|
|
4
|
+
* A lightweight, closure-based alternative to the class-heavy
|
|
5
|
+
* `GroupedToolBuilder`. Instead of maintaining internal state via `this._x`,
|
|
6
|
+
* it compiles a group config into a frozen object with pre-composed
|
|
7
|
+
* middleware and an O(1) dispatch function.
|
|
8
|
+
*
|
|
9
|
+
* **Why Functional?**
|
|
10
|
+
* - Closures minify 30-40% better than class methods (Terser can rename local vars)
|
|
11
|
+
* - No prototype chain overhead — zero `this` binding issues
|
|
12
|
+
* - Frozen return type prevents accidental mutation
|
|
13
|
+
* - Compatible with Edge Runtimes (Cloudflare Workers, Deno Deploy)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createGroup, success } from 'vurb';
|
|
18
|
+
*
|
|
19
|
+
* const billing = createGroup({
|
|
20
|
+
* name: 'billing',
|
|
21
|
+
* description: 'Invoice management',
|
|
22
|
+
* middleware: [requireAuth],
|
|
23
|
+
* actions: {
|
|
24
|
+
* get_invoice: {
|
|
25
|
+
* schema: z.object({ id: z.string() }),
|
|
26
|
+
* readOnly: true,
|
|
27
|
+
* handler: async (ctx, args) => success(await ctx.db.invoices.get(args.id)),
|
|
28
|
+
* },
|
|
29
|
+
* pay: {
|
|
30
|
+
* schema: z.object({ invoice_id: z.string(), amount: z.number() }),
|
|
31
|
+
* destructive: true,
|
|
32
|
+
* handler: async (ctx, args) => success(await ctx.db.payments.create(args)),
|
|
33
|
+
* },
|
|
34
|
+
* },
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // billing.execute(ctx, 'get_invoice', { id: '123' })
|
|
38
|
+
* // billing.name === 'billing'
|
|
39
|
+
* // billing.actionNames === ['get_invoice', 'pay']
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @module
|
|
43
|
+
*/
|
|
44
|
+
import {} from 'zod';
|
|
45
|
+
import { error as toolError } from '../core/response.js';
|
|
46
|
+
import {} from '../core/types.js';
|
|
47
|
+
// ── Middleware Composition ────────────────────────────────
|
|
48
|
+
/**
|
|
49
|
+
* Compose an array of middleware into a single function.
|
|
50
|
+
* Right-to-left composition: last middleware is innermost (closest to handler).
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
function composeMiddleware(globalMiddleware, actionMiddleware, handler) {
|
|
54
|
+
const allMiddleware = [...globalMiddleware, ...actionMiddleware];
|
|
55
|
+
if (allMiddleware.length === 0) {
|
|
56
|
+
return handler;
|
|
57
|
+
}
|
|
58
|
+
// Build the chain from right to left
|
|
59
|
+
return allMiddleware.reduceRight((next, mw) => (ctx, args) => mw(ctx, args, () => next(ctx, args)), handler);
|
|
60
|
+
}
|
|
61
|
+
// ── Factory ──────────────────────────────────────────────
|
|
62
|
+
/**
|
|
63
|
+
* Create a compiled, frozen tool group from a declarative config.
|
|
64
|
+
*
|
|
65
|
+
* The returned object has O(1) action dispatch via a pre-built Map.
|
|
66
|
+
* All middleware chains are pre-composed at creation time — zero
|
|
67
|
+
* runtime overhead on each call.
|
|
68
|
+
*
|
|
69
|
+
* @typeParam TContext - Application context type
|
|
70
|
+
* @param config - Group configuration with actions
|
|
71
|
+
* @returns A frozen {@link CompiledGroup} ready for execution
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const tasks = createGroup({
|
|
76
|
+
* name: 'tasks',
|
|
77
|
+
* middleware: [logMiddleware],
|
|
78
|
+
* actions: {
|
|
79
|
+
* list: {
|
|
80
|
+
* readOnly: true,
|
|
81
|
+
* handler: async (ctx) => success(await ctx.db.tasks.findMany()),
|
|
82
|
+
* },
|
|
83
|
+
* create: {
|
|
84
|
+
* schema: z.object({ title: z.string() }),
|
|
85
|
+
* handler: async (ctx, args) => success(await ctx.db.tasks.create(args)),
|
|
86
|
+
* },
|
|
87
|
+
* },
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* const result = await tasks.execute(ctx, 'create', { title: 'Buy milk' });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export function createGroup(config) {
|
|
94
|
+
const globalMiddleware = config.middleware ?? [];
|
|
95
|
+
const actionNames = Object.keys(config.actions);
|
|
96
|
+
// Pre-compose middleware chains for each action (O(1) dispatch)
|
|
97
|
+
const dispatchMap = new Map();
|
|
98
|
+
for (const [name, action] of Object.entries(config.actions)) {
|
|
99
|
+
const compiled = composeMiddleware(globalMiddleware, action.middleware ?? [], action.handler);
|
|
100
|
+
dispatchMap.set(name, compiled);
|
|
101
|
+
}
|
|
102
|
+
// Pre-validate action args using Zod schemas
|
|
103
|
+
const schemaMap = new Map();
|
|
104
|
+
for (const [name, action] of Object.entries(config.actions)) {
|
|
105
|
+
if (action.schema) {
|
|
106
|
+
schemaMap.set(name, action.schema);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const execute = async (ctx, action, args) => {
|
|
110
|
+
const chain = dispatchMap.get(action);
|
|
111
|
+
if (!chain) {
|
|
112
|
+
return toolError(`Unknown action "${action}" in group "${config.name}". Available: ${actionNames.join(', ')}`, 'INVALID_PARAMS');
|
|
113
|
+
}
|
|
114
|
+
// Validate with Zod if schema is defined — use safeParse to return
|
|
115
|
+
// ToolResponse instead of throwing ZodError (contract compliance).
|
|
116
|
+
// Uses the consumer's schema as-is to respect their unknown-keys policy
|
|
117
|
+
// (.passthrough(), .strip(), or .strict()).
|
|
118
|
+
const schema = schemaMap.get(action);
|
|
119
|
+
if (schema) {
|
|
120
|
+
const result = schema.safeParse(args);
|
|
121
|
+
if (!result.success) {
|
|
122
|
+
const issues = result.error.issues
|
|
123
|
+
.map(i => `${i.path.join('.')}: ${i.message}`)
|
|
124
|
+
.join('; ');
|
|
125
|
+
return toolError(`Validation failed for action "${action}" in group "${config.name}": ${issues}`, 'INVALID_PARAMS');
|
|
126
|
+
}
|
|
127
|
+
// Use result.data to preserve Zod transforms, defaults, and strip behavior
|
|
128
|
+
return chain(ctx, result.data ?? args);
|
|
129
|
+
}
|
|
130
|
+
return chain(ctx, args);
|
|
131
|
+
};
|
|
132
|
+
const getAction = (name) => {
|
|
133
|
+
return config.actions[name];
|
|
134
|
+
};
|
|
135
|
+
return Object.freeze({
|
|
136
|
+
name: config.name,
|
|
137
|
+
description: config.description,
|
|
138
|
+
tags: Object.freeze(config.tags ?? []),
|
|
139
|
+
actionNames: Object.freeze(actionNames),
|
|
140
|
+
execute,
|
|
141
|
+
getAction,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=createGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGroup.js","sourceRoot":"","sources":["../../src/core/createGroup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAoC,MAAM,KAAK,CAAC;AACvD,OAAO,EAAqB,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAqB,MAAM,kBAAkB,CAAC;AAoErD,6DAA6D;AAE7D;;;;GAIG;AACH,SAAS,iBAAiB,CACtB,gBAA0C,EAC1C,gBAA0C,EAC1C,OAAgF;IAEhF,MAAM,aAAa,GAAG,CAAC,GAAG,gBAAgB,EAAE,GAAG,gBAAgB,CAAC,CAAC;IAEjE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,qCAAqC;IAC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AM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACtC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;QACvC,OAAO;QACP,SAAS;KACZ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConcurrencyGuard — Per-Tool Semaphore with Backpressure Queue
|
|
3
|
+
*
|
|
4
|
+
* Implements the Semaphore pattern to prevent thundering-herd scenarios
|
|
5
|
+
* where an LLM fires N concurrent tool calls in the same millisecond.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* ┌─────────────────────────────────────────────────┐
|
|
9
|
+
* │ Incoming tool call │
|
|
10
|
+
* │ │
|
|
11
|
+
* │ ┌───────────┐ slot free? ┌──────────────┐ │
|
|
12
|
+
* │ │ acquire() ├────YES────► │ run handler │ │
|
|
13
|
+
* │ │ │ └──────────────┘ │
|
|
14
|
+
* │ │ │ queue has ┌──────────────┐ │
|
|
15
|
+
* │ │ ├──space?──YES─►│ enqueue() │ │
|
|
16
|
+
* │ │ │ └──────────────┘ │
|
|
17
|
+
* │ │ │ both full ┌──────────────┐ │
|
|
18
|
+
* │ │ ├──────NO──────►│ load shedding│ │
|
|
19
|
+
* │ └───────────┘ └──────────────┘ │
|
|
20
|
+
* └─────────────────────────────────────────────────┘
|
|
21
|
+
*
|
|
22
|
+
* Properties:
|
|
23
|
+
* - Zero overhead when not configured (guard is `undefined`)
|
|
24
|
+
* - O(1) acquire/release with deque-based pending queue
|
|
25
|
+
* - Cooperative with AbortSignal: queued waiters are rejected on abort
|
|
26
|
+
* - Pure module: no side effects, no dependencies
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Concurrency configuration for a tool builder.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* createTool<AppContext>('billing')
|
|
37
|
+
* .concurrency({ maxActive: 5, maxQueue: 20 })
|
|
38
|
+
* .action({ name: 'process_invoice', handler: ... });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export interface ConcurrencyConfig {
|
|
42
|
+
/**
|
|
43
|
+
* Maximum number of concurrent executions allowed.
|
|
44
|
+
* When all slots are occupied, new calls enter the queue.
|
|
45
|
+
*
|
|
46
|
+
* @minimum 1
|
|
47
|
+
*/
|
|
48
|
+
readonly maxActive: number;
|
|
49
|
+
/**
|
|
50
|
+
* Maximum number of calls waiting in the backpressure queue.
|
|
51
|
+
* When the queue is full, new calls are immediately rejected
|
|
52
|
+
* with a load-shedding error.
|
|
53
|
+
*
|
|
54
|
+
* @minimum 0
|
|
55
|
+
* @default 0
|
|
56
|
+
*/
|
|
57
|
+
readonly maxQueue?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A concurrency guard that limits simultaneous tool executions.
|
|
61
|
+
*
|
|
62
|
+
* Created once per builder via `createConcurrencyGuard()`.
|
|
63
|
+
* Used by `GroupedToolBuilder.execute()` to gate entry.
|
|
64
|
+
*/
|
|
65
|
+
export declare class ConcurrencyGuard {
|
|
66
|
+
private readonly _maxActive;
|
|
67
|
+
private readonly _maxQueue;
|
|
68
|
+
private _active;
|
|
69
|
+
private readonly _pending;
|
|
70
|
+
constructor(config: ConcurrencyConfig);
|
|
71
|
+
/**
|
|
72
|
+
* Attempt to acquire an execution slot.
|
|
73
|
+
*
|
|
74
|
+
* - If a slot is free: increments active count, resolves immediately.
|
|
75
|
+
* - If queue has space: enqueues and returns a promise that resolves when a slot opens.
|
|
76
|
+
* - If both full: returns `null` (load shedding signal).
|
|
77
|
+
*
|
|
78
|
+
* @param signal - Optional AbortSignal for cooperative cancellation of queued waiters.
|
|
79
|
+
* @returns A release function (call when execution completes) or `null` for load shedding.
|
|
80
|
+
*/
|
|
81
|
+
acquire(signal?: AbortSignal): Promise<(() => void)> | null;
|
|
82
|
+
/**
|
|
83
|
+
* Current number of active (in-flight) executions.
|
|
84
|
+
*/
|
|
85
|
+
get active(): number;
|
|
86
|
+
/**
|
|
87
|
+
* Current number of waiters in the backpressure queue.
|
|
88
|
+
*/
|
|
89
|
+
get queued(): number;
|
|
90
|
+
private _createRelease;
|
|
91
|
+
private _drainNext;
|
|
92
|
+
private _removePending;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a ConcurrencyGuard from configuration.
|
|
96
|
+
*
|
|
97
|
+
* Returns `undefined` when no configuration is provided,
|
|
98
|
+
* ensuring zero overhead on the fast path.
|
|
99
|
+
*
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
export declare function createConcurrencyGuard(config?: ConcurrencyConfig): ConcurrencyGuard | undefined;
|
|
103
|
+
//# sourceMappingURL=ConcurrencyGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConcurrencyGuard.d.ts","sourceRoot":"","sources":["../../../src/core/execution/ConcurrencyGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC9B;AAUD;;;;;GAKG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;gBAEpC,MAAM,EAAE,iBAAiB;IAOrC;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI;IA6C3D;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAID,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,cAAc;CAMzB;AAID;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,CAAC,EAAE,iBAAiB,GAC3B,gBAAgB,GAAG,SAAS,CAG9B"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConcurrencyGuard — Per-Tool Semaphore with Backpressure Queue
|
|
3
|
+
*
|
|
4
|
+
* Implements the Semaphore pattern to prevent thundering-herd scenarios
|
|
5
|
+
* where an LLM fires N concurrent tool calls in the same millisecond.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* ┌─────────────────────────────────────────────────┐
|
|
9
|
+
* │ Incoming tool call │
|
|
10
|
+
* │ │
|
|
11
|
+
* │ ┌───────────┐ slot free? ┌──────────────┐ │
|
|
12
|
+
* │ │ acquire() ├────YES────► │ run handler │ │
|
|
13
|
+
* │ │ │ └──────────────┘ │
|
|
14
|
+
* │ │ │ queue has ┌──────────────┐ │
|
|
15
|
+
* │ │ ├──space?──YES─►│ enqueue() │ │
|
|
16
|
+
* │ │ │ └──────────────┘ │
|
|
17
|
+
* │ │ │ both full ┌──────────────┐ │
|
|
18
|
+
* │ │ ├──────NO──────►│ load shedding│ │
|
|
19
|
+
* │ └───────────┘ └──────────────┘ │
|
|
20
|
+
* └─────────────────────────────────────────────────┘
|
|
21
|
+
*
|
|
22
|
+
* Properties:
|
|
23
|
+
* - Zero overhead when not configured (guard is `undefined`)
|
|
24
|
+
* - O(1) acquire/release with deque-based pending queue
|
|
25
|
+
* - Cooperative with AbortSignal: queued waiters are rejected on abort
|
|
26
|
+
* - Pure module: no side effects, no dependencies
|
|
27
|
+
*
|
|
28
|
+
* @module
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* A concurrency guard that limits simultaneous tool executions.
|
|
33
|
+
*
|
|
34
|
+
* Created once per builder via `createConcurrencyGuard()`.
|
|
35
|
+
* Used by `GroupedToolBuilder.execute()` to gate entry.
|
|
36
|
+
*/
|
|
37
|
+
export class ConcurrencyGuard {
|
|
38
|
+
_maxActive;
|
|
39
|
+
_maxQueue;
|
|
40
|
+
_active = 0;
|
|
41
|
+
_pending = [];
|
|
42
|
+
constructor(config) {
|
|
43
|
+
this._maxActive = Math.max(1, Math.floor(config.maxActive));
|
|
44
|
+
this._maxQueue = Math.max(0, Math.floor(config.maxQueue ?? 0));
|
|
45
|
+
}
|
|
46
|
+
// ── Public API ───────────────────────────────────────
|
|
47
|
+
/**
|
|
48
|
+
* Attempt to acquire an execution slot.
|
|
49
|
+
*
|
|
50
|
+
* - If a slot is free: increments active count, resolves immediately.
|
|
51
|
+
* - If queue has space: enqueues and returns a promise that resolves when a slot opens.
|
|
52
|
+
* - If both full: returns `null` (load shedding signal).
|
|
53
|
+
*
|
|
54
|
+
* @param signal - Optional AbortSignal for cooperative cancellation of queued waiters.
|
|
55
|
+
* @returns A release function (call when execution completes) or `null` for load shedding.
|
|
56
|
+
*/
|
|
57
|
+
acquire(signal) {
|
|
58
|
+
// Fast path: slot available
|
|
59
|
+
if (this._active < this._maxActive) {
|
|
60
|
+
this._active++;
|
|
61
|
+
return Promise.resolve(this._createRelease());
|
|
62
|
+
}
|
|
63
|
+
// Queue path: check capacity
|
|
64
|
+
if (this._pending.length >= this._maxQueue) {
|
|
65
|
+
return null; // Load shedding
|
|
66
|
+
}
|
|
67
|
+
// Enqueue waiter
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
69
|
+
const waiter = {
|
|
70
|
+
resolve: () => resolve(this._createRelease()),
|
|
71
|
+
reject,
|
|
72
|
+
};
|
|
73
|
+
this._pending.push(waiter);
|
|
74
|
+
// If signal is already aborted, reject immediately
|
|
75
|
+
if (signal?.aborted) {
|
|
76
|
+
this._removePending(waiter);
|
|
77
|
+
reject(new Error('Request cancelled while queued.'));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// Listen for abort while queued
|
|
81
|
+
if (signal) {
|
|
82
|
+
const onAbort = () => {
|
|
83
|
+
this._removePending(waiter);
|
|
84
|
+
reject(new Error('Request cancelled while queued.'));
|
|
85
|
+
};
|
|
86
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
87
|
+
// Clean up listener when waiter resolves normally
|
|
88
|
+
const originalResolve = waiter.resolve;
|
|
89
|
+
waiter.resolve = () => {
|
|
90
|
+
signal.removeEventListener('abort', onAbort);
|
|
91
|
+
originalResolve();
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Current number of active (in-flight) executions.
|
|
98
|
+
*/
|
|
99
|
+
get active() {
|
|
100
|
+
return this._active;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Current number of waiters in the backpressure queue.
|
|
104
|
+
*/
|
|
105
|
+
get queued() {
|
|
106
|
+
return this._pending.length;
|
|
107
|
+
}
|
|
108
|
+
// ── Private ──────────────────────────────────────────
|
|
109
|
+
_createRelease() {
|
|
110
|
+
let released = false;
|
|
111
|
+
return () => {
|
|
112
|
+
if (released)
|
|
113
|
+
return; // Idempotent
|
|
114
|
+
released = true;
|
|
115
|
+
this._active--;
|
|
116
|
+
this._drainNext();
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
_drainNext() {
|
|
120
|
+
if (this._pending.length > 0 && this._active < this._maxActive) {
|
|
121
|
+
this._active++;
|
|
122
|
+
const next = this._pending.shift();
|
|
123
|
+
next.resolve();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
_removePending(waiter) {
|
|
127
|
+
const idx = this._pending.indexOf(waiter);
|
|
128
|
+
if (idx !== -1) {
|
|
129
|
+
this._pending.splice(idx, 1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// ── Factory ──────────────────────────────────────────────
|
|
134
|
+
/**
|
|
135
|
+
* Create a ConcurrencyGuard from configuration.
|
|
136
|
+
*
|
|
137
|
+
* Returns `undefined` when no configuration is provided,
|
|
138
|
+
* ensuring zero overhead on the fast path.
|
|
139
|
+
*
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
|
+
export function createConcurrencyGuard(config) {
|
|
143
|
+
if (!config)
|
|
144
|
+
return undefined;
|
|
145
|
+
return new ConcurrencyGuard(config);
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=ConcurrencyGuard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConcurrencyGuard.js","sourceRoot":"","sources":["../../../src/core/execution/ConcurrencyGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AA0CH;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IACR,UAAU,CAAS;IACnB,SAAS,CAAS;IAC3B,OAAO,GAAG,CAAC,CAAC;IACH,QAAQ,GAAoB,EAAE,CAAC;IAEhD,YAAY,MAAyB;QACjC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,wDAAwD;IAExD;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAoB;QACxB,4BAA4B;QAC5B,IAAI,IAAI,CAAC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gBAAgB,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EgressGuard — Payload Size Limiter (FinOps + OOM Shield)
|
|
3
|
+
*
|
|
4
|
+
* Prevents oversized tool responses from:
|
|
5
|
+
* 1. Crashing the Node process with OOM (JSON.stringify of 30MB)
|
|
6
|
+
* 2. Overflowing the LLM context window ($15 per wasted request)
|
|
7
|
+
* 3. Saturating the transport layer
|
|
8
|
+
*
|
|
9
|
+
* This is a **brute-force safety net** — the last line of defense.
|
|
10
|
+
* Presenter `.agentLimit()` is the domain-aware guard; this is the
|
|
11
|
+
* byte-level guard for when `.agentLimit()` is not configured.
|
|
12
|
+
*
|
|
13
|
+
* Architecture:
|
|
14
|
+
* ┌──────────────────────────────────────────────┐
|
|
15
|
+
* │ ToolResponse from handler/Presenter │
|
|
16
|
+
* │ │
|
|
17
|
+
* │ ┌──────────┐ within limit? ┌───────────┐ │
|
|
18
|
+
* │ │ measure ├────YES────────►│ pass-thru │ │
|
|
19
|
+
* │ │ bytes │ └───────────┘ │
|
|
20
|
+
* │ │ │ exceeds? ┌───────────┐ │
|
|
21
|
+
* │ │ ├────YES────────►│ truncate │ │
|
|
22
|
+
* │ └──────────┘ │ + inject │ │
|
|
23
|
+
* │ │ guidance │ │
|
|
24
|
+
* │ └───────────┘ │
|
|
25
|
+
* └──────────────────────────────────────────────┘
|
|
26
|
+
*
|
|
27
|
+
* Properties:
|
|
28
|
+
* - Zero overhead when not configured (guard returns input directly)
|
|
29
|
+
* - Measures byte length via Buffer.byteLength (UTF-8 accurate)
|
|
30
|
+
* - Truncates at the text level, preserving valid ToolResponse shape
|
|
31
|
+
* - Injects system intervention message for LLM self-correction
|
|
32
|
+
*
|
|
33
|
+
* @module
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
import { type ToolResponse } from '../response.js';
|
|
37
|
+
/**
|
|
38
|
+
* Egress guard configuration.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* registry.attachToServer(server, {
|
|
43
|
+
* contextFactory: createContext,
|
|
44
|
+
* maxPayloadBytes: 2 * 1024 * 1024, // 2MB safety net
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export interface EgressConfig {
|
|
49
|
+
/**
|
|
50
|
+
* Maximum total payload size in bytes.
|
|
51
|
+
* When a response exceeds this limit, the text content is
|
|
52
|
+
* truncated and a system intervention message is appended.
|
|
53
|
+
*
|
|
54
|
+
* @minimum 1024 (1KB minimum to avoid unusable responses)
|
|
55
|
+
*/
|
|
56
|
+
readonly maxPayloadBytes: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Apply egress guard to a ToolResponse.
|
|
60
|
+
*
|
|
61
|
+
* Measures the total byte length of all text content blocks.
|
|
62
|
+
* If the total exceeds `maxPayloadBytes`, truncates the LAST
|
|
63
|
+
* text block and appends a system intervention message.
|
|
64
|
+
*
|
|
65
|
+
* @param response - The ToolResponse to guard
|
|
66
|
+
* @param maxPayloadBytes - Maximum allowed bytes
|
|
67
|
+
* @returns The original response (if within limit) or a truncated copy
|
|
68
|
+
*
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export declare function applyEgressGuard(response: ToolResponse, maxPayloadBytes: number): ToolResponse;
|
|
72
|
+
//# sourceMappingURL=EgressGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EgressGuard.d.ts","sourceRoot":"","sources":["../../../src/core/execution/EgressGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CACpC;AAYD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC5B,QAAQ,EAAE,YAAY,EACtB,eAAe,EAAE,MAAM,GACxB,YAAY,CA6Ed"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EgressGuard — Payload Size Limiter (FinOps + OOM Shield)
|
|
3
|
+
*
|
|
4
|
+
* Prevents oversized tool responses from:
|
|
5
|
+
* 1. Crashing the Node process with OOM (JSON.stringify of 30MB)
|
|
6
|
+
* 2. Overflowing the LLM context window ($15 per wasted request)
|
|
7
|
+
* 3. Saturating the transport layer
|
|
8
|
+
*
|
|
9
|
+
* This is a **brute-force safety net** — the last line of defense.
|
|
10
|
+
* Presenter `.agentLimit()` is the domain-aware guard; this is the
|
|
11
|
+
* byte-level guard for when `.agentLimit()` is not configured.
|
|
12
|
+
*
|
|
13
|
+
* Architecture:
|
|
14
|
+
* ┌──────────────────────────────────────────────┐
|
|
15
|
+
* │ ToolResponse from handler/Presenter │
|
|
16
|
+
* │ │
|
|
17
|
+
* │ ┌──────────┐ within limit? ┌───────────┐ │
|
|
18
|
+
* │ │ measure ├────YES────────►│ pass-thru │ │
|
|
19
|
+
* │ │ bytes │ └───────────┘ │
|
|
20
|
+
* │ │ │ exceeds? ┌───────────┐ │
|
|
21
|
+
* │ │ ├────YES────────►│ truncate │ │
|
|
22
|
+
* │ └──────────┘ │ + inject │ │
|
|
23
|
+
* │ │ guidance │ │
|
|
24
|
+
* │ └───────────┘ │
|
|
25
|
+
* └──────────────────────────────────────────────┘
|
|
26
|
+
*
|
|
27
|
+
* Properties:
|
|
28
|
+
* - Zero overhead when not configured (guard returns input directly)
|
|
29
|
+
* - Measures byte length via Buffer.byteLength (UTF-8 accurate)
|
|
30
|
+
* - Truncates at the text level, preserving valid ToolResponse shape
|
|
31
|
+
* - Injects system intervention message for LLM self-correction
|
|
32
|
+
*
|
|
33
|
+
* @module
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
import {} from '../response.js';
|
|
37
|
+
// ── Constants ────────────────────────────────────────────
|
|
38
|
+
const MIN_PAYLOAD_BYTES = 1024;
|
|
39
|
+
const TRUNCATION_SUFFIX = '\n\n[SYSTEM INTERVENTION: Payload truncated at {limit} to prevent memory crash. ' +
|
|
40
|
+
'You MUST use pagination (limit/offset) or filters to retrieve smaller result sets.]';
|
|
41
|
+
// ── Guard Implementation ─────────────────────────────────
|
|
42
|
+
/**
|
|
43
|
+
* Apply egress guard to a ToolResponse.
|
|
44
|
+
*
|
|
45
|
+
* Measures the total byte length of all text content blocks.
|
|
46
|
+
* If the total exceeds `maxPayloadBytes`, truncates the LAST
|
|
47
|
+
* text block and appends a system intervention message.
|
|
48
|
+
*
|
|
49
|
+
* @param response - The ToolResponse to guard
|
|
50
|
+
* @param maxPayloadBytes - Maximum allowed bytes
|
|
51
|
+
* @returns The original response (if within limit) or a truncated copy
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
export function applyEgressGuard(response, maxPayloadBytes) {
|
|
56
|
+
const limit = Math.max(MIN_PAYLOAD_BYTES, maxPayloadBytes);
|
|
57
|
+
// Measure total byte length across all content blocks
|
|
58
|
+
let totalBytes = 0;
|
|
59
|
+
for (const block of response.content) {
|
|
60
|
+
totalBytes += byteLength(block.text);
|
|
61
|
+
}
|
|
62
|
+
// Fast path: within limit
|
|
63
|
+
if (totalBytes <= limit) {
|
|
64
|
+
return response;
|
|
65
|
+
}
|
|
66
|
+
// Truncation path: find how much to cut
|
|
67
|
+
const suffix = TRUNCATION_SUFFIX.replace('{limit}', formatBytes(limit));
|
|
68
|
+
const suffixBytes = byteLength(suffix);
|
|
69
|
+
const targetBytes = limit - suffixBytes;
|
|
70
|
+
if (targetBytes <= 0) {
|
|
71
|
+
// Edge case: limit is smaller than the suffix itself
|
|
72
|
+
return {
|
|
73
|
+
content: [{ type: 'text', text: suffix.trim() }],
|
|
74
|
+
isError: true,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// Truncate by rebuilding content blocks
|
|
78
|
+
let remainingBytes = targetBytes;
|
|
79
|
+
const truncatedContent = [];
|
|
80
|
+
for (const block of response.content) {
|
|
81
|
+
const blockBytes = byteLength(block.text);
|
|
82
|
+
if (remainingBytes <= 0) {
|
|
83
|
+
// Skip remaining blocks entirely
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (blockBytes <= remainingBytes) {
|
|
87
|
+
// Block fits entirely
|
|
88
|
+
truncatedContent.push({ type: 'text', text: block.text });
|
|
89
|
+
remainingBytes -= blockBytes;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// Block needs truncation — truncate at character boundary
|
|
93
|
+
const truncatedText = truncateToByteLimit(block.text, remainingBytes);
|
|
94
|
+
truncatedContent.push({ type: 'text', text: truncatedText + suffix });
|
|
95
|
+
remainingBytes = 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// If blocks were skipped (remainingBytes exhausted exactly at a block
|
|
99
|
+
// boundary), append the truncation suffix so the LLM knows content
|
|
100
|
+
// was removed. Without this, the response looks deceptively complete.
|
|
101
|
+
const allBlocksIncluded = truncatedContent.length === response.content.length;
|
|
102
|
+
if (!allBlocksIncluded && truncatedContent.length > 0) {
|
|
103
|
+
const last = truncatedContent[truncatedContent.length - 1];
|
|
104
|
+
if (!last.text.endsWith(suffix.trim())) {
|
|
105
|
+
truncatedContent[truncatedContent.length - 1] = {
|
|
106
|
+
type: 'text',
|
|
107
|
+
text: last.text + suffix,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Ensure at least one content block exists
|
|
112
|
+
if (truncatedContent.length === 0) {
|
|
113
|
+
truncatedContent.push({ type: 'text', text: suffix.trim() });
|
|
114
|
+
}
|
|
115
|
+
const result = {
|
|
116
|
+
content: truncatedContent,
|
|
117
|
+
};
|
|
118
|
+
if (response.isError) {
|
|
119
|
+
result.isError = true;
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
// ── Utilities ────────────────────────────────────────────
|
|
124
|
+
/**
|
|
125
|
+
* Get the UTF-8 byte length of a string.
|
|
126
|
+
* Uses TextEncoder for cross-platform compatibility.
|
|
127
|
+
*/
|
|
128
|
+
const encoder = new TextEncoder();
|
|
129
|
+
const decoder = new TextDecoder('utf-8', { fatal: false });
|
|
130
|
+
function byteLength(str) {
|
|
131
|
+
return encoder.encode(str).byteLength;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Truncate a string to fit within a byte limit.
|
|
135
|
+
* Respects multi-byte UTF-8 character boundaries by backtracking
|
|
136
|
+
* from the cut point to avoid producing U+FFFD replacement characters.
|
|
137
|
+
*/
|
|
138
|
+
function truncateToByteLimit(str, maxBytes) {
|
|
139
|
+
const encoded = encoder.encode(str);
|
|
140
|
+
if (encoded.byteLength <= maxBytes)
|
|
141
|
+
return str;
|
|
142
|
+
// Backtrack from the byte boundary to a valid UTF-8 sequence start.
|
|
143
|
+
// UTF-8 continuation bytes have the pattern 10xxxxxx (0x80..0xBF).
|
|
144
|
+
let end = maxBytes;
|
|
145
|
+
while (end > 0 && ((encoded[end] ?? 0) & 0xC0) === 0x80) {
|
|
146
|
+
end--;
|
|
147
|
+
}
|
|
148
|
+
const sliced = encoded.slice(0, end);
|
|
149
|
+
return decoder.decode(sliced);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Format bytes into a human-readable string.
|
|
153
|
+
*/
|
|
154
|
+
function formatBytes(bytes) {
|
|
155
|
+
if (bytes >= 1024 * 1024) {
|
|
156
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
157
|
+
}
|
|
158
|
+
if (bytes >= 1024) {
|
|
159
|
+
return `${(bytes / 1024).toFixed(0)}KB`;
|
|
160
|
+
}
|
|
161
|
+
return `${bytes}B`;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=EgressGuard.js.map
|
|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