@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,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E101: Missing Tool Description
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool has no description OR
|
|
6
|
+
* - Tool description is empty or only whitespace
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - LLM cannot understand what the tool does
|
|
10
|
+
* - Tool selection becomes ambiguous
|
|
11
|
+
* - Critical for tool discovery and usage
|
|
12
|
+
*/
|
|
13
|
+
import { BaseRule } from '../base.js';
|
|
14
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
15
|
+
class E101MissingToolDescriptionRule extends BaseRule {
|
|
16
|
+
id = ERROR_CODES.E101;
|
|
17
|
+
severity = 'error';
|
|
18
|
+
ruleName = 'Missing Tool Description';
|
|
19
|
+
description = 'Tool is missing a description. LLM cannot understand what the tool does.';
|
|
20
|
+
check(ctx) {
|
|
21
|
+
const diagnostics = [];
|
|
22
|
+
for (const tool of ctx.tools) {
|
|
23
|
+
// Check if description is missing or empty/whitespace only
|
|
24
|
+
const hasDescription = Boolean(tool.description && tool.description.trim().length > 0);
|
|
25
|
+
if (!hasDescription) {
|
|
26
|
+
diagnostics.push(this.createDiagnostic(`Tool "${tool.name}" is missing a description.`, tool.name, undefined, `Add a clear description to "${tool.name}" explaining what it does, what inputs it expects, and what it returns.`));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return diagnostics;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export const E101MissingToolDescription = new E101MissingToolDescriptionRule();
|
|
33
|
+
//# sourceMappingURL=e101-missing-tool-description.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E102: Underspecified Required Input
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Input parameter is required AND
|
|
6
|
+
* - Type is broad (string, any, object) AND
|
|
7
|
+
* - No description, constraints, enum, regex, or example
|
|
8
|
+
*
|
|
9
|
+
* Why:
|
|
10
|
+
* - LLM will hallucinate values
|
|
11
|
+
* - Tool invocation becomes nondeterministic
|
|
12
|
+
*/
|
|
13
|
+
import { BaseRule } from '../base.js';
|
|
14
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
15
|
+
declare class E102UnderspecifiedRequiredInputRule extends BaseRule {
|
|
16
|
+
readonly id: "E102";
|
|
17
|
+
readonly severity: "error";
|
|
18
|
+
readonly ruleName = "Underspecified Required Input";
|
|
19
|
+
readonly description = "Required parameter is underspecified. LLM may pass invalid or ambiguous values.";
|
|
20
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
21
|
+
}
|
|
22
|
+
export declare const E102UnderspecifiedRequiredInput: E102UnderspecifiedRequiredInputRule;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=e102-underspecified-input.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E102: Underspecified Required Input
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Input parameter is required AND
|
|
6
|
+
* - Type is broad (string, any, object) AND
|
|
7
|
+
* - No description, constraints, enum, regex, or example
|
|
8
|
+
*
|
|
9
|
+
* Why:
|
|
10
|
+
* - LLM will hallucinate values
|
|
11
|
+
* - Tool invocation becomes nondeterministic
|
|
12
|
+
*/
|
|
13
|
+
import { BaseRule } from '../base.js';
|
|
14
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
15
|
+
class E102UnderspecifiedRequiredInputRule extends BaseRule {
|
|
16
|
+
id = ERROR_CODES.E102;
|
|
17
|
+
severity = 'error';
|
|
18
|
+
ruleName = 'Underspecified Required Input';
|
|
19
|
+
description = 'Required parameter is underspecified. LLM may pass invalid or ambiguous values.';
|
|
20
|
+
check(ctx) {
|
|
21
|
+
const diagnostics = [];
|
|
22
|
+
// Broad types that need constraints
|
|
23
|
+
const broadTypes = new Set(['string', 'any', 'object']);
|
|
24
|
+
for (const tool of ctx.tools) {
|
|
25
|
+
for (const input of tool.inputs) {
|
|
26
|
+
// Check if type is broad
|
|
27
|
+
if (!broadTypes.has(input.type)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
// Check if it has any constraints
|
|
31
|
+
const hasDescription = Boolean(input.description && input.description.trim());
|
|
32
|
+
const hasEnum = Boolean(input.enum && input.enum.length > 0);
|
|
33
|
+
const hasPattern = Boolean(input.pattern);
|
|
34
|
+
const hasExample = input.example !== undefined;
|
|
35
|
+
// If it's broad and has no constraints, it's underspecified
|
|
36
|
+
if (!hasDescription && !hasEnum && !hasPattern && !hasExample) {
|
|
37
|
+
if (input.required) {
|
|
38
|
+
// Required parameter without constraints - error
|
|
39
|
+
diagnostics.push(this.createDiagnostic(`Required parameter "${input.name}" in tool "${tool.name}" is underspecified. LLM may pass invalid or ambiguous values.`, tool.name, input.name, `Add constraints to "${input.name}": provide a description, enum values, regex pattern, or example.`));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Optional parameter without constraints - flag as warning since it's less critical
|
|
43
|
+
diagnostics.push(this.createDiagnostic(`Optional parameter "${input.name}" in tool "${tool.name}" is underspecified. LLM may pass invalid or ambiguous values.`, tool.name, input.name, `Add constraints to "${input.name}": provide a description, enum values, regex pattern, or example.`, undefined, 'warning'));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return diagnostics;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export const E102UnderspecifiedRequiredInput = new E102UnderspecifiedRequiredInputRule();
|
|
52
|
+
//# sourceMappingURL=e102-underspecified-input.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E103: Unsafe Tool Chaining (Type Mismatch)
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool A output flows into Tool B input AND
|
|
6
|
+
* - Output type incompatible with input type
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - Tool chains silently break
|
|
10
|
+
* - Bugs appear "random"
|
|
11
|
+
*/
|
|
12
|
+
import { BaseRule } from '../base.js';
|
|
13
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
14
|
+
declare class E103TypeMismatchRule extends BaseRule {
|
|
15
|
+
readonly id: "E103";
|
|
16
|
+
readonly severity: "error";
|
|
17
|
+
readonly ruleName = "Unsafe Tool Chaining (Type Mismatch)";
|
|
18
|
+
readonly description = "Output type incompatible with downstream input type. Tool chains will break.";
|
|
19
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
20
|
+
}
|
|
21
|
+
export declare const E103TypeMismatch: E103TypeMismatchRule;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=e103-type-mismatch.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E103: Unsafe Tool Chaining (Type Mismatch)
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool A output flows into Tool B input AND
|
|
6
|
+
* - Output type incompatible with input type
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - Tool chains silently break
|
|
10
|
+
* - Bugs appear "random"
|
|
11
|
+
*/
|
|
12
|
+
import { BaseRule } from '../base.js';
|
|
13
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
14
|
+
/**
|
|
15
|
+
* Type compatibility matrix.
|
|
16
|
+
* Maps each output type to the list of input types it can be safely converted to.
|
|
17
|
+
*/
|
|
18
|
+
const COMPATIBILITY_MATRIX = {
|
|
19
|
+
string: ['string'], // Only string outputs to string inputs
|
|
20
|
+
number: ['number', 'string'],
|
|
21
|
+
integer: ['integer', 'number', 'string'],
|
|
22
|
+
boolean: ['boolean', 'string'],
|
|
23
|
+
array: ['array', 'string'],
|
|
24
|
+
object: ['object', 'string'],
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Check if two types are incompatible.
|
|
28
|
+
*/
|
|
29
|
+
function areTypesIncompatible(outputType, inputType) {
|
|
30
|
+
// Exact match is always compatible
|
|
31
|
+
if (outputType === inputType) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
// Define which types can be safely converted to which inputs
|
|
35
|
+
const compatibleInputs = COMPATIBILITY_MATRIX[outputType];
|
|
36
|
+
if (!compatibleInputs) {
|
|
37
|
+
// Unknown output type - consider incompatible by default
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return !compatibleInputs.includes(inputType);
|
|
41
|
+
}
|
|
42
|
+
class E103TypeMismatchRule extends BaseRule {
|
|
43
|
+
id = ERROR_CODES.E103;
|
|
44
|
+
severity = 'error';
|
|
45
|
+
ruleName = 'Unsafe Tool Chaining (Type Mismatch)';
|
|
46
|
+
description = 'Output type incompatible with downstream input type. Tool chains will break.';
|
|
47
|
+
check(ctx) {
|
|
48
|
+
const diagnostics = [];
|
|
49
|
+
// Only check high-confidence dependencies (>= 0.8)
|
|
50
|
+
const highConfidenceDeps = ctx.dependencies.filter(d => d.confidence >= 0.8);
|
|
51
|
+
for (const dep of highConfidenceDeps) {
|
|
52
|
+
// Find the output and input fields
|
|
53
|
+
const fromTool = ctx.indexes.toolIndex.get(dep.fromTool.toLowerCase());
|
|
54
|
+
const toTool = ctx.indexes.toolIndex.get(dep.toTool.toLowerCase());
|
|
55
|
+
if (!fromTool || !toTool) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const fromField = fromTool.outputs.find(f => f.name === dep.fromField);
|
|
59
|
+
const toField = toTool.inputs.find(f => f.name === dep.toField);
|
|
60
|
+
if (!fromField || !toField) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
// Check type compatibility
|
|
64
|
+
if (areTypesIncompatible(fromField.type, toField.type)) {
|
|
65
|
+
diagnostics.push(this.createDiagnostic(`Tool "${dep.toTool}" parameter "${dep.toField}" depends on output from "${dep.fromTool}", but types are incompatible (${fromField.type} → ${toField.type}).`, dep.toTool, dep.toField, `Ensure "${dep.fromTool}" outputs ${toField.type}, or modify "${dep.toTool}" to accept ${fromField.type}.`));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return diagnostics;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export const E103TypeMismatch = new E103TypeMismatchRule();
|
|
72
|
+
//# sourceMappingURL=e103-type-mismatch.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E104: Required Input Not Mentioned in Description
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Required input exists
|
|
6
|
+
* - Tool description does not reference it directly or indirectly
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - LLM does not know parameter exists or matters
|
|
10
|
+
*/
|
|
11
|
+
import { BaseRule } from '../base.js';
|
|
12
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
13
|
+
declare class E104ParamNotInDescriptionRule extends BaseRule {
|
|
14
|
+
readonly id: "E104";
|
|
15
|
+
readonly severity: "error";
|
|
16
|
+
readonly ruleName = "Required Input Not Mentioned in Description";
|
|
17
|
+
readonly description = "Required parameter is not referenced in tool description. LLM may not know parameter exists.";
|
|
18
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
19
|
+
}
|
|
20
|
+
export declare const E104ParamNotInDescription: E104ParamNotInDescriptionRule;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=e104-param-not-in-description.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E104: Required Input Not Mentioned in Description
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Required input exists
|
|
6
|
+
* - Tool description does not reference it directly or indirectly
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - LLM does not know parameter exists or matters
|
|
10
|
+
*/
|
|
11
|
+
import { BaseRule } from '../base.js';
|
|
12
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
13
|
+
/**
|
|
14
|
+
* Check if a parameter name appears in the description (case-insensitive).
|
|
15
|
+
*/
|
|
16
|
+
function isParameterMentioned(description, paramName) {
|
|
17
|
+
const descLower = description.toLowerCase();
|
|
18
|
+
const paramLower = paramName.toLowerCase();
|
|
19
|
+
// Exact match
|
|
20
|
+
if (descLower.includes(paramLower)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
// Check if words from param name appear in description
|
|
24
|
+
const paramWords = paramLower.split(/\W+/).filter(w => w.length > 2);
|
|
25
|
+
const descWords = descLower.split(/\W+/);
|
|
26
|
+
for (const word of paramWords) {
|
|
27
|
+
if (descWords.includes(word)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
class E104ParamNotInDescriptionRule extends BaseRule {
|
|
34
|
+
id = ERROR_CODES.E104;
|
|
35
|
+
severity = 'error';
|
|
36
|
+
ruleName = 'Required Input Not Mentioned in Description';
|
|
37
|
+
description = 'Required parameter is not referenced in tool description. LLM may not know parameter exists.';
|
|
38
|
+
check(ctx) {
|
|
39
|
+
const diagnostics = [];
|
|
40
|
+
for (const tool of ctx.tools) {
|
|
41
|
+
const description = tool.description || '';
|
|
42
|
+
for (const input of tool.inputs) {
|
|
43
|
+
// Only check required inputs
|
|
44
|
+
if (!input.required) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// Check if parameter is mentioned in description
|
|
48
|
+
if (!isParameterMentioned(description, input.name)) {
|
|
49
|
+
diagnostics.push(this.createDiagnostic(`Required parameter "${input.name}" is not referenced in "${tool.name}" description.`, tool.name, input.name, `Mention "${input.name}" in the tool description so the LLM knows it exists and is required.`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return diagnostics;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export const E104ParamNotInDescription = new E104ParamNotInDescriptionRule();
|
|
57
|
+
//# sourceMappingURL=e104-param-not-in-description.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E105: Unsafe Tool Chaining (Free Text Propagation)
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Output is unconstrained string
|
|
6
|
+
* - Used as input to another tool
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - LLM passes sentences instead of data
|
|
10
|
+
* - Most common real-world failure
|
|
11
|
+
*/
|
|
12
|
+
import { BaseRule } from '../base.js';
|
|
13
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
14
|
+
declare class E105FreeTextPropagationRule extends BaseRule {
|
|
15
|
+
readonly id: "E105";
|
|
16
|
+
readonly severity: "error";
|
|
17
|
+
readonly ruleName = "Unsafe Tool Chaining (Free Text Propagation)";
|
|
18
|
+
readonly description = "Free-text output is used by another tool. This is unsafe without constraints.";
|
|
19
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
20
|
+
}
|
|
21
|
+
export declare const E105FreeTextPropagation: E105FreeTextPropagationRule;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=e105-free-text-propagation.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E105: Unsafe Tool Chaining (Free Text Propagation)
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Output is unconstrained string
|
|
6
|
+
* - Used as input to another tool
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - LLM passes sentences instead of data
|
|
10
|
+
* - Most common real-world failure
|
|
11
|
+
*/
|
|
12
|
+
import { BaseRule } from '../base.js';
|
|
13
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
14
|
+
class E105FreeTextPropagationRule extends BaseRule {
|
|
15
|
+
id = ERROR_CODES.E105;
|
|
16
|
+
severity = 'error';
|
|
17
|
+
ruleName = 'Unsafe Tool Chaining (Free Text Propagation)';
|
|
18
|
+
description = 'Free-text output is used by another tool. This is unsafe without constraints.';
|
|
19
|
+
check(ctx) {
|
|
20
|
+
const diagnostics = [];
|
|
21
|
+
// Only check high-confidence dependencies (>= 0.8)
|
|
22
|
+
const highConfidenceDeps = ctx.dependencies.filter(d => d.confidence >= 0.8);
|
|
23
|
+
for (const dep of highConfidenceDeps) {
|
|
24
|
+
// Find the output field
|
|
25
|
+
const fromTool = ctx.indexes.toolIndex.get(dep.fromTool.toLowerCase());
|
|
26
|
+
if (!fromTool) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const fromField = fromTool.outputs.find(f => f.name === dep.fromField);
|
|
30
|
+
if (!fromField) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
// Check if output is unconstrained string
|
|
34
|
+
const isString = fromField.type === 'string';
|
|
35
|
+
const hasEnum = Boolean(fromField.enum && fromField.enum.length > 0);
|
|
36
|
+
const hasPattern = Boolean(fromField.pattern);
|
|
37
|
+
// If it's a string with no constraints (enum/pattern), it's free text
|
|
38
|
+
// Note: hasDescription is NOT a constraint, only documentation
|
|
39
|
+
if (isString && !hasEnum && !hasPattern) {
|
|
40
|
+
diagnostics.push(this.createDiagnostic(`Free-text output from "${dep.fromTool}" (field: "${dep.fromField}") is used by "${dep.toTool}". This is unsafe without constraints.`, dep.toTool, dep.toField, `Constrain the output of "${dep.fromTool}" by adding enum values or regex pattern.`));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return diagnostics;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export const E105FreeTextPropagation = new E105FreeTextPropagationRule();
|
|
47
|
+
//# sourceMappingURL=e105-free-text-propagation.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E106: Output Used Downstream but Not Guaranteed
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool output is optional / nullable
|
|
6
|
+
* - Used downstream without fallback
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - Silent null propagation
|
|
10
|
+
* - Hard-to-debug failures
|
|
11
|
+
*/
|
|
12
|
+
import { BaseRule } from '../base.js';
|
|
13
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
14
|
+
declare class E106OutputNotGuaranteedRule extends BaseRule {
|
|
15
|
+
readonly id: "E106";
|
|
16
|
+
readonly severity: "error";
|
|
17
|
+
readonly ruleName = "Output Used Downstream but Not Guaranteed";
|
|
18
|
+
readonly description = "Output of tool is not guaranteed, but is used by downstream tools without fallback.";
|
|
19
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
20
|
+
}
|
|
21
|
+
export declare const E106OutputNotGuaranteed: E106OutputNotGuaranteedRule;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=e106-output-not-guaranteed.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E106: Output Used Downstream but Not Guaranteed
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool output is optional / nullable
|
|
6
|
+
* - Used downstream without fallback
|
|
7
|
+
*
|
|
8
|
+
* Why:
|
|
9
|
+
* - Silent null propagation
|
|
10
|
+
* - Hard-to-debug failures
|
|
11
|
+
*/
|
|
12
|
+
import { BaseRule } from '../base.js';
|
|
13
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
14
|
+
class E106OutputNotGuaranteedRule extends BaseRule {
|
|
15
|
+
id = ERROR_CODES.E106;
|
|
16
|
+
severity = 'error';
|
|
17
|
+
ruleName = 'Output Used Downstream but Not Guaranteed';
|
|
18
|
+
description = 'Output of tool is not guaranteed, but is used by downstream tools without fallback.';
|
|
19
|
+
check(ctx) {
|
|
20
|
+
const diagnostics = [];
|
|
21
|
+
// Only check high-confidence dependencies (>= 0.8)
|
|
22
|
+
const highConfidenceDeps = ctx.dependencies.filter(d => d.confidence >= 0.8);
|
|
23
|
+
for (const dep of highConfidenceDeps) {
|
|
24
|
+
// Find the output field
|
|
25
|
+
const fromTool = ctx.indexes.toolIndex.get(dep.fromTool.toLowerCase());
|
|
26
|
+
if (!fromTool) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const fromField = fromTool.outputs.find(f => f.name === dep.fromField);
|
|
30
|
+
if (!fromField) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
// Find the downstream input field
|
|
34
|
+
const toTool = ctx.indexes.toolIndex.get(dep.toTool.toLowerCase());
|
|
35
|
+
if (!toTool) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const toField = toTool.inputs.find(f => f.name === dep.toField);
|
|
39
|
+
if (!toField) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
// Check if output is not guaranteed and downstream requires it without fallback
|
|
43
|
+
// (1) Optional upstream always triggers when downstream requires it
|
|
44
|
+
if (!fromField.required && toField.required === true) {
|
|
45
|
+
diagnostics.push(this.createDiagnostic(`Output of "${dep.fromTool}" (field: "${dep.fromField}") is optional/may be missing but is required by "${dep.toTool}".`, dep.toTool, dep.toField, `Make the output of "${dep.fromTool}" required, or add fallback/handling in "${dep.toTool}" for when the field is missing.`));
|
|
46
|
+
}
|
|
47
|
+
// (2) Nullable upstream only triggers when downstream is required AND not nullable (can't handle null)
|
|
48
|
+
if (fromField.nullable === true &&
|
|
49
|
+
toField.required === true &&
|
|
50
|
+
toField.nullable !== true) {
|
|
51
|
+
diagnostics.push(this.createDiagnostic(`Output of "${dep.fromTool}" (field: "${dep.fromField}") is nullable but "${dep.toTool}" cannot accept null.`, dep.toTool, dep.toField, `Make the output of "${dep.fromTool}" non-nullable, or ensure "${dep.toTool}" handles null values.`));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return diagnostics;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export const E106OutputNotGuaranteed = new E106OutputNotGuaranteedRule();
|
|
58
|
+
//# sourceMappingURL=e106-output-not-guaranteed.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E107: Circular Tool Dependency
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool dependency graph contains a cycle
|
|
6
|
+
*
|
|
7
|
+
* Why:
|
|
8
|
+
* - LLMs cannot reason about cycles
|
|
9
|
+
* - Execution becomes undefined
|
|
10
|
+
*/
|
|
11
|
+
import { BaseRule } from '../base.js';
|
|
12
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
13
|
+
declare class E107CircularDependencyRule extends BaseRule {
|
|
14
|
+
readonly id: "E107";
|
|
15
|
+
readonly severity: "error";
|
|
16
|
+
readonly ruleName = "Circular Tool Dependency";
|
|
17
|
+
readonly description = "Circular dependency detected between tools. Execution becomes undefined.";
|
|
18
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
19
|
+
}
|
|
20
|
+
export declare const E107CircularDependency: E107CircularDependencyRule;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=e107-circular-dependency.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E107: Circular Tool Dependency
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool dependency graph contains a cycle
|
|
6
|
+
*
|
|
7
|
+
* Why:
|
|
8
|
+
* - LLMs cannot reason about cycles
|
|
9
|
+
* - Execution becomes undefined
|
|
10
|
+
*/
|
|
11
|
+
import { BaseRule } from '../base.js';
|
|
12
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
13
|
+
/**
|
|
14
|
+
* Detect cycles in the dependency graph using DFS.
|
|
15
|
+
*/
|
|
16
|
+
function detectCycles(dependencies) {
|
|
17
|
+
// Build adjacency list
|
|
18
|
+
const graph = new Map();
|
|
19
|
+
for (const dep of dependencies) {
|
|
20
|
+
if (!graph.has(dep.fromTool)) {
|
|
21
|
+
graph.set(dep.fromTool, []);
|
|
22
|
+
}
|
|
23
|
+
graph.get(dep.fromTool).push(dep.toTool);
|
|
24
|
+
}
|
|
25
|
+
const cycles = [];
|
|
26
|
+
const visited = new Set();
|
|
27
|
+
const recStack = new Set();
|
|
28
|
+
function dfs(tool, path) {
|
|
29
|
+
visited.add(tool);
|
|
30
|
+
recStack.add(tool);
|
|
31
|
+
path.push(tool);
|
|
32
|
+
const neighbors = graph.get(tool) || [];
|
|
33
|
+
for (const neighbor of neighbors) {
|
|
34
|
+
if (!visited.has(neighbor)) {
|
|
35
|
+
dfs(neighbor, [...path]);
|
|
36
|
+
}
|
|
37
|
+
else if (recStack.has(neighbor)) {
|
|
38
|
+
// Found a cycle
|
|
39
|
+
const cycleStart = path.indexOf(neighbor);
|
|
40
|
+
if (cycleStart !== -1) {
|
|
41
|
+
cycles.push([...path.slice(cycleStart), neighbor]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
recStack.delete(tool);
|
|
46
|
+
}
|
|
47
|
+
// Check all tools
|
|
48
|
+
for (const dep of dependencies) {
|
|
49
|
+
if (!visited.has(dep.fromTool)) {
|
|
50
|
+
dfs(dep.fromTool, []);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return cycles;
|
|
54
|
+
}
|
|
55
|
+
class E107CircularDependencyRule extends BaseRule {
|
|
56
|
+
id = ERROR_CODES.E107;
|
|
57
|
+
severity = 'error';
|
|
58
|
+
ruleName = 'Circular Tool Dependency';
|
|
59
|
+
description = 'Circular dependency detected between tools. Execution becomes undefined.';
|
|
60
|
+
check(ctx) {
|
|
61
|
+
const diagnostics = [];
|
|
62
|
+
// Only check high-confidence dependencies (>= 0.8) for cycles
|
|
63
|
+
const highConfidenceDeps = ctx.dependencies.filter(d => d.confidence >= 0.8);
|
|
64
|
+
if (highConfidenceDeps.length === 0) {
|
|
65
|
+
return diagnostics;
|
|
66
|
+
}
|
|
67
|
+
const cycles = detectCycles(highConfidenceDeps);
|
|
68
|
+
// Report each cycle
|
|
69
|
+
const reportedCycles = new Set();
|
|
70
|
+
for (const cycle of cycles) {
|
|
71
|
+
// Create a canonical representation of the cycle (sort a copy to avoid mutating original)
|
|
72
|
+
const cycleKey = [...cycle].sort().join(' → ');
|
|
73
|
+
if (reportedCycles.has(cycleKey)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
reportedCycles.add(cycleKey);
|
|
77
|
+
const cycleStr = cycle.join(' → ');
|
|
78
|
+
diagnostics.push(this.createDiagnostic(`Circular dependency detected between tools: ${cycleStr}.`, undefined, undefined, `Break the cycle by removing or restructuring dependencies between: ${cycle.join(', ')}.`));
|
|
79
|
+
}
|
|
80
|
+
return diagnostics;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export const E107CircularDependency = new E107CircularDependencyRule();
|
|
84
|
+
//# sourceMappingURL=e107-circular-dependency.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E108: Tool Depends on User Input Indirectly
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool expects data
|
|
6
|
+
* - Only source is implicit user memory / conversation
|
|
7
|
+
* - No explicit tool provides it
|
|
8
|
+
*
|
|
9
|
+
* Why:
|
|
10
|
+
* - Relies on hallucinated context
|
|
11
|
+
*/
|
|
12
|
+
import { BaseRule } from '../base.js';
|
|
13
|
+
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
14
|
+
declare class E108ImplicitUserInputRule extends BaseRule {
|
|
15
|
+
readonly id: "E108";
|
|
16
|
+
readonly severity: "error";
|
|
17
|
+
readonly ruleName = "Tool Depends on User Input Indirectly";
|
|
18
|
+
readonly description = "Tool depends on implicit user context with no explicit source.";
|
|
19
|
+
check(ctx: AnalysisContext): Diagnostic[];
|
|
20
|
+
}
|
|
21
|
+
export declare const E108ImplicitUserInput: E108ImplicitUserInputRule;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=e108-implicit-user-input.d.ts.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E108: Tool Depends on User Input Indirectly
|
|
3
|
+
*
|
|
4
|
+
* Condition:
|
|
5
|
+
* - Tool expects data
|
|
6
|
+
* - Only source is implicit user memory / conversation
|
|
7
|
+
* - No explicit tool provides it
|
|
8
|
+
*
|
|
9
|
+
* Why:
|
|
10
|
+
* - Relies on hallucinated context
|
|
11
|
+
*/
|
|
12
|
+
import { BaseRule } from '../base.js';
|
|
13
|
+
import { ERROR_CODES } from '../error-codes.js';
|
|
14
|
+
/**
|
|
15
|
+
* Keywords that suggest user-provided input.
|
|
16
|
+
*/
|
|
17
|
+
const USER_DATA_INDICATORS = [
|
|
18
|
+
'user',
|
|
19
|
+
'person',
|
|
20
|
+
'name',
|
|
21
|
+
'email',
|
|
22
|
+
'location',
|
|
23
|
+
'address',
|
|
24
|
+
'preference',
|
|
25
|
+
];
|
|
26
|
+
class E108ImplicitUserInputRule extends BaseRule {
|
|
27
|
+
id = ERROR_CODES.E108;
|
|
28
|
+
severity = 'error';
|
|
29
|
+
ruleName = 'Tool Depends on User Input Indirectly';
|
|
30
|
+
description = 'Tool depends on implicit user context with no explicit source.';
|
|
31
|
+
check(ctx) {
|
|
32
|
+
const diagnostics = [];
|
|
33
|
+
for (const tool of ctx.tools) {
|
|
34
|
+
for (const input of tool.inputs) {
|
|
35
|
+
if (!input.required) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
// Check if there's any tool that provides this input
|
|
39
|
+
// Look for output fields with similar names
|
|
40
|
+
const fieldName = input.name.toLowerCase();
|
|
41
|
+
let hasExplicitSource = false;
|
|
42
|
+
// Token-based matching: split on non-alphanumeric and camelCase boundaries
|
|
43
|
+
// Compute fieldTokens once per field since it only depends on fieldName
|
|
44
|
+
const fieldTokens = new Set(fieldName
|
|
45
|
+
.split(/[^\w]+|(?<=[a-z])(?=[A-Z])/)
|
|
46
|
+
.filter(t => t.length > 0));
|
|
47
|
+
for (const otherTool of ctx.tools) {
|
|
48
|
+
if (otherTool.name === tool.name) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
for (const output of otherTool.outputs) {
|
|
52
|
+
const outputName = output.name.toLowerCase();
|
|
53
|
+
// Check for exact match or token-based match
|
|
54
|
+
if (outputName === fieldName) {
|
|
55
|
+
hasExplicitSource = true;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
// Token-based matching: compute outputTokens per output
|
|
59
|
+
const outputTokens = new Set(outputName
|
|
60
|
+
.split(/[^\w]+|(?<=[a-z])(?=[A-Z])/)
|
|
61
|
+
.filter(t => t.length > 0));
|
|
62
|
+
// Check for token intersection
|
|
63
|
+
const hasTokenMatch = Array.from(fieldTokens).some(token => outputTokens.has(token) && token.length >= 3) ||
|
|
64
|
+
Array.from(outputTokens).some(token => fieldTokens.has(token) && token.length >= 3);
|
|
65
|
+
if (hasTokenMatch) {
|
|
66
|
+
hasExplicitSource = true;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (hasExplicitSource) {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Also check dependencies
|
|
75
|
+
if (!hasExplicitSource) {
|
|
76
|
+
const hasDependency = ctx.dependencies.some(d => d.toTool === tool.name &&
|
|
77
|
+
d.toField === input.name &&
|
|
78
|
+
d.confidence >= 0.6);
|
|
79
|
+
if (hasDependency) {
|
|
80
|
+
hasExplicitSource = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// If no explicit source found and input name suggests user data
|
|
84
|
+
const looksLikeUserData = USER_DATA_INDICATORS.some(indicator => fieldName.includes(indicator));
|
|
85
|
+
if (!hasExplicitSource && looksLikeUserData) {
|
|
86
|
+
diagnostics.push(this.createDiagnostic(`Tool "${tool.name}" depends on implicit user context (parameter: "${input.name}") with no explicit source.`, tool.name, input.name, `Create an explicit tool to provide "${input.name}", or ensure it's clearly documented as user input.`));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return diagnostics;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export const E108ImplicitUserInput = new E108ImplicitUserInputRule();
|
|
94
|
+
//# sourceMappingURL=e108-implicit-user-input.js.map
|