@syrin/cli 1.3.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/LICENSE +15 -0
- package/README.md +302 -0
- package/dist/cli/commands/analyse.d.ts +16 -0
- package/dist/cli/commands/analyse.js +61 -0
- package/dist/cli/commands/dev.d.ts +23 -0
- package/dist/cli/commands/dev.js +419 -0
- package/dist/cli/commands/doctor.d.ts +10 -0
- package/dist/cli/commands/doctor.js +195 -0
- package/dist/cli/commands/index.d.ts +12 -0
- package/dist/cli/commands/index.js +12 -0
- package/dist/cli/commands/init.d.ts +16 -0
- package/dist/cli/commands/init.js +90 -0
- package/dist/cli/commands/list.d.ts +15 -0
- package/dist/cli/commands/list.js +50 -0
- package/dist/cli/commands/rollback.d.ts +12 -0
- package/dist/cli/commands/rollback.js +101 -0
- package/dist/cli/commands/test.d.ts +31 -0
- package/dist/cli/commands/test.js +88 -0
- package/dist/cli/commands/update.d.ts +9 -0
- package/dist/cli/commands/update.js +76 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.js +342 -0
- package/dist/cli/prompts/index.d.ts +5 -0
- package/dist/cli/prompts/index.js +5 -0
- package/dist/cli/prompts/init-prompt.d.ts +17 -0
- package/dist/cli/prompts/init-prompt.js +263 -0
- package/dist/cli/utils/command-error-handler.d.ts +14 -0
- package/dist/cli/utils/command-error-handler.js +35 -0
- package/dist/cli/utils/common-types.d.ts +24 -0
- package/dist/cli/utils/common-types.js +6 -0
- package/dist/cli/utils/connection-handler.d.ts +37 -0
- package/dist/cli/utils/connection-handler.js +90 -0
- package/dist/cli/utils/index.d.ts +11 -0
- package/dist/cli/utils/index.js +11 -0
- package/dist/cli/utils/option-parsers.d.ts +41 -0
- package/dist/cli/utils/option-parsers.js +92 -0
- package/dist/cli/utils/output-utils.d.ts +12 -0
- package/dist/cli/utils/output-utils.js +21 -0
- package/dist/cli/utils/transport-resolver.d.ts +33 -0
- package/dist/cli/utils/transport-resolver.js +82 -0
- package/dist/cli/utils/version-banner.d.ts +10 -0
- package/dist/cli/utils/version-banner.js +26 -0
- package/dist/config/env-checker.d.ts +37 -0
- package/dist/config/env-checker.js +136 -0
- package/dist/config/generator.d.ts +19 -0
- package/dist/config/generator.js +196 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +9 -0
- package/dist/config/loader.d.ts +19 -0
- package/dist/config/loader.js +57 -0
- package/dist/config/schema.d.ts +42 -0
- package/dist/config/schema.js +181 -0
- package/dist/config/syrin.template.yaml +127 -0
- package/dist/config/types.d.ts +87 -0
- package/dist/config/types.js +6 -0
- package/dist/constants/app.d.ts +9 -0
- package/dist/constants/app.js +9 -0
- package/dist/constants/commands.d.ts +43 -0
- package/dist/constants/commands.js +43 -0
- package/dist/constants/defaults.d.ts +18 -0
- package/dist/constants/defaults.js +18 -0
- package/dist/constants/env-vars.d.ts +11 -0
- package/dist/constants/env-vars.js +11 -0
- package/dist/constants/icons.d.ts +23 -0
- package/dist/constants/icons.js +23 -0
- package/dist/constants/index.d.ts +17 -0
- package/dist/constants/index.js +17 -0
- package/dist/constants/labels.d.ts +38 -0
- package/dist/constants/labels.js +42 -0
- package/dist/constants/links.d.ts +10 -0
- package/dist/constants/links.js +11 -0
- package/dist/constants/list.d.ts +10 -0
- package/dist/constants/list.js +9 -0
- package/dist/constants/llm.d.ts +26 -0
- package/dist/constants/llm.js +25 -0
- package/dist/constants/messages.d.ts +107 -0
- package/dist/constants/messages.js +138 -0
- package/dist/constants/paths.d.ts +29 -0
- package/dist/constants/paths.js +29 -0
- package/dist/constants/transport.d.ts +9 -0
- package/dist/constants/transport.js +8 -0
- package/dist/events/emitter.d.ts +64 -0
- package/dist/events/emitter.js +142 -0
- package/dist/events/event-type.d.ts +66 -0
- package/dist/events/event-type.js +81 -0
- package/dist/events/payloads/diagnostics.d.ts +24 -0
- package/dist/events/payloads/diagnostics.js +5 -0
- package/dist/events/payloads/index.d.ts +15 -0
- package/dist/events/payloads/index.js +6 -0
- package/dist/events/payloads/llm.d.ts +58 -0
- package/dist/events/payloads/llm.js +6 -0
- package/dist/events/payloads/registry.d.ts +28 -0
- package/dist/events/payloads/registry.js +5 -0
- package/dist/events/payloads/session.d.ts +32 -0
- package/dist/events/payloads/session.js +5 -0
- package/dist/events/payloads/testing.d.ts +17 -0
- package/dist/events/payloads/testing.js +5 -0
- package/dist/events/payloads/tool.d.ts +29 -0
- package/dist/events/payloads/tool.js +5 -0
- package/dist/events/payloads/transport.d.ts +30 -0
- package/dist/events/payloads/transport.js +5 -0
- package/dist/events/payloads/validation.d.ts +37 -0
- package/dist/events/payloads/validation.js +5 -0
- package/dist/events/payloads/workflow.d.ts +45 -0
- package/dist/events/payloads/workflow.js +5 -0
- package/dist/events/store/file-store.d.ts +37 -0
- package/dist/events/store/file-store.js +113 -0
- package/dist/events/store/index.d.ts +7 -0
- package/dist/events/store/index.js +6 -0
- package/dist/events/store/memory-store.d.ts +26 -0
- package/dist/events/store/memory-store.js +39 -0
- package/dist/events/store.d.ts +11 -0
- package/dist/events/store.js +2 -0
- package/dist/events/types.d.ts +14 -0
- package/dist/events/types.js +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +30 -0
- package/dist/presentation/analysis-ui.d.ts +24 -0
- package/dist/presentation/analysis-ui.js +158 -0
- package/dist/presentation/dev/chat-ui-types.d.ts +68 -0
- package/dist/presentation/dev/chat-ui-types.js +5 -0
- package/dist/presentation/dev/chat-ui.d.ts +61 -0
- package/dist/presentation/dev/chat-ui.js +714 -0
- package/dist/presentation/dev/components/assistant-message.d.ts +19 -0
- package/dist/presentation/dev/components/assistant-message.js +36 -0
- package/dist/presentation/dev/components/header.d.ts +16 -0
- package/dist/presentation/dev/components/header.js +22 -0
- package/dist/presentation/dev/components/index.d.ts +13 -0
- package/dist/presentation/dev/components/index.js +13 -0
- package/dist/presentation/dev/components/input-panel.d.ts +22 -0
- package/dist/presentation/dev/components/input-panel.js +43 -0
- package/dist/presentation/dev/components/message-component.d.ts +16 -0
- package/dist/presentation/dev/components/message-component.js +51 -0
- package/dist/presentation/dev/components/messages-list.d.ts +24 -0
- package/dist/presentation/dev/components/messages-list.js +48 -0
- package/dist/presentation/dev/components/system-message.d.ts +16 -0
- package/dist/presentation/dev/components/system-message.js +26 -0
- package/dist/presentation/dev/components/user-message.d.ts +21 -0
- package/dist/presentation/dev/components/user-message.js +35 -0
- package/dist/presentation/dev/components/welcome-banner.d.ts +24 -0
- package/dist/presentation/dev/components/welcome-banner.js +146 -0
- package/dist/presentation/dev/goodbye-messages.d.ts +31 -0
- package/dist/presentation/dev/goodbye-messages.js +100 -0
- package/dist/presentation/dev/index.d.ts +5 -0
- package/dist/presentation/dev/index.js +5 -0
- package/dist/presentation/dev/text-wrapper.d.ts +30 -0
- package/dist/presentation/dev/text-wrapper.js +74 -0
- package/dist/presentation/dev-ui.d.ts +33 -0
- package/dist/presentation/dev-ui.js +246 -0
- package/dist/presentation/doctor-ui.d.ts +40 -0
- package/dist/presentation/doctor-ui.js +157 -0
- package/dist/presentation/init-ui.d.ts +14 -0
- package/dist/presentation/init-ui.js +41 -0
- package/dist/presentation/list-ui.d.ts +44 -0
- package/dist/presentation/list-ui.js +139 -0
- package/dist/presentation/test-ui.d.ts +49 -0
- package/dist/presentation/test-ui.js +358 -0
- package/dist/runtime/analysis/analyser.d.ts +14 -0
- package/dist/runtime/analysis/analyser.js +88 -0
- package/dist/runtime/analysis/dependencies.d.ts +10 -0
- package/dist/runtime/analysis/dependencies.js +140 -0
- package/dist/runtime/analysis/index.d.ts +10 -0
- package/dist/runtime/analysis/index.js +10 -0
- package/dist/runtime/analysis/indexer.d.ts +10 -0
- package/dist/runtime/analysis/indexer.js +62 -0
- package/dist/runtime/analysis/loader.d.ts +15 -0
- package/dist/runtime/analysis/loader.js +47 -0
- package/dist/runtime/analysis/normalizer.d.ts +14 -0
- package/dist/runtime/analysis/normalizer.js +184 -0
- package/dist/runtime/analysis/rules/__test-helpers__.d.ts +18 -0
- package/dist/runtime/analysis/rules/__test-helpers__.js +40 -0
- package/dist/runtime/analysis/rules/base.d.ts +38 -0
- package/dist/runtime/analysis/rules/base.js +23 -0
- package/dist/runtime/analysis/rules/error-codes.d.ts +64 -0
- package/dist/runtime/analysis/rules/error-codes.js +73 -0
- package/dist/runtime/analysis/rules/errors/e000-tool-not-found.d.ts +35 -0
- package/dist/runtime/analysis/rules/errors/e000-tool-not-found.js +32 -0
- package/dist/runtime/analysis/rules/errors/e001-missing-output-schema.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e001-missing-output-schema.js +30 -0
- package/dist/runtime/analysis/rules/errors/e002-underspecified-input.d.ts +24 -0
- package/dist/runtime/analysis/rules/errors/e002-underspecified-input.js +52 -0
- package/dist/runtime/analysis/rules/errors/e003-type-mismatch.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e003-type-mismatch.js +73 -0
- package/dist/runtime/analysis/rules/errors/e004-free-text-propagation.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e004-free-text-propagation.js +47 -0
- package/dist/runtime/analysis/rules/errors/e005-tool-ambiguity.d.ts +25 -0
- package/dist/runtime/analysis/rules/errors/e005-tool-ambiguity.js +73 -0
- package/dist/runtime/analysis/rules/errors/e006-param-not-in-description.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e006-param-not-in-description.js +57 -0
- package/dist/runtime/analysis/rules/errors/e007-output-not-guaranteed.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e007-output-not-guaranteed.js +56 -0
- package/dist/runtime/analysis/rules/errors/e008-circular-dependency.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e008-circular-dependency.js +84 -0
- package/dist/runtime/analysis/rules/errors/e009-implicit-user-input.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e009-implicit-user-input.js +89 -0
- package/dist/runtime/analysis/rules/errors/e010-non-serializable.d.ts +25 -0
- package/dist/runtime/analysis/rules/errors/e010-non-serializable.js +46 -0
- package/dist/runtime/analysis/rules/errors/e011-missing-tool-description.d.ts +24 -0
- package/dist/runtime/analysis/rules/errors/e011-missing-tool-description.js +33 -0
- package/dist/runtime/analysis/rules/errors/e012-side-effect-detected.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e012-side-effect-detected.js +40 -0
- package/dist/runtime/analysis/rules/errors/e013-non-deterministic-output.d.ts +37 -0
- package/dist/runtime/analysis/rules/errors/e013-non-deterministic-output.js +34 -0
- package/dist/runtime/analysis/rules/errors/e013-output-explosion.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e013-output-explosion.js +36 -0
- package/dist/runtime/analysis/rules/errors/e014-hidden-dependency.d.ts +42 -0
- package/dist/runtime/analysis/rules/errors/e014-hidden-dependency.js +46 -0
- package/dist/runtime/analysis/rules/errors/e014-output-explosion.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e014-output-explosion.js +36 -0
- package/dist/runtime/analysis/rules/errors/e015-hidden-dependency.d.ts +42 -0
- package/dist/runtime/analysis/rules/errors/e015-hidden-dependency.js +46 -0
- package/dist/runtime/analysis/rules/errors/e015-unbounded-execution.d.ts +44 -0
- package/dist/runtime/analysis/rules/errors/e015-unbounded-execution.js +66 -0
- package/dist/runtime/analysis/rules/errors/e016-output-validation-failed.d.ts +43 -0
- package/dist/runtime/analysis/rules/errors/e016-output-validation-failed.js +42 -0
- package/dist/runtime/analysis/rules/errors/e016-unbounded-execution.d.ts +44 -0
- package/dist/runtime/analysis/rules/errors/e016-unbounded-execution.js +66 -0
- package/dist/runtime/analysis/rules/errors/e017-input-validation-failed.d.ts +57 -0
- package/dist/runtime/analysis/rules/errors/e017-input-validation-failed.js +80 -0
- package/dist/runtime/analysis/rules/errors/e017-output-validation-failed.d.ts +43 -0
- package/dist/runtime/analysis/rules/errors/e017-output-validation-failed.js +42 -0
- package/dist/runtime/analysis/rules/errors/e018-input-validation-failed.d.ts +57 -0
- package/dist/runtime/analysis/rules/errors/e018-input-validation-failed.js +80 -0
- package/dist/runtime/analysis/rules/errors/e018-tool-execution-failed.d.ts +38 -0
- package/dist/runtime/analysis/rules/errors/e018-tool-execution-failed.js +37 -0
- package/dist/runtime/analysis/rules/errors/e019-tool-execution-failed.d.ts +38 -0
- package/dist/runtime/analysis/rules/errors/e019-tool-execution-failed.js +37 -0
- package/dist/runtime/analysis/rules/errors/e019-unexpected-test-result.d.ts +65 -0
- package/dist/runtime/analysis/rules/errors/e019-unexpected-test-result.js +109 -0
- package/dist/runtime/analysis/rules/errors/e020-unexpected-test-result.d.ts +65 -0
- package/dist/runtime/analysis/rules/errors/e020-unexpected-test-result.js +109 -0
- package/dist/runtime/analysis/rules/errors/e100-missing-output-schema.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e100-missing-output-schema.js +30 -0
- package/dist/runtime/analysis/rules/errors/e101-missing-tool-description.d.ts +24 -0
- package/dist/runtime/analysis/rules/errors/e101-missing-tool-description.js +33 -0
- package/dist/runtime/analysis/rules/errors/e102-underspecified-input.d.ts +24 -0
- package/dist/runtime/analysis/rules/errors/e102-underspecified-input.js +52 -0
- package/dist/runtime/analysis/rules/errors/e103-type-mismatch.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e103-type-mismatch.js +72 -0
- package/dist/runtime/analysis/rules/errors/e104-param-not-in-description.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e104-param-not-in-description.js +57 -0
- package/dist/runtime/analysis/rules/errors/e105-free-text-propagation.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e105-free-text-propagation.js +47 -0
- package/dist/runtime/analysis/rules/errors/e106-output-not-guaranteed.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e106-output-not-guaranteed.js +58 -0
- package/dist/runtime/analysis/rules/errors/e107-circular-dependency.d.ts +22 -0
- package/dist/runtime/analysis/rules/errors/e107-circular-dependency.js +84 -0
- package/dist/runtime/analysis/rules/errors/e108-implicit-user-input.d.ts +23 -0
- package/dist/runtime/analysis/rules/errors/e108-implicit-user-input.js +94 -0
- package/dist/runtime/analysis/rules/errors/e109-non-serializable.d.ts +25 -0
- package/dist/runtime/analysis/rules/errors/e109-non-serializable.js +44 -0
- package/dist/runtime/analysis/rules/errors/e110-tool-ambiguity.d.ts +25 -0
- package/dist/runtime/analysis/rules/errors/e110-tool-ambiguity.js +73 -0
- package/dist/runtime/analysis/rules/errors/e200-input-validation-failed.d.ts +57 -0
- package/dist/runtime/analysis/rules/errors/e200-input-validation-failed.js +71 -0
- package/dist/runtime/analysis/rules/errors/e300-output-validation-failed.d.ts +43 -0
- package/dist/runtime/analysis/rules/errors/e300-output-validation-failed.js +44 -0
- package/dist/runtime/analysis/rules/errors/e301-output-explosion.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e301-output-explosion.js +36 -0
- package/dist/runtime/analysis/rules/errors/e400-tool-execution-failed.d.ts +38 -0
- package/dist/runtime/analysis/rules/errors/e400-tool-execution-failed.js +37 -0
- package/dist/runtime/analysis/rules/errors/e403-unbounded-execution.d.ts +44 -0
- package/dist/runtime/analysis/rules/errors/e403-unbounded-execution.js +66 -0
- package/dist/runtime/analysis/rules/errors/e500-side-effect-detected.d.ts +39 -0
- package/dist/runtime/analysis/rules/errors/e500-side-effect-detected.js +40 -0
- package/dist/runtime/analysis/rules/errors/e501-hidden-dependency.d.ts +47 -0
- package/dist/runtime/analysis/rules/errors/e501-hidden-dependency.js +46 -0
- package/dist/runtime/analysis/rules/errors/e600-unexpected-test-result.d.ts +65 -0
- package/dist/runtime/analysis/rules/errors/e600-unexpected-test-result.js +109 -0
- package/dist/runtime/analysis/rules/index.d.ts +18 -0
- package/dist/runtime/analysis/rules/index.js +94 -0
- package/dist/runtime/analysis/rules/warnings/w001-implicit-dependency.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w001-implicit-dependency.js +39 -0
- package/dist/runtime/analysis/rules/warnings/w002-free-text-without-normalization.d.ts +24 -0
- package/dist/runtime/analysis/rules/warnings/w002-free-text-without-normalization.js +40 -0
- package/dist/runtime/analysis/rules/warnings/w003-missing-examples.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w003-missing-examples.js +84 -0
- package/dist/runtime/analysis/rules/warnings/w004-overloaded-responsibility.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w004-overloaded-responsibility.js +96 -0
- package/dist/runtime/analysis/rules/warnings/w005-generic-description.d.ts +53 -0
- package/dist/runtime/analysis/rules/warnings/w005-generic-description.js +108 -0
- package/dist/runtime/analysis/rules/warnings/w006-optional-as-required.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w006-optional-as-required.js +44 -0
- package/dist/runtime/analysis/rules/warnings/w007-broad-output-schema.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w007-broad-output-schema.js +37 -0
- package/dist/runtime/analysis/rules/warnings/w008-multiple-entry-points.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w008-multiple-entry-points.js +97 -0
- package/dist/runtime/analysis/rules/warnings/w009-hidden-side-effects.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w009-hidden-side-effects.js +88 -0
- package/dist/runtime/analysis/rules/warnings/w010-output-not-reusable.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w010-output-not-reusable.js +81 -0
- package/dist/runtime/analysis/rules/warnings/w021-weak-schema.d.ts +40 -0
- package/dist/runtime/analysis/rules/warnings/w021-weak-schema.js +32 -0
- package/dist/runtime/analysis/rules/warnings/w022-high-entropy-output.d.ts +39 -0
- package/dist/runtime/analysis/rules/warnings/w022-high-entropy-output.js +36 -0
- package/dist/runtime/analysis/rules/warnings/w023-unstable-defaults.d.ts +38 -0
- package/dist/runtime/analysis/rules/warnings/w023-unstable-defaults.js +36 -0
- package/dist/runtime/analysis/rules/warnings/w100-implicit-dependency.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w100-implicit-dependency.js +89 -0
- package/dist/runtime/analysis/rules/warnings/w101-free-text-without-normalization.d.ts +24 -0
- package/dist/runtime/analysis/rules/warnings/w101-free-text-without-normalization.js +40 -0
- package/dist/runtime/analysis/rules/warnings/w102-missing-examples.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w102-missing-examples.js +76 -0
- package/dist/runtime/analysis/rules/warnings/w103-overloaded-responsibility.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w103-overloaded-responsibility.js +91 -0
- package/dist/runtime/analysis/rules/warnings/w104-generic-description.d.ts +53 -0
- package/dist/runtime/analysis/rules/warnings/w104-generic-description.js +108 -0
- package/dist/runtime/analysis/rules/warnings/w105-optional-as-required.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w105-optional-as-required.js +45 -0
- package/dist/runtime/analysis/rules/warnings/w106-broad-output-schema.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w106-broad-output-schema.js +37 -0
- package/dist/runtime/analysis/rules/warnings/w107-multiple-entry-points.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w107-multiple-entry-points.js +97 -0
- package/dist/runtime/analysis/rules/warnings/w108-hidden-side-effects.d.ts +23 -0
- package/dist/runtime/analysis/rules/warnings/w108-hidden-side-effects.js +94 -0
- package/dist/runtime/analysis/rules/warnings/w109-output-not-reusable.d.ts +22 -0
- package/dist/runtime/analysis/rules/warnings/w109-output-not-reusable.js +63 -0
- package/dist/runtime/analysis/rules/warnings/w110-weak-schema.d.ts +40 -0
- package/dist/runtime/analysis/rules/warnings/w110-weak-schema.js +32 -0
- package/dist/runtime/analysis/rules/warnings/w300-high-entropy-output.d.ts +39 -0
- package/dist/runtime/analysis/rules/warnings/w300-high-entropy-output.js +47 -0
- package/dist/runtime/analysis/rules/warnings/w301-unstable-defaults.d.ts +38 -0
- package/dist/runtime/analysis/rules/warnings/w301-unstable-defaults.js +36 -0
- package/dist/runtime/analysis/strict-mode.d.ts +21 -0
- package/dist/runtime/analysis/strict-mode.js +44 -0
- package/dist/runtime/analysis/types.d.ts +133 -0
- package/dist/runtime/analysis/types.js +6 -0
- package/dist/runtime/analysis/utils.d.ts +19 -0
- package/dist/runtime/analysis/utils.js +21 -0
- package/dist/runtime/dev/data-manager.d.ts +55 -0
- package/dist/runtime/dev/data-manager.js +87 -0
- package/dist/runtime/dev/event-mapper.d.ts +100 -0
- package/dist/runtime/dev/event-mapper.js +400 -0
- package/dist/runtime/dev/formatter.d.ts +94 -0
- package/dist/runtime/dev/formatter.js +236 -0
- package/dist/runtime/dev/index.d.ts +9 -0
- package/dist/runtime/dev/index.js +9 -0
- package/dist/runtime/dev/repl.d.ts +114 -0
- package/dist/runtime/dev/repl.js +310 -0
- package/dist/runtime/dev/session.d.ts +86 -0
- package/dist/runtime/dev/session.js +447 -0
- package/dist/runtime/dev/stack-trace.d.ts +77 -0
- package/dist/runtime/dev/stack-trace.js +286 -0
- package/dist/runtime/dev/types.d.ts +54 -0
- package/dist/runtime/dev/types.js +5 -0
- package/dist/runtime/llm/claude.d.ts +27 -0
- package/dist/runtime/llm/claude.js +150 -0
- package/dist/runtime/llm/factory.d.ts +30 -0
- package/dist/runtime/llm/factory.js +78 -0
- package/dist/runtime/llm/index.d.ts +10 -0
- package/dist/runtime/llm/index.js +10 -0
- package/dist/runtime/llm/ollama.d.ts +45 -0
- package/dist/runtime/llm/ollama.js +449 -0
- package/dist/runtime/llm/openai.d.ts +27 -0
- package/dist/runtime/llm/openai.js +170 -0
- package/dist/runtime/llm/provider.d.ts +32 -0
- package/dist/runtime/llm/provider.js +6 -0
- package/dist/runtime/llm/types.d.ts +55 -0
- package/dist/runtime/llm/types.js +6 -0
- package/dist/runtime/mcp/client/base.d.ts +40 -0
- package/dist/runtime/mcp/client/base.js +157 -0
- package/dist/runtime/mcp/client/manager.d.ts +91 -0
- package/dist/runtime/mcp/client/manager.js +248 -0
- package/dist/runtime/mcp/client/process.d.ts +31 -0
- package/dist/runtime/mcp/client/process.js +82 -0
- package/dist/runtime/mcp/connection.d.ts +63 -0
- package/dist/runtime/mcp/connection.js +449 -0
- package/dist/runtime/mcp/index.d.ts +9 -0
- package/dist/runtime/mcp/index.js +9 -0
- package/dist/runtime/mcp/list.d.ts +50 -0
- package/dist/runtime/mcp/list.js +65 -0
- package/dist/runtime/mcp/stdio-transport.d.ts +23 -0
- package/dist/runtime/mcp/stdio-transport.js +71 -0
- package/dist/runtime/mcp/types.d.ts +85 -0
- package/dist/runtime/mcp/types.js +6 -0
- package/dist/runtime/sandbox/executor.d.ts +102 -0
- package/dist/runtime/sandbox/executor.js +537 -0
- package/dist/runtime/sandbox/index.d.ts +9 -0
- package/dist/runtime/sandbox/index.js +9 -0
- package/dist/runtime/sandbox/io-monitor.d.ts +78 -0
- package/dist/runtime/sandbox/io-monitor.js +98 -0
- package/dist/runtime/sandbox/time-parser.d.ts +19 -0
- package/dist/runtime/sandbox/time-parser.js +67 -0
- package/dist/runtime/sandbox/types.d.ts +58 -0
- package/dist/runtime/sandbox/types.js +23 -0
- package/dist/runtime/test/behavior-observer.d.ts +61 -0
- package/dist/runtime/test/behavior-observer.js +140 -0
- package/dist/runtime/test/contract-loader.d.ts +41 -0
- package/dist/runtime/test/contract-loader.js +158 -0
- package/dist/runtime/test/contract-schema.d.ts +46 -0
- package/dist/runtime/test/contract-schema.js +107 -0
- package/dist/runtime/test/contract-types.d.ts +106 -0
- package/dist/runtime/test/contract-types.js +6 -0
- package/dist/runtime/test/dependency-tracker.d.ts +66 -0
- package/dist/runtime/test/dependency-tracker.js +80 -0
- package/dist/runtime/test/formatters.d.ts +18 -0
- package/dist/runtime/test/formatters.js +172 -0
- package/dist/runtime/test/index.d.ts +12 -0
- package/dist/runtime/test/index.js +13 -0
- package/dist/runtime/test/input-generator.d.ts +33 -0
- package/dist/runtime/test/input-generator.js +498 -0
- package/dist/runtime/test/mcp-root-detector.d.ts +31 -0
- package/dist/runtime/test/mcp-root-detector.js +105 -0
- package/dist/runtime/test/orchestrator.d.ts +131 -0
- package/dist/runtime/test/orchestrator.js +738 -0
- package/dist/runtime/test/output-validator.d.ts +44 -0
- package/dist/runtime/test/output-validator.js +262 -0
- package/dist/runtime/test/retry-tester.d.ts +44 -0
- package/dist/runtime/test/retry-tester.js +103 -0
- package/dist/runtime/test/runner.d.ts +28 -0
- package/dist/runtime/test/runner.js +55 -0
- package/dist/runtime/test/synthetic-input-generator.d.ts +11 -0
- package/dist/runtime/test/synthetic-input-generator.js +154 -0
- package/dist/runtime/test/test-runner.d.ts +28 -0
- package/dist/runtime/test/test-runner.js +55 -0
- package/dist/types/factories.d.ts +16 -0
- package/dist/types/factories.js +43 -0
- package/dist/types/ids.d.ts +16 -0
- package/dist/types/ids.js +2 -0
- package/dist/types/opaque.d.ts +4 -0
- package/dist/types/opaque.js +2 -0
- package/dist/utils/errors.d.ts +92 -0
- package/dist/utils/errors.js +97 -0
- package/dist/utils/gitignore.d.ts +11 -0
- package/dist/utils/gitignore.js +59 -0
- package/dist/utils/json-file-saver.d.ts +17 -0
- package/dist/utils/json-file-saver.js +81 -0
- package/dist/utils/json-formatter.d.ts +63 -0
- package/dist/utils/json-formatter.js +344 -0
- package/dist/utils/logger.d.ts +184 -0
- package/dist/utils/logger.js +330 -0
- package/dist/utils/package-manager.d.ts +30 -0
- package/dist/utils/package-manager.js +157 -0
- package/dist/utils/version-checker.d.ts +47 -0
- package/dist/utils/version-checker.js +167 -0
- package/dist/utils/version-display.d.ts +10 -0
- package/dist/utils/version-display.js +20 -0
- package/package.json +106 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output schema validator.
|
|
3
|
+
* Validates that tool outputs match declared schema structure.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* JSON Schema field interface.
|
|
7
|
+
*/
|
|
8
|
+
interface JSONSchemaField {
|
|
9
|
+
type?: string | string[];
|
|
10
|
+
description?: string;
|
|
11
|
+
required?: string[];
|
|
12
|
+
properties?: Record<string, JSONSchemaField>;
|
|
13
|
+
items?: JSONSchemaField | JSONSchemaField[];
|
|
14
|
+
$ref?: string;
|
|
15
|
+
enum?: unknown[];
|
|
16
|
+
pattern?: string;
|
|
17
|
+
example?: unknown;
|
|
18
|
+
examples?: unknown[];
|
|
19
|
+
nullable?: boolean;
|
|
20
|
+
}
|
|
21
|
+
type JSONSchema = JSONSchemaField | Record<string, unknown> | unknown;
|
|
22
|
+
/**
|
|
23
|
+
* Validation result.
|
|
24
|
+
*/
|
|
25
|
+
export interface OutputValidationResult {
|
|
26
|
+
/** Whether output is valid */
|
|
27
|
+
valid: boolean;
|
|
28
|
+
/** Error message if invalid */
|
|
29
|
+
error?: string;
|
|
30
|
+
/** Validation details */
|
|
31
|
+
details?: {
|
|
32
|
+
/** Missing required fields */
|
|
33
|
+
missingFields?: string[];
|
|
34
|
+
/** Fields with type mismatches */
|
|
35
|
+
typeMismatches?: Array<{
|
|
36
|
+
field: string;
|
|
37
|
+
expected: string;
|
|
38
|
+
actual: string;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export declare function validateOutputStructure(output: unknown, schema: JSONSchema): OutputValidationResult;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=output-validator.d.ts.map
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output schema validator.
|
|
3
|
+
* Validates that tool outputs match declared schema structure.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Validate output structure against schema.
|
|
7
|
+
* @param output - Tool output to validate
|
|
8
|
+
* @param schema - Expected output schema
|
|
9
|
+
* @returns Validation result
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Type guard for JSONSchemaField.
|
|
13
|
+
*/
|
|
14
|
+
function isJSONSchemaField(obj) {
|
|
15
|
+
return (typeof obj === 'object' &&
|
|
16
|
+
obj !== null &&
|
|
17
|
+
('type' in obj || 'properties' in obj || 'items' in obj || '$ref' in obj));
|
|
18
|
+
}
|
|
19
|
+
export function validateOutputStructure(output, schema) {
|
|
20
|
+
try {
|
|
21
|
+
// Basic type check
|
|
22
|
+
if (!isJSONSchemaField(schema)) {
|
|
23
|
+
return {
|
|
24
|
+
valid: false,
|
|
25
|
+
error: 'Invalid schema: schema must be an object',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// If output is not an object, check if schema expects object
|
|
29
|
+
if (typeof output !== 'object' || output === null) {
|
|
30
|
+
const schemaType = getSchemaType(schema);
|
|
31
|
+
if (schemaType === 'object' && !isNullable(schema)) {
|
|
32
|
+
return {
|
|
33
|
+
valid: false,
|
|
34
|
+
error: `Output type mismatch: expected object, got ${typeof output}`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// If schema allows null or other types, it might be valid
|
|
38
|
+
return { valid: true };
|
|
39
|
+
}
|
|
40
|
+
// Validate object structure
|
|
41
|
+
return validateObjectStructure(output, schema);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return {
|
|
45
|
+
valid: false,
|
|
46
|
+
error: `Validation error: ${error instanceof Error ? error.message : String(error)}`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Validate object structure against schema.
|
|
52
|
+
*/
|
|
53
|
+
function validateObjectStructure(output, schema) {
|
|
54
|
+
if (!isJSONSchemaField(schema)) {
|
|
55
|
+
return { valid: false, error: 'Invalid schema' };
|
|
56
|
+
}
|
|
57
|
+
const properties = schema.properties;
|
|
58
|
+
const required = schema.required;
|
|
59
|
+
const missingFields = [];
|
|
60
|
+
const typeMismatches = [];
|
|
61
|
+
// Check required fields
|
|
62
|
+
if (required && properties) {
|
|
63
|
+
for (const fieldName of required) {
|
|
64
|
+
if (!(fieldName in output)) {
|
|
65
|
+
missingFields.push(fieldName);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Check field types (recursively for nested objects and arrays)
|
|
70
|
+
if (properties) {
|
|
71
|
+
for (const [fieldName, fieldValue] of Object.entries(output)) {
|
|
72
|
+
const fieldSchema = properties[fieldName];
|
|
73
|
+
if (fieldSchema) {
|
|
74
|
+
const expectedType = getSchemaType(fieldSchema);
|
|
75
|
+
const actualType = getValueType(fieldValue);
|
|
76
|
+
if (!isTypeCompatible(actualType, expectedType, fieldSchema, fieldValue)) {
|
|
77
|
+
typeMismatches.push({
|
|
78
|
+
field: fieldName,
|
|
79
|
+
expected: expectedType,
|
|
80
|
+
actual: actualType,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Recursively validate nested structures
|
|
85
|
+
if (isJSONSchemaField(fieldSchema)) {
|
|
86
|
+
// Validate nested object
|
|
87
|
+
if (expectedType === 'object' &&
|
|
88
|
+
actualType === 'object' &&
|
|
89
|
+
fieldSchema.properties &&
|
|
90
|
+
fieldValue !== null &&
|
|
91
|
+
typeof fieldValue === 'object' &&
|
|
92
|
+
!Array.isArray(fieldValue)) {
|
|
93
|
+
const nestedResult = validateObjectStructure(fieldValue, fieldSchema);
|
|
94
|
+
if (!nestedResult.valid) {
|
|
95
|
+
// Add field prefix to nested errors
|
|
96
|
+
const prefix = fieldName + '.';
|
|
97
|
+
if (nestedResult.details?.missingFields) {
|
|
98
|
+
missingFields.push(...nestedResult.details.missingFields.map(f => prefix + f));
|
|
99
|
+
}
|
|
100
|
+
if (nestedResult.details?.typeMismatches) {
|
|
101
|
+
typeMismatches.push(...nestedResult.details.typeMismatches.map(m => ({
|
|
102
|
+
field: prefix + m.field,
|
|
103
|
+
expected: m.expected,
|
|
104
|
+
actual: m.actual,
|
|
105
|
+
})));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Validate array items
|
|
110
|
+
else if (expectedType === 'array' &&
|
|
111
|
+
actualType === 'array' &&
|
|
112
|
+
fieldSchema.items &&
|
|
113
|
+
Array.isArray(fieldValue)) {
|
|
114
|
+
const itemsSchema = Array.isArray(fieldSchema.items)
|
|
115
|
+
? fieldSchema.items[0]
|
|
116
|
+
: fieldSchema.items;
|
|
117
|
+
if (itemsSchema && isJSONSchemaField(itemsSchema)) {
|
|
118
|
+
for (let i = 0; i < fieldValue.length; i++) {
|
|
119
|
+
const item = fieldValue[i];
|
|
120
|
+
const itemType = getValueType(item);
|
|
121
|
+
const expectedItemType = getSchemaType(itemsSchema);
|
|
122
|
+
if (!isTypeCompatible(itemType, expectedItemType, itemsSchema, item)) {
|
|
123
|
+
typeMismatches.push({
|
|
124
|
+
field: `${fieldName}[${i}]`,
|
|
125
|
+
expected: expectedItemType,
|
|
126
|
+
actual: itemType,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else if (expectedItemType === 'object' &&
|
|
130
|
+
itemType === 'object' &&
|
|
131
|
+
itemsSchema.properties &&
|
|
132
|
+
item !== null &&
|
|
133
|
+
typeof item === 'object' &&
|
|
134
|
+
!Array.isArray(item)) {
|
|
135
|
+
// Recursively validate array item objects
|
|
136
|
+
const itemResult = validateObjectStructure(item, itemsSchema);
|
|
137
|
+
if (!itemResult.valid) {
|
|
138
|
+
const prefix = `${fieldName}[${i}].`;
|
|
139
|
+
if (itemResult.details?.missingFields) {
|
|
140
|
+
missingFields.push(...itemResult.details.missingFields.map(f => prefix + f));
|
|
141
|
+
}
|
|
142
|
+
if (itemResult.details?.typeMismatches) {
|
|
143
|
+
typeMismatches.push(...itemResult.details.typeMismatches.map(m => ({
|
|
144
|
+
field: prefix + m.field,
|
|
145
|
+
expected: m.expected,
|
|
146
|
+
actual: m.actual,
|
|
147
|
+
})));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (missingFields.length > 0 || typeMismatches.length > 0) {
|
|
160
|
+
return {
|
|
161
|
+
valid: false,
|
|
162
|
+
error: 'Output structure does not match schema',
|
|
163
|
+
details: {
|
|
164
|
+
missingFields: missingFields.length > 0 ? missingFields : undefined,
|
|
165
|
+
typeMismatches: typeMismatches.length > 0 ? typeMismatches : undefined,
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return { valid: true };
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get schema type as string.
|
|
173
|
+
*/
|
|
174
|
+
function getSchemaType(schema) {
|
|
175
|
+
if (!isJSONSchemaField(schema)) {
|
|
176
|
+
return 'unknown';
|
|
177
|
+
}
|
|
178
|
+
const type = schema.type;
|
|
179
|
+
if (typeof type === 'string') {
|
|
180
|
+
return type;
|
|
181
|
+
}
|
|
182
|
+
if (Array.isArray(type)) {
|
|
183
|
+
// Return first non-null type, or 'any' if all null
|
|
184
|
+
const nonNull = type.find(t => t !== 'null');
|
|
185
|
+
return nonNull || 'null';
|
|
186
|
+
}
|
|
187
|
+
// Infer from properties
|
|
188
|
+
if (schema.properties) {
|
|
189
|
+
return 'object';
|
|
190
|
+
}
|
|
191
|
+
if (schema.items) {
|
|
192
|
+
return 'array';
|
|
193
|
+
}
|
|
194
|
+
return 'any';
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get value type as string.
|
|
198
|
+
*/
|
|
199
|
+
function getValueType(value) {
|
|
200
|
+
if (value === null) {
|
|
201
|
+
return 'null';
|
|
202
|
+
}
|
|
203
|
+
if (Array.isArray(value)) {
|
|
204
|
+
return 'array';
|
|
205
|
+
}
|
|
206
|
+
return typeof value;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Check if actual type is compatible with expected type.
|
|
210
|
+
*/
|
|
211
|
+
function isTypeCompatible(actualType, expectedType, schema, value) {
|
|
212
|
+
// Exact match
|
|
213
|
+
if (actualType === expectedType) {
|
|
214
|
+
// For integer type, verify it's actually an integer (not just a number)
|
|
215
|
+
if (expectedType === 'integer' && typeof value === 'number') {
|
|
216
|
+
return Number.isInteger(value);
|
|
217
|
+
}
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
// Null compatibility
|
|
221
|
+
if (actualType === 'null' && isNullable(schema)) {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
// Number/integer compatibility
|
|
225
|
+
if (expectedType === 'number' && actualType === 'number') {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
if (expectedType === 'integer' && actualType === 'number') {
|
|
229
|
+
// Integer requires the value to be a whole number
|
|
230
|
+
return Number.isInteger(value);
|
|
231
|
+
}
|
|
232
|
+
// Array compatibility
|
|
233
|
+
if (expectedType === 'array' && actualType === 'array') {
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
// Object compatibility
|
|
237
|
+
if (expectedType === 'object' && actualType === 'object') {
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
// Any type accepts anything
|
|
241
|
+
if (expectedType === 'any') {
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Check if schema is nullable.
|
|
248
|
+
*/
|
|
249
|
+
function isNullable(schema) {
|
|
250
|
+
if (!isJSONSchemaField(schema)) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
if (schema.nullable === true) {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
const type = schema.type;
|
|
257
|
+
if (Array.isArray(type)) {
|
|
258
|
+
return type.includes('null');
|
|
259
|
+
}
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=output-validator.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry scenario tester.
|
|
3
|
+
* Tests tools against agent retry patterns (retry on failure, timeout, error).
|
|
4
|
+
*/
|
|
5
|
+
import type { SandboxExecutor, ToolExecutionResult } from '../../runtime/sandbox/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Retry test configuration.
|
|
8
|
+
*/
|
|
9
|
+
export interface RetryTestConfig {
|
|
10
|
+
/** Maximum number of retries to test (default: 3) */
|
|
11
|
+
maxRetries?: number;
|
|
12
|
+
/** Retry delay in milliseconds (default: 100) */
|
|
13
|
+
retryDelayMs?: number;
|
|
14
|
+
/** Test retry on failure (default: true) */
|
|
15
|
+
testRetryOnFailure?: boolean;
|
|
16
|
+
/** Test retry on timeout (default: true) */
|
|
17
|
+
testRetryOnTimeout?: boolean;
|
|
18
|
+
/** Test retry on connection error (default: true) */
|
|
19
|
+
testRetryOnConnectionError?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retry test result.
|
|
23
|
+
*/
|
|
24
|
+
export interface RetryTestResult {
|
|
25
|
+
/** Input tested */
|
|
26
|
+
testInput: Record<string, unknown>;
|
|
27
|
+
/** Retry attempts made */
|
|
28
|
+
attempts: number;
|
|
29
|
+
/** Whether tool eventually succeeded after retries */
|
|
30
|
+
eventuallySucceeded: boolean;
|
|
31
|
+
/** Results from all retry attempts */
|
|
32
|
+
results: ToolExecutionResult[];
|
|
33
|
+
/** Issues detected */
|
|
34
|
+
issues: string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Test tool retry behavior.
|
|
38
|
+
* Simulates agent retry patterns to ensure tools handle retries gracefully.
|
|
39
|
+
*
|
|
40
|
+
* Note: Idempotency (output consistency across retries) is checked separately
|
|
41
|
+
* This tester focuses on retry reliability.
|
|
42
|
+
*/
|
|
43
|
+
export declare function testRetryBehavior(executor: SandboxExecutor, toolName: string, testInput: Record<string, unknown>, config?: RetryTestConfig, toolTimeoutMs?: number): Promise<RetryTestResult>;
|
|
44
|
+
//# sourceMappingURL=retry-tester.d.ts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry scenario tester.
|
|
3
|
+
* Tests tools against agent retry patterns (retry on failure, timeout, error).
|
|
4
|
+
*/
|
|
5
|
+
import { ToolExecutionErrorType } from '../../runtime/sandbox/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Get error type from an unknown error object.
|
|
8
|
+
* @param error - Error object (may be ToolExecutionError or unknown)
|
|
9
|
+
* @returns ToolExecutionErrorType if error has errorType, undefined otherwise
|
|
10
|
+
*/
|
|
11
|
+
function getErrorType(error) {
|
|
12
|
+
if (error && typeof error === 'object' && 'errorType' in error) {
|
|
13
|
+
return error.errorType;
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Test tool retry behavior.
|
|
19
|
+
* Simulates agent retry patterns to ensure tools handle retries gracefully.
|
|
20
|
+
*
|
|
21
|
+
* Note: Idempotency (output consistency across retries) is checked separately
|
|
22
|
+
* This tester focuses on retry reliability.
|
|
23
|
+
*/
|
|
24
|
+
export async function testRetryBehavior(executor, toolName, testInput, config = {}, toolTimeoutMs) {
|
|
25
|
+
const maxRetries = config.maxRetries ?? 3;
|
|
26
|
+
const retryDelayMs = config.retryDelayMs ?? 100;
|
|
27
|
+
const testRetryOnFailure = config.testRetryOnFailure ?? true;
|
|
28
|
+
const testRetryOnTimeout = config.testRetryOnTimeout ?? true;
|
|
29
|
+
const testRetryOnConnectionError = config.testRetryOnConnectionError ?? true;
|
|
30
|
+
const results = [];
|
|
31
|
+
const issues = [];
|
|
32
|
+
let eventuallySucceeded = false;
|
|
33
|
+
// Run initial execution
|
|
34
|
+
let executionResults = await executor.executeTool(toolName, [testInput], toolTimeoutMs);
|
|
35
|
+
let lastResult = executionResults[0];
|
|
36
|
+
if (lastResult) {
|
|
37
|
+
results.push(lastResult);
|
|
38
|
+
}
|
|
39
|
+
// If first attempt succeeded, test retry behavior
|
|
40
|
+
if (lastResult && lastResult.success) {
|
|
41
|
+
eventuallySucceeded = true;
|
|
42
|
+
// Retry to check reliability
|
|
43
|
+
for (let attempt = 1; attempt < maxRetries; attempt++) {
|
|
44
|
+
await new Promise(resolve => setTimeout(resolve, retryDelayMs));
|
|
45
|
+
executionResults = await executor.executeTool(toolName, [testInput], toolTimeoutMs);
|
|
46
|
+
const retryResult = executionResults[0];
|
|
47
|
+
if (retryResult) {
|
|
48
|
+
results.push(retryResult);
|
|
49
|
+
// Check reliability (retry shouldn't fail if first attempt succeeded)
|
|
50
|
+
if (!retryResult.success) {
|
|
51
|
+
issues.push(`Retry ${attempt + 1} failed (was successful on first attempt) - tool may be unreliable under retry scenarios`);
|
|
52
|
+
}
|
|
53
|
+
// Note: We don't report idempotency issues here as tools can be idempotent by design
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (lastResult && !lastResult.success) {
|
|
58
|
+
// First attempt failed - test retry on failure
|
|
59
|
+
if (testRetryOnFailure) {
|
|
60
|
+
const errorType = getErrorType(lastResult.error);
|
|
61
|
+
const shouldRetry = errorType === ToolExecutionErrorType.EXECUTION_ERROR ||
|
|
62
|
+
errorType === ToolExecutionErrorType.UNKNOWN;
|
|
63
|
+
if (shouldRetry) {
|
|
64
|
+
// Retry on failure
|
|
65
|
+
for (let attempt = 1; attempt < maxRetries; attempt++) {
|
|
66
|
+
await new Promise(resolve => setTimeout(resolve, retryDelayMs));
|
|
67
|
+
executionResults = await executor.executeTool(toolName, [testInput], toolTimeoutMs);
|
|
68
|
+
const retryResult = executionResults[0];
|
|
69
|
+
if (retryResult) {
|
|
70
|
+
results.push(retryResult);
|
|
71
|
+
if (retryResult.success) {
|
|
72
|
+
eventuallySucceeded = true;
|
|
73
|
+
issues.push(`Tool recovered after ${attempt + 1} retry attempts (initially failed)`);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (!eventuallySucceeded) {
|
|
79
|
+
issues.push(`Tool failed consistently after ${maxRetries} retry attempts`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Test retry on timeout
|
|
84
|
+
if (testRetryOnTimeout && lastResult.timedOut === true) {
|
|
85
|
+
issues.push(`Tool timed out - agents may retry, causing delays`);
|
|
86
|
+
}
|
|
87
|
+
// Test retry on connection error
|
|
88
|
+
if (testRetryOnConnectionError && !lastResult.success) {
|
|
89
|
+
const errorType = getErrorType(lastResult.error);
|
|
90
|
+
if (errorType === ToolExecutionErrorType.CONNECTION_ERROR) {
|
|
91
|
+
issues.push(`Connection error detected - agents may retry, causing delays`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
testInput,
|
|
97
|
+
attempts: results.length,
|
|
98
|
+
eventuallySucceeded,
|
|
99
|
+
results,
|
|
100
|
+
issues,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=retry-tester.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test input runner.
|
|
3
|
+
* Executes tools with contract-defined test inputs.
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolContract } from './contract-types.js';
|
|
6
|
+
import type { SandboxExecutor, ToolExecutionResult } from '../../runtime/sandbox/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Test execution result with metadata.
|
|
9
|
+
*/
|
|
10
|
+
export type TestExecutionResult = ToolExecutionResult & {
|
|
11
|
+
/** Test case name */
|
|
12
|
+
testName: string;
|
|
13
|
+
/** Test input used */
|
|
14
|
+
testInput: Record<string, unknown>;
|
|
15
|
+
/** Test expectation */
|
|
16
|
+
expectation?: import('./contract-types.js').TestExpectation;
|
|
17
|
+
/** Expected output schema name (optional, for tests expecting different output schema) */
|
|
18
|
+
expectedOutputSchema?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Run contract-defined test cases.
|
|
22
|
+
* @param executor - Sandbox executor
|
|
23
|
+
* @param contract - Tool contract
|
|
24
|
+
* @param toolTimeoutMs - Optional timeout for tool execution in milliseconds
|
|
25
|
+
* @returns Array of test execution results
|
|
26
|
+
*/
|
|
27
|
+
export declare function runContractTests(executor: SandboxExecutor, contract: ToolContract, toolTimeoutMs?: number): Promise<TestExecutionResult[]>;
|
|
28
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test input runner.
|
|
3
|
+
* Executes tools with contract-defined test inputs.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Run contract-defined test cases.
|
|
7
|
+
* @param executor - Sandbox executor
|
|
8
|
+
* @param contract - Tool contract
|
|
9
|
+
* @param toolTimeoutMs - Optional timeout for tool execution in milliseconds
|
|
10
|
+
* @returns Array of test execution results
|
|
11
|
+
*/
|
|
12
|
+
export async function runContractTests(executor, contract, toolTimeoutMs) {
|
|
13
|
+
if (!contract.tests || contract.tests.length === 0) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const results = [];
|
|
17
|
+
for (const test of contract.tests) {
|
|
18
|
+
// Set environment variables if specified
|
|
19
|
+
const originalEnv = { ...process.env };
|
|
20
|
+
if (test.env) {
|
|
21
|
+
for (const [key, value] of Object.entries(test.env)) {
|
|
22
|
+
process.env[key] = value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
// Execute tool with test input (run once)
|
|
27
|
+
const executionResults = await executor.executeTool(contract.tool, [test.input], toolTimeoutMs);
|
|
28
|
+
// Map to test execution results
|
|
29
|
+
for (const result of executionResults) {
|
|
30
|
+
results.push({
|
|
31
|
+
...result,
|
|
32
|
+
testName: test.name,
|
|
33
|
+
testInput: test.input,
|
|
34
|
+
expectation: test.expect,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
// Restore environment properly (avoid reassigning process.env which breaks Node's proxy)
|
|
40
|
+
// Remove any keys that were added
|
|
41
|
+
const currentKeys = Object.keys(process.env);
|
|
42
|
+
for (const key of currentKeys) {
|
|
43
|
+
if (!(key in originalEnv)) {
|
|
44
|
+
delete process.env[key];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Restore any keys that were changed
|
|
48
|
+
for (const [key, value] of Object.entries(originalEnv)) {
|
|
49
|
+
process.env[key] = value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return results;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate system-level synthetic test inputs from tool input schema.
|
|
3
|
+
* These inputs test edge cases, type validations, and boundary conditions.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generate synthetic test inputs from a JSON schema.
|
|
7
|
+
* @param schema - Input schema (JSON Schema format)
|
|
8
|
+
* @returns Array of synthetic test inputs
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateSyntheticInputs(schema: unknown): Array<Record<string, unknown>>;
|
|
11
|
+
//# sourceMappingURL=synthetic-input-generator.d.ts.map
|