@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,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate system-level synthetic test inputs from tool input schema.
|
|
3
|
+
* These inputs test edge cases, type validations, and boundary conditions.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generate synthetic test inputs from a JSON schema.
|
|
7
|
+
* @param schema - Input schema (JSON Schema format)
|
|
8
|
+
* @returns Array of synthetic test inputs
|
|
9
|
+
*/
|
|
10
|
+
export function generateSyntheticInputs(schema) {
|
|
11
|
+
const inputs = [];
|
|
12
|
+
if (!schema || typeof schema !== 'object') {
|
|
13
|
+
return inputs;
|
|
14
|
+
}
|
|
15
|
+
const jsonSchema = schema;
|
|
16
|
+
// Handle object schemas with properties
|
|
17
|
+
if (jsonSchema.type === 'object' && jsonSchema.properties) {
|
|
18
|
+
const properties = jsonSchema.properties;
|
|
19
|
+
const required = jsonSchema.required || [];
|
|
20
|
+
// Generate edge case inputs for each property
|
|
21
|
+
for (const [propName, propSchema] of Object.entries(properties)) {
|
|
22
|
+
const prop = propSchema;
|
|
23
|
+
const propType = Array.isArray(prop.type) ? prop.type[0] : prop.type;
|
|
24
|
+
// Generate edge case values based on property type
|
|
25
|
+
const edgeCases = generateEdgeCasesForProperty(propName, prop, propType);
|
|
26
|
+
for (const edgeCase of edgeCases) {
|
|
27
|
+
inputs.push(edgeCase);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Generate input with all required fields (minimal valid input)
|
|
31
|
+
if (required.length > 0) {
|
|
32
|
+
const minimalInput = {};
|
|
33
|
+
for (const reqField of required) {
|
|
34
|
+
const propSchema = properties[reqField];
|
|
35
|
+
const propType = Array.isArray(propSchema?.type)
|
|
36
|
+
? propSchema.type[0]
|
|
37
|
+
: propSchema?.type;
|
|
38
|
+
minimalInput[reqField] = getDefaultValue(propType);
|
|
39
|
+
}
|
|
40
|
+
inputs.push(minimalInput);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Remove duplicates
|
|
44
|
+
return removeDuplicateInputs(inputs);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Generate edge case values for a specific property.
|
|
48
|
+
*/
|
|
49
|
+
function generateEdgeCasesForProperty(propName, propSchema, propType) {
|
|
50
|
+
const edgeCases = [];
|
|
51
|
+
if (propSchema.enum) {
|
|
52
|
+
// For enums, test each enum value
|
|
53
|
+
for (const enumValue of propSchema.enum) {
|
|
54
|
+
edgeCases.push({ [propName]: enumValue });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
switch (propType) {
|
|
59
|
+
case 'string':
|
|
60
|
+
edgeCases.push({ [propName]: '' }, // Empty string
|
|
61
|
+
{ [propName]: 'test' }, // Normal string
|
|
62
|
+
...(propSchema.minLength !== undefined ? [] : [
|
|
63
|
+
{ [propName]: 'a'.repeat(100) }, // Long string
|
|
64
|
+
]));
|
|
65
|
+
break;
|
|
66
|
+
case 'number':
|
|
67
|
+
case 'integer':
|
|
68
|
+
edgeCases.push({ [propName]: 0 }, { [propName]: 1 }, { [propName]: -1 }, ...(propSchema.minimum !== undefined ? [] : [
|
|
69
|
+
{ [propName]: Number.MAX_SAFE_INTEGER },
|
|
70
|
+
]), ...(propSchema.maximum !== undefined ? [] : [
|
|
71
|
+
{ [propName]: Number.MIN_SAFE_INTEGER },
|
|
72
|
+
]));
|
|
73
|
+
break;
|
|
74
|
+
case 'boolean':
|
|
75
|
+
edgeCases.push({ [propName]: true }, { [propName]: false });
|
|
76
|
+
break;
|
|
77
|
+
case 'array':
|
|
78
|
+
edgeCases.push({ [propName]: [] }, // Empty array
|
|
79
|
+
{ [propName]: [1, 2, 3] } // Array with values
|
|
80
|
+
);
|
|
81
|
+
break;
|
|
82
|
+
case 'object':
|
|
83
|
+
edgeCases.push({ [propName]: {} }, // Empty object
|
|
84
|
+
{ [propName]: { key: 'value' } } // Object with values
|
|
85
|
+
);
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
// For unknown types, generate a basic test value
|
|
89
|
+
edgeCases.push({ [propName]: null });
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return edgeCases;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get a default value for a property type.
|
|
97
|
+
*/
|
|
98
|
+
function getDefaultValue(propType) {
|
|
99
|
+
switch (propType) {
|
|
100
|
+
case 'string':
|
|
101
|
+
return 'test';
|
|
102
|
+
case 'number':
|
|
103
|
+
case 'integer':
|
|
104
|
+
return 0;
|
|
105
|
+
case 'boolean':
|
|
106
|
+
return false;
|
|
107
|
+
case 'array':
|
|
108
|
+
return [];
|
|
109
|
+
case 'object':
|
|
110
|
+
return {};
|
|
111
|
+
default:
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Remove duplicate inputs by normalizing and comparing JSON representation.
|
|
117
|
+
*/
|
|
118
|
+
function removeDuplicateInputs(inputs) {
|
|
119
|
+
const seen = new Set();
|
|
120
|
+
const unique = [];
|
|
121
|
+
for (const input of inputs) {
|
|
122
|
+
const normalized = deepSortObject(input);
|
|
123
|
+
const key = JSON.stringify(normalized);
|
|
124
|
+
if (!seen.has(key)) {
|
|
125
|
+
seen.add(key);
|
|
126
|
+
unique.push(input);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return unique;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Recursively sort object keys for deterministic comparison.
|
|
133
|
+
*/
|
|
134
|
+
function deepSortObject(obj) {
|
|
135
|
+
if (obj === null || obj === undefined) {
|
|
136
|
+
return obj;
|
|
137
|
+
}
|
|
138
|
+
if (Array.isArray(obj)) {
|
|
139
|
+
return obj.map(item => deepSortObject(item));
|
|
140
|
+
}
|
|
141
|
+
if (typeof obj === 'object') {
|
|
142
|
+
const sorted = {};
|
|
143
|
+
const keys = Object.keys(obj).sort();
|
|
144
|
+
for (const key of keys) {
|
|
145
|
+
const value = obj[key];
|
|
146
|
+
if (value !== undefined) {
|
|
147
|
+
sorted[key] = deepSortObject(value);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return sorted;
|
|
151
|
+
}
|
|
152
|
+
return obj;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=synthetic-input-generator.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test input runner.
|
|
3
|
+
* Executes tools with contract-defined test inputs.
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolContract } from './contract-types.js';
|
|
6
|
+
import type { SandboxExecutor, ToolExecutionResult } from '../../runtime/sandbox/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Test execution result with metadata.
|
|
9
|
+
*/
|
|
10
|
+
export type TestExecutionResult = ToolExecutionResult & {
|
|
11
|
+
/** Test case name */
|
|
12
|
+
testName: string;
|
|
13
|
+
/** Test input used */
|
|
14
|
+
testInput: Record<string, unknown>;
|
|
15
|
+
/** Test expectation */
|
|
16
|
+
expectation?: import('./contract-types.js').TestExpectation;
|
|
17
|
+
/** Expected output schema name (optional, for tests expecting different output schema) */
|
|
18
|
+
expectedOutputSchema?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Run contract-defined test cases.
|
|
22
|
+
* @param executor - Sandbox executor
|
|
23
|
+
* @param contract - Tool contract
|
|
24
|
+
* @param determinismRuns - Number of runs for deterministic tests (default: 1)
|
|
25
|
+
* @returns Array of test execution results
|
|
26
|
+
*/
|
|
27
|
+
export declare function runContractTests(executor: SandboxExecutor, contract: ToolContract, toolTimeoutMs?: number): Promise<TestExecutionResult[]>;
|
|
28
|
+
//# sourceMappingURL=test-runner.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test input runner.
|
|
3
|
+
* Executes tools with contract-defined test inputs.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Run contract-defined test cases.
|
|
7
|
+
* @param executor - Sandbox executor
|
|
8
|
+
* @param contract - Tool contract
|
|
9
|
+
* @param determinismRuns - Number of runs for deterministic tests (default: 1)
|
|
10
|
+
* @returns Array of test execution results
|
|
11
|
+
*/
|
|
12
|
+
export async function runContractTests(executor, contract, toolTimeoutMs) {
|
|
13
|
+
if (!contract.tests || contract.tests.length === 0) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
const results = [];
|
|
17
|
+
for (const test of contract.tests) {
|
|
18
|
+
// Set environment variables if specified
|
|
19
|
+
const originalEnv = { ...process.env };
|
|
20
|
+
if (test.env) {
|
|
21
|
+
for (const [key, value] of Object.entries(test.env)) {
|
|
22
|
+
process.env[key] = value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
// Execute tool with test input (run once)
|
|
27
|
+
const executionResults = await executor.executeTool(contract.tool, [test.input], toolTimeoutMs);
|
|
28
|
+
// Map to test execution results
|
|
29
|
+
for (const result of executionResults) {
|
|
30
|
+
results.push({
|
|
31
|
+
...result,
|
|
32
|
+
testName: test.name,
|
|
33
|
+
testInput: test.input,
|
|
34
|
+
expectation: test.expect,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
// Restore environment properly (avoid reassigning process.env which breaks Node's proxy)
|
|
40
|
+
// Remove any keys that were added
|
|
41
|
+
const currentKeys = Object.keys(process.env);
|
|
42
|
+
for (const key of currentKeys) {
|
|
43
|
+
if (!(key in originalEnv)) {
|
|
44
|
+
delete process.env[key];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Restore any keys that were changed
|
|
48
|
+
for (const [key, value] of Object.entries(originalEnv)) {
|
|
49
|
+
process.env[key] = value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return results;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=test-runner.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SessionID, EventID, ISO8601Timestamp, WorkflowID, PromptID, ProjectName, AgentName, MCPURL, Command, APIKey, ModelName, ProviderIdentifier, ScriptCommand, SyrinVersion } from '../types/ids.js';
|
|
2
|
+
export declare function makeSessionID(value: string): SessionID;
|
|
3
|
+
export declare function makeEventID(value: string): EventID;
|
|
4
|
+
export declare function makeTimestamp(value: string): ISO8601Timestamp;
|
|
5
|
+
export declare function makeWorkflowID(value: string): WorkflowID;
|
|
6
|
+
export declare function makePromptID(value: string): PromptID;
|
|
7
|
+
export declare function makeProjectName(value: string): ProjectName;
|
|
8
|
+
export declare function makeAgentName(value: string): AgentName;
|
|
9
|
+
export declare function makeMCPURL(value: string): MCPURL;
|
|
10
|
+
export declare function makeCommand(value: string): Command;
|
|
11
|
+
export declare function makeAPIKey(value: string): APIKey;
|
|
12
|
+
export declare function makeModelName(value: string): ModelName;
|
|
13
|
+
export declare function makeProviderIdentifier(value: string): ProviderIdentifier;
|
|
14
|
+
export declare function makeScriptCommand(value: string): ScriptCommand;
|
|
15
|
+
export declare function makeSyrinVersion(value: string): SyrinVersion;
|
|
16
|
+
//# sourceMappingURL=factories.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function makeSessionID(value) {
|
|
2
|
+
return value;
|
|
3
|
+
}
|
|
4
|
+
export function makeEventID(value) {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
export function makeTimestamp(value) {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
export function makeWorkflowID(value) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
export function makePromptID(value) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
export function makeProjectName(value) {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
export function makeAgentName(value) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
export function makeMCPURL(value) {
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
export function makeCommand(value) {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
export function makeAPIKey(value) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
export function makeModelName(value) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
export function makeProviderIdentifier(value) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
export function makeScriptCommand(value) {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
export function makeSyrinVersion(value) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=factories.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Opaque } from '../types/opaque.js';
|
|
2
|
+
export type SessionID = Opaque<string, 'SessionID'>;
|
|
3
|
+
export type EventID = Opaque<string, 'EventID'>;
|
|
4
|
+
export type WorkflowID = Opaque<string, 'WorkflowID'>;
|
|
5
|
+
export type PromptID = Opaque<string, 'PromptID'>;
|
|
6
|
+
export type ISO8601Timestamp = Opaque<string, 'ISO8601Timestamp'>;
|
|
7
|
+
export type ProjectName = Opaque<string, 'ProjectName'>;
|
|
8
|
+
export type SyrinVersion = Opaque<string, 'SyrinVersion'>;
|
|
9
|
+
export type AgentName = Opaque<string, 'AgentName'>;
|
|
10
|
+
export type MCPURL = Opaque<string, 'MCPURL'>;
|
|
11
|
+
export type Command = Opaque<string, 'Command'>;
|
|
12
|
+
export type APIKey = Opaque<string, 'APIKey'>;
|
|
13
|
+
export type ModelName = Opaque<string, 'ModelName'>;
|
|
14
|
+
export type ProviderIdentifier = Opaque<string, 'ProviderIdentifier'>;
|
|
15
|
+
export type ScriptCommand = Opaque<string, 'ScriptCommand'>;
|
|
16
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { EventEnvelope } from '../events/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize an unknown error value to an Error instance.
|
|
4
|
+
* This ensures consistent error handling across the codebase.
|
|
5
|
+
*
|
|
6
|
+
* @param error - Unknown error value (Error, string, or other)
|
|
7
|
+
* @returns Error instance
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeError(error: unknown): Error;
|
|
10
|
+
/**
|
|
11
|
+
* Extract error message from unknown error value.
|
|
12
|
+
* Returns a string representation of the error.
|
|
13
|
+
*
|
|
14
|
+
* @param error - Unknown error value
|
|
15
|
+
* @returns Error message string
|
|
16
|
+
*/
|
|
17
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
18
|
+
/**
|
|
19
|
+
* Base error class for all Syrin errors.
|
|
20
|
+
* All errors should extend this class to maintain consistency.
|
|
21
|
+
*/
|
|
22
|
+
export declare class SyrinError extends Error {
|
|
23
|
+
readonly code: string;
|
|
24
|
+
readonly event?: EventEnvelope;
|
|
25
|
+
readonly context?: Record<string, unknown>;
|
|
26
|
+
readonly cause?: Error;
|
|
27
|
+
constructor(message: string, code: string, options?: {
|
|
28
|
+
event?: EventEnvelope;
|
|
29
|
+
context?: Record<string, unknown>;
|
|
30
|
+
cause?: Error;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Configuration-related errors.
|
|
35
|
+
*/
|
|
36
|
+
export declare class ConfigurationError extends SyrinError {
|
|
37
|
+
constructor(message: string, options?: {
|
|
38
|
+
context?: Record<string, unknown>;
|
|
39
|
+
cause?: Error;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Transport layer errors.
|
|
44
|
+
*/
|
|
45
|
+
export declare class TransportError extends SyrinError {
|
|
46
|
+
constructor(message: string, options?: {
|
|
47
|
+
event?: EventEnvelope;
|
|
48
|
+
context?: Record<string, unknown>;
|
|
49
|
+
cause?: Error;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validation errors.
|
|
54
|
+
*/
|
|
55
|
+
export declare class ValidationError extends SyrinError {
|
|
56
|
+
constructor(message: string, options?: {
|
|
57
|
+
event?: EventEnvelope;
|
|
58
|
+
context?: Record<string, unknown>;
|
|
59
|
+
cause?: Error;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Runtime errors.
|
|
64
|
+
*/
|
|
65
|
+
export declare class RuntimeError extends SyrinError {
|
|
66
|
+
constructor(message: string, options?: {
|
|
67
|
+
event?: EventEnvelope;
|
|
68
|
+
context?: Record<string, unknown>;
|
|
69
|
+
cause?: Error;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Adapter errors.
|
|
74
|
+
*/
|
|
75
|
+
export declare class AdapterError extends SyrinError {
|
|
76
|
+
constructor(message: string, options?: {
|
|
77
|
+
event?: EventEnvelope;
|
|
78
|
+
context?: Record<string, unknown>;
|
|
79
|
+
cause?: Error;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Event store errors.
|
|
84
|
+
*/
|
|
85
|
+
export declare class EventStoreError extends SyrinError {
|
|
86
|
+
constructor(message: string, options?: {
|
|
87
|
+
event?: EventEnvelope;
|
|
88
|
+
context?: Record<string, unknown>;
|
|
89
|
+
cause?: Error;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize an unknown error value to an Error instance.
|
|
3
|
+
* This ensures consistent error handling across the codebase.
|
|
4
|
+
*
|
|
5
|
+
* @param error - Unknown error value (Error, string, or other)
|
|
6
|
+
* @returns Error instance
|
|
7
|
+
*/
|
|
8
|
+
export function normalizeError(error) {
|
|
9
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Extract error message from unknown error value.
|
|
13
|
+
* Returns a string representation of the error.
|
|
14
|
+
*
|
|
15
|
+
* @param error - Unknown error value
|
|
16
|
+
* @returns Error message string
|
|
17
|
+
*/
|
|
18
|
+
export function getErrorMessage(error) {
|
|
19
|
+
return error instanceof Error ? error.message : String(error);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Base error class for all Syrin errors.
|
|
23
|
+
* All errors should extend this class to maintain consistency.
|
|
24
|
+
*/
|
|
25
|
+
export class SyrinError extends Error {
|
|
26
|
+
code;
|
|
27
|
+
event;
|
|
28
|
+
context;
|
|
29
|
+
cause;
|
|
30
|
+
constructor(message, code, options) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = 'SyrinError';
|
|
33
|
+
this.code = code;
|
|
34
|
+
this.event = options?.event;
|
|
35
|
+
this.context = options?.context;
|
|
36
|
+
this.cause = options?.cause;
|
|
37
|
+
// Maintain proper stack trace
|
|
38
|
+
if (Error.captureStackTrace) {
|
|
39
|
+
Error.captureStackTrace(this, SyrinError);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Configuration-related errors.
|
|
45
|
+
*/
|
|
46
|
+
export class ConfigurationError extends SyrinError {
|
|
47
|
+
constructor(message, options) {
|
|
48
|
+
super(message, 'CONFIG_ERROR', options);
|
|
49
|
+
this.name = 'ConfigurationError';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Transport layer errors.
|
|
54
|
+
*/
|
|
55
|
+
export class TransportError extends SyrinError {
|
|
56
|
+
constructor(message, options) {
|
|
57
|
+
super(message, 'TRANSPORT_ERROR', options);
|
|
58
|
+
this.name = 'TransportError';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Validation errors.
|
|
63
|
+
*/
|
|
64
|
+
export class ValidationError extends SyrinError {
|
|
65
|
+
constructor(message, options) {
|
|
66
|
+
super(message, 'VALIDATION_ERROR', options);
|
|
67
|
+
this.name = 'ValidationError';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Runtime errors.
|
|
72
|
+
*/
|
|
73
|
+
export class RuntimeError extends SyrinError {
|
|
74
|
+
constructor(message, options) {
|
|
75
|
+
super(message, 'RUNTIME_ERROR', options);
|
|
76
|
+
this.name = 'RuntimeError';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Adapter errors.
|
|
81
|
+
*/
|
|
82
|
+
export class AdapterError extends SyrinError {
|
|
83
|
+
constructor(message, options) {
|
|
84
|
+
super(message, 'ADAPTER_ERROR', options);
|
|
85
|
+
this.name = 'AdapterError';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Event store errors.
|
|
90
|
+
*/
|
|
91
|
+
export class EventStoreError extends SyrinError {
|
|
92
|
+
constructor(message, options) {
|
|
93
|
+
super(message, 'EVENT_STORE_ERROR', options);
|
|
94
|
+
this.name = 'EventStoreError';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for managing .gitignore file.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Ensure .gitignore exists and contains the specified pattern.
|
|
6
|
+
* @param projectRoot - Project root directory
|
|
7
|
+
* @param pattern - Pattern to add to .gitignore
|
|
8
|
+
* @returns true if pattern was added, false if it already existed
|
|
9
|
+
*/
|
|
10
|
+
export declare function ensureGitignorePattern(projectRoot: string, pattern: string): Promise<boolean>;
|
|
11
|
+
//# sourceMappingURL=gitignore.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for managing .gitignore file.
|
|
3
|
+
*/
|
|
4
|
+
import * as fs from 'fs/promises';
|
|
5
|
+
import * as path from 'path';
|
|
6
|
+
/**
|
|
7
|
+
* Ensure .gitignore exists and contains the specified pattern.
|
|
8
|
+
* @param projectRoot - Project root directory
|
|
9
|
+
* @param pattern - Pattern to add to .gitignore
|
|
10
|
+
* @returns true if pattern was added, false if it already existed
|
|
11
|
+
*/
|
|
12
|
+
export async function ensureGitignorePattern(projectRoot, pattern) {
|
|
13
|
+
const gitignorePath = path.join(projectRoot, '.gitignore');
|
|
14
|
+
let content = '';
|
|
15
|
+
try {
|
|
16
|
+
content = await fs.readFile(gitignorePath, 'utf-8');
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
// File doesn't exist, create it
|
|
20
|
+
const err = error;
|
|
21
|
+
if (err.code !== 'ENOENT') {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Normalize line endings and split into lines
|
|
26
|
+
const lines = content
|
|
27
|
+
.replace(/\r\n/g, '\n')
|
|
28
|
+
.split('\n')
|
|
29
|
+
.map(line => line.trim());
|
|
30
|
+
// Check if pattern already exists (exact match or commented out)
|
|
31
|
+
const patternExists = lines.some(line => line === pattern || line === `# ${pattern}` || line.endsWith(pattern));
|
|
32
|
+
if (patternExists) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
// Add pattern to .gitignore
|
|
36
|
+
// Add a blank line if file is not empty and doesn't end with newline
|
|
37
|
+
if (content && !content.endsWith('\n')) {
|
|
38
|
+
content += '\n';
|
|
39
|
+
}
|
|
40
|
+
// Add pattern to .gitignore
|
|
41
|
+
if (content) {
|
|
42
|
+
// Check if we already have a "Syrin" section
|
|
43
|
+
if (content.includes('# Syrin')) {
|
|
44
|
+
// Add to existing Syrin section
|
|
45
|
+
content += `${pattern}\n`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Create new section with generic comment
|
|
49
|
+
content += `\n# Syrin files\n${pattern}\n`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Create new file with generic comment
|
|
54
|
+
content = `# Syrin files\n${pattern}\n`;
|
|
55
|
+
}
|
|
56
|
+
await fs.writeFile(gitignorePath, content, 'utf-8');
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=gitignore.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for saving large JSON data to external files.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Save JSON data to a file.
|
|
6
|
+
* Returns the file path.
|
|
7
|
+
*/
|
|
8
|
+
export declare function saveJSONToFile(data: unknown, toolName: string, outputDir?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Get the size of a file in human-readable format.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getFileSize(filePath: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Format a file path for display (shorten if too long).
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatFilePath(filePath: string, maxLength?: number): string;
|
|
17
|
+
//# sourceMappingURL=json-file-saver.d.ts.map
|