@hexagen-monaco/sync 0.4.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 +33 -0
- package/README.md +181 -0
- package/dist/application/index.d.ts +3 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/ports/index.d.ts +2 -0
- package/dist/application/ports/index.d.ts.map +1 -0
- package/dist/application/ports/out/architecture-graph-provider.port.d.ts +6 -0
- package/dist/application/ports/out/architecture-graph-provider.port.d.ts.map +1 -0
- package/dist/application/ports/out/file-system.port.d.ts +22 -0
- package/dist/application/ports/out/file-system.port.d.ts.map +1 -0
- package/dist/application/ports/out/generator-config.port.d.ts +51 -0
- package/dist/application/ports/out/generator-config.port.d.ts.map +1 -0
- package/dist/application/ports/out/index.d.ts +9 -0
- package/dist/application/ports/out/index.d.ts.map +1 -0
- package/dist/application/ports/out/linter-report-provider.port.d.ts +6 -0
- package/dist/application/ports/out/linter-report-provider.port.d.ts.map +1 -0
- package/dist/application/ports/out/ownership-registry.port.d.ts +35 -0
- package/dist/application/ports/out/ownership-registry.port.d.ts.map +1 -0
- package/dist/application/ports/out/project-configuration-read.port.d.ts +9 -0
- package/dist/application/ports/out/project-configuration-read.port.d.ts.map +1 -0
- package/dist/application/ports/out/symbol-reference-provider.port.d.ts +10 -0
- package/dist/application/ports/out/symbol-reference-provider.port.d.ts.map +1 -0
- package/dist/application/ports/out/workspace-file-provider.port.d.ts +14 -0
- package/dist/application/ports/out/workspace-file-provider.port.d.ts.map +1 -0
- package/dist/application/use-cases/get-architecture-graph.use-case.d.ts +8 -0
- package/dist/application/use-cases/get-architecture-graph.use-case.d.ts.map +1 -0
- package/dist/application/use-cases/get-linter-report.use-case.d.ts +8 -0
- package/dist/application/use-cases/get-linter-report.use-case.d.ts.map +1 -0
- package/dist/application/use-cases/get-manifest-resource.use-case.d.ts +8 -0
- package/dist/application/use-cases/get-manifest-resource.use-case.d.ts.map +1 -0
- package/dist/application/use-cases/index.d.ts +4 -0
- package/dist/application/use-cases/index.d.ts.map +1 -0
- package/dist/application/use-cases/refactoring-impact.use-case.d.ts +29 -0
- package/dist/application/use-cases/refactoring-impact.use-case.d.ts.map +1 -0
- package/dist/application/use-cases/stub-generation.use-case.d.ts +23 -0
- package/dist/application/use-cases/stub-generation.use-case.d.ts.map +1 -0
- package/dist/arch-linter-bin.d.ts +20 -0
- package/dist/arch-linter-bin.d.ts.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +12149 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add/index.d.ts +8 -0
- package/dist/commands/add/index.d.ts.map +1 -0
- package/dist/commands/add/validate.d.ts +2 -0
- package/dist/commands/add/validate.d.ts.map +1 -0
- package/dist/commands/arch/add.d.ts +3 -0
- package/dist/commands/arch/add.d.ts.map +1 -0
- package/dist/commands/arch/context/command.d.ts +4 -0
- package/dist/commands/arch/context/command.d.ts.map +1 -0
- package/dist/commands/arch/context/persistence.d.ts +22 -0
- package/dist/commands/arch/context/persistence.d.ts.map +1 -0
- package/dist/commands/arch/context/wizard.d.ts +7 -0
- package/dist/commands/arch/context/wizard.d.ts.map +1 -0
- package/dist/commands/arch/diff.d.ts +3 -0
- package/dist/commands/arch/diff.d.ts.map +1 -0
- package/dist/commands/arch/edit.d.ts +9 -0
- package/dist/commands/arch/edit.d.ts.map +1 -0
- package/dist/commands/arch/index.d.ts +3 -0
- package/dist/commands/arch/index.d.ts.map +1 -0
- package/dist/commands/arch/list.d.ts +2 -0
- package/dist/commands/arch/list.d.ts.map +1 -0
- package/dist/commands/arch/port/persistence.d.ts +28 -0
- package/dist/commands/arch/port/persistence.d.ts.map +1 -0
- package/dist/commands/arch/port.d.ts +4 -0
- package/dist/commands/arch/port.d.ts.map +1 -0
- package/dist/commands/arch/refactor-rename-entity.d.ts +3 -0
- package/dist/commands/arch/refactor-rename-entity.d.ts.map +1 -0
- package/dist/commands/arch/refactor-rename-port.d.ts +3 -0
- package/dist/commands/arch/refactor-rename-port.d.ts.map +1 -0
- package/dist/commands/arch/refactor-rename-use-case.d.ts +3 -0
- package/dist/commands/arch/refactor-rename-use-case.d.ts.map +1 -0
- package/dist/commands/arch/refactor-shared.d.ts +11 -0
- package/dist/commands/arch/refactor-shared.d.ts.map +1 -0
- package/dist/commands/arch/refactor.d.ts +3 -0
- package/dist/commands/arch/refactor.d.ts.map +1 -0
- package/dist/commands/arch/remove/context.d.ts +7 -0
- package/dist/commands/arch/remove/context.d.ts.map +1 -0
- package/dist/commands/arch/remove/port.d.ts +7 -0
- package/dist/commands/arch/remove/port.d.ts.map +1 -0
- package/dist/commands/arch/remove.d.ts +3 -0
- package/dist/commands/arch/remove.d.ts.map +1 -0
- package/dist/commands/arch/validate.d.ts +2 -0
- package/dist/commands/arch/validate.d.ts.map +1 -0
- package/dist/commands/manifest/index.d.ts +3 -0
- package/dist/commands/manifest/index.d.ts.map +1 -0
- package/dist/commands/manifest/split-utils.d.ts +8 -0
- package/dist/commands/manifest/split-utils.d.ts.map +1 -0
- package/dist/commands/manifest/split.d.ts +3 -0
- package/dist/commands/manifest/split.d.ts.map +1 -0
- package/dist/commands/shared/confirm.d.ts +5 -0
- package/dist/commands/shared/confirm.d.ts.map +1 -0
- package/dist/commands/shared/error-formatter.d.ts +7 -0
- package/dist/commands/shared/error-formatter.d.ts.map +1 -0
- package/dist/commands/shared/index.d.ts +15 -0
- package/dist/commands/shared/index.d.ts.map +1 -0
- package/dist/commands/shared/project-root.d.ts +3 -0
- package/dist/commands/shared/project-root.d.ts.map +1 -0
- package/dist/commands/shared/prompt-service.d.ts +15 -0
- package/dist/commands/shared/prompt-service.d.ts.map +1 -0
- package/dist/commands/shared/spinner.d.ts +13 -0
- package/dist/commands/shared/spinner.d.ts.map +1 -0
- package/dist/commands/shared/template-engine-path.d.ts +12 -0
- package/dist/commands/shared/template-engine-path.d.ts.map +1 -0
- package/dist/commands/shared/validation.d.ts +15 -0
- package/dist/commands/shared/validation.d.ts.map +1 -0
- package/dist/commands/shared/yaml-service.d.ts +23 -0
- package/dist/commands/shared/yaml-service.d.ts.map +1 -0
- package/dist/commands/templates/index.d.ts +3 -0
- package/dist/commands/templates/index.d.ts.map +1 -0
- package/dist/commands/templates/info.d.ts +2 -0
- package/dist/commands/templates/info.d.ts.map +1 -0
- package/dist/commands/templates/list.d.ts +2 -0
- package/dist/commands/templates/list.d.ts.map +1 -0
- package/dist/config/barrel-exclusions.d.ts +10 -0
- package/dist/config/barrel-exclusions.d.ts.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/domain/index.d.ts +5 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/result.d.ts +4 -0
- package/dist/domain/result.d.ts.map +1 -0
- package/dist/domain/services/architectural-boundary-checker.d.ts +18 -0
- package/dist/domain/services/architectural-boundary-checker.d.ts.map +1 -0
- package/dist/domain/services/emission-plan-builder.d.ts +17 -0
- package/dist/domain/services/emission-plan-builder.d.ts.map +1 -0
- package/dist/domain/services/impact-analysis.types.d.ts +24 -0
- package/dist/domain/services/impact-analysis.types.d.ts.map +1 -0
- package/dist/domain/services/impact-request-validator.d.ts +14 -0
- package/dist/domain/services/impact-request-validator.d.ts.map +1 -0
- package/dist/domain/services/index.d.ts +7 -0
- package/dist/domain/services/index.d.ts.map +1 -0
- package/dist/domain/services/layer-classifier.d.ts +4 -0
- package/dist/domain/services/layer-classifier.d.ts.map +1 -0
- package/dist/domain/services/stub-template-resolver.d.ts +16 -0
- package/dist/domain/services/stub-template-resolver.d.ts.map +1 -0
- package/dist/domain/session.d.ts +6 -0
- package/dist/domain/session.d.ts.map +1 -0
- package/dist/domain/stub-templates.d.ts +8 -0
- package/dist/domain/stub-templates.d.ts.map +1 -0
- package/dist/domain/types.d.ts +4 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/fs-utils.d.ts +28 -0
- package/dist/fs-utils.d.ts.map +1 -0
- package/dist/generators/apps-framework-templates.d.ts +4 -0
- package/dist/generators/apps-framework-templates.d.ts.map +1 -0
- package/dist/generators/apps.d.ts +5 -0
- package/dist/generators/apps.d.ts.map +1 -0
- package/dist/generators/architecture-file-templates.d.ts +9 -0
- package/dist/generators/architecture-file-templates.d.ts.map +1 -0
- package/dist/generators/architecture-files.d.ts +5 -0
- package/dist/generators/architecture-files.d.ts.map +1 -0
- package/dist/generators/barrels/index.d.ts +6 -0
- package/dist/generators/barrels/index.d.ts.map +1 -0
- package/dist/generators/barrels/recursive.d.ts +44 -0
- package/dist/generators/barrels/recursive.d.ts.map +1 -0
- package/dist/generators/barrels/utils.d.ts +56 -0
- package/dist/generators/barrels/utils.d.ts.map +1 -0
- package/dist/generators/barrels.d.ts +31 -0
- package/dist/generators/barrels.d.ts.map +1 -0
- package/dist/generators/eslint.d.ts +47 -0
- package/dist/generators/eslint.d.ts.map +1 -0
- package/dist/generators/layer-folders.d.ts +16 -0
- package/dist/generators/layer-folders.d.ts.map +1 -0
- package/dist/generators/migration-assistant.d.ts +7 -0
- package/dist/generators/migration-assistant.d.ts.map +1 -0
- package/dist/generators/migration-audit.d.ts +28 -0
- package/dist/generators/migration-audit.d.ts.map +1 -0
- package/dist/generators/migration-stubs.d.ts +7 -0
- package/dist/generators/migration-stubs.d.ts.map +1 -0
- package/dist/generators/package-json.d.ts +11 -0
- package/dist/generators/package-json.d.ts.map +1 -0
- package/dist/generators/port-analyzer.d.ts +56 -0
- package/dist/generators/port-analyzer.d.ts.map +1 -0
- package/dist/generators/reap.d.ts +11 -0
- package/dist/generators/reap.d.ts.map +1 -0
- package/dist/generators/root-file-templates.d.ts +8 -0
- package/dist/generators/root-file-templates.d.ts.map +1 -0
- package/dist/generators/root-files.d.ts +5 -0
- package/dist/generators/root-files.d.ts.map +1 -0
- package/dist/generators/stubs/index.d.ts +4 -0
- package/dist/generators/stubs/index.d.ts.map +1 -0
- package/dist/generators/stubs/stub-templates.d.ts +3 -0
- package/dist/generators/stubs/stub-templates.d.ts.map +1 -0
- package/dist/generators/stubs.d.ts +5 -0
- package/dist/generators/stubs.d.ts.map +1 -0
- package/dist/generators/test-generator.d.ts +7 -0
- package/dist/generators/test-generator.d.ts.map +1 -0
- package/dist/generators/test-templates/data-builder.d.ts +2 -0
- package/dist/generators/test-templates/data-builder.d.ts.map +1 -0
- package/dist/generators/test-templates/enhanced-test-double.d.ts +2 -0
- package/dist/generators/test-templates/enhanced-test-double.d.ts.map +1 -0
- package/dist/generators/test-templates/index.d.ts +5 -0
- package/dist/generators/test-templates/index.d.ts.map +1 -0
- package/dist/generators/test-templates/integration-test.d.ts +2 -0
- package/dist/generators/test-templates/integration-test.d.ts.map +1 -0
- package/dist/generators/test-templates/unit-test.d.ts +2 -0
- package/dist/generators/test-templates/unit-test.d.ts.map +1 -0
- package/dist/generators/tsconfig.d.ts +16 -0
- package/dist/generators/tsconfig.d.ts.map +1 -0
- package/dist/generators/validators/index.d.ts +11 -0
- package/dist/generators/validators/index.d.ts.map +1 -0
- package/dist/generators/validators/validate-dependencies.d.ts +7 -0
- package/dist/generators/validators/validate-dependencies.d.ts.map +1 -0
- package/dist/generators/validators/validate-manifest-sync.d.ts +5 -0
- package/dist/generators/validators/validate-manifest-sync.d.ts.map +1 -0
- package/dist/generators/validators/validate-port-adapter.d.ts +5 -0
- package/dist/generators/validators/validate-port-adapter.d.ts.map +1 -0
- package/dist/generators/validators/validation-types.d.ts +20 -0
- package/dist/generators/validators/validation-types.d.ts.map +1 -0
- package/dist/generators/validators.d.ts +7 -0
- package/dist/generators/validators.d.ts.map +1 -0
- package/dist/generators/wiring.d.ts +20 -0
- package/dist/generators/wiring.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8070 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/adapters/atomic-file-system.adapter.d.ts +13 -0
- package/dist/infrastructure/adapters/atomic-file-system.adapter.d.ts.map +1 -0
- package/dist/infrastructure/adapters/file-system-workspace.adapter.d.ts +12 -0
- package/dist/infrastructure/adapters/file-system-workspace.adapter.d.ts.map +1 -0
- package/dist/infrastructure/adapters/in-memory-config-double.d.ts +30 -0
- package/dist/infrastructure/adapters/in-memory-config-double.d.ts.map +1 -0
- package/dist/infrastructure/adapters/index.d.ts +5 -0
- package/dist/infrastructure/adapters/index.d.ts.map +1 -0
- package/dist/infrastructure/adapters/yaml-config.adapter.d.ts +38 -0
- package/dist/infrastructure/adapters/yaml-config.adapter.d.ts.map +1 -0
- package/dist/infrastructure/index.d.ts +2 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/linter.d.ts +7 -0
- package/dist/linter.d.ts.map +1 -0
- package/dist/loaders/index.d.ts +2 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/manifest-merge-loader.d.ts +3 -0
- package/dist/loaders/manifest-merge-loader.d.ts.map +1 -0
- package/dist/lock.d.ts +14 -0
- package/dist/lock.d.ts.map +1 -0
- package/dist/manifest-service.d.ts +10 -0
- package/dist/manifest-service.d.ts.map +1 -0
- package/dist/migration-report.d.ts +12 -0
- package/dist/migration-report.d.ts.map +1 -0
- package/dist/preflight.d.ts +7 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/refactoring/git-operations.d.ts +9 -0
- package/dist/refactoring/git-operations.d.ts.map +1 -0
- package/dist/refactoring/impact-analyzer.d.ts +23 -0
- package/dist/refactoring/impact-analyzer.d.ts.map +1 -0
- package/dist/refactoring/index.d.ts +6 -0
- package/dist/refactoring/index.d.ts.map +1 -0
- package/dist/refactoring/refactoring-engine.d.ts +40 -0
- package/dist/refactoring/refactoring-engine.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/base-pattern.d.ts +37 -0
- package/dist/refactoring/refactoring-patterns/base-pattern.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/index.d.ts +5 -0
- package/dist/refactoring/refactoring-patterns/index.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/refactoring-utils.d.ts +8 -0
- package/dist/refactoring/refactoring-patterns/refactoring-utils.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/rename-entity.pattern.d.ts +19 -0
- package/dist/refactoring/refactoring-patterns/rename-entity.pattern.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/rename-port.pattern.d.ts +42 -0
- package/dist/refactoring/refactoring-patterns/rename-port.pattern.d.ts.map +1 -0
- package/dist/refactoring/refactoring-patterns/rename-use-case.pattern.d.ts +40 -0
- package/dist/refactoring/refactoring-patterns/rename-use-case.pattern.d.ts.map +1 -0
- package/dist/refactoring/safe-refactoring-orchestrator.d.ts +24 -0
- package/dist/refactoring/safe-refactoring-orchestrator.d.ts.map +1 -0
- package/dist/refactoring/validation-suite.d.ts +20 -0
- package/dist/refactoring/validation-suite.d.ts.map +1 -0
- package/dist/results.d.ts +16 -0
- package/dist/results.d.ts.map +1 -0
- package/dist/sync-engine-helpers.d.ts +15 -0
- package/dist/sync-engine-helpers.d.ts.map +1 -0
- package/dist/sync-engine-init.d.ts +12 -0
- package/dist/sync-engine-init.d.ts.map +1 -0
- package/dist/sync-engine.d.ts +21 -0
- package/dist/sync-engine.d.ts.map +1 -0
- package/dist/template-engine.d.ts +3 -0
- package/dist/template-engine.d.ts.map +1 -0
- package/dist/templates/__example__/files/example-output.txt +9 -0
- package/dist/templates/__example__/manifest.json +44 -0
- package/dist/templates/adobe-creative-production/README.md +89 -0
- package/dist/templates/adobe-creative-production/files/.env.adobe-creative-production.example +6 -0
- package/dist/templates/adobe-creative-production/files/src/domain/ports/out/creative-production.port.ts +62 -0
- package/dist/templates/adobe-creative-production/files/src/infrastructure/adobe/creative-production/creative-production.adapter.ts +144 -0
- package/dist/templates/adobe-creative-production/manifest.json +25 -0
- package/dist/templates/adobe-express/README.md +85 -0
- package/dist/templates/adobe-express/files/.env.adobe-express.example +7 -0
- package/dist/templates/adobe-express/files/src/domain/ports/out/express.port.ts +47 -0
- package/dist/templates/adobe-express/files/src/infrastructure/adobe/express/express.adapter.ts +155 -0
- package/dist/templates/adobe-express/manifest.json +32 -0
- package/dist/templates/adobe-firefly-composite/README.md +75 -0
- package/dist/templates/adobe-firefly-composite/files/.env.adobe-composite.example +5 -0
- package/dist/templates/adobe-firefly-composite/files/src/domain/ports/out/composite.port.ts +39 -0
- package/dist/templates/adobe-firefly-composite/files/src/infrastructure/adobe/composite/composite.adapter.ts +102 -0
- package/dist/templates/adobe-firefly-composite/manifest.json +32 -0
- package/dist/templates/adobe-firefly-content-tagging/README.md +70 -0
- package/dist/templates/adobe-firefly-content-tagging/files/.env.adobe-content-tagging.example +4 -0
- package/dist/templates/adobe-firefly-content-tagging/files/src/domain/ports/out/content-tagging.port.ts +28 -0
- package/dist/templates/adobe-firefly-content-tagging/files/src/infrastructure/adobe/content-tagging/content-tagging.adapter.ts +120 -0
- package/dist/templates/adobe-firefly-content-tagging/manifest.json +31 -0
- package/dist/templates/adobe-firefly-core/README.md +147 -0
- package/dist/templates/adobe-firefly-core/files/.env.adobe.example +15 -0
- package/dist/templates/adobe-firefly-core/files/src/domain/ports/out/firefly-auth.port.ts +11 -0
- package/dist/templates/adobe-firefly-core/files/src/domain/ports/out/firefly-job.port.ts +50 -0
- package/dist/templates/adobe-firefly-core/files/src/domain/ports/out/firefly-storage.port.ts +20 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/auth/ims-token-provider.adapter.ts +112 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/auth/smoke-token.ts +17 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/errors/firefly-errors.ts +91 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/http/firefly-client.ts +135 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/index.ts +46 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/jobs/job-poller.ts +52 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/jobs/job-port.ts +149 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/jobs/job-result.ts +113 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/jobs/webhook-verifier.ts +67 -0
- package/dist/templates/adobe-firefly-core/files/src/infrastructure/adobe/storage/passthrough-storage.adapter.ts +36 -0
- package/dist/templates/adobe-firefly-core/manifest.json +86 -0
- package/dist/templates/adobe-firefly-custom-models/README.md +96 -0
- package/dist/templates/adobe-firefly-custom-models/files/.env.adobe-custom-models.example +6 -0
- package/dist/templates/adobe-firefly-custom-models/files/src/domain/ports/out/custom-model.port.ts +77 -0
- package/dist/templates/adobe-firefly-custom-models/files/src/infrastructure/adobe/custom-models/firefly-custom-model.adapter.ts +199 -0
- package/dist/templates/adobe-firefly-custom-models/manifest.json +33 -0
- package/dist/templates/adobe-firefly-generate/README.md +86 -0
- package/dist/templates/adobe-firefly-generate/files/.env.adobe-generate.example +5 -0
- package/dist/templates/adobe-firefly-generate/files/src/domain/ports/out/image-generation.port.ts +61 -0
- package/dist/templates/adobe-firefly-generate/files/src/infrastructure/adobe/generate/firefly-generate.adapter.ts +167 -0
- package/dist/templates/adobe-firefly-generate/manifest.json +45 -0
- package/dist/templates/adobe-firefly-media/README.md +99 -0
- package/dist/templates/adobe-firefly-media/files/.env.adobe-media.example +8 -0
- package/dist/templates/adobe-firefly-media/files/src/domain/ports/out/media-generation.port.ts +80 -0
- package/dist/templates/adobe-firefly-media/files/src/infrastructure/adobe/media/firefly-media.adapter.ts +161 -0
- package/dist/templates/adobe-firefly-media/manifest.json +32 -0
- package/dist/templates/adobe-firefly-storage-azure/README.md +88 -0
- package/dist/templates/adobe-firefly-storage-azure/files/.env.adobe-storage-azure.example +9 -0
- package/dist/templates/adobe-firefly-storage-azure/files/src/infrastructure/adobe/storage/azure-blob-presign.adapter.ts +171 -0
- package/dist/templates/adobe-firefly-storage-azure/files/src/infrastructure/adobe/storage/azure-register.ts +15 -0
- package/dist/templates/adobe-firefly-storage-azure/manifest.json +37 -0
- package/dist/templates/adobe-firefly-storage-gcs/README.md +85 -0
- package/dist/templates/adobe-firefly-storage-gcs/files/.env.adobe-storage-gcs.example +8 -0
- package/dist/templates/adobe-firefly-storage-gcs/files/src/infrastructure/adobe/storage/gcs-presign.adapter.ts +100 -0
- package/dist/templates/adobe-firefly-storage-gcs/files/src/infrastructure/adobe/storage/gcs-register.ts +15 -0
- package/dist/templates/adobe-firefly-storage-gcs/manifest.json +33 -0
- package/dist/templates/adobe-firefly-storage-s3/README.md +76 -0
- package/dist/templates/adobe-firefly-storage-s3/files/.env.adobe-storage-s3.example +8 -0
- package/dist/templates/adobe-firefly-storage-s3/files/src/infrastructure/adobe/storage/s3-presign.adapter.ts +109 -0
- package/dist/templates/adobe-firefly-storage-s3/files/src/infrastructure/adobe/storage/s3-register.ts +15 -0
- package/dist/templates/adobe-firefly-storage-s3/manifest.json +31 -0
- package/dist/templates/adobe-firefly-upscale/README.md +68 -0
- package/dist/templates/adobe-firefly-upscale/files/.env.adobe-upscale.example +3 -0
- package/dist/templates/adobe-firefly-upscale/files/src/domain/ports/out/upscale.port.ts +25 -0
- package/dist/templates/adobe-firefly-upscale/files/src/infrastructure/adobe/upscale/upscale.adapter.ts +85 -0
- package/dist/templates/adobe-firefly-upscale/manifest.json +30 -0
- package/dist/templates/adobe-illustrator/README.md +80 -0
- package/dist/templates/adobe-illustrator/files/.env.adobe-illustrator.example +7 -0
- package/dist/templates/adobe-illustrator/files/src/domain/ports/out/illustrator.port.ts +51 -0
- package/dist/templates/adobe-illustrator/files/src/infrastructure/adobe/illustrator/illustrator.adapter.ts +167 -0
- package/dist/templates/adobe-illustrator/manifest.json +38 -0
- package/dist/templates/adobe-ims-spa/README.md +99 -0
- package/dist/templates/adobe-ims-spa/files/.env.adobe-ims.example +12 -0
- package/dist/templates/adobe-ims-spa/files/app/api/auth/callback/route.ts +84 -0
- package/dist/templates/adobe-ims-spa/files/app/api/auth/login/route.ts +30 -0
- package/dist/templates/adobe-ims-spa/files/app/api/auth/logout/route.ts +24 -0
- package/dist/templates/adobe-ims-spa/files/app/api/auth/me/route.ts +18 -0
- package/dist/templates/adobe-ims-spa/files/middleware.ts +74 -0
- package/dist/templates/adobe-ims-spa/files/src/domain/ports/out/ims-auth.port.ts +24 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/adobe-ims-auth.adapter.ts +71 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/config.ts +34 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/ims-client.ts +85 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/pkce.ts +37 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/token-store.ts +54 -0
- package/dist/templates/adobe-ims-spa/files/src/infrastructure/auth/adobe-ims/user-profile-mapper.ts +12 -0
- package/dist/templates/adobe-ims-spa/files/src/lib/auth/get-current-user.ts +56 -0
- package/dist/templates/adobe-ims-spa/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/adobe-ims-spa/manifest.json +88 -0
- package/dist/templates/adobe-indesign/README.md +76 -0
- package/dist/templates/adobe-indesign/files/.env.adobe-indesign.example +7 -0
- package/dist/templates/adobe-indesign/files/src/domain/ports/out/indesign.port.ts +43 -0
- package/dist/templates/adobe-indesign/files/src/infrastructure/adobe/indesign/indesign.adapter.ts +160 -0
- package/dist/templates/adobe-indesign/manifest.json +38 -0
- package/dist/templates/adobe-lightroom/README.md +81 -0
- package/dist/templates/adobe-lightroom/files/.env.adobe-lightroom.example +7 -0
- package/dist/templates/adobe-lightroom/files/src/domain/ports/out/lightroom.port.ts +36 -0
- package/dist/templates/adobe-lightroom/files/src/infrastructure/adobe/lightroom/lightroom.adapter.ts +145 -0
- package/dist/templates/adobe-lightroom/manifest.json +39 -0
- package/dist/templates/adobe-photoshop/README.md +87 -0
- package/dist/templates/adobe-photoshop/files/.env.adobe-photoshop.example +7 -0
- package/dist/templates/adobe-photoshop/files/src/domain/ports/out/photoshop-automation.port.ts +60 -0
- package/dist/templates/adobe-photoshop/files/src/infrastructure/adobe/photoshop/photoshop-automation.adapter.ts +180 -0
- package/dist/templates/adobe-photoshop/manifest.json +45 -0
- package/dist/templates/adobe-substance-3d/README.md +88 -0
- package/dist/templates/adobe-substance-3d/files/.env.adobe-substance-3d.example +12 -0
- package/dist/templates/adobe-substance-3d/files/src/domain/ports/out/substance-3d.port.ts +45 -0
- package/dist/templates/adobe-substance-3d/files/src/infrastructure/adobe/substance-3d/substance-3d.adapter.ts +177 -0
- package/dist/templates/adobe-substance-3d/manifest.json +39 -0
- package/dist/templates/agents-md/README.md +55 -0
- package/dist/templates/agents-md/files/.agents/architecture.md +42 -0
- package/dist/templates/agents-md/files/.agents/git.md +30 -0
- package/dist/templates/agents-md/files/.agents/session-log.md +37 -0
- package/dist/templates/agents-md/files/.agents/tech-stack.md +34 -0
- package/dist/templates/agents-md/files/.agents/testing.md +30 -0
- package/dist/templates/agents-md/files/AGENTS.md +97 -0
- package/dist/templates/agents-md/manifest.json +49 -0
- package/dist/templates/auth-mock/README.md +57 -0
- package/dist/templates/auth-mock/files/.env.auth.example +9 -0
- package/dist/templates/auth-mock/files/middleware.ts +28 -0
- package/dist/templates/auth-mock/manifest.json +23 -0
- package/dist/templates/bedrock-agentcore-runtime/README.md +68 -0
- package/dist/templates/bedrock-agentcore-runtime/files/.env.agentcore.example +19 -0
- package/dist/templates/bedrock-agentcore-runtime/files/.github/workflows/deploy-agentcore.yml +100 -0
- package/dist/templates/bedrock-agentcore-runtime/files/Dockerfile.agentcore +33 -0
- package/dist/templates/bedrock-agentcore-runtime/files/agentcore/agentcore.json +16 -0
- package/dist/templates/bedrock-agentcore-runtime/files/agentcore/aws-targets.json +7 -0
- package/dist/templates/bedrock-agentcore-runtime/files/iam/agentcore-runtime-role.policy.json +49 -0
- package/dist/templates/bedrock-agentcore-runtime/files/infra/agentcore-stack.ts +90 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/invocations.handler.ts +152 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/ping.handler.ts +13 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/server.ts +134 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/runtime/payload.ts +63 -0
- package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/runtime/session.ts +58 -0
- package/dist/templates/bedrock-agentcore-runtime/manifest.json +89 -0
- package/dist/templates/bedrock-agentcore-services/README.md +65 -0
- package/dist/templates/bedrock-agentcore-services/files/.env.agentcore-services.example +20 -0
- package/dist/templates/bedrock-agentcore-services/files/agentcore/agentcore-services.json +14 -0
- package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/agent-identity.port.ts +26 -0
- package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/agent-memory.port.ts +30 -0
- package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/tool-gateway.port.ts +27 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/gateway/agentcore-gateway.adapter.ts +103 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/gateway/mcp-tool-mapper.ts +44 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/identity/agentcore-identity.adapter.ts +82 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/identity/idp-bridge.ts +74 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/memory/agentcore-memory.adapter.ts +82 -0
- package/dist/templates/bedrock-agentcore-services/files/src/infrastructure/agentcore/memory/memory-config.ts +45 -0
- package/dist/templates/bedrock-agentcore-services/manifest.json +97 -0
- package/dist/templates/better-auth/README.md +60 -0
- package/dist/templates/better-auth/files/.env.better-auth.example +20 -0
- package/dist/templates/better-auth/files/app/api/auth/[...all]/route.ts +5 -0
- package/dist/templates/better-auth/files/src/db/index.ts +10 -0
- package/dist/templates/better-auth/files/src/db/migrations/0001_better_auth.sql +49 -0
- package/dist/templates/better-auth/files/src/db/schema/better-auth.ts +57 -0
- package/dist/templates/better-auth/files/src/lib/auth-client.ts +13 -0
- package/dist/templates/better-auth/files/src/lib/auth.ts +72 -0
- package/dist/templates/better-auth/manifest.json +71 -0
- package/dist/templates/bullmq/README.md +61 -0
- package/dist/templates/bullmq/files/.env.bullmq.example +34 -0
- package/dist/templates/bullmq/files/app/admin/queues/[[...slug]]/route.ts +103 -0
- package/dist/templates/bullmq/files/scripts/start-worker.ts +55 -0
- package/dist/templates/bullmq/files/server/startup/start-workers.ts +171 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/connection.ts +105 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/fallback/sync-executor.ts +96 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/index.ts +30 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/ai-generation.job.ts +53 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/email.job.ts +42 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/export.job.ts +49 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/image-processing.job.ts +48 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/jobs/webhook.job.ts +139 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/parse-int-env.ts +28 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/queues.ts +153 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/scheduler/job-scheduler.ts +70 -0
- package/dist/templates/bullmq/files/src/infrastructure/queue/workers.ts +101 -0
- package/dist/templates/bullmq/manifest.json +120 -0
- package/dist/templates/ci-github-actions/README.md +62 -0
- package/dist/templates/ci-github-actions/files/.github/dependabot.yml +20 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/ci.yml +103 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-fly.yml +30 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-railway.yml +32 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vercel.yml +39 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/deploy-vps.yml +34 -0
- package/dist/templates/ci-github-actions/files/.github/workflows/preview.yml +58 -0
- package/dist/templates/ci-github-actions/files/fly.toml +23 -0
- package/dist/templates/ci-github-actions/manifest.json +100 -0
- package/dist/templates/clerk/README.md +59 -0
- package/dist/templates/clerk/files/.env.clerk.example +11 -0
- package/dist/templates/clerk/files/app/(protected)/layout.tsx +18 -0
- package/dist/templates/clerk/files/app/api/protected-example/route.ts +17 -0
- package/dist/templates/clerk/files/middleware.ts +25 -0
- package/dist/templates/clerk/files/src/lib/auth.ts +12 -0
- package/dist/templates/clerk/files/src/lib/role-guard.tsx +32 -0
- package/dist/templates/clerk/manifest.json +67 -0
- package/dist/templates/design-system/README.md +60 -0
- package/dist/templates/design-system/files/.storybook/main.ts +9 -0
- package/dist/templates/design-system/files/.storybook/preview.ts +13 -0
- package/dist/templates/design-system/files/DESIGN.md +76 -0
- package/dist/templates/design-system/files/src/components/ui/button.stories.tsx +17 -0
- package/dist/templates/design-system/files/src/components/ui/button.tsx +61 -0
- package/dist/templates/design-system/files/src/components/ui/card.tsx +40 -0
- package/dist/templates/design-system/files/src/components/ui/index.ts +6 -0
- package/dist/templates/design-system/files/src/components/ui/input.tsx +29 -0
- package/dist/templates/design-system/files/src/lib/cn.ts +13 -0
- package/dist/templates/design-system/files/src/styles/globals.css +37 -0
- package/dist/templates/design-system/files/src/styles/theme.ts +56 -0
- package/dist/templates/design-system/files/src/styles/tokens.css +73 -0
- package/dist/templates/design-system/files/tailwind.config.ts +58 -0
- package/dist/templates/design-system/manifest.json +81 -0
- package/dist/templates/docker/README.md +62 -0
- package/dist/templates/docker/files/.dockerignore +34 -0
- package/dist/templates/docker/files/.github/workflows/docker-build.yml +74 -0
- package/dist/templates/docker/files/Dockerfile +57 -0
- package/dist/templates/docker/files/docker-compose.ci.yml +22 -0
- package/dist/templates/docker/files/docker-compose.override.yml +20 -0
- package/dist/templates/docker/files/docker-compose.yml +109 -0
- package/dist/templates/docker/manifest.json +59 -0
- package/dist/templates/env-setup/README.md +70 -0
- package/dist/templates/env-setup/files/.env.example +28 -0
- package/dist/templates/env-setup/files/.gitignore.hexagen +16 -0
- package/dist/templates/env-setup/files/SETUP.md +70 -0
- package/dist/templates/env-setup/files/scripts/check-env.ts +95 -0
- package/dist/templates/env-setup/files/src/config/env.client.ts +18 -0
- package/dist/templates/env-setup/files/src/config/env.server.ts +49 -0
- package/dist/templates/env-setup/files/src/config/env.ts +14 -0
- package/dist/templates/env-setup/files/src/config/load-env.ts +40 -0
- package/dist/templates/env-setup/manifest.json +55 -0
- package/dist/templates/error-handling/README.md +72 -0
- package/dist/templates/error-handling/files/.env.sentry.example +8 -0
- package/dist/templates/error-handling/files/app/components/ErrorBoundary.tsx +49 -0
- package/dist/templates/error-handling/files/app/components/ErrorFallback.tsx +35 -0
- package/dist/templates/error-handling/files/server/middleware/error-handler.ts +131 -0
- package/dist/templates/error-handling/files/src/application/errors/application.error.ts +33 -0
- package/dist/templates/error-handling/files/src/domain/errors/authorization.error.ts +20 -0
- package/dist/templates/error-handling/files/src/domain/errors/domain.error.ts +23 -0
- package/dist/templates/error-handling/files/src/domain/errors/not-found.error.ts +11 -0
- package/dist/templates/error-handling/files/src/domain/errors/validation.error.ts +17 -0
- package/dist/templates/error-handling/files/src/infrastructure/errors/external-service.error.ts +24 -0
- package/dist/templates/error-handling/files/src/infrastructure/errors/infrastructure.error.ts +22 -0
- package/dist/templates/error-handling/files/src/infrastructure/errors/llm-errors.ts +57 -0
- package/dist/templates/error-handling/files/src/shared/errors/error-codes.ts +29 -0
- package/dist/templates/error-handling/files/src/shared/result.ts +38 -0
- package/dist/templates/error-handling/manifest.json +63 -0
- package/dist/templates/eslint-no-console/README.md +78 -0
- package/dist/templates/eslint-no-console/files/eslint.no-console.mjs +35 -0
- package/dist/templates/eslint-no-console/manifest.json +28 -0
- package/dist/templates/github-oauth/README.md +61 -0
- package/dist/templates/github-oauth/files/.env.github-oauth.example +13 -0
- package/dist/templates/github-oauth/files/app/api/auth/callback/github/route.ts +105 -0
- package/dist/templates/github-oauth/files/app/api/auth/login/github/route.ts +33 -0
- package/dist/templates/github-oauth/files/app/api/auth/logout/github/route.ts +8 -0
- package/dist/templates/github-oauth/files/app/api/auth/me/route.ts +10 -0
- package/dist/templates/github-oauth/files/middleware.ts +59 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/config.ts +34 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/github-auth.adapter.ts +12 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/github-client.ts +95 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/github-user.ts +8 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/session-store.ts +56 -0
- package/dist/templates/github-oauth/files/src/infrastructure/auth/github/user-profile-mapper.ts +24 -0
- package/dist/templates/github-oauth/files/src/lib/auth/get-current-user.ts +31 -0
- package/dist/templates/github-oauth/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/github-oauth/manifest.json +83 -0
- package/dist/templates/google-oauth/README.md +70 -0
- package/dist/templates/google-oauth/files/.env.google-oauth.example +14 -0
- package/dist/templates/google-oauth/files/app/api/auth/callback/google/route.ts +78 -0
- package/dist/templates/google-oauth/files/app/api/auth/login/google/route.ts +34 -0
- package/dist/templates/google-oauth/files/app/api/auth/logout/google/route.ts +8 -0
- package/dist/templates/google-oauth/files/app/api/auth/me/route.ts +13 -0
- package/dist/templates/google-oauth/files/middleware.ts +62 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/config.ts +29 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/google-auth.adapter.ts +22 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/google-client.ts +65 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/google-user.ts +9 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/session-store.ts +62 -0
- package/dist/templates/google-oauth/files/src/infrastructure/auth/google/user-profile-mapper.ts +24 -0
- package/dist/templates/google-oauth/files/src/lib/auth/get-current-user.ts +36 -0
- package/dist/templates/google-oauth/files/src/lib/auth/require-auth.ts +13 -0
- package/dist/templates/google-oauth/manifest.json +82 -0
- package/dist/templates/langgraph/README.md +60 -0
- package/dist/templates/langgraph/files/.env.langgraph.example +26 -0
- package/dist/templates/langgraph/files/app/api/agent/invoke/route.ts +48 -0
- package/dist/templates/langgraph/files/app/api/agent/resume/route.ts +66 -0
- package/dist/templates/langgraph/files/app/api/agent/stream/route.ts +63 -0
- package/dist/templates/langgraph/files/src/domain/ports/out/agent-graph.port.ts +78 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/adapters/langgraph.adapter.ts +185 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/index.ts +84 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/memory-checkpointer.ts +12 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/postgres-checkpointer.ts +20 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/redis-checkpointer.ts +25 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/checkpointers/supabase-checkpointer.ts +26 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/edges/routing.ts +31 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/graphs/research-agent.graph.ts +81 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/graphs/simple-chain.graph.ts +81 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/index.ts +23 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/human-review.node.ts +34 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/input-processor.node.ts +31 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/llm-call.node.ts +38 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/output-formatter.node.ts +27 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/planner.node.ts +51 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/researcher.node.ts +63 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/nodes/synthesiser.node.ts +62 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/state/graph-state.ts +57 -0
- package/dist/templates/langgraph/files/src/infrastructure/langgraph/streaming/token-stream.ts +84 -0
- package/dist/templates/langgraph/manifest.json +131 -0
- package/dist/templates/llm-adapter/README.md +63 -0
- package/dist/templates/llm-adapter/files/.env.llm.example +49 -0
- package/dist/templates/llm-adapter/files/src/domain/ports/out/llm-client.port.ts +36 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/anthropic-llm-client.adapter.ts +111 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/azure-openai-llm-client.adapter.ts +105 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/ollama-llm-client.adapter.ts +102 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/openai-llm-client.adapter.ts +104 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/adapters/xai-llm-client.adapter.ts +104 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/constants/capabilities.ts +38 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/constants/models.ts +39 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/errors/llm-errors.ts +83 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/index.ts +39 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/router/llm-router.ts +117 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/router/provider-registry.ts +45 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/smoke-test.ts +25 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/parse-env.ts +8 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/retry.ts +39 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/structured-output.ts +78 -0
- package/dist/templates/llm-adapter/files/src/infrastructure/llm/utils/timeout.ts +22 -0
- package/dist/templates/llm-adapter/manifest.json +113 -0
- package/dist/templates/llm-adapter-bedrock/README.md +58 -0
- package/dist/templates/llm-adapter-bedrock/files/.env.bedrock.example +23 -0
- package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/adapters/bedrock-llm-client.adapter.ts +126 -0
- package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/adapters/bedrock-register.ts +20 -0
- package/dist/templates/llm-adapter-bedrock/files/src/infrastructure/llm/errors/bedrock-errors.ts +42 -0
- package/dist/templates/llm-adapter-bedrock/manifest.json +51 -0
- package/dist/templates/magic-link/README.md +66 -0
- package/dist/templates/magic-link/files/.env.magic-link.example +24 -0
- package/dist/templates/magic-link/files/app/api/auth/logout/route.ts +12 -0
- package/dist/templates/magic-link/files/app/api/auth/magic-link/request/route.ts +34 -0
- package/dist/templates/magic-link/files/app/api/auth/magic-link/verify/route.ts +41 -0
- package/dist/templates/magic-link/files/app/api/auth/me/route.ts +10 -0
- package/dist/templates/magic-link/files/middleware.ts +60 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/config.ts +17 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/email-templates.ts +46 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/email-transport.ts +71 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/magic-link-auth.adapter.ts +11 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/magic-link-store.ts +31 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/session-store.ts +56 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/token-generator.ts +71 -0
- package/dist/templates/magic-link/files/src/infrastructure/auth/magic-link/user-profile-mapper.ts +10 -0
- package/dist/templates/magic-link/files/src/lib/auth/get-current-user.ts +28 -0
- package/dist/templates/magic-link/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/magic-link/manifest.json +99 -0
- package/dist/templates/microsoft-entra/README.md +63 -0
- package/dist/templates/microsoft-entra/files/.env.microsoft-entra.example +17 -0
- package/dist/templates/microsoft-entra/files/app/api/auth/callback/entra/route.ts +93 -0
- package/dist/templates/microsoft-entra/files/app/api/auth/login/entra/route.ts +29 -0
- package/dist/templates/microsoft-entra/files/app/api/auth/logout/entra/route.ts +26 -0
- package/dist/templates/microsoft-entra/files/app/api/auth/me/route.ts +10 -0
- package/dist/templates/microsoft-entra/files/middleware.ts +59 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/config.ts +43 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/entra-auth.adapter.ts +14 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/entra-client.ts +82 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/entra-user.ts +9 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/group-role-mapper.ts +22 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/pkce.ts +20 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/session-store.ts +56 -0
- package/dist/templates/microsoft-entra/files/src/infrastructure/auth/entra/user-profile-mapper.ts +33 -0
- package/dist/templates/microsoft-entra/files/src/lib/auth/get-current-user.ts +31 -0
- package/dist/templates/microsoft-entra/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/microsoft-entra/manifest.json +93 -0
- package/dist/templates/nextauth/README.md +61 -0
- package/dist/templates/nextauth/files/.env.nextauth.example +16 -0
- package/dist/templates/nextauth/files/app/api/auth/[...nextauth]/route.ts +4 -0
- package/dist/templates/nextauth/files/middleware.ts +17 -0
- package/dist/templates/nextauth/files/src/auth.config.ts +41 -0
- package/dist/templates/nextauth/files/src/auth.ts +67 -0
- package/dist/templates/nextauth/files/types/next-auth.d.ts +16 -0
- package/dist/templates/nextauth/manifest.json +74 -0
- package/dist/templates/observability/README.md +69 -0
- package/dist/templates/observability/files/.env.observability.example +12 -0
- package/dist/templates/observability/files/.env.otel.example +7 -0
- package/dist/templates/observability/files/app/api/health/route.ts +37 -0
- package/dist/templates/observability/files/instrumentation.ts +52 -0
- package/dist/templates/observability/files/server/middleware/request-logger.ts +53 -0
- package/dist/templates/observability/files/src/infrastructure/logging/context.ts +21 -0
- package/dist/templates/observability/files/src/infrastructure/logging/correlation.ts +39 -0
- package/dist/templates/observability/files/src/infrastructure/logging/index.ts +12 -0
- package/dist/templates/observability/files/src/infrastructure/logging/logger.ts +68 -0
- package/dist/templates/observability/files/src/infrastructure/logging/redact.ts +89 -0
- package/dist/templates/observability/manifest.json +57 -0
- package/dist/templates/rate-limiting/README.md +63 -0
- package/dist/templates/rate-limiting/files/.env.rate-limit.example +21 -0
- package/dist/templates/rate-limiting/files/server/errors/rate-limit-exceeded.error.ts +43 -0
- package/dist/templates/rate-limiting/files/server/middleware/rate-limit.ts +79 -0
- package/dist/templates/rate-limiting/files/server/utils/get-client-ip.ts +27 -0
- package/dist/templates/rate-limiting/files/server/utils/rate-limiter.ts +82 -0
- package/dist/templates/rate-limiting/files/server/utils/session-id.ts +28 -0
- package/dist/templates/rate-limiting/files/types/rate-limit.d.ts +12 -0
- package/dist/templates/rate-limiting/manifest.json +66 -0
- package/dist/templates/shared-types/README.md +59 -0
- package/dist/templates/shared-types/files/.env.shared-types.example +14 -0
- package/dist/templates/shared-types/files/src/domain/value-objects/user-context.ts +11 -0
- package/dist/templates/shared-types/files/src/infrastructure/auth/mock-user.ts +16 -0
- package/dist/templates/shared-types/files/src/infrastructure/auth/session/session-manager.ts +59 -0
- package/dist/templates/shared-types/manifest.json +37 -0
- package/dist/templates/supabase/README.md +59 -0
- package/dist/templates/supabase/files/.env.supabase.example +15 -0
- package/dist/templates/supabase/files/drizzle.config.ts +15 -0
- package/dist/templates/supabase/files/scripts/gen-types.sh +9 -0
- package/dist/templates/supabase/files/scripts/migrate.ts +23 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/admin.ts +23 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/client.ts +16 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/drizzle/client.ts +17 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/drizzle/schema.ts +10 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/realtime/subscribe.ts +41 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/result.ts +30 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/server.ts +28 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/delete.ts +17 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/download.ts +17 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/index.ts +4 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/signed-url.ts +26 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/storage/upload.ts +24 -0
- package/dist/templates/supabase/files/src/infrastructure/supabase/types/database.types.ts +10 -0
- package/dist/templates/supabase/files/supabase/migrations/0001_example_rls.sql +23 -0
- package/dist/templates/supabase/files/supabase/seed.sql +7 -0
- package/dist/templates/supabase/manifest.json +133 -0
- package/dist/templates/supabase-auth/README.md +55 -0
- package/dist/templates/supabase-auth/files/app/api/auth/me/route.ts +10 -0
- package/dist/templates/supabase-auth/files/middleware.ts +108 -0
- package/dist/templates/supabase-auth/files/src/lib/auth/get-current-user.ts +46 -0
- package/dist/templates/supabase-auth/files/src/lib/auth/require-auth.ts +11 -0
- package/dist/templates/supabase-auth/manifest.json +40 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/manifest/apps.d.ts +24 -0
- package/dist/types/manifest/apps.d.ts.map +1 -0
- package/dist/types/manifest/bounded-context.d.ts +43 -0
- package/dist/types/manifest/bounded-context.d.ts.map +1 -0
- package/dist/types/manifest/generator.d.ts +51 -0
- package/dist/types/manifest/generator.d.ts.map +1 -0
- package/dist/types/manifest/helpers.d.ts +30 -0
- package/dist/types/manifest/helpers.d.ts.map +1 -0
- package/dist/types/manifest/index.d.ts +8 -0
- package/dist/types/manifest/index.d.ts.map +1 -0
- package/dist/types/manifest/layers.d.ts +32 -0
- package/dist/types/manifest/layers.d.ts.map +1 -0
- package/dist/types/manifest/manifest.d.ts +64 -0
- package/dist/types/manifest/manifest.d.ts.map +1 -0
- package/dist/types/manifest/monorepo.d.ts +94 -0
- package/dist/types/manifest/monorepo.d.ts.map +1 -0
- package/dist/types/manifest.d.ts +2 -0
- package/dist/types/manifest.d.ts.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { ZodSchema } from "zod";
|
|
2
|
+
import type {
|
|
3
|
+
LLMClientPort,
|
|
4
|
+
LLMCallOptions,
|
|
5
|
+
LLMResponse,
|
|
6
|
+
} from "../../../domain/ports/out/llm-client.port";
|
|
7
|
+
import type { LLMError } from "../errors/llm-errors";
|
|
8
|
+
import { MODELS } from "../constants/models";
|
|
9
|
+
import { XaiLLMClientAdapter } from "../adapters/xai-llm-client.adapter";
|
|
10
|
+
import { OpenAILLMClientAdapter } from "../adapters/openai-llm-client.adapter";
|
|
11
|
+
import { AnthropicLLMClientAdapter } from "../adapters/anthropic-llm-client.adapter";
|
|
12
|
+
import { OllamaLLMClientAdapter } from "../adapters/ollama-llm-client.adapter";
|
|
13
|
+
import { AzureOpenAILLMClientAdapter } from "../adapters/azure-openai-llm-client.adapter";
|
|
14
|
+
import {
|
|
15
|
+
registeredProviders,
|
|
16
|
+
type ProviderModels,
|
|
17
|
+
} from "./provider-registry";
|
|
18
|
+
import type { Result } from "../../../../shared/result";
|
|
19
|
+
|
|
20
|
+
export type CallType = "orchestration" | "wizard" | "fast" | "vision";
|
|
21
|
+
|
|
22
|
+
interface ResolvedTarget {
|
|
23
|
+
adapter: LLMClientPort;
|
|
24
|
+
model: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type LLMRouterOptions = LLMCallOptions & { callType?: CallType };
|
|
28
|
+
|
|
29
|
+
export class LLMRouter implements LLMClientPort {
|
|
30
|
+
private readonly adapters: Map<string, LLMClientPort>;
|
|
31
|
+
private readonly models: Map<string, ProviderModels>;
|
|
32
|
+
private readonly primaryProvider: string;
|
|
33
|
+
|
|
34
|
+
// `string` (not the built-in `Provider` union) so addon-registered providers
|
|
35
|
+
// — e.g. "bedrock" via the provider-registry seam — are accepted too.
|
|
36
|
+
constructor(primaryProvider: string = "xai") {
|
|
37
|
+
this.primaryProvider = primaryProvider;
|
|
38
|
+
this.adapters = new Map<string, LLMClientPort>([
|
|
39
|
+
["xai", new XaiLLMClientAdapter()],
|
|
40
|
+
["openai", new OpenAILLMClientAdapter()],
|
|
41
|
+
["anthropic", new AnthropicLLMClientAdapter()],
|
|
42
|
+
["ollama", new OllamaLLMClientAdapter()],
|
|
43
|
+
["azure-openai", new AzureOpenAILLMClientAdapter()],
|
|
44
|
+
]);
|
|
45
|
+
this.models = new Map<string, ProviderModels>(Object.entries(MODELS));
|
|
46
|
+
// Merge providers registered by addon templates (e.g. llm-adapter-bedrock).
|
|
47
|
+
// Honour the lazy `factory` contract: only the *selected* provider's adapter
|
|
48
|
+
// is instantiated — unused addon adapters (and their SDK clients) are never
|
|
49
|
+
// built. A registered name may not shadow a built-in.
|
|
50
|
+
for (const [name, reg] of registeredProviders()) {
|
|
51
|
+
if (this.adapters.has(name)) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Registered LLM provider "${name}" collides with a built-in provider.`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
this.models.set(name, reg.models);
|
|
57
|
+
if (name === primaryProvider) {
|
|
58
|
+
this.adapters.set(name, reg.factory());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Fail fast at construction (a config error) with an actionable message —
|
|
62
|
+
// the usual cause for an addon provider is a missing registration
|
|
63
|
+
// side-effect import. Because this validates here, `resolve()` (and thus
|
|
64
|
+
// `call()`) never has to handle an unknown provider.
|
|
65
|
+
if (!this.adapters.has(primaryProvider)) {
|
|
66
|
+
const known = [...this.adapters.keys(), ...registeredProviders().keys()];
|
|
67
|
+
throw new Error(
|
|
68
|
+
`Unknown LLM provider "${primaryProvider}". Available: ${known.join(", ")}. ` +
|
|
69
|
+
`If it is an addon provider (e.g. "bedrock"), import its registration module once at ` +
|
|
70
|
+
`startup before constructing LLMRouter — e.g. ` +
|
|
71
|
+
`import "./infrastructure/llm/adapters/bedrock-register";`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async call(
|
|
77
|
+
prompt: string,
|
|
78
|
+
options: LLMRouterOptions = {},
|
|
79
|
+
): Promise<Result<LLMResponse, LLMError>> {
|
|
80
|
+
const { callType = "fast", ...rest } = options;
|
|
81
|
+
const { adapter, model } = this.resolve(callType);
|
|
82
|
+
return adapter.call(prompt, { ...rest, model });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async callStructured<T>(
|
|
86
|
+
prompt: string,
|
|
87
|
+
schema: ZodSchema<T>,
|
|
88
|
+
options: LLMRouterOptions = {},
|
|
89
|
+
): Promise<Result<T, LLMError>> {
|
|
90
|
+
const { callType = "fast", ...rest } = options;
|
|
91
|
+
const { adapter, model } = this.resolve(callType);
|
|
92
|
+
return adapter.callStructured(prompt, schema, { ...rest, model });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private resolve(callType: CallType): ResolvedTarget {
|
|
96
|
+
const provider = this.primaryProvider;
|
|
97
|
+
// The constructor validated the primary provider, so its adapter and models
|
|
98
|
+
// are present — resolve never throws, keeping call()/callStructured() within
|
|
99
|
+
// the Result contract.
|
|
100
|
+
const adapter = this.adapters.get(provider)!;
|
|
101
|
+
const providerModels = this.models.get(provider)!;
|
|
102
|
+
|
|
103
|
+
const model: string = (() => {
|
|
104
|
+
switch (callType) {
|
|
105
|
+
case "orchestration":
|
|
106
|
+
return providerModels.reasoning;
|
|
107
|
+
case "vision":
|
|
108
|
+
return providerModels.vision;
|
|
109
|
+
case "wizard":
|
|
110
|
+
case "fast":
|
|
111
|
+
return providerModels.fast;
|
|
112
|
+
}
|
|
113
|
+
})();
|
|
114
|
+
|
|
115
|
+
return { adapter, model };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { LLMClientPort } from "../../../domain/ports/out/llm-client.port";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Provider-registration seam. Addon templates (e.g. `llm-adapter-bedrock`)
|
|
5
|
+
* register an extra LLM provider here instead of overwriting the router or the
|
|
6
|
+
* built-in `MODELS` map — keeping the base files untouched and the addon
|
|
7
|
+
* self-contained.
|
|
8
|
+
*
|
|
9
|
+
* Each registration supplies a lazy adapter factory and the model id per call
|
|
10
|
+
* tier, so `LLMRouter` can resolve a registered provider exactly like a built-in
|
|
11
|
+
* one. Register at startup, before the router is constructed:
|
|
12
|
+
*
|
|
13
|
+
* import "./infrastructure/llm/adapters/<provider>-register";
|
|
14
|
+
*/
|
|
15
|
+
export interface ProviderModels {
|
|
16
|
+
readonly reasoning: string;
|
|
17
|
+
readonly fast: string;
|
|
18
|
+
readonly vision: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ProviderRegistration {
|
|
22
|
+
/** Lazily instantiate the adapter — only registered providers are built. */
|
|
23
|
+
readonly factory: () => LLMClientPort;
|
|
24
|
+
/** Model id per call tier (env-overridable in the addon's registration). */
|
|
25
|
+
readonly models: ProviderModels;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const registry = new Map<string, ProviderRegistration>();
|
|
29
|
+
|
|
30
|
+
export function registerProvider(
|
|
31
|
+
name: string,
|
|
32
|
+
registration: ProviderRegistration,
|
|
33
|
+
): void {
|
|
34
|
+
// Reject duplicates so a typo or a second addon can't silently replace an
|
|
35
|
+
// already-registered provider and change routing with no signal.
|
|
36
|
+
if (registry.has(name)) {
|
|
37
|
+
throw new Error(`LLM provider "${name}" is already registered.`);
|
|
38
|
+
}
|
|
39
|
+
registry.set(name, registration);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Snapshot of registered providers, consumed by `LLMRouter`'s constructor. */
|
|
43
|
+
export function registeredProviders(): ReadonlyMap<string, ProviderRegistration> {
|
|
44
|
+
return registry;
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LLMRouter } from "./router/llm-router";
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
const router = new LLMRouter();
|
|
5
|
+
console.log("LLM smoke test — calling router with callType: fast...");
|
|
6
|
+
|
|
7
|
+
const result = await router.call('Say only the word "OK" and nothing else.', {
|
|
8
|
+
callType: "fast",
|
|
9
|
+
maxTokens: 10,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
if (!result.success) {
|
|
13
|
+
console.error("Smoke test FAILED:", result.error.message);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
console.log("Smoke test PASSED:", result.value.content.trim());
|
|
18
|
+
console.log("Model:", result.value.model);
|
|
19
|
+
console.log("Tokens:", result.value.usage.totalTokens);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
main().catch((e) => {
|
|
23
|
+
console.error("Smoke test threw:", e);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isRetryable, type LLMError } from "../errors/llm-errors";
|
|
2
|
+
import { parseIntSafe } from "./parse-env";
|
|
3
|
+
import type { Result } from "../../../../shared/result";
|
|
4
|
+
|
|
5
|
+
const DEFAULT_BASE_MS = 500;
|
|
6
|
+
|
|
7
|
+
function jitter(base: number): number {
|
|
8
|
+
return Math.random() * base;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function backoffMs(attempt: number, base = DEFAULT_BASE_MS): number {
|
|
12
|
+
return base * Math.pow(2, attempt) + jitter(base);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function sleep(ms: number): Promise<void> {
|
|
16
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function withRetry<T>(
|
|
20
|
+
fn: () => Promise<Result<T, LLMError>>,
|
|
21
|
+
maxRetries = parseIntSafe(process.env.LLM_MAX_RETRIES, 2, 0),
|
|
22
|
+
): Promise<Result<T, LLMError>> {
|
|
23
|
+
let attempt = 0;
|
|
24
|
+
|
|
25
|
+
while (true) {
|
|
26
|
+
const result = await fn();
|
|
27
|
+
|
|
28
|
+
if (result.success) return result;
|
|
29
|
+
|
|
30
|
+
const error = result.error;
|
|
31
|
+
const isLast = attempt >= maxRetries;
|
|
32
|
+
|
|
33
|
+
if (isLast || !isRetryable(error)) return result;
|
|
34
|
+
|
|
35
|
+
const delay = error.retryAfterMs ?? backoffMs(attempt);
|
|
36
|
+
await sleep(delay);
|
|
37
|
+
attempt++;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ZodSchema } from "zod";
|
|
2
|
+
import { LLMParsingError } from "../errors/llm-errors";
|
|
3
|
+
import type { LLMClientPort, LLMCallOptions } from "../../../domain/ports/out/llm-client.port";
|
|
4
|
+
import type { Result } from "../../../../shared/result";
|
|
5
|
+
import type { LLMError } from "../errors/llm-errors";
|
|
6
|
+
|
|
7
|
+
const JSON_FENCE_RE = /```(?:json)?\s*([\s\S]*?)```/i;
|
|
8
|
+
|
|
9
|
+
function extractJson(raw: string): string {
|
|
10
|
+
const fenced = JSON_FENCE_RE.exec(raw);
|
|
11
|
+
if (fenced) return fenced[1].trim();
|
|
12
|
+
const start = raw.indexOf("{");
|
|
13
|
+
const end = raw.lastIndexOf("}");
|
|
14
|
+
if (start !== -1 && end > start) return raw.slice(start, end + 1);
|
|
15
|
+
const arrStart = raw.indexOf("[");
|
|
16
|
+
const arrEnd = raw.lastIndexOf("]");
|
|
17
|
+
if (arrStart !== -1 && arrEnd > arrStart) return raw.slice(arrStart, arrEnd + 1);
|
|
18
|
+
return raw.trim();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const REPAIR_SYSTEM_PROMPT = `You are a JSON repair assistant. The user will provide a JSON string and a validation error. Return ONLY the corrected JSON with no explanation, no markdown, no code fences.`;
|
|
22
|
+
|
|
23
|
+
export async function callStructured<T>(
|
|
24
|
+
client: LLMClientPort,
|
|
25
|
+
prompt: string,
|
|
26
|
+
schema: ZodSchema<T>,
|
|
27
|
+
options?: LLMCallOptions,
|
|
28
|
+
): Promise<Result<T, LLMError>> {
|
|
29
|
+
const systemPrompt = [
|
|
30
|
+
options?.systemPrompt,
|
|
31
|
+
"Respond with ONLY valid JSON matching the requested schema. No explanation, no markdown.",
|
|
32
|
+
]
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.join("\n\n");
|
|
35
|
+
|
|
36
|
+
const callResult = await client.call(prompt, { ...options, systemPrompt });
|
|
37
|
+
if (!callResult.success) return callResult;
|
|
38
|
+
|
|
39
|
+
const raw = callResult.value.content;
|
|
40
|
+
|
|
41
|
+
let repairReason: string;
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const parsed = JSON.parse(extractJson(raw));
|
|
45
|
+
const validated = schema.safeParse(parsed);
|
|
46
|
+
if (validated.success) return { success: true, value: validated.data };
|
|
47
|
+
repairReason = `Validation errors:\n${JSON.stringify(validated.error.issues, null, 2)}`;
|
|
48
|
+
} catch (e) {
|
|
49
|
+
repairReason = `JSON.parse failed: ${e instanceof Error ? e.message : String(e)}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// One repair attempt — covers both invalid JSON and schema validation failures
|
|
53
|
+
const repairPrompt = `Original response:\n${raw}\n\n${repairReason}\n\nReturn the corrected JSON only.`;
|
|
54
|
+
const repairResult = await client.call(repairPrompt, {
|
|
55
|
+
...options,
|
|
56
|
+
systemPrompt: REPAIR_SYSTEM_PROMPT,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (!repairResult.success) return repairResult;
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
const repaired = JSON.parse(extractJson(repairResult.value.content));
|
|
63
|
+
const revalidated = schema.safeParse(repaired);
|
|
64
|
+
if (revalidated.success) return { success: true, value: revalidated.data };
|
|
65
|
+
return {
|
|
66
|
+
success: false,
|
|
67
|
+
error: new LLMParsingError(
|
|
68
|
+
`Schema validation failed after repair: ${revalidated.error.message}`,
|
|
69
|
+
raw,
|
|
70
|
+
),
|
|
71
|
+
};
|
|
72
|
+
} catch (e) {
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
error: new LLMParsingError("Repair response is not valid JSON", repairResult.value.content, e),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LLMTimeoutError } from "../errors/llm-errors";
|
|
2
|
+
|
|
3
|
+
export async function withTimeout<T>(
|
|
4
|
+
operation: (signal: AbortSignal) => Promise<T>,
|
|
5
|
+
ms: number,
|
|
6
|
+
): Promise<T> {
|
|
7
|
+
const controller = new AbortController();
|
|
8
|
+
const timer = setTimeout(() => controller.abort(), ms);
|
|
9
|
+
try {
|
|
10
|
+
return await operation(controller.signal);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
if (
|
|
13
|
+
error instanceof Error &&
|
|
14
|
+
(error.name === "AbortError" || error.name === "TimeoutError")
|
|
15
|
+
) {
|
|
16
|
+
throw new LLMTimeoutError(ms);
|
|
17
|
+
}
|
|
18
|
+
throw error;
|
|
19
|
+
} finally {
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "llm-adapter",
|
|
3
|
+
"name": "LLM Adapter",
|
|
4
|
+
"description": "Typed port interface, provider adapters (xAI, OpenAI, Anthropic, Ollama, Azure OpenAI), model constants, reasoning routing, retry logic, structured output",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"requires": ["env-setup", "error-handling"],
|
|
7
|
+
"conflicts": [],
|
|
8
|
+
"questions": [
|
|
9
|
+
{
|
|
10
|
+
"id": "providers",
|
|
11
|
+
"type": "multiselect",
|
|
12
|
+
"prompt": "Which LLM providers do you need?",
|
|
13
|
+
"options": ["xai", "openai", "anthropic", "ollama", "azure-openai"],
|
|
14
|
+
"default": ["xai"]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "primary_provider",
|
|
18
|
+
"type": "select",
|
|
19
|
+
"prompt": "Primary provider for orchestration (must be one of the providers selected above)?",
|
|
20
|
+
"options": ["xai", "openai", "anthropic", "ollama", "azure-openai"],
|
|
21
|
+
"default": "xai"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "reasoning_routing",
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"prompt": "Route orchestration calls to a dedicated reasoning model?",
|
|
27
|
+
"default": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "structured_output",
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"prompt": "Need structured JSON output with Zod schema validation?",
|
|
33
|
+
"default": true
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "streaming",
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"prompt": "Enable streaming responses?",
|
|
39
|
+
"default": false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "default_timeout_ms",
|
|
43
|
+
"type": "select",
|
|
44
|
+
"prompt": "Default request timeout (ms)?",
|
|
45
|
+
"options": ["15000", "30000", "60000", "120000"],
|
|
46
|
+
"default": "30000"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "max_retries",
|
|
50
|
+
"type": "select",
|
|
51
|
+
"prompt": "Max retries on transient failure?",
|
|
52
|
+
"options": ["0", "1", "2", "3"],
|
|
53
|
+
"default": "2"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"envVars": [
|
|
57
|
+
"XAI_API_KEY",
|
|
58
|
+
"XAI_BASE_URL",
|
|
59
|
+
"OPENAI_API_KEY",
|
|
60
|
+
"OPENAI_BASE_URL",
|
|
61
|
+
"OPENAI_REASONING_MODEL",
|
|
62
|
+
"OPENAI_FAST_MODEL",
|
|
63
|
+
"OPENAI_VISION_MODEL",
|
|
64
|
+
"ANTHROPIC_API_KEY",
|
|
65
|
+
"ANTHROPIC_REASONING_MODEL",
|
|
66
|
+
"ANTHROPIC_FAST_MODEL",
|
|
67
|
+
"ANTHROPIC_VISION_MODEL",
|
|
68
|
+
"OLLAMA_BASE_URL",
|
|
69
|
+
"OLLAMA_REASONING_MODEL",
|
|
70
|
+
"OLLAMA_FAST_MODEL",
|
|
71
|
+
"OLLAMA_VISION_MODEL",
|
|
72
|
+
"AZURE_OPENAI_API_KEY",
|
|
73
|
+
"AZURE_OPENAI_ENDPOINT",
|
|
74
|
+
"AZURE_OPENAI_DEPLOYMENT",
|
|
75
|
+
"AZURE_OPENAI_REASONING_DEPLOYMENT",
|
|
76
|
+
"AZURE_OPENAI_FAST_DEPLOYMENT",
|
|
77
|
+
"AZURE_OPENAI_VISION_DEPLOYMENT",
|
|
78
|
+
"LLM_REASONING_MODEL",
|
|
79
|
+
"LLM_FAST_MODEL",
|
|
80
|
+
"LLM_VISION_MODEL",
|
|
81
|
+
"LLM_DEFAULT_TIMEOUT_MS",
|
|
82
|
+
"LLM_MAX_RETRIES"
|
|
83
|
+
],
|
|
84
|
+
"outputs": [
|
|
85
|
+
"src/domain/ports/out/llm-client.port.ts",
|
|
86
|
+
"src/infrastructure/llm/constants/models.ts",
|
|
87
|
+
"src/infrastructure/llm/constants/capabilities.ts",
|
|
88
|
+
"src/infrastructure/llm/errors/llm-errors.ts",
|
|
89
|
+
"src/infrastructure/llm/utils/parse-env.ts",
|
|
90
|
+
"src/infrastructure/llm/utils/retry.ts",
|
|
91
|
+
"src/infrastructure/llm/utils/timeout.ts",
|
|
92
|
+
"src/infrastructure/llm/utils/structured-output.ts",
|
|
93
|
+
"src/infrastructure/llm/adapters/xai-llm-client.adapter.ts",
|
|
94
|
+
"src/infrastructure/llm/adapters/openai-llm-client.adapter.ts",
|
|
95
|
+
"src/infrastructure/llm/adapters/anthropic-llm-client.adapter.ts",
|
|
96
|
+
"src/infrastructure/llm/adapters/ollama-llm-client.adapter.ts",
|
|
97
|
+
"src/infrastructure/llm/adapters/azure-openai-llm-client.adapter.ts",
|
|
98
|
+
"src/infrastructure/llm/router/llm-router.ts",
|
|
99
|
+
"src/infrastructure/llm/router/provider-registry.ts",
|
|
100
|
+
"src/infrastructure/llm/index.ts",
|
|
101
|
+
"src/infrastructure/llm/smoke-test.ts",
|
|
102
|
+
".env.llm.example"
|
|
103
|
+
],
|
|
104
|
+
"checklist": [
|
|
105
|
+
"Copy .env.llm.example values into your .env.local",
|
|
106
|
+
"Add your API key(s) for the provider(s) you selected",
|
|
107
|
+
"Confirm primary_provider is included in your providers list",
|
|
108
|
+
"Verify LLM_REASONING_MODEL matches a model available on your current API tier",
|
|
109
|
+
"Run: npx tsx src/infrastructure/llm/smoke-test.ts to verify provider wiring",
|
|
110
|
+
"See SETUP.md → LLM Adapter for model reference and tier limits"
|
|
111
|
+
],
|
|
112
|
+
"branch": "feature/generator-template-llm-adapter"
|
|
113
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# LLM Adapter — Amazon Bedrock (`llm-adapter-bedrock`)
|
|
2
|
+
|
|
3
|
+
> Adds Amazon Bedrock (Converse API) as a provider to the `llm-adapter` router via its
|
|
4
|
+
> provider-registration seam — no base files overwritten. Auth uses the AWS credential chain.
|
|
5
|
+
|
|
6
|
+
| | |
|
|
7
|
+
| ------------- | -------------------------------------------- |
|
|
8
|
+
| **ID** | `llm-adapter-bedrock` |
|
|
9
|
+
| **Category** | LLM provider add-on |
|
|
10
|
+
| **Requires** | `llm-adapter`, `error-handling`, `env-setup` |
|
|
11
|
+
| **Conflicts** | none |
|
|
12
|
+
| **Branch** | `feature/generator-template-bedrock` |
|
|
13
|
+
|
|
14
|
+
Author/agent-facing reference, beside `manifest.json` — not emitted into projects.
|
|
15
|
+
|
|
16
|
+
## What it does
|
|
17
|
+
|
|
18
|
+
Registers a Bedrock adapter with the existing `llm-adapter` router. It only **adds** files (the
|
|
19
|
+
adapter, a registration module, Bedrock error mapping) — nothing in `llm-adapter` is overwritten.
|
|
20
|
+
Models are addressed by inference-profile id (e.g. `us.anthropic.claude-sonnet-4-…`).
|
|
21
|
+
|
|
22
|
+
## Service & API
|
|
23
|
+
|
|
24
|
+
- **Provider:** Amazon Bedrock Runtime, **Converse API** (`@aws-sdk/client-bedrock-runtime`).
|
|
25
|
+
- **Auth:** the AWS credential chain (task role on AWS, `AWS_*` locally). Optional Guardrails.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
`hexagen add llm-adapter-bedrock`. Questions: `bedrock_region`, `bedrock_inference` (default
|
|
30
|
+
model id), `bedrock_guardrails` (bool). No new schema env vars; seeds `.env.bedrock.example` with
|
|
31
|
+
`BEDROCK_*` model overrides + optional `BEDROCK_GUARDRAIL_ID`. Emits the adapter,
|
|
32
|
+
`bedrock-register.ts`, `bedrock-errors.ts`, `.env.bedrock.example`.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import "@/infrastructure/llm/adapters/bedrock-register"; // once, before constructing the router
|
|
38
|
+
import { LLMRouter } from "@/infrastructure/llm/router/llm-router";
|
|
39
|
+
|
|
40
|
+
const llm = new LLMRouter("bedrock"); // Bedrock as primary
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Notes for agents
|
|
44
|
+
|
|
45
|
+
- `npm install @aws-sdk/client-bedrock-runtime` (the only channel — no manifest `deps`).
|
|
46
|
+
- Enable model access in the Bedrock console (per account, per region) or calls return
|
|
47
|
+
`AccessDeniedException`.
|
|
48
|
+
- Import the registration **before** constructing the router.
|
|
49
|
+
- Override models per tier via `BEDROCK_REASONING_MODEL` / `BEDROCK_FAST_MODEL` / `BEDROCK_VISION_MODEL`.
|
|
50
|
+
|
|
51
|
+
## Checklist (post-install)
|
|
52
|
+
|
|
53
|
+
Install the SDK; enable model access; import `bedrock-register` at startup; make Bedrock primary;
|
|
54
|
+
use the AWS credential chain; set model overrides + Guardrails if used.
|
|
55
|
+
|
|
56
|
+
## Related
|
|
57
|
+
|
|
58
|
+
Requires [`llm-adapter`](../llm-adapter), [`error-handling`](../error-handling), [`env-setup`](../env-setup).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# -------- Amazon Bedrock (llm-adapter-bedrock) --------
|
|
2
|
+
# Auth uses the AWS credential chain (env -> shared profile -> IMDS/IRSA).
|
|
3
|
+
# On ECS/Graviton deploys, leave AWS_* unset and grant the task role
|
|
4
|
+
# bedrock:InvokeModel / bedrock:Converse. check:env treats AWS_* as optional.
|
|
5
|
+
# AWS_ACCESS_KEY_ID=
|
|
6
|
+
# AWS_SECRET_ACCESS_KEY=
|
|
7
|
+
# AWS_SESSION_TOKEN=
|
|
8
|
+
|
|
9
|
+
# Region is OPTIONAL — leave unset to let the SDK cascade resolve it
|
|
10
|
+
# (env -> profile -> IMDS/IRSA). Set it only to pin a region explicitly.
|
|
11
|
+
# BEDROCK_REGION={bedrock_region}
|
|
12
|
+
|
|
13
|
+
# Model ids (cross-region inference profiles). Default chosen at install:
|
|
14
|
+
# {bedrock_inference}
|
|
15
|
+
# Override per call tier as needed:
|
|
16
|
+
# BEDROCK_REASONING_MODEL=
|
|
17
|
+
# BEDROCK_FAST_MODEL=
|
|
18
|
+
# BEDROCK_VISION_MODEL=
|
|
19
|
+
|
|
20
|
+
# Guardrails support wired: {bedrock_guardrails}
|
|
21
|
+
# Set an id to attach a Bedrock Guardrail to every Converse call.
|
|
22
|
+
# BEDROCK_GUARDRAIL_ID=
|
|
23
|
+
# BEDROCK_GUARDRAIL_VERSION=DRAFT
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// @hexagen-server-only — uses the AWS SDK + Node credential chain; never import
|
|
2
|
+
// from a client bundle (ADR-0037).
|
|
3
|
+
import type { ZodSchema } from "zod";
|
|
4
|
+
import {
|
|
5
|
+
BedrockRuntimeClient,
|
|
6
|
+
ConverseCommand,
|
|
7
|
+
} from "@aws-sdk/client-bedrock-runtime";
|
|
8
|
+
import type {
|
|
9
|
+
LLMClientPort,
|
|
10
|
+
LLMCallOptions,
|
|
11
|
+
LLMResponse,
|
|
12
|
+
} from "../../../domain/ports/out/llm-client.port";
|
|
13
|
+
import type { LLMError } from "../errors/llm-errors";
|
|
14
|
+
import { classifyAwsError } from "../errors/bedrock-errors";
|
|
15
|
+
import { withRetry } from "../utils/retry";
|
|
16
|
+
import { withTimeout } from "../utils/timeout";
|
|
17
|
+
import { callStructured } from "../utils/structured-output";
|
|
18
|
+
import { parseIntSafe } from "../utils/parse-env";
|
|
19
|
+
import type { Result } from "../../../../shared/result";
|
|
20
|
+
|
|
21
|
+
const DEFAULT_TIMEOUT = parseIntSafe(
|
|
22
|
+
process.env.LLM_DEFAULT_TIMEOUT_MS,
|
|
23
|
+
30000,
|
|
24
|
+
1,
|
|
25
|
+
);
|
|
26
|
+
const DEFAULT_MODEL = process.env.BEDROCK_FAST_MODEL ?? "{bedrock_inference}";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Region resolution: let the AWS SDK cascade win (env -> shared profile ->
|
|
30
|
+
* IMDS/IRSA on Graviton/ECS). Only pin a region when the user explicitly set
|
|
31
|
+
* one — a hardcoded literal would silently mis-region in-cluster.
|
|
32
|
+
*/
|
|
33
|
+
function resolveRegion(): string | undefined {
|
|
34
|
+
return process.env.BEDROCK_REGION ?? process.env.AWS_REGION ?? undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class BedrockLLMClientAdapter implements LLMClientPort {
|
|
38
|
+
private readonly client: BedrockRuntimeClient;
|
|
39
|
+
|
|
40
|
+
constructor(client?: BedrockRuntimeClient) {
|
|
41
|
+
const region = resolveRegion();
|
|
42
|
+
this.client = client ?? new BedrockRuntimeClient(region ? { region } : {});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async call(
|
|
46
|
+
prompt: string,
|
|
47
|
+
options: LLMCallOptions = {},
|
|
48
|
+
): Promise<Result<LLMResponse, LLMError>> {
|
|
49
|
+
return withRetry(() => this.doCall(prompt, options));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async callStructured<T>(
|
|
53
|
+
prompt: string,
|
|
54
|
+
schema: ZodSchema<T>,
|
|
55
|
+
options?: LLMCallOptions,
|
|
56
|
+
): Promise<Result<T, LLMError>> {
|
|
57
|
+
return callStructured(this, prompt, schema, options);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private async doCall(
|
|
61
|
+
prompt: string,
|
|
62
|
+
options: LLMCallOptions,
|
|
63
|
+
): Promise<Result<LLMResponse, LLMError>> {
|
|
64
|
+
const modelId = options.model ?? DEFAULT_MODEL;
|
|
65
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT;
|
|
66
|
+
const guardrailId = process.env.BEDROCK_GUARDRAIL_ID;
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
const response = await withTimeout(
|
|
70
|
+
(signal) =>
|
|
71
|
+
this.client.send(
|
|
72
|
+
// ConverseCommand is provider-agnostic across Bedrock model families
|
|
73
|
+
// (Claude, Nova, Llama, …) — preferred over InvokeModel.
|
|
74
|
+
new ConverseCommand({
|
|
75
|
+
modelId,
|
|
76
|
+
messages: [{ role: "user", content: [{ text: prompt }] }],
|
|
77
|
+
...(options.systemPrompt
|
|
78
|
+
? { system: [{ text: options.systemPrompt }] }
|
|
79
|
+
: {}),
|
|
80
|
+
inferenceConfig: {
|
|
81
|
+
maxTokens: options.maxTokens ?? 4096,
|
|
82
|
+
temperature: options.temperature ?? 0.7,
|
|
83
|
+
},
|
|
84
|
+
...(guardrailId
|
|
85
|
+
? {
|
|
86
|
+
guardrailConfig: {
|
|
87
|
+
guardrailIdentifier: guardrailId,
|
|
88
|
+
guardrailVersion:
|
|
89
|
+
process.env.BEDROCK_GUARDRAIL_VERSION ?? "DRAFT",
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
: {}),
|
|
93
|
+
}),
|
|
94
|
+
{ abortSignal: signal },
|
|
95
|
+
),
|
|
96
|
+
timeoutMs,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// Converse can return non-text blocks (e.g. `toolUse`), but LLMClientPort
|
|
100
|
+
// is text / structured-output focused, so concatenate text blocks only.
|
|
101
|
+
const content =
|
|
102
|
+
response.output?.message?.content
|
|
103
|
+
?.map((block) => block.text ?? "")
|
|
104
|
+
.join("") ?? "";
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
success: true,
|
|
108
|
+
value: {
|
|
109
|
+
content,
|
|
110
|
+
model: modelId,
|
|
111
|
+
usage: {
|
|
112
|
+
promptTokens: response.usage?.inputTokens ?? 0,
|
|
113
|
+
completionTokens: response.usage?.outputTokens ?? 0,
|
|
114
|
+
totalTokens: response.usage?.totalTokens ?? 0,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
} catch (e) {
|
|
119
|
+
// withTimeout throws LLMTimeoutError directly; preserve it.
|
|
120
|
+
if (e instanceof Error && e.name === "LLMTimeoutError") {
|
|
121
|
+
return { success: false, error: e as LLMError };
|
|
122
|
+
}
|
|
123
|
+
return { success: false, error: classifyAwsError(e) };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|