@sunerpy/kiro-provider 0.8.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +48 -67
  2. package/dist/cli.js +134 -72
  3. package/package.json +10 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # kiro-provider
2
2
 
3
- > A protocol-fidelity gateway exposing a verified OpenAI Responses and Anthropic Messages subset over AWS Kiro (CodeWhisperer).
3
+ > An OpenAI Responses-compatible provider over AWS KiroRuntime, with native Responses and protocol-fidelity stateless fallback transports.
4
4
 
5
5
  [![CI](https://github.com/sunerpy/kiro-provider/actions/workflows/ci.yml/badge.svg)](https://github.com/sunerpy/kiro-provider/actions/workflows/ci.yml)
6
6
  [![codecov](https://codecov.io/gh/sunerpy/kiro-provider/branch/main/graph/badge.svg)](https://codecov.io/gh/sunerpy/kiro-provider)
@@ -29,17 +29,20 @@
29
29
 
30
30
  ## Features
31
31
 
32
- - OpenAI Responses `POST /v1/responses` and Anthropic Messages `POST /v1/messages` (both streaming and non-streaming), plus `POST /v1/messages/count_tokens`, `GET /v1/models`, `GET /health`, and authenticated `GET /ready`.
32
+ - OpenAI Responses creation plus locally mirrored retrieve, delete, input-items,
33
+ and cancel routes; Anthropic Messages `POST /v1/messages`; legacy Chat
34
+ Completions behind an explicit switch; `GET /v1/models`, `GET /health`, and
35
+ authenticated `GET /ready`.
33
36
  - Legacy OpenAI Chat Completions is available at `POST /v1/chat/completions`, but is disabled by default and must be explicitly enabled with `enable_legacy_chat_completions`.
34
37
  - Bearer API-key gate that fails closed: the server refuses to start with no configured keys, and defaults to binding `127.0.0.1`.
35
38
  - Provider-owned authentication by default: `auth_source: "local"` stores credentials in `~/.config/kiro-provider/accounts.db`. Existing `opencode-kiro-auth` accounts can be imported once with `kiro-provider accounts import`; after that, kiro-provider refreshes access tokens, usage, quota recovery, and account health without reading or locking OpenCode's database.
36
39
  - Explicit-only session affinity by default: Responses requests can opt in through standard `metadata`, compatibility `client_metadata`, or `prompt_cache_key`; standard clients that resend complete history can also continue through the exact prior assistant-output lineage. User prompts are never fingerprinted to guess a session. A matching Zuno native OpenAI transport supplies `metadata.zuno_session_id` automatically.
37
40
  - Account-scoped scheduling and cached SDK/transport objects: unrelated accounts can run concurrently, while one account is protected from overlapping Kiro streams. Access-token rotation rebuilds the credential-bound SDK client while retaining the account transport. A production-default service lock prevents multiple processes from silently splitting those queues and pools. Kiro model-call HTTP keep-alive is disabled by default and is an explicit transport opt-in.
38
41
  - Live per-account model discovery and account-aware routing through Kiro management, with bounded stale/static fallback. Production calls use the live-probe-confirmed `runtime.<region>.kiro.dev` dialect. Token-usage metadata is an immediate completion witness; the current runtime's valid terminal metering event is accepted only when followed by clean EOF.
39
- - Zero provider-owned prompt injection in the default `safe` mode: a canonical
40
- input IR preserves client text, roles, content-block boundaries, tool
41
- identity, ordering, and source paths; Kiro output is normalized into a
42
- separate canonical completion/event IR before protocol-specific encoding.
42
+ - Default `v3-auto` transport selection: ordinary requests use KiroRuntime's
43
+ native OpenAI Responses operation and request shapes requiring `store:false`,
44
+ max effort, encrypted reasoning replay, custom grammar, namespace tools, or
45
+ Codex collaboration use the canonical stateless fallback.
43
46
  - Encrypted reasoning replay for complete native Kiro envelopes: opaque `kr1_...` tokens, AES-256-GCM storage, tenant/model/account/conversation/output binding, TTL/LRU cleanup, and account-locked replay.
44
47
  - Multi-account rotation with automatic token refresh and failover. Exhausted accounts are hard-excluded from model attempts, then automatically rejoin only after a bounded, deduplicated Kiro usage probe confirms a new quota window. A provider-owned maintenance loop also refreshes near-expiry tokens and stale usage while the service is idle.
45
48
  - `kiro-provider login` and `accounts import` write directly to the provider-owned local authentication store. The former `auth_source: "opencode-shared"` compatibility mode was removed in 0.7.0; a configuration that still selects it fails at startup with migration instructions (import once, then use `local`).
@@ -48,54 +51,30 @@
48
51
 
49
52
  ## Protocol compatibility
50
53
 
51
- v0.5 is intentionally a **verified compatibility subset**. It does not accept
52
- fields and silently discard them. The default `protocol_projection_mode:
53
- "safe"` never prepends or rewrites client instructions, merges adjacent
54
- messages, clears repeated assistant output, removes trailing text such as `{`,
55
- or creates model-visible compensation prose.
56
-
57
- Key boundaries:
58
-
59
- - plain text, consecutive same-role turns, function/custom tool declarations,
60
- calls, and results retain their original structure and order;
61
- - plain-text-only top-level blocks remain distinct in the canonical request,
62
- then are concatenated byte-for-byte with no inserted separator at Kiro's
63
- single-text-field boundary; multiple text blocks interleaved with images or
64
- tool content still return `unsupported_content_block_projection`;
65
- - `instructions`, `system`, and `developer` return
66
- `unsupported_instruction_projection` in safe mode because Kiro accepted a
67
- valid `additionalContext` shape but did not preserve its instruction content
68
- or priority in live GPT and Claude probes;
69
- - `tool_choice: auto` is supported; `parallel_tool_calls: false` is accepted as
70
- a no-op only when no callable tool can run (including `tool_choice: none`),
71
- and otherwise returns `unsupported_parallel_tool_calls`; required/named
72
- choice, strict schemas, custom grammars, and namespace tools are rejected
73
- rather than weakened;
74
- - base64/data-URL images are supported, while remote image URLs and detail
75
- controls are rejected;
76
- - Responses `input_file` supports inline base64/data-URL documents in Kiro's
77
- native document formats. The original filename remains in the canonical
78
- request; its recognized extension becomes the separate Kiro `format`, while
79
- the extensionless ASCII name is validated before the SDK call. Names that
80
- would require lossy rewriting return `invalid_file_name`; `file_id`
81
- references are rejected because the provider has no OpenAI file store;
82
- - an output-token limit is probe-confirmed for `claude-sonnet-5` and
83
- `claude-opus-5` variants in the range 1,024–128,000;
84
- - Responses omits only the exact `...`/`…` reasoning placeholder emitted by
85
- GPT 5.6 Sol; Opus reasoning, non-placeholder Sol reasoning, effort mapping,
86
- and encrypted reasoning replay remain unchanged;
87
- - stateful Responses fields and native Web Search remain unsupported, and the
88
- provider never fabricates search/citation events.
89
-
90
- The current state of the verified subset, the compiled-binary acceptance runs
91
- behind each release, and the 2026-09-02 full code review with its remediation
92
- plan are recorded in [`docs/audits/`](docs/audits/README.md). Stable releases
93
- stay gated on those records rather than on silently discarding unsupported
94
- fields.
95
-
96
- For the complete capability matrix, error codes, reasoning replay contract,
97
- and v0.4 migration steps, see
98
- [`docs/PROTOCOL_COMPATIBILITY.md`](docs/PROTOCOL_COMPATIBILITY.md).
54
+ V3 implements the core OpenAI Responses resource and makes every upstream
55
+ difference explicit:
56
+
57
+ - native JSON/SSE creation, instructions, function tools, supported effort and
58
+ token controls, and native `previous_response_id`;
59
+ - automatic stateless fallback for `store:false`, max effort, encrypted
60
+ reasoning, custom grammar, namespace tools, and Codex multi-agent items;
61
+ - tenant-isolated local response mirrors for retrieve, delete, input-items
62
+ pagination, and continuation;
63
+ - field-level OpenAI error envelopes for capabilities Kiro cannot preserve,
64
+ including Responses conversation objects, background execution, Structured
65
+ Outputs, hosted tools, remote file references, compact, and exact
66
+ input-token counting.
67
+
68
+ The old GenerateAssistantResponse `safe` mode remains fail-closed because
69
+ `additionalContext` did not preserve instruction content or priority, and the
70
+ account does not advertise the private `systemPrompt` feature. The default
71
+ `v3-auto` path instead uses KiroRuntime CreateResponse's native
72
+ `instructions` field.
73
+
74
+ For the transport decision table, stored-response contract, data-retention
75
+ boundary, verified model controls, and current client evidence, see
76
+ [`docs/PROTOCOL_COMPATIBILITY.md`](docs/PROTOCOL_COMPATIBILITY.md) and the
77
+ [`docs/audits/`](docs/audits/README.md) records.
99
78
 
100
79
  ## Install
101
80
 
@@ -135,11 +114,11 @@ irm https://raw.githubusercontent.com/sunerpy/kiro-provider/main/scripts/install
135
114
  Both scripts download the platform asset together with the release's `SHA256SUMS`, verify the checksum, and abort on a mismatch before installing to `~/.local/bin` (override with `KIRO_PROVIDER_INSTALL_DIR`). By default they follow `releases/latest`; for reproducible or service installs, pin a release with `KIRO_PROVIDER_VERSION` (recommended):
136
115
 
137
116
  ```bash
138
- curl -fsSL https://raw.githubusercontent.com/sunerpy/kiro-provider/main/scripts/install.sh | KIRO_PROVIDER_VERSION=0.5.1 sh
117
+ curl -fsSL https://raw.githubusercontent.com/sunerpy/kiro-provider/main/scripts/install.sh | KIRO_PROVIDER_VERSION=3.0.0 sh
139
118
  ```
140
119
 
141
120
  ```powershell
142
- $env:KIRO_PROVIDER_VERSION = "0.5.1"; irm https://raw.githubusercontent.com/sunerpy/kiro-provider/main/scripts/install.ps1 | iex
121
+ $env:KIRO_PROVIDER_VERSION = "3.0.0"; irm https://raw.githubusercontent.com/sunerpy/kiro-provider/main/scripts/install.ps1 | iex
143
122
  ```
144
123
 
145
124
  ### 3. From source (developers)
@@ -503,7 +482,7 @@ Config is loaded from `~/.config/kiro-provider/config.json` (or `$XDG_CONFIG_HOM
503
482
  | `port` | `8787` | `KIRO_PROVIDER_PORT` |
504
483
  | `api_keys` | required, non-empty | `KIRO_PROVIDER_API_KEYS` |
505
484
  | `enable_legacy_chat_completions` | `false` | `KIRO_PROVIDER_ENABLE_LEGACY_CHAT_COMPLETIONS` |
506
- | `protocol_projection_mode` | `safe` | `KIRO_PROVIDER_PROTOCOL_PROJECTION_MODE` |
485
+ | `protocol_projection_mode` | `v3-auto` | `KIRO_PROVIDER_PROTOCOL_PROJECTION_MODE` |
507
486
  | `session_affinity_mode` | `explicit-only` | `KIRO_PROVIDER_SESSION_AFFINITY_MODE` |
508
487
  | `auth_source` | `local` | `KIRO_PROVIDER_AUTH_SOURCE` |
509
488
  | `opencode_auth_db_path` | `null` (deprecated since 0.7.0, ignored) | `KIRO_PROVIDER_OPENCODE_AUTH_DB_PATH` |
@@ -560,12 +539,12 @@ Chat-Completions-only client (`@ai-sdk/openai-compatible`, older LangChain
560
539
  adapters, or an OpenCode custom provider using that package) at
561
540
  `POST /v1/chat/completions` after explicitly enabling the legacy endpoint.
562
541
 
563
- Standard clients must also stay within the verified subset. In safe mode a
564
- client that always sends system/developer instructions, custom grammars,
565
- namespace tools, or Anthropic `cache_control` receives a field-level 400; the
566
- gateway does not modify that request to force it through Kiro. The optional
567
- `legacy-user-prefix` projection is a temporary instruction-only migration aid
568
- for v0.5.x/v0.6.x and is scheduled for removal in v0.7.0.
542
+ The default `v3-auto` mode accepts standard instructions through KiroRuntime's
543
+ native Responses field. Requests that need custom grammar, namespace tools,
544
+ Codex collaboration items, encrypted reasoning replay, max effort, or
545
+ `store:false` automatically use the stateless compatibility lane. Unsupported
546
+ hosted capabilities fail with a field-level OpenAI error instead of being
547
+ silently ignored.
569
548
 
570
549
  The default `session_affinity_mode: "explicit-only"` never hashes prompt text
571
550
  to guess a conversation. Responses checks, in order,
@@ -582,9 +561,10 @@ socket behavior.
582
561
  The temporary `legacy-initial-input` mode restores only the old affinity
583
562
  heuristics and logs a startup warning; it does not alter request content.
584
563
 
585
- Stateful Responses fields `previous_response_id` and `conversation` are
586
- rejected until the gateway has a real response-state store, so clients must
587
- resend the complete input.
564
+ `previous_response_id` is supported for tenant-local mirrored responses.
565
+ `conversation` objects remain unsupported. Retrieve, delete, input-items, and
566
+ cancel use the local mirror; deleting it does not prove deletion of Kiro's
567
+ upstream state.
588
568
 
589
569
  <details>
590
570
  <summary>Agent command reference</summary>
@@ -665,7 +645,8 @@ returns `unsupported_instruction_projection` and never rewrites the request.
665
645
  Set Zuno `options.maxTokens` to `null` as shown so its generic layer does not
666
646
  add the unsupported `max_output_tokens: 32000`. Neither setting uses a private
667
647
  Header or client-side prompt patch; the legacy mode is an explicit migration
668
- exception scheduled for removal in v0.7.0.
648
+ exception whose removal is gated on native instruction fidelity or completed
649
+ client migration.
669
650
 
670
651
  ## Use with Codex CLI
671
652