aws-cli-agent 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,8 +4,256 @@ All notable changes to this project are documented here.
4
4
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
5
5
  versioning follows [SemVer](https://semver.org/).
6
6
 
7
- ## [0.4.0] - 2026-05-17
7
+ ## [0.6.0] - 2026-05-31
8
+
9
+ ### Breaking
10
+
11
+ - **Config schema restructured: per-provider blocks at top level.** Provider-specific fields (`model`, `apiKey`, `apiKeyEnv`) move into a top-level block named after the provider. The old top-level `model` and `apiKeyEnv` fields are gone. For Bedrock, the `model` field also moves into the existing `bedrock` block (which already held `region` and `profile`).
12
+
13
+ Old:
14
+ ```json
15
+ {
16
+ "provider": "anthropic",
17
+ "model": "claude-sonnet-4-6",
18
+ "apiKeyEnv": "MY_KEY",
19
+ "bedrock": { "region": "us-east-1" }
20
+ }
21
+ ```
22
+
23
+ New:
24
+ ```json
25
+ {
26
+ "provider": "anthropic",
27
+ "anthropic": {
28
+ "model": "claude-sonnet-4-6",
29
+ "apiKeyEnv": "MY_KEY"
30
+ },
31
+ "bedrock": {
32
+ "model": "us.anthropic.claude-sonnet-4-6",
33
+ "region": "us-east-1"
34
+ }
35
+ }
36
+ ```
37
+
38
+ Old configs fail to load with a clear migration message pointing at the new shape — no silent fallback.
39
+
40
+ - **Strict validation of the active provider block.** When `provider` is set, the matching top-level block must exist with a `model` field. Previously the top-level `model` default kicked in if absent; now you have to be explicit. Run `aca config` to scaffold a working default.
41
+
42
+ ### Added
43
+
44
+ - **`<provider>.apiKey` config field for Anthropic / OpenAI / Google.** Convenience for casual users who don't want to set env vars; persists to disk so see the security note in the README. Resolution order: `apiKeyEnv`-named env var → default provider env var → `<provider>.apiKey` from config → error. The env var always wins when both are set.
45
+ - **Default config file is created with mode `0600`** (owner read/write only) so it isn't world-readable on creation. Doesn't help if you edit the file with another tool that resets permissions.
46
+ - **Debug-level log note when the API key resolves from config** rather than an env var. Helps post-hoc forensics see what happened. The key value itself is never logged.
47
+ - **Helpful migration error for pre-0.6 configs.** Loading a config file with top-level `model` or `apiKeyEnv` produces a side-by-side old/new shape diff instead of a cryptic zod parse failure.
48
+
49
+ ### Changed
50
+
51
+ - **`apiKeyEnv` moves from top-level into the per-provider block.** It was a top-level field since 0.1.0; now it lives at `<provider>.apiKeyEnv`. Same semantics, just nested.
52
+ - **`apiKeyEnv` set to an empty env var emits a warning.** Previously the fall-through to the default env var was silent — convenient until a user noticed the wrong account was being charged. Now if `<provider>.apiKeyEnv` names a variable that isn't set, `aca` prints a warning to stderr and falls back to the default env var (and then to `<provider>.apiKey`). The warning is purely informational; resolution still continues.
53
+
54
+ ### Fixed
55
+
56
+ - **Ctrl-C inside an SSM session no longer prints "Cannot perform start session: read /dev/stdin: input/output error".** Previously, Ctrl-C delivered SIGINT to both the AWS CLI subprocess AND aca; aca's process tore down the shared stdin before the AWS CLI's own cleanup completed, producing the I/O-error message. The fix: `aca` installs a no-op SIGINT handler for the lifetime of any interactive AWS CLI subprocess, leaving the signal exclusively to the child. The AWS CLI now performs its normal clean shutdown and exits with code 0 or 130, which aca recognizes as a clean termination.
57
+
58
+ ## [0.5.0] - 2026-05-19
59
+ ### Added
60
+
61
+ - **Graceful error handling for AWS CLI failures.** AWS CLI exit codes
62
+ 252–255 (parse error, missing credentials, client error, server error)
63
+ are now classified as fatal and abort the agent loop immediately rather
64
+ than being fed back to the model for retry. The user sees the AWS
65
+ stderr printed verbatim in red; the process exits 1. Other non-zero
66
+ exits remain soft failures — the model can decide whether to retry,
67
+ bounded by `maxSteps` as before.
68
+ - **Ctrl-C handling.** Pressing Ctrl-C at any agent-driven prompt
69
+ (approval prompts, agent-asked questions, the bash script's
70
+ execute/save/cancel dialog) now exits cleanly with a "cancelled by
71
+ user" message on stderr and exit code 130 (SIGINT convention). No
72
+ stack trace, no red error, no "ran N commands" footer.
73
+ - **SSM-session Ctrl-C silenced.** When you Ctrl-C to end an interactive
74
+ AWS CLI session (SSM Session Manager shells, port-forwards, etc.),
75
+ exit code 130 is treated as a clean termination instead of an error.
76
+ The audit log still records the real exit code for accuracy.
77
+ - **`endReason` field on `RunResult`.** Internal API used by cli.ts to
78
+ pick the right exit code: `completed` (0), `cancelled` (130), or
79
+ `fatal` (1).
80
+
81
+ ### Changed
82
+
83
+ - **The "ran N commands" footer is now verbose-only.** Previously printed
84
+ on every multi-command run; now requires `--verbose` / `-v` to surface.
85
+ With verbose off, nothing aca generates reaches the terminal — only
86
+ the AWS CLI's verbatim output does, matching the README's promise.
87
+
88
+ ## [0.4.0] - 2026-05-18
89
+
90
+ ### Changed
91
+
92
+ - **Dependency upgrades.** Vercel AI SDK v4 → v6, zod v3 → v4, TypeScript
93
+ v5 → v6, ESLint v9 → v10, `@types/node` v22 → v25, and all `@ai-sdk/*`
94
+ provider packages to their v6-compatible majors (`@ai-sdk/anthropic`@3,
95
+ `@ai-sdk/openai`@3, `@ai-sdk/google`@3, `@ai-sdk/amazon-bedrock`@4).
96
+ Required code changes:
97
+ - `generateText({ maxSteps })` → `generateText({ stopWhen: stepCountIs(n) })`
98
+ - Tool definition field `parameters:` → `inputSchema:`
99
+ - Tool call payload `args` → `input`
100
+ - Usage fields `promptTokens` / `completionTokens` →
101
+ `inputTokens` / `outputTokens` (the data we write to `usage.log` keeps
102
+ the legacy names — they're a stable public interface, just remapped at
103
+ extraction time).
104
+ - `createOpenAI({ compatibility: 'strict' })` removed; the option no longer
105
+ exists.
106
+ - Zod v4 `.default({})` on object schemas now requires the fully-typed
107
+ default value; updated `LoggingSchema` and `autoApprove` defaults.
108
+ - Step events from `onStepFinish` dropped the `stepType` field; the debug
109
+ log now only mentions `finishReason`.
110
+
111
+ ### Fixed
112
+
113
+ - **Interactive AWS CLI commands now work.** Previously, commands like
114
+ `aws ssm start-session` (interactive shells), port-forwarding sessions, and
115
+ log tails with `--follow` appeared to hang — the child process's stdout was
116
+ being captured into a string for the agent's context, and the child's stdin
117
+ was never connected to the user's terminal. Now the host detects common
118
+ interactive patterns and uses `stdio: 'inherit'` for those commands, so the
119
+ user's terminal connects directly to the AWS CLI subprocess.
120
+ - **General log no longer echoes to the console.** Previously, the operational
121
+ `Logger` wrote both to `general.log` *and* to stderr at every level above
122
+ the threshold — meaning `--log-level debug` would spam debug lines into the
123
+ user's terminal. Now `Logger` is strictly file-only; the only things that
124
+ reach the console are (a) the AWS CLI's verbatim stdout, (b) approval
125
+ prompts, (c) error summaries, and (d) reasoning steps when `verbose` is
126
+ on. To watch operational logs live: `tail -f
127
+ ~/.local/state/aws-cli-agent/general.log`.
128
+
129
+ ### Added
130
+
131
+ - **`--interactive` / `-i` CLI flag** to force every AWS CLI command in a run
132
+ to inherit the user's terminal. Useful as an escape hatch for commands not
133
+ in the auto-detect list (`ssm start-session`, `ssm start-session` with
134
+ port-forward documents, `ecs execute-command`, `logs tail --follow`).
135
+ - **`interactive` parameter on `execute_aws_command` tool.** Lets the agent
136
+ explicitly mark a command as interactive when it knows the command needs
137
+ a TTY. For interactive runs, the agent receives a "do not summarize"
138
+ signal instead of stdout.
139
+ - **Auto-approve never applies to interactive commands.** Handing your
140
+ terminal to a subprocess is a meaningful event; it always prompts.
141
+
142
+ - **Prompt caching** for Anthropic and Bedrock providers (`caching: true` by
143
+ default). Marks the system prompt + tool definitions as cacheable; cache
144
+ reads cost ~10% of normal input tokens on these providers. OpenAI
145
+ auto-caches without our involvement; Google Gemini isn't supported yet.
146
+ Cache hit/miss tokens are recorded in `usage.log` as `cacheReadTokens` and
147
+ `cacheWriteTokens`. Typical cost reduction: ~60% off the input bill for
148
+ frequent users.
149
+ - **Usage log** — `usage.log` (JSONL) records token totals per `aca`
150
+ invocation: timestamp, provider, model, steps, prompt/completion/total
151
+ tokens. Enable/disable via `logging.usageLog` (default `true`). Sum the
152
+ day's tokens with `cat usage.log | jq -s 'map(.totalTokens) | add'`.
153
+ - **Interactive prompting** during the reasoning process. The `prompt_user`
154
+ tool now supports four question kinds: `text` (free-form), `choice` (pick
155
+ one from a finite list), `confirm` (yes/no), and `secret` (hidden input
156
+ for short secrets like MFA codes). New `prompt_user_multi` tool batches
157
+ several related questions into a single round so the agent doesn't need
158
+ multiple model round-trips to gather setup data.
159
+ - **Sharpened system prompt** with explicit anti-guessing rules and worked
160
+ examples of when to ask vs. when to discover. The agent is much more
161
+ likely to stop and ask when it isn't certain rather than picking a
162
+ plausible answer and acting on it.
163
+
164
+ ## [0.3.0] - 2026-05-15
165
+
166
+ ### Changed
167
+
168
+ - **Renamed** package from `ai-aws` to `aws-cli-agent`. Short CLI name is `aca`;
169
+ the long name `aws-cli-agent` works too. Install with
170
+ `npm install -g aws-cli-agent`.
171
+ - **Restructured logging config.** Replaced top-level `logLevel`, `audit.enabled`,
172
+ and `reasoning.enabled` with a nested `logging` object:
173
+ ```json
174
+ "logging": { "level": "error", "auditLog": true, "reasoningLog": false }
175
+ ```
176
+ Defaults are now: level `error` (was `info`), audit on (unchanged), reasoning
177
+ log **off** (was on).
178
+ - **Renamed general log file** from `ai-aws.log` to `general.log`.
179
+ - **`--verbose` is now reasoning-only.** Previously also bumped log level to
180
+ debug; now controls only whether reasoning is echoed to the console. Use
181
+ `--log-level debug` separately if you want a noisier general log.
182
+ - **Restructured Bedrock config** into a nested `bedrock` object:
183
+ ```json
184
+ "bedrock": { "region": "us-east-1", "profile": "shared-services" }
185
+ ```
186
+ Replaces the old top-level `bedrockRegion` / `bedrockProfile`.
187
+
188
+ ### Added
189
+
190
+ - **`defaultRegion`** config and `--region` CLI flag. The configured region
191
+ is auto-appended as `--region` to every AWS CLI call the agent makes —
192
+ unless the agent itself specified a region, in which case its choice wins.
193
+ - **Bash script "save to disk" option.** When the agent generates a script,
194
+ the user now sees a three-way prompt: Execute / Save to disk / Cancel.
195
+ The save path is shown inline so you know exactly where the file lands.
196
+ Folder is configurable via `scriptFolder`; default is
197
+ `$XDG_DATA_HOME/aws-cli-agent/scripts`.
198
+ - **Two npm-installable binary names**: `aws-cli-agent` and `aca` (same binary).
199
+ - **GitHub Actions CI** (lint, typecheck, build, smoke test on Node 20 & 22).
200
+ - **GitHub Actions Release** workflow (publishes to npm on tag push or release
201
+ publication, with provenance attestation).
202
+ - **Dependabot** config for npm and GitHub Actions.
203
+ - **Smoke test** script (`npm test`) that exercises the basic CLI surface
204
+ without needing cloud credentials.
205
+
206
+ ### Removed
207
+
208
+ - **`--quiet` / `-q` flag.** Use `--log-level error` (or `silent`) instead.
209
+ - **Top-level config keys** `logLevel`, `audit`, `reasoning`, `bedrockRegion`,
210
+ `bedrockProfile`. See "Changed" above.
211
+ - **`autoApprove` no longer applies to bash scripts.** Scripts always prompt
212
+ (Execute / Save / Cancel). The flag still skips approval for individual
213
+ AWS CLI calls.
214
+
215
+ ### Migration notes
216
+
217
+ The old `ai-aws` config at `~/.config/ai-aws/config.json` is not read or
218
+ migrated. Run `aca config` to write a fresh default at the new path. Translate
219
+ old → new keys:
220
+
221
+ | Old | New |
222
+ |---|---|
223
+ | `logLevel` | `logging.level` |
224
+ | `audit.enabled` | `logging.auditLog` |
225
+ | `reasoning.enabled` | `logging.reasoningLog` |
226
+ | `bedrockRegion` | `bedrock.region` |
227
+ | `bedrockProfile` | `bedrock.profile` |
228
+
229
+ History at the old `~/.local/state/ai-aws/` location won't be picked up.
230
+ If you want to keep it: `mv ~/.local/state/ai-aws ~/.local/state/aws-cli-agent`.
231
+
232
+ ## [0.2.0] - 2026-05-14
233
+
234
+ ### Added
235
+
236
+ - Amazon Bedrock as a provider option via `@ai-sdk/amazon-bedrock`. Uses the
237
+ standard AWS credential chain; no API key required. Configurable via
238
+ optional `bedrockRegion` and `bedrockProfile` (since superseded by nested
239
+ `bedrock` in 0.3.0).
240
+ - Audit log: append-only JSONL of every executed command/script with full
241
+ stdout/stderr/exit code. Bash scripts also log full source.
242
+ - Reasoning log: text record of agent reasoning steps and tool calls.
243
+ - ESLint 9 with flat config (`npm run lint`, `npm run lint:fix`).
244
+
245
+ ### Changed
246
+
247
+ - Output policy: stdout is reserved for the verbatim AWS CLI output. The agent
248
+ cannot rewrite or summarize results. Pipe to `jq`, `wc`, etc. like you would
249
+ with the AWS CLI directly.
250
+ - Moved `history.jsonl` from `$XDG_DATA_HOME` to `$XDG_STATE_HOME` alongside
251
+ the logs.
252
+
253
+ ## [0.1.0] - 2026-05-14
8
254
 
9
255
  ### Added
10
256
 
11
- - Initial official release. Agentic AI assistant that turns natural-language requests into AWS CLI commands and runs them locally.
257
+ - Initial release. Agentic AWS CLI assistant with multi-step tool calling
258
+ (Vercel AI SDK), local-only state, XDG-compliant paths, configurable
259
+ providers (Anthropic / OpenAI / Google), per-command approval prompts.
package/README.md CHANGED
@@ -31,8 +31,15 @@ The first example is interactive — the agent runs a read-only `describe-instan
31
31
  - **Your prompts go to the model provider.** AWS CLI output is fed back to the model as part of subsequent steps. That means resource names, instance IDs, tag values, and any other data that appears in command output is transmitted to Anthropic / OpenAI / Google / Bedrock (depending on your provider choice). The provider does not retain this data beyond the request itself (and the cache TTL, ~5 minutes for cached prefixes), but **confirm this is compatible with the policies you have to respect** before pointing `aca` at sensitive accounts.
32
32
  - **Provider terms apply.** When you use a provider, you agree to that provider's terms of service. For Bedrock, that's AWS's own terms (data stays in your AWS account boundary). For Anthropic / OpenAI / Google, that's their respective enterprise / API terms. Read them.
33
33
  - **Audit log is your friend.** Every executed command — including its stdout, stderr, and exit code — lands in `audit.log` (JSONL). If you ever need to reconstruct what happened, it's all there. Don't disable `logging.auditLog` unless you have a specific reason.
34
+ - **API keys in the config file persist to disk.** As of 0.6.0, you can put your LLM provider API key in `<provider>.apiKey` for convenience. The env var still takes precedence when both are set. Putting a key on disk is a meaningful step down from keeping it in your shell environment: backup tools, accidental `git add .` from the wrong directory, screen-sharing, and shoulder-surfing all become realistic leak vectors. The config file is created with mode 0600 by `aca config`, but that doesn't help if you edit it with another tool that resets permissions, or if you copy your `~/.config` into a dotfiles repo. Use the env var path when possible; reserve the config-file path for casual local use.
34
35
  - **No warranty.** **You use this agent at your own risk.** The authors are not responsible for unintended AWS API calls, deleted resources, exceeded budgets, or any other damage caused by using this tool. If you wouldn't run `aws` commands blindly from a script you found in someone's gist, don't run `aca` blindly either.
35
36
 
37
+ ## Trademark & affiliation
38
+
39
+ `aws-cli-agent` (`aca`) is an independent project, not affiliated with or
40
+ endorsed by Amazon Web Services. "AWS" and "Amazon Web Services" are
41
+ trademarks of Amazon.com, Inc.
42
+
36
43
  ## Installation
37
44
 
38
45
  ```bash
@@ -72,7 +79,9 @@ Default contents (created by `aca config`):
72
79
  ```json
73
80
  {
74
81
  "provider": "anthropic",
75
- "model": "claude-sonnet-4-5-20250929",
82
+ "anthropic": {
83
+ "model": "claude-sonnet-4-6"
84
+ },
76
85
  "maxSteps": 15,
77
86
  "logging": {
78
87
  "level": "error",
@@ -91,28 +100,43 @@ Default contents (created by `aca config`):
91
100
  }
92
101
  ```
93
102
 
94
- Optional fields (omit if you don't need them):
103
+ A more populated config showing all four providers (you only need the block for the active provider; the others are illustrative):
95
104
 
96
105
  ```json
97
106
  {
98
- "apiKeyEnv": "MY_CUSTOM_ANTHROPIC_KEY",
99
- "defaultRegion": "eu-west-1",
100
- "scriptFolder": "/home/me/aws-scripts",
107
+ "provider": "anthropic",
108
+ "anthropic": {
109
+ "model": "claude-sonnet-4-6",
110
+ "apiKey": "sk-ant-...",
111
+ "apiKeyEnv": "MY_CUSTOM_ANTHROPIC_KEY"
112
+ },
113
+ "openai": {
114
+ "model": "gpt-5",
115
+ "apiKey": "sk-..."
116
+ },
117
+ "google": {
118
+ "model": "gemini-2.5-pro",
119
+ "apiKey": "..."
120
+ },
101
121
  "bedrock": {
122
+ "model": "us.anthropic.claude-sonnet-4-6",
102
123
  "region": "us-east-1",
103
124
  "profile": "shared-services"
104
- }
125
+ },
126
+ "defaultRegion": "eu-west-1",
127
+ "scriptFolder": "/home/me/aws-scripts"
105
128
  }
106
129
  ```
107
130
 
131
+ Per-provider configuration lives in a top-level block named after the provider (`anthropic`, `openai`, `google`, `bedrock`). The active provider is selected by the top-level `provider` field, and its block must exist with at least a `model` set. All other provider blocks are ignored at runtime, but you can keep them populated if you switch providers often — `aca` won't read them until you change `provider`.
132
+
108
133
  ### Top-level keys
109
134
 
110
135
  | Key | Default | Meaning |
111
136
  |---|---|---|
112
- | `provider` | `anthropic` | LLM provider: `anthropic` \| `openai` \| `google` \| `bedrock` |
113
- | `model` | `claude-sonnet-4-5-20250929` | Model identifier (Bedrock uses fully-qualified IDs see below) |
114
- | `apiKeyEnv` | — | Override the env var name that holds the API key (ignored for `bedrock`) |
115
- | `bedrock` | — | Bedrock-specific settings (see below). Only used when `provider = "bedrock"`. |
137
+ | `provider` | `anthropic` | Active LLM provider: `anthropic` \| `openai` \| `google` \| `bedrock`. The matching top-level block must exist and contain a `model`. |
138
+ | `anthropic`, `openai`, `google` | | Per-provider blocks for the three keyed providers. See "Per-provider keys" below. |
139
+ | `bedrock` | — | Bedrock provider block. See "Bedrock" below. |
116
140
  | `defaultRegion` | — | AWS region injected into every AWS CLI command when the agent didn't specify one |
117
141
  | `caching` | `true` | Enable prompt caching for providers that support it. See "Prompt caching" below. |
118
142
  | `maxSteps` | `15` | Hard cap on agent reasoning/tool steps per request (range 1-50) |
@@ -124,6 +148,28 @@ Optional fields (omit if you don't need them):
124
148
  | `historyLimit` | `200` | Max history entries kept in memory for context |
125
149
  | `scriptFolder` | `$XDG_DATA_HOME/aws-cli-agent/scripts` | Where saved bash scripts are written |
126
150
 
151
+ ### Per-provider keys (anthropic, openai, google)
152
+
153
+ All three keyed providers accept the same three fields:
154
+
155
+ | Key | Required | Meaning |
156
+ |---|---|---|
157
+ | `<provider>.model` | yes | Model identifier (e.g. `claude-sonnet-4-6`, `gpt-5`, `gemini-2.5-pro`). Required when this provider is active. |
158
+ | `<provider>.apiKey` | no | API key for this provider. **SECURITY:** putting the key here persists it to disk; prefer the env var. The env var wins if both are set. |
159
+ | `<provider>.apiKeyEnv` | no | Override the env var name read for this provider. Default names: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`. |
160
+
161
+ **API key resolution order** (highest priority first):
162
+
163
+ 1. Env var named by `<provider>.apiKeyEnv` (if that field is set).
164
+ 2. Default env var for the provider (e.g. `ANTHROPIC_API_KEY`).
165
+ 3. `<provider>.apiKey` from the config file.
166
+
167
+ If none of the above is set, the run fails with an error listing all three options.
168
+
169
+ When the key is resolved from the config file instead of an env var, `aca` writes a debug-level note to `general.log` ("API key loaded from config file (no env var set)") so a forensic investigation can see what happened. The key value itself is never logged.
170
+
171
+ The config file is created with file mode `0600` (owner read/write only) when `aca config` runs. If you edit it manually with another tool, `aca` won't re-permission it on read — that's on you.
172
+
127
173
  ### Logging
128
174
 
129
175
  ```json
@@ -154,13 +200,13 @@ aca --region eu-west-1 "list ec2 instances in my-staging"
154
200
 
155
201
  ### Bedrock
156
202
 
157
- When `provider = "bedrock"`, configure region and (optionally) profile via the nested `bedrock` object:
203
+ When `provider = "bedrock"`, configure model, region, and (optionally) profile in the `bedrock` block:
158
204
 
159
205
  ```json
160
206
  {
161
207
  "provider": "bedrock",
162
- "model": "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
163
208
  "bedrock": {
209
+ "model": "us.anthropic.claude-sonnet-4-6",
164
210
  "region": "us-east-1",
165
211
  "profile": "shared-services"
166
212
  }
@@ -170,6 +216,7 @@ When `provider = "bedrock"`, configure region and (optionally) profile via the n
170
216
  - **Model IDs**: Bedrock uses fully-qualified inference-profile IDs. The `us.` / `eu.` / `apac.` prefix is required for most newer Anthropic models. Use `aws bedrock list-inference-profiles --region <region>` to discover what your account can invoke.
171
217
  - **`bedrock.profile`** is independent from operational profiles. The agent calls Bedrock under `bedrock.profile`, but each AWS CLI command it issues uses its own `--profile` (resolved from the user's prompt / history). This is the right pattern when one account holds Bedrock entitlements and other accounts hold workloads.
172
218
  - If `bedrock.region` is unset, falls back to `AWS_REGION` / `AWS_DEFAULT_REGION` env vars.
219
+ - Bedrock uses the AWS credential chain — there's no `apiKey` field.
173
220
 
174
221
  ### Prompt caching
175
222
 
@@ -370,4 +417,4 @@ Without this rule, the approval prompts and reasoning lines would land in the ne
370
417
 
371
418
  ## License
372
419
 
373
- MIT
420
+ MIT
package/dist/agent.d.ts CHANGED
@@ -28,6 +28,18 @@ export type RunResult = {
28
28
  finalError: string | null;
29
29
  /** Did the last execute_* call run successfully? */
30
30
  ranCommand: boolean;
31
+ /**
32
+ * How the run ended. cli.ts uses this to pick the exit code and decide
33
+ * whether to print the AWS stderr as a red error:
34
+ * - 'completed' — normal end, model stopped on its own (exit 0)
35
+ * - 'cancelled' — Ctrl-C at a prompt; cli.ts prints "cancelled by
36
+ * user" on stderr and exits 130 (the canonical SIGINT
37
+ * exit code)
38
+ * - 'fatal' — AWS CLI returned an unrecoverable exit code
39
+ * (252-255); finalError carries the stderr, cli.ts
40
+ * prints it in red and exits 1
41
+ */
42
+ endReason: 'completed' | 'cancelled' | 'fatal';
31
43
  };
32
44
  export declare function runAgent(opts: {
33
45
  input: string;