@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
package/dist/templates/bedrock-agentcore-runtime/files/src/infrastructure/agentcore/http/server.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { createServer, type IncomingMessage, type ServerResponse } from "node:http";
|
|
2
|
+
import type { AddressInfo } from "node:net";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { createInvocationHandler } from "./invocations.handler";
|
|
6
|
+
import { handlePing } from "./ping.handler";
|
|
7
|
+
import type { AgentRuntimePort } from "../runtime/payload";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* AgentCore Runtime container entrypoint.
|
|
11
|
+
*
|
|
12
|
+
* AgentCore requires the container to listen on port 8080 and serve the HTTP
|
|
13
|
+
* contract: `GET /ping` (health) and `POST /invocations` (the agent). This is a
|
|
14
|
+
* dependency-free `node:http` server — no web framework — that adapts Node's
|
|
15
|
+
* request/response to the Web-standard `Request`/`Response` handlers so the
|
|
16
|
+
* handlers stay framework-agnostic and unit-testable.
|
|
17
|
+
*
|
|
18
|
+
* Wire your agent (any {@link AgentRuntimePort} implementation) into
|
|
19
|
+
* `createAgentCoreServer(agent)`; the inbound adapter never depends on a
|
|
20
|
+
* concrete agent.
|
|
21
|
+
*/
|
|
22
|
+
export const RUNTIME_PORT = Number(process.env.AGENTCORE_RUNTIME_PORT ?? 8080);
|
|
23
|
+
|
|
24
|
+
export function createAgentCoreServer(agent: AgentRuntimePort) {
|
|
25
|
+
const handleInvocation = createInvocationHandler(agent);
|
|
26
|
+
|
|
27
|
+
return createServer((req: IncomingMessage, res: ServerResponse) => {
|
|
28
|
+
void route(req, handleInvocation)
|
|
29
|
+
.then((response) => sendWebResponse(res, response))
|
|
30
|
+
.catch((err) => {
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
console.error("[agentcore] unhandled server error", err);
|
|
33
|
+
res.writeHead(500, { "content-type": "application/json" });
|
|
34
|
+
res.end(JSON.stringify({ error: "Internal server error" }));
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function route(
|
|
40
|
+
req: IncomingMessage,
|
|
41
|
+
handleInvocation: (request: Request) => Promise<Response>,
|
|
42
|
+
): Promise<Response> {
|
|
43
|
+
const method = req.method ?? "GET";
|
|
44
|
+
const url = req.url ?? "/";
|
|
45
|
+
|
|
46
|
+
if (method === "GET" && url === "/ping") {
|
|
47
|
+
return handlePing();
|
|
48
|
+
}
|
|
49
|
+
if (method === "POST" && url === "/invocations") {
|
|
50
|
+
return handleInvocation(await toWebRequest(req));
|
|
51
|
+
}
|
|
52
|
+
return new Response(JSON.stringify({ error: "Not found" }), {
|
|
53
|
+
status: 404,
|
|
54
|
+
headers: { "content-type": "application/json" },
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function toWebRequest(req: IncomingMessage): Promise<Request> {
|
|
59
|
+
// Buffer the whole body — AgentCore invocation envelopes are small JSON
|
|
60
|
+
// (prompt + metadata), so this is fine. If you ever accept large or binary
|
|
61
|
+
// uploads, stream `req` straight into the Request body instead of concatenating.
|
|
62
|
+
const chunks: Buffer[] = [];
|
|
63
|
+
for await (const chunk of req) {
|
|
64
|
+
chunks.push(chunk as Buffer);
|
|
65
|
+
}
|
|
66
|
+
const headers = new Headers();
|
|
67
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
68
|
+
if (Array.isArray(value)) headers.set(key, value.join(", "));
|
|
69
|
+
else if (value != null) headers.set(key, value);
|
|
70
|
+
}
|
|
71
|
+
return new Request(`http://localhost${req.url ?? "/"}`, {
|
|
72
|
+
method: req.method,
|
|
73
|
+
headers,
|
|
74
|
+
body: chunks.length ? Buffer.concat(chunks) : undefined,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function sendWebResponse(res: ServerResponse, response: Response): Promise<void> {
|
|
79
|
+
res.statusCode = response.status;
|
|
80
|
+
response.headers.forEach((value, key) => res.setHeader(key, value));
|
|
81
|
+
if (response.body) {
|
|
82
|
+
for await (const chunk of response.body as unknown as AsyncIterable<Uint8Array>) {
|
|
83
|
+
res.write(chunk);
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
const text = await response.text();
|
|
87
|
+
if (text) res.write(text);
|
|
88
|
+
}
|
|
89
|
+
res.end();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Start the runtime. Returns once the socket is listening. */
|
|
93
|
+
export function startAgentCoreServer(agent: AgentRuntimePort): Promise<void> {
|
|
94
|
+
const server = createAgentCoreServer(agent);
|
|
95
|
+
return new Promise((resolve) => {
|
|
96
|
+
server.listen(RUNTIME_PORT, "0.0.0.0", () => {
|
|
97
|
+
const addr = server.address() as AddressInfo | null;
|
|
98
|
+
// eslint-disable-next-line no-console
|
|
99
|
+
console.log(`[agentcore] runtime listening on :${addr?.port ?? RUNTIME_PORT}`);
|
|
100
|
+
resolve();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
// Container bootstrap. The Dockerfile's CMD runs this file directly.
|
|
107
|
+
//
|
|
108
|
+
// TODO(you): replace `placeholderAgent` with your real agent — e.g. construct
|
|
109
|
+
// your LangGraph graph / tool-calling loop and adapt it to AgentRuntimePort.
|
|
110
|
+
// If observability is installed, also wire the correlation seam here (see
|
|
111
|
+
// session.ts module docs).
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
const placeholderAgent: AgentRuntimePort = {
|
|
114
|
+
async run({ prompt }) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`AgentCore runtime is not wired yet. Implement AgentRuntimePort and pass it to ` +
|
|
117
|
+
`startAgentCoreServer() in src/infrastructure/agentcore/http/server.ts ` +
|
|
118
|
+
`(received prompt: ${JSON.stringify(prompt.slice(0, 40))}).`,
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// Run only when executed as the entrypoint, not when imported by tests.
|
|
124
|
+
// Compare both sides as resolved filesystem paths — `import.meta.url` is a
|
|
125
|
+
// (possibly percent-encoded) file:// URL while `process.argv[1]` is a path that
|
|
126
|
+
// is often relative under `npx tsx src/.../server.ts`, so concatenating a file://
|
|
127
|
+
// URL from argv[1] and string-comparing it would never match and the runtime
|
|
128
|
+
// would never bind.
|
|
129
|
+
const isMain =
|
|
130
|
+
process.argv[1] != null &&
|
|
131
|
+
fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
|
|
132
|
+
if (isMain) {
|
|
133
|
+
void startAgentCoreServer(placeholderAgent);
|
|
134
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AgentCore Runtime HTTP contract — request/response payloads.
|
|
5
|
+
*
|
|
6
|
+
* Bedrock AgentCore Runtime forwards the caller's JSON body verbatim to
|
|
7
|
+
* `POST /invocations` and expects a JSON (or SSE) response back. This module
|
|
8
|
+
* defines the *Hexagen* envelope that the invocation handler validates against,
|
|
9
|
+
* keeping the inbound adapter's surface explicit and parse-safe — the handler
|
|
10
|
+
* never trusts the raw body.
|
|
11
|
+
*/
|
|
12
|
+
export const invocationPayloadSchema = z.object({
|
|
13
|
+
/** End-user prompt / instruction for the agent. */
|
|
14
|
+
prompt: z.string().min(1, "prompt must not be empty"),
|
|
15
|
+
/**
|
|
16
|
+
* Opaque per-conversation id. AgentCore also supplies one via the runtime
|
|
17
|
+
* session header; the body value (when present) wins so callers can pin a
|
|
18
|
+
* conversation explicitly. See `readSessionId()`.
|
|
19
|
+
*/
|
|
20
|
+
sessionId: z.string().min(1).optional(),
|
|
21
|
+
/** Request a streamed (SSE) response instead of a single JSON envelope. */
|
|
22
|
+
stream: z.boolean().optional(),
|
|
23
|
+
/** Free-form caller context (tenant, locale, feature flags, …). */
|
|
24
|
+
metadata: z.record(z.unknown()).optional(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type InvocationPayload = z.infer<typeof invocationPayloadSchema>;
|
|
28
|
+
|
|
29
|
+
/** Success envelope returned to the AgentCore caller. */
|
|
30
|
+
export interface InvocationResponse {
|
|
31
|
+
readonly output: string;
|
|
32
|
+
readonly sessionId: string;
|
|
33
|
+
readonly metadata?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Error envelope — AgentCore surfaces the status code; `error` aids debugging. */
|
|
37
|
+
export interface InvocationErrorResponse {
|
|
38
|
+
readonly error: string;
|
|
39
|
+
readonly sessionId?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Application use-case the runtime drives. Implemented by your agent (e.g. a
|
|
44
|
+
* LangGraph graph, a tool-calling loop, a single LLM call) and injected into the
|
|
45
|
+
* server — the inbound HTTP adapter depends only on this port, never on a
|
|
46
|
+
* concrete agent. `runStream` is optional; when absent, `stream: true` requests
|
|
47
|
+
* fall back to a single `run()` result.
|
|
48
|
+
*/
|
|
49
|
+
export interface AgentRunInput {
|
|
50
|
+
readonly prompt: string;
|
|
51
|
+
readonly sessionId: string;
|
|
52
|
+
readonly metadata?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface AgentRunResult {
|
|
56
|
+
readonly output: string;
|
|
57
|
+
readonly metadata?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface AgentRuntimePort {
|
|
61
|
+
run(input: AgentRunInput): Promise<AgentRunResult>;
|
|
62
|
+
runStream?(input: AgentRunInput): AsyncIterable<string>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AgentCore Runtime session id + observability correlation.
|
|
5
|
+
*
|
|
6
|
+
* Bedrock AgentCore stamps every invocation with a runtime session id in the
|
|
7
|
+
* `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id` header so multi-turn calls map
|
|
8
|
+
* to one conversation. We surface it as the correlation id so that:
|
|
9
|
+
* - your application logs, and
|
|
10
|
+
* - AgentCore's built-in OTEL -> CloudWatch traces
|
|
11
|
+
* share a single id end-to-end.
|
|
12
|
+
*
|
|
13
|
+
* The observability template is a *soft* dependency, so this module must not
|
|
14
|
+
* import it (the file may not exist). Instead it exposes a seam: if
|
|
15
|
+
* observability is installed, register its context runner once at startup —
|
|
16
|
+
*
|
|
17
|
+
* import { setCorrelationSeeder } from "./infrastructure/agentcore/runtime/session";
|
|
18
|
+
* import { runWithContext } from "./infrastructure/observability/logging/context";
|
|
19
|
+
* setCorrelationSeeder((id, fn) => runWithContext({ requestId: id }, fn));
|
|
20
|
+
*
|
|
21
|
+
* Without that wiring, `withSession` is a transparent pass-through and the
|
|
22
|
+
* session id is still threaded explicitly to the agent via `AgentRunInput`.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** Canonical AgentCore runtime session header (case-insensitive on read). */
|
|
26
|
+
export const RUNTIME_SESSION_HEADER =
|
|
27
|
+
"x-amzn-bedrock-agentcore-runtime-session-id";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the conversation/correlation id for an invocation. An explicit
|
|
31
|
+
* `bodySessionId` (from the validated payload) wins; otherwise the runtime
|
|
32
|
+
* session header; otherwise a fresh uuid so every request is still traceable.
|
|
33
|
+
*/
|
|
34
|
+
export function readSessionId(
|
|
35
|
+
headers: Headers,
|
|
36
|
+
bodySessionId?: string,
|
|
37
|
+
): string {
|
|
38
|
+
if (bodySessionId) return bodySessionId;
|
|
39
|
+
return headers.get(RUNTIME_SESSION_HEADER) ?? randomUUID();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type CorrelationSeeder = <T>(correlationId: string, fn: () => T) => T;
|
|
43
|
+
|
|
44
|
+
// Default: no observability installed -> run the handler unchanged.
|
|
45
|
+
let seeder: CorrelationSeeder = (_correlationId, fn) => fn();
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Register the observability context runner (see module docs). Idempotent —
|
|
49
|
+
* the last registration wins, so call it once at startup.
|
|
50
|
+
*/
|
|
51
|
+
export function setCorrelationSeeder(next: CorrelationSeeder): void {
|
|
52
|
+
seeder = next;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Run `fn` inside the correlation context seeded from `sessionId`. */
|
|
56
|
+
export function withSession<T>(sessionId: string, fn: () => T): T {
|
|
57
|
+
return seeder(sessionId, fn);
|
|
58
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "bedrock-agentcore-runtime",
|
|
3
|
+
"name": "Bedrock AgentCore Runtime",
|
|
4
|
+
"description": "Deploy the Hexagen TypeScript server to Amazon Bedrock AgentCore Runtime as an ARM64 container implementing the HTTP contract (POST /invocations, GET /ping). Generates agentcore.json, an IAM execution policy, and an optional deploy GitHub Action — no Python agent scaffolding.",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"requires": ["docker", "env-setup"],
|
|
7
|
+
"conflicts": [],
|
|
8
|
+
"questions": [
|
|
9
|
+
{
|
|
10
|
+
"id": "aws_region",
|
|
11
|
+
"type": "select",
|
|
12
|
+
"prompt": "AWS region for AgentCore Runtime?",
|
|
13
|
+
"options": ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-2"],
|
|
14
|
+
"default": "us-west-2"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "agent_name",
|
|
18
|
+
"type": "text",
|
|
19
|
+
"prompt": "AgentCore agent name?",
|
|
20
|
+
"default": "hexagen-agent"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "protocol",
|
|
24
|
+
"type": "select",
|
|
25
|
+
"prompt": "Runtime protocol?",
|
|
26
|
+
"options": ["HTTP", "MCP", "A2A"],
|
|
27
|
+
"default": "HTTP"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "build_type",
|
|
31
|
+
"type": "select",
|
|
32
|
+
"prompt": "Build type? (Container is required for a TypeScript runtime)",
|
|
33
|
+
"options": ["Container", "CodeZip"],
|
|
34
|
+
"default": "Container"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "inbound_auth",
|
|
38
|
+
"type": "select",
|
|
39
|
+
"prompt": "Inbound auth on the runtime endpoint?",
|
|
40
|
+
"options": ["IAM", "OAuth"],
|
|
41
|
+
"default": "IAM"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "provision",
|
|
45
|
+
"type": "select",
|
|
46
|
+
"prompt": "How to provision the runtime?",
|
|
47
|
+
"options": ["agentcore-cli", "cdk", "none"],
|
|
48
|
+
"default": "agentcore-cli"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "deploy_ci",
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"prompt": "Generate a deploy GitHub Action (ARM64 build -> ECR -> create/update runtime)?",
|
|
54
|
+
"default": true
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"envVars": [],
|
|
58
|
+
"outputs": [
|
|
59
|
+
"Dockerfile.agentcore",
|
|
60
|
+
"src/infrastructure/agentcore/http/invocations.handler.ts",
|
|
61
|
+
"src/infrastructure/agentcore/http/ping.handler.ts",
|
|
62
|
+
"src/infrastructure/agentcore/http/server.ts",
|
|
63
|
+
"src/infrastructure/agentcore/runtime/payload.ts",
|
|
64
|
+
"src/infrastructure/agentcore/runtime/session.ts",
|
|
65
|
+
"agentcore/agentcore.json",
|
|
66
|
+
"agentcore/aws-targets.json",
|
|
67
|
+
"iam/agentcore-runtime-role.policy.json",
|
|
68
|
+
".env.agentcore.example",
|
|
69
|
+
{
|
|
70
|
+
"path": ".github/workflows/deploy-agentcore.yml",
|
|
71
|
+
"when": { "answer": "deploy_ci", "equals": true }
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "infra/agentcore-stack.ts",
|
|
75
|
+
"when": { "answer": "provision", "equals": "cdk" }
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"checklist": [
|
|
79
|
+
"Enable model access for your Bedrock model in the Bedrock console (per account, per region) — invocations fail with AccessDeniedException until you do",
|
|
80
|
+
"Wire your agent into the runtime: implement AgentRuntimePort (run / optional runStream) and pass it to createAgentCoreServer() in src/infrastructure/agentcore/http/server.ts",
|
|
81
|
+
"Build + smoke the HTTP contract locally: docker buildx build --platform linux/arm64 -f Dockerfile.agentcore -t agent . ; docker run -p 8080:8080 agent ; curl localhost:8080/ping",
|
|
82
|
+
"Provision: `agentcore deploy` (agentcore-cli) — or if you chose cdk, `cdk bootstrap` once then `cdk deploy` infra/agentcore-stack.ts",
|
|
83
|
+
"Attach iam/agentcore-runtime-role.policy.json to the runtime execution role (bedrock:InvokeModel/Converse, logs, bedrock-agentcore)",
|
|
84
|
+
"Invoke: `agentcore invoke --prompt \"hello\"` (or boto3/SDK InvokeAgentRuntime with the ARN), then copy AGENTCORE_RUNTIME_ARN from `agentcore status` into .env.local",
|
|
85
|
+
"If observability is installed, the handler seeds the correlation store from runtimeSessionId so app logs and AgentCore's OTEL->CloudWatch traces share one id (see session.ts)",
|
|
86
|
+
"If inbound_auth=OAuth, set AGENTCORE_OAUTH_DISCOVERY_URL / AGENTCORE_OAUTH_ALLOWED_AUDIENCE AND register a real verifier via setTokenVerifier() at startup — OAuth mode is fail-closed and rejects every call until you do; otherwise the runtime boundary is IAM (SigV4)"
|
|
87
|
+
],
|
|
88
|
+
"branch": "feature/generator-template-bedrock-agentcore-runtime"
|
|
89
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Bedrock AgentCore Services (`bedrock-agentcore-services`)
|
|
2
|
+
|
|
3
|
+
> Hexagonal ports + adapters for Amazon Bedrock AgentCore stateful services — Memory, Gateway
|
|
4
|
+
> (APIs/Lambdas/MCP as MCP tools), and Identity (workload token + IdP claim bridge to `UserContext`).
|
|
5
|
+
|
|
6
|
+
| | |
|
|
7
|
+
| ------------- | ------------------------------------------------------- |
|
|
8
|
+
| **ID** | `bedrock-agentcore-services` |
|
|
9
|
+
| **Category** | LLM / agents — stateful services |
|
|
10
|
+
| **Requires** | `env-setup` |
|
|
11
|
+
| **Conflicts** | none |
|
|
12
|
+
| **Branch** | `feature/generator-template-bedrock-agentcore-services` |
|
|
13
|
+
|
|
14
|
+
Author/agent-facing reference, beside `manifest.json` — not emitted into projects.
|
|
15
|
+
|
|
16
|
+
## What it does
|
|
17
|
+
|
|
18
|
+
Adds ports + adapters for AgentCore's stateful services, gated by which you enable:
|
|
19
|
+
|
|
20
|
+
- **Memory** — multi-turn + long-term recall (`SEMANTIC` / `SUMMARY` / `USER_PREFERENCE` strategies).
|
|
21
|
+
- **Gateway** — exposes APIs/Lambdas/MCP servers as MCP tools.
|
|
22
|
+
- **Identity** — bridges a workload token + IdP claims onto `UserContext`.
|
|
23
|
+
|
|
24
|
+
The application layer depends only on the ports; adapters sit behind them at the composition root.
|
|
25
|
+
|
|
26
|
+
## Service & API
|
|
27
|
+
|
|
28
|
+
- **SDK:** `@aws-sdk/client-bedrock-agentcore`. Ports: `AgentMemoryPort`, `ToolGatewayPort`,
|
|
29
|
+
`AgentIdentityPort` (each emitted only if its service is selected).
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
`hexagen add bedrock-agentcore-services`. Questions: `services` (multiselect:
|
|
34
|
+
memory/gateway/identity), `memory_mode`, `memory_strategies` (multiselect), `gateway_targets`
|
|
35
|
+
(`lambda`/`openapi`/`mcp`/`none`), `identity_idp` (`cognito`/`okta`/`entra`/`auth0`/`none`).
|
|
36
|
+
Emits the gated port/adapter sets under `src/{domain/ports/out,infrastructure/agentcore}/…` plus
|
|
37
|
+
`agentcore/agentcore-services.json`, `.env.agentcore-services.example`.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
// Wire each adapter behind its port at the composition root, e.g.:
|
|
43
|
+
import { AgentCoreMemoryAdapter } from "@/infrastructure/agentcore/memory/agentcore-memory.adapter";
|
|
44
|
+
const memory: AgentMemoryPort = new AgentCoreMemoryAdapter();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Notes for agents
|
|
48
|
+
|
|
49
|
+
- `npm install @aws-sdk/client-bedrock-agentcore` (the only channel — no manifest `deps`).
|
|
50
|
+
- Provision: `agentcore add memory --strategies …`, `agentcore add gateway`, then `agentcore deploy`;
|
|
51
|
+
copy `AGENTCORE_MEMORY_ID` / `AGENTCORE_GATEWAY_URL` / `AGENTCORE_WORKLOAD_IDENTITY_ARN` from `agentcore status`.
|
|
52
|
+
- **Merge** `agentcore-services.json` into the runtime's `agentcore.json` (this template doesn't overwrite it).
|
|
53
|
+
- The Gateway adapter is a minimal MCP-over-HTTP client — swap in `@modelcontextprotocol/sdk` for the
|
|
54
|
+
full handshake if needed.
|
|
55
|
+
- Identity: confirm `idp-bridge.ts` maps your IdP's claims onto `UserContext` (reuse an installed
|
|
56
|
+
auth provider's mapping if present).
|
|
57
|
+
|
|
58
|
+
## Checklist (post-install)
|
|
59
|
+
|
|
60
|
+
Install the SDK; provision the enabled resources; copy the ids; extend the runtime IAM policy;
|
|
61
|
+
merge the services JSON; wire adapters behind ports; run port-fake tests before live AWS.
|
|
62
|
+
|
|
63
|
+
## Related
|
|
64
|
+
|
|
65
|
+
Pairs with [`bedrock-agentcore-runtime`](../bedrock-agentcore-runtime). Requires [`env-setup`](../env-setup).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# --- Bedrock AgentCore Services ---
|
|
2
|
+
# Enabled services: {services}
|
|
3
|
+
# Copy into .env.local. Values are populated after `agentcore add ...` + `agentcore status`.
|
|
4
|
+
# Region is never hardcoded in adapters — it falls back AGENTCORE_REGION -> AWS_REGION -> SDK chain.
|
|
5
|
+
# AGENTCORE_REGION=
|
|
6
|
+
|
|
7
|
+
# AgentCore Memory (if 'memory' enabled)
|
|
8
|
+
AGENTCORE_MEMORY_ID=
|
|
9
|
+
AGENTCORE_MEMORY_NAMESPACE=default
|
|
10
|
+
|
|
11
|
+
# AgentCore Gateway (if 'gateway' enabled)
|
|
12
|
+
AGENTCORE_GATEWAY_URL=
|
|
13
|
+
AGENTCORE_GATEWAY_ID=
|
|
14
|
+
|
|
15
|
+
# AgentCore Identity (if 'identity' enabled)
|
|
16
|
+
# The adapter needs the workload *name*: set AGENTCORE_WORKLOAD_NAME, or leave it
|
|
17
|
+
# unset and it is derived from the final path segment of the ARN below.
|
|
18
|
+
AGENTCORE_WORKLOAD_NAME=
|
|
19
|
+
AGENTCORE_WORKLOAD_IDENTITY_ARN=
|
|
20
|
+
AGENTCORE_IDP_DISCOVERY_URL=
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "AgentCore service resource blocks for the services you enabled. This template does NOT overwrite agentcore/agentcore.json (created by bedrock-agentcore-runtime) — merge the relevant blocks below into it, or provision them with `agentcore add memory|gateway`. memory.strategies is a comma list because it derives from a multiselect answer.",
|
|
3
|
+
"memory": {
|
|
4
|
+
"namespace": "default",
|
|
5
|
+
"retention": "{memory_mode}",
|
|
6
|
+
"strategies": "{memory_strategies}"
|
|
7
|
+
},
|
|
8
|
+
"gateway": {
|
|
9
|
+
"targetSource": "{gateway_targets}"
|
|
10
|
+
},
|
|
11
|
+
"identity": {
|
|
12
|
+
"idp": "{identity_idp}"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/agent-identity.port.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outbound port for AgentCore Identity — the agent's own workload identity plus
|
|
3
|
+
* outbound credential exchange to third-party resources.
|
|
4
|
+
*
|
|
5
|
+
* Framework-neutral: returns domain credential shapes, never AWS SDK responses.
|
|
6
|
+
* Claim → {@link UserContext} mapping for inbound callers lives in `idp-bridge.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export interface WorkloadToken {
|
|
9
|
+
readonly token: string;
|
|
10
|
+
/** ISO-8601 expiry, when the provider returns one. */
|
|
11
|
+
readonly expiresAt?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface OutboundCredential {
|
|
15
|
+
readonly accessToken: string;
|
|
16
|
+
readonly expiresAt?: string;
|
|
17
|
+
/** Scopes actually granted for the exchanged credential. */
|
|
18
|
+
readonly scopes?: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AgentIdentityPort {
|
|
22
|
+
/** Fetch the agent's workload identity token (for calling AWS / the Gateway). */
|
|
23
|
+
getWorkloadToken(): Promise<WorkloadToken>;
|
|
24
|
+
/** Exchange the workload identity for an outbound credential to `resource`. */
|
|
25
|
+
exchangeForOutbound(resource: string): Promise<OutboundCredential>;
|
|
26
|
+
}
|
package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/agent-memory.port.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outbound port for agent memory — short-term (multi-turn) and long-term
|
|
3
|
+
* (cross-session) recall, keyed by the AgentCore runtime session id.
|
|
4
|
+
*
|
|
5
|
+
* Framework-neutral by design: it speaks domain shapes ({@link MemoryTurn} /
|
|
6
|
+
* {@link MemoryRecord}), never AWS SDK types. An agent use-case can therefore run
|
|
7
|
+
* against AgentCore Memory in production and an in-memory fake in tests without
|
|
8
|
+
* changing a line — the AWS translation lives entirely in the adapter.
|
|
9
|
+
*/
|
|
10
|
+
export interface MemoryTurn {
|
|
11
|
+
readonly role: "user" | "assistant";
|
|
12
|
+
readonly content: string;
|
|
13
|
+
/** ISO-8601; defaults to now when omitted by the caller. */
|
|
14
|
+
readonly timestamp?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface MemoryRecord {
|
|
18
|
+
readonly content: string;
|
|
19
|
+
/** Relevance score for semantic recall, when the backing strategy provides one. */
|
|
20
|
+
readonly score?: number;
|
|
21
|
+
/** Strategy that produced this record (e.g. "SEMANTIC", "SUMMARY"). */
|
|
22
|
+
readonly kind?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface MemoryPort {
|
|
26
|
+
/** Persist a conversation turn for the session (short- and long-term ingestion). */
|
|
27
|
+
store(sessionId: string, turn: MemoryTurn): Promise<void>;
|
|
28
|
+
/** Recall memory relevant to `query` for the session, best-first. */
|
|
29
|
+
retrieve(sessionId: string, query: string, limit?: number): Promise<MemoryRecord[]>;
|
|
30
|
+
}
|
package/dist/templates/bedrock-agentcore-services/files/src/domain/ports/out/tool-gateway.port.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outbound port for the AgentCore Gateway — exposes APIs, Lambdas, and MCP
|
|
3
|
+
* servers as a single set of MCP tools behind one endpoint.
|
|
4
|
+
*
|
|
5
|
+
* Framework-neutral: tools surface as {@link GatewayTool} domain shapes, not MCP
|
|
6
|
+
* wire types, so the agent's tool-calling layer (e.g. langgraph tool nodes) binds
|
|
7
|
+
* to this port and never to the MCP client.
|
|
8
|
+
*/
|
|
9
|
+
export interface GatewayTool {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
/** JSON-Schema for the tool's arguments, as advertised by the Gateway. */
|
|
13
|
+
readonly inputSchema?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ToolInvocationResult {
|
|
17
|
+
readonly content: string;
|
|
18
|
+
/** True when the tool reported a handled error (vs. a transport failure, which throws). */
|
|
19
|
+
readonly isError?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ToolGatewayPort {
|
|
23
|
+
/** Discover the tools currently published by the Gateway. */
|
|
24
|
+
listTools(): Promise<GatewayTool[]>;
|
|
25
|
+
/** Invoke a tool by name with JSON arguments. */
|
|
26
|
+
invokeTool(name: string, args: Record<string, unknown>): Promise<ToolInvocationResult>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// @hexagen-server-only
|
|
2
|
+
import type {
|
|
3
|
+
GatewayTool,
|
|
4
|
+
ToolGatewayPort,
|
|
5
|
+
ToolInvocationResult,
|
|
6
|
+
} from "../../../domain/ports/out/tool-gateway.port";
|
|
7
|
+
import {
|
|
8
|
+
toGatewayTool,
|
|
9
|
+
toInvocationResult,
|
|
10
|
+
type McpCallResult,
|
|
11
|
+
type McpToolDescriptor,
|
|
12
|
+
} from "./mcp-tool-mapper";
|
|
13
|
+
|
|
14
|
+
/** Async bearer-token provider — wire AgentIdentityPort.getWorkloadToken here. */
|
|
15
|
+
export type TokenProvider = () => Promise<string | undefined>;
|
|
16
|
+
|
|
17
|
+
interface JsonRpcResponse<T> {
|
|
18
|
+
result?: T;
|
|
19
|
+
error?: { code: number; message: string };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* AgentCore Gateway adapter — a minimal MCP-over-HTTP (Streamable HTTP) client
|
|
24
|
+
* implementing {@link ToolGatewayPort} with `fetch` and no extra dependencies.
|
|
25
|
+
*
|
|
26
|
+
* It issues plain JSON-RPC `tools/list` / `tools/call` POSTs and reads a JSON
|
|
27
|
+
* response. This is enough for Gateways that accept stateless calls; if yours
|
|
28
|
+
* requires the full MCP `initialize` handshake or SSE streaming, swap this for
|
|
29
|
+
* the official `@modelcontextprotocol/sdk` client behind the same port — the
|
|
30
|
+
* application layer won't change.
|
|
31
|
+
*/
|
|
32
|
+
export class AgentCoreGatewayAdapter implements ToolGatewayPort {
|
|
33
|
+
private readonly endpoint: string;
|
|
34
|
+
private readonly getToken?: TokenProvider;
|
|
35
|
+
private requestId = 0;
|
|
36
|
+
|
|
37
|
+
constructor(endpoint?: string, getToken?: TokenProvider) {
|
|
38
|
+
const resolved = endpoint ?? process.env.AGENTCORE_GATEWAY_URL;
|
|
39
|
+
if (!resolved) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
"AGENTCORE_GATEWAY_URL is not set — run `agentcore add gateway` then copy the url " +
|
|
42
|
+
"from `agentcore status` into .env.local.",
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
this.endpoint = resolved;
|
|
46
|
+
this.getToken = getToken;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async listTools(): Promise<GatewayTool[]> {
|
|
50
|
+
const result = await this.rpc<{ tools: McpToolDescriptor[] }>("tools/list", {});
|
|
51
|
+
return (result.tools ?? []).map(toGatewayTool);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async invokeTool(
|
|
55
|
+
name: string,
|
|
56
|
+
args: Record<string, unknown>,
|
|
57
|
+
): Promise<ToolInvocationResult> {
|
|
58
|
+
const result = await this.rpc<McpCallResult>("tools/call", {
|
|
59
|
+
name,
|
|
60
|
+
arguments: args,
|
|
61
|
+
});
|
|
62
|
+
return toInvocationResult(result);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private async rpc<T>(method: string, params: unknown): Promise<T> {
|
|
66
|
+
const headers: Record<string, string> = {
|
|
67
|
+
"content-type": "application/json",
|
|
68
|
+
// JSON-only: this minimal client reads a single JSON-RPC response and does
|
|
69
|
+
// not parse SSE frames. Requesting application/json keeps a Streamable-HTTP
|
|
70
|
+
// Gateway from replying with an event stream that response.json() can't
|
|
71
|
+
// parse. For streaming, swap in @modelcontextprotocol/sdk (see class docs).
|
|
72
|
+
accept: "application/json",
|
|
73
|
+
};
|
|
74
|
+
const token = await this.getToken?.();
|
|
75
|
+
if (token) headers.authorization = `Bearer ${token}`;
|
|
76
|
+
|
|
77
|
+
const response = await fetch(this.endpoint, {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers,
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
jsonrpc: "2.0",
|
|
82
|
+
id: ++this.requestId,
|
|
83
|
+
method,
|
|
84
|
+
params,
|
|
85
|
+
}),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (!response.ok) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
`AgentCore Gateway ${method} failed: ${response.status} ${response.statusText}`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const body = (await response.json()) as JsonRpcResponse<T>;
|
|
95
|
+
if (body.error) {
|
|
96
|
+
throw new Error(`AgentCore Gateway ${method} error: ${body.error.message}`);
|
|
97
|
+
}
|
|
98
|
+
if (body.result === undefined) {
|
|
99
|
+
throw new Error(`AgentCore Gateway ${method} returned no result`);
|
|
100
|
+
}
|
|
101
|
+
return body.result;
|
|
102
|
+
}
|
|
103
|
+
}
|