@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,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index builder.
|
|
3
|
+
* Builds fast lookup indexes for analysis rules.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Extract keywords from tool name and description.
|
|
7
|
+
*/
|
|
8
|
+
function extractKeywords(tool) {
|
|
9
|
+
const keywords = new Set();
|
|
10
|
+
const text = `${tool.name} ${tool.description}`.toLowerCase();
|
|
11
|
+
// Extract words (alphanumeric sequences)
|
|
12
|
+
const words = text.match(/\b\w{3,}\b/g) || [];
|
|
13
|
+
for (const word of words) {
|
|
14
|
+
keywords.add(word);
|
|
15
|
+
}
|
|
16
|
+
return keywords;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build indexes from normalized tools.
|
|
20
|
+
*/
|
|
21
|
+
export function buildIndexes(tools) {
|
|
22
|
+
const toolIndex = new Map();
|
|
23
|
+
const inputIndex = new Map();
|
|
24
|
+
const outputIndex = new Map();
|
|
25
|
+
const keywordIndex = new Map();
|
|
26
|
+
for (const tool of tools) {
|
|
27
|
+
// Build tool index
|
|
28
|
+
toolIndex.set(tool.name.toLowerCase(), tool);
|
|
29
|
+
// Build input index
|
|
30
|
+
for (const input of tool.inputs) {
|
|
31
|
+
const fieldName = input.name.toLowerCase();
|
|
32
|
+
if (!inputIndex.has(fieldName)) {
|
|
33
|
+
inputIndex.set(fieldName, []);
|
|
34
|
+
}
|
|
35
|
+
inputIndex.get(fieldName).push(input);
|
|
36
|
+
}
|
|
37
|
+
// Build output index
|
|
38
|
+
for (const output of tool.outputs) {
|
|
39
|
+
const fieldName = output.name.toLowerCase();
|
|
40
|
+
if (!outputIndex.has(fieldName)) {
|
|
41
|
+
outputIndex.set(fieldName, []);
|
|
42
|
+
}
|
|
43
|
+
outputIndex.get(fieldName).push(output);
|
|
44
|
+
}
|
|
45
|
+
// Build keyword index
|
|
46
|
+
const keywords = extractKeywords(tool);
|
|
47
|
+
const toolNameLower = tool.name.toLowerCase();
|
|
48
|
+
for (const keyword of keywords) {
|
|
49
|
+
if (!keywordIndex.has(keyword)) {
|
|
50
|
+
keywordIndex.set(keyword, new Set());
|
|
51
|
+
}
|
|
52
|
+
keywordIndex.get(keyword).add(toolNameLower);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
toolIndex,
|
|
57
|
+
inputIndex,
|
|
58
|
+
outputIndex,
|
|
59
|
+
keywordIndex,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=indexer.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool loader.
|
|
3
|
+
* Loads raw tool metadata from MCP servers.
|
|
4
|
+
*/
|
|
5
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
6
|
+
import type { RawTool } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Load raw tools from MCP server.
|
|
9
|
+
* This is the entry point that fetches tool metadata without execution.
|
|
10
|
+
*
|
|
11
|
+
* @param client - Connected MCP client
|
|
12
|
+
* @returns Array of raw tool definitions
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadMCPTools(client: Client): Promise<RawTool[]>;
|
|
15
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool loader.
|
|
3
|
+
* Loads raw tool metadata from MCP servers.
|
|
4
|
+
*/
|
|
5
|
+
import { listTools } from '../../runtime/mcp/list.js';
|
|
6
|
+
/**
|
|
7
|
+
* Load raw tools from MCP server.
|
|
8
|
+
* This is the entry point that fetches tool metadata without execution.
|
|
9
|
+
*
|
|
10
|
+
* @param client - Connected MCP client
|
|
11
|
+
* @returns Array of raw tool definitions
|
|
12
|
+
*/
|
|
13
|
+
export async function loadMCPTools(client) {
|
|
14
|
+
let result;
|
|
15
|
+
try {
|
|
16
|
+
result = await listTools(client);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
20
|
+
throw new Error(`Failed to load tools from MCP server: ${errorMessage}`, {
|
|
21
|
+
cause: error,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const tools = result.tools || [];
|
|
25
|
+
// Validate each tool before mapping
|
|
26
|
+
for (let i = 0; i < tools.length; i++) {
|
|
27
|
+
const tool = tools[i];
|
|
28
|
+
if (!tool) {
|
|
29
|
+
throw new Error(`Tool at index ${i} is undefined`);
|
|
30
|
+
}
|
|
31
|
+
if (!tool.name) {
|
|
32
|
+
const toolSummary = JSON.stringify({
|
|
33
|
+
description: tool.description,
|
|
34
|
+
inputSchema: tool.inputSchema ? 'present' : 'missing',
|
|
35
|
+
outputSchema: tool.outputSchema ? 'present' : 'missing',
|
|
36
|
+
});
|
|
37
|
+
throw new Error(`Missing tool.name at index ${i}: ${toolSummary}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return tools.map(tool => ({
|
|
41
|
+
name: tool.name,
|
|
42
|
+
description: tool.description,
|
|
43
|
+
inputSchema: tool.inputSchema,
|
|
44
|
+
outputSchema: tool.outputSchema,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema normalizer.
|
|
3
|
+
* Normalizes and extracts fields from JSON Schema definitions.
|
|
4
|
+
*/
|
|
5
|
+
import type { RawTool, ToolSpec } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Normalize a raw tool into a ToolSpec.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeTool(rawTool: RawTool): Promise<ToolSpec>;
|
|
10
|
+
/**
|
|
11
|
+
* Normalize multiple raw tools.
|
|
12
|
+
*/
|
|
13
|
+
export declare function normalizeTools(rawTools: RawTool[]): Promise<ToolSpec[]>;
|
|
14
|
+
//# sourceMappingURL=normalizer.d.ts.map
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema normalizer.
|
|
3
|
+
* Normalizes and extracts fields from JSON Schema definitions.
|
|
4
|
+
*/
|
|
5
|
+
import $RefParser from '@apidevtools/json-schema-ref-parser';
|
|
6
|
+
/**
|
|
7
|
+
* Type guard to check if object is a JSONSchemaField.
|
|
8
|
+
* Performs structural check for expected JSON Schema field properties.
|
|
9
|
+
*/
|
|
10
|
+
function isJSONSchemaField(obj) {
|
|
11
|
+
return (typeof obj === 'object' &&
|
|
12
|
+
obj !== null &&
|
|
13
|
+
('type' in obj || 'properties' in obj || 'items' in obj || '$ref' in obj));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Extract tokens from text for similarity matching.
|
|
17
|
+
*/
|
|
18
|
+
function extractTokens(text) {
|
|
19
|
+
const tokens = text
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.replace(/[^\w\s]/g, ' ')
|
|
22
|
+
.split(/\s+/)
|
|
23
|
+
.filter(token => token.length > 2); // Filter out short tokens
|
|
24
|
+
return new Set(tokens);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Normalize a JSON Schema type to a string representation.
|
|
28
|
+
* Handles string, string[], and undefined types.
|
|
29
|
+
*
|
|
30
|
+
* @param type - The type to normalize (string, string[], or undefined)
|
|
31
|
+
* @returns Normalized type string ('any' for empty/undefined, joined types for arrays)
|
|
32
|
+
*/
|
|
33
|
+
function normalizeType(type) {
|
|
34
|
+
if (Array.isArray(type)) {
|
|
35
|
+
// Empty array defaults to 'any'
|
|
36
|
+
if (type.length === 0) {
|
|
37
|
+
return 'any';
|
|
38
|
+
}
|
|
39
|
+
// Filter out 'null' and join remaining types
|
|
40
|
+
const nonNullTypes = type.filter(t => t !== 'null');
|
|
41
|
+
// If only 'null' remains, return 'null', otherwise join non-null types
|
|
42
|
+
return nonNullTypes.length > 0 ? nonNullTypes.join('|') : 'null';
|
|
43
|
+
}
|
|
44
|
+
// String or undefined: return type or 'any' as fallback
|
|
45
|
+
return type || 'any';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Extract field specifications from a JSON Schema object.
|
|
49
|
+
*/
|
|
50
|
+
async function extractFieldsFromSchema(schema, toolName, isInput) {
|
|
51
|
+
const fields = [];
|
|
52
|
+
if (!schema || typeof schema !== 'object') {
|
|
53
|
+
return fields;
|
|
54
|
+
}
|
|
55
|
+
// Resolve $ref if present
|
|
56
|
+
let resolvedSchema = schema;
|
|
57
|
+
try {
|
|
58
|
+
resolvedSchema = await $RefParser.dereference(schema);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// If dereference fails, use original schema
|
|
62
|
+
resolvedSchema = schema;
|
|
63
|
+
}
|
|
64
|
+
if (!isJSONSchemaField(resolvedSchema)) {
|
|
65
|
+
return fields;
|
|
66
|
+
}
|
|
67
|
+
// Handle object type with properties
|
|
68
|
+
if (resolvedSchema.type === 'object' &&
|
|
69
|
+
resolvedSchema.properties &&
|
|
70
|
+
typeof resolvedSchema.properties === 'object') {
|
|
71
|
+
const required = new Set(Array.isArray(resolvedSchema.required) ? resolvedSchema.required : []);
|
|
72
|
+
const properties = resolvedSchema.properties;
|
|
73
|
+
for (const [fieldName, fieldSchema] of Object.entries(properties)) {
|
|
74
|
+
// Handle fields that might not have a type but have other properties (like title)
|
|
75
|
+
// In JSON Schema, fields without explicit type default to 'any'
|
|
76
|
+
if (typeof fieldSchema !== 'object' || fieldSchema === null) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
// If field doesn't pass isJSONSchemaField check but is in properties,
|
|
80
|
+
// it might still be a valid field (e.g., only has 'title' but no 'type')
|
|
81
|
+
// We'll treat it as a field with type 'any' (undefined type normalizes to 'any')
|
|
82
|
+
// Create a field object that will work with our processing
|
|
83
|
+
const field = isJSONSchemaField(fieldSchema)
|
|
84
|
+
? fieldSchema
|
|
85
|
+
: {
|
|
86
|
+
...fieldSchema,
|
|
87
|
+
type: undefined, // Will normalize to 'any'
|
|
88
|
+
};
|
|
89
|
+
// Determine nullable: true if explicitly set, or if type is an array containing 'null'
|
|
90
|
+
// Do not infer nullable from single type === 'null' (that means value must be null)
|
|
91
|
+
const isNullable = field.nullable === true ||
|
|
92
|
+
(Array.isArray(field.type) && field.type.includes('null'));
|
|
93
|
+
// Normalize type using helper function
|
|
94
|
+
const normalizedType = normalizeType(field.type);
|
|
95
|
+
const fieldSpec = {
|
|
96
|
+
tool: toolName,
|
|
97
|
+
name: fieldName,
|
|
98
|
+
type: normalizedType,
|
|
99
|
+
required: required.has(fieldName),
|
|
100
|
+
description: field.description,
|
|
101
|
+
nullable: isNullable,
|
|
102
|
+
};
|
|
103
|
+
// Extract enum values
|
|
104
|
+
if (Array.isArray(field.enum)) {
|
|
105
|
+
fieldSpec.enum = field.enum.map(String);
|
|
106
|
+
}
|
|
107
|
+
// Extract pattern
|
|
108
|
+
if (field.pattern) {
|
|
109
|
+
fieldSpec.pattern = String(field.pattern);
|
|
110
|
+
}
|
|
111
|
+
// Extract example
|
|
112
|
+
if (Array.isArray(field.examples) && field.examples.length > 0) {
|
|
113
|
+
fieldSpec.example = field.examples[0];
|
|
114
|
+
}
|
|
115
|
+
else if (field.example !== undefined) {
|
|
116
|
+
fieldSpec.example = field.example;
|
|
117
|
+
}
|
|
118
|
+
// Handle nested object properties
|
|
119
|
+
// Check if type is 'object' (either directly or in an array)
|
|
120
|
+
const isObjectType = (Array.isArray(field.type) && field.type.includes('object')) ||
|
|
121
|
+
field.type === 'object';
|
|
122
|
+
if (isObjectType && field.properties) {
|
|
123
|
+
fieldSpec.properties = await extractFieldsFromSchema(field, toolName, isInput);
|
|
124
|
+
}
|
|
125
|
+
fields.push(fieldSpec);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else if (resolvedSchema.type) {
|
|
129
|
+
// Handle non-object types (simple types)
|
|
130
|
+
// Normalize type using helper function
|
|
131
|
+
const normalizedType = normalizeType(resolvedSchema.type);
|
|
132
|
+
const fieldSpec = {
|
|
133
|
+
tool: toolName,
|
|
134
|
+
name: isInput ? 'input' : 'output',
|
|
135
|
+
type: normalizedType,
|
|
136
|
+
required: !isInput, // Outputs are always "required" conceptually
|
|
137
|
+
description: resolvedSchema.description,
|
|
138
|
+
nullable: resolvedSchema.nullable === true,
|
|
139
|
+
};
|
|
140
|
+
if (Array.isArray(resolvedSchema.enum)) {
|
|
141
|
+
fieldSpec.enum = resolvedSchema.enum.map(String);
|
|
142
|
+
}
|
|
143
|
+
if (resolvedSchema.pattern) {
|
|
144
|
+
fieldSpec.pattern = String(resolvedSchema.pattern);
|
|
145
|
+
}
|
|
146
|
+
if (resolvedSchema.examples &&
|
|
147
|
+
Array.isArray(resolvedSchema.examples) &&
|
|
148
|
+
resolvedSchema.examples.length > 0) {
|
|
149
|
+
fieldSpec.example = resolvedSchema.examples[0];
|
|
150
|
+
}
|
|
151
|
+
else if (resolvedSchema.example !== undefined) {
|
|
152
|
+
fieldSpec.example = resolvedSchema.example;
|
|
153
|
+
}
|
|
154
|
+
fields.push(fieldSpec);
|
|
155
|
+
}
|
|
156
|
+
return fields;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Normalize a raw tool into a ToolSpec.
|
|
160
|
+
*/
|
|
161
|
+
export async function normalizeTool(rawTool) {
|
|
162
|
+
const description = rawTool.description || '';
|
|
163
|
+
const inputs = rawTool.inputSchema
|
|
164
|
+
? await extractFieldsFromSchema(rawTool.inputSchema, rawTool.name, true)
|
|
165
|
+
: [];
|
|
166
|
+
const outputs = rawTool.outputSchema
|
|
167
|
+
? await extractFieldsFromSchema(rawTool.outputSchema, rawTool.name, false)
|
|
168
|
+
: [];
|
|
169
|
+
return {
|
|
170
|
+
name: rawTool.name,
|
|
171
|
+
description,
|
|
172
|
+
inputs,
|
|
173
|
+
outputs,
|
|
174
|
+
descriptionTokens: extractTokens(rawTool.name + ' ' + description),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Normalize multiple raw tools.
|
|
179
|
+
*/
|
|
180
|
+
export async function normalizeTools(rawTools) {
|
|
181
|
+
const normalized = await Promise.all(rawTools.map(normalizeTool));
|
|
182
|
+
return normalized;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=normalizer.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test helpers for analysis rule tests.
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolSpec, FieldSpec } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build indexes from tools for testing.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildIndexesFromTools(tools: ToolSpec[]): {
|
|
9
|
+
toolIndex: Map<string, ToolSpec>;
|
|
10
|
+
inputIndex: Map<string, FieldSpec[]>;
|
|
11
|
+
outputIndex: Map<string, FieldSpec[]>;
|
|
12
|
+
keywordIndex: Map<string, Set<string>>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Setup mocks for analysis tests.
|
|
16
|
+
* Note: Mocks should be set up in individual test files using vi.mock()
|
|
17
|
+
*/
|
|
18
|
+
//# sourceMappingURL=__test-helpers__.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test helpers for analysis rule tests.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Build indexes from tools for testing.
|
|
6
|
+
*/
|
|
7
|
+
export function buildIndexesFromTools(tools) {
|
|
8
|
+
const toolIndex = new Map();
|
|
9
|
+
const inputIndex = new Map();
|
|
10
|
+
const outputIndex = new Map();
|
|
11
|
+
const keywordIndex = new Map();
|
|
12
|
+
for (const tool of tools) {
|
|
13
|
+
toolIndex.set(tool.name.toLowerCase(), tool);
|
|
14
|
+
for (const input of tool.inputs || []) {
|
|
15
|
+
const fieldName = input.name.toLowerCase();
|
|
16
|
+
if (!inputIndex.has(fieldName)) {
|
|
17
|
+
inputIndex.set(fieldName, []);
|
|
18
|
+
}
|
|
19
|
+
inputIndex.get(fieldName).push(input);
|
|
20
|
+
}
|
|
21
|
+
for (const output of tool.outputs || []) {
|
|
22
|
+
const fieldName = output.name.toLowerCase();
|
|
23
|
+
if (!outputIndex.has(fieldName)) {
|
|
24
|
+
outputIndex.set(fieldName, []);
|
|
25
|
+
}
|
|
26
|
+
outputIndex.get(fieldName).push(output);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
toolIndex,
|
|
31
|
+
inputIndex,
|
|
32
|
+
outputIndex,
|
|
33
|
+
keywordIndex,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Setup mocks for analysis tests.
|
|
38
|
+
* Note: Mocks should be set up in individual test files using vi.mock()
|
|
39
|
+
*/
|
|
40
|
+
//# sourceMappingURL=__test-helpers__.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule engine base types and interfaces.
|
|
3
|
+
*/
|
|
4
|
+
import type { AnalysisContext, Diagnostic } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Base interface for all analysis rules.
|
|
7
|
+
*/
|
|
8
|
+
export interface Rule {
|
|
9
|
+
/** Rule ID (e.g., "E001", "W001") */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Severity level */
|
|
12
|
+
severity: 'error' | 'warning';
|
|
13
|
+
/** Human-readable rule name */
|
|
14
|
+
ruleName: string;
|
|
15
|
+
/** Rule description */
|
|
16
|
+
description: string;
|
|
17
|
+
/**
|
|
18
|
+
* Check function that returns diagnostics for violations.
|
|
19
|
+
* @param ctx - Analysis context
|
|
20
|
+
* @returns Array of diagnostics (empty if no violations)
|
|
21
|
+
*/
|
|
22
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Base rule implementation helper.
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class BaseRule implements Rule {
|
|
28
|
+
abstract readonly id: string;
|
|
29
|
+
abstract readonly severity: 'error' | 'warning';
|
|
30
|
+
abstract readonly ruleName: string;
|
|
31
|
+
abstract readonly description: string;
|
|
32
|
+
abstract check(ctx: AnalysisContext): Diagnostic[];
|
|
33
|
+
/**
|
|
34
|
+
* Create a diagnostic.
|
|
35
|
+
*/
|
|
36
|
+
protected createDiagnostic(message: string, tool?: string, field?: string, suggestion?: string, context?: Record<string, unknown>, severity?: 'error' | 'warning'): Diagnostic;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule engine base types and interfaces.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base rule implementation helper.
|
|
6
|
+
*/
|
|
7
|
+
export class BaseRule {
|
|
8
|
+
/**
|
|
9
|
+
* Create a diagnostic.
|
|
10
|
+
*/
|
|
11
|
+
createDiagnostic(message, tool, field, suggestion, context, severity) {
|
|
12
|
+
return {
|
|
13
|
+
code: this.id,
|
|
14
|
+
severity: severity ?? this.severity,
|
|
15
|
+
message,
|
|
16
|
+
tool,
|
|
17
|
+
field,
|
|
18
|
+
suggestion,
|
|
19
|
+
context,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error code constants.
|
|
3
|
+
* Centralized definition of all error codes used in the analysis system.
|
|
4
|
+
* Organized by category (similar to HTTP status codes) for future expansion.
|
|
5
|
+
* This ensures type safety, prevents typos, and provides a single source of truth.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Error codes for analysis rules.
|
|
9
|
+
* Organized in categories with ranges for future expansion.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ERROR_CODES: {
|
|
12
|
+
readonly E000: "E000";
|
|
13
|
+
readonly E100: "E100";
|
|
14
|
+
readonly E101: "E101";
|
|
15
|
+
readonly E102: "E102";
|
|
16
|
+
readonly E103: "E103";
|
|
17
|
+
readonly E104: "E104";
|
|
18
|
+
readonly E105: "E105";
|
|
19
|
+
readonly E106: "E106";
|
|
20
|
+
readonly E107: "E107";
|
|
21
|
+
readonly E108: "E108";
|
|
22
|
+
readonly E109: "E109";
|
|
23
|
+
readonly E110: "E110";
|
|
24
|
+
readonly E200: "E200";
|
|
25
|
+
readonly E300: "E300";
|
|
26
|
+
readonly E301: "E301";
|
|
27
|
+
readonly E400: "E400";
|
|
28
|
+
readonly E403: "E403";
|
|
29
|
+
readonly E500: "E500";
|
|
30
|
+
readonly E501: "E501";
|
|
31
|
+
readonly E600: "E600";
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Warning code constants.
|
|
35
|
+
*/
|
|
36
|
+
export declare const WARNING_CODES: {
|
|
37
|
+
readonly W100: "W100";
|
|
38
|
+
readonly W101: "W101";
|
|
39
|
+
readonly W102: "W102";
|
|
40
|
+
readonly W103: "W103";
|
|
41
|
+
readonly W104: "W104";
|
|
42
|
+
readonly W105: "W105";
|
|
43
|
+
readonly W106: "W106";
|
|
44
|
+
readonly W107: "W107";
|
|
45
|
+
readonly W108: "W108";
|
|
46
|
+
readonly W109: "W109";
|
|
47
|
+
readonly W110: "W110";
|
|
48
|
+
readonly W300: "W300";
|
|
49
|
+
readonly W301: "W301";
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Error code type for type safety.
|
|
53
|
+
*/
|
|
54
|
+
export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
55
|
+
/**
|
|
56
|
+
* Warning code type for type safety.
|
|
57
|
+
*/
|
|
58
|
+
export type WarningCode = (typeof WARNING_CODES)[keyof typeof WARNING_CODES];
|
|
59
|
+
/**
|
|
60
|
+
* Error type to error code mapping.
|
|
61
|
+
* Maps friendly error type names (as used in test expectations) to error codes.
|
|
62
|
+
*/
|
|
63
|
+
export declare const ERROR_TYPE_TO_CODE: Record<string, ErrorCode>;
|
|
64
|
+
//# sourceMappingURL=error-codes.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error code constants.
|
|
3
|
+
* Centralized definition of all error codes used in the analysis system.
|
|
4
|
+
* Organized by category (similar to HTTP status codes) for future expansion.
|
|
5
|
+
* This ensures type safety, prevents typos, and provides a single source of truth.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Error codes for analysis rules.
|
|
9
|
+
* Organized in categories with ranges for future expansion.
|
|
10
|
+
*/
|
|
11
|
+
export const ERROR_CODES = {
|
|
12
|
+
// 0xx: Configuration & Setup Errors
|
|
13
|
+
E000: 'E000', // Tool Not Found
|
|
14
|
+
// 1xx: Schema & Contract Errors (Static Analysis)
|
|
15
|
+
E100: 'E100', // Missing Output Schema
|
|
16
|
+
E101: 'E101', // Missing Tool Description
|
|
17
|
+
E102: 'E102', // Underspecified Required Input
|
|
18
|
+
E103: 'E103', // Type Mismatch
|
|
19
|
+
E104: 'E104', // Parameter Not In Description
|
|
20
|
+
E105: 'E105', // Free Text Propagation
|
|
21
|
+
E106: 'E106', // Output Not Guaranteed
|
|
22
|
+
E107: 'E107', // Circular Dependency
|
|
23
|
+
E108: 'E108', // Implicit User Input
|
|
24
|
+
E109: 'E109', // Non-Serializable
|
|
25
|
+
E110: 'E110', // Tool Ambiguity
|
|
26
|
+
// 2xx: Input Validation Errors
|
|
27
|
+
E200: 'E200', // Input Validation Failed
|
|
28
|
+
// 3xx: Output Validation Errors
|
|
29
|
+
E300: 'E300', // Output Validation Failed
|
|
30
|
+
E301: 'E301', // Output Explosion
|
|
31
|
+
// 4xx: Execution Errors
|
|
32
|
+
E400: 'E400', // Tool Execution Failed
|
|
33
|
+
E403: 'E403', // Unbounded Execution
|
|
34
|
+
// 5xx: Behavioral Errors (Side Effects & Dependencies)
|
|
35
|
+
E500: 'E500', // Side Effect Detected
|
|
36
|
+
E501: 'E501', // Hidden Dependency
|
|
37
|
+
// 6xx: Test & Validation Framework Errors
|
|
38
|
+
E600: 'E600', // Unexpected Test Result
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Warning code constants.
|
|
42
|
+
*/
|
|
43
|
+
export const WARNING_CODES = {
|
|
44
|
+
// 1xx: Schema & Contract Warnings (Static Analysis)
|
|
45
|
+
W100: 'W100', // Implicit Dependency
|
|
46
|
+
W101: 'W101', // Free Text Without Normalization
|
|
47
|
+
W102: 'W102', // Missing Examples
|
|
48
|
+
W103: 'W103', // Overloaded Responsibility
|
|
49
|
+
W104: 'W104', // Generic Description
|
|
50
|
+
W105: 'W105', // Optional As Required
|
|
51
|
+
W106: 'W106', // Broad Output Schema
|
|
52
|
+
W107: 'W107', // Multiple Entry Points
|
|
53
|
+
W108: 'W108', // Hidden Side Effects
|
|
54
|
+
W109: 'W109', // Output Not Reusable
|
|
55
|
+
W110: 'W110', // Weak Schema
|
|
56
|
+
// 3xx: Output Validation Warnings
|
|
57
|
+
W300: 'W300', // High Entropy Output
|
|
58
|
+
W301: 'W301', // Unstable Defaults
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Error type to error code mapping.
|
|
62
|
+
* Maps friendly error type names (as used in test expectations) to error codes.
|
|
63
|
+
*/
|
|
64
|
+
export const ERROR_TYPE_TO_CODE = {
|
|
65
|
+
side_effect: ERROR_CODES.E500,
|
|
66
|
+
output_explosion: ERROR_CODES.E301,
|
|
67
|
+
hidden_dependency: ERROR_CODES.E501,
|
|
68
|
+
unbounded_execution: ERROR_CODES.E403,
|
|
69
|
+
output_validation: ERROR_CODES.E300,
|
|
70
|
+
input_validation: ERROR_CODES.E200,
|
|
71
|
+
execution_error: ERROR_CODES.E400,
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=error-codes.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E000: Tool Not Found
|
|
3
|
+
*
|
|
4
|
+
* Condition: Tool is not found in MCP server
|
|
5
|
+
*
|
|
6
|
+
* Why this is fatal:
|
|
7
|
+
* - Tool contract exists but tool is not registered in server
|
|
8
|
+
* - Indicates configuration mismatch or missing tool implementation
|
|
9
|
+
* - Cannot test or validate a tool that doesn't exist
|
|
10
|
+
*/
|
|
11
|
+
import { BaseRule } from '../base.js';
|
|
12
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Context for tool not found detection.
|
|
15
|
+
*/
|
|
16
|
+
export interface ToolNotFoundContext {
|
|
17
|
+
/** Tool name */
|
|
18
|
+
toolName: string;
|
|
19
|
+
/** MCP server script name */
|
|
20
|
+
scriptName: string;
|
|
21
|
+
}
|
|
22
|
+
declare class E000ToolNotFoundRule extends BaseRule {
|
|
23
|
+
readonly id: "E000";
|
|
24
|
+
readonly severity: "error";
|
|
25
|
+
readonly ruleName = "Tool Not Found";
|
|
26
|
+
readonly description = "Tool is not found in MCP server. Tool contract exists but tool is not registered in the server script.";
|
|
27
|
+
check(_ctx: AnalysisContext): Diagnostic[];
|
|
28
|
+
/**
|
|
29
|
+
* Check with runtime context (called from test orchestrator).
|
|
30
|
+
*/
|
|
31
|
+
checkWithRuntimeContext(runtimeCtx: ToolNotFoundContext): Diagnostic[];
|
|
32
|
+
}
|
|
33
|
+
export declare const E000ToolNotFound: E000ToolNotFoundRule;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=e000-tool-not-found.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E000: Tool Not Found
|
|
3
|
+
*
|
|
4
|
+
* Condition: Tool is not found in MCP server
|
|
5
|
+
*
|
|
6
|
+
* Why this is fatal:
|
|
7
|
+
* - Tool contract exists but tool is not registered in server
|
|
8
|
+
* - Indicates configuration mismatch or missing tool implementation
|
|
9
|
+
* - Cannot test or validate a tool that doesn't exist
|
|
10
|
+
*/
|
|
11
|
+
import { BaseRule } from '../base.js';
|
|
12
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
13
|
+
class E000ToolNotFoundRule extends BaseRule {
|
|
14
|
+
id = ERROR_CODES.E000;
|
|
15
|
+
severity = 'error';
|
|
16
|
+
ruleName = 'Tool Not Found';
|
|
17
|
+
description = 'Tool is not found in MCP server. Tool contract exists but tool is not registered in the server script.';
|
|
18
|
+
check(_ctx) {
|
|
19
|
+
// This rule requires runtime context (checked in orchestrator)
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Check with runtime context (called from test orchestrator).
|
|
24
|
+
*/
|
|
25
|
+
checkWithRuntimeContext(runtimeCtx) {
|
|
26
|
+
const diagnostics = [];
|
|
27
|
+
diagnostics.push(this.createDiagnostic(`Tool "${runtimeCtx.toolName}" not found in MCP server (running: ${runtimeCtx.scriptName}). Ensure the tool is registered in the server script.`, runtimeCtx.toolName, undefined, `Verify that "${runtimeCtx.toolName}" is registered in your MCP server script (${runtimeCtx.scriptName}). If the tool is in a different server file, update the 'script' configuration in syrin.yaml.`));
|
|
28
|
+
return diagnostics;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export const E000ToolNotFound = new E000ToolNotFoundRule();
|
|
32
|
+
//# sourceMappingURL=e000-tool-not-found.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E001: Missing Output Schema
|
|
3
|
+
*
|
|
4
|
+
* Condition: Tool does not declare an output schema
|
|
5
|
+
*
|
|
6
|
+
* Why this is fatal:
|
|
7
|
+
* - Downstream tools cannot reason about outputs
|
|
8
|
+
* - LLM will invent structure
|
|
9
|
+
* - Reproducibility is impossible
|
|
10
|
+
*/
|
|
11
|
+
import { BaseRule } from '../base.js';
|
|
12
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
13
|
+
declare class E001MissingOutputSchemaRule extends BaseRule {
|
|
14
|
+
readonly id: "E001";
|
|
15
|
+
readonly severity: "error";
|
|
16
|
+
readonly ruleName = "Missing Output Schema";
|
|
17
|
+
readonly description = "Tool does not declare an output schema. Downstream tools cannot safely consume its output.";
|
|
18
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
19
|
+
}
|
|
20
|
+
export declare const E001MissingOutputSchema: E001MissingOutputSchemaRule;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=e001-missing-output-schema.d.ts.map
|