Commit Graph
39 Commits
Author SHA1 Message Date
caozhenyuanandcaozhenyuan d91f8e31a0 kiro 0.1.37: switches to pin an Identity Center account to one credit region (#964)
Two switches in the provider's editor, "Use us-east-1 only" and "Use
eu-central-1 only" (us-east-1-only, eu-central-1-only), pin an Identity
Center account to one credit region. They are read with input.magpie.option
at each request.
- With one on, every request goes to that region. If that region is not
  enabled or is used up, the answer is a 429 naming the switch, and the
  other region is never tried.
- auth.usage counts only the pinned region. If the pinned region is not
  enabled or couldn't be read, a used-up window gives the reason, so the
  account is left out of routing.
- The not-enabled reminder names only the pinned region.
- Both off, or both on, is the default.

Run at 38c18529 merged with main 7153e59d (Windows 11, Bun 1.4.2, temp
HOME and USERPROFILE):
- bun test packages/kiro: 178 pass, 8 fail. The 8 are the EBUSY cleanup
  reds that fail the same on main on Windows (#966).
- bun scripts/check.mjs kiro: ok.
- The review's two probes, the reminder under a pin and an unenabled
  pinned region, now give the right card.
Broken by hand: dropping the pinned-reminder filter and the unenabled-pin
window turns 3 region tests red.
Not tried: a real Identity Center account in both regions, and the
switches in magpie's editor.

Co-authored-by: caozhenyuan <caozhenyuan@users.noreply.github.com>
2026-11-11 11:35:34 +08:00
yetone 5292fc9f55 kiro 0.1.36: overage is its own window against its cap; the plan's credits are the plan's (wizcheu on X)
wizcheu on X, Kiro Power (10000 credits) with overage on: the Kiro IDE
shows "10000 used / 10000 covered in plan" and 2589.24 post-paid credits
used (12589.24 this month). magpie showed 12589.24 / 37500 (in "left"
mode 24910.76 / 37500), the overage cap taken for the month's whole
limit.

The cap counts the overage alone: it is the profile's "maximum allowed
overage" quota, in USD at $0.04 a credit (Kiro's Service Quotas
L-75434B0B; $400 is 10000 credits, the cap the 0.1.28 fixture had on a
2000-credit plan). So with overage on the month is now two windows, as
the IDE shows it:
- the plan's credits, min(used, plan) / plan, shown only (aside): using
  them up doesn't stop the account;
- "Overage": currentOveragesWithPrecision (else currentOverages, else
  what is past the plan) / overageCap, the window that stops it.
With overage off nothing changes. An Identity Center account's regions
sum each: the plans' sum first, shown only, then the overages' sum,
which is the one magpie weighs; a region is used up when its overage
is.

Run (mote, macOS, Bun 1.4.2, HOME a temp dir), at this commit:
- bun test packages/kiro: 172 pass, 0 fail.
- bun scripts/check.mjs: ok.
Broken by hand, bun test packages/kiro/region.test.mjs:
- index.mjs from origin/main (overage cap as the month): 6 fail,
  the reporter's numbers among them.
- a region used up by its plan, not its overage: 1 fail ("a region
  past its plan with overage left is still used").

Not tried: a real Kiro account with overage on. The fixture is built
from the reporter's screenshot (12589.24, 10000, 2589.24, 37500); the
overageCap-is-overage-only reading is from Kiro's quota docs, not from
a read of a real account at its cap.
2026-11-10 17:58:29 +08:00
yetone 588b3611cb kiro 0.1.35: the sign-in's ways, question and choices in magpie's languages
mahiro233 on magpie's Discord (plugin 0.1.34, magpie v0.1.3372): in a
Chinese window, the account sheet's "Choose a sign-in method" and its
three choices read in English. Each way, question and choice now gives its
words in Chinese, Traditional Chinese, Japanese and German, as magpie's
own labels, messages and hints fields beside the English (magpie reads
them from its next release; OpenCode and an older magpie show the English,
which is unchanged). "AWS Builder ID" stays the product's name; its hint
is translated. The API key way also gives its field a "ksk_…" placeholder.

The same report said there's no API key option. The plugin has had one
since it began (the third way, "Kiro API key (ksk_…)", as kiro-cli uses
KIRO_API_KEY), but magpie opened a moved Kiro's first way at once, and its
question left no way to the others; magpie's side of the fix is in
yetone/magpie.

Run on mote: packages/kiro bun test with HOME under the temp dir, 171 pass
0 fail; bun run check ok (exit 0).
Broken by hand: with origin/main's index.mjs, signin-words.test.mjs goes
red (the first way's zh label undefined).
Not tried: a real sign-in (no words on the wire changed); the full root
suite.
2026-11-09 18:22:25 +08:00
yetone 1aab125bf1 kiro 0.1.34: each model shows Kiro's credit multiplier
01huadalang on Discord: "kiro 加上积分倍率消耗". Kiro's
List-Available-Models gives each model rateMultiplier with rateUnit
"Credit"; listModels now carries it as the model's rate, which magpie's
plugin host reads (rateOf) as Model.Rate, on the account's list and on the
config's model. A null, non-number, zero or negative multiplier, or a unit
other than Credit, gives no rate.

Values from a real Free account on 11-09 (origin KIRO_CLI and AI_EDITOR
answer the same, and kiro-cli chat --list-models shows the same
rate_multiplier): auto 1, claude-sonnet-4.5 1.3, claude-haiku-4.5 0.4,
deepseek-3.2 0.25, minimax-m2.5 0.25, minimax-m2.1 0.15, glm-5 0.5,
qwen3-coder-next 0.05. rate.test.mjs keeps sonnet's and the default
model's objects as Kiro sent them.

Usage is not multiplied again: the credits a request's meteringEvent
reports (usage.credit) already include the rate. One prompt cost 0.005349
on haiku and 0.017385 on sonnet, 3.25x, which is 1.3/0.4. The README says so.

Run on mote: packages/kiro bun test with HOME under the temp dir, 170 pass
0 fail; bun scripts/check.mjs kiro ok. Real run: listModels with kiro-cli's
sign-in returned all eight rates and runtimeModel carries them.
Broken by hand: without the rate in listModels both rate tests go red;
without the unit check the "no rate" test goes red.
Not tried: a Pro account's list (only Free); the rate in magpie's GUI. The
full root suite at this head was cut off when mote dropped mid-run
(connection closed by the host); it was not run to the end.
2026-11-09 12:45:12 +08:00
yetone 9b41df1507 kiro 0.1.33: an account in Kiro IDE's CreateResponse experiment is asked at /v1/responses, as the IDE asks it (#842, #848)
ThirdTimes (#842, #848): on one Builder ID account the plugin (0.1.32)
was answered 429 USER_REQUEST_RATE_EXCEEDED on generateAssistantResponse,
and Kiro IDE 1.4.121, 11s later, was answered. The IDE's log says
"api=CreateResponse armSource=experiment callPath=main". The version
strings the plugin sends already match the IDE (1.4.121, the update
feed's latest, 2026-11-06). The difference is the call. Kiro puts accounts
in a create_response_api experiment, and an account in its arm is asked
at POST runtime.<region>.kiro.dev/v1/responses. The IDE's own
generateAssistantResponse title call on that account was 429 too.

All of this is read from the IDE's extension.js (kiro.kiro-agent, in the
1.4.121 linux tarball, which was not run):
- The experiment is read as ExperimentConfigService reads it:
  GET /featureConfiguration?origin=AI_EDITOR&version=1.4.121 with
  x-amzn-kiro-profile-arn. The key is
  sha256hex("kiro-feature-config-key-salt-3e9b1d7a" + "create_response_api"),
  and the arm's value is "create_response". The result is kept 15 minutes
  per sign-in. A failed read is asked again after 60s and keeps the last
  good config, and the read has a 5s timeout. With no config the account
  stays on generateAssistantResponse, as the IDE's default does, so an
  account outside the arm is sent what 0.1.32 sent.
- CreateResponse is sent with the IDE's headers: the plain IDE user agent
  (no aws-sdk prefix, no amz-sdk-*), x-amzn-kiro-origin AI_EDITOR,
  x-amzn-codewhisperer-optout, x-amzn-kiro-profile, TokenType and
  x-amzn-kiro-attempt "n;max=3". The body is {model, input, tools, stream,
  origin, profileArn, metadata kiro:agent_mode/kiro:conversation_id,
  reasoning}, made from the request built for generateAssistantResponse
  (history, tool calls and results, images as data: URLs). The system text
  stays at the head of the first message, as with the IDE's
  system_field_injection off.
- The SSE reply is read into the same events the old frames gave: text,
  reasoning and its signature, refusals, function calls (pieces or
  whole), stop reason, context %, and credits. An error before any answer
  becomes the status generateAssistantResponse's would have, mapped through
  the IDE's reason table (rate_limit_exceeded is USER_REQUEST_RATE_EXCEEDED,
  context_length_exceeded is CONTENT_LENGTH_EXCEEDS_THRESHOLD, and so on).
  The 0.1.32 429 retry applies to both paths.

Not done: the auxiliary path (create_response_api_auxiliary; the plugin
has no auxiliary calls), the x-amzn-kiro-fallback header, documents as
input_file, and reasoning items in history.

Run on mote at base 966cf717: packages/kiro bun test 168 pass 0 fail
(HOME a temp dir). bun scripts/check.mjs kiro ok. Root bun test 6892 pass,
20 skip, 0 fail. Rebased onto e7af7856 (inkstone only) before pushing.
Broken by hand: with the arm's value changed, 8 of the 11 new tests go
red. image-size and refresh tests now leave the featureConfiguration GET
out of what they count as a chat send.

Not tried: a real Kiro account. No account in the CreateResponse arm was
available, so the /v1/responses body and SSE are as the IDE's source
writes and reads them, not as captured from Kiro.
2026-11-08 20:31:34 +08:00
yetone 966cf71764 kiro: a 429 throttle is waited out and tried again, as the Kiro IDE does (0.1.32)
onemezao on Discord: a "hi" answered, and the next message straight
after was Kiro's 429 USER_REQUEST_RATE_EXCEEDED, while the Kiro IDE on
the same Builder ID account and model (claude-haiku-5.5) took two
messages in a row (plugins#842, plugins#848).

The IDE gets the same throttles; it rides them out. Its chat client
(kiro.kiro-agent 1.1.787, dist/extension.js) classifies a
ThrottlingException with reason USER_REQUEST_RATE_EXCEEDED or
CREDIT_CONSUMPTION_RATE_EXCEEDED (ClientThrottleError) or any other
throttle (ServiceThrottleError) as retryErrorType THROTTLING, and its
QClientRetryStrategy tries 3 times: Kiro's retryAfterMilliseconds when
said, else 1s doubling (20% jitter, 20s max), counting each try in
amz-sdk-request and x-amzn-kiro-attempt. It shows "Retrying in N
seconds" over 2s. The plugin sent the first 429 back at once, and
since 0.1.30 with Retry-After 30s, so magpie didn't retry either.

Now paced() sends a chat call the same way: a 429 throttle (those three
reasons, or a reasonless "too many requests"/throttling) is waited out
and sent again, up to 3 tries, one invocation id, attempt=N; max=3. A
wait Kiro says is over 20s isn't held: the 429 goes back with it as
before. Usage limits (MONTHLY/DAILY/..., USAGE_LIMIT), model capacity
and other statuses aren't retried. A cancelled request ends during the
pause and isn't sent again. The last try's 429 keeps 0.1.30's words and
Retry-After.

The 47.3K input tokens of a "hi" are Kiro's own contextUsagePercentage
times the model's window: the agent's system prompt and tools, not
something the plugin adds.

Run (mote, HOME and TMPDIR inside the run dir):
- packages/kiro: bun test, 157 pass 0 fail.
- repo root: bun test; bun scripts/check.mjs kiro.
  Root: 6867 pass, 0 fail, 6887 tests across 499 files; check ok.

Broken by hand: paced() returning the first answer (n >= 1) turns 5
tests red (the four new throttle tests in errors.test.mjs and
region.test.mjs's rate-limit case).

Not tried: a real throttled Kiro account. No Builder ID account that
Kiro throttles was at hand, so the retry is checked against the IDE's
code and mocked answers only, not against Kiro.

Reported-by: onemezao (Discord)
2026-11-08 04:52:34 +08:00
yetone b81000019f kiro 0.1.31: reasoning sent with its signature in one event keeps it; chat as the Kiro IDE
Called as the Kiro IDE (previous commit), Kiro's auto ends a reply with
one reasoningContentEvent holding both text ("...") and a signature
(".KTR~~…"). events() read the text and dropped the signature, so the
reply had a thinking block with an empty one. Both are now kept: the
signature goes on the block the text began, streamed (signature_delta)
or not. The IDE's own reader (extension.js) keeps them together too.

Version 0.1.31 carries this and the IDE identity.

Run on mote: bun test in packages/kiro (152 pass), bun scripts/check.mjs
kiro, in a temp HOME.
Broken by hand: reasoning-signature.test.mjs (the payloads of a real
reply) against the old else-if, 2 of 2 red.
Real use (same sandbox as before): auto answered 200 with the thinking
block's signature kept, a second turn carrying that block back answered
200, and the streamed reply sent the signature_delta.
Not tried: a thinking model with a budget under the new identity.

Reported-by: onemezao
2026-11-07 20:43:30 +08:00
yetone 44df5f0505 kiro 0.1.30: an account's request rate (USER_REQUEST_RATE_EXCEEDED) says whose limit it is, and isn't re-asked at 1/2/4s
onemezao on Discord: through pi, every request of a one-account Kiro
setup (claude-haiku-5.5, 965KB sent) failed after 42s with Kiro's "Too
many requests, please wait before trying again.
(USER_REQUEST_RATE_EXCEEDED)", while the Kiro IDE answered on the same
account. Kiro's words say neither whose limit it is nor what to do, and
with no wait given magpie sent the whole request to the same account
again at 1, 2 and 4s, each try one more against that account's rate.

- failure() and the stream's exception() turn that reason into a 429
  that says Kiro is limiting this account's requests, to wait a minute,
  and that a limit persisting while the Kiro app works is on the account
  for Kiro support, with the request ID (x-amzn-requestid, as the IDE
  reads it) when Kiro gave one.
- When Kiro gives no wait for that reason, Retry-After is 30s, past
  magpie's same-account retries (8s), so the 1/2/4s re-asks stop. A
  wait Kiro does give still wins; other reasons keep magpie's pauses.

Cause, from a real account (the owner's existing kiro-cli sign-in, no
sign-in or refresh, sandbox HOME): a 975KB request is not refused as a
rate: claude-haiku-4.5 answers 400 CONTENT_LENGTH_EXCEEDS_THRESHOLD and
auto (1M) answers 200 in 8.9s; 467KB on haiku 200 in 5.2s; "?" 200. So
the reporter's 429 is Kiro's per-account request-rate state, not the
body or the model. Kiro's own tracker has the same reason on the IDE
for hours (kirodotdev/Kiro#10937, #8549), answered by support.

Run on mote: bun test packages/kiro (146 pass), bun scripts/check.mjs
kiro, and the repo's bun test (6759 pass, 0 fail), each in a temp HOME.
Broken by hand: the new tests against the old index.mjs, 3 red (the
Retry-After cases, the plain message with request ID, the stream case).
Not tried: a real USER_REQUEST_RATE_EXCEEDED (couldn't be drawn without
hammering an account), claude-haiku-5.5 (not on the owner's account),
and whether the Kiro IDE's other request path (CreateResponse) is
rate-counted apart from generateAssistantResponse.

Reported-by: onemezao
2026-11-07 16:58:27 +08:00
caozhenyuan 4200fed099 kiro 0.1.29: what Kiro's meteringEvents say a request cost goes on as usage.credit (#823)
Kiro gives no token counts, only what each request cost in credits: a
meteringEvent ({"unit": "credit", "usage": 0.091}) near the end of its
reply. The plugin read past it, so magpie's Usage page reckoned Kiro's
cost from estimated tokens with no cache (yetone/magpie#4328, #3761).

The credits of a request's meteringEvents are now summed (a hosted web
search's turns are one request) and said as usage.credit in the last
message_delta, streamed, or in the message's usage, as WorkBuddy's
usage.credit is said on the Chat path. A reply with none says no credit;
one Kiro says cost 0 says 0. An event in another unit, or with a usage
that isn't a number of at least 0, is left out. magpie reads the field on
/v1/messages once the host half of yetone/magpie#4328 is in; until then
it is passed over.

Run at 57a4d35e on mote (Bun 1.4.2, HOME a temp dir): bun test
packages/kiro 144 pass, 0 fail; bun scripts/check.mjs kiro ok; bun test
(whole repo) 6679 pass, 0 fail. Merged onto main e7004d93: kiro 144 pass,
check ok. CI pr run 42349117220 green, attempt 1. npm had 0.1.28.
Broken by hand, each red: meteringEvent ignored (4 tests), last event
kept instead of summed, any unit taken, a negative taken, a string usage
taken, a search's turns not summed, a search keeping only its last turn,
a stated 0 dropped.
Not tried: magpie's ledger with the host half (not merged); a real Kiro
reply with more than one meteringEvent.
2026-11-07 15:27:27 +08:00
caozhenyuan e7cb9dc54c kiro 0.1.28: an Identity Center account's two credit regions, each with its overage cap (#820)
An IAM Identity Center organization can enable Kiro in both of its regions, us-east-1 and eu-central-1. Each region has its own profile, its own month of credits and its own overage cap. The plugin used only the first profile it found, so when that region was used up the account left rotation while the other region still had credits.

- Overage: with overageStatus ENABLED, the month counts against overageCap (the month's whole limit).
- Identity Center sign-ins list their profiles in both regions and keep them with the account (`profiles`, by region). A region with no profile is asked for again at most every PROBE_MS (10 minutes).
- A request goes to the first enabled region with credits left. On MONTHLY_REQUEST_COUNT / USAGE_LIMIT that region rests until its reset (an hour when none is known), and the request is sent once to the other region. A rate limit is passed on with Kiro's wait as Retry-After. When every region is used up, the reply is a 429 that names them, carries the last wait and names any region not enabled.
- auth.usage reads both regions. Each region gets a window, shown only, and their sum is the window magpie weighs the account by.
- Builder ID, Google, GitHub and API key sign-ins keep one region.

Run at head ce4004b99257fb66bac92a564a322b693748a7ec, merged onto main 978bb42b (mote, macOS, Bun 1.4.2, Node 22.22.0, HOME=$(mktemp -d)):
- bun test packages/kiro: 140 pass, 0 fail (main: 127 pass).
- bun scripts/check.mjs kiro and bun scripts/check.mjs: ok.
- Repo-wide bun test: 6675 pass, 0 fail (main: 6662 pass).
- Reviewer's Retry-After probe, social and Identity Center 429s: green, as on main.
- Broken by hand, each red in 1-2s: usedUpSaid always or never true, no spend on a used-up reply, overage off, pick ignoring spent regions, usage never spending, two regions for every sign-in, no PROBE_MS gate, no tried guard (red, no longer a hang), the wait dropped from the loop, the wait dropped from the all-used-up 429.
- Survives: a region not enabled that is never probed again after the first probe. No test covers the re-probe after PROBE_MS.

Not tried: a real Identity Center account running out in one region. The author ran real accounts enabled in one region each.
2026-11-07 14:15:17 +08:00
yetone ab0d3fe54a kiro 0.1.27: Kiro's wait before asking again goes on as Retry-After
A 429 Kiro answered before any of the reply (USER_REQUEST_RATE_EXCEEDED,
"Too many requests, please wait before trying again.") reached magpie
with no word of when, as the plugin built its error response from
nothing. With one account magpie then asked it again after 1, 2 and 4s
and on through its patience: onemezao's one small message took six asks,
five of them 429.

The plugin now reads the wait where Kiro's own clients read it and sends
it on as Retry-After (whole seconds, rounded up): the Kiro IDE's
x-amzn-kiro-ratelimit-retry-after header and the body's
retryAfterMilliseconds (both ms; kiro.kiro-agent 1.1.499, decompiled in
hj01857655/kiro-account-manager docs/Kiro-1.4.5/re/pfd-full.txt), the
x-amz-retry-after header kiro-cli 2.35's AWS SDK honours (ms, found in
the binary's strings), and HTTP's Retry-After. magpie's gateway already
waits a Retry-After: past 8s it skips the quick retries and rests the
account that long. With none said, nothing changes.

Run (mote, HOME a temp dir): bun test packages/kiro, 127 pass;
bun scripts/check.mjs, ok.
Broken by hand: generate without the wait argument; the new test fails
(Expected "13", Received null).
Not tried: a real Kiro 429. Which of these headers Kiro sends on
generateAssistantResponse's 429 is not seen; the IDE reads them on its
CreateResponse path. Hammering a real account to get one was not done.

Reported-by: onemezao
2026-11-07 03:17:09 +08:00
yetone 17e5ef7457 all: load on OpenCode 2.x through a default {id, setup} (#657)
nbczw8750 (#657): trae 0.2.26 on OpenCode 2.2.5 fails with "Plugin
must export a default definition with an id and an effect or setup
function. (cause: SchemaError(Missing key at ["default"]))". 2.x
imports a package's exports["."] (a plugin dir and an npm install
alike) and has no V1 path at all, so every package here that serves
models failed the same way, not only trae.

Every one of the 32 model packages now has:
- opencode2.mjs, exports["."]: a copy of scripts/opencode2.mjs, an
  adapter that runs the package's V1 plugins inside 2.x's promise
  API. Config providers become 2.x providers (package pinned so the
  aisdk sdk hook runs), V1 auth methods become integration methods
  (oauth auto/code with forms; api without authorize as a key method),
  V1 credentials are kept in metadata.v1, the loader's baseURL,
  apiKey, headers and fetch are applied through the sdk hook, an
  auth.set renewal is stored per credential, and credential.switched
  /updated reload the account's own model list.
- opencode.mjs, main: re-exports the V1 plugin functions only.
  OpenCode 1.x and magpie's host.js take main. On 1.x, trae 0.2.26's
  main exported a non-plugin (_internal) and 1.19.5 refused it ("Plugin
  export is not a function"); the new main fixes that too.
- both files in "files"; patch version bumped. devin already had 2.x
  and is unchanged.

scripts/check.mjs fails a model package whose 2.x entry has no default
{id, setup}, whose opencode2.mjs differs from the canonical one, whose
entry is missing from files, or whose main exports a non-plugin.

Run at this head (mote):
- HOME=$(mktemp -d) bun test, as CI runs it: 4900 pass, 0 fail
  (4914 tests, 374 files). A first run set globalThis.fetch for the
  whole process from opencode2.test and failed 528 tests in other
  packages; the block is now set and put back around that file's tests.
- bun scripts/check.mjs: every package passes. With the network
  blocked cloudflare-workers-ai fails on its fetched catalog, the same
  on origin/main.
- Real OpenCode 2.2.5 (npm opencode-ai), sandbox HOME, packed trae
  0.2.27: loads with no error; /api/integration lists trae-cn "Trae CN"
  and trae-global "Trae Global" with their browser sign-ins; `auth
  login` starts the trae.cn authorization and waits (cancelled there);
  with a fake credential POSTed to /api/credential, `opencode models`
  lists trae-cn's six models.
- Real 2.2.5 with a fake V1 key plugin through the same adapter
  against a local fake server: `auth login` with a key, `models`,
  `opencode run` reached /real/v1/chat/completions with the loader's
  "Bearer loader-sk-fake" and header, and printed the fake's reply;
  with @ai-sdk/anthropic it reached /real/v1/messages with x-api-key
  from the loader. This run found the key method missing after 2.x's
  second integration transform (a once-only flag outside the
  transform); fixed, and opencode2.test checks a rebuild.
- Real OpenCode 1.19.5, sandbox HOME, trae 0.2.27: `opencode models`
  lists trae-cn and trae-global models; 0.2.26 failed there.

Broken by hand (scratch copy, bun test scripts/ and check.mjs):
- trae's exports back to "./index.mjs": the trae 2.x test fails
  (default.id undefined), check fails trae with "OpenCode 2.x:
  ./index.mjs has no default {id, setup} (plugins#657)".
- zed's opencode2.mjs changed: the copies test fails, check fails zed
  "differs from scripts/opencode2.mjs".
- the key flag back outside the transform: the 1.x plugin test fails
  on the rebuilt sign-ins (key missing).

Not tried: a real sign-in with a real account on 2.x; Windows (the
reporter's OS); chat.headers, chat.params, usage and tool hooks, which
the adapter doesn't carry to 2.x; the tools/pages packages (calc,
goanyapi, layerfs, search1api, aelios, agent-console, chat,
fingerprint, nowledge-mem, kimi-desktop), which still load only on 1.x.
2026-11-03 13:54:26 +08:00
Giant_GKL 605381174d kiro 0.1.25: bonus credits show on the Usage card, each with when it lapses (#602)
kiro 0.1.25: bonus credits (bonuses in Get-Usage-Limits) show on the Usage card as windows of their own, aside, with when they lapse; a month used up while a bonus has credits left is set aside too, since Kiro spends plan credits first.

Reviewed head fc9eb1e on main df98bf6, on macOS (Bun 1.4.2): packages/kiro bun test 126 pass 0 fail; root bun test 4533 pass 9 skip 0 fail; scripts/check.mjs ok. With main's index.mjs, 3 of the new usage tests fail; removing the carried aside, the expiry filter, the ACTIVE filter, the bonus aside or the spent-bonus runsOut guard each turns at least one red. Shape checked against kiro-cli's UsageBreakdown model (bonuses, FIRST_UPGRADE_TRIAL) and kiro.dev/docs/billing. Not tried with a real Kiro account by the reviewer.
2026-11-01 22:14:27 +08:00
yetone e8050e812d kiro 0.1.24: a conversation past the model's window is a 400 that says too long
Kiro says a conversation is too long for the model three ways: an HTTP
400 ValidationException "Input is too long." (CONTENT_LENGTH_EXCEEDS_THRESHOLD),
the same ValidationException as an exception frame in the event stream,
or a metadataEvent with stopReason MODEL_CONTEXT_WINDOW_EXCEEDED. Only the
first came out as the 400 "input is too long for the model's context: ..."
that magpie's gateway reads as an overflow (tooLong). The stream exception
went out as a 502 (failedBefore), and the stop reason as end_turn.

As a 502, magpie counted a passing failure: it asked the same Kiro model
again, could rest the account, and in a group routed by intent only moved
on as for any vendor error; a lone agent got a vendor error instead of
context_length_exceeded, so it never compacted. Reported by
ergou0954_54426 on Discord (Kiro's Claude/GPT and DeepSeek in intent
routing, "kiro 那边报错说超出上下文").

Now failedBefore, and the turn after a web search, answer a too-long
exception with that 400. A MODEL_CONTEXT_WINDOW_EXCEEDED stop before any
of the reply is the same 400; after some of it, the reply ends with stop
reason model_context_window_exceeded (Anthropic's word for it). Other
exceptions keep 502, quota and throttling keep 429.

Run on mote: HOME=$(mktemp -d) bun test in packages/kiro, 122 pass;
bun scripts/check.mjs ok. Broken by hand: with index.mjs at HEAD the
three new too-long tests fail (13 pass, 3 fail in errors.test.mjs).
Not tried: a real Kiro account pushed past its window; the stream shapes
come from Kiro's own clients (amazon-q-developer-cli's error enums,
kiro.rs, opencodex's kiro stream reader).
2026-11-01 11:11:02 +08:00
yetone 3d56e7e4d6 kiro 0.1.23: an effort without thinking asked for is sent no thinking (#538)
thinking() turned thinking on for any output_config.effort above low,
even when the request had no thinking object or had thinking disabled.
Claude Code's title and side requests carry an effort and no thinking,
and a turn with thinking turned off says disabled, so Kiro was sent a
<max_thinking_length> budget for them, or, for a model whose catalog lists
effort fields, adaptive thinking at that level. Low alone was spared.
Now only thinking.type enabled or adaptive asks for thinking, as
Anthropic's API and magpie's gateway (anthropic.go) read a request.

With thinking on, nothing changes: each of low, medium, high, xhigh and
max goes as additionalModelRequestFields {thinking: adaptive,
output_config: {effort}} when the model's schema lists it, else as the
10k/20k/30k/50k/50k budget.

Run: HOME=$(mktemp -d) bun test in packages/kiro on mote: 118 pass.
bun scripts/check.mjs: ok. Broken by hand: with index.mjs at HEAD~,
the new "an effort without thinking asked for" test fails, the
per-level test passes. A probe built the body for every level x
{adaptive, enabled, none, disabled} x {schema, no schema}.
Not tried: a live Kiro account whose catalog lists effort levels.
2026-10-31 10:32:35 +08:00
yetone 9d4c7ce558 kiro: xhigh and max go as Kiro's own effort levels; trailing system context goes before the question (#538)
Two problems from #538 (zengxiaosong):

1. xhigh and max both became a 50000 <max_thinking_length> budget. The
   plugin now reads each model's additionalModelRequestFieldsSchema from
   ListAvailableModels, as Kiro IDE 1.4.62 does: when the schema offers
   thinking.type "adaptive" and an effort enum under output_config (or
   reasoning), a level in that enum is sent as
   additionalModelRequestFields {thinking:{type:"adaptive"},
   output_config:{effort}} and the XML budget is left out. A model with
   no such schema (every model on a Free account today: the schema is
   null), a level not in the enum, or thinking off, is sent as before.

2. System messages ending the conversation (Claude Code's environment
   context) were joined into the question. They now go as a user turn
   before the question, answered by "Understood." (Kiro IDE's placeholder
   for a missing assistant turn), and the question is the current
   message. Not moved when the question holds tool results or follows
   tool calls, so call/result pairs are unchanged. systemPrompt is not
   used: the reporter's account refuses it.

Run (on mote, bun 1.4.2):
- bun test packages/kiro: 115 pass.
- Full suite as CI, HOME=$(mktemp -d) bun test: 3885 pass, 0 fail;
  bun scripts/check.mjs: ok.
Broken by hand:
- nativeFields never finding a model: the two schema tests go red.
- contextFirst returning messages as given: the reporter's [user,
  system] test and the later-question test go red.
- The new tests on origin/main's index.mjs: 6 fail (in part only because
  the new exports are missing there).
Not tried: a real Kiro account whose catalog has a non-null schema. The
only account here is Free, whose ListAvailableModels gives null for every
model, so the schema shape is from Kiro IDE 1.4.62's source, and the
fixture follows it.
2026-10-31 01:13:32 +08:00
SemonCat 498358c04e kiro 0.1.21: choose direct AWS sign-in for a remote magpie (#507)
The Kiro browser sign-in asks first which way to sign in:

- AWS Builder ID registers a client with AWS OIDC (us-east-1) and opens
  AWS's authorize page directly.
- IAM Identity Center asks for the organization's HTTPS Start URL and AWS
  region (blank is us-east-1), then opens that region's AWS authorize page.
- Kiro sign-in page keeps the portal (Google, GitHub, other ways); a caller
  without inputs (OpenCode's CLI) keeps it too.

The direct ways skip the portal's first loopback callback, so a magpie on a
server or in Docker needs one pasted callback address instead of two. Still
authorization code + PKCE, same scopes, same hosts (oidc.<region>.amazonaws.com,
Kiro's own API). The callback handler now takes each stage's own state and
path once, answers a stale or foreign address with 404 without ending the
sign-in, says 409 to a second paste while a code is traded, sends a repeated
portal address to the same AWS page, and a new sign-in ends the one left
behind and frees its port at once. Kiro's page's region and AWS issuer are
checked for shape (a region can no longer put another host into the OIDC
address). Version 0.1.20 -> 0.1.21.

Reviewed head: 236db712518305415f15651178696a59a72c4a8b (base f6412ab).

Run at that head, on mote, HOME=$(mktemp -d):
- bun test packages/kiro: 110 pass, 0 fail (17 files).
- bun scripts/check.mjs kiro: ok; node --check packages/kiro/index.mjs: ok.
- Review probes (not committed), 9 pass: method list and labels the same as
  main; the portal URL (no inputs, {}, portal) has main's shape; direct
  Builder ID through magpie's loopbackPorts/openPastedCallback emulation
  signs in with the PKCE verifier, reaches only oidc.us-east-1.amazonaws.com
  and management.us-east-1.kiro.dev, and the account it saves refreshes
  through the IdC refresh_token grant; a host-injecting region
  ("us-east-1.evil.com", "us-east-1/x") and a credentialed or http Start URL
  are refused before any request; cancelled at AWS (access_denied) fails
  with AWS's reason; an expired code at the token exchange fails plainly;
  AWS register failing throws and frees the port; a superseded sign-in
  fails "another sign-in to Kiro was started" and its port is reused; a
  portal-state address on a direct sign-in is 404 and ends nothing.
- PR CI (test, on-npm): green.

Not tried: a real AWS account sign-in (the author reports reaching the
Builder ID and organization login pages on a remote magpie, and one
organization sign-in completed); the 10-minute timeout path.
2026-10-30 12:34:29 +08:00
SemonCat ecc4df3076 kiro 0.1.20: accept object tool schemas and run native web search (#492)
Kiro answers 400 REQUEST_BODY_INVALID to a tool schema whose root has
properties and no type, or is {}: the root is now sent as type "object"
(copied; nothing under it changed, another explicit root type left alone).

Anthropic's hosted web search (web_search_20250305) is searched with Kiro's
own web_search, sent as kiro-cli 2.35 sends it: InvokeMCP at the runtime's
root (AWS JSON 1.0, x-amz-target AmazonCodeWhispererStreamingService.InvokeMCP),
a JSON-RPC tools/call with {query} only, the profile ARN in the body and in
x-amzn-kiro-profile-arn. The model is offered kiro-cli's own web_search spec
(with __tool_use_purpose, which is stripped before the caller sees it and
never searched). At most 10 searches per request (max_uses honoured), a
turn cap of uses+2 (pause_turn), 30s timeout and a 1 MiB cap per search.
The config hook says searches: true, which the user's own setting overrides.
Other web_search versions are a 400 that names provider.kiro.searches: false.
kiro 0.1.19 -> 0.1.20.

Author: SemonCat (#492)

Run at 993f9bae5628cd3d525a838bdc0319cc58968c03 on mote (macOS, Bun 1.4.2),
HOME=$(mktemp -d) as CI:
- bun test packages/kiro: 94 pass, 0 fail
- bun test (whole repo): 3563 pass, 8 skip, 0 fail
- bun scripts/check.mjs: every package ok, kiro included
- npm pack --dry-run in packages/kiro: 0.1.20, 3 files; node scripts/dist.mjs
  into a scratch folder packs opencode-kiro-auth@0.1.20
Broken by hand, each red in packages/kiro: schema root sent raw (5 fail),
profileArn left out of the search body (1), the 10-search cap removed (1),
__tool_use_purpose kept in the caller's input (1).
Checked against kiro-cli 2.35.0's binary: the web_search description, the
query's description and maxLength, the __tool_use_purpose text and the
InvokeMCP target/content type are its strings; the fixture's result fields
(title, url, snippet, publishedDate, domain, id, maxVerbatimWordLimit,
publicDomain) are the output its tool spec documents.
The search goes to the same runtime.<region>.kiro.dev host as inference.
Not tried here: a live search (the author's record has one OAuth account,
Haiku 5.5, us-east-1); an API-key search live.
2026-10-30 00:42:03 +08:00
yetone 9410e2a510 commandcode 0.1.19, devin 0.1.26, kiro 0.1.19: a refused sign-in marks the account signed out
blue12345655 (magpie Discord #help): a Command Code account signed in
through the plugin was signed out, and magpie offered no 重新登录, on
v0.1.1844 and still on v0.1.2021.

Cause: commandcode said X-Magpie-Sign-In "kept" on every answer and
signIn "kept" on every usage read, so a revoked key came back as a card
saying "Unauthorized" while magpie kept the account signed in, routed to
it, and never showed Sign in again on its rows. Devin and Kiro did the
same in their usage reads: their errors already said "sign in again",
but "kept" stops magpie from reading those words.

- commandcode: a usage read whose credits are refused (401/403), or a
  request answered 401, asks /alpha/whoami; when whoami refuses the key
  too, the usage says signIn "expired" with "Command Code's sign-in has
  expired; sign in again", and the answer carries X-Magpie-Sign-In:
  expired, its body unchanged. A 403 for a model the plan lacks, a 401
  whoami still takes, and a whoami 500 keep the account. A clean usage
  read says "renewed", which takes a mark off.
- devin: a usage read Devin answers 401 says "expired"; a clean read
  "renewed"; other failures "kept". Requests unchanged.
- kiro: a usage read whose sign-in Kiro refused (the errors made by
  gone) says "expired"; a clean read "renewed"; other failures "kept".
  auth.refresh and requests unchanged.

The response bytes in commandcode/signed-out.test.mjs are what
api.commandcode.ai answered an unknown key on 2026-10-29 (whoami,
billing/credits, billing/subscriptions, provider/v1/chat/completions).

Run (WSL magpie-desktop, Bun 1.4.2, HOME=$(mktemp -d)):
- bun test in packages/commandcode: 82 pass, 0 fail; packages/devin:
  142 pass; packages/kiro: 67 pass.
- bun scripts/check.mjs: every package ok.

Broken by hand: signed-out.test.mjs against the 0.1.18 index.mjs, 4 of
9 red (usage expired, clean read renewed, Provider API expired, Go
expired). kiro's and devin's changed usage tests against their old
index.mjs: red ("kept" received where "expired" expected).

Not tried: a real revoked Command Code, Devin or Kiro account; the
whoami check is only against an unknown key's real answers.
2026-10-29 17:04:52 +08:00
yetone ceda580080 kiro 0.1.18: an image over Kiro's 5 MiB Base64 limit is shrunk on the request, or replaced by a note (#428)
imwaco (#428): in Codex -> magpie -> Kiro, view_image returned a PNG of
4,171,428 bytes, 5,561,904 as Base64, and Kiro answered
  messages.130.content.2.image.source.base64: image exceeds 5 MB maximum:
  5561904 bytes > 5242880 bytes (IMAGE_SIZE_EXCEEDED)
on that turn and on every later one, text-only ones too, as the image
stays in history. The limit is on the Base64 string: 5561904 is that
image's Base64 length, not its file size, so the largest file that fits is
3,932,160 bytes. kiro-cli's own gate is 10 MB of raw file
(MAX_IMAGE_SIZE, aws/amazon-q-developer-cli chat/consts.rs), the gap
kirodotdev/Kiro#11497 describes.

buildKiro's conversation is now built as an object (kiroRequest) and,
after the latest-image selection, kiroBody fits every image left in it,
user images and tool images in history alike, on the plugin's own copy:
- an image at or under 5,242,880 Base64 characters is sent byte for byte;
- one over it is decoded with Bun.Image (Bun 1.4's built-in libspng /
  libjpeg-turbo / libwebp, no new dependency; magpie's host and OpenCode
  2.0.25 both run Bun 1.4.2) and tried, in order: its own kind with the
  long edge at most 2000 px, then WebP (keeps alpha) or JPEG for a JPEG,
  q80, then 0.7x smaller at q75 down to 256 px, until it fits;
- bounds: 50M pixels (a header claiming more is refused before decoding),
  64 MB of Base64 looked at, 30 s per image; one image is worked once per
  sha256 (in-flight shared, 4 kept);
- one that can't be read, has too many pixels, can't be brought under, or
  a host without Bun.Image: the image is left out and a one-line note
  takes its place in that message's text, so the turn still goes.
History, entry count, tool pairing and image order are unchanged.

Run:
- HOME=$(mktemp -d) bun test packages/kiro: 67 pass (image-size.test.mjs
  new, 10 tests); the same under OpenCode 2.0.25's Bun (BUN_BE_BUN=1
  opencode test packages/kiro): 67 pass. bun scripts/check.mjs kiro: ok.
- Fixtures are built in the test: a 1389x1000 noise PNG padded to exactly
  4,171,428 bytes (5,561,904 Base64), PNGs at 3,932,159 / 3,932,160 /
  3,932,161 bytes (Base64 5,242,880 with "=", 5,242,880, 5,242,884), a
  20000x20000 header bomb and 4 MB of junk.
- Full HOME=$(mktemp -d) bun test at 18268848: 2851 pass, 1 fail:
  layerfs "item 3: an import over the file limit" timed out at its 30 s
  bar (46 s) writing 20,001 files at load ~40; it fails alone too at this
  load, and the kiro change doesn't reach layerfs.
Broken by hand: kiroBody without fitImages: 7 of 10 fail; no cache: the
once-per-image test fails; `<` for `<=` at the limit: the boundary test
fails.
Not tried: a real Kiro account (none in a sandbox; no live sign-in read);
an animated GIF over the limit (Bun decodes its first frame only).
2026-10-27 17:27:57 +08:00
yetone 634a865346 kiro 0.1.17: credits tell their count, so magpie's "Left" shows what is left (#408)
Fidelxyz switched magpie's usage to "Left" and Kiro's credits still read
as used ("12.5 / 50"). magpie turns a window round only from its count
(amount, limit, unit; quotaCount in app.js): display alone is the
vendor's text, shown as it is. usageOf now gives each Credits and Free
trial window amount = currentUsageWithPrecision, limit =
usageLimitWithPrecision and unit "credits"; display is unchanged.

Run: HOME=$(mktemp -d) bun test in packages/kiro: 57 pass 0 fail. On the
old index.mjs the two usage tests fail (amount/limit/unit missing).
bun scripts/check.mjs: kiro ok.
Not tried: a real Kiro account (no vendor credentials used); the window
shape is the one workbuddy's Credits already shows "left" with.
2026-10-26 15:50:26 +08:00
yetone 9f6c4e8861 kiro 0.1.16: a reply with no token counts says its cache is unknown, not 0 (zeewell on X)
zeewell on X: every Kiro request in magpie's Routing page shows cache 0%
(Claude Code through group/wf-coding-*, claude-sonnet-5.5 and
claude-opus-5.5, 150-180k tokens, consecutive calls seconds apart).

Cause, from real requests (Google sign-in through kiro-cli, 2026-10-24):
Kiro caches, but reports no token counts at all. A
generateAssistantResponse reply ends with metadataEvent {stopReason},
contextUsageEvent {contextUsagePercentage} and meteringEvent {credits};
no tokenUsage. The same 9k-token prompt sent twice was billed 0.091
then 0.048 credits, the same with or without cachePoints and with a
fresh or a fixed conversationId. kiro-cli 2.32's own trace log
(KIRO_LOG_LEVEL=trace) shows its MetadataEvent with total_tokens,
uncached_input_tokens, cache_read_input_tokens and
cache_write_input_tokens all None, and kiro-cli sends no cachePoint.
So nothing the plugin sends or drops keeps Kiro from caching (#110's
reading that only cachePoints make it cache was wrong); the plugin said
cache_read_input_tokens 0 for a number Kiro never gave.

Now, with no tokenUsage, the reply's usage leaves both cache fields out
and says magpie_cache_unknown: true, which magpie reads as no hit rate
instead of 0%. A tokenUsage, if Kiro sends one, is told as before.
cache-points.test.mjs's comment is corrected; the marks stay.

Run: cache-unknown.test.mjs (the real reply's events, streamed and not)
fails on 0.1.15's index.mjs (1 fail) and passes; bun test in
packages/kiro 57 pass under a scratch HOME/TMPDIR; scripts/check.mjs
kiro ok. The patched loader's fetch against real Kiro (source "kiro",
claude-sonnet-4.5, twice): 200, message_delta usage
{"output_tokens":1,"magpie_cache_unknown":true}. Not tried: an IDE or
Builder ID sign-in, other models' replies.
2026-10-24 17:03:48 +08:00
yetone 20396784c7 kiro 0.1.15: an API key is used as kiro-cli uses it, with or without a profile GetProfile finds (Hollowhere on Discord)
Hollowhere (magpie 0.1.1319, kiro-cli 2.33.1, macOS) signed in to Kiro in
magpie with a Kiro API key. /v1/models listed kiro/auto alone, and every
request failed with "Kiro: Kiro didn't take the API key: 400 Bad Request",
while kiro-cli listed claude-opus-5.5 and claude-sonnet-5.5 and chatted
with the same key.

Cause: the plugin asked GetProfile in us-east-1 only and threw on any
answer but a profile, so a key GetProfile has no profile for never got
further: the model list fell back to Auto and every request failed with
that 400. kiro-cli 2.32.0 (installed here), traced with KIRO_API_KEY set
to a made-up key in a sandbox HOME, every host behind a local proxy that
refused all of them (nothing left the machine), and then with
api.cps.service/api.krs.service/api.codewhisperer.service pointed at a
local recorder:
- asks GetProfile (POST management/, X-Amz-Target
  AmazonCodeWhispererService.GetProfile, body {}) in us-east-1, then
  eu-central-1, then GovCloud and ISO, and with every one refused goes on
  to list models and chat in us-east-1 all the same;
- lists models with the control plane's ListAvailableModels (POST
  management/?origin=KIRO_CLI, X-Amz-Target
  KiroControlPlaneBearerService.ListAvailableModels, body
  {"origin":"KIRO_CLI"}, paged with nextToken), not the REST
  List-Available-Models with a profileArn;
- reads credits with GetUsageLimits (same shape, body {"origin":"KIRO_CLI"});
- names no profileArn in generateAssistantResponse, ListAvailableModels
  or GetUsageLimits, even when GetProfile gave one;
- sends each with Content-Type application/x-amz-json-1.0,
  Authorization: Bearer <key>, tokentype: API_KEY (as the plugin did).

The plugin now does the same for an API key: GetProfile in us-east-1 then
eu-central-1, once per key; a found profile only picks the region; none
found means us-east-1. Its models are ListAvailableModels as above, its
credits GetUsageLimits as above, and its chat names no profile. Sign-ins
other than an API key are unchanged.

Run, in packages/kiro, H=$(mktemp -d); HOME="$H" bun test: 55 pass at
this head (rebased on origin/main 4d73d22, kiro 0.1.14). The new
apikey.test.mjs (fake management and runtime API built from the recorded
shapes: GetProfile 400 in both regions, a key whose profile is in
eu-central-1, two pages of models, GetUsageLimits) fails 4 of 4 with
origin/main's index.mjs (0.1.14) and passes with this one.
bun scripts/check.mjs kiro passes.

Not tried: no real API key was tried. None was used anywhere; the traces
used a made-up key against a local recorder only. That Kiro answers a
real key's GetProfile with 400 when it has no profile, and serves its
ListAvailableModels and chat in us-east-1 without one, is what kiro-cli
2.32.0 does and Hollowhere's kiro-cli 2.33.1 succeeds with, not seen
here. kiro-cli's own handling of a 400 (rather than a refused host) per
region was not traced, since its TLS goes through the system's trust and
was not intercepted. GovCloud and ISO regions are not asked.
2026-10-22 20:00:05 +08:00
yetone 7fdc07f150 kiro 0.1.14: an account is named by its email and the way it was signed in to, "email (Google)", "email (GitHub)" (#309)
magpie names a plugin's account by its accountId (host.js whoOf) and,
when two read the same, adds the slot: molvqingtai's Google and GitHub
accounts of one email read "email (uid-slot)". The accountId is now the
email and the way, as Kiro's sign-in page names it: Google, GitHub,
Builder ID, IAM Identity Center, Internal. A way not known (kiro-cli's
or the Kiro IDE's sign-in, which carry no loginProvider) keeps the bare
email, and magpie's slot stays the fallback.

- browserSignIn's success names the account so.
- An account kept by its bare email, with a known loginProvider, is
  given the name the way the uid was in 0.1.13: by the save after a
  request, model listing or usage read (once per token), and in
  auth.refresh's result (host.js renew merges it over the old).
- Sibling: usage's user is the same name for a sign-in kept here
  (magpie's quota card shows it); kiro-cli's and the IDE's stay bare.

The window: magpie's settle (internal/plugin/host.js) replaces an account
only when whoOf (the accountId) is equal and the uids don't differ. An
old account still named "email", signed in again the same way before
its first use on 0.1.14, has "email (Google)" against "email" and is
kept beside it as a second account. The plugin can't close it: its
client.auth has set/remove for the account in scope only, and a sign-in
result is matched by name alone. Any use (magpie's usage read, a
request, a renewal) renames it first, after which the sign-in replaces
it. Said in the README.

Run at d767d1c + this change:
- accounts.test.mjs on the old index.mjs: 3 fail (the two existing
  tests' labelled expectations, and the bare-email rename), 2 pass (the
  kiro-cli bare-email guard, and the no-save case). On the new: 5 pass.
- HOME=$(mktemp -d) bun test: 2104 pass, 0 fail, 184 files.
- bun scripts/check.mjs: ok.
Not tried: a real Kiro sign-in; the names were checked only against the
tests' fake Kiro.
2026-10-22 15:31:02 +08:00
yetone d767d1c8e6 kiro 0.1.13: a Google and a GitHub sign-in of one email are two accounts, not one replacing the other (#309)
molvqingtai: Kiro keeps a GitHub and a Google sign-in that share an
email as two accounts, but only one could be added; the second replaced
the first. The plugin named each sign-in by its email alone, and magpie's
host.js settle (internal/plugin/host.js:1022) replaces an account whose
accountId is the new sign-in's, unless both carry a uid and the two
differ (the rule WorkBuddy's uid uses, #413).

Each browser sign-in now carries uid = its way in, lowercased (google,
github, builderid, enterprise, internal). accountId stays the email, so:
- Google and GitHub (or Builder ID) of one email are kept side by side;
  magpie labels the two rows apart by their slot.
- A sign-in again the same way still replaces its own account.
- An account saved before 0.1.13 (bare email, loginProvider kept, as the
  built-in's mover also saved it) still matches a sign-in again, so no
  duplicate appears. It is given its uid from loginProvider on its first
  request, model listing or usage read (one save per token), and on
  magpie's renewal (auth.refresh returns uid with the token). Until then,
  a sign-in the other way of the same email would still replace it, as
  before; magpie lists each account's models when its host starts, so
  that window is the time to the first listing.
Not changed: kiro-cli's and the IDE's sign-in (a pointer to whatever they
are signed in to; kiro-cli's social token doesn't say Google or GitHub)
keeps no uid and matches by email as before. Two Identity Center orgs
with one email are still one (both "enterprise"). Kiro's userInfo gives
no per-account id this plugin reads; none was assumed.

Run at this tree (origin/main 6219a71), sandbox HOME:
- bun test packages/kiro: 49 pass, 0 fail.
- bun test (whole repo): 2102 pass, 0 fail.
- bun scripts/check.mjs: ok.
- accounts.test.mjs on origin/main's index.mjs: 2 of 3 red (Google and
  GitHub sign-ins carry no uid, so magpie's rule keeps one; an old
  account is never given its uid). The third (no save for an account
  that has its uid or no known way) passes on both, as it should.
Not tried: a real Google and GitHub Kiro sign-in of one email (no such
accounts here); the reporter is asked to confirm on #309.
2026-10-22 14:03:15 +08:00
yetone 060bda8f65 kiro 0.1.12: a request's structured output (output_config.format) is told in the system prompt, as the built-in told it
Kiro's generateAssistantResponse has no field for the answer's format, so
magpie's built-in Kiro (internal/gateway/kiro.go, req.inSystem()) told
the model the schema at the end of the system prompt: "Respond with a
single JSON value and nothing else, matching this JSON schema:\n<schema>."
The plugin dropped output_config.format, and magpie's generic plugin path
falls back to inSystem only when an upstream answers 400 naming the
format, which the plugin never did, so a moved user asking for JSON got
prose. buildKiro now says the schema the same way, after the caller's
system prompt and before the thinking budget prefix. The AI SDK's
output_format is read too. A JSON object with no schema needs nothing
here: magpie's Anthropic body already tells it in the system prompt.

Run: HOME=$(mktemp -d) bun test in packages/kiro: 46 pass, 0 fail.
structured-output.test.mjs: 3 of its 4 tests red with the index.mjs
change taken out (the fourth checks a request with no format is
unchanged). bun scripts/check.mjs kiro: ok.
Not run: a real Kiro account, nor magpie end to end.
2026-10-16 17:32:22 +08:00
yetone 779e9b2368 kiro 0.1.11: a thinking model offers xhigh as its own level, so Claude Code's xhigh isn't routed as max (#120)
The variants came from BUDGETS (low, medium, high, max), while thinking()
already read xhigh. magpie fits an effort the model doesn't offer to the
nearest it does, so Claude Code's xhigh on a moved Kiro was recorded and
sent as max: 166 of the reporter's requests on 10-14, after the built-in,
which takes xhigh, had served it as xhigh the day before.

BUDGETS now has xhigh at 50k, the budget thinking() and the built-in's
kiroThinkingBudget give it, so what Kiro is asked is unchanged; only the
level magpie records and passes is. Both configModel and runtimeModel
read BUDGETS.

Run: bun test across the repo (TMPDIR+HOME in the scratchpad), all pass;
the new effort.test.mjs fails on the old BUDGETS. Not tried with a real
Kiro account (none signed in on this machine).
2026-10-14 17:28:46 +08:00
yetone 386a2ba5ad kiro 0.1.10: the caller's prompt-cache marks reach Kiro as cachePoints (#110)
What: buildKiro dropped every cache_control, so Kiro was never asked to
cache a prompt and its tokenUsage reported no cache reads ("kiro cli
cache 率为 0"). Kiro's generateAssistantResponse takes Bedrock's cachePoint
({"type":"default"}) on a userInputMessage, on an assistantResponseMessage
and as an entry of the tools: the CodeWhisperer streaming model's
UserInputMessage.cachePoint, AssistantResponseMessage.cachePoint and
Tool::CachePoint (aws/amazon-q-developer-cli's generated client), and
Kiro CLI 2.27's model list carries supportsPromptCaching and
maximumCacheCheckpointsPerRequest. A message holding a marked block now
gets a cachePoint on the entry it ends up in (merged turns included; a
marked system prompt marks the first message, where the instructions
go), and a marked tool is followed by a cachePoint entry, as kirocc and
AIClient2API send. Four at most, the last kept, as Anthropic allows.
conversationId is left per request: a cachePoint caches the prompt's
prefix, not a conversation.

Run: TMPDIR=<scratch> HOME=<scratch> bun test (1191 pass, 0 fail) and bun
scripts/check.mjs kiro. cache-points.test.mjs's first fixture places the
marks where a captured Claude Code 2.1.296 request had them (two system
blocks and the trailing system-role hook message; texts cut short); the
second is the shape magpie's buildAnthropic hands a plugin for a
translated request. With the two cachePoint lines taken out, 3 of its 4
tests fail. Not tried against a real Kiro account (none signed in here),
so whether Kiro then reports cacheReadInputTokens is not seen yet.
2026-10-14 12:54:44 +08:00
yetone 66facacf14 kiro 0.1.9: a tool's images reach the model, as the built-in sends them (yetone/magpie#1861)
What: buildKiro read a tool_result's content for its text alone, so an
image a tool returned (Codex's view_image, a computer-use screenshot,
Claude Code's Read of a PNG) never reached Kiro: the model got
"(no output)" and said it saw nothing. Its image blocks (base64) now go
with the message that answers the call, beside any image the user sent,
as magpie's built-in has sent them since yetone/magpie#369. Kiro's tool
results hold text alone. The "only the latest images" rule is unchanged;
an image named only by a URL still has no bytes to send and is left out.

Why: simonsmh reported Codex's view_image unreadable through Kiro on
magpie v0.1.1215 (#1861). A moved Kiro is served by this plugin, which
never got #369's fix.

Run: HOME=<scratch> TMPDIR=<scratch> bun test (1152 pass, 0 fail) and
bun scripts/check.mjs. tool-images.test.mjs's fixture is the Anthropic body
magpie's gateway hands the plugin for Codex 0.162's view_image output
([{"type":"input_image","image_url":"data:...","detail":"high"}]), dumped
from magpie's buildAnthropic; 3 of its 4 tests fail on 0.1.8. Not tried
against a real Kiro account (none signed in here); #369 checked the same
body shape on the built-in against a real account.
2026-10-13 03:40:07 +08:00
yetone e1efc3d623 kiro 0.1.8: a tool named past 64 characters is sent under a short name, and its calls come back under the caller's (yetone/magpie#1393)
Kiro answers a tool name longer than 64 characters "Invalid tool use
format." (REQUEST_BODY_INVALID), and has declined to raise the limit
(kirodotdev/Kiro#7684). Claude Code names a plugin's MCP tools
mcp__plugin_<plugin>_<server>__<tool>, e.g. the Cloudflare plugin's
mcp__plugin_cloudflare_cloudflare-docs__search_cloudflare_documentation
(71), so every turn that offered it failed. The plugin passed t.name
through as it was.

toolName keeps a name of [a-zA-Z0-9_-]{1,64} as it is; any other becomes
its head (other characters as _) plus _ and 12 hex of its sha256, at most
64 characters. It is the same each turn, so the declaration, the history's
toolUses and the tools declared for the history all agree without state.
toolNames maps each such name back from the request's tools and history,
and reply gives the caller's name on tool_use blocks, streamed and not.
Results pair by toolUseId, which is unchanged.

tool-names.test.mjs (the reporter's 71- and 70-character names) fails 3
of 3 without the change and passes; HOME=$(mktemp -d) bun test: 1003
pass, 0 fail across the repo; bun scripts/check.mjs kiro passes. Not
tried against Kiro itself: no Kiro sign-in on this machine.
2026-10-09 19:25:13 +08:00
yetone b5fc67f0f4 kiro 0.1.7: a Builder ID sign-in is asked with Builder ID's service profile, so its models are listed and served, as the built-in (#16, YuanZhe-99: a Kiro Student account moved to the plugin was offered no claude-opus-5.5 or claude-sonnet-5.5, which the built-in listed) — a Builder ID sign-in (kiro-cli's, the Kiro IDE's or one made here) names no profile, and Kiro won't list one for it: List-Available-Profiles answers 403 "AWS Builder ID is not supported for this operation" in both regions, so profileOf threw, provider.models fell back to Auto alone, and usage and chat failed. magpie's built-in has asked such a sign-in with the service profile kiro-cli and the IDE use (arn:aws:codewhisperer:us-east-1:638616132270:profile/AAAACCCCXXXX) since magpie 40102f74 (yetone/magpie#422); the plugin now does as it does: kiro-cli's odic sign-in with Builder ID's start URL or none, the IDE's with provider BuilderId, and one signed in here (or moved from the built-in) with loginProvider BuilderId take it without asking, and an AWS sign-in whose profile listing is that 403 takes it too. Identity Center sign-ins still have their profile listed. builderid.test.mjs (fake management and runtime API: one signed in here lists claude-opus-5.5 and chats under the service profile, the 403 found, Identity Center unchanged, kiro-cli's with and without a start URL, the IDE's) fails 4 of 5 on 0.1.6 and passes; bun test (28 pass) and bun scripts/check.mjs kiro pass under a temp HOME. Checked for real with a Google sign-in (profile listed, models listed, claude-sonnet-4.5 answers): unchanged. Not tried with a real Builder ID or Kiro Student account (none here). 2026-10-04 12:04:57 +08:00
yetone ce009e60c6 kiro 0.1.6: magpie renews the sign-in ahead of time through auth.refresh
auth.refresh with refreshLead 10 minutes (in-fetch: 2) for sign-ins kept in
magpie; kiro-cli's and the IDE's (expires 0) are renewed as before. It runs
under the request path's per-account lock, and an after map lets a request
holding the old token use the new one. Every failure, a refusal included,
throws plainly: the built-in never marked a Kiro account lapsed.

The check before each request stays for OpenCode, which doesn't call the
hook (magpie 0.1.684+ does). refresh.test.mjs fails without the change;
HOME=$(mktemp -d) bun test passes (396 across the repo).
2026-10-03 12:07:22 +08:00
yetone 8f25b63718 publish from GitHub Actions with npm's trusted publishing, no one-time password [skip ci]
.github/workflows/publish.yml runs the tests (in a throwaway HOME) and
scripts/publish.sh on each package.json change pushed to main, or by hand;
npm's OIDC exchange stands in for a token and an OTP. Every package now
names magpie-community/plugins' publish.yml as its trusted publisher on
npmjs.com, and gets the repository field npm checks it against.
2026-10-03 00:00:23 +08:00
yetone 85d7dd0d0a all: each plugin fails with its built-in's status and marks the sign-in as it did, through X-Magpie-Sign-In (要保证插件跟内置的所有逻辑都要一模一样) — Factory's and MiMo's refused renewals are the built-ins' 502 marked expired, not 401s; Qoder's vendor 403 is the built-in's 401 kept, its model list's failure a 400, its job refresh refused marked expired; Zed's retried 401 is a 401 kept, not a 403; Kiro's unreachable refresh a 401 kept; Cursor's expired trial a 401 kept; a vendor 401 WorkBuddy, Grok, Devin, Command Code and ZCode passed on no longer marks the account, as their built-ins never did, and Grok and MiMo no longer retry what their built-ins sent once. Messages take the built-ins' words. New tests fail against the previous index.mjs. 2026-10-01 04:47:03 +08:00
yetone 8efe85163c kiro 0.1.4: an exception Kiro sends before any of the answer (a throttle, a quota, a server error) is a status, not a 200 stream holding an error event, as the built-in's relay answers it: a 429 when it reads as a quota or rate limit (magpie's quotaWords), else a 502, so magpie moves on to the next account exactly as it did; unstreamed, what was said before a later exception is the answer, as the built-in's collector gives it, where the plugin answered 502. errors.test.mjs fails without the change. 2026-10-01 03:45:12 +08:00
yetone 96b3ad276b kiro 0.1.3: only a sign-in that is gone (a refresh Kiro refused, no refresh token, no sign-in, a refused API key) answers a request with the 401 magpie marks the account lapsed on; a refresh that timed out, failed to connect or met a 5xx is a 502; errors no longer start with "Kiro: ", which magpie adds 2026-10-01 03:17:51 +08:00
yetone c8f4d448df Parity with magpie's built-ins: a failed sign-in says why, CLI-backed Command Code and Devin accounts follow the CLI's key, Factory's refused renewal is a 401 in the caller's API shape
- every {type:"failed"} carries an error reason magpie shows
- commandcode/devin: accounts taken from the CLI are marked metadata.cli and re-read its credentials on each request, usage and models
- factory: a refused refresh answers 401 authentication_error (Anthropic shape on /llm/a/, OpenAI's elsewhere) instead of throwing; the whoami back-off is per account; 403 hints name the account to sign in again
- versions: factory/devin/commandcode/cursor/kiro/mimo/zed/zcode 0.1.2, workbuddy 0.1.3
2026-10-01 00:55:50 +08:00
yetone 84e5e853ee kiro 0.1.1: usage shows as magpie's built-in did — plan, period, windows and what they count, balancekiro 2026-09-30 23:03:09 +08:00
yetone e08a374886 kiro: Kiro — the IDE's browser sign-in (social, Builder ID, Identity Center), kiro-cli's or the IDE's sign-in, or an API key; conversations and the event stream as magpie's gateway does them; tried with real requests 2026-09-30 17:12:09 +08:00