@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,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResponseDecorator — Causal Invalidation Signal Injection
|
|
3
|
+
*
|
|
4
|
+
* Pure function. Single responsibility: prepend a `[System: ...]`
|
|
5
|
+
* content block to a tool call result when causal invalidation
|
|
6
|
+
* is triggered.
|
|
7
|
+
*
|
|
8
|
+
* The system block goes at **index 0** — a deliberate design choice:
|
|
9
|
+
* it survives response truncation and appears before the developer's
|
|
10
|
+
* payload, maximizing LLM attention.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* Before: [{ type: 'text', text: '{"ok": true}' }]
|
|
15
|
+
* After: [
|
|
16
|
+
* { type: 'text', text: '<cache_invalidation cause="sprints.update" domains="sprints.*" />' },
|
|
17
|
+
* { type: 'text', text: '{"ok": true}' },
|
|
18
|
+
* ]
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import type { ToolResponse } from '../core/response.js';
|
|
24
|
+
/**
|
|
25
|
+
* Prepend a System invalidation content block to a tool call response.
|
|
26
|
+
*
|
|
27
|
+
* @param result - The original tool call result (developer's response)
|
|
28
|
+
* @param patterns - Domain patterns that were invalidated (e.g. `['sprints.*']`)
|
|
29
|
+
* @param causedBy - The tool name that caused the invalidation
|
|
30
|
+
* @returns A new result with the System block at index 0
|
|
31
|
+
*/
|
|
32
|
+
export declare function decorateResponse(result: ToolResponse, patterns: readonly string[], causedBy: string): ToolResponse;
|
|
33
|
+
//# sourceMappingURL=ResponseDecorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponseDecorator.d.ts","sourceRoot":"","sources":["../../src/state-sync/ResponseDecorator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,QAAQ,EAAE,MAAM,GACjB,YAAY,CAUd"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { escapeXmlAttr } from '../core/response.js';
|
|
2
|
+
/**
|
|
3
|
+
* Prepend a System invalidation content block to a tool call response.
|
|
4
|
+
*
|
|
5
|
+
* @param result - The original tool call result (developer's response)
|
|
6
|
+
* @param patterns - Domain patterns that were invalidated (e.g. `['sprints.*']`)
|
|
7
|
+
* @param causedBy - The tool name that caused the invalidation
|
|
8
|
+
* @returns A new result with the System block at index 0
|
|
9
|
+
*/
|
|
10
|
+
export function decorateResponse(result, patterns, causedBy) {
|
|
11
|
+
const domains = patterns.join(', ');
|
|
12
|
+
return {
|
|
13
|
+
...result,
|
|
14
|
+
content: [
|
|
15
|
+
{ type: 'text', text: `<cache_invalidation cause="${escapeXmlAttr(causedBy)}" domains="${escapeXmlAttr(domains)}" />` },
|
|
16
|
+
...result.content,
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ResponseDecorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponseDecorator.js","sourceRoot":"","sources":["../../src/state-sync/ResponseDecorator.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC5B,MAAoB,EACpB,QAA2B,EAC3B,QAAgB;IAEhB,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpC,OAAO;QACH,GAAG,MAAM;QACT,OAAO,EAAE;YACL,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,8BAA8B,aAAa,CAAC,QAAQ,CAAC,cAAc,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;YAChI,GAAG,MAAM,CAAC,OAAO;SACpB;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type CacheDirective, type InvalidationEvent, type ResourceNotification } from './types.js';
|
|
2
|
+
import { StateSyncLayer } from './StateSyncLayer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Nested builder for configuring a single State Sync policy.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PolicyBuilder {
|
|
7
|
+
private _cacheControl?;
|
|
8
|
+
private _invalidates;
|
|
9
|
+
/**
|
|
10
|
+
* Mark matching tools as immutable (safe to cache forever).
|
|
11
|
+
* Use for reference data: countries, currencies, ICD-10 codes.
|
|
12
|
+
*/
|
|
13
|
+
cached(): this;
|
|
14
|
+
/**
|
|
15
|
+
* Mark matching tools as volatile (never cache).
|
|
16
|
+
* Use for dynamic data that changes on every call.
|
|
17
|
+
*/
|
|
18
|
+
stale(): this;
|
|
19
|
+
/**
|
|
20
|
+
* Declare which glob patterns are invalidated when these tools succeed.
|
|
21
|
+
*/
|
|
22
|
+
invalidates(...patterns: string[]): this;
|
|
23
|
+
/** @internal */
|
|
24
|
+
build(): {
|
|
25
|
+
cacheControl?: CacheDirective;
|
|
26
|
+
invalidates?: string[];
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Fluent builder for centralized State Sync configuration.
|
|
31
|
+
*
|
|
32
|
+
* Typically accessed via `f.stateSync()` in the `initVurb` instance.
|
|
33
|
+
*/
|
|
34
|
+
export declare class StateSyncBuilder {
|
|
35
|
+
private _policies;
|
|
36
|
+
private _defaults;
|
|
37
|
+
private _onInvalidation?;
|
|
38
|
+
private _notificationSink?;
|
|
39
|
+
private _cachedLayer?;
|
|
40
|
+
/**
|
|
41
|
+
* Set global default cache-control directives.
|
|
42
|
+
*
|
|
43
|
+
* Only cache-control directives are valid for defaults.
|
|
44
|
+
* Invalidation patterns are NOT allowed here — use `.policy()` instead.
|
|
45
|
+
*/
|
|
46
|
+
defaults(fn: (p: Omit<PolicyBuilder, 'invalidates'>) => void): this;
|
|
47
|
+
/**
|
|
48
|
+
* Add a scoped policy for matching tools using a fluent nested builder.
|
|
49
|
+
*
|
|
50
|
+
* @param match - Tool name or glob pattern (e.g. 'users.*', 'billing.create')
|
|
51
|
+
* @param fn - Callback to configure the policy
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* .policy('billing.*', p => p.noStore().invalidates('billing.*'))
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
policy(match: string, fn: (p: PolicyBuilder) => void): this;
|
|
59
|
+
/**
|
|
60
|
+
* Set a hook for observability when invalidations occur.
|
|
61
|
+
*/
|
|
62
|
+
onInvalidation(fn: (event: InvalidationEvent) => void): this;
|
|
63
|
+
/**
|
|
64
|
+
* Set the notification sink for protocol-level resource updates.
|
|
65
|
+
*/
|
|
66
|
+
notificationSink(fn: (notification: ResourceNotification) => void | Promise<void>): this;
|
|
67
|
+
/**
|
|
68
|
+
* Build the StateSyncLayer instance.
|
|
69
|
+
*/
|
|
70
|
+
build(): StateSyncLayer;
|
|
71
|
+
/**
|
|
72
|
+
* Shortcut for build() to align with other builders.
|
|
73
|
+
* Bug #114 fix: cache the result so `sync.layer === sync.layer` is true.
|
|
74
|
+
*/
|
|
75
|
+
get layer(): StateSyncLayer;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=StateSyncBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateSyncBuilder.d.ts","sourceRoot":"","s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Ac;IAevB;;;OAGG;IACH,IAAI,KAAK,mBAAiD;CAC7D"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {} from './types.js';
|
|
2
|
+
import { StateSyncLayer } from './StateSyncLayer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Nested builder for configuring a single State Sync policy.
|
|
5
|
+
*/
|
|
6
|
+
export class PolicyBuilder {
|
|
7
|
+
_cacheControl;
|
|
8
|
+
_invalidates = [];
|
|
9
|
+
/**
|
|
10
|
+
* Mark matching tools as immutable (safe to cache forever).
|
|
11
|
+
* Use for reference data: countries, currencies, ICD-10 codes.
|
|
12
|
+
*/
|
|
13
|
+
cached() {
|
|
14
|
+
this._cacheControl = 'immutable';
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Mark matching tools as volatile (never cache).
|
|
19
|
+
* Use for dynamic data that changes on every call.
|
|
20
|
+
*/
|
|
21
|
+
stale() {
|
|
22
|
+
this._cacheControl = 'no-store';
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Declare which glob patterns are invalidated when these tools succeed.
|
|
27
|
+
*/
|
|
28
|
+
invalidates(...patterns) {
|
|
29
|
+
this._invalidates = [...this._invalidates, ...patterns];
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
/** @internal */
|
|
33
|
+
build() {
|
|
34
|
+
const result = {};
|
|
35
|
+
if (this._cacheControl)
|
|
36
|
+
result.cacheControl = this._cacheControl;
|
|
37
|
+
if (this._invalidates.length > 0)
|
|
38
|
+
result.invalidates = this._invalidates;
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Fluent builder for centralized State Sync configuration.
|
|
44
|
+
*
|
|
45
|
+
* Typically accessed via `f.stateSync()` in the `initVurb` instance.
|
|
46
|
+
*/
|
|
47
|
+
export class StateSyncBuilder {
|
|
48
|
+
_policies = [];
|
|
49
|
+
_defaults = {};
|
|
50
|
+
_onInvalidation;
|
|
51
|
+
_notificationSink;
|
|
52
|
+
_cachedLayer; // Bug #114 fix
|
|
53
|
+
/**
|
|
54
|
+
* Set global default cache-control directives.
|
|
55
|
+
*
|
|
56
|
+
* Only cache-control directives are valid for defaults.
|
|
57
|
+
* Invalidation patterns are NOT allowed here — use `.policy()` instead.
|
|
58
|
+
*/
|
|
59
|
+
defaults(fn) {
|
|
60
|
+
const builder = new PolicyBuilder();
|
|
61
|
+
fn(builder);
|
|
62
|
+
const built = builder.build();
|
|
63
|
+
// Runtime guard: invalidates() is hidden by Omit<> at compile time
|
|
64
|
+
// but still callable at runtime — catch this mistake early.
|
|
65
|
+
if (built.invalidates && built.invalidates.length > 0) {
|
|
66
|
+
throw new Error('StateSyncBuilder.defaults(): invalidates() is not allowed in defaults. ' +
|
|
67
|
+
'Use .policy(match, p => p.invalidates(...)) for scoped invalidation.');
|
|
68
|
+
}
|
|
69
|
+
if (built.cacheControl) {
|
|
70
|
+
this._defaults.cacheControl = built.cacheControl;
|
|
71
|
+
}
|
|
72
|
+
this._cachedLayer = undefined;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Add a scoped policy for matching tools using a fluent nested builder.
|
|
77
|
+
*
|
|
78
|
+
* @param match - Tool name or glob pattern (e.g. 'users.*', 'billing.create')
|
|
79
|
+
* @param fn - Callback to configure the policy
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* .policy('billing.*', p => p.noStore().invalidates('billing.*'))
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
policy(match, fn) {
|
|
87
|
+
const builder = new PolicyBuilder();
|
|
88
|
+
fn(builder);
|
|
89
|
+
this._policies.push({ match, ...builder.build() });
|
|
90
|
+
this._cachedLayer = undefined;
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Set a hook for observability when invalidations occur.
|
|
95
|
+
*/
|
|
96
|
+
onInvalidation(fn) {
|
|
97
|
+
this._onInvalidation = fn;
|
|
98
|
+
this._cachedLayer = undefined;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Set the notification sink for protocol-level resource updates.
|
|
103
|
+
*/
|
|
104
|
+
notificationSink(fn) {
|
|
105
|
+
this._notificationSink = fn;
|
|
106
|
+
this._cachedLayer = undefined;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Build the StateSyncLayer instance.
|
|
111
|
+
*/
|
|
112
|
+
build() {
|
|
113
|
+
const config = {
|
|
114
|
+
policies: this._policies,
|
|
115
|
+
defaults: this._defaults,
|
|
116
|
+
};
|
|
117
|
+
if (this._onInvalidation)
|
|
118
|
+
config.onInvalidation = this._onInvalidation;
|
|
119
|
+
if (this._notificationSink)
|
|
120
|
+
config.notificationSink = this._notificationSink;
|
|
121
|
+
return new StateSyncLayer(config);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Shortcut for build() to align with other builders.
|
|
125
|
+
* Bug #114 fix: cache the result so `sync.layer === sync.layer` is true.
|
|
126
|
+
*/
|
|
127
|
+
get layer() { return this._cachedLayer ??= this.build(); }
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=StateSyncBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateSyncBuilder.js","sourceRoot":"","sources":["../../src/state-sync/StateSyncBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2F,MAAM,YAAY,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;GAEG;AACH,MAAM,OAAO,aAAa;IACd,aAAa,CAAkB;IAC/B,YAAY,GAAa,EAAE,CAAC;IAEpC;;;OAGG;IACH,MAAM;QACF,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;QACjC,OAAO,IAAI,CAAC;IAChB,CA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|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StateSyncLayer — Protocol Interception Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Thin orchestration layer that ties together the PolicyEngine,
|
|
5
|
+
* DescriptionDecorator, CausalEngine, and ResponseDecorator into
|
|
6
|
+
* a single, minimal interface consumed by {@link ServerAttachment}.
|
|
7
|
+
*
|
|
8
|
+
* This is **not** a middleware — it operates at the protocol layer,
|
|
9
|
+
* intercepting `tools/list` and `tools/call` responses to inject
|
|
10
|
+
* cache-control signals that prevent LLM Temporal Blindness and
|
|
11
|
+
* Causal State Drift.
|
|
12
|
+
*
|
|
13
|
+
* Performance: tool description decoration is cached — the regex +
|
|
14
|
+
* string concatenation + object spread only runs ONCE per unique
|
|
15
|
+
* tool name, not per `tools/list` request.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Created internally by ServerAttachment when stateSync is configured.
|
|
20
|
+
* // Not typically instantiated directly — use AttachOptions instead.
|
|
21
|
+
*
|
|
22
|
+
* registry.attachToServer(server, {
|
|
23
|
+
* stateSync: {
|
|
24
|
+
* defaults: { cacheControl: 'no-store' },
|
|
25
|
+
* policies: [
|
|
26
|
+
* { match: 'sprints.update', invalidates: ['sprints.*'] },
|
|
27
|
+
* { match: 'countries.*', cacheControl: 'immutable' },
|
|
28
|
+
* ],
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see {@link StateSyncConfig} for configuration options
|
|
34
|
+
* @see {@link PolicyEngine} for the resolution strategy
|
|
35
|
+
*
|
|
36
|
+
* @module
|
|
37
|
+
*/
|
|
38
|
+
import { type Tool as McpTool } from '@modelcontextprotocol/sdk/types.js';
|
|
39
|
+
import type { ToolResponse } from '../core/response.js';
|
|
40
|
+
import type { StateSyncConfig } from './types.js';
|
|
41
|
+
export declare class StateSyncLayer {
|
|
42
|
+
private readonly _engine;
|
|
43
|
+
private readonly _onInvalidation?;
|
|
44
|
+
private readonly _notificationSink?;
|
|
45
|
+
/**
|
|
46
|
+
* Per-tool-name cache of decorated McpTool objects.
|
|
47
|
+
*
|
|
48
|
+
* Since tool descriptions are stable between `tools/list` calls,
|
|
49
|
+
* we cache the decorated version per tool name. This avoids
|
|
50
|
+
* re-running the regex match, string concatenation, and object spread
|
|
51
|
+
* on every `tools/list` request — which is the hottest path since
|
|
52
|
+
* it runs at the start of every LLM conversation.
|
|
53
|
+
*
|
|
54
|
+
* The cache key is the tool name — tool definitions are immutable
|
|
55
|
+
* after registration, so the name alone is sufficient.
|
|
56
|
+
* Cache hit rate approaches 100%.
|
|
57
|
+
*/
|
|
58
|
+
private readonly _decoratedToolCache;
|
|
59
|
+
/**
|
|
60
|
+
* Construct a StateSyncLayer from user configuration.
|
|
61
|
+
*
|
|
62
|
+
* Eagerly validates all policies and defaults at construction time.
|
|
63
|
+
* If any policy is invalid, construction fails immediately with
|
|
64
|
+
* a descriptive error.
|
|
65
|
+
*
|
|
66
|
+
* @param config - State sync configuration (policies + optional defaults)
|
|
67
|
+
* @throws {Error} If any policy or default is invalid
|
|
68
|
+
*/
|
|
69
|
+
constructor(config: StateSyncConfig);
|
|
70
|
+
/**
|
|
71
|
+
* Decorate all tool descriptions with their resolved Cache-Control directives.
|
|
72
|
+
*
|
|
73
|
+
* Called during `tools/list` to append `[Cache-Control: X]` to each tool's
|
|
74
|
+
* description. Tools without a matching policy (and no defaults) are
|
|
75
|
+
* returned unchanged.
|
|
76
|
+
*
|
|
77
|
+
* Uses per-tool caching to avoid redundant decoration on repeated calls.
|
|
78
|
+
*
|
|
79
|
+
* @param tools - Original MCP tool definitions from the registry
|
|
80
|
+
* @returns Decorated tool definitions (cached shallow copies where modified)
|
|
81
|
+
*/
|
|
82
|
+
decorateTools(tools: McpTool[]): McpTool[];
|
|
83
|
+
/**
|
|
84
|
+
* Decorate a tool call response with causal invalidation signals.
|
|
85
|
+
*
|
|
86
|
+
* Called after every `tools/call` execution. If the tool's policy has
|
|
87
|
+
* `invalidates` patterns and the call succeeded (`isError !== true`),
|
|
88
|
+
* prepends a `[System: Cache invalidated for X — caused by Y]` block
|
|
89
|
+
* at content index 0.
|
|
90
|
+
*
|
|
91
|
+
* @param toolName - The name of the tool that was called
|
|
92
|
+
* @param result - The tool call result from the handler
|
|
93
|
+
* @returns Decorated result (with System block) or unchanged result
|
|
94
|
+
*/
|
|
95
|
+
decorateResult(toolName: string, result: ToolResponse): ToolResponse;
|
|
96
|
+
/**
|
|
97
|
+
* Return a cached decorated tool, or compute and cache it.
|
|
98
|
+
*
|
|
99
|
+
* Cache invalidation: tool definitions are immutable after registration
|
|
100
|
+
* in Vurb's ToolRegistry (builders produce new objects each time,
|
|
101
|
+
* but the content is stable). For safety, we use the tool name as
|
|
102
|
+
* the cache key — if the same tool name produces different descriptions
|
|
103
|
+
* across calls (which shouldn't happen), the first decoration wins.
|
|
104
|
+
*/
|
|
105
|
+
private _decorateToolCached;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=StateSyncLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateSyncLayer.d.ts","sourceRoot":"","sources":["../../src/state-sync/StateSyncLayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,KAAK,IAAI,IAAI,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAA2C,MAAM,YAAY,CAAC;AAM3F,qBAAa,cAAc;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAmD;IACpF,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAA6E;IAEhH;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA8B;IAElE;;;;;;;;;OASG;gBACS,MAAM,EAAE,eAAe;IAMnC;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE;IAI1C;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY;IAuCpE;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;CAQ9B"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StateSyncLayer — Protocol Interception Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Thin orchestration layer that ties together the PolicyEngine,
|
|
5
|
+
* DescriptionDecorator, CausalEngine, and ResponseDecorator into
|
|
6
|
+
* a single, minimal interface consumed by {@link ServerAttachment}.
|
|
7
|
+
*
|
|
8
|
+
* This is **not** a middleware — it operates at the protocol layer,
|
|
9
|
+
* intercepting `tools/list` and `tools/call` responses to inject
|
|
10
|
+
* cache-control signals that prevent LLM Temporal Blindness and
|
|
11
|
+
* Causal State Drift.
|
|
12
|
+
*
|
|
13
|
+
* Performance: tool description decoration is cached — the regex +
|
|
14
|
+
* string concatenation + object spread only runs ONCE per unique
|
|
15
|
+
* tool name, not per `tools/list` request.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Created internally by ServerAttachment when stateSync is configured.
|
|
20
|
+
* // Not typically instantiated directly — use AttachOptions instead.
|
|
21
|
+
*
|
|
22
|
+
* registry.attachToServer(server, {
|
|
23
|
+
* stateSync: {
|
|
24
|
+
* defaults: { cacheControl: 'no-store' },
|
|
25
|
+
* policies: [
|
|
26
|
+
* { match: 'sprints.update', invalidates: ['sprints.*'] },
|
|
27
|
+
* { match: 'countries.*', cacheControl: 'immutable' },
|
|
28
|
+
* ],
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see {@link StateSyncConfig} for configuration options
|
|
34
|
+
* @see {@link PolicyEngine} for the resolution strategy
|
|
35
|
+
*
|
|
36
|
+
* @module
|
|
37
|
+
*/
|
|
38
|
+
import {} from '@modelcontextprotocol/sdk/types.js';
|
|
39
|
+
import { PolicyEngine } from './PolicyEngine.js';
|
|
40
|
+
import { decorateDescription } from './DescriptionDecorator.js';
|
|
41
|
+
import { resolveInvalidations } from './CausalEngine.js';
|
|
42
|
+
import { decorateResponse } from './ResponseDecorator.js';
|
|
43
|
+
export class StateSyncLayer {
|
|
44
|
+
_engine;
|
|
45
|
+
_onInvalidation;
|
|
46
|
+
_notificationSink;
|
|
47
|
+
/**
|
|
48
|
+
* Per-tool-name cache of decorated McpTool objects.
|
|
49
|
+
*
|
|
50
|
+
* Since tool descriptions are stable between `tools/list` calls,
|
|
51
|
+
* we cache the decorated version per tool name. This avoids
|
|
52
|
+
* re-running the regex match, string concatenation, and object spread
|
|
53
|
+
* on every `tools/list` request — which is the hottest path since
|
|
54
|
+
* it runs at the start of every LLM conversation.
|
|
55
|
+
*
|
|
56
|
+
* The cache key is the tool name — tool definitions are immutable
|
|
57
|
+
* after registration, so the name alone is sufficient.
|
|
58
|
+
* Cache hit rate approaches 100%.
|
|
59
|
+
*/
|
|
60
|
+
_decoratedToolCache = new Map();
|
|
61
|
+
/**
|
|
62
|
+
* Construct a StateSyncLayer from user configuration.
|
|
63
|
+
*
|
|
64
|
+
* Eagerly validates all policies and defaults at construction time.
|
|
65
|
+
* If any policy is invalid, construction fails immediately with
|
|
66
|
+
* a descriptive error.
|
|
67
|
+
*
|
|
68
|
+
* @param config - State sync configuration (policies + optional defaults)
|
|
69
|
+
* @throws {Error} If any policy or default is invalid
|
|
70
|
+
*/
|
|
71
|
+
constructor(config) {
|
|
72
|
+
this._engine = new PolicyEngine(config.policies, config.defaults);
|
|
73
|
+
this._onInvalidation = config.onInvalidation;
|
|
74
|
+
this._notificationSink = config.notificationSink;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Decorate all tool descriptions with their resolved Cache-Control directives.
|
|
78
|
+
*
|
|
79
|
+
* Called during `tools/list` to append `[Cache-Control: X]` to each tool's
|
|
80
|
+
* description. Tools without a matching policy (and no defaults) are
|
|
81
|
+
* returned unchanged.
|
|
82
|
+
*
|
|
83
|
+
* Uses per-tool caching to avoid redundant decoration on repeated calls.
|
|
84
|
+
*
|
|
85
|
+
* @param tools - Original MCP tool definitions from the registry
|
|
86
|
+
* @returns Decorated tool definitions (cached shallow copies where modified)
|
|
87
|
+
*/
|
|
88
|
+
decorateTools(tools) {
|
|
89
|
+
return tools.map(tool => this._decorateToolCached(tool));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Decorate a tool call response with causal invalidation signals.
|
|
93
|
+
*
|
|
94
|
+
* Called after every `tools/call` execution. If the tool's policy has
|
|
95
|
+
* `invalidates` patterns and the call succeeded (`isError !== true`),
|
|
96
|
+
* prepends a `[System: Cache invalidated for X — caused by Y]` block
|
|
97
|
+
* at content index 0.
|
|
98
|
+
*
|
|
99
|
+
* @param toolName - The name of the tool that was called
|
|
100
|
+
* @param result - The tool call result from the handler
|
|
101
|
+
* @returns Decorated result (with System block) or unchanged result
|
|
102
|
+
*/
|
|
103
|
+
decorateResult(toolName, result) {
|
|
104
|
+
const policy = this._engine.resolve(toolName);
|
|
105
|
+
const invalidations = resolveInvalidations(policy, result.isError ?? false);
|
|
106
|
+
if (invalidations.length > 0) {
|
|
107
|
+
// Fire observability hook (sync, fire-and-forget)
|
|
108
|
+
if (this._onInvalidation) {
|
|
109
|
+
const event = {
|
|
110
|
+
causedBy: toolName,
|
|
111
|
+
patterns: invalidations,
|
|
112
|
+
timestamp: new Date().toISOString(),
|
|
113
|
+
};
|
|
114
|
+
try {
|
|
115
|
+
this._onInvalidation(event);
|
|
116
|
+
}
|
|
117
|
+
catch { /* observer must not break the pipeline */ }
|
|
118
|
+
}
|
|
119
|
+
// Emit protocol-level notifications (fire-and-forget, safe for async sinks)
|
|
120
|
+
if (this._notificationSink) {
|
|
121
|
+
for (const pattern of invalidations) {
|
|
122
|
+
const notification = {
|
|
123
|
+
method: 'notifications/resources/updated',
|
|
124
|
+
params: { uri: `vurb://stale/${pattern}` },
|
|
125
|
+
};
|
|
126
|
+
try {
|
|
127
|
+
const maybePromise = this._notificationSink(notification);
|
|
128
|
+
if (maybePromise instanceof Promise) {
|
|
129
|
+
maybePromise.catch(() => { });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch { /* swallow sync errors — best-effort */ }
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return decorateResponse(result, invalidations, toolName);
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
// ── Private ──────────────────────────────────────────
|
|
140
|
+
/**
|
|
141
|
+
* Return a cached decorated tool, or compute and cache it.
|
|
142
|
+
*
|
|
143
|
+
* Cache invalidation: tool definitions are immutable after registration
|
|
144
|
+
* in Vurb's ToolRegistry (builders produce new objects each time,
|
|
145
|
+
* but the content is stable). For safety, we use the tool name as
|
|
146
|
+
* the cache key — if the same tool name produces different descriptions
|
|
147
|
+
* across calls (which shouldn't happen), the first decoration wins.
|
|
148
|
+
*/
|
|
149
|
+
_decorateToolCached(tool) {
|
|
150
|
+
const cached = this._decoratedToolCache.get(tool.name);
|
|
151
|
+
if (cached)
|
|
152
|
+
return cached;
|
|
153
|
+
const decorated = decorateDescription(tool, this._engine.resolve(tool.name));
|
|
154
|
+
this._decoratedToolCache.set(tool.name, decorated);
|
|
155
|
+
return decorated;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=StateSyncLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateSyncLayer.js","sourceRoot":"","sources":["../../src/state-sync/StateSyncLayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;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CAAC,CAAC;QAC7E,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACnD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State Sync — Public API
|
|
3
|
+
*
|
|
4
|
+
* Epistemic cache-control layer for MCP tool routing.
|
|
5
|
+
* Prevents LLM Temporal Blindness and Causal State Drift via
|
|
6
|
+
* RFC 7234 semantics and coarse-grained causal domain invalidation.
|
|
7
|
+
*
|
|
8
|
+
* **Consumer API:**
|
|
9
|
+
* - {@link StateSyncConfig} — Configuration type (passed to `attachToServer`)
|
|
10
|
+
* - {@link StateSyncLayer} — Orchestrator (used internally by ServerAttachment)
|
|
11
|
+
*
|
|
12
|
+
* Pure functions and PolicyEngine are exported for advanced use cases
|
|
13
|
+
* (custom pipelines, testing) but are not needed for standard usage.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link StateSyncLayer} for the orchestration facade
|
|
16
|
+
* @see {@link StateSyncConfig} for configuration options
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
export { StateSyncLayer } from './StateSyncLayer.js';
|
|
21
|
+
export { StateSyncBuilder, PolicyBuilder } from './StateSyncBuilder.js';
|
|
22
|
+
export type { CacheDirective, SyncPolicy, StateSyncConfig, ResolvedPolicy, InvalidationEvent, ResourceNotification, } from './types.js';
|
|
23
|
+
export { PolicyEngine } from './PolicyEngine.js';
|
|
24
|
+
export { matchGlob } from './GlobMatcher.js';
|
|
25
|
+
export { detectOverlaps } from './PolicyValidator.js';
|
|
26
|
+
export type { OverlapWarning } from './PolicyValidator.js';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state-sync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGxE,YAAY,EACR,cAAc,EACd,UAAU,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GACvB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State Sync — Public API
|
|
3
|
+
*
|
|
4
|
+
* Epistemic cache-control layer for MCP tool routing.
|
|
5
|
+
* Prevents LLM Temporal Blindness and Causal State Drift via
|
|
6
|
+
* RFC 7234 semantics and coarse-grained causal domain invalidation.
|
|
7
|
+
*
|
|
8
|
+
* **Consumer API:**
|
|
9
|
+
* - {@link StateSyncConfig} — Configuration type (passed to `attachToServer`)
|
|
10
|
+
* - {@link StateSyncLayer} — Orchestrator (used internally by ServerAttachment)
|
|
11
|
+
*
|
|
12
|
+
* Pure functions and PolicyEngine are exported for advanced use cases
|
|
13
|
+
* (custom pipelines, testing) but are not needed for standard usage.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link StateSyncLayer} for the orchestration facade
|
|
16
|
+
* @see {@link StateSyncConfig} for configuration options
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
// ── Orchestrator (primary export) ────────────────────────
|
|
21
|
+
export { StateSyncLayer } from './StateSyncLayer.js';
|
|
22
|
+
export { StateSyncBuilder, PolicyBuilder } from './StateSyncBuilder.js';
|
|
23
|
+
// ── Infrastructure (advanced usage) ──────────────────────
|
|
24
|
+
export { PolicyEngine } from './PolicyEngine.js';
|
|
25
|
+
export { matchGlob } from './GlobMatcher.js';
|
|
26
|
+
export { detectOverlaps } from './PolicyValidator.js';
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state-sync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,4DAA4D;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAYxE,4DAA4D;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|