@aws/agentcore 0.3.0-preview.2.0 → 0.3.0-preview.2.1

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 (24) hide show
  1. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +71 -75
  2. package/dist/assets/container/python/Dockerfile +12 -8
  3. package/dist/assets/container/python/dockerignore.template +7 -0
  4. package/dist/assets/python/autogen/base/README.md +9 -11
  5. package/dist/assets/python/autogen/base/mcp_client/__init__.py +1 -1
  6. package/dist/assets/python/autogen/base/model/__init__.py +1 -1
  7. package/dist/assets/python/crewai/base/README.md +9 -11
  8. package/dist/assets/python/crewai/base/model/__init__.py +1 -1
  9. package/dist/assets/python/googleadk/base/README.md +9 -9
  10. package/dist/assets/python/googleadk/base/mcp_client/__init__.py +1 -1
  11. package/dist/assets/python/googleadk/base/model/__init__.py +1 -1
  12. package/dist/assets/python/langchain_langgraph/base/README.md +9 -11
  13. package/dist/assets/python/langchain_langgraph/base/mcp_client/__init__.py +1 -1
  14. package/dist/assets/python/langchain_langgraph/base/model/__init__.py +1 -1
  15. package/dist/assets/python/openaiagents/base/README.md +9 -9
  16. package/dist/assets/python/openaiagents/base/mcp_client/__init__.py +1 -1
  17. package/dist/assets/python/openaiagents/base/model/__init__.py +1 -1
  18. package/dist/assets/python/strands/base/README.md +9 -11
  19. package/dist/assets/python/strands/base/mcp_client/__init__.py +1 -1
  20. package/dist/assets/python/strands/base/model/__init__.py +1 -1
  21. package/dist/assets/python/strands/base/pyproject.toml +2 -1
  22. package/dist/assets/python/strands/capabilities/memory/__init__.py +1 -0
  23. package/dist/cli/index.mjs +1 -1
  24. package/package.json +2 -8
@@ -792,25 +792,23 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/au
792
792
 
793
793
  # Layout
794
794
 
795
- There is one directory with generated application code, \`src/\` . At the root, there is a \`.gitignore\` file, a
796
- \`.agentcore\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
795
+ The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
796
+ \`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
797
797
  commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
798
798
 
799
- ## src/
799
+ ## Agent Root
800
800
 
801
- The main entrypoint to your app is defined in \`src/main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
801
+ The main entrypoint to your app is defined in \`main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
802
802
  file defines a Starlette ASGI app with the AutoGen framework running within.
803
803
 
804
- \`src/model/load.py\` instantiates your chosen model provider.
804
+ \`model/load.py\` instantiates your chosen model provider.
805
805
 
806
806
  ## Environment Variables
807
807
 
808
- | Variable | Required | Description |
809
- | ------------------------------ | --------------- | ---------------------------------------------------------------- |
810
- | \`AGENTCORE_IDENTITY_OPENAI\` | Yes (OpenAI) | OpenAI API key (local) or Identity provider name (deployed) |
811
- | \`AGENTCORE_IDENTITY_ANTHROPIC\` | Yes (Anthropic) | Anthropic API key (local) or Identity provider name (deployed) |
812
- | \`AGENTCORE_IDENTITY_GEMINI\` | Yes (Gemini) | Gemini API key (local) or Identity provider name (deployed) |
813
- | \`LOCAL_DEV\` | No | Set to \`1\` to use \`agentcore/.env\` instead of AgentCore Identity |
808
+ | Variable | Required | Description |
809
+ | --- | --- | --- |
810
+ {{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
811
+ {{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
814
812
 
815
813
  # Developing locally
816
814
 
@@ -934,7 +932,7 @@ if __name__ == "__main__":
934
932
  `;
935
933
 
936
934
  exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/mcp_client/__init__.py should match snapshot 1`] = `
937
- "
935
+ "# Package marker
938
936
  "
939
937
  `;
940
938
 
@@ -961,7 +959,7 @@ async def get_streamable_http_mcp_tools() -> List[StreamableHttpMcpToolAdapter]:
961
959
  `;
962
960
 
963
961
  exports[`Assets Directory Snapshots > Python framework assets > python/python/autogen/base/model/__init__.py should match snapshot 1`] = `
964
- "
962
+ "# Package marker
965
963
  "
966
964
  `;
967
965
 
@@ -1148,25 +1146,23 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/cr
1148
1146
 
1149
1147
  # Layout
1150
1148
 
1151
- There is one directory with generated application code, \`src/\` . At the root, there is a \`.gitignore\` file, a
1152
- \`.agentcore\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
1149
+ The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
1150
+ \`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
1153
1151
  commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
1154
1152
 
1155
- ## src/
1153
+ ## Agent Root
1156
1154
 
1157
- The main entrypoint to your app is defined in \`src/main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
1155
+ The main entrypoint to your app is defined in \`main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
1158
1156
  file defines a Starlette ASGI app with the CrewAI framework running within.
1159
1157
 
1160
- \`src/model/load.py\` instantiates your chosen model provider.
1158
+ \`model/load.py\` instantiates your chosen model provider.
1161
1159
 
1162
1160
  ## Environment Variables
1163
1161
 
1164
- | Variable | Required | Description |
1165
- | ------------------------------ | --------------- | ---------------------------------------------------------------- |
1166
- | \`AGENTCORE_IDENTITY_OPENAI\` | Yes (OpenAI) | OpenAI API key (local) or Identity provider name (deployed) |
1167
- | \`AGENTCORE_IDENTITY_ANTHROPIC\` | Yes (Anthropic) | Anthropic API key (local) or Identity provider name (deployed) |
1168
- | \`AGENTCORE_IDENTITY_GEMINI\` | Yes (Gemini) | Gemini API key (local) or Identity provider name (deployed) |
1169
- | \`LOCAL_DEV\` | No | Set to \`1\` to use \`agentcore/.env\` instead of AgentCore Identity |
1162
+ | Variable | Required | Description |
1163
+ | --- | --- | --- |
1164
+ {{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
1165
+ {{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
1170
1166
 
1171
1167
  # Developing locally
1172
1168
 
@@ -1293,7 +1289,7 @@ if __name__ == "__main__":
1293
1289
  `;
1294
1290
 
1295
1291
  exports[`Assets Directory Snapshots > Python framework assets > python/python/crewai/base/model/__init__.py should match snapshot 1`] = `
1296
- "
1292
+ "# Package marker
1297
1293
  "
1298
1294
  `;
1299
1295
 
@@ -1474,23 +1470,23 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/go
1474
1470
 
1475
1471
  # Layout
1476
1472
 
1477
- There is one directory with generated application code, \`src/\` . At the root, there is a \`.gitignore\` file, a
1478
- \`.agentcore\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
1473
+ The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
1474
+ \`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
1479
1475
  commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
1480
1476
 
1481
- ## src/
1477
+ ## Agent Root
1482
1478
 
1483
- The main entrypoint to your app is defined in \`src/main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
1479
+ The main entrypoint to your app is defined in \`main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
1484
1480
  file defines a Starlette ASGI app with the Google ADK framework running within.
1485
1481
 
1486
- \`src/model/load.py\` instantiates your chosen model provider (Gemini).
1482
+ \`model/load.py\` instantiates your chosen model provider (Gemini).
1487
1483
 
1488
1484
  ## Environment Variables
1489
1485
 
1490
- | Variable | Required | Description |
1491
- | --------------------------- | -------- | ---------------------------------------------------------------- |
1492
- | \`AGENTCORE_IDENTITY_GEMINI\` | Yes | Gemini API key (local) or Identity provider name (deployed) |
1493
- | \`LOCAL_DEV\` | No | Set to \`1\` to use \`agentcore/.env\` instead of AgentCore Identity |
1486
+ | Variable | Required | Description |
1487
+ | --- | --- | --- |
1488
+ {{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
1489
+ {{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
1494
1490
 
1495
1491
  # Developing locally
1496
1492
 
@@ -1653,7 +1649,7 @@ if __name__ == "__main__":
1653
1649
  `;
1654
1650
 
1655
1651
  exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/mcp_client/__init__.py should match snapshot 1`] = `
1656
- "
1652
+ "# Package marker
1657
1653
  "
1658
1654
  `;
1659
1655
 
@@ -1677,7 +1673,7 @@ def get_streamable_http_mcp_client() -> MCPToolset:
1677
1673
  `;
1678
1674
 
1679
1675
  exports[`Assets Directory Snapshots > Python framework assets > python/python/googleadk/base/model/__init__.py should match snapshot 1`] = `
1680
- "
1676
+ "# Package marker
1681
1677
  "
1682
1678
  `;
1683
1679
 
@@ -1755,25 +1751,23 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/la
1755
1751
 
1756
1752
  # Layout
1757
1753
 
1758
- There is one directory with generated application code, \`src/\` . At the root, there is a \`.gitignore\` file, a
1759
- \`.agentcore\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
1754
+ The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
1755
+ \`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
1760
1756
  commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
1761
1757
 
1762
- ## src/
1758
+ ## Agent Root
1763
1759
 
1764
- The main entrypoint to your app is defined in \`src/main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
1760
+ The main entrypoint to your app is defined in \`main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
1765
1761
  file defines a Starlette ASGI app with the LangChain/LangGraph framework running within.
1766
1762
 
1767
- \`src/model/load.py\` instantiates your chosen model provider.
1763
+ \`model/load.py\` instantiates your chosen model provider.
1768
1764
 
1769
1765
  ## Environment Variables
1770
1766
 
1771
- | Variable | Required | Description |
1772
- | ------------------------------ | --------------- | ---------------------------------------------------------------- |
1773
- | \`AGENTCORE_IDENTITY_OPENAI\` | Yes (OpenAI) | OpenAI API key (local) or Identity provider name (deployed) |
1774
- | \`AGENTCORE_IDENTITY_ANTHROPIC\` | Yes (Anthropic) | Anthropic API key (local) or Identity provider name (deployed) |
1775
- | \`AGENTCORE_IDENTITY_GEMINI\` | Yes (Gemini) | Gemini API key (local) or Identity provider name (deployed) |
1776
- | \`LOCAL_DEV\` | No | Set to \`1\` to use \`agentcore/.env\` instead of AgentCore Identity |
1767
+ | Variable | Required | Description |
1768
+ | --- | --- | --- |
1769
+ {{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
1770
+ {{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
1777
1771
 
1778
1772
  # Developing locally
1779
1773
 
@@ -1901,7 +1895,7 @@ if __name__ == "__main__":
1901
1895
  `;
1902
1896
 
1903
1897
  exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/mcp_client/__init__.py should match snapshot 1`] = `
1904
- "
1898
+ "# Package marker
1905
1899
  "
1906
1900
  `;
1907
1901
 
@@ -1929,7 +1923,7 @@ def get_streamable_http_mcp_client() -> MultiServerMCPClient:
1929
1923
  `;
1930
1924
 
1931
1925
  exports[`Assets Directory Snapshots > Python framework assets > python/python/langchain_langgraph/base/model/__init__.py should match snapshot 1`] = `
1932
- "
1926
+ "# Package marker
1933
1927
  "
1934
1928
  `;
1935
1929
 
@@ -2105,23 +2099,23 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/op
2105
2099
 
2106
2100
  # Layout
2107
2101
 
2108
- There is one directory with generated application code, \`src/\` . At the root, there is a \`.gitignore\` file, a
2109
- \`.agentcore\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
2102
+ The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
2103
+ \`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
2110
2104
  commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
2111
2105
 
2112
- ## src/
2106
+ ## Agent Root
2113
2107
 
2114
- The main entrypoint to your app is defined in \`src/main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
2108
+ The main entrypoint to your app is defined in \`main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
2115
2109
  file defines a Starlette ASGI app with the OpenAI Agents SDK framework running within.
2116
2110
 
2117
- \`src/model/load.py\` instantiates your chosen model provider (OpenAI).
2111
+ \`model/load.py\` instantiates your chosen model provider (OpenAI).
2118
2112
 
2119
2113
  ## Environment Variables
2120
2114
 
2121
- | Variable | Required | Description |
2122
- | --------------------------- | -------- | ---------------------------------------------------------------- |
2123
- | \`AGENTCORE_IDENTITY_OPENAI\` | Yes | OpenAI API key (local) or Identity provider name (deployed) |
2124
- | \`LOCAL_DEV\` | No | Set to \`1\` to use \`agentcore/.env\` instead of AgentCore Identity |
2115
+ | Variable | Required | Description |
2116
+ | --- | --- | --- |
2117
+ {{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
2118
+ {{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
2125
2119
 
2126
2120
  # Developing locally
2127
2121
 
@@ -2256,7 +2250,7 @@ if __name__ == "__main__":
2256
2250
  `;
2257
2251
 
2258
2252
  exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/mcp_client/__init__.py should match snapshot 1`] = `
2259
- "
2253
+ "# Package marker
2260
2254
  "
2261
2255
  `;
2262
2256
 
@@ -2279,7 +2273,7 @@ def get_streamable_http_mcp_client() -> MCPServerStreamableHttp:
2279
2273
  `;
2280
2274
 
2281
2275
  exports[`Assets Directory Snapshots > Python framework assets > python/python/openaiagents/base/model/__init__.py should match snapshot 1`] = `
2282
- "
2276
+ "# Package marker
2283
2277
  "
2284
2278
  `;
2285
2279
 
@@ -2352,25 +2346,23 @@ exports[`Assets Directory Snapshots > Python framework assets > python/python/st
2352
2346
 
2353
2347
  # Layout
2354
2348
 
2355
- There is one directory with generated application code, \`src/\` . At the root, there is a \`.gitignore\` file, a
2356
- \`.agentcore\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
2349
+ The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
2350
+ \`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
2357
2351
  commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
2358
2352
 
2359
- ## src/
2353
+ ## Agent Root
2360
2354
 
2361
- The main entrypoint to your app is defined in \`src/main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
2355
+ The main entrypoint to your app is defined in \`main.py\`. Using the AgentCore SDK \`@app.entrypoint\` decorator, this
2362
2356
  file defines a Starlette ASGI app with the chosen Agent framework SDK running within.
2363
2357
 
2364
- \`src/model/load.py\` instantiates your chosen model provider.
2358
+ \`model/load.py\` instantiates your chosen model provider.
2365
2359
 
2366
2360
  ## Environment Variables
2367
2361
 
2368
- | Variable | Required | Description |
2369
- | ------------------------------ | --------------- | ---------------------------------------------------------------- |
2370
- | \`AGENTCORE_IDENTITY_OPENAI\` | Yes (OpenAI) | OpenAI API key (local) or Identity provider name (deployed) |
2371
- | \`AGENTCORE_IDENTITY_ANTHROPIC\` | Yes (Anthropic) | Anthropic API key (local) or Identity provider name (deployed) |
2372
- | \`AGENTCORE_IDENTITY_GEMINI\` | Yes (Gemini) | Gemini API key (local) or Identity provider name (deployed) |
2373
- | \`LOCAL_DEV\` | No | Set to \`1\` to use \`agentcore/.env\` instead of AgentCore Identity |
2362
+ | Variable | Required | Description |
2363
+ | --- | --- | --- |
2364
+ {{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
2365
+ {{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
2374
2366
 
2375
2367
  # Developing locally
2376
2368
 
@@ -2524,7 +2516,7 @@ if __name__ == "__main__":
2524
2516
  `;
2525
2517
 
2526
2518
  exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/mcp_client/__init__.py should match snapshot 1`] = `
2527
- "
2519
+ "# Package marker
2528
2520
  "
2529
2521
  `;
2530
2522
 
@@ -2544,7 +2536,7 @@ def get_streamable_http_mcp_client() -> MCPClient:
2544
2536
  `;
2545
2537
 
2546
2538
  exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/base/model/__init__.py should match snapshot 1`] = `
2547
- "
2539
+ "# Package marker
2548
2540
  "
2549
2541
  `;
2550
2542
 
@@ -2692,7 +2684,8 @@ dependencies = [
2692
2684
  "bedrock-agentcore >= 1.0.3",
2693
2685
  "botocore[crt] >= 1.35.0",
2694
2686
  {{#if (eq modelProvider "Gemini")}}"google-genai >= 1.0.0",
2695
- {{/if}}{{#if (eq modelProvider "OpenAI")}}"openai >= 1.0.0",
2687
+ {{/if}}"mcp >= 1.19.0",
2688
+ {{#if (eq modelProvider "OpenAI")}}"openai >= 1.0.0",
2696
2689
  {{/if}}"strands-agents >= 1.13.0",
2697
2690
  ]
2698
2691
 
@@ -2701,7 +2694,10 @@ packages = ["."]
2701
2694
  "
2702
2695
  `;
2703
2696
 
2704
- exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/capabilities/memory/__init__.py should match snapshot 1`] = `""`;
2697
+ exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/capabilities/memory/__init__.py should match snapshot 1`] = `
2698
+ "# Package marker
2699
+ "
2700
+ `;
2705
2701
 
2706
2702
  exports[`Assets Directory Snapshots > Python framework assets > python/python/strands/capabilities/memory/session.py should match snapshot 1`] = `
2707
2703
  "import os
@@ -8,17 +8,21 @@ ENV UV_SYSTEM_PYTHON=1 \
8
8
  PYTHONUNBUFFERED=1 \
9
9
  DOCKER_CONTAINER=1
10
10
 
11
- COPY pyproject.toml uv.lock* ./
12
- RUN uv pip install -r pyproject.toml
13
-
14
11
  RUN useradd -m -u 1000 bedrock_agentcore
15
- USER bedrock_agentcore
16
12
 
17
- COPY . .
13
+ COPY pyproject.toml uv.lock ./
14
+ RUN uv sync --frozen --no-dev --no-install-project
15
+
16
+ COPY --chown=bedrock_agentcore:bedrock_agentcore . .
17
+ RUN uv sync --frozen --no-dev
18
+
19
+ USER bedrock_agentcore
18
20
 
19
- # 8080: AgentCore runtime endpoint
20
- # 8000: Local dev server (uvicorn)
21
- # 9000: OpenTelemetry collector
21
+ # AgentCore Runtime service contract ports
22
+ # https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-service-contract.html
23
+ # 8080: HTTP Mode
24
+ # 8000: MCP Mode
25
+ # 9000: A2A Mode
22
26
  EXPOSE 8080 8000 9000
23
27
 
24
28
  CMD ["opentelemetry-instrument", "python", "-m", "{{entrypoint}}"]
@@ -15,6 +15,13 @@ build/
15
15
  .coverage
16
16
  htmlcov/
17
17
 
18
+ # Secrets and environment files
19
+ .env
20
+ .env.*
21
+
22
+ # Version control
23
+ .git/
24
+
18
25
  # AgentCore build artifacts
19
26
  .agentcore/artifacts/
20
27
  *.zip
@@ -2,25 +2,23 @@ This is a project generated by the agentcore create CLI tool!
2
2
 
3
3
  # Layout
4
4
 
5
- There is one directory with generated application code, `src/` . At the root, there is a `.gitignore` file, a
6
- `.agentcore` folder which represents the configurations and state associated with this project. Other `agentcore`
5
+ The generated application code lives at the agent root directory. At the root, there is a `.gitignore` file, an
6
+ `agentcore/` folder which represents the configurations and state associated with this project. Other `agentcore`
7
7
  commands like `deploy`, `dev`, and `invoke` rely on the configuration stored here.
8
8
 
9
- ## src/
9
+ ## Agent Root
10
10
 
11
- The main entrypoint to your app is defined in `src/main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
11
+ The main entrypoint to your app is defined in `main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
12
12
  file defines a Starlette ASGI app with the AutoGen framework running within.
13
13
 
14
- `src/model/load.py` instantiates your chosen model provider.
14
+ `model/load.py` instantiates your chosen model provider.
15
15
 
16
16
  ## Environment Variables
17
17
 
18
- | Variable | Required | Description |
19
- | ------------------------------ | --------------- | ---------------------------------------------------------------- |
20
- | `AGENTCORE_IDENTITY_OPENAI` | Yes (OpenAI) | OpenAI API key (local) or Identity provider name (deployed) |
21
- | `AGENTCORE_IDENTITY_ANTHROPIC` | Yes (Anthropic) | Anthropic API key (local) or Identity provider name (deployed) |
22
- | `AGENTCORE_IDENTITY_GEMINI` | Yes (Gemini) | Gemini API key (local) or Identity provider name (deployed) |
23
- | `LOCAL_DEV` | No | Set to `1` to use `agentcore/.env` instead of AgentCore Identity |
18
+ | Variable | Required | Description |
19
+ | --- | --- | --- |
20
+ {{#if hasIdentity}}| `{{identityProviders.[0].envVarName}}` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
21
+ {{/if}}| `LOCAL_DEV` | No | Set to `1` to use `.env.local` instead of AgentCore Identity |
24
22
 
25
23
  # Developing locally
26
24
 
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -2,25 +2,23 @@ This is a project generated by the agentcore create CLI tool!
2
2
 
3
3
  # Layout
4
4
 
5
- There is one directory with generated application code, `src/` . At the root, there is a `.gitignore` file, a
6
- `.agentcore` folder which represents the configurations and state associated with this project. Other `agentcore`
5
+ The generated application code lives at the agent root directory. At the root, there is a `.gitignore` file, an
6
+ `agentcore/` folder which represents the configurations and state associated with this project. Other `agentcore`
7
7
  commands like `deploy`, `dev`, and `invoke` rely on the configuration stored here.
8
8
 
9
- ## src/
9
+ ## Agent Root
10
10
 
11
- The main entrypoint to your app is defined in `src/main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
11
+ The main entrypoint to your app is defined in `main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
12
12
  file defines a Starlette ASGI app with the CrewAI framework running within.
13
13
 
14
- `src/model/load.py` instantiates your chosen model provider.
14
+ `model/load.py` instantiates your chosen model provider.
15
15
 
16
16
  ## Environment Variables
17
17
 
18
- | Variable | Required | Description |
19
- | ------------------------------ | --------------- | ---------------------------------------------------------------- |
20
- | `AGENTCORE_IDENTITY_OPENAI` | Yes (OpenAI) | OpenAI API key (local) or Identity provider name (deployed) |
21
- | `AGENTCORE_IDENTITY_ANTHROPIC` | Yes (Anthropic) | Anthropic API key (local) or Identity provider name (deployed) |
22
- | `AGENTCORE_IDENTITY_GEMINI` | Yes (Gemini) | Gemini API key (local) or Identity provider name (deployed) |
23
- | `LOCAL_DEV` | No | Set to `1` to use `agentcore/.env` instead of AgentCore Identity |
18
+ | Variable | Required | Description |
19
+ | --- | --- | --- |
20
+ {{#if hasIdentity}}| `{{identityProviders.[0].envVarName}}` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
21
+ {{/if}}| `LOCAL_DEV` | No | Set to `1` to use `.env.local` instead of AgentCore Identity |
24
22
 
25
23
  # Developing locally
26
24
 
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -2,23 +2,23 @@ This is a project generated by the agentcore create CLI tool!
2
2
 
3
3
  # Layout
4
4
 
5
- There is one directory with generated application code, `src/` . At the root, there is a `.gitignore` file, a
6
- `.agentcore` folder which represents the configurations and state associated with this project. Other `agentcore`
5
+ The generated application code lives at the agent root directory. At the root, there is a `.gitignore` file, an
6
+ `agentcore/` folder which represents the configurations and state associated with this project. Other `agentcore`
7
7
  commands like `deploy`, `dev`, and `invoke` rely on the configuration stored here.
8
8
 
9
- ## src/
9
+ ## Agent Root
10
10
 
11
- The main entrypoint to your app is defined in `src/main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
11
+ The main entrypoint to your app is defined in `main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
12
12
  file defines a Starlette ASGI app with the Google ADK framework running within.
13
13
 
14
- `src/model/load.py` instantiates your chosen model provider (Gemini).
14
+ `model/load.py` instantiates your chosen model provider (Gemini).
15
15
 
16
16
  ## Environment Variables
17
17
 
18
- | Variable | Required | Description |
19
- | --------------------------- | -------- | ---------------------------------------------------------------- |
20
- | `AGENTCORE_IDENTITY_GEMINI` | Yes | Gemini API key (local) or Identity provider name (deployed) |
21
- | `LOCAL_DEV` | No | Set to `1` to use `agentcore/.env` instead of AgentCore Identity |
18
+ | Variable | Required | Description |
19
+ | --- | --- | --- |
20
+ {{#if hasIdentity}}| `{{identityProviders.[0].envVarName}}` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
21
+ {{/if}}| `LOCAL_DEV` | No | Set to `1` to use `.env.local` instead of AgentCore Identity |
22
22
 
23
23
  # Developing locally
24
24
 
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -2,25 +2,23 @@ This is a project generated by the agentcore create CLI tool!
2
2
 
3
3
  # Layout
4
4
 
5
- There is one directory with generated application code, `src/` . At the root, there is a `.gitignore` file, a
6
- `.agentcore` folder which represents the configurations and state associated with this project. Other `agentcore`
5
+ The generated application code lives at the agent root directory. At the root, there is a `.gitignore` file, an
6
+ `agentcore/` folder which represents the configurations and state associated with this project. Other `agentcore`
7
7
  commands like `deploy`, `dev`, and `invoke` rely on the configuration stored here.
8
8
 
9
- ## src/
9
+ ## Agent Root
10
10
 
11
- The main entrypoint to your app is defined in `src/main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
11
+ The main entrypoint to your app is defined in `main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
12
12
  file defines a Starlette ASGI app with the LangChain/LangGraph framework running within.
13
13
 
14
- `src/model/load.py` instantiates your chosen model provider.
14
+ `model/load.py` instantiates your chosen model provider.
15
15
 
16
16
  ## Environment Variables
17
17
 
18
- | Variable | Required | Description |
19
- | ------------------------------ | --------------- | ---------------------------------------------------------------- |
20
- | `AGENTCORE_IDENTITY_OPENAI` | Yes (OpenAI) | OpenAI API key (local) or Identity provider name (deployed) |
21
- | `AGENTCORE_IDENTITY_ANTHROPIC` | Yes (Anthropic) | Anthropic API key (local) or Identity provider name (deployed) |
22
- | `AGENTCORE_IDENTITY_GEMINI` | Yes (Gemini) | Gemini API key (local) or Identity provider name (deployed) |
23
- | `LOCAL_DEV` | No | Set to `1` to use `agentcore/.env` instead of AgentCore Identity |
18
+ | Variable | Required | Description |
19
+ | --- | --- | --- |
20
+ {{#if hasIdentity}}| `{{identityProviders.[0].envVarName}}` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
21
+ {{/if}}| `LOCAL_DEV` | No | Set to `1` to use `.env.local` instead of AgentCore Identity |
24
22
 
25
23
  # Developing locally
26
24
 
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -2,23 +2,23 @@ This is a project generated by the agentcore create CLI tool!
2
2
 
3
3
  # Layout
4
4
 
5
- There is one directory with generated application code, `src/` . At the root, there is a `.gitignore` file, a
6
- `.agentcore` folder which represents the configurations and state associated with this project. Other `agentcore`
5
+ The generated application code lives at the agent root directory. At the root, there is a `.gitignore` file, an
6
+ `agentcore/` folder which represents the configurations and state associated with this project. Other `agentcore`
7
7
  commands like `deploy`, `dev`, and `invoke` rely on the configuration stored here.
8
8
 
9
- ## src/
9
+ ## Agent Root
10
10
 
11
- The main entrypoint to your app is defined in `src/main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
11
+ The main entrypoint to your app is defined in `main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
12
12
  file defines a Starlette ASGI app with the OpenAI Agents SDK framework running within.
13
13
 
14
- `src/model/load.py` instantiates your chosen model provider (OpenAI).
14
+ `model/load.py` instantiates your chosen model provider (OpenAI).
15
15
 
16
16
  ## Environment Variables
17
17
 
18
- | Variable | Required | Description |
19
- | --------------------------- | -------- | ---------------------------------------------------------------- |
20
- | `AGENTCORE_IDENTITY_OPENAI` | Yes | OpenAI API key (local) or Identity provider name (deployed) |
21
- | `LOCAL_DEV` | No | Set to `1` to use `agentcore/.env` instead of AgentCore Identity |
18
+ | Variable | Required | Description |
19
+ | --- | --- | --- |
20
+ {{#if hasIdentity}}| `{{identityProviders.[0].envVarName}}` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
21
+ {{/if}}| `LOCAL_DEV` | No | Set to `1` to use `.env.local` instead of AgentCore Identity |
22
22
 
23
23
  # Developing locally
24
24
 
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -2,25 +2,23 @@ This is a project generated by the agentcore create basic CLI tool!
2
2
 
3
3
  # Layout
4
4
 
5
- There is one directory with generated application code, `src/` . At the root, there is a `.gitignore` file, a
6
- `.agentcore` folder which represents the configurations and state associated with this project. Other `agentcore`
5
+ The generated application code lives at the agent root directory. At the root, there is a `.gitignore` file, an
6
+ `agentcore/` folder which represents the configurations and state associated with this project. Other `agentcore`
7
7
  commands like `deploy`, `dev`, and `invoke` rely on the configuration stored here.
8
8
 
9
- ## src/
9
+ ## Agent Root
10
10
 
11
- The main entrypoint to your app is defined in `src/main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
11
+ The main entrypoint to your app is defined in `main.py`. Using the AgentCore SDK `@app.entrypoint` decorator, this
12
12
  file defines a Starlette ASGI app with the chosen Agent framework SDK running within.
13
13
 
14
- `src/model/load.py` instantiates your chosen model provider.
14
+ `model/load.py` instantiates your chosen model provider.
15
15
 
16
16
  ## Environment Variables
17
17
 
18
- | Variable | Required | Description |
19
- | ------------------------------ | --------------- | ---------------------------------------------------------------- |
20
- | `AGENTCORE_IDENTITY_OPENAI` | Yes (OpenAI) | OpenAI API key (local) or Identity provider name (deployed) |
21
- | `AGENTCORE_IDENTITY_ANTHROPIC` | Yes (Anthropic) | Anthropic API key (local) or Identity provider name (deployed) |
22
- | `AGENTCORE_IDENTITY_GEMINI` | Yes (Gemini) | Gemini API key (local) or Identity provider name (deployed) |
23
- | `LOCAL_DEV` | No | Set to `1` to use `agentcore/.env` instead of AgentCore Identity |
18
+ | Variable | Required | Description |
19
+ | --- | --- | --- |
20
+ {{#if hasIdentity}}| `{{identityProviders.[0].envVarName}}` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
21
+ {{/if}}| `LOCAL_DEV` | No | Set to `1` to use `.env.local` instead of AgentCore Identity |
24
22
 
25
23
  # Developing locally
26
24
 
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -1 +1 @@
1
-
1
+ # Package marker
@@ -14,7 +14,8 @@ dependencies = [
14
14
  "bedrock-agentcore >= 1.0.3",
15
15
  "botocore[crt] >= 1.35.0",
16
16
  {{#if (eq modelProvider "Gemini")}}"google-genai >= 1.0.0",
17
- {{/if}}{{#if (eq modelProvider "OpenAI")}}"openai >= 1.0.0",
17
+ {{/if}}"mcp >= 1.19.0",
18
+ {{#if (eq modelProvider "OpenAI")}}"openai >= 1.0.0",
18
19
  {{/if}}"strands-agents >= 1.13.0",
19
20
  ]
20
21
 
@@ -0,0 +1 @@
1
+ # Package marker
@@ -733,7 +733,7 @@ ${i.itemsToRemove.map(p=>`\u2022 ${p}`).join(`
733
733
 
734
734
  All agent definitions and configurations will be cleared.`:void 0;return(0,fi.jsx)(cB,{message:"Reset all AgentCore schemas to empty state?",detail:u,onConfirm:i.confirmRemoval,onCancel:o,showInput:!0,inputPrompt:"Confirm reset (y/n)"})}return(0,fi.jsx)(tn,{title:"Reset AgentCore Schemas",onExit:o,helpText:i.phase==="complete"?Nn.EXIT:Nn.EXIT,children:(0,fi.jsxs)(J,{flexDirection:"column",gap:1,children:[i.phase==="checking"&&(0,fi.jsx)(k,{dimColor:!0,children:"Checking for AgentCore project..."}),i.phase==="not-found"&&(0,fi.jsxs)(J,{flexDirection:"column",gap:1,children:[(0,fi.jsx)(k,{color:"yellow",children:"No AgentCore project found in current directory."}),(0,fi.jsx)(k,{dimColor:!0,children:"Nothing to reset."})]}),i.phase==="dry-run"&&(0,fi.jsxs)(J,{flexDirection:"column",gap:1,children:[(0,fi.jsx)(k,{color:"cyan",children:"Dry run - showing what would be reset:"}),(0,fi.jsx)(J,{marginLeft:2,flexDirection:"column",children:i.itemsToRemove.map((u,p)=>(0,fi.jsxs)(k,{dimColor:!0,children:["\u2022 ",u]},p))})]}),i.phase==="removing"&&(0,fi.jsxs)(J,{flexDirection:"column",gap:1,children:[(0,fi.jsx)(k,{children:"Resetting AgentCore schemas..."}),(0,fi.jsx)(ff,{steps:i.steps})]}),i.phase==="complete"&&(0,fi.jsx)(J,{flexDirection:"column",gap:1,children:i.hasError?(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(k,{color:"red",children:"Reset completed with errors"}),(0,fi.jsx)(k,{dimColor:!0,children:"Some schemas may need manual cleanup"})]}):(0,fi.jsxs)(fi.Fragment,{children:[(0,fi.jsx)(k,{color:"green",children:"AgentCore schemas reset successfully"}),(0,fi.jsx)(k,{dimColor:!0,children:"Your source code has not been modified."}),i.hasDeployedResources?(0,fi.jsx)(Np,{steps:ZIn,isInteractive:e,onSelect:u=>r?.(u.command),onBack:o,isActive:a}):(0,fi.jsx)(k,{dimColor:!0,children:"All schemas have been reset to empty state."})]})})]})})}await Qr();Pd();await Jt();var CJ=Q(Xe()),$i=Q(Ne());function XIn(e,t){let n=JSON.stringify(e,null,2).split(`
735
735
  `),o=JSON.stringify(t,null,2).split(`
736
- `),r=n.length,i=o.length,a=Array.from({length:r+1},()=>Array(i+1).fill(0));for(let D=1;D<=r;D++)for(let B=1;B<=i;B++)n[D-1]===o[B-1]?a[D][B]=a[D-1][B-1]+1:a[D][B]=Math.max(a[D-1][B],a[D][B-1]);let u=r,p=i,f=[];for(;u>0||p>0;)u>0&&p>0&&n[u-1]===o[p-1]?(f.unshift(` ${n[u-1]}`),u--,p--):p>0&&(u===0||a[u][p-1]>=a[u-1][p])?(f.unshift(`+ ${o[p-1]}`),p--):u>0&&(f.unshift(`- ${n[u-1]}`),u--);let g=[],h=[],C=[],R=()=>{g.push(...h),g.push(...C),h=[],C=[]};for(let D of f)D.startsWith("- ")?(C.length>0&&R(),h.push(D)):D.startsWith("+ ")?C.push(D):(R(),g.push(D));return R(),e_n(g,2)}function e_n(e,t){let n=[],o=[];if(e.forEach((a,u)=>{(a.startsWith("- ")||a.startsWith("+ "))&&o.push(u)}),o.length===0)return[" (no changes)"];let r=new Set;for(let a of o)for(let u=Math.max(0,a-t);u<=Math.min(e.length-1,a+t);u++)r.add(u);let i=-2;for(let a=0;a<e.length;a++)r.has(a)&&(i<a-1&&i>=0&&n.push(" ..."),n.push(e[a]),i=a);return n}function t_n({changes:e,maxHeight:t=30,minHeight:n=6}){let{stdout:o}=Tl(),[r,i]=(0,CJ.useState)(0),a=(0,CJ.useMemo)(()=>{let D=[];for(let B of e){D.push(`\u2500\u2500\u2500 ${B.file} \u2500\u2500\u2500`);let O=XIn(B.before,B.after);D.push(...O)}return D},[e]),u=o?.rows??24,p=Math.max(n,Math.min(t,u-14)),f=Math.min(p,a.length),g=a.length,h=Math.max(0,g-f),C=g>f;er((D,B)=>{C&&(B.upArrow&&i(O=>Math.max(0,O-1)),B.downArrow&&i(O=>Math.min(h,O+1)))});let R=a.slice(r,r+f);return(0,$i.jsxs)(J,{flexDirection:"column",children:[(0,$i.jsx)(J,{flexDirection:"column",height:C?f:void 0,children:R.map((D,B)=>D.startsWith("\u2500\u2500\u2500")?(0,$i.jsx)(k,{bold:!0,color:"cyan",children:D},r+B):D.startsWith("- ")?(0,$i.jsx)(k,{color:"red",children:D},r+B):D.startsWith("+ ")?(0,$i.jsx)(k,{color:"green",children:D},r+B):(0,$i.jsx)(k,{dimColor:!0,children:D},r+B))}),C&&(0,$i.jsxs)(k,{dimColor:!0,children:["[",r+1,"-",Math.min(r+f,g)," of ",g,"] \u2191\u2193 scroll"]})]})}function cR({title:e,preview:t,onConfirm:n,onCancel:o}){er((i,a)=>{a.return&&n(),a.escape&&o()});let r=(0,$i.jsx)(J,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,children:t.summary.map((i,a)=>{let u=i.indexOf(":");if(u>0&&u<20){let p=i.slice(0,u+1),f=i.slice(u+1);return(0,$i.jsxs)(J,{children:[(0,$i.jsx)(k,{children:p}),(0,$i.jsx)(k,{color:"cyan",children:f})]},a)}return i.startsWith("[cascade]")?(0,$i.jsx)(k,{color:"yellow",children:i},a):i.startsWith("BLOCKED")?(0,$i.jsx)(k,{color:"red",children:i},a):(0,$i.jsx)(k,{children:i},a)})});return(0,$i.jsx)(tn,{title:e,onExit:o,helpText:Nn.CONFIRM_CANCEL,headerContent:r,children:(0,$i.jsxs)(J,{flexDirection:"column",flexGrow:1,children:[t.schemaChanges.length>0&&(0,$i.jsx)(t_n,{changes:t.schemaChanges}),(0,$i.jsxs)(J,{marginTop:1,children:[(0,$i.jsx)(k,{color:"yellow",children:"\u25B6 "}),(0,$i.jsx)(k,{children:"Press "}),(0,$i.jsx)(k,{bold:!0,color:"green",children:"Enter"}),(0,$i.jsx)(k,{children:" to remove, "}),(0,$i.jsx)(k,{bold:!0,children:"Esc"}),(0,$i.jsx)(k,{children:" to cancel"})]})]})})}await Qr();var lr=Q(Xe());function Prt(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await qye();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await qye();t(o)},[]);return{agents:e??[],isLoading:e===null,refresh:n}}function Ort(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await Vye();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await Vye();t(o)},[]);return{gateways:e??[],isLoading:e===null,refresh:n}}function Nrt(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await XM();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await XM();t(o)},[]);return{tools:e??[],isLoading:e===null,refresh:n}}function krt(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await Yye();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await Yye();t(o)},[]);return{memories:e??[],isLoading:e===null,refresh:n}}function $rt(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await Zye();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await Zye();t(o)},[]);return{identities:e??[],isLoading:e===null,refresh:n}}function Mrt(){let[e,t]=(0,lr.useState)({isLoading:!1,preview:null,error:null}),n=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await Xtt(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),o=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await ent(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),r=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await nnt(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),i=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await int(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),a=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await snt(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),u=(0,lr.useCallback)(()=>{t({isLoading:!1,preview:null,error:null})},[]);return{...e,loadAgentPreview:n,loadGatewayPreview:o,loadMcpToolPreview:r,loadMemoryPreview:i,loadIdentityPreview:a,reset:u}}function Lrt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await WW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"agent",resourceName:a});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}function Qrt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await JW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"gateway",resourceName:a});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}function Urt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await YW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"mcp-tool",resourceName:a.name});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}function Frt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await ZW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"memory",resourceName:a});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}function Grt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await XW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"identity",resourceName:a});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}await Qr();var Cir=Q(Xe()),zrt=Q(Ne());function zEe({gateways:e,onSelect:t,onExit:n}){let o=e.map(r=>({id:r,title:r,description:`Remove gateway "${r}"`}));return(0,zrt.jsx)(Pl,{title:"Select Gateway to Remove",items:o,onSelect:r=>t(r.id),onExit:n})}await Qr();var _ir=Q(Xe()),jrt=Q(Ne());function jEe({identities:e,onSelect:t,onExit:n}){let o=e.map(r=>({id:r.name,title:r.name,description:r.type}));return(0,jrt.jsx)(Pl,{title:"Select Credential to Remove",items:o,onSelect:r=>t(r.id),onExit:n})}await Qr();var Tir=Q(Xe()),Hrt=Q(Ne());function HEe({tools:e,onSelect:t,onExit:n}){let o=e.map(i=>({id:i.name,title:i.name,description:i.type==="mcp-runtime"?"MCP Runtime tool":`Gateway target (${i.gatewayName})`})),r=new Map(e.map(i=>[i.name,i]));return(0,Hrt.jsx)(Pl,{title:"Select MCP Tool to Remove",items:o,onSelect:i=>{let a=r.get(i.id);a&&t(a)},onExit:n})}await Qr();var Pir=Q(Xe()),Krt=Q(Ne());function KEe({memories:e,onSelect:t,onExit:n}){let o=e.map(r=>({id:r.name,title:r.name,description:"AgentCore Memory"}));return(0,Krt.jsx)(Pl,{title:"Select Memory to Remove",items:o,onSelect:r=>t(r.id),onExit:n})}await Qr();var qrt=Q(Xe()),Vrt=Q(Ne()),n_n=[{id:"agent",title:"Agent",description:"Remove an agent from the project"},{id:"memory",title:"Memory",description:"Remove a memory provider"},{id:"identity",title:"Identity",description:"Remove an identity provider"},{id:"gateway",title:"Gateway (coming soon)",description:"Remove an MCP gateway",disabled:!0},{id:"mcp-tool",title:"MCP Tool (coming soon)",description:"Remove an MCP tool",disabled:!0},{id:"all",title:"All",description:"Reset entire agentcore project"}];function qEe({onSelect:e,onExit:t,agentCount:n,gatewayCount:o,mcpToolCount:r,memoryCount:i,identityCount:a}){let u=(0,qrt.useMemo)(()=>n_n.map(f=>{let g="disabled"in f&&f.disabled||!1,h=f.description;switch(f.id){case"agent":n===0&&(g=!0,h="No agents to remove");break;case"memory":i===0&&(g=!0,h="No memories to remove");break;case"identity":a===0&&(g=!0,h="No identities to remove");break;case"all":break}return{...f,disabled:g,description:h}}),[n,i,a]);return(0,Vrt.jsx)(Pl,{title:"Remove Resource",items:u,onSelect:f=>e(f.id),onExit:t,isDisabled:f=>f.disabled??!1})}await Qr();await Jt();var Qir=Q(Xe()),zu=Q(Ne()),r_n=[{command:"remove",label:"Remove another resource"}];function uR({isInteractive:e,message:t,detail:n,logFilePath:o,onRemoveAnother:r,onExit:i}){let a=u=>{u.command==="remove"&&r()};return e?(0,zu.jsx)(tn,{title:"Success",onExit:i,children:(0,zu.jsxs)(J,{flexDirection:"column",gap:1,children:[(0,zu.jsxs)(J,{flexDirection:"column",children:[(0,zu.jsxs)(k,{color:"green",children:["\u2713 ",t]}),n&&(0,zu.jsx)(k,{children:n}),(0,zu.jsx)(k,{dimColor:!0,children:"Your source code has not been modified."}),o&&(0,zu.jsx)(yf,{filePath:o,label:"Diff"})]}),(0,zu.jsx)(Np,{steps:r_n,isInteractive:!0,onSelect:a,onBack:i})]})}):(0,zu.jsx)(tn,{title:"Success",onExit:i,children:(0,zu.jsxs)(J,{flexDirection:"column",children:[(0,zu.jsxs)(k,{color:"green",children:["\u2713 ",t]}),n&&(0,zu.jsx)(k,{children:n}),(0,zu.jsx)(k,{dimColor:!0,children:"Your source code has not been modified."}),o&&(0,zu.jsx)(yf,{filePath:o,label:"Diff"})]})})}await Jt();var gB=Q(Xe(),1);await Jt();var Xrt=Q(Zrt(),1);function i_n({type:e="dots"}){let[t,n]=(0,gB.useState)(0),o=Xrt.default[e];return(0,gB.useEffect)(()=>{let r=setInterval(()=>{n(i=>i===o.frames.length-1?0:i+1)},o.interval);return()=>{clearInterval(r)}},[o]),gB.default.createElement(k,null,o.frames[t])}var eot=i_n;var ws=Q(Xe()),bs=Q(Ne());function AB({isInteractive:e,onExit:t,onNavigate:n,force:o=!1,initialResourceType:r,initialResourceName:i}){let a=()=>{if(!r)return{name:"select"};switch(r){case"agent":return{name:"select-agent"};case"gateway":return{name:"select-gateway"};case"mcp-tool":return{name:"select-mcp-tool"};case"memory":return{name:"select-memory"};case"identity":return{name:"select-identity"};default:return{name:"select"}}},[u,p]=(0,ws.useState)(a),{agents:f,isLoading:g,refresh:h}=Prt(),{gateways:C,isLoading:R,refresh:D}=Ort(),{tools:B,isLoading:O,refresh:z}=Nrt(),{memories:Y,isLoading:ee,refresh:Z}=krt(),{identities:oe,isLoading:Be,refresh:Ce}=$rt(),pe=g||R||O||ee||Be,{loadAgentPreview:ne,loadGatewayPreview:ie,loadMcpToolPreview:we,loadMemoryPreview:de,loadIdentityPreview:ze,reset:Pe}=Mrt(),{remove:fe,reset:De}=Lrt(),{remove:Re,reset:je}=Qrt(),{remove:et,reset:on}=Urt(),{remove:ce,reset:Ke}=Frt(),{remove:ht,reset:ot}=Grt(),it=(0,ws.useRef)(null),[Wt,Vt]=(0,ws.useState)(!1);(0,ws.useEffect)(()=>{if(u.name==="loading"&&Wt&&it.current){let Je=it.current;it.current=null,setTimeout(()=>{Vt(!1),p(Je)},0)}},[u.name,Wt]),(0,ws.useEffect)(()=>{e||["agent-success","gateway-success","tool-success","memory-success","identity-success"].includes(u.name)&&t()},[e,u.name,t]);let gn=(0,ws.useRef)(!1),Ot=(0,ws.useCallback)(Je=>{switch(Je){case"agent":p({name:"select-agent"});break;case"gateway":p({name:"select-gateway"});break;case"mcp-tool":p({name:"select-mcp-tool"});break;case"memory":p({name:"select-memory"});break;case"identity":p({name:"select-identity"});break;case"all":p({name:"remove-all"});break}},[]),st=(0,ws.useCallback)(async Je=>{let Ht=await ne(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing agent ${Je}...`});let Gn=await fe(Je,Ht.preview);Gn.ok?p({name:"agent-success",agentName:Je}):p({name:"error",message:Gn.error})}else p({name:"confirm-agent",agentName:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[ne,o,fe]),nt=(0,ws.useCallback)(async Je=>{let Ht=await ie(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing gateway ${Je}...`});let Gn=await Re(Je,Ht.preview);Gn.ok?p({name:"gateway-success",gatewayName:Je}):p({name:"error",message:Gn.error})}else p({name:"confirm-gateway",gatewayName:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[ie,o,Re]),lt=(0,ws.useCallback)(async Je=>{let Ht=await we(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing MCP tool ${Je.name}...`});let Gn=await et(Je,Ht.preview);Gn.ok?p({name:"tool-success",toolName:Je.name}):p({name:"error",message:Gn.error})}else p({name:"confirm-mcp-tool",tool:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[we,o,et]),Nt=(0,ws.useCallback)(async Je=>{let Ht=await de(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing memory ${Je}...`});let Gn=await ce(Je,Ht.preview);Gn.ok?p({name:"memory-success",memoryName:Je}):p({name:"error",message:Gn.error})}else p({name:"confirm-memory",memoryName:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[de,o,ce]),mt=(0,ws.useCallback)(async Je=>{let Ht=await ze(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing identity ${Je}...`});let Gn=await ht(Je,Ht.preview);Gn.ok?p({name:"identity-success",identityName:Je}):p({name:"error",message:Gn.error})}else p({name:"confirm-identity",identityName:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[ze,o,ht]);(0,ws.useEffect)(()=>{!i||pe||gn.current||(gn.current=!0,setTimeout(()=>{switch(r){case"agent":st(i);break;case"gateway":nt(i);break;case"memory":Nt(i);break;case"identity":mt(i);break}},0))},[i,r,pe,st,nt,Nt,mt]);let Gt=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing agent ${Je}...`});let Gn=await fe(Je,Ht);Gn.ok?it.current={name:"agent-success",agentName:Je,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[fe]),$n=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing gateway ${Je}...`});let Gn=await Re(Je,Ht);Gn.ok?it.current={name:"gateway-success",gatewayName:Je,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[Re]),kt=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing MCP tool ${Je.name}...`});let Gn=await et(Je,Ht);Gn.ok?it.current={name:"tool-success",toolName:Je.name,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[et]),$t=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing memory ${Je}...`});let Gn=await ce(Je,Ht);Gn.ok?it.current={name:"memory-success",memoryName:Je,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[ce]),Eo=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing identity ${Je}...`});let Gn=await ht(Je,Ht);Gn.ok?it.current={name:"identity-success",identityName:Je,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[ht]),Mo=(0,ws.useCallback)(()=>{Pe(),De(),je(),on(),Ke(),ot()},[Pe,De,je,on,Ke,ot]),ln=(0,ws.useCallback)(async()=>{await Promise.all([h(),D(),z(),Z(),Ce()])},[h,D,z,Z,Ce]);return u.name==="select"?pe?null:(0,bs.jsx)(qEe,{onSelect:Ot,onExit:t,agentCount:f.length,gatewayCount:C.length,mcpToolCount:B.length,memoryCount:Y.length,identityCount:oe.length}):u.name==="loading"?(0,bs.jsx)(tn,{title:"Remove Resource",onExit:()=>{},children:(0,bs.jsx)(Nr,{children:(0,bs.jsxs)(k,{children:[(0,bs.jsx)(eot,{type:"dots"})," ",u.message]})})}):u.name==="select-agent"?i&&pe?null:(0,bs.jsx)(GEe,{agents:f,onSelect:Je=>{st(Je)},onExit:()=>p({name:"select"})}):u.name==="select-gateway"?i&&pe?null:(0,bs.jsx)(zEe,{gateways:C,onSelect:Je=>{nt(Je)},onExit:()=>p({name:"select"})}):u.name==="select-mcp-tool"?(0,bs.jsx)(HEe,{tools:B,onSelect:Je=>{lt(Je)},onExit:()=>p({name:"select"})}):u.name==="select-memory"?i&&pe?null:(0,bs.jsx)(KEe,{memories:Y,onSelect:Je=>{Nt(Je)},onExit:()=>p({name:"select"})}):u.name==="select-identity"?i&&pe?null:(0,bs.jsx)(jEe,{identities:oe,onSelect:Je=>{mt(Je)},onExit:()=>p({name:"select"})}):u.name==="confirm-agent"?(0,bs.jsx)(cR,{title:`Remove Agent: ${u.agentName}`,preview:u.preview,onConfirm:()=>{Gt(u.agentName,u.preview)},onCancel:()=>p({name:"select-agent"})}):u.name==="confirm-gateway"?(0,bs.jsx)(cR,{title:`Remove Gateway: ${u.gatewayName}`,preview:u.preview,onConfirm:()=>{$n(u.gatewayName,u.preview)},onCancel:()=>p({name:"select-gateway"})}):u.name==="confirm-mcp-tool"?(0,bs.jsx)(cR,{title:`Remove MCP Tool: ${u.tool.name}`,preview:u.preview,onConfirm:()=>{kt(u.tool,u.preview)},onCancel:()=>p({name:"select-mcp-tool"})}):u.name==="confirm-memory"?(0,bs.jsx)(cR,{title:`Remove Memory: ${u.memoryName}`,preview:u.preview,onConfirm:()=>{$t(u.memoryName,u.preview)},onCancel:()=>p({name:"select-memory"})}):u.name==="confirm-identity"?(0,bs.jsx)(cR,{title:`Remove Identity: ${u.identityName}`,preview:u.preview,onConfirm:()=>{Eo(u.identityName,u.preview)},onCancel:()=>p({name:"select-identity"})}):u.name==="agent-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed agent: ${u.agentName}`,detail:"Agent removed from agentcore.json. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="gateway-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed gateway: ${u.gatewayName}`,detail:"Gateway removed from mcp.json. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="tool-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed MCP tool: ${u.toolName}`,detail:"MCP tool removed. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="memory-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed memory: ${u.memoryName}`,detail:"Memory provider removed from agentcore.json. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="identity-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed identity: ${u.identityName}`,detail:"Identity provider removed from agentcore.json. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="remove-all"?(0,bs.jsx)(fL,{isInteractive:e,onExit:t,onNavigate:n}):(0,bs.jsx)(Op,{message:"Failed to remove resource",detail:u.message,onBack:()=>{Mo(),p({name:"select"})},onExit:t})}mn();Ci();var gL="Your agent app source code has not been modified. Deploy with `agentcore deploy` to apply your removal changes to AWS.";async function tot(e){let{resourceType:t,name:n}=e;try{switch(t){case"agent":{let o=await WW(n);return o.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed agent '${n}'`,note:gL}:{success:!1,error:o.error}}case"gateway":{let o=await JW(n);return o.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed gateway '${n}'`,note:gL}:{success:!1,error:o.error}}case"mcp-tool":{let r=(await XM()).find(a=>a.name===n);if(!r)return{success:!1,error:`MCP tool '${n}' not found`};let i=await YW(r);return i.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed MCP tool '${n}'`,note:gL}:{success:!1,error:i.error}}case"memory":{let o=await ZW(n);return o.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed memory '${n}'`,note:gL}:{success:!1,error:o.error}}case"identity":{let o=await XW(n);return o.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed identity '${n}'`,note:gL}:{success:!1,error:o.error}}default:return{success:!1,error:`Unknown resource type: ${t}`}}}catch(o){return{success:!1,error:Zt(o)}}}async function not(e){try{let t=new Rt,n="Project";try{n=(await t.readProjectSpec()).name}catch{}return await t.writeProjectSpec({name:n,version:1,agents:[],memories:[],credentials:[]}),{success:!0,message:"All schemas reset to empty state",note:"Your source code has not been modified. Run `agentcore deploy` to apply changes to AWS."}}catch(t){return{success:!1,error:Zt(t)}}}function rot(e){return e.json&&!e.name?{valid:!1,error:"--name is required for JSON output"}:{valid:!0}}function oot(e){return{valid:!0}}await Jt();var wsr=Q(Xe()),lR=Q(Ne());function s_n(e={}){let{unmount:t}=On((0,lR.jsx)(fL,{isInteractive:!1,force:e.force,dryRun:e.dryRun,onExit:()=>{t(),process.exit(0)}}))}function a_n(e,t){let{clear:n,unmount:o}=On((0,lR.jsx)(AB,{isInteractive:!1,force:t.force,initialResourceType:e,initialResourceName:t.name,onExit:()=>{n(),o(),process.exit(0)}}))}async function c_n(e){let t=rot(e);t.valid||(console.log(JSON.stringify({success:!1,error:t.error})),process.exit(1));let n=await tot({resourceType:e.resourceType,name:e.name,force:e.force});console.log(JSON.stringify(n)),process.exit(n.success?0:1)}async function u_n(e){oot(e);let t=await not(e);console.log(JSON.stringify(t)),process.exit(t.success?0:1)}function VEe(e,t,n,o){e.command(t).description(o).option("--name <name>","Name of resource to remove [non-interactive]").option("--force","Skip confirmation prompt [non-interactive]").option("--json","Output as JSON [non-interactive]").action(async r=>{try{Ic(),r.name||r.force||r.json?await c_n({resourceType:n,name:r.name,force:r.force,json:r.json}):a_n(n,{})}catch(i){r.json?console.log(JSON.stringify({success:!1,error:Zt(i)})):On((0,lR.jsxs)(k,{color:"red",children:["Error: ",Zt(i)]})),process.exit(1)}})}var WEe=e=>{let t=e.command("remove").description(Ws.remove);t.command("all").description("Reset all agentcore schemas to empty state").option("--force","Skip confirmation prompts [non-interactive]").option("--dry-run","Show what would be reset without actually resetting [non-interactive]").option("--json","Output as JSON [non-interactive]").action(async n=>{try{n.force||n.dryRun||n.json?await u_n({force:n.force,dryRun:n.dryRun,json:n.json}):s_n({})}catch(o){n.json?console.log(JSON.stringify({success:!1,error:Zt(o)})):On((0,lR.jsxs)(k,{color:"red",children:["Error: ",Zt(o)]})),process.exit(1)}}),VEe(t,"agent","agent","Remove an agent from the project"),VEe(t,"memory","memory","Remove a memory provider from the project"),VEe(t,"identity","identity","Remove an identity provider from the project"),t.command("mcp-tool",{hidden:!0}).description("Remove an MCP tool from the project").option("--name <name>","Name of resource to remove").option("--force","Skip confirmation prompt").option("--json","Output as JSON").action(()=>{console.error("MCP Tool integration is coming soon."),process.exit(1)}),t.command("gateway",{hidden:!0}).description("Remove a gateway from the project").option("--name <name>","Name of resource to remove").option("--force","Skip confirmation prompt").option("--json","Output as JSON").action(()=>{console.error("AgentCore Gateway integration is coming soon."),process.exit(1)}),t.argument("[subcommand]").action((n,o,r)=>{n&&(console.error(`error: '${n}' is not a valid subcommand.`),r.outputHelp(),process.exit(1)),Ic();let{clear:i,unmount:a}=On((0,lR.jsx)(AB,{isInteractive:!1,onExit:()=>{i(),a()}}))}).showHelpAfterError().showSuggestionAfterError()};Ci();mn();HA();Ci();async function AL(e=new Rt){return{project:await e.readProjectSpec(),deployedState:await e.readDeployedState(),awsTargets:await e.readAWSDeploymentTargets()}}async function JEe(e,t={}){let{project:n,deployedState:o,awsTargets:r}=e,i=t.agentRuntimeId?r.map(C=>C.name):Object.keys(o.targets);if(i.length===0)return{success:!1,error:t.agentRuntimeId?"No deployment targets found. Run `agentcore create` first.":"No deployed targets found. Run `agentcore deploy` first."};let a=t.targetName??i[0];if(t.targetName&&!i.includes(t.targetName))return{success:!1,error:`Target '${t.targetName}' not found. Available: ${i.join(", ")}`};let u=a?o.targets[a]:void 0,p=r.find(C=>C.name===a);if(!p)return{success:!1,error:`Target config '${a}' not found in aws-targets`};if(t.agentRuntimeId)try{let C=await Ok({region:p.region,runtimeId:t.agentRuntimeId});return{success:!0,targetName:a,runtimeId:C.runtimeId,runtimeStatus:C.status}}catch(C){return{success:!1,error:Zt(C)}}if(n.agents.length===0)return{success:!1,error:"No agents defined in configuration"};let f=n.agents.map(C=>C.name),g=t.agentName?n.agents.find(C=>C.name===t.agentName):n.agents[0];if(t.agentName&&!g)return{success:!1,error:`Agent '${t.agentName}' not found. Available: ${f.join(", ")}`};if(!g)return{success:!1,error:"No agents defined in configuration"};let h=u?.resources?.agents?.[g.name];if(!h)return{success:!0,agentName:g.name,targetName:a,isDeployed:!1};try{let C=await Ok({region:p.region,runtimeId:h.runtimeId});return{success:!0,agentName:g.name,targetName:a,isDeployed:!0,runtimeId:C.runtimeId,runtimeStatus:C.status}}catch(C){return{success:!1,error:Zt(C)}}}async function vJ(e,t={}){let{project:n,deployedState:o,awsTargets:r}=e,i=Object.keys(o.targets);if(i.length===0)return{success:!1,error:"No deployed targets found. Run `agentcore deploy` first."};let a=t.targetName??i[0];if(t.targetName&&!i.includes(t.targetName))return{success:!1,error:`Target '${t.targetName}' not found. Available: ${i.join(", ")}`};let u=o.targets[a],p=r.find(g=>g.name===a);if(!p)return{success:!1,error:`Target config '${a}' not found in aws-targets`};if(n.agents.length===0)return{success:!1,error:"No agents defined in configuration"};let f=await Promise.all(n.agents.map(async g=>{let h=u?.resources?.agents?.[g.name];if(!h)return{agentName:g.name,isDeployed:!1};try{let C=await Ok({region:p.region,runtimeId:h.runtimeId});return{agentName:g.name,isDeployed:!0,runtimeId:C.runtimeId,runtimeStatus:C.status}}catch(C){return{agentName:g.name,isDeployed:!0,runtimeId:h.runtimeId,error:Zt(C)}}}));return{success:!0,targetName:a,entries:f}}await Jt();var NE=Q(Ne()),YEe=e=>{e.command("status").alias("s").description(Ws.status).option("--agent <name>","Select specific agent").option("--agent-runtime-id <id>","Select specific agent runtime ID").option("--target <name>","Select deployment target").action(async t=>{Ic();try{let a=function(g){if(g!==void 0)return g?"Deployed":"Not deployed"};var n=a;let o=await AL();if(!t.agent&&!t.agentRuntimeId){let g=await vJ(o,{targetName:t.target});if(!g.success||!g.entries){On((0,NE.jsx)(k,{color:"red",children:g.error}));return}On((0,NE.jsxs)(J,{flexDirection:"column",children:[(0,NE.jsxs)(k,{children:["AgentCore Status (target: ",g.targetName,")"]}),g.entries.map(h=>{let C=h.isDeployed?"Deployed":"Not deployed",R=h.runtimeStatus?`Runtime status: ${h.runtimeStatus}`:void 0,D=h.error?`Runtime error: ${h.error}`:void 0,B=[C,R,D].filter(Boolean).join(" - ");return(0,NE.jsxs)(k,{children:[h.agentName,": ",B]},h.agentName)})]}));return}let r=await JEe(o,{agentName:t.agent,agentRuntimeId:t.agentRuntimeId,targetName:t.target});if(!r.success){On((0,NE.jsx)(k,{color:"red",children:r.error}));return}let i=r.agentName??r.runtimeId??"Agent",u=a(r.isDeployed),p=r.runtimeStatus?`Runtime status: ${r.runtimeStatus}`:void 0,f=[u,p].filter(Boolean).join(" - ");On((0,NE.jsxs)(k,{children:["AgentCore Status - ",i," (target: ",r.targetName,")",f?` - ${f}`:""]}))}catch(o){On((0,NE.jsxs)(k,{color:"red",children:["Error: ",Zt(o)]})),process.exit(1)}})};Ci();XS();import{execSync as l_n}from"child_process";var ZEe=X8e();async function IJ(){let e=`${ZEe.registryUrl}/${ZEe.packageName}/latest`,t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch latest version: ${t.statusText}`);return(await t.json()).version}function _J(e,t){let n=e.split(".").map(Number),o=t.split(".").map(Number);for(let r=0;r<3;r++){let i=n[r]??0,a=o[r]??0;if(a>i)return 1;if(a<i)return-1}return 0}async function XEe(e){let t=await IJ(),n=_J(Il,t);if(n===0)return{status:"up-to-date",currentVersion:Il,latestVersion:t};if(n<0)return{status:"newer-local",currentVersion:Il,latestVersion:t};if(e)return{status:"update-available",currentVersion:Il,latestVersion:t};try{return l_n(ZEe.installCommand,{stdio:"inherit"}),{status:"updated",currentVersion:Il,latestVersion:t}}catch{return{status:"update-failed",currentVersion:Il,latestVersion:t}}}await Jt();var Og=Q(Ne()),eCe=e=>{e.command("update").description(Ws.update).option("-c, --check","Check for updates without installing").action(async t=>{try{On((0,Og.jsx)(k,{children:"Checking for updates..."}));let n=await XEe(t.check??!1);switch(n.status){case"up-to-date":On((0,Og.jsxs)(k,{color:"green",children:["You are already on the latest version (",n.currentVersion,")"]}));break;case"newer-local":On((0,Og.jsxs)(k,{color:"yellow",children:["Your version (",n.currentVersion,") is newer than the published version (",n.latestVersion,")"]}));break;case"update-available":On((0,Og.jsxs)(k,{children:["Update available: ",n.currentVersion," \u2192 ",(0,Og.jsx)(k,{color:"green",children:n.latestVersion})]})),On((0,Og.jsx)(k,{children:"Run `agentcore update` to install the update."}));break;case"updated":On((0,Og.jsxs)(k,{color:"green",children:["Successfully updated to ",n.latestVersion]}));break;case"update-failed":On((0,Og.jsx)(k,{color:"red",children:"Failed to install update. Try running: npm install -g @aws/agentcore@latest"})),process.exit(1);break}}catch(n){On((0,Og.jsxs)(k,{color:"red",children:["Error: ",Zt(n)]})),process.exit(1)}})};mn();async function nCe(e){let t=e.directory??process.cwd(),n=Ar(t);if(!n)return{success:!1,error:new ba().message};let o=new Rt({baseDir:n});try{await o.readProjectSpec()}catch(r){return{success:!1,error:tCe(r,"agentcore.json")}}try{await o.readAWSDeploymentTargets()}catch(r){return{success:!1,error:tCe(r,"aws-targets.json")}}if(o.configExists("state"))try{await o.readDeployedState()}catch(r){return{success:!1,error:tCe(r,".cli/state.json")}}return{success:!0}}function tCe(e,t){return e instanceof mI?e.message:e instanceof Jx?`Invalid JSON in ${t}: ${e.cause instanceof Error?e.cause.message:String(e.cause)}`:e instanceof Vx?`Failed to read ${t}: ${e.cause instanceof Error?e.cause.message:String(e.cause)}`:e instanceof qx?`Required file not found: ${t}`:e instanceof Error?e.message:String(e)}await Jt();var rCe=Q(Ne()),oCe=e=>{e.command("validate").option("-d, --directory <path>","Project directory containing agentcore config").description(Ws.validate).action(async t=>{let n=await nCe(t);n.success?(On((0,rCe.jsx)(k,{color:"green",children:"Valid"})),process.exit(0)):(On((0,rCe.jsx)(k,{color:"red",children:n.error})),process.exit(1))})};XS();mn();await xv();await Jt();var gar=Q(Xe()),Ov=Q(Ne());function iot(e){return er((t,n)=>{(n.escape||t==="b")&&e.onBack()}),(0,Ov.jsxs)(J,{flexDirection:"column",padding:1,children:[(0,Ov.jsx)(k,{bold:!0,children:e.command.title}),(0,Ov.jsx)(k,{dimColor:!0,children:e.command.description}),(0,Ov.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,Ov.jsxs)(k,{children:["TODO: implement ",e.command.id]}),(0,Ov.jsx)(k,{dimColor:!0,children:"Esc/B back"})]})]})}await NEe();await xv();await Jt();var sot=Q(Xe()),nu=Q(Ne()),d_n=50;function p_n(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}function iCe({commands:e}){let{exit:t}=yE(),{contentWidth:n}=IE(),o=LM(n);(0,sot.useEffect)(()=>{let i=setTimeout(()=>t(),0);return()=>clearTimeout(i)},[t]);let r=e.filter(i=>!i.disabled);return(0,nu.jsxs)(J,{flexDirection:"column",paddingY:1,children:[(0,nu.jsx)(k,{children:o}),(0,nu.jsx)(k,{children:" "}),(0,nu.jsx)(k,{bold:!0,color:"yellow",children:"Usage:"}),(0,nu.jsx)(k,{children:" agentcore [command]"}),(0,nu.jsx)(k,{children:" "}),(0,nu.jsx)(k,{bold:!0,color:"yellow",children:"Commands:"}),r.map(i=>{let a=p_n(i.description,d_n),u=" ".repeat(Math.max(1,14-i.title.length));return(0,nu.jsxs)(J,{children:[(0,nu.jsx)(k,{children:" "}),(0,nu.jsx)(k,{color:"cyan",children:i.title}),(0,nu.jsx)(k,{children:u}),(0,nu.jsx)(k,{dimColor:!0,children:a})]},i.id)}),(0,nu.jsx)(k,{children:" "}),(0,nu.jsx)(k,{dimColor:!0,children:"Run agentcore [command] --help for command-specific help"}),(0,nu.jsx)(k,{dimColor:!0,children:"Run agentcore (no args) for interactive mode"})]})}await Qr();await xv();await Na();await Jt();var vh=Q(Xe()),Wo=Q(Ne()),m_n=50;function f_n(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}function g_n({items:e,query:t,cursor:n,clampedIndex:o,notice:r}){let{contentWidth:i}=IE(),a="\u2500".repeat(i),u=(0,vh.useMemo)(()=>e.length===0?0:Math.max(...e.map(p=>p.matchedSubcommand?p.command.title.length+3+p.matchedSubcommand.length:p.command.title.length)),[e]);return(0,Wo.jsxs)(J,{flexDirection:"column",children:[(0,Wo.jsx)(k,{bold:!0,color:"cyan",children:"Commands"}),(0,Wo.jsxs)(J,{marginTop:1,flexShrink:0,children:[(0,Wo.jsx)(k,{color:"cyan",children:"> "}),(0,Wo.jsx)(k,{children:t.slice(0,n)}),(0,Wo.jsx)(eu,{}),(0,Wo.jsx)(k,{children:t.slice(n)})]}),(0,Wo.jsx)(J,{marginTop:1,flexDirection:"column",children:e.length===0?(0,Wo.jsxs)(J,{flexDirection:"column",children:[(0,Wo.jsxs)(k,{dimColor:!0,children:['No commands match "',t,'"']}),(0,Wo.jsx)(k,{dimColor:!0,children:"Esc to clear"})]}):e.map((p,f)=>{let g=f===o,h=p.matchedSubcommand?`${p.command.id}-${p.matchedSubcommand}`:p.command.id,C=f_n(p.command.description,m_n),R=p.matchedSubcommand?p.command.title.length+3+p.matchedSubcommand.length:p.command.title.length,D=" ".repeat(Math.max(1,u-R+2));return(0,Wo.jsxs)(J,{children:[(0,Wo.jsxs)(k,{color:g?"cyan":"white",children:[g?"\u276F":" "," "]}),(0,Wo.jsx)(k,{bold:g,color:g?"cyan":void 0,children:p.command.title}),p.matchedSubcommand&&(0,Wo.jsxs)(Wo.Fragment,{children:[(0,Wo.jsx)(k,{dimColor:!0,children:" \u2192 "}),(0,Wo.jsx)(k,{bold:g,color:g?"cyan":void 0,children:p.matchedSubcommand})]}),(0,Wo.jsx)(k,{children:D}),(0,Wo.jsx)(k,{dimColor:!0,children:C})]},h)})}),r&&(0,Wo.jsx)(J,{marginTop:1,children:r}),(0,Wo.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,Wo.jsx)(k,{dimColor:!0,children:a}),(0,Wo.jsx)(k,{dimColor:!0,children:pU.COMMANDS})]})]})}function sCe(e){let{commands:t,initialQuery:n,notice:o,onNoticeDismiss:r,onSelect:i,onBack:a}=e,[u,p]=(0,vh.useState)(0),[f,g]=(0,vh.useState)(!1),h=(0,vh.useRef)(null);(0,vh.useEffect)(()=>(f&&(h.current=setTimeout(()=>{g(!1)},3e3)),()=>{h.current&&clearTimeout(h.current)}),[f]);let{value:C,cursor:R,clear:D}=z_({initialValue:n??"",isActive:!0}),B=(0,vh.useMemo)(()=>t.filter(z=>!z.disabled).flatMap(z=>{if(!C)return[{command:z}];let Y=C.toLowerCase(),ee=z.id.toLowerCase().includes(Y),Z=z.subcommands.filter(Be=>Be.toLowerCase().includes(Y)),oe=[];ee&&oe.push({command:z});for(let Be of Z)ee||oe.push({command:z,matchedSubcommand:Be});return oe}),[t,C]),O=Math.min(u,Math.max(0,B.length-1));return er((z,Y)=>{if(o&&r&&r(),Y.escape){C?(D(),p(0),g(!1)):f?a():g(!0);return}if(f&&g(!1),Y.upArrow&&B.length>0){p(Z=>(Z-1+B.length)%B.length);return}if(Y.downArrow&&B.length>0){p(Z=>(Z+1)%B.length);return}let ee=B.at(O);if(Y.return&&ee){i(ee.command.id);return}}),(0,Wo.jsx)(Pp,{children:(0,Wo.jsx)(g_n,{items:B,query:C,cursor:R,clampedIndex:O,notice:f?(0,Wo.jsx)(k,{color:"yellow",children:"Press Esc again to exit"}):o})})}mn();await Qr();await xv();await Jt();var kar=Q(Xe()),si=Q(Ne());function A_n(){return(0,si.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,si.jsx)(k,{color:"yellow",children:"No AgentCore project found in this directory."}),(0,si.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,si.jsx)(k,{dimColor:!0,children:"You can:"}),(0,si.jsxs)(J,{marginLeft:2,flexDirection:"column",children:[(0,si.jsxs)(k,{children:[(0,si.jsx)(k,{color:"cyan",children:"create"}),(0,si.jsx)(k,{dimColor:!0,children:" - Create a new AgentCore project here"})]}),(0,si.jsx)(k,{dimColor:!0,children:"or cd into an existing project directory"})]})]})]})}function h_n(){return(0,si.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,si.jsx)(A_n,{}),(0,si.jsx)(J,{marginTop:1,children:(0,si.jsxs)(k,{children:[(0,si.jsx)(k,{color:"cyan",children:"\u2691 "}),(0,si.jsx)(k,{dimColor:!0,children:"Press Enter to create a new project"})]})})]})}function y_n(){return Ar()!==null}var E_n=9;function aCe({cwd:e,version:t,onShowHelp:n,onSelectCreate:o}){let{exit:r}=yE(),{contentWidth:i}=IE(),a=!y_n(),u=LM(i,t),p="\u2500".repeat(i);return er((f,g)=>{if(g.escape){r();return}if(g.return&&a){o();return}if(g.tab){n();return}f&&!g.ctrl&&!g.meta&&n(f)}),(0,si.jsx)(Pp,{children:(0,si.jsxs)(J,{flexDirection:"column",children:[(0,si.jsx)(k,{color:"cyan",children:u}),(0,si.jsx)(J,{marginTop:1,children:(0,si.jsxs)(J,{children:[(0,si.jsx)(k,{color:"cyan",children:"> "}),(0,si.jsx)(eu,{})]})}),a?(0,si.jsx)(h_n,{}):(0,si.jsx)(J,{height:E_n}),(0,si.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,si.jsx)(k,{dimColor:!0,children:p}),(0,si.jsx)(k,{dimColor:!0,children:pU.HOME})]})]})})}mn();await Qr();Tv();await Jt();var RJ=Q(Xe()),ru=Q(Ne());function cCe({isInteractive:e,onExit:t}){let[n,o]=(0,RJ.useState)({phase:"loading",projectName:null,steps:[],results:[],skipped:[],error:null,totalSize:null});(0,RJ.useEffect)(()=>{(async()=>{let a=Ar(process.cwd());if(!a){o(u=>({...u,phase:"error",error:"No AgentCore project found in current directory"}));return}try{let p=await new Rt({baseDir:a}).readProjectSpec(),f=p.agents;if(f.length===0){o({phase:"error",projectName:p.name,steps:[],results:[],skipped:[],error:"No agents found in project",totalSize:null});return}let g=f.map(O=>({label:O.name,status:"pending"}));o(O=>({...O,phase:"packaging",projectName:p.name,steps:g}));let h=await pL({}),C=[],R=[],D=[...g];for(let O=0;O<f.length;O++){let z=f[O];if(!z)continue;let Y=D[O];if(Y){D[O]={label:Y.label,status:"running"},o(ee=>({...ee,steps:[...D]})),await new Promise(ee=>setTimeout(ee,100));try{let ee={...h,targetAgent:z.name},Z=await mL(ee);if(Z.skipped.length>0)R.push(...Z.skipped),D[O]={label:z.name,status:"warn",warn:"Skipped: no container runtime available"},o(oe=>({...oe,steps:[...D],skipped:R}));else{let oe=Z.results[0];oe&&(C.push(oe),D[O]={label:`${z.name} \u2192 ${oe.artifactPath}`,status:"success",info:`${oe.sizeMb} MB`}),o(Be=>({...Be,steps:[...D],results:C}))}}catch(ee){let Z=ee instanceof Error?ee.message:String(ee);D[O]={label:z.name,status:"error",error:Z},o({phase:"error",projectName:p.name,steps:[...D],results:C,skipped:R,error:Z,totalSize:null});return}}}let B=C.reduce((O,z)=>O+parseFloat(z.sizeMb),0).toFixed(2);o({phase:"success",projectName:p.name,steps:D,results:C,skipped:R,error:null,totalSize:B})}catch(u){let p=u instanceof Error?u.message:String(u);o(f=>({...f,phase:"error",error:p}))}})()},[]);let r=n.projectName?(0,ru.jsxs)(J,{children:[(0,ru.jsx)(k,{children:"Project: "}),(0,ru.jsx)(k,{color:co.success,children:n.projectName})]}):void 0;return n.phase==="loading"?(0,ru.jsx)(tn,{title:"AgentCore Package",onExit:t,headerContent:r,children:(0,ru.jsx)(k,{dimColor:!0,children:"Loading project..."})}):(0,ru.jsx)(tn,{title:"AgentCore Package",onExit:t,headerContent:r,children:(0,ru.jsxs)(J,{flexDirection:"column",marginTop:1,children:[n.steps.length>0&&(0,ru.jsx)(ff,{steps:n.steps}),n.phase==="success"&&n.results.length>0&&(0,ru.jsx)(J,{marginTop:1,children:(0,ru.jsxs)(k,{color:co.success,children:["Packaged ",n.results.length," agent",n.results.length!==1?"s":""," (",n.totalSize," MB total)"]})}),n.phase==="success"&&n.results.length===0&&n.skipped.length>0&&(0,ru.jsx)(J,{marginTop:1,children:(0,ru.jsx)(k,{color:co.warning,children:"No agents packaged (all skipped)"})}),n.phase==="error"&&(0,ru.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,ru.jsx)(k,{color:co.error,children:"Packaging failed"}),n.error&&(0,ru.jsx)(k,{color:co.error,dimColor:!0,children:n.error})]})]})})}await Qr();Ci();var kl=Q(Xe());function aot(){let[e,t]=(0,kl.useState)({phase:"loading",targetIndex:0,allStatuses:{},statusesLoaded:!1});(0,kl.useEffect)(()=>{let h=!0;return AL().then(C=>{if(!h)return;if(!C.project.agents.length){t(D=>({...D,phase:"error",error:"No agents defined in configuration."}));return}if(Object.keys(C.deployedState.targets).length===0){t(D=>({...D,phase:"error",error:"No deployed targets found. Run `agentcore deploy` first."}));return}t(D=>({...D,phase:"ready",project:C.project,deployedState:C.deployedState,awsTargets:C.awsTargets}))}).catch(C=>{h&&t(R=>({...R,phase:"error",error:C.message}))}),()=>{h=!1}},[]);let n=(0,kl.useMemo)(()=>!e.project||!e.deployedState||!e.awsTargets?null:{project:e.project,deployedState:e.deployedState,awsTargets:e.awsTargets},[e.awsTargets,e.deployedState,e.project]),o=(0,kl.useMemo)(()=>e.deployedState?Object.keys(e.deployedState.targets):[],[e.deployedState]),r=o[e.targetIndex],i=(0,kl.useMemo)(()=>{if(!(!e.awsTargets||!r))return e.awsTargets.find(h=>h.name===r)},[e.awsTargets,r]),a=(0,kl.useMemo)(()=>{if(!e.project)return[];let h=e.deployedState?.targets?.[r??""]?.resources?.agents;return e.project.agents.map(C=>{let R=h?.[C.name];return{name:C.name,isDeployed:!!R,runtimeId:R?.runtimeId}})},[e.deployedState,e.project,r]),u=(0,kl.useMemo)(()=>{if(!(!e.deployedState||!r))return e.deployedState.targets[r]?.resources},[e.deployedState,r]),p=(0,kl.useCallback)(async()=>{if(!(!n||!r)){t(h=>({...h,phase:"fetching-statuses",statusesError:void 0}));try{let h=await vJ(n,{targetName:r});if(!h.success){t(R=>({...R,phase:"ready",statusesLoaded:!0,statusesError:h.error}));return}let C={};for(let R of h.entries??[])C[R.agentName]=R;t(R=>({...R,phase:"ready",allStatuses:C,statusesLoaded:!0,statusesError:void 0}))}catch(h){t(C=>({...C,phase:"ready",statusesLoaded:!0,statusesError:Zt(h)}))}}},[n,r]);(0,kl.useEffect)(()=>{e.phase==="ready"&&n&&!e.statusesLoaded&&p()},[e.phase,n,e.statusesLoaded,p]);let f=(0,kl.useCallback)(()=>{e.phase!=="ready"&&e.phase!=="fetching-statuses"||t(h=>({...h,statusesLoaded:!1}))},[e.phase]),g=(0,kl.useCallback)(()=>{o.length&&t(h=>({...h,targetIndex:(h.targetIndex+1)%o.length,allStatuses:{},statusesLoaded:!1,statusesError:void 0}))},[o.length]);return{phase:e.phase,error:e.error,project:e.project,projectName:e.project?.name??"Unknown",targetName:r??"Unknown",targetRegion:i?.region,agents:a,hasMultipleTargets:o.length>1,allStatuses:e.allStatuses,statusesLoading:e.phase==="fetching-statuses",statusesError:e.statusesError,deployedResources:u,cycleTarget:g,refreshStatuses:f}}await Jt();var cot=Q(Xe()),Zr=Q(Ne());function uot({isInteractive:e,onExit:t}){let{phase:n,error:o,project:r,projectName:i,targetName:a,targetRegion:u,hasMultipleTargets:p,allStatuses:f,statusesLoading:g,statusesError:h,deployedResources:C,cycleTarget:R,refreshStatuses:D}=aot(),B=(0,cot.useMemo)(()=>{let ee={};for(let[Z,oe]of Object.entries(f))ee[Z]={runtimeStatus:oe.isDeployed?oe.runtimeStatus:"not deployed",error:oe.error};return ee},[f]);if(er((ee,Z)=>{n!=="ready"&&n!=="fetching-statuses"||(ee==="t"&&p&&R(),ee==="r"&&Z.ctrl&&D())},{isActive:n==="ready"||n==="fetching-statuses"}),n==="loading")return(0,Zr.jsx)(tn,{title:"AgentCore Status",onExit:t,children:(0,Zr.jsx)(k,{dimColor:!0,children:"Loading project status..."})});if(n==="error")return(0,Zr.jsx)(tn,{title:"AgentCore Status",onExit:t,children:(0,Zr.jsx)(k,{color:"red",children:o})});let O=["Ctrl+R refresh runtime status"];p&&O.push("T target"),O.push("Esc back","Ctrl+C quit");let z=O.join(" \xB7 "),Y=(0,Zr.jsxs)(J,{flexDirection:"column",children:[(0,Zr.jsxs)(J,{children:[(0,Zr.jsx)(k,{children:"Project: "}),(0,Zr.jsx)(k,{color:"green",children:i})]}),(0,Zr.jsxs)(J,{children:[(0,Zr.jsx)(k,{children:"Target: "}),(0,Zr.jsxs)(k,{color:"yellow",children:[a,u?` (${u})`:""]})]})]});return(0,Zr.jsxs)(tn,{title:"AgentCore Status",onExit:t,helpText:z,headerContent:Y,children:[g&&(0,Zr.jsx)(J,{marginTop:1,children:(0,Zr.jsx)(k,{dimColor:!0,children:"Fetching runtime statuses..."})}),h&&(0,Zr.jsx)(J,{marginTop:1,children:(0,Zr.jsxs)(k,{color:"red",children:["Error fetching statuses: ",h]})}),r&&(0,Zr.jsx)(J,{marginTop:1,children:(0,Zr.jsx)(qM,{project:r,agentStatuses:B,deployedAgents:C?.agents})}),C?.mcp&&(Object.keys(C.mcp.gateways??{}).length>0||Object.keys(C.mcp.runtimes??{}).length>0||Object.keys(C.mcp.lambdas??{}).length>0)&&(0,Zr.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,Zr.jsx)(k,{bold:!0,dimColor:!0,children:"\u2500 Deployed MCP Resources \u2500"}),C.mcp.gateways&&Object.keys(C.mcp.gateways).length>0&&(0,Zr.jsx)(J,{flexDirection:"column",marginTop:1,children:Object.entries(C.mcp.gateways).map(([ee,Z])=>(0,Zr.jsx)(J,{marginLeft:2,children:(0,Zr.jsxs)(k,{children:[(0,Zr.jsxs)(k,{color:"yellow",children:["\u25C6 ",ee]}),(0,Zr.jsxs)(k,{dimColor:!0,children:[" ",Z.gatewayId]})]})},ee))}),C.mcp.runtimes&&Object.keys(C.mcp.runtimes).length>0&&(0,Zr.jsx)(J,{flexDirection:"column",marginTop:1,children:Object.entries(C.mcp.runtimes).map(([ee,Z])=>(0,Zr.jsx)(J,{marginLeft:2,children:(0,Zr.jsxs)(k,{children:[(0,Zr.jsxs)(k,{color:"magenta",children:["\u25B6 ",ee]}),(0,Zr.jsxs)(k,{dimColor:!0,children:[" ",Z.runtimeId]})]})},ee))}),C.mcp.lambdas&&Object.keys(C.mcp.lambdas).length>0&&(0,Zr.jsx)(J,{flexDirection:"column",marginTop:1,children:Object.entries(C.mcp.lambdas).map(([ee,Z])=>(0,Zr.jsx)(J,{marginLeft:2,children:(0,Zr.jsxs)(k,{children:[(0,Zr.jsxs)(k,{color:"magenta",children:["\u03BB ",ee]}),(0,Zr.jsxs)(k,{dimColor:!0,children:[" ",Z.functionName]})]})},ee))})]})]})}XS();await Qr();Tv();await Jt();var DJ=Q(Xe()),sr=Q(Ne());function uCe({isInteractive:e,onExit:t}){let[n,o]=(0,DJ.useState)({phase:"checking",currentVersion:Il,latestVersion:null,error:null});return(0,DJ.useEffect)(()=>{(async()=>{try{let a=await IJ(),u=_J(Il,a);u===0?o({phase:"up-to-date",currentVersion:Il,latestVersion:a,error:null}):u<0?o({phase:"newer-local",currentVersion:Il,latestVersion:a,error:null}):o({phase:"update-available",currentVersion:Il,latestVersion:a,error:null})}catch(a){let u=a instanceof Error?a.message:String(a);o(p=>({...p,phase:"error",error:u}))}})()},[]),(0,sr.jsx)(tn,{title:"AgentCore Update",onExit:t,children:(()=>{switch(n.phase){case"checking":return(0,sr.jsx)(J,{flexDirection:"column",marginTop:1,children:(0,sr.jsx)(Bd,{text:"Checking for updates..."})});case"up-to-date":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Current version: "}),(0,sr.jsx)(k,{color:co.success,children:n.currentVersion})]}),(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Latest version: "}),(0,sr.jsx)(k,{children:n.latestVersion})]}),(0,sr.jsx)(J,{marginTop:1,children:(0,sr.jsx)(k,{color:co.success,children:"You are on the latest version"})})]});case"newer-local":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Current version: "}),(0,sr.jsx)(k,{color:co.warning,children:n.currentVersion})]}),(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Latest version: "}),(0,sr.jsx)(k,{children:n.latestVersion})]}),(0,sr.jsx)(J,{marginTop:1,children:(0,sr.jsx)(k,{color:co.warning,children:"Your version is newer than the published version (dev build)"})})]});case"update-available":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Current version: "}),(0,sr.jsx)(k,{children:n.currentVersion})]}),(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Latest version: "}),(0,sr.jsx)(k,{color:co.success,children:n.latestVersion})]}),(0,sr.jsx)(J,{marginTop:1,children:(0,sr.jsx)(k,{color:co.info,children:"Update available!"})}),(0,sr.jsxs)(J,{marginTop:1,children:[(0,sr.jsx)(k,{dimColor:!0,children:"Run "}),(0,sr.jsx)(k,{color:co.info,children:"agentcore update"}),(0,sr.jsx)(k,{dimColor:!0,children:" from the command line to install"})]})]});case"updating":return(0,sr.jsx)(J,{flexDirection:"column",marginTop:1,children:(0,sr.jsx)(Bd,{text:"Installing update..."})});case"updated":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsx)(J,{children:(0,sr.jsxs)(k,{color:co.success,children:["Successfully updated to ",n.latestVersion]})}),(0,sr.jsx)(J,{marginTop:1,children:(0,sr.jsx)(k,{dimColor:!0,children:"Restart agentcore to use the new version"})})]});case"error":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsx)(k,{color:co.error,children:"Failed to check for updates"}),n.error&&(0,sr.jsx)(k,{color:co.error,dimColor:!0,children:n.error})]});default:return null}})()})}mn();await Qr();Tv();await Jt();var TJ=Q(Xe()),Lp=Q(Ne()),xJ=[{key:"project",label:"agentcore.json",required:!0},{key:"targets",label:"aws-targets.json",required:!0},{key:"mcp",label:"mcp.json",required:!1},{key:"mcpDefs",label:"mcp-defs.json",required:!1},{key:"state",label:".cli/state.json",required:!1}];function lCe({isInteractive:e,onExit:t}){let[n,o]=(0,TJ.useState)({phase:"validating",steps:xJ.map(i=>({label:i.label,status:"pending"})),projectName:null,error:null});(0,TJ.useEffect)(()=>{(async()=>{let a=Ar(process.cwd());if(!a){o(g=>({...g,phase:"error",error:"No AgentCore project found in current directory",steps:g.steps.map((h,C)=>C===0?{label:h.label,status:"error",error:"Project not found"}:h)}));return}let u=new Rt({baseDir:a}),p=null,f=xJ.map(g=>({label:g.label,status:"pending"}));for(let g=0;g<xJ.length;g++){let h=xJ[g];if(!h)continue;let C=f[g];if(C){f[g]={label:C.label,status:"running"},o(R=>({...R,steps:[...f]})),await new Promise(R=>setTimeout(R,100));try{h.key==="project"?(p=(await u.readProjectSpec()).name,f[g]={label:h.label,status:"success"}):h.key==="targets"?(await u.readAWSDeploymentTargets(),f[g]={label:h.label,status:"success"}):h.key==="mcp"?u.configExists("mcp")?(await u.readMcpSpec(),f[g]={label:h.label,status:"success"}):f[g]={label:h.label,status:"info",info:"Not present (optional)"}:h.key==="mcpDefs"?u.configExists("mcpDefs")?(await u.readMcpDefs(),f[g]={label:h.label,status:"success"}):f[g]={label:h.label,status:"info",info:"Not present (optional)"}:h.key==="state"&&(u.configExists("state")?(await u.readDeployedState(),f[g]={label:h.label,status:"success"}):f[g]={label:h.label,status:"info",info:"Not present (optional)"}),o(R=>({...R,steps:[...f],projectName:p}))}catch(R){let D=R instanceof Error?R.message:String(R);f[g]={label:h.label,status:"error",error:D},o({phase:"error",steps:[...f],projectName:p,error:D});return}}}o({phase:"success",steps:f,projectName:p,error:null})})()},[]);let r=n.projectName?(0,Lp.jsxs)(J,{children:[(0,Lp.jsx)(k,{children:"Project: "}),(0,Lp.jsx)(k,{color:co.success,children:n.projectName})]}):void 0;return(0,Lp.jsx)(tn,{title:"AgentCore Validate",onExit:t,headerContent:r,children:(0,Lp.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,Lp.jsx)(ff,{steps:n.steps}),n.phase==="success"&&(0,Lp.jsx)(J,{marginTop:1,children:(0,Lp.jsx)(k,{color:co.success,children:"All schemas valid"})}),n.phase==="error"&&(0,Lp.jsx)(J,{marginTop:1,children:(0,Lp.jsx)(k,{color:co.error,children:"Validation failed"})}),(n.phase==="success"||n.phase==="error")&&(0,Lp.jsx)(Np,{steps:[],isInteractive:e,onBack:t,isActive:!0})]})})}gme();await Jt();var dCe=Q(Xe()),xc=Q(Ne()),lot=Yc(),C_n=new Set(["create","update"]);function S_n(){let{exit:e}=yE(),t=qW(),n=zye(),o=t?{name:"help"}:{name:"home"},[r,i]=(0,dCe.useState)(o),[a,u]=(0,dCe.useState)(null),p=pCe(),f=H2(p,{inProject:t}),g=h=>{let C=f.find(R=>R.id===h);if(C){if(h!=="add"&&u(null),n&&!C_n.has(h)){u((0,xc.jsx)(Hye,{projectRoot:n}));return}if(h==="dev")i({name:"dev"});else if(h==="deploy")i({name:"deploy"});else if(h==="invoke")i({name:"invoke"});else if(h==="status")i({name:"status"});else if(h==="create")i({name:"create"});else if(h==="add"){if(!qW()&&r.name==="help"){u((0,xc.jsx)(jye,{inTui:!0}));return}i({name:"add"})}else i(h==="remove"?{name:"remove"}:h==="validate"?{name:"validate"}:h==="package"?{name:"package"}:h==="update"?{name:"update"}:{name:"command",command:C})}};return r.name==="home"?(0,xc.jsx)(aCe,{cwd:lot,version:p.version()??"0.0.0",onShowHelp:h=>i({name:"help",initialQuery:h}),onSelectCreate:()=>i({name:"create"})}):r.name==="help"?(0,xc.jsx)(sCe,{commands:f,initialQuery:r.initialQuery,notice:a??void 0,onNoticeDismiss:()=>u(null),onSelect:g,onBack:()=>{u(null),e()}}):r.name==="dev"?(0,xc.jsx)(OEe,{onBack:()=>i({name:"help"})}):r.name==="deploy"?(0,xc.jsx)(hJ,{isInteractive:!0,onExit:()=>i({name:"help"}),onNavigate:h=>i({name:h})}):r.name==="invoke"?(0,xc.jsx)(aR,{isInteractive:!0,onExit:()=>i({name:"help"})}):r.name==="status"?(0,xc.jsx)(uot,{isInteractive:!0,onExit:()=>i({name:"help"})}):r.name==="add"?(0,xc.jsx)(lJ,{isInteractive:!0,onExit:()=>i({name:"help"}),onDev:()=>i({name:"dev"}),onDeploy:()=>i({name:"deploy"})}):r.name==="remove"?(0,xc.jsx)(AB,{isInteractive:!0,onExit:()=>i({name:"help"}),onNavigate:h=>i({name:h})}):r.name==="create"?(0,xc.jsx)(dL,{cwd:lot,isInteractive:!0,onExit:()=>i({name:"help"}),onNavigate:({command:h,workingDir:C})=>{process.chdir(C),i({name:h})}}):r.name==="validate"?(0,xc.jsx)(lCe,{isInteractive:!0,onExit:()=>i({name:"help"})}):r.name==="package"?(0,xc.jsx)(cCe,{isInteractive:!0,onExit:()=>i({name:"help"})}):r.name==="update"?(0,xc.jsx)(uCe,{isInteractive:!0,onExit:()=>i({name:"help"})}):(0,xc.jsx)(iot,{command:r.command,onBack:()=>i({name:"help"})})}function dot(){return(0,xc.jsx)(j_,{children:(0,xc.jsx)(S_n,{})})}await xv();eh();var Dot=Q(Rot(),1),{program:Wcr,createCommand:Jcr,createArgument:Ycr,createOption:Zcr,CommanderError:Xcr,InvalidArgumentError:eur,InvalidOptionArgumentError:tur,Command:xot,Argument:nur,Option:rur,Help:our}=Dot.default;await Jt();var PJ=Q(Xe()),M_n="\x1B[?1049h\x1B[H",Tot="\x1B[?1049l",bot="\x1B[?25h",wCe=!1;function L_n(){let e=()=>{wCe&&process.stdout.write(Tot),process.stdout.write(bot)};process.on("exit",e),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("SIGTERM",()=>{e(),process.exit(0)})}function Q_n(){wCe=!0,process.stdout.write(M_n);let{waitUntilExit:e}=On(PJ.default.createElement(dot));e().then(()=>{wCe=!1,process.stdout.write(Tot),process.stdout.write(bot);let t=drt();t&&(console.log(t),prt())})}function U_n(e){let t=H2(e);On(PJ.default.createElement(j_,null,PJ.default.createElement(iCe,{commands:t})))}function pCe(){let e=new xot;e.name("agentcore").description(Ws.program).version(Il).showHelpAfterError().showSuggestionAfterError(),e.addHelpCommand(!1),e.helpOption("-h, --help","Display help"),e.on("option:help",()=>{U_n(e),process.exit(0)}),F_n(e);let t="\nRun without flags for interactive mode. Flags marked [non-interactive] trigger CLI mode.\nRun `agentcore help modes` for details.";return e.commands.forEach(n=>{n.addHelpText("after",t),n.commands.forEach(o=>{o.addHelpText("after",t)})}),e}function F_n(e){IEe(e),kEe(e),PEe(e),TEe(e),$Ee(e),UEe(e),FEe(e),WEe(e),YEe(e),eCe(e),oCe(e)}var wot=async e=>{L_n();let t=pCe();if(e.slice(2).length===0){Q_n();return}await t.parseAsync(e)};Ci();wot(process.argv).catch(e=>{console.error(Zt(e)),process.exit(1)});
736
+ `),r=n.length,i=o.length,a=Array.from({length:r+1},()=>Array(i+1).fill(0));for(let D=1;D<=r;D++)for(let B=1;B<=i;B++)n[D-1]===o[B-1]?a[D][B]=a[D-1][B-1]+1:a[D][B]=Math.max(a[D-1][B],a[D][B-1]);let u=r,p=i,f=[];for(;u>0||p>0;)u>0&&p>0&&n[u-1]===o[p-1]?(f.unshift(` ${n[u-1]}`),u--,p--):p>0&&(u===0||a[u][p-1]>=a[u-1][p])?(f.unshift(`+ ${o[p-1]}`),p--):u>0&&(f.unshift(`- ${n[u-1]}`),u--);let g=[],h=[],C=[],R=()=>{g.push(...h),g.push(...C),h=[],C=[]};for(let D of f)D.startsWith("- ")?(C.length>0&&R(),h.push(D)):D.startsWith("+ ")?C.push(D):(R(),g.push(D));return R(),e_n(g,2)}function e_n(e,t){let n=[],o=[];if(e.forEach((a,u)=>{(a.startsWith("- ")||a.startsWith("+ "))&&o.push(u)}),o.length===0)return[" (no changes)"];let r=new Set;for(let a of o)for(let u=Math.max(0,a-t);u<=Math.min(e.length-1,a+t);u++)r.add(u);let i=-2;for(let a=0;a<e.length;a++)r.has(a)&&(i<a-1&&i>=0&&n.push(" ..."),n.push(e[a]),i=a);return n}function t_n({changes:e,maxHeight:t=30,minHeight:n=6}){let{stdout:o}=Tl(),[r,i]=(0,CJ.useState)(0),a=(0,CJ.useMemo)(()=>{let D=[];for(let B of e){D.push(`\u2500\u2500\u2500 ${B.file} \u2500\u2500\u2500`);let O=XIn(B.before,B.after);D.push(...O)}return D},[e]),u=o?.rows??24,p=Math.max(n,Math.min(t,u-14)),f=Math.min(p,a.length),g=a.length,h=Math.max(0,g-f),C=g>f;er((D,B)=>{C&&(B.upArrow&&i(O=>Math.max(0,O-1)),B.downArrow&&i(O=>Math.min(h,O+1)))});let R=a.slice(r,r+f);return(0,$i.jsxs)(J,{flexDirection:"column",children:[(0,$i.jsx)(J,{flexDirection:"column",height:C?f:void 0,children:R.map((D,B)=>D.startsWith("\u2500\u2500\u2500")?(0,$i.jsx)(k,{bold:!0,color:"cyan",children:D},r+B):D.startsWith("- ")?(0,$i.jsx)(k,{color:"red",children:D},r+B):D.startsWith("+ ")?(0,$i.jsx)(k,{color:"green",children:D},r+B):(0,$i.jsx)(k,{dimColor:!0,children:D},r+B))}),C&&(0,$i.jsxs)(k,{dimColor:!0,children:["[",r+1,"-",Math.min(r+f,g)," of ",g,"] \u2191\u2193 scroll"]})]})}function cR({title:e,preview:t,onConfirm:n,onCancel:o}){er((i,a)=>{a.return&&n(),a.escape&&o()});let r=(0,$i.jsx)(J,{flexDirection:"column",borderStyle:"round",borderColor:"gray",paddingX:1,children:t.summary.map((i,a)=>{let u=i.indexOf(":");if(u>0&&u<20){let p=i.slice(0,u+1),f=i.slice(u+1);return(0,$i.jsxs)(J,{children:[(0,$i.jsx)(k,{children:p}),(0,$i.jsx)(k,{color:"cyan",children:f})]},a)}return i.startsWith("[cascade]")?(0,$i.jsx)(k,{color:"yellow",children:i},a):i.startsWith("BLOCKED")?(0,$i.jsx)(k,{color:"red",children:i},a):(0,$i.jsx)(k,{children:i},a)})});return(0,$i.jsx)(tn,{title:e,onExit:o,helpText:Nn.CONFIRM_CANCEL,headerContent:r,children:(0,$i.jsxs)(J,{flexDirection:"column",flexGrow:1,children:[t.schemaChanges.length>0&&(0,$i.jsx)(t_n,{changes:t.schemaChanges}),(0,$i.jsxs)(J,{marginTop:1,children:[(0,$i.jsx)(k,{color:"yellow",children:"\u25B6 "}),(0,$i.jsx)(k,{children:"Press "}),(0,$i.jsx)(k,{bold:!0,color:"green",children:"Enter"}),(0,$i.jsx)(k,{children:" to remove, "}),(0,$i.jsx)(k,{bold:!0,children:"Esc"}),(0,$i.jsx)(k,{children:" to cancel"})]})]})})}await Qr();var lr=Q(Xe());function Prt(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await qye();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await qye();t(o)},[]);return{agents:e??[],isLoading:e===null,refresh:n}}function Ort(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await Vye();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await Vye();t(o)},[]);return{gateways:e??[],isLoading:e===null,refresh:n}}function Nrt(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await XM();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await XM();t(o)},[]);return{tools:e??[],isLoading:e===null,refresh:n}}function krt(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await Yye();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await Yye();t(o)},[]);return{memories:e??[],isLoading:e===null,refresh:n}}function $rt(){let[e,t]=(0,lr.useState)(null);(0,lr.useEffect)(()=>{async function o(){let r=await Zye();t(r)}o()},[]);let n=(0,lr.useCallback)(async()=>{let o=await Zye();t(o)},[]);return{identities:e??[],isLoading:e===null,refresh:n}}function Mrt(){let[e,t]=(0,lr.useState)({isLoading:!1,preview:null,error:null}),n=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await Xtt(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),o=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await ent(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),r=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await nnt(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),i=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await int(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),a=(0,lr.useCallback)(async p=>{t({isLoading:!0,preview:null,error:null});try{let f=await snt(p);return t({isLoading:!1,preview:f,error:null}),{ok:!0,preview:f}}catch(f){let g=f instanceof Error?f.message:"Failed to load preview";return t({isLoading:!1,preview:null,error:g}),{ok:!1,error:g}}},[]),u=(0,lr.useCallback)(()=>{t({isLoading:!1,preview:null,error:null})},[]);return{...e,loadAgentPreview:n,loadGatewayPreview:o,loadMcpToolPreview:r,loadMemoryPreview:i,loadIdentityPreview:a,reset:u}}function Lrt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await WW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"agent",resourceName:a});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}function Qrt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await JW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"gateway",resourceName:a});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}function Urt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await YW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"mcp-tool",resourceName:a.name});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}function Frt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await ZW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"memory",resourceName:a});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}function Grt(){let[e,t]=(0,lr.useState)({isLoading:!1,result:null}),[n,o]=(0,lr.useState)(null),r=(0,lr.useCallback)(async(a,u)=>{t({isLoading:!0,result:null});let p=await XW(a);t({isLoading:!1,result:p});let f;if(u){let g=new OE({resourceType:"identity",resourceName:a});g.logRemoval(u,p.ok,p.ok?void 0:p.error),f=g.getAbsoluteLogPath(),o(f)}return{...p,logFilePath:f}},[]),i=(0,lr.useCallback)(()=>{t({isLoading:!1,result:null}),o(null)},[]);return{...e,logFilePath:n,remove:r,reset:i}}await Qr();var Cir=Q(Xe()),zrt=Q(Ne());function zEe({gateways:e,onSelect:t,onExit:n}){let o=e.map(r=>({id:r,title:r,description:`Remove gateway "${r}"`}));return(0,zrt.jsx)(Pl,{title:"Select Gateway to Remove",items:o,onSelect:r=>t(r.id),onExit:n})}await Qr();var _ir=Q(Xe()),jrt=Q(Ne());function jEe({identities:e,onSelect:t,onExit:n}){let o=e.map(r=>({id:r.name,title:r.name,description:r.type}));return(0,jrt.jsx)(Pl,{title:"Select Credential to Remove",items:o,onSelect:r=>t(r.id),onExit:n})}await Qr();var Tir=Q(Xe()),Hrt=Q(Ne());function HEe({tools:e,onSelect:t,onExit:n}){let o=e.map(i=>({id:i.name,title:i.name,description:i.type==="mcp-runtime"?"MCP Runtime tool":`Gateway target (${i.gatewayName})`})),r=new Map(e.map(i=>[i.name,i]));return(0,Hrt.jsx)(Pl,{title:"Select MCP Tool to Remove",items:o,onSelect:i=>{let a=r.get(i.id);a&&t(a)},onExit:n})}await Qr();var Pir=Q(Xe()),Krt=Q(Ne());function KEe({memories:e,onSelect:t,onExit:n}){let o=e.map(r=>({id:r.name,title:r.name,description:"AgentCore Memory"}));return(0,Krt.jsx)(Pl,{title:"Select Memory to Remove",items:o,onSelect:r=>t(r.id),onExit:n})}await Qr();var qrt=Q(Xe()),Vrt=Q(Ne()),n_n=[{id:"agent",title:"Agent",description:"Remove an agent from the project"},{id:"memory",title:"Memory",description:"Remove a memory provider"},{id:"identity",title:"Identity",description:"Remove an identity provider"},{id:"gateway",title:"Gateway (coming soon)",description:"Remove an MCP gateway",disabled:!0},{id:"mcp-tool",title:"MCP Tool (coming soon)",description:"Remove an MCP tool",disabled:!0},{id:"all",title:"All",description:"Reset entire agentcore project"}];function qEe({onSelect:e,onExit:t,agentCount:n,gatewayCount:o,mcpToolCount:r,memoryCount:i,identityCount:a}){let u=(0,qrt.useMemo)(()=>n_n.map(f=>{let g="disabled"in f&&f.disabled||!1,h=f.description;switch(f.id){case"agent":n===0&&(g=!0,h="No agents to remove");break;case"memory":i===0&&(g=!0,h="No memories to remove");break;case"identity":a===0&&(g=!0,h="No identities to remove");break;case"all":break}return{...f,disabled:g,description:h}}),[n,i,a]);return(0,Vrt.jsx)(Pl,{title:"Remove Resource",items:u,onSelect:f=>e(f.id),onExit:t,isDisabled:f=>f.disabled??!1})}await Qr();await Jt();var Qir=Q(Xe()),zu=Q(Ne()),r_n=[{command:"remove",label:"Remove another resource"}];function uR({isInteractive:e,message:t,detail:n,logFilePath:o,onRemoveAnother:r,onExit:i}){let a=u=>{u.command==="remove"&&r()};return e?(0,zu.jsx)(tn,{title:"Success",onExit:i,children:(0,zu.jsxs)(J,{flexDirection:"column",gap:1,children:[(0,zu.jsxs)(J,{flexDirection:"column",children:[(0,zu.jsxs)(k,{color:"green",children:["\u2713 ",t]}),n&&(0,zu.jsx)(k,{children:n}),(0,zu.jsx)(k,{dimColor:!0,children:"Your source code has not been modified."}),o&&(0,zu.jsx)(yf,{filePath:o,label:"Diff"})]}),(0,zu.jsx)(Np,{steps:r_n,isInteractive:!0,onSelect:a,onBack:i})]})}):(0,zu.jsx)(tn,{title:"Success",onExit:i,children:(0,zu.jsxs)(J,{flexDirection:"column",children:[(0,zu.jsxs)(k,{color:"green",children:["\u2713 ",t]}),n&&(0,zu.jsx)(k,{children:n}),(0,zu.jsx)(k,{dimColor:!0,children:"Your source code has not been modified."}),o&&(0,zu.jsx)(yf,{filePath:o,label:"Diff"})]})})}await Jt();var gB=Q(Xe(),1);await Jt();var Xrt=Q(Zrt(),1);function i_n({type:e="dots"}){let[t,n]=(0,gB.useState)(0),o=Xrt.default[e];return(0,gB.useEffect)(()=>{let r=setInterval(()=>{n(i=>i===o.frames.length-1?0:i+1)},o.interval);return()=>{clearInterval(r)}},[o]),gB.default.createElement(k,null,o.frames[t])}var eot=i_n;var ws=Q(Xe()),bs=Q(Ne());function AB({isInteractive:e,onExit:t,onNavigate:n,force:o=!1,initialResourceType:r,initialResourceName:i}){let a=()=>{if(!r)return{name:"select"};switch(r){case"agent":return{name:"select-agent"};case"gateway":return{name:"select-gateway"};case"mcp-tool":return{name:"select-mcp-tool"};case"memory":return{name:"select-memory"};case"identity":return{name:"select-identity"};default:return{name:"select"}}},[u,p]=(0,ws.useState)(a),{agents:f,isLoading:g,refresh:h}=Prt(),{gateways:C,isLoading:R,refresh:D}=Ort(),{tools:B,isLoading:O,refresh:z}=Nrt(),{memories:Y,isLoading:ee,refresh:Z}=krt(),{identities:oe,isLoading:Be,refresh:Ce}=$rt(),pe=g||R||O||ee||Be,{loadAgentPreview:ne,loadGatewayPreview:ie,loadMcpToolPreview:we,loadMemoryPreview:de,loadIdentityPreview:ze,reset:Pe}=Mrt(),{remove:fe,reset:De}=Lrt(),{remove:Re,reset:je}=Qrt(),{remove:et,reset:on}=Urt(),{remove:ce,reset:Ke}=Frt(),{remove:ht,reset:ot}=Grt(),it=(0,ws.useRef)(null),[Wt,Vt]=(0,ws.useState)(!1);(0,ws.useEffect)(()=>{if(u.name==="loading"&&Wt&&it.current){let Je=it.current;it.current=null,setTimeout(()=>{Vt(!1),p(Je)},0)}},[u.name,Wt]),(0,ws.useEffect)(()=>{e||["agent-success","gateway-success","tool-success","memory-success","identity-success"].includes(u.name)&&t()},[e,u.name,t]);let gn=(0,ws.useRef)(!1),Ot=(0,ws.useCallback)(Je=>{switch(Je){case"agent":p({name:"select-agent"});break;case"gateway":p({name:"select-gateway"});break;case"mcp-tool":p({name:"select-mcp-tool"});break;case"memory":p({name:"select-memory"});break;case"identity":p({name:"select-identity"});break;case"all":p({name:"remove-all"});break}},[]),st=(0,ws.useCallback)(async Je=>{let Ht=await ne(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing agent ${Je}...`});let Gn=await fe(Je,Ht.preview);Gn.ok?p({name:"agent-success",agentName:Je}):p({name:"error",message:Gn.error})}else p({name:"confirm-agent",agentName:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[ne,o,fe]),nt=(0,ws.useCallback)(async Je=>{let Ht=await ie(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing gateway ${Je}...`});let Gn=await Re(Je,Ht.preview);Gn.ok?p({name:"gateway-success",gatewayName:Je}):p({name:"error",message:Gn.error})}else p({name:"confirm-gateway",gatewayName:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[ie,o,Re]),lt=(0,ws.useCallback)(async Je=>{let Ht=await we(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing MCP tool ${Je.name}...`});let Gn=await et(Je,Ht.preview);Gn.ok?p({name:"tool-success",toolName:Je.name}):p({name:"error",message:Gn.error})}else p({name:"confirm-mcp-tool",tool:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[we,o,et]),Nt=(0,ws.useCallback)(async Je=>{let Ht=await de(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing memory ${Je}...`});let Gn=await ce(Je,Ht.preview);Gn.ok?p({name:"memory-success",memoryName:Je}):p({name:"error",message:Gn.error})}else p({name:"confirm-memory",memoryName:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[de,o,ce]),mt=(0,ws.useCallback)(async Je=>{let Ht=await ze(Je);if(Ht.ok)if(o){p({name:"loading",message:`Removing identity ${Je}...`});let Gn=await ht(Je,Ht.preview);Gn.ok?p({name:"identity-success",identityName:Je}):p({name:"error",message:Gn.error})}else p({name:"confirm-identity",identityName:Je,preview:Ht.preview});else p({name:"error",message:Ht.error})},[ze,o,ht]);(0,ws.useEffect)(()=>{!i||pe||gn.current||(gn.current=!0,setTimeout(()=>{switch(r){case"agent":st(i);break;case"gateway":nt(i);break;case"memory":Nt(i);break;case"identity":mt(i);break}},0))},[i,r,pe,st,nt,Nt,mt]);let Gt=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing agent ${Je}...`});let Gn=await fe(Je,Ht);Gn.ok?it.current={name:"agent-success",agentName:Je,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[fe]),$n=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing gateway ${Je}...`});let Gn=await Re(Je,Ht);Gn.ok?it.current={name:"gateway-success",gatewayName:Je,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[Re]),kt=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing MCP tool ${Je.name}...`});let Gn=await et(Je,Ht);Gn.ok?it.current={name:"tool-success",toolName:Je.name,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[et]),$t=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing memory ${Je}...`});let Gn=await ce(Je,Ht);Gn.ok?it.current={name:"memory-success",memoryName:Je,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[ce]),Eo=(0,ws.useCallback)(async(Je,Ht)=>{it.current=null,Vt(!1),p({name:"loading",message:`Removing identity ${Je}...`});let Gn=await ht(Je,Ht);Gn.ok?it.current={name:"identity-success",identityName:Je,logFilePath:Gn.logFilePath}:it.current={name:"error",message:Gn.error},Vt(!0)},[ht]),Mo=(0,ws.useCallback)(()=>{Pe(),De(),je(),on(),Ke(),ot()},[Pe,De,je,on,Ke,ot]),ln=(0,ws.useCallback)(async()=>{await Promise.all([h(),D(),z(),Z(),Ce()])},[h,D,z,Z,Ce]);return u.name==="select"?pe?null:(0,bs.jsx)(qEe,{onSelect:Ot,onExit:t,agentCount:f.length,gatewayCount:C.length,mcpToolCount:B.length,memoryCount:Y.length,identityCount:oe.length}):u.name==="loading"?(0,bs.jsx)(tn,{title:"Remove Resource",onExit:()=>{},children:(0,bs.jsx)(Nr,{children:(0,bs.jsxs)(k,{children:[(0,bs.jsx)(eot,{type:"dots"})," ",u.message]})})}):u.name==="select-agent"?i&&pe?null:(0,bs.jsx)(GEe,{agents:f,onSelect:Je=>{st(Je)},onExit:()=>p({name:"select"})}):u.name==="select-gateway"?i&&pe?null:(0,bs.jsx)(zEe,{gateways:C,onSelect:Je=>{nt(Je)},onExit:()=>p({name:"select"})}):u.name==="select-mcp-tool"?(0,bs.jsx)(HEe,{tools:B,onSelect:Je=>{lt(Je)},onExit:()=>p({name:"select"})}):u.name==="select-memory"?i&&pe?null:(0,bs.jsx)(KEe,{memories:Y,onSelect:Je=>{Nt(Je)},onExit:()=>p({name:"select"})}):u.name==="select-identity"?i&&pe?null:(0,bs.jsx)(jEe,{identities:oe,onSelect:Je=>{mt(Je)},onExit:()=>p({name:"select"})}):u.name==="confirm-agent"?(0,bs.jsx)(cR,{title:`Remove Agent: ${u.agentName}`,preview:u.preview,onConfirm:()=>{Gt(u.agentName,u.preview)},onCancel:()=>p({name:"select-agent"})}):u.name==="confirm-gateway"?(0,bs.jsx)(cR,{title:`Remove Gateway: ${u.gatewayName}`,preview:u.preview,onConfirm:()=>{$n(u.gatewayName,u.preview)},onCancel:()=>p({name:"select-gateway"})}):u.name==="confirm-mcp-tool"?(0,bs.jsx)(cR,{title:`Remove MCP Tool: ${u.tool.name}`,preview:u.preview,onConfirm:()=>{kt(u.tool,u.preview)},onCancel:()=>p({name:"select-mcp-tool"})}):u.name==="confirm-memory"?(0,bs.jsx)(cR,{title:`Remove Memory: ${u.memoryName}`,preview:u.preview,onConfirm:()=>{$t(u.memoryName,u.preview)},onCancel:()=>p({name:"select-memory"})}):u.name==="confirm-identity"?(0,bs.jsx)(cR,{title:`Remove Identity: ${u.identityName}`,preview:u.preview,onConfirm:()=>{Eo(u.identityName,u.preview)},onCancel:()=>p({name:"select-identity"})}):u.name==="agent-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed agent: ${u.agentName}`,detail:"Agent removed from agentcore.json. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="gateway-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed gateway: ${u.gatewayName}`,detail:"Gateway removed from mcp.json. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="tool-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed MCP tool: ${u.toolName}`,detail:"MCP tool removed. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="memory-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed memory: ${u.memoryName}`,detail:"Memory provider removed from agentcore.json. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="identity-success"?(0,bs.jsx)(uR,{isInteractive:e,message:`Removed identity: ${u.identityName}`,detail:"Identity provider removed from agentcore.json. Deploy with `agentcore deploy` to apply changes.",logFilePath:u.logFilePath,onRemoveAnother:()=>{Mo(),ln().then(()=>p({name:"select"}))},onExit:t}):u.name==="remove-all"?(0,bs.jsx)(fL,{isInteractive:e,onExit:t,onNavigate:n}):(0,bs.jsx)(Op,{message:"Failed to remove resource",detail:u.message,onBack:()=>{Mo(),p({name:"select"})},onExit:t})}mn();Ci();var gL="Your agent app source code has not been modified. Deploy with `agentcore deploy` to apply your removal changes to AWS.";async function tot(e){let{resourceType:t,name:n}=e;try{switch(t){case"agent":{let o=await WW(n);return o.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed agent '${n}'`,note:gL}:{success:!1,error:o.error}}case"gateway":{let o=await JW(n);return o.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed gateway '${n}'`,note:gL}:{success:!1,error:o.error}}case"mcp-tool":{let r=(await XM()).find(a=>a.name===n);if(!r)return{success:!1,error:`MCP tool '${n}' not found`};let i=await YW(r);return i.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed MCP tool '${n}'`,note:gL}:{success:!1,error:i.error}}case"memory":{let o=await ZW(n);return o.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed memory '${n}'`,note:gL}:{success:!1,error:o.error}}case"identity":{let o=await XW(n);return o.ok?{success:!0,resourceType:t,resourceName:n,message:`Removed identity '${n}'`,note:gL}:{success:!1,error:o.error}}default:return{success:!1,error:`Unknown resource type: ${t}`}}}catch(o){return{success:!1,error:Zt(o)}}}async function not(e){try{let t=new Rt,n="Project";try{n=(await t.readProjectSpec()).name}catch{}return await t.writeProjectSpec({name:n,version:1,agents:[],memories:[],credentials:[]}),{success:!0,message:"All schemas reset to empty state",note:"Your source code has not been modified. Run `agentcore deploy` to apply changes to AWS."}}catch(t){return{success:!1,error:Zt(t)}}}function rot(e){return e.json&&!e.name?{valid:!1,error:"--name is required for JSON output"}:{valid:!0}}function oot(e){return{valid:!0}}await Jt();var wsr=Q(Xe()),lR=Q(Ne());function s_n(e={}){let{unmount:t}=On((0,lR.jsx)(fL,{isInteractive:!1,force:e.force,dryRun:e.dryRun,onExit:()=>{t(),process.exit(0)}}))}function a_n(e,t){let{clear:n,unmount:o}=On((0,lR.jsx)(AB,{isInteractive:!1,force:t.force,initialResourceType:e,initialResourceName:t.name,onExit:()=>{n(),o(),process.exit(0)}}))}async function c_n(e){let t=rot(e);t.valid||(console.log(JSON.stringify({success:!1,error:t.error})),process.exit(1));let n=await tot({resourceType:e.resourceType,name:e.name,force:e.force});console.log(JSON.stringify(n)),process.exit(n.success?0:1)}async function u_n(e){oot(e);let t=await not(e);console.log(JSON.stringify(t)),process.exit(t.success?0:1)}function VEe(e,t,n,o){e.command(t).description(o).option("--name <name>","Name of resource to remove [non-interactive]").option("--force","Skip confirmation prompt [non-interactive]").option("--json","Output as JSON [non-interactive]").action(async r=>{try{Ic(),r.name||r.force||r.json?await c_n({resourceType:n,name:r.name,force:r.force,json:r.json}):a_n(n,{})}catch(i){r.json?console.log(JSON.stringify({success:!1,error:Zt(i)})):On((0,lR.jsxs)(k,{color:"red",children:["Error: ",Zt(i)]})),process.exit(1)}})}var WEe=e=>{let t=e.command("remove").description(Ws.remove);t.command("all").description("Reset all agentcore schemas to empty state").option("--force","Skip confirmation prompts [non-interactive]").option("--dry-run","Show what would be reset without actually resetting [non-interactive]").option("--json","Output as JSON [non-interactive]").action(async n=>{try{n.force||n.dryRun||n.json?await u_n({force:n.force,dryRun:n.dryRun,json:n.json}):s_n({})}catch(o){n.json?console.log(JSON.stringify({success:!1,error:Zt(o)})):On((0,lR.jsxs)(k,{color:"red",children:["Error: ",Zt(o)]})),process.exit(1)}}),VEe(t,"agent","agent","Remove an agent from the project"),VEe(t,"memory","memory","Remove a memory provider from the project"),VEe(t,"identity","identity","Remove an identity provider from the project"),t.command("mcp-tool",{hidden:!0}).description("Remove an MCP tool from the project").option("--name <name>","Name of resource to remove").option("--force","Skip confirmation prompt").option("--json","Output as JSON").action(()=>{console.error("MCP Tool integration is coming soon."),process.exit(1)}),t.command("gateway",{hidden:!0}).description("Remove a gateway from the project").option("--name <name>","Name of resource to remove").option("--force","Skip confirmation prompt").option("--json","Output as JSON").action(()=>{console.error("AgentCore Gateway integration is coming soon."),process.exit(1)}),t.argument("[subcommand]").action((n,o,r)=>{n&&(console.error(`error: '${n}' is not a valid subcommand.`),r.outputHelp(),process.exit(1)),Ic();let{clear:i,unmount:a}=On((0,lR.jsx)(AB,{isInteractive:!1,onExit:()=>{i(),a()}}))}).showHelpAfterError().showSuggestionAfterError()};Ci();mn();HA();Ci();async function AL(e=new Rt){return{project:await e.readProjectSpec(),deployedState:await e.readDeployedState(),awsTargets:await e.readAWSDeploymentTargets()}}async function JEe(e,t={}){let{project:n,deployedState:o,awsTargets:r}=e,i=t.agentRuntimeId?r.map(C=>C.name):Object.keys(o.targets);if(i.length===0)return{success:!1,error:t.agentRuntimeId?"No deployment targets found. Run `agentcore create` first.":"No deployed targets found. Run `agentcore deploy` first."};let a=t.targetName??i[0];if(t.targetName&&!i.includes(t.targetName))return{success:!1,error:`Target '${t.targetName}' not found. Available: ${i.join(", ")}`};let u=a?o.targets[a]:void 0,p=r.find(C=>C.name===a);if(!p)return{success:!1,error:`Target config '${a}' not found in aws-targets`};if(t.agentRuntimeId)try{let C=await Ok({region:p.region,runtimeId:t.agentRuntimeId});return{success:!0,targetName:a,runtimeId:C.runtimeId,runtimeStatus:C.status}}catch(C){return{success:!1,error:Zt(C)}}if(n.agents.length===0)return{success:!1,error:"No agents defined in configuration"};let f=n.agents.map(C=>C.name),g=t.agentName?n.agents.find(C=>C.name===t.agentName):n.agents[0];if(t.agentName&&!g)return{success:!1,error:`Agent '${t.agentName}' not found. Available: ${f.join(", ")}`};if(!g)return{success:!1,error:"No agents defined in configuration"};let h=u?.resources?.agents?.[g.name];if(!h)return{success:!0,agentName:g.name,targetName:a,isDeployed:!1};try{let C=await Ok({region:p.region,runtimeId:h.runtimeId});return{success:!0,agentName:g.name,targetName:a,isDeployed:!0,runtimeId:C.runtimeId,runtimeStatus:C.status}}catch(C){return{success:!1,error:Zt(C)}}}async function vJ(e,t={}){let{project:n,deployedState:o,awsTargets:r}=e,i=Object.keys(o.targets);if(i.length===0)return{success:!1,error:"No deployed targets found. Run `agentcore deploy` first."};let a=t.targetName??i[0];if(t.targetName&&!i.includes(t.targetName))return{success:!1,error:`Target '${t.targetName}' not found. Available: ${i.join(", ")}`};let u=o.targets[a],p=r.find(g=>g.name===a);if(!p)return{success:!1,error:`Target config '${a}' not found in aws-targets`};if(n.agents.length===0)return{success:!1,error:"No agents defined in configuration"};let f=await Promise.all(n.agents.map(async g=>{let h=u?.resources?.agents?.[g.name];if(!h)return{agentName:g.name,isDeployed:!1};try{let C=await Ok({region:p.region,runtimeId:h.runtimeId});return{agentName:g.name,isDeployed:!0,runtimeId:C.runtimeId,runtimeStatus:C.status}}catch(C){return{agentName:g.name,isDeployed:!0,runtimeId:h.runtimeId,error:Zt(C)}}}));return{success:!0,targetName:a,entries:f}}await Jt();var NE=Q(Ne()),YEe=e=>{e.command("status").alias("s").description(Ws.status).option("--agent <name>","Select specific agent").option("--agent-runtime-id <id>","Select specific agent runtime ID").option("--target <name>","Select deployment target").action(async t=>{Ic();try{let a=function(g){if(g!==void 0)return g?"Deployed":"Not deployed"};var n=a;let o=await AL();if(!t.agent&&!t.agentRuntimeId){let g=await vJ(o,{targetName:t.target});if(!g.success||!g.entries){On((0,NE.jsx)(k,{color:"red",children:g.error}));return}On((0,NE.jsxs)(J,{flexDirection:"column",children:[(0,NE.jsxs)(k,{children:["AgentCore Status (target: ",g.targetName,")"]}),g.entries.map(h=>{let C=h.isDeployed?"Deployed":"Not deployed",R=h.runtimeStatus?`Runtime status: ${h.runtimeStatus}`:void 0,D=h.error?`Runtime error: ${h.error}`:void 0,B=[C,R,D].filter(Boolean).join(" - ");return(0,NE.jsxs)(k,{children:[h.agentName,": ",B]},h.agentName)})]}));return}let r=await JEe(o,{agentName:t.agent,agentRuntimeId:t.agentRuntimeId,targetName:t.target});if(!r.success){On((0,NE.jsx)(k,{color:"red",children:r.error}));return}let i=r.agentName??r.runtimeId??"Agent",u=a(r.isDeployed),p=r.runtimeStatus?`Runtime status: ${r.runtimeStatus}`:void 0,f=[u,p].filter(Boolean).join(" - ");On((0,NE.jsxs)(k,{children:["AgentCore Status - ",i," (target: ",r.targetName,")",f?` - ${f}`:""]}))}catch(o){On((0,NE.jsxs)(k,{color:"red",children:["Error: ",Zt(o)]})),process.exit(1)}})};Ci();XS();import{execSync as l_n}from"child_process";var ZEe=X8e();async function IJ(){let e=`${ZEe.registryUrl}/${ZEe.packageName}/latest`,t=await fetch(e);if(!t.ok)throw new Error(`Failed to fetch latest version: ${t.statusText}`);return(await t.json()).version}function _J(e,t){let n=p=>{let[f="",...g]=p.split("-"),h=f.split(".").map(Number),C=g.join("-");return{nums:h,prerelease:C}},o=n(e),r=n(t);for(let p=0;p<3;p++){let f=o.nums[p]??0,g=r.nums[p]??0;if(g>f)return 1;if(g<f)return-1}if(!o.prerelease&&!r.prerelease)return 0;if(!o.prerelease)return-1;if(!r.prerelease)return 1;let i=o.prerelease.split("."),a=r.prerelease.split("."),u=Math.max(i.length,a.length);for(let p=0;p<u;p++){let f=i[p],g=a[p];if(f===void 0)return 1;if(g===void 0)return-1;let h=Number(f),C=Number(g);if(!isNaN(h)&&!isNaN(C)){if(C>h)return 1;if(C<h)return-1}else{if(g>f)return 1;if(g<f)return-1}}return 0}async function XEe(e){let t=await IJ(),n=_J(Il,t);if(n===0)return{status:"up-to-date",currentVersion:Il,latestVersion:t};if(n<0)return{status:"newer-local",currentVersion:Il,latestVersion:t};if(e)return{status:"update-available",currentVersion:Il,latestVersion:t};try{return l_n(ZEe.installCommand,{stdio:"inherit"}),{status:"updated",currentVersion:Il,latestVersion:t}}catch{return{status:"update-failed",currentVersion:Il,latestVersion:t}}}await Jt();var Og=Q(Ne()),eCe=e=>{e.command("update").description(Ws.update).option("-c, --check","Check for updates without installing").action(async t=>{try{On((0,Og.jsx)(k,{children:"Checking for updates..."}));let n=await XEe(t.check??!1);switch(n.status){case"up-to-date":On((0,Og.jsxs)(k,{color:"green",children:["You are already on the latest version (",n.currentVersion,")"]}));break;case"newer-local":On((0,Og.jsxs)(k,{color:"yellow",children:["Your version (",n.currentVersion,") is newer than the published version (",n.latestVersion,")"]}));break;case"update-available":On((0,Og.jsxs)(k,{children:["Update available: ",n.currentVersion," \u2192 ",(0,Og.jsx)(k,{color:"green",children:n.latestVersion})]})),On((0,Og.jsx)(k,{children:"Run `agentcore update` to install the update."}));break;case"updated":On((0,Og.jsxs)(k,{color:"green",children:["Successfully updated to ",n.latestVersion]}));break;case"update-failed":On((0,Og.jsx)(k,{color:"red",children:"Failed to install update. Try running: npm install -g @aws/agentcore@latest"})),process.exit(1);break}}catch(n){On((0,Og.jsxs)(k,{color:"red",children:["Error: ",Zt(n)]})),process.exit(1)}})};mn();async function nCe(e){let t=e.directory??process.cwd(),n=Ar(t);if(!n)return{success:!1,error:new ba().message};let o=new Rt({baseDir:n});try{await o.readProjectSpec()}catch(r){return{success:!1,error:tCe(r,"agentcore.json")}}try{await o.readAWSDeploymentTargets()}catch(r){return{success:!1,error:tCe(r,"aws-targets.json")}}if(o.configExists("state"))try{await o.readDeployedState()}catch(r){return{success:!1,error:tCe(r,".cli/state.json")}}return{success:!0}}function tCe(e,t){return e instanceof mI?e.message:e instanceof Jx?`Invalid JSON in ${t}: ${e.cause instanceof Error?e.cause.message:String(e.cause)}`:e instanceof Vx?`Failed to read ${t}: ${e.cause instanceof Error?e.cause.message:String(e.cause)}`:e instanceof qx?`Required file not found: ${t}`:e instanceof Error?e.message:String(e)}await Jt();var rCe=Q(Ne()),oCe=e=>{e.command("validate").option("-d, --directory <path>","Project directory containing agentcore config").description(Ws.validate).action(async t=>{let n=await nCe(t);n.success?(On((0,rCe.jsx)(k,{color:"green",children:"Valid"})),process.exit(0)):(On((0,rCe.jsx)(k,{color:"red",children:n.error})),process.exit(1))})};XS();mn();await xv();await Jt();var gar=Q(Xe()),Ov=Q(Ne());function iot(e){return er((t,n)=>{(n.escape||t==="b")&&e.onBack()}),(0,Ov.jsxs)(J,{flexDirection:"column",padding:1,children:[(0,Ov.jsx)(k,{bold:!0,children:e.command.title}),(0,Ov.jsx)(k,{dimColor:!0,children:e.command.description}),(0,Ov.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,Ov.jsxs)(k,{children:["TODO: implement ",e.command.id]}),(0,Ov.jsx)(k,{dimColor:!0,children:"Esc/B back"})]})]})}await NEe();await xv();await Jt();var sot=Q(Xe()),nu=Q(Ne()),d_n=50;function p_n(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}function iCe({commands:e}){let{exit:t}=yE(),{contentWidth:n}=IE(),o=LM(n);(0,sot.useEffect)(()=>{let i=setTimeout(()=>t(),0);return()=>clearTimeout(i)},[t]);let r=e.filter(i=>!i.disabled);return(0,nu.jsxs)(J,{flexDirection:"column",paddingY:1,children:[(0,nu.jsx)(k,{children:o}),(0,nu.jsx)(k,{children:" "}),(0,nu.jsx)(k,{bold:!0,color:"yellow",children:"Usage:"}),(0,nu.jsx)(k,{children:" agentcore [command]"}),(0,nu.jsx)(k,{children:" "}),(0,nu.jsx)(k,{bold:!0,color:"yellow",children:"Commands:"}),r.map(i=>{let a=p_n(i.description,d_n),u=" ".repeat(Math.max(1,14-i.title.length));return(0,nu.jsxs)(J,{children:[(0,nu.jsx)(k,{children:" "}),(0,nu.jsx)(k,{color:"cyan",children:i.title}),(0,nu.jsx)(k,{children:u}),(0,nu.jsx)(k,{dimColor:!0,children:a})]},i.id)}),(0,nu.jsx)(k,{children:" "}),(0,nu.jsx)(k,{dimColor:!0,children:"Run agentcore [command] --help for command-specific help"}),(0,nu.jsx)(k,{dimColor:!0,children:"Run agentcore (no args) for interactive mode"})]})}await Qr();await xv();await Na();await Jt();var vh=Q(Xe()),Wo=Q(Ne()),m_n=50;function f_n(e,t){return e.length<=t?e:e.slice(0,t-1)+"\u2026"}function g_n({items:e,query:t,cursor:n,clampedIndex:o,notice:r}){let{contentWidth:i}=IE(),a="\u2500".repeat(i),u=(0,vh.useMemo)(()=>e.length===0?0:Math.max(...e.map(p=>p.matchedSubcommand?p.command.title.length+3+p.matchedSubcommand.length:p.command.title.length)),[e]);return(0,Wo.jsxs)(J,{flexDirection:"column",children:[(0,Wo.jsx)(k,{bold:!0,color:"cyan",children:"Commands"}),(0,Wo.jsxs)(J,{marginTop:1,flexShrink:0,children:[(0,Wo.jsx)(k,{color:"cyan",children:"> "}),(0,Wo.jsx)(k,{children:t.slice(0,n)}),(0,Wo.jsx)(eu,{}),(0,Wo.jsx)(k,{children:t.slice(n)})]}),(0,Wo.jsx)(J,{marginTop:1,flexDirection:"column",children:e.length===0?(0,Wo.jsxs)(J,{flexDirection:"column",children:[(0,Wo.jsxs)(k,{dimColor:!0,children:['No commands match "',t,'"']}),(0,Wo.jsx)(k,{dimColor:!0,children:"Esc to clear"})]}):e.map((p,f)=>{let g=f===o,h=p.matchedSubcommand?`${p.command.id}-${p.matchedSubcommand}`:p.command.id,C=f_n(p.command.description,m_n),R=p.matchedSubcommand?p.command.title.length+3+p.matchedSubcommand.length:p.command.title.length,D=" ".repeat(Math.max(1,u-R+2));return(0,Wo.jsxs)(J,{children:[(0,Wo.jsxs)(k,{color:g?"cyan":"white",children:[g?"\u276F":" "," "]}),(0,Wo.jsx)(k,{bold:g,color:g?"cyan":void 0,children:p.command.title}),p.matchedSubcommand&&(0,Wo.jsxs)(Wo.Fragment,{children:[(0,Wo.jsx)(k,{dimColor:!0,children:" \u2192 "}),(0,Wo.jsx)(k,{bold:g,color:g?"cyan":void 0,children:p.matchedSubcommand})]}),(0,Wo.jsx)(k,{children:D}),(0,Wo.jsx)(k,{dimColor:!0,children:C})]},h)})}),r&&(0,Wo.jsx)(J,{marginTop:1,children:r}),(0,Wo.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,Wo.jsx)(k,{dimColor:!0,children:a}),(0,Wo.jsx)(k,{dimColor:!0,children:pU.COMMANDS})]})]})}function sCe(e){let{commands:t,initialQuery:n,notice:o,onNoticeDismiss:r,onSelect:i,onBack:a}=e,[u,p]=(0,vh.useState)(0),[f,g]=(0,vh.useState)(!1),h=(0,vh.useRef)(null);(0,vh.useEffect)(()=>(f&&(h.current=setTimeout(()=>{g(!1)},3e3)),()=>{h.current&&clearTimeout(h.current)}),[f]);let{value:C,cursor:R,clear:D}=z_({initialValue:n??"",isActive:!0}),B=(0,vh.useMemo)(()=>t.filter(z=>!z.disabled).flatMap(z=>{if(!C)return[{command:z}];let Y=C.toLowerCase(),ee=z.id.toLowerCase().includes(Y),Z=z.subcommands.filter(Be=>Be.toLowerCase().includes(Y)),oe=[];ee&&oe.push({command:z});for(let Be of Z)ee||oe.push({command:z,matchedSubcommand:Be});return oe}),[t,C]),O=Math.min(u,Math.max(0,B.length-1));return er((z,Y)=>{if(o&&r&&r(),Y.escape){C?(D(),p(0),g(!1)):f?a():g(!0);return}if(f&&g(!1),Y.upArrow&&B.length>0){p(Z=>(Z-1+B.length)%B.length);return}if(Y.downArrow&&B.length>0){p(Z=>(Z+1)%B.length);return}let ee=B.at(O);if(Y.return&&ee){i(ee.command.id);return}}),(0,Wo.jsx)(Pp,{children:(0,Wo.jsx)(g_n,{items:B,query:C,cursor:R,clampedIndex:O,notice:f?(0,Wo.jsx)(k,{color:"yellow",children:"Press Esc again to exit"}):o})})}mn();await Qr();await xv();await Jt();var kar=Q(Xe()),si=Q(Ne());function A_n(){return(0,si.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,si.jsx)(k,{color:"yellow",children:"No AgentCore project found in this directory."}),(0,si.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,si.jsx)(k,{dimColor:!0,children:"You can:"}),(0,si.jsxs)(J,{marginLeft:2,flexDirection:"column",children:[(0,si.jsxs)(k,{children:[(0,si.jsx)(k,{color:"cyan",children:"create"}),(0,si.jsx)(k,{dimColor:!0,children:" - Create a new AgentCore project here"})]}),(0,si.jsx)(k,{dimColor:!0,children:"or cd into an existing project directory"})]})]})]})}function h_n(){return(0,si.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,si.jsx)(A_n,{}),(0,si.jsx)(J,{marginTop:1,children:(0,si.jsxs)(k,{children:[(0,si.jsx)(k,{color:"cyan",children:"\u2691 "}),(0,si.jsx)(k,{dimColor:!0,children:"Press Enter to create a new project"})]})})]})}function y_n(){return Ar()!==null}var E_n=9;function aCe({cwd:e,version:t,onShowHelp:n,onSelectCreate:o}){let{exit:r}=yE(),{contentWidth:i}=IE(),a=!y_n(),u=LM(i,t),p="\u2500".repeat(i);return er((f,g)=>{if(g.escape){r();return}if(g.return&&a){o();return}if(g.tab){n();return}f&&!g.ctrl&&!g.meta&&n(f)}),(0,si.jsx)(Pp,{children:(0,si.jsxs)(J,{flexDirection:"column",children:[(0,si.jsx)(k,{color:"cyan",children:u}),(0,si.jsx)(J,{marginTop:1,children:(0,si.jsxs)(J,{children:[(0,si.jsx)(k,{color:"cyan",children:"> "}),(0,si.jsx)(eu,{})]})}),a?(0,si.jsx)(h_n,{}):(0,si.jsx)(J,{height:E_n}),(0,si.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,si.jsx)(k,{dimColor:!0,children:p}),(0,si.jsx)(k,{dimColor:!0,children:pU.HOME})]})]})})}mn();await Qr();Tv();await Jt();var RJ=Q(Xe()),ru=Q(Ne());function cCe({isInteractive:e,onExit:t}){let[n,o]=(0,RJ.useState)({phase:"loading",projectName:null,steps:[],results:[],skipped:[],error:null,totalSize:null});(0,RJ.useEffect)(()=>{(async()=>{let a=Ar(process.cwd());if(!a){o(u=>({...u,phase:"error",error:"No AgentCore project found in current directory"}));return}try{let p=await new Rt({baseDir:a}).readProjectSpec(),f=p.agents;if(f.length===0){o({phase:"error",projectName:p.name,steps:[],results:[],skipped:[],error:"No agents found in project",totalSize:null});return}let g=f.map(O=>({label:O.name,status:"pending"}));o(O=>({...O,phase:"packaging",projectName:p.name,steps:g}));let h=await pL({}),C=[],R=[],D=[...g];for(let O=0;O<f.length;O++){let z=f[O];if(!z)continue;let Y=D[O];if(Y){D[O]={label:Y.label,status:"running"},o(ee=>({...ee,steps:[...D]})),await new Promise(ee=>setTimeout(ee,100));try{let ee={...h,targetAgent:z.name},Z=await mL(ee);if(Z.skipped.length>0)R.push(...Z.skipped),D[O]={label:z.name,status:"warn",warn:"Skipped: no container runtime available"},o(oe=>({...oe,steps:[...D],skipped:R}));else{let oe=Z.results[0];oe&&(C.push(oe),D[O]={label:`${z.name} \u2192 ${oe.artifactPath}`,status:"success",info:`${oe.sizeMb} MB`}),o(Be=>({...Be,steps:[...D],results:C}))}}catch(ee){let Z=ee instanceof Error?ee.message:String(ee);D[O]={label:z.name,status:"error",error:Z},o({phase:"error",projectName:p.name,steps:[...D],results:C,skipped:R,error:Z,totalSize:null});return}}}let B=C.reduce((O,z)=>O+parseFloat(z.sizeMb),0).toFixed(2);o({phase:"success",projectName:p.name,steps:D,results:C,skipped:R,error:null,totalSize:B})}catch(u){let p=u instanceof Error?u.message:String(u);o(f=>({...f,phase:"error",error:p}))}})()},[]);let r=n.projectName?(0,ru.jsxs)(J,{children:[(0,ru.jsx)(k,{children:"Project: "}),(0,ru.jsx)(k,{color:co.success,children:n.projectName})]}):void 0;return n.phase==="loading"?(0,ru.jsx)(tn,{title:"AgentCore Package",onExit:t,headerContent:r,children:(0,ru.jsx)(k,{dimColor:!0,children:"Loading project..."})}):(0,ru.jsx)(tn,{title:"AgentCore Package",onExit:t,headerContent:r,children:(0,ru.jsxs)(J,{flexDirection:"column",marginTop:1,children:[n.steps.length>0&&(0,ru.jsx)(ff,{steps:n.steps}),n.phase==="success"&&n.results.length>0&&(0,ru.jsx)(J,{marginTop:1,children:(0,ru.jsxs)(k,{color:co.success,children:["Packaged ",n.results.length," agent",n.results.length!==1?"s":""," (",n.totalSize," MB total)"]})}),n.phase==="success"&&n.results.length===0&&n.skipped.length>0&&(0,ru.jsx)(J,{marginTop:1,children:(0,ru.jsx)(k,{color:co.warning,children:"No agents packaged (all skipped)"})}),n.phase==="error"&&(0,ru.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,ru.jsx)(k,{color:co.error,children:"Packaging failed"}),n.error&&(0,ru.jsx)(k,{color:co.error,dimColor:!0,children:n.error})]})]})})}await Qr();Ci();var kl=Q(Xe());function aot(){let[e,t]=(0,kl.useState)({phase:"loading",targetIndex:0,allStatuses:{},statusesLoaded:!1});(0,kl.useEffect)(()=>{let h=!0;return AL().then(C=>{if(!h)return;if(!C.project.agents.length){t(D=>({...D,phase:"error",error:"No agents defined in configuration."}));return}if(Object.keys(C.deployedState.targets).length===0){t(D=>({...D,phase:"error",error:"No deployed targets found. Run `agentcore deploy` first."}));return}t(D=>({...D,phase:"ready",project:C.project,deployedState:C.deployedState,awsTargets:C.awsTargets}))}).catch(C=>{h&&t(R=>({...R,phase:"error",error:C.message}))}),()=>{h=!1}},[]);let n=(0,kl.useMemo)(()=>!e.project||!e.deployedState||!e.awsTargets?null:{project:e.project,deployedState:e.deployedState,awsTargets:e.awsTargets},[e.awsTargets,e.deployedState,e.project]),o=(0,kl.useMemo)(()=>e.deployedState?Object.keys(e.deployedState.targets):[],[e.deployedState]),r=o[e.targetIndex],i=(0,kl.useMemo)(()=>{if(!(!e.awsTargets||!r))return e.awsTargets.find(h=>h.name===r)},[e.awsTargets,r]),a=(0,kl.useMemo)(()=>{if(!e.project)return[];let h=e.deployedState?.targets?.[r??""]?.resources?.agents;return e.project.agents.map(C=>{let R=h?.[C.name];return{name:C.name,isDeployed:!!R,runtimeId:R?.runtimeId}})},[e.deployedState,e.project,r]),u=(0,kl.useMemo)(()=>{if(!(!e.deployedState||!r))return e.deployedState.targets[r]?.resources},[e.deployedState,r]),p=(0,kl.useCallback)(async()=>{if(!(!n||!r)){t(h=>({...h,phase:"fetching-statuses",statusesError:void 0}));try{let h=await vJ(n,{targetName:r});if(!h.success){t(R=>({...R,phase:"ready",statusesLoaded:!0,statusesError:h.error}));return}let C={};for(let R of h.entries??[])C[R.agentName]=R;t(R=>({...R,phase:"ready",allStatuses:C,statusesLoaded:!0,statusesError:void 0}))}catch(h){t(C=>({...C,phase:"ready",statusesLoaded:!0,statusesError:Zt(h)}))}}},[n,r]);(0,kl.useEffect)(()=>{e.phase==="ready"&&n&&!e.statusesLoaded&&p()},[e.phase,n,e.statusesLoaded,p]);let f=(0,kl.useCallback)(()=>{e.phase!=="ready"&&e.phase!=="fetching-statuses"||t(h=>({...h,statusesLoaded:!1}))},[e.phase]),g=(0,kl.useCallback)(()=>{o.length&&t(h=>({...h,targetIndex:(h.targetIndex+1)%o.length,allStatuses:{},statusesLoaded:!1,statusesError:void 0}))},[o.length]);return{phase:e.phase,error:e.error,project:e.project,projectName:e.project?.name??"Unknown",targetName:r??"Unknown",targetRegion:i?.region,agents:a,hasMultipleTargets:o.length>1,allStatuses:e.allStatuses,statusesLoading:e.phase==="fetching-statuses",statusesError:e.statusesError,deployedResources:u,cycleTarget:g,refreshStatuses:f}}await Jt();var cot=Q(Xe()),Zr=Q(Ne());function uot({isInteractive:e,onExit:t}){let{phase:n,error:o,project:r,projectName:i,targetName:a,targetRegion:u,hasMultipleTargets:p,allStatuses:f,statusesLoading:g,statusesError:h,deployedResources:C,cycleTarget:R,refreshStatuses:D}=aot(),B=(0,cot.useMemo)(()=>{let ee={};for(let[Z,oe]of Object.entries(f))ee[Z]={runtimeStatus:oe.isDeployed?oe.runtimeStatus:"not deployed",error:oe.error};return ee},[f]);if(er((ee,Z)=>{n!=="ready"&&n!=="fetching-statuses"||(ee==="t"&&p&&R(),ee==="r"&&Z.ctrl&&D())},{isActive:n==="ready"||n==="fetching-statuses"}),n==="loading")return(0,Zr.jsx)(tn,{title:"AgentCore Status",onExit:t,children:(0,Zr.jsx)(k,{dimColor:!0,children:"Loading project status..."})});if(n==="error")return(0,Zr.jsx)(tn,{title:"AgentCore Status",onExit:t,children:(0,Zr.jsx)(k,{color:"red",children:o})});let O=["Ctrl+R refresh runtime status"];p&&O.push("T target"),O.push("Esc back","Ctrl+C quit");let z=O.join(" \xB7 "),Y=(0,Zr.jsxs)(J,{flexDirection:"column",children:[(0,Zr.jsxs)(J,{children:[(0,Zr.jsx)(k,{children:"Project: "}),(0,Zr.jsx)(k,{color:"green",children:i})]}),(0,Zr.jsxs)(J,{children:[(0,Zr.jsx)(k,{children:"Target: "}),(0,Zr.jsxs)(k,{color:"yellow",children:[a,u?` (${u})`:""]})]})]});return(0,Zr.jsxs)(tn,{title:"AgentCore Status",onExit:t,helpText:z,headerContent:Y,children:[g&&(0,Zr.jsx)(J,{marginTop:1,children:(0,Zr.jsx)(k,{dimColor:!0,children:"Fetching runtime statuses..."})}),h&&(0,Zr.jsx)(J,{marginTop:1,children:(0,Zr.jsxs)(k,{color:"red",children:["Error fetching statuses: ",h]})}),r&&(0,Zr.jsx)(J,{marginTop:1,children:(0,Zr.jsx)(qM,{project:r,agentStatuses:B,deployedAgents:C?.agents})}),C?.mcp&&(Object.keys(C.mcp.gateways??{}).length>0||Object.keys(C.mcp.runtimes??{}).length>0||Object.keys(C.mcp.lambdas??{}).length>0)&&(0,Zr.jsxs)(J,{marginTop:1,flexDirection:"column",children:[(0,Zr.jsx)(k,{bold:!0,dimColor:!0,children:"\u2500 Deployed MCP Resources \u2500"}),C.mcp.gateways&&Object.keys(C.mcp.gateways).length>0&&(0,Zr.jsx)(J,{flexDirection:"column",marginTop:1,children:Object.entries(C.mcp.gateways).map(([ee,Z])=>(0,Zr.jsx)(J,{marginLeft:2,children:(0,Zr.jsxs)(k,{children:[(0,Zr.jsxs)(k,{color:"yellow",children:["\u25C6 ",ee]}),(0,Zr.jsxs)(k,{dimColor:!0,children:[" ",Z.gatewayId]})]})},ee))}),C.mcp.runtimes&&Object.keys(C.mcp.runtimes).length>0&&(0,Zr.jsx)(J,{flexDirection:"column",marginTop:1,children:Object.entries(C.mcp.runtimes).map(([ee,Z])=>(0,Zr.jsx)(J,{marginLeft:2,children:(0,Zr.jsxs)(k,{children:[(0,Zr.jsxs)(k,{color:"magenta",children:["\u25B6 ",ee]}),(0,Zr.jsxs)(k,{dimColor:!0,children:[" ",Z.runtimeId]})]})},ee))}),C.mcp.lambdas&&Object.keys(C.mcp.lambdas).length>0&&(0,Zr.jsx)(J,{flexDirection:"column",marginTop:1,children:Object.entries(C.mcp.lambdas).map(([ee,Z])=>(0,Zr.jsx)(J,{marginLeft:2,children:(0,Zr.jsxs)(k,{children:[(0,Zr.jsxs)(k,{color:"magenta",children:["\u03BB ",ee]}),(0,Zr.jsxs)(k,{dimColor:!0,children:[" ",Z.functionName]})]})},ee))})]})]})}XS();await Qr();Tv();await Jt();var DJ=Q(Xe()),sr=Q(Ne());function uCe({isInteractive:e,onExit:t}){let[n,o]=(0,DJ.useState)({phase:"checking",currentVersion:Il,latestVersion:null,error:null});return(0,DJ.useEffect)(()=>{(async()=>{try{let a=await IJ(),u=_J(Il,a);u===0?o({phase:"up-to-date",currentVersion:Il,latestVersion:a,error:null}):u<0?o({phase:"newer-local",currentVersion:Il,latestVersion:a,error:null}):o({phase:"update-available",currentVersion:Il,latestVersion:a,error:null})}catch(a){let u=a instanceof Error?a.message:String(a);o(p=>({...p,phase:"error",error:u}))}})()},[]),(0,sr.jsx)(tn,{title:"AgentCore Update",onExit:t,children:(()=>{switch(n.phase){case"checking":return(0,sr.jsx)(J,{flexDirection:"column",marginTop:1,children:(0,sr.jsx)(Bd,{text:"Checking for updates..."})});case"up-to-date":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Current version: "}),(0,sr.jsx)(k,{color:co.success,children:n.currentVersion})]}),(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Latest version: "}),(0,sr.jsx)(k,{children:n.latestVersion})]}),(0,sr.jsx)(J,{marginTop:1,children:(0,sr.jsx)(k,{color:co.success,children:"You are on the latest version"})})]});case"newer-local":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Current version: "}),(0,sr.jsx)(k,{color:co.warning,children:n.currentVersion})]}),(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Latest version: "}),(0,sr.jsx)(k,{children:n.latestVersion})]}),(0,sr.jsx)(J,{marginTop:1,children:(0,sr.jsx)(k,{color:co.warning,children:"Your version is newer than the published version (dev build)"})})]});case"update-available":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Current version: "}),(0,sr.jsx)(k,{children:n.currentVersion})]}),(0,sr.jsxs)(J,{children:[(0,sr.jsx)(k,{children:"Latest version: "}),(0,sr.jsx)(k,{color:co.success,children:n.latestVersion})]}),(0,sr.jsx)(J,{marginTop:1,children:(0,sr.jsx)(k,{color:co.info,children:"Update available!"})}),(0,sr.jsxs)(J,{marginTop:1,children:[(0,sr.jsx)(k,{dimColor:!0,children:"Run "}),(0,sr.jsx)(k,{color:co.info,children:"agentcore update"}),(0,sr.jsx)(k,{dimColor:!0,children:" from the command line to install"})]})]});case"updating":return(0,sr.jsx)(J,{flexDirection:"column",marginTop:1,children:(0,sr.jsx)(Bd,{text:"Installing update..."})});case"updated":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsx)(J,{children:(0,sr.jsxs)(k,{color:co.success,children:["Successfully updated to ",n.latestVersion]})}),(0,sr.jsx)(J,{marginTop:1,children:(0,sr.jsx)(k,{dimColor:!0,children:"Restart agentcore to use the new version"})})]});case"error":return(0,sr.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,sr.jsx)(k,{color:co.error,children:"Failed to check for updates"}),n.error&&(0,sr.jsx)(k,{color:co.error,dimColor:!0,children:n.error})]});default:return null}})()})}mn();await Qr();Tv();await Jt();var TJ=Q(Xe()),Lp=Q(Ne()),xJ=[{key:"project",label:"agentcore.json",required:!0},{key:"targets",label:"aws-targets.json",required:!0},{key:"mcp",label:"mcp.json",required:!1},{key:"mcpDefs",label:"mcp-defs.json",required:!1},{key:"state",label:".cli/state.json",required:!1}];function lCe({isInteractive:e,onExit:t}){let[n,o]=(0,TJ.useState)({phase:"validating",steps:xJ.map(i=>({label:i.label,status:"pending"})),projectName:null,error:null});(0,TJ.useEffect)(()=>{(async()=>{let a=Ar(process.cwd());if(!a){o(g=>({...g,phase:"error",error:"No AgentCore project found in current directory",steps:g.steps.map((h,C)=>C===0?{label:h.label,status:"error",error:"Project not found"}:h)}));return}let u=new Rt({baseDir:a}),p=null,f=xJ.map(g=>({label:g.label,status:"pending"}));for(let g=0;g<xJ.length;g++){let h=xJ[g];if(!h)continue;let C=f[g];if(C){f[g]={label:C.label,status:"running"},o(R=>({...R,steps:[...f]})),await new Promise(R=>setTimeout(R,100));try{h.key==="project"?(p=(await u.readProjectSpec()).name,f[g]={label:h.label,status:"success"}):h.key==="targets"?(await u.readAWSDeploymentTargets(),f[g]={label:h.label,status:"success"}):h.key==="mcp"?u.configExists("mcp")?(await u.readMcpSpec(),f[g]={label:h.label,status:"success"}):f[g]={label:h.label,status:"info",info:"Not present (optional)"}:h.key==="mcpDefs"?u.configExists("mcpDefs")?(await u.readMcpDefs(),f[g]={label:h.label,status:"success"}):f[g]={label:h.label,status:"info",info:"Not present (optional)"}:h.key==="state"&&(u.configExists("state")?(await u.readDeployedState(),f[g]={label:h.label,status:"success"}):f[g]={label:h.label,status:"info",info:"Not present (optional)"}),o(R=>({...R,steps:[...f],projectName:p}))}catch(R){let D=R instanceof Error?R.message:String(R);f[g]={label:h.label,status:"error",error:D},o({phase:"error",steps:[...f],projectName:p,error:D});return}}}o({phase:"success",steps:f,projectName:p,error:null})})()},[]);let r=n.projectName?(0,Lp.jsxs)(J,{children:[(0,Lp.jsx)(k,{children:"Project: "}),(0,Lp.jsx)(k,{color:co.success,children:n.projectName})]}):void 0;return(0,Lp.jsx)(tn,{title:"AgentCore Validate",onExit:t,headerContent:r,children:(0,Lp.jsxs)(J,{flexDirection:"column",marginTop:1,children:[(0,Lp.jsx)(ff,{steps:n.steps}),n.phase==="success"&&(0,Lp.jsx)(J,{marginTop:1,children:(0,Lp.jsx)(k,{color:co.success,children:"All schemas valid"})}),n.phase==="error"&&(0,Lp.jsx)(J,{marginTop:1,children:(0,Lp.jsx)(k,{color:co.error,children:"Validation failed"})}),(n.phase==="success"||n.phase==="error")&&(0,Lp.jsx)(Np,{steps:[],isInteractive:e,onBack:t,isActive:!0})]})})}gme();await Jt();var dCe=Q(Xe()),xc=Q(Ne()),lot=Yc(),C_n=new Set(["create","update"]);function S_n(){let{exit:e}=yE(),t=qW(),n=zye(),o=t?{name:"help"}:{name:"home"},[r,i]=(0,dCe.useState)(o),[a,u]=(0,dCe.useState)(null),p=pCe(),f=H2(p,{inProject:t}),g=h=>{let C=f.find(R=>R.id===h);if(C){if(h!=="add"&&u(null),n&&!C_n.has(h)){u((0,xc.jsx)(Hye,{projectRoot:n}));return}if(h==="dev")i({name:"dev"});else if(h==="deploy")i({name:"deploy"});else if(h==="invoke")i({name:"invoke"});else if(h==="status")i({name:"status"});else if(h==="create")i({name:"create"});else if(h==="add"){if(!qW()&&r.name==="help"){u((0,xc.jsx)(jye,{inTui:!0}));return}i({name:"add"})}else i(h==="remove"?{name:"remove"}:h==="validate"?{name:"validate"}:h==="package"?{name:"package"}:h==="update"?{name:"update"}:{name:"command",command:C})}};return r.name==="home"?(0,xc.jsx)(aCe,{cwd:lot,version:p.version()??"0.0.0",onShowHelp:h=>i({name:"help",initialQuery:h}),onSelectCreate:()=>i({name:"create"})}):r.name==="help"?(0,xc.jsx)(sCe,{commands:f,initialQuery:r.initialQuery,notice:a??void 0,onNoticeDismiss:()=>u(null),onSelect:g,onBack:()=>{u(null),e()}}):r.name==="dev"?(0,xc.jsx)(OEe,{onBack:()=>i({name:"help"})}):r.name==="deploy"?(0,xc.jsx)(hJ,{isInteractive:!0,onExit:()=>i({name:"help"}),onNavigate:h=>i({name:h})}):r.name==="invoke"?(0,xc.jsx)(aR,{isInteractive:!0,onExit:()=>i({name:"help"})}):r.name==="status"?(0,xc.jsx)(uot,{isInteractive:!0,onExit:()=>i({name:"help"})}):r.name==="add"?(0,xc.jsx)(lJ,{isInteractive:!0,onExit:()=>i({name:"help"}),onDev:()=>i({name:"dev"}),onDeploy:()=>i({name:"deploy"})}):r.name==="remove"?(0,xc.jsx)(AB,{isInteractive:!0,onExit:()=>i({name:"help"}),onNavigate:h=>i({name:h})}):r.name==="create"?(0,xc.jsx)(dL,{cwd:lot,isInteractive:!0,onExit:()=>i({name:"help"}),onNavigate:({command:h,workingDir:C})=>{process.chdir(C),i({name:h})}}):r.name==="validate"?(0,xc.jsx)(lCe,{isInteractive:!0,onExit:()=>i({name:"help"})}):r.name==="package"?(0,xc.jsx)(cCe,{isInteractive:!0,onExit:()=>i({name:"help"})}):r.name==="update"?(0,xc.jsx)(uCe,{isInteractive:!0,onExit:()=>i({name:"help"})}):(0,xc.jsx)(iot,{command:r.command,onBack:()=>i({name:"help"})})}function dot(){return(0,xc.jsx)(j_,{children:(0,xc.jsx)(S_n,{})})}await xv();eh();var Dot=Q(Rot(),1),{program:Wcr,createCommand:Jcr,createArgument:Ycr,createOption:Zcr,CommanderError:Xcr,InvalidArgumentError:eur,InvalidOptionArgumentError:tur,Command:xot,Argument:nur,Option:rur,Help:our}=Dot.default;await Jt();var PJ=Q(Xe()),M_n="\x1B[?1049h\x1B[H",Tot="\x1B[?1049l",bot="\x1B[?25h",wCe=!1;function L_n(){let e=()=>{wCe&&process.stdout.write(Tot),process.stdout.write(bot)};process.on("exit",e),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("SIGTERM",()=>{e(),process.exit(0)})}function Q_n(){wCe=!0,process.stdout.write(M_n);let{waitUntilExit:e}=On(PJ.default.createElement(dot));e().then(()=>{wCe=!1,process.stdout.write(Tot),process.stdout.write(bot);let t=drt();t&&(console.log(t),prt())})}function U_n(e){let t=H2(e);On(PJ.default.createElement(j_,null,PJ.default.createElement(iCe,{commands:t})))}function pCe(){let e=new xot;e.name("agentcore").description(Ws.program).version(Il).showHelpAfterError().showSuggestionAfterError(),e.addHelpCommand(!1),e.helpOption("-h, --help","Display help"),e.on("option:help",()=>{U_n(e),process.exit(0)}),F_n(e);let t="\nRun without flags for interactive mode. Flags marked [non-interactive] trigger CLI mode.\nRun `agentcore help modes` for details.";return e.commands.forEach(n=>{n.addHelpText("after",t),n.commands.forEach(o=>{o.addHelpText("after",t)})}),e}function F_n(e){IEe(e),kEe(e),PEe(e),TEe(e),$Ee(e),UEe(e),FEe(e),WEe(e),YEe(e),eCe(e),oCe(e)}var wot=async e=>{L_n();let t=pCe();if(e.slice(2).length===0){Q_n();return}await t.parseAsync(e)};Ci();wot(process.argv).catch(e=>{console.error(Zt(e)),process.exit(1)});
737
737
  /*! Bundled license information:
738
738
 
739
739
  react/cjs/react.production.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/agentcore",
3
- "version": "0.3.0-preview.2.0",
3
+ "version": "0.3.0-preview.2.1",
4
4
  "description": "CLI for Amazon Bedrock AgentCore",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -100,7 +100,7 @@
100
100
  "@typescript-eslint/eslint-plugin": "^8.50.0",
101
101
  "@typescript-eslint/parser": "^8.50.0",
102
102
  "@vitest/coverage-v8": "^4.0.18",
103
- "aws-cdk-lib": "^2.234.1",
103
+ "aws-cdk-lib": "^2.239.0",
104
104
  "constructs": "^10.4.4",
105
105
  "esbuild": "^0.27.2",
106
106
  "eslint": "^9.39.2",
@@ -121,12 +121,6 @@
121
121
  "typescript-eslint": "^8.50.1",
122
122
  "vitest": "^4.0.18"
123
123
  },
124
- "overridesComments": {
125
- "fast-xml-parser": "CVE-2026-26278: @aws-sdk/xml-builder pins fast-xml-parser@5.3.4 which is vulnerable to DoS via entity expansion. Remove this override once @aws-sdk/xml-builder updates its pin to >=5.3.6."
126
- },
127
- "overrides": {
128
- "fast-xml-parser": "5.3.6"
129
- },
130
124
  "engines": {
131
125
  "node": ">=20"
132
126
  },