Repository navigation
feat(kiro): bulk refresh-token import + thinking/agentic variants - #1273
Open
aminfathullah wants to merge 2 commits into
Open
aminfathullah wants to merge 2 commits into
aminfathullah wants to merge 2 commits into
Conversation
Bulk refresh-token import
-------------------------
- POST /api/oauth/kiro/import now accepts many tokens at once via a
`refreshTokens` array or whitespace/comma/semicolon-separated string,
while keeping the legacy `refreshToken` single-token shape (and its
`connection` response field) intact.
- Each token is validated and persisted in parallel; per-token results are
returned as `{ imported: [...], failed: [...] }`. Status is 200 when at
least one token is imported, 422 otherwise.
- GET /api/oauth/kiro/auto-import now accepts `?all=1` to walk every
`~/.aws/sso/cache/*.json` entry, sorted with `kiro-auth-token.json`
first and deduplicated by token value.
- KiroAuthModal swaps the single Input for a textarea with a live token
count, calls `?all=1` for autodetect, and renders a per-token
imported/failed summary. Pure helpers extracted into
`src/app/api/oauth/kiro/import/helpers.js` for unit testing.
Thinking / agentic model variants
---------------------------------
- Added `-thinking`, `-agentic`, and `-thinking-agentic` synthetic model
IDs for every Kiro base model (claude-sonnet-4.5, claude-haiku-4.5,
deepseek-3.2, qwen3-coder-next, glm-5, MiniMax-M2.5) in both
`open-sse/config/providerModels.js` and `cli/src/cli/menus/providers.js`.
- Suffixes are stripped before the upstream request leaves the process
and inject Kiro's standard system-prompt sentinels.
Inline-thinking emission (Claude on Kiro)
-----------------------------------------
- Live testing revealed Claude on Kiro emits reasoning inline as
`<thinking>...</thinking>` inside `assistantResponseEvent.content`,
not as separate `reasoningContentEvent` frames.
- Added a stream-safe state-machine splitter in
`open-sse/executors/kiroThinking.js` that holds back up to 11 trailing
chars of a potential partial tag across SSE chunks, so tags split
across slices are joined correctly. Only engaged when the request
contains `<system-reminder>thinking</system-reminder>`; non-thinking
flows are untouched.
Tests
-----
- 13 unit tests for the inline-thinking splitter (cross-chunk splits,
char-by-char streaming, leftover flush, partial-tag holdback,
false-positive tag-shaped text).
- 16 unit tests for the import helpers (legacy/array/string shapes,
mixed separators, dedupe, trim, malformed payloads, mask format).
- All 29 new tests pass; ESLint clean across all modified files.
Next.js 16 with workspace tracing root writes the standalone bundle one level deep (e.g. `.next/standalone/9router/server.js`) instead of at the top of `.next/standalone/`. The build-cli copy step was hardcoded for the flat (Next 13-15) and legacy nested-app (pre-13) layouts and silently bailed when neither matched. Probe all three layouts in turn and log which one was used so the same script keeps working across Next.js upgrades.
aminfathullah
force-pushed
the
feat/kiro-bulk-import-and-thinking-variants
branch
from
May 19, 2026 06:46
ddcb6a5 to
6b5c316
Compare
This was referenced May 27, 2026
Closed
2 of 3 tasks
diegosouzapw
pushed a commit
to diegosouzapw/OmniRoute
that referenced
this pull request
Jun 26, 2026
Ports the kiroThinking module from decolua/9router#1273. When `<thinking_mode>enabled</thinking_mode>` is injected into the system prompt, Claude on Kiro streams its reasoning **inline** inside `assistantResponseEvent.content` as `<thinking>…</thinking>` blocks rather than as separate `reasoningContentEvent` frames. The new `open-sse/executors/kiroThinking.ts` module provides two pure functions — `splitInlineThinking` and `flushPendingThinking` — that walk each content slice and route characters to either the `delta.content` or `delta.reasoning_content` SSE channel. State is carried across slices so tags split between frames (e.g. `<thi` then `nking>`) are still recognised. `KiroExecutor.transformEventStreamToSSE` now accepts a `thinkingExpected` option (derived from the upstream request body) and wires the splitter into the `assistantResponseEvent` handler and the `flush` callback. The passthrough path for non-thinking requests is unchanged. 13 unit tests cover plain content, full blocks, split tags, character-by-character feeding, multiple blocks, mid-stream truncation, and null/empty inputs — all green. Inspired-by: decolua/9router#1273 Co-authored-by: Amin Fathullah <11917479+aminfathullah@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related improvements to the Kiro provider, plus a small CLI build fix that fell out of testing.
1. Bulk refresh-token import
POST /api/oauth/kiro/importnow accepts many tokens at once. The legacy single-token shape (and itsconnectionresponse field) is preserved.{ "refreshToken": "aorAAAAAG..." } // legacy { "refreshTokens": ["aorAAAAAG-1", "aorAAAAAG-2"] } // new — array { "refreshTokens": "aorAAAAAG-1\naorAAAAAG-2 aorAAAAAG-3" } // new — split on whitespace/comma/semicolonEach token is validated and persisted in parallel; per-token results return as
{ imported: [...], failed: [...] }. Status is 200 if any succeed, 422 otherwise.GET /api/oauth/kiro/auto-import?all=1walks every~/.aws/sso/cache/*.json, sorted withkiro-auth-token.jsonfirst and deduplicated by token.KiroAuthModalswaps the single Input for a textarea with a live token count, calls?all=1for autodetect, and renders an imported/failed summary.2. Thinking / agentic model variants
Added
-thinking,-agentic, and-thinking-agenticsynthetic model IDs for every Kiro base model (claude-sonnet-4.5, claude-haiku-4.5, deepseek-3.2, qwen3-coder-next, glm-5, MiniMax-M2.5) in both web (open-sse/config/providerModels.js) and CLI (cli/src/cli/menus/providers.js).Suffixes are stripped before the upstream request leaves the process and inject Kiro's standard system-prompt sentinels.
3. Inline-thinking emission (Claude on Kiro)
Live testing surfaced that Claude on Kiro emits reasoning inline as
<thinking>...</thinking>insideassistantResponseEvent.content, not as separatereasoningContentEventframes. The newopen-sse/executors/kiroThinking.jsis a stream-safe state-machine splitter that holds back up to 11 trailing chars of a potential partial tag across SSE chunks, so tags split across slices are joined correctly. Only engaged when the request contains<system-reminder>thinking</system-reminder>; non-thinking flows are untouched.4. CLI build fix (separate commit)
Next.js 16 with workspace tracing root writes the standalone bundle one level deep (
.next/standalone/9router/server.js) instead of at the top.build-cli.jsnow probes all three layouts (flat, nested-by-workspace-folder, legacy nested-app) so the same script keeps working across Next upgrades.Tests
Pre-existing failures in
unit/rtk.test.jsandunit/oauth-cursor-auto-import.test.jsare unrelated to this work and exist onmasterat v0.4.55.Commits
feat(kiro): bulk refresh-token import + thinking/agentic model variantsfix(cli): detect Next.js 16 standalone layout under workspace folder