@aws/agentcore 0.3.0-preview.1.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.
Files changed (213) hide show
  1. package/LICENSE +175 -0
  2. package/README.md +147 -0
  3. package/dist/assets/README.md +79 -0
  4. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +2862 -0
  5. package/dist/assets/__tests__/assets.snapshot.test.ts +139 -0
  6. package/dist/assets/agents/AGENTS.md +102 -0
  7. package/dist/assets/cdk/.prettierrc +8 -0
  8. package/dist/assets/cdk/README.md +14 -0
  9. package/dist/assets/cdk/bin/cdk.ts +50 -0
  10. package/dist/assets/cdk/cdk.json +88 -0
  11. package/dist/assets/cdk/gitignore.template +9 -0
  12. package/dist/assets/cdk/jest.config.js +9 -0
  13. package/dist/assets/cdk/lib/cdk-stack.ts +38 -0
  14. package/dist/assets/cdk/npmignore.template +6 -0
  15. package/dist/assets/cdk/package.json +30 -0
  16. package/dist/assets/cdk/test/cdk.test.ts +16 -0
  17. package/dist/assets/cdk/tsconfig.json +28 -0
  18. package/dist/assets/mcp/python/README.md +27 -0
  19. package/dist/assets/mcp/python/pyproject.toml +22 -0
  20. package/dist/assets/mcp/python/server.py +117 -0
  21. package/dist/assets/mcp/python-lambda/README.md +22 -0
  22. package/dist/assets/mcp/python-lambda/handler.py +144 -0
  23. package/dist/assets/mcp/python-lambda/pyproject.toml +15 -0
  24. package/dist/assets/python/autogen/base/README.md +41 -0
  25. package/dist/assets/python/autogen/base/gitignore.template +40 -0
  26. package/dist/assets/python/autogen/base/main.py +52 -0
  27. package/dist/assets/python/autogen/base/mcp_client/client.py +18 -0
  28. package/dist/assets/python/autogen/base/model/load.py +136 -0
  29. package/dist/assets/python/autogen/base/pyproject.toml +35 -0
  30. package/dist/assets/python/crewai/base/README.md +41 -0
  31. package/dist/assets/python/crewai/base/gitignore.template +40 -0
  32. package/dist/assets/python/crewai/base/main.py +55 -0
  33. package/dist/assets/python/crewai/base/model/load.py +133 -0
  34. package/dist/assets/python/crewai/base/pyproject.toml +32 -0
  35. package/dist/assets/python/googleadk/base/README.md +39 -0
  36. package/dist/assets/python/googleadk/base/gitignore.template +40 -0
  37. package/dist/assets/python/googleadk/base/main.py +84 -0
  38. package/dist/assets/python/googleadk/base/mcp_client/client.py +15 -0
  39. package/dist/assets/python/googleadk/base/model/load.py +41 -0
  40. package/dist/assets/python/googleadk/base/pyproject.toml +21 -0
  41. package/dist/assets/python/langchain_langgraph/base/README.md +41 -0
  42. package/dist/assets/python/langchain_langgraph/base/gitignore.template +40 -0
  43. package/dist/assets/python/langchain_langgraph/base/main.py +51 -0
  44. package/dist/assets/python/langchain_langgraph/base/mcp_client/client.py +19 -0
  45. package/dist/assets/python/langchain_langgraph/base/model/load.py +123 -0
  46. package/dist/assets/python/langchain_langgraph/base/pyproject.toml +37 -0
  47. package/dist/assets/python/openaiagents/base/README.md +39 -0
  48. package/dist/assets/python/openaiagents/base/gitignore.template +40 -0
  49. package/dist/assets/python/openaiagents/base/main.py +56 -0
  50. package/dist/assets/python/openaiagents/base/mcp_client/client.py +14 -0
  51. package/dist/assets/python/openaiagents/base/model/load.py +37 -0
  52. package/dist/assets/python/openaiagents/base/pyproject.toml +20 -0
  53. package/dist/assets/python/strands/base/README.md +41 -0
  54. package/dist/assets/python/strands/base/gitignore.template +41 -0
  55. package/dist/assets/python/strands/base/main.py +76 -0
  56. package/dist/assets/python/strands/base/mcp_client/client.py +12 -0
  57. package/dist/assets/python/strands/base/model/load.py +123 -0
  58. package/dist/assets/python/strands/base/pyproject.toml +23 -0
  59. package/dist/assets/python/strands/capabilities/memory/session.py +39 -0
  60. package/dist/assets/typescript/.gitkeep +0 -0
  61. package/dist/cli/index.mjs +985 -0
  62. package/dist/index.d.ts +9 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +27 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/lib/constants.d.ts +25 -0
  67. package/dist/lib/constants.d.ts.map +1 -0
  68. package/dist/lib/constants.js +49 -0
  69. package/dist/lib/constants.js.map +1 -0
  70. package/dist/lib/errors/config.d.ts +49 -0
  71. package/dist/lib/errors/config.d.ts.map +1 -0
  72. package/dist/lib/errors/config.js +167 -0
  73. package/dist/lib/errors/config.js.map +1 -0
  74. package/dist/lib/errors/index.d.ts +2 -0
  75. package/dist/lib/errors/index.d.ts.map +1 -0
  76. package/dist/lib/errors/index.js +18 -0
  77. package/dist/lib/errors/index.js.map +1 -0
  78. package/dist/lib/index.d.ts +7 -0
  79. package/dist/lib/index.d.ts.map +1 -0
  80. package/dist/lib/index.js +39 -0
  81. package/dist/lib/index.js.map +1 -0
  82. package/dist/lib/packaging/errors.d.ts +16 -0
  83. package/dist/lib/packaging/errors.d.ts.map +1 -0
  84. package/dist/lib/packaging/errors.js +36 -0
  85. package/dist/lib/packaging/errors.js.map +1 -0
  86. package/dist/lib/packaging/helpers.d.ts +54 -0
  87. package/dist/lib/packaging/helpers.d.ts.map +1 -0
  88. package/dist/lib/packaging/helpers.js +461 -0
  89. package/dist/lib/packaging/helpers.js.map +1 -0
  90. package/dist/lib/packaging/index.d.ts +36 -0
  91. package/dist/lib/packaging/index.d.ts.map +1 -0
  92. package/dist/lib/packaging/index.js +89 -0
  93. package/dist/lib/packaging/index.js.map +1 -0
  94. package/dist/lib/packaging/node.d.ts +17 -0
  95. package/dist/lib/packaging/node.d.ts.map +1 -0
  96. package/dist/lib/packaging/node.js +108 -0
  97. package/dist/lib/packaging/node.js.map +1 -0
  98. package/dist/lib/packaging/python.d.ts +17 -0
  99. package/dist/lib/packaging/python.d.ts.map +1 -0
  100. package/dist/lib/packaging/python.js +162 -0
  101. package/dist/lib/packaging/python.js.map +1 -0
  102. package/dist/lib/packaging/types/index.d.ts +2 -0
  103. package/dist/lib/packaging/types/index.d.ts.map +1 -0
  104. package/dist/lib/packaging/types/index.js +3 -0
  105. package/dist/lib/packaging/types/index.js.map +1 -0
  106. package/dist/lib/packaging/types/packaging.d.ts +57 -0
  107. package/dist/lib/packaging/types/packaging.d.ts.map +1 -0
  108. package/dist/lib/packaging/types/packaging.js +3 -0
  109. package/dist/lib/packaging/types/packaging.js.map +1 -0
  110. package/dist/lib/packaging/uv.d.ts +7 -0
  111. package/dist/lib/packaging/uv.d.ts.map +1 -0
  112. package/dist/lib/packaging/uv.js +40 -0
  113. package/dist/lib/packaging/uv.js.map +1 -0
  114. package/dist/lib/schemas/io/config-io.d.ts +106 -0
  115. package/dist/lib/schemas/io/config-io.d.ts.map +1 -0
  116. package/dist/lib/schemas/io/config-io.js +293 -0
  117. package/dist/lib/schemas/io/config-io.js.map +1 -0
  118. package/dist/lib/schemas/io/index.d.ts +3 -0
  119. package/dist/lib/schemas/io/index.d.ts.map +1 -0
  120. package/dist/lib/schemas/io/index.js +17 -0
  121. package/dist/lib/schemas/io/index.js.map +1 -0
  122. package/dist/lib/schemas/io/path-resolver.d.ts +112 -0
  123. package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -0
  124. package/dist/lib/schemas/io/path-resolver.js +195 -0
  125. package/dist/lib/schemas/io/path-resolver.js.map +1 -0
  126. package/dist/lib/utils/aws-account.d.ts +7 -0
  127. package/dist/lib/utils/aws-account.d.ts.map +1 -0
  128. package/dist/lib/utils/aws-account.js +24 -0
  129. package/dist/lib/utils/aws-account.js.map +1 -0
  130. package/dist/lib/utils/credentials.d.ts +86 -0
  131. package/dist/lib/utils/credentials.d.ts.map +1 -0
  132. package/dist/lib/utils/credentials.js +153 -0
  133. package/dist/lib/utils/credentials.js.map +1 -0
  134. package/dist/lib/utils/env.d.ts +22 -0
  135. package/dist/lib/utils/env.d.ts.map +1 -0
  136. package/dist/lib/utils/env.js +65 -0
  137. package/dist/lib/utils/env.js.map +1 -0
  138. package/dist/lib/utils/index.d.ts +7 -0
  139. package/dist/lib/utils/index.d.ts.map +1 -0
  140. package/dist/lib/utils/index.js +23 -0
  141. package/dist/lib/utils/index.js.map +1 -0
  142. package/dist/lib/utils/platform.d.ts +63 -0
  143. package/dist/lib/utils/platform.d.ts.map +1 -0
  144. package/dist/lib/utils/platform.js +88 -0
  145. package/dist/lib/utils/platform.js.map +1 -0
  146. package/dist/lib/utils/subprocess.d.ts +29 -0
  147. package/dist/lib/utils/subprocess.d.ts.map +1 -0
  148. package/dist/lib/utils/subprocess.js +94 -0
  149. package/dist/lib/utils/subprocess.js.map +1 -0
  150. package/dist/lib/utils/zod.d.ts +14 -0
  151. package/dist/lib/utils/zod.d.ts.map +1 -0
  152. package/dist/lib/utils/zod.js +32 -0
  153. package/dist/lib/utils/zod.js.map +1 -0
  154. package/dist/schema/constants.d.ts +82 -0
  155. package/dist/schema/constants.d.ts.map +1 -0
  156. package/dist/schema/constants.js +117 -0
  157. package/dist/schema/constants.js.map +1 -0
  158. package/dist/schema/index.d.ts +4 -0
  159. package/dist/schema/index.d.ts.map +1 -0
  160. package/dist/schema/index.js +21 -0
  161. package/dist/schema/index.js.map +1 -0
  162. package/dist/schema/schemas/agent-env.d.ts +75 -0
  163. package/dist/schema/schemas/agent-env.d.ts.map +1 -0
  164. package/dist/schema/schemas/agent-env.js +84 -0
  165. package/dist/schema/schemas/agent-env.js.map +1 -0
  166. package/dist/schema/schemas/agentcore-project.d.ts +88 -0
  167. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -0
  168. package/dist/schema/schemas/agentcore-project.js +83 -0
  169. package/dist/schema/schemas/agentcore-project.js.map +1 -0
  170. package/dist/schema/schemas/aws-targets.d.ts +50 -0
  171. package/dist/schema/schemas/aws-targets.d.ts.map +1 -0
  172. package/dist/schema/schemas/aws-targets.js +49 -0
  173. package/dist/schema/schemas/aws-targets.js.map +1 -0
  174. package/dist/schema/schemas/deployed-state.d.ts +260 -0
  175. package/dist/schema/schemas/deployed-state.d.ts.map +1 -0
  176. package/dist/schema/schemas/deployed-state.js +100 -0
  177. package/dist/schema/schemas/deployed-state.js.map +1 -0
  178. package/dist/schema/schemas/index.d.ts +8 -0
  179. package/dist/schema/schemas/index.d.ts.map +1 -0
  180. package/dist/schema/schemas/index.js +25 -0
  181. package/dist/schema/schemas/index.js.map +1 -0
  182. package/dist/schema/schemas/mcp-defs.d.ts +52 -0
  183. package/dist/schema/schemas/mcp-defs.d.ts.map +1 -0
  184. package/dist/schema/schemas/mcp-defs.js +50 -0
  185. package/dist/schema/schemas/mcp-defs.js.map +1 -0
  186. package/dist/schema/schemas/mcp.d.ts +659 -0
  187. package/dist/schema/schemas/mcp.d.ts.map +1 -0
  188. package/dist/schema/schemas/mcp.js +283 -0
  189. package/dist/schema/schemas/mcp.js.map +1 -0
  190. package/dist/schema/schemas/primitives/index.d.ts +3 -0
  191. package/dist/schema/schemas/primitives/index.d.ts.map +1 -0
  192. package/dist/schema/schemas/primitives/index.js +9 -0
  193. package/dist/schema/schemas/primitives/index.js.map +1 -0
  194. package/dist/schema/schemas/primitives/memory.d.ts +42 -0
  195. package/dist/schema/schemas/primitives/memory.d.ts.map +1 -0
  196. package/dist/schema/schemas/primitives/memory.js +50 -0
  197. package/dist/schema/schemas/primitives/memory.js.map +1 -0
  198. package/dist/schema/schemas/zod-util.d.ts +10 -0
  199. package/dist/schema/schemas/zod-util.d.ts.map +1 -0
  200. package/dist/schema/schemas/zod-util.js +23 -0
  201. package/dist/schema/schemas/zod-util.js.map +1 -0
  202. package/dist/schema/types/index.d.ts +2 -0
  203. package/dist/schema/types/index.d.ts.map +1 -0
  204. package/dist/schema/types/index.js +18 -0
  205. package/dist/schema/types/index.js.map +1 -0
  206. package/dist/schema/types/path.d.ts +27 -0
  207. package/dist/schema/types/path.d.ts.map +1 -0
  208. package/dist/schema/types/path.js +13 -0
  209. package/dist/schema/types/path.js.map +1 -0
  210. package/package.json +111 -0
  211. package/scripts/bump-version.ts +442 -0
  212. package/scripts/check-old-cli.mjs +26 -0
  213. package/scripts/copy-assets.mjs +50 -0
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NodeCodeZipPackagerSync = exports.NodeCodeZipPackager = void 0;
4
+ const constants_1 = require("../constants");
5
+ const subprocess_1 = require("../utils/subprocess");
6
+ const errors_1 = require("./errors");
7
+ const helpers_1 = require("./helpers");
8
+ const path_1 = require("path");
9
+ const NODE_RUNTIME_REGEX = /NODE_(\d+)/;
10
+ /**
11
+ * Type guard to check if runtime version is a Node runtime
12
+ */
13
+ function isNodeRuntimeVersion(version) {
14
+ return (0, helpers_1.isNodeRuntime)(version);
15
+ }
16
+ /**
17
+ * Extracts Node version from runtime constant.
18
+ * Example: NODE_20 -> "20" (for use with node version checks)
19
+ */
20
+ function _extractNodeVersion(runtime) {
21
+ const match = NODE_RUNTIME_REGEX.exec(runtime);
22
+ if (!match) {
23
+ throw new errors_1.PackagingError(`Unsupported Node runtime value: ${runtime}`);
24
+ }
25
+ const [, major] = match;
26
+ if (!major) {
27
+ throw new errors_1.PackagingError(`Invalid Node runtime value: ${runtime}`);
28
+ }
29
+ return major;
30
+ }
31
+ /**
32
+ * Async Node/TypeScript packager for CLI usage.
33
+ */
34
+ class NodeCodeZipPackager {
35
+ async pack(spec, options = {}) {
36
+ if (spec.build !== 'CodeZip') {
37
+ throw new errors_1.PackagingError('Node packager only supports CodeZip build type.');
38
+ }
39
+ if (!isNodeRuntimeVersion(spec.runtimeVersion)) {
40
+ throw new errors_1.PackagingError(`Node packager only supports Node runtimes. Received: ${spec.runtimeVersion}`);
41
+ }
42
+ const agentName = options.agentName ?? spec.name;
43
+ const { projectRoot, srcDir, stagingDir, artifactsDir } = await (0, helpers_1.resolveProjectPaths)(options, agentName);
44
+ await (0, helpers_1.ensureBinaryAvailable)('npm', constants_1.NPM_INSTALL_HINT);
45
+ await (0, helpers_1.ensureDirClean)(stagingDir);
46
+ // Copy source files
47
+ await (0, helpers_1.copySourceTree)(srcDir, stagingDir);
48
+ // Install production dependencies
49
+ await this.installDependencies(projectRoot, stagingDir);
50
+ const artifactPath = options.outputPath ?? (0, path_1.join)(artifactsDir, (0, constants_1.getArtifactZipName)(agentName));
51
+ await (0, helpers_1.createZipFromDir)(stagingDir, artifactPath);
52
+ const sizeBytes = await (0, helpers_1.enforceZipSizeLimit)(artifactPath);
53
+ return {
54
+ artifactPath,
55
+ sizeBytes,
56
+ stagingPath: stagingDir,
57
+ };
58
+ }
59
+ async installDependencies(projectRoot, stagingDir) {
60
+ // Copy package.json to staging
61
+ const result = await (0, subprocess_1.runSubprocessCapture)('npm', ['install', '--omit=dev', '--prefix', stagingDir], {
62
+ cwd: projectRoot,
63
+ });
64
+ if (result.code !== 0) {
65
+ const combined = `${result.stdout}\n${result.stderr}`.trim();
66
+ throw new errors_1.PackagingError(combined.length > 0 ? combined : `npm install failed with exit code ${result.code}`);
67
+ }
68
+ }
69
+ }
70
+ exports.NodeCodeZipPackager = NodeCodeZipPackager;
71
+ /**
72
+ * Sync Node/TypeScript packager for CDK bundling.
73
+ */
74
+ class NodeCodeZipPackagerSync {
75
+ packCodeZip(config, options = {}) {
76
+ const runtimeVersion = config.runtimeVersion ?? 'NODE_20';
77
+ if (!isNodeRuntimeVersion(runtimeVersion)) {
78
+ throw new errors_1.PackagingError(`Node packager only supports Node runtimes. Received: ${runtimeVersion}`);
79
+ }
80
+ const agentName = options.agentName ?? config.name ?? 'asset';
81
+ const { projectRoot, srcDir, stagingDir, artifactsDir } = (0, helpers_1.resolveProjectPathsSync)(options, agentName);
82
+ (0, helpers_1.ensureBinaryAvailableSync)('npm', constants_1.NPM_INSTALL_HINT);
83
+ (0, helpers_1.ensureDirCleanSync)(stagingDir);
84
+ // Copy source files
85
+ (0, helpers_1.copySourceTreeSync)(srcDir, stagingDir);
86
+ // Install production dependencies
87
+ this.installDependenciesSync(projectRoot, stagingDir);
88
+ const artifactPath = options.outputPath ?? (0, path_1.join)(artifactsDir, (0, constants_1.getArtifactZipName)(agentName));
89
+ (0, helpers_1.createZipFromDirSync)(stagingDir, artifactPath);
90
+ const sizeBytes = (0, helpers_1.enforceZipSizeLimitSync)(artifactPath);
91
+ return {
92
+ artifactPath,
93
+ sizeBytes,
94
+ stagingPath: stagingDir,
95
+ };
96
+ }
97
+ installDependenciesSync(projectRoot, stagingDir) {
98
+ const result = (0, subprocess_1.runSubprocessCaptureSync)('npm', ['install', '--omit=dev', '--prefix', stagingDir], {
99
+ cwd: projectRoot,
100
+ });
101
+ if (result.code !== 0) {
102
+ const combined = `${result.stdout}\n${result.stderr}`.trim();
103
+ throw new errors_1.PackagingError(combined.length > 0 ? combined : `npm install failed with exit code ${result.code}`);
104
+ }
105
+ }
106
+ }
107
+ exports.NodeCodeZipPackagerSync = NodeCodeZipPackagerSync;
108
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/lib/packaging/node.ts"],"names":[],"mappings":";;;AACA,4CAAoE;AACpE,oDAAqF;AACrF,qCAA0C;AAC1C,uCAcmB;AAEnB,+BAA4B;AAE5B,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAExC;;GAEG;AACH,SAAS,oBAAoB,CAAC,OAAuB;IACnD,OAAO,IAAA,uBAAa,EAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,SAAS,mBAAmB,CAAC,OAAoB;IAC/C,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,uBAAc,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC;IACxB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,uBAAc,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAa,mBAAmB;IAC9B,KAAK,CAAC,IAAI,CAAC,IAAkB,EAAE,UAA0B,EAAE;QACzD,IAAI,IA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YAAY,EAAE,IAAA,8BAAkB,EAAC,SAAS,CAAC,CAAC,CAAC;QAC7F,IAAA,8BAAoB,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QAC/C,MAAM,SAAS,GAAG,IAAA,iCAAuB,EAAC,YAAY,CAAC,CAAC;QAExD,OAAO;YACL,YAAY;YACZ,SAAS;YACT,WAAW,EAAE,UAAU;SACxB,CAAC;IACJ,CAAC;IAEO,uBAAuB,CAAC,WAAmB,EAAE,UAAkB;QACrE,MAAM,MAAM,GAAG,IAAA,qCAAwB,EAAC,KAAK,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE;YAChG,GAAG,EAAE,WAAW;SACjB,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;YAC7D,MAAM,IAAI,uBAAc,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,qCAAqC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAChH,CAAC;IACH,CAAC;CACF;AAzCD,0DAyCC"}
@@ -0,0 +1,17 @@
1
+ import type { AgentEnvSpec } from '../../schema';
2
+ import type { ArtifactResult, CodeZipPackager, PackageOptions, RuntimePackager } from './types/packaging';
3
+ /**
4
+ * Async Python packager for CLI usage.
5
+ */
6
+ export declare class PythonCodeZipPackager implements RuntimePackager {
7
+ pack(spec: AgentEnvSpec, options?: PackageOptions): Promise<ArtifactResult>;
8
+ private installWithRetries;
9
+ }
10
+ /**
11
+ * Sync Python packager for CDK bundling.
12
+ */
13
+ export declare class PythonCodeZipPackagerSync implements CodeZipPackager {
14
+ packCodeZip(config: AgentEnvSpec, options?: PackageOptions): ArtifactResult;
15
+ private installWithRetriesSync;
16
+ }
17
+ //# sourceMappingURL=python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../src/lib/packaging/python.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAiC,MAAM,cAAc,CAAC;AAqBhF,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA+B1G;;GAEG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IACrD,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;YAuCvE,kBAAkB;CAsDjC;AAED;;GAEG;AACH,qBAAa,yBAA0B,YAAW,eAAe;IAC/D,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,GAAE,cAAmB,GAAG,cAAc;IAqC/E,OAAO,CAAC,sBAAsB;CAsD/B"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PythonCodeZipPackagerSync = exports.PythonCodeZipPackager = void 0;
4
+ const constants_1 = require("../constants");
5
+ const subprocess_1 = require("../utils/subprocess");
6
+ const errors_1 = require("./errors");
7
+ const helpers_1 = require("./helpers");
8
+ const uv_1 = require("./uv");
9
+ const path_1 = require("path");
10
+ const PYTHON_RUNTIME_REGEX = /PYTHON_(\d+)_?(\d+)?/;
11
+ /**
12
+ * Type guard to check if runtime version is a Python runtime
13
+ */
14
+ function isPythonRuntimeVersion(version) {
15
+ return (0, helpers_1.isPythonRuntime)(version);
16
+ }
17
+ // AC Runtime uses AL2023 with GLIBC 2.34, we can support any manylinux <= 2_34
18
+ const PLATFORM_CANDIDATES = ['aarch64-manylinux2014', 'aarch64-manylinux_2_28', 'aarch64-manylinux_2_34'];
19
+ /**
20
+ * Extracts Python version from runtime constant.
21
+ * Example: PYTHON_3_12 -> "3.12" (for use with uv --python-version)
22
+ */
23
+ function extractPythonVersion(runtime) {
24
+ const match = PYTHON_RUNTIME_REGEX.exec(runtime);
25
+ if (!match) {
26
+ throw new errors_1.PackagingError(`Unsupported Python runtime value: ${runtime}`);
27
+ }
28
+ const [, major, minor] = match;
29
+ if (!major || !minor) {
30
+ throw new errors_1.PackagingError(`Invalid Python runtime value: ${runtime}`);
31
+ }
32
+ return `${Number(major)}.${Number(minor)}`;
33
+ }
34
+ /**
35
+ * Async Python packager for CLI usage.
36
+ */
37
+ class PythonCodeZipPackager {
38
+ async pack(spec, options = {}) {
39
+ if (spec.build !== 'CodeZip') {
40
+ throw new errors_1.PackagingError('Python packager only supports CodeZip build type.');
41
+ }
42
+ if (!isPythonRuntimeVersion(spec.runtimeVersion)) {
43
+ throw new errors_1.PackagingError(`Python packager only supports Python runtimes. Received: ${spec.runtimeVersion}`);
44
+ }
45
+ const agentName = options.agentName ?? spec.name;
46
+ const { projectRoot, srcDir, stagingDir, artifactsDir, pyprojectPath } = await (0, helpers_1.resolveProjectPaths)(options, agentName);
47
+ const pythonPlatforms = options.pythonPlatform ? [options.pythonPlatform] : PLATFORM_CANDIDATES;
48
+ await (0, helpers_1.ensureBinaryAvailable)('uv', constants_1.UV_INSTALL_HINT);
49
+ await (0, helpers_1.ensureDirClean)(stagingDir);
50
+ const finalStaging = await this.installWithRetries(projectRoot, srcDir, stagingDir, spec.runtimeVersion, pythonPlatforms, pyprojectPath);
51
+ const artifactPath = options.outputPath ?? (0, path_1.join)(artifactsDir, (0, constants_1.getArtifactZipName)(agentName));
52
+ await (0, helpers_1.createZipFromDir)(finalStaging, artifactPath);
53
+ const sizeBytes = await (0, helpers_1.enforceZipSizeLimit)(artifactPath);
54
+ return {
55
+ artifactPath,
56
+ sizeBytes,
57
+ stagingPath: finalStaging,
58
+ };
59
+ }
60
+ async installWithRetries(projectRoot, srcDir, stagingDir, runtimeVersion, pythonPlatforms, pyprojectPath) {
61
+ const pythonVersion = extractPythonVersion(runtimeVersion);
62
+ for (const platform of pythonPlatforms) {
63
+ if (!platform) {
64
+ throw new errors_1.PackagingError('No platform candidate available for dependency installation.');
65
+ }
66
+ await (0, helpers_1.ensureDirClean)(stagingDir);
67
+ const result = await (0, subprocess_1.runSubprocessCapture)('uv', [
68
+ 'pip',
69
+ 'install',
70
+ '-r',
71
+ pyprojectPath,
72
+ '--target',
73
+ stagingDir,
74
+ '--python-version',
75
+ pythonVersion,
76
+ '--python-platform',
77
+ platform,
78
+ '--only-binary',
79
+ ':all:',
80
+ ], { cwd: projectRoot });
81
+ if (result.code === 0) {
82
+ await (0, helpers_1.copySourceTree)(srcDir, stagingDir);
83
+ await (0, helpers_1.convertWindowsScriptsToLinux)(stagingDir);
84
+ return stagingDir;
85
+ }
86
+ else {
87
+ const platformIssue = (0, uv_1.detectUnavailablePlatform)(result);
88
+ if (platformIssue) {
89
+ continue;
90
+ }
91
+ const combined = `${result.stdout}\n${result.stderr}`.trim();
92
+ throw new errors_1.PackagingError(combined.length > 0 ? combined : `uv install failed on platform ${platform} with exit code ${result.code}`);
93
+ }
94
+ }
95
+ throw new errors_1.PackagingError('uv install failed for all platform candidates.');
96
+ }
97
+ }
98
+ exports.PythonCodeZipPackager = PythonCodeZipPackager;
99
+ /**
100
+ * Sync Python packager for CDK bundling.
101
+ */
102
+ class PythonCodeZipPackagerSync {
103
+ packCodeZip(config, options = {}) {
104
+ const runtimeVersion = config.runtimeVersion ?? 'PYTHON_3_12';
105
+ if (!isPythonRuntimeVersion(runtimeVersion)) {
106
+ throw new errors_1.PackagingError(`Python packager only supports Python runtimes. Received: ${runtimeVersion}`);
107
+ }
108
+ const agentName = options.agentName ?? config.name ?? 'asset';
109
+ const { projectRoot, srcDir, stagingDir, artifactsDir, pyprojectPath } = (0, helpers_1.resolveProjectPathsSync)(options, agentName);
110
+ const pythonPlatforms = options.pythonPlatform ? [options.pythonPlatform] : PLATFORM_CANDIDATES;
111
+ (0, helpers_1.ensureBinaryAvailableSync)('uv', constants_1.UV_INSTALL_HINT);
112
+ (0, helpers_1.ensureDirCleanSync)(stagingDir);
113
+ const finalStaging = this.installWithRetriesSync(projectRoot, srcDir, stagingDir, runtimeVersion, pythonPlatforms, pyprojectPath);
114
+ const artifactPath = options.outputPath ?? (0, path_1.join)(artifactsDir, (0, constants_1.getArtifactZipName)(agentName));
115
+ (0, helpers_1.createZipFromDirSync)(finalStaging, artifactPath);
116
+ const sizeBytes = (0, helpers_1.enforceZipSizeLimitSync)(artifactPath);
117
+ return {
118
+ artifactPath,
119
+ sizeBytes,
120
+ stagingPath: finalStaging,
121
+ };
122
+ }
123
+ installWithRetriesSync(projectRoot, srcDir, stagingDir, runtimeVersion, pythonPlatforms, pyprojectPath) {
124
+ const pythonVersion = extractPythonVersion(runtimeVersion);
125
+ for (const platform of pythonPlatforms) {
126
+ if (!platform) {
127
+ throw new errors_1.PackagingError('No platform candidate available for dependency installation.');
128
+ }
129
+ (0, helpers_1.ensureDirCleanSync)(stagingDir);
130
+ const result = (0, subprocess_1.runSubprocessCaptureSync)('uv', [
131
+ 'pip',
132
+ 'install',
133
+ '-r',
134
+ pyprojectPath,
135
+ '--target',
136
+ stagingDir,
137
+ '--python-version',
138
+ pythonVersion,
139
+ '--python-platform',
140
+ platform,
141
+ '--only-binary',
142
+ ':all:',
143
+ ], { cwd: projectRoot });
144
+ if (result.code === 0) {
145
+ (0, helpers_1.copySourceTreeSync)(srcDir, stagingDir);
146
+ (0, helpers_1.convertWindowsScriptsToLinuxSync)(stagingDir);
147
+ return stagingDir;
148
+ }
149
+ else {
150
+ const platformIssue = (0, uv_1.detectUnavailablePlatform)(result);
151
+ if (platformIssue) {
152
+ continue;
153
+ }
154
+ const combined = `${result.stdout}\n${result.stderr}`.trim();
155
+ throw new errors_1.PackagingError(combined.length > 0 ? combined : `uv install failed on platform ${platform} with exit code ${result.code}`);
156
+ }
157
+ }
158
+ throw new errors_1.PackagingError('uv install failed for all platform candidates.');
159
+ }
160
+ }
161
+ exports.PythonCodeZipPackagerSync = PythonCodeZipPackagerSync;
162
+ //# sourceMappingURL=python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.js","sourceRoot":"","sources":["../../../src/lib/packaging/python.ts"],"names":[],"mappings":";;;AACA,4CAAmE;AACnE,oDAAqF;AACrF,qCAA0C;AAC1C,uCAgBmB;AAEnB,6BAAiD;AACjD,+BAA4B;AAE5B,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD;;GAEG;AACH,SAAS,sBAAsB,CAAC,OAAuB;IACrD,OAAO,IAAA,yBAAe,EAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AACD,+EAA+E;AAC/E,MAAM,mBAAmB,GAAG,CAAC,uBAAuB,EAAE,wBAAwB,EAAE,wBAAwB,CAAC,CAAC;AAE1G;;;GAGG;AACH,SAAS,oBAAoB,CAAC,OAAsB;IAClD,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,uBAAc,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC;IAC/B,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,IAAI,uBAAc,CAAC,iCAAiC,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAa,qBAAqB;IAChC,KAAK,CAAC,IAAI,CAAC,IAAkB,EAAE,UAA0B,EAAE;QACzD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,IAAI,uBAAc,CAAC,mDAAmD,CAAC,CAAC;QAChF,CAAC;QAED,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,cAA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ipPackager, PackageOptions, RuntimePackager } from './packaging';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/packaging/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/packaging/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,57 @@
1
+ import type { AgentEnvSpec, RuntimeVersion } from '../../../schema';
2
+ export interface PackageOptions {
3
+ /** Optional override for project root; defaults to cwd or discovered root. */
4
+ projectRoot?: string;
5
+ /** Optional override for source directory; defaults to <projectRoot>/src. */
6
+ srcDir?: string;
7
+ /** Optional override for pyproject path; defaults to <projectRoot>/pyproject.toml (Python) or package.json (Node). */
8
+ pyprojectPath?: string;
9
+ /** Optional override for artifact base directory; defaults to <projectRoot>/.agentcore. */
10
+ artifactDir?: string;
11
+ /** Optional override for python platform tag; defaults to aarch64-manylinux2014. Only used for Python. */
12
+ pythonPlatform?: string;
13
+ /** Agent name for artifact naming and staging isolation. */
14
+ agentName?: string;
15
+ /** Output path for the zip artifact. If provided, writes directly here. */
16
+ outputPath?: string;
17
+ }
18
+ export interface ArtifactResult {
19
+ artifactPath: string;
20
+ sizeBytes: number;
21
+ stagingPath: string;
22
+ }
23
+ /**
24
+ * Common interface for code bundling.
25
+ * Both AgentEnvSpec and runtime configs satisfy this interface.
26
+ */
27
+ export interface CodeBundleConfig {
28
+ name: string;
29
+ codeLocation: string;
30
+ entrypoint: string;
31
+ runtimeVersion?: RuntimeVersion;
32
+ }
33
+ /**
34
+ * Async packager interface for CLI usage.
35
+ */
36
+ export interface RuntimePackager {
37
+ /**
38
+ * Package code for a runtime asynchronously.
39
+ * @param spec The agent environment spec
40
+ * @param options Packaging options
41
+ * @returns Promise of ArtifactResult with the path to the created zip
42
+ */
43
+ pack(spec: AgentEnvSpec, options?: PackageOptions): Promise<ArtifactResult>;
44
+ }
45
+ /**
46
+ * Sync packager interface for CDK bundling constructs.
47
+ */
48
+ export interface CodeZipPackager {
49
+ /**
50
+ * Package code for a CodeZip runtime synchronously.
51
+ * @param config The code bundle configuration (AgentEnvSpec or compatible)
52
+ * @param options Packaging options
53
+ * @returns ArtifactResult with the path to the created zip
54
+ */
55
+ packCodeZip(config: CodeBundleConfig | AgentEnvSpec, options?: PackageOptions): ArtifactResult;
56
+ }
57
+ //# sourceMappingURL=packaging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packaging.d.ts","sourceRoot":"","sources":["../../../../src/lib/packaging/types/packaging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sHAAsH;IACtH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0GAA0G;IAC1G,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC7E;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC;CAChG"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=packaging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packaging.js","sourceRoot":"","sources":["../../../../src/lib/packaging/types/packaging.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { SubprocessResult } from '../utils/subprocess';
2
+ export interface PlatformIssue {
3
+ message: string;
4
+ platforms?: string[];
5
+ }
6
+ export declare function detectUnavailablePlatform(result: SubprocessResult): PlatformIssue | null;
7
+ //# sourceMappingURL=uv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uv.d.ts","sourceRoot":"","sources":["../../../src/lib/packaging/uv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAMD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,GAAG,IAAI,CAoBxF"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detectUnavailablePlatform = detectUnavailablePlatform;
4
+ const PLATFORM_HINT_REGEX = /platforms:\s*([^\n]+)/i;
5
+ const MANYLINUX_TOKEN = /(manylinux[^\s,]+)/gi;
6
+ const NO_WHEELS_REGEX = /(has no wheels with a matching platform tag|no compatible (?:wheels|tags) found)/i;
7
+ function detectUnavailablePlatform(result) {
8
+ const combined = `${result.stdout}\n${result.stderr}`;
9
+ const hintMatch = PLATFORM_HINT_REGEX.exec(combined);
10
+ if (hintMatch?.[1]) {
11
+ const hints = Array.from(hintMatch[1].matchAll(MANYLINUX_TOKEN))
12
+ .map(match => match[1])
13
+ .filter((value) => Boolean(value));
14
+ if (hints.length > 0) {
15
+ return {
16
+ message: extractRelevantBlock(combined, PLATFORM_HINT_REGEX),
17
+ platforms: hints,
18
+ };
19
+ }
20
+ }
21
+ if (NO_WHEELS_REGEX.test(combined)) {
22
+ return { message: extractRelevantBlock(combined, NO_WHEELS_REGEX) };
23
+ }
24
+ return null;
25
+ }
26
+ function extractRelevantBlock(text, pattern, context = 3) {
27
+ const lines = text.split(/\r?\n/);
28
+ const index = lines.findIndex(line => pattern.test(line));
29
+ if (index === -1) {
30
+ return text.trim();
31
+ }
32
+ const start = Math.max(0, index - context);
33
+ const end = Math.min(lines.length, index + context + 1);
34
+ return lines
35
+ .slice(start, end)
36
+ .map(line => line.trim())
37
+ .join('\n')
38
+ .trim();
39
+ }
40
+ //# sourceMappingURL=uv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uv.js","sourceRoot":"","sources":["../../../src/lib/packaging/uv.ts"],"names":[],"mappings":";;AAWA,8DAoBC;AAxBD,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AACrD,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAC/C,MAAM,eAAe,GAAG,mFAAmF,CAAC;AAE5G,SAAgB,yBAAyB,CAAC,MAAwB;IAChE,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;IACtD,MAA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AI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;IACxD,OAAO,KAAK;SACT,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC;SACjB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SACxB,IAAI,CAAC,IAAI,CAAC;SACV,IAAI,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,106 @@
1
+ import type { AgentCoreCliMcpDefs, AgentCoreMcpSpec, AgentCoreProjectSpec, AwsDeploymentTarget, DeployedState } from '../../../schema';
2
+ import { type PathConfig, PathResolver } from './path-resolver';
3
+ /**
4
+ * Manages reading, writing, and validation of AgentCore configuration files
5
+ */
6
+ export declare class ConfigIO {
7
+ private readonly pathResolver;
8
+ private readonly projectDiscovered;
9
+ /**
10
+ * Create a ConfigIO instance.
11
+ * If no baseDir is provided, automatically discovers the project using findConfigRoot().
12
+ */
13
+ constructor(pathConfig?: Partial<PathConfig>);
14
+ /**
15
+ * Check if this ConfigIO is associated with a discovered or explicitly configured project.
16
+ * Returns false if no baseDir was provided and no project was found via auto-discovery.
17
+ */
18
+ hasProject(): boolean;
19
+ /**
20
+ * Get the current path resolver
21
+ */
22
+ getPathResolver(): PathResolver;
23
+ /**
24
+ * Update the base directory for config files
25
+ */
26
+ setBaseDir(baseDir: string): void;
27
+ /**
28
+ * Get the project root directory (parent of agentcore/)
29
+ */
30
+ getProjectRoot(): string;
31
+ /**
32
+ * Get the config root directory (the agentcore/ directory)
33
+ */
34
+ getConfigRoot(): string;
35
+ /**
36
+ * Read and validate the project configuration.
37
+ */
38
+ readProjectSpec(): Promise<AgentCoreProjectSpec>;
39
+ /**
40
+ * Write and validate the project configuration file.
41
+ */
42
+ writeProjectSpec(data: AgentCoreProjectSpec): Promise<void>;
43
+ /**
44
+ * Read and validate the AWS configuration file.
45
+ * Applies overrides following AWS SDK precedence:
46
+ * - Account: from current credentials if AWS_PROFILE is set
47
+ * - Region: AWS_REGION > AWS_DEFAULT_REGION > profile config > saved value
48
+ */
49
+ readAWSDeploymentTargets(): Promise<AwsDeploymentTarget[]>;
50
+ /**
51
+ * Write and validate the AWS configuration file
52
+ */
53
+ writeAWSDeploymentTargets(data: AwsDeploymentTarget[]): Promise<void>;
54
+ /**
55
+ * Read and validate the deployed state file.
56
+ * Validates that all target keys exist in aws-targets.
57
+ */
58
+ readDeployedState(): Promise<DeployedState>;
59
+ /**
60
+ * Write and validate the deployed state file.
61
+ * Validates that all target keys exist in aws-targets.
62
+ */
63
+ writeDeployedState(data: DeployedState): Promise<void>;
64
+ /**
65
+ * Read and validate the MCP configuration file
66
+ */
67
+ readMcpSpec(): Promise<AgentCoreMcpSpec>;
68
+ /**
69
+ * Write and validate the MCP configuration file
70
+ */
71
+ writeMcpSpec(data: AgentCoreMcpSpec): Promise<void>;
72
+ /**
73
+ * Read and validate the MCP definitions file
74
+ */
75
+ readMcpDefs(): Promise<AgentCoreCliMcpDefs>;
76
+ /**
77
+ * Write and validate the MCP definitions file
78
+ */
79
+ writeMcpDefs(data: AgentCoreCliMcpDefs): Promise<void>;
80
+ /**
81
+ * Check if the base directory exists
82
+ */
83
+ baseDirExists(): boolean;
84
+ /**
85
+ * Check if a specific config file exists
86
+ */
87
+ configExists(type: 'project' | 'awsTargets' | 'state' | 'mcp' | 'mcpDefs'): boolean;
88
+ /**
89
+ * Initialize the base directory and CLI system subdirectory.
90
+ * Requires that a baseDir was explicitly provided or a project was discovered.
91
+ */
92
+ initializeBaseDir(): Promise<void>;
93
+ /**
94
+ * Generic read and validate method
95
+ */
96
+ private readAndValidate;
97
+ /**
98
+ * Generic validate and write method
99
+ */
100
+ private validateAndWrite;
101
+ }
102
+ /**
103
+ * Create a new ConfigIO instance
104
+ */
105
+ export declare function createConfigIO(pathConfig?: Partial<PathConfig>): ConfigIO;
106
+ //# sourceMappingURL=config-io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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