@javargasm/pi-kiro 0.2.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 +63 -0
- package/LICENSE +21 -0
- package/README.md +119 -0
- package/dist/core.d.ts +10 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +2849 -0
- package/dist/debug.d.ts +12 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/event-parser.d.ts +56 -0
- package/dist/event-parser.d.ts.map +1 -0
- package/dist/extension.d.ts +43 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +2940 -0
- package/dist/health.d.ts +6 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/kiro-cli-sync.d.ts +44 -0
- package/dist/kiro-cli-sync.d.ts.map +1 -0
- package/dist/kiro-defaults.d.ts +25 -0
- package/dist/kiro-defaults.d.ts.map +1 -0
- package/dist/kiro-tools.d.ts +4 -0
- package/dist/kiro-tools.d.ts.map +1 -0
- package/dist/models.d.ts +122 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/oauth.d.ts +48 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/stream.d.ts +20 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/thinking-parser.d.ts +24 -0
- package/dist/thinking-parser.d.ts.map +1 -0
- package/dist/tokenizer.d.ts +2 -0
- package/dist/tokenizer.d.ts.map +1 -0
- package/dist/transform.d.ts +113 -0
- package/dist/transform.d.ts.map +1 -0
- package/package.json +79 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1](https://github.com/javargasm/pi-kiro/pull/1) [`2e0975a`](https://github.com/javargasm/pi-kiro/commit/2e0975a02b0961d85add9bfd6e06b39b9bc63ef5) Thanks [@javargasm](https://github.com/javargasm)! - Harden packaging and release infrastructure.
|
|
8
|
+
|
|
9
|
+
- Scope the package as `@javargasm/pi-kiro` and point `repository`,
|
|
10
|
+
`homepage`, and `bugs` at the fork.
|
|
11
|
+
- Add a rich `description` and discoverability `keywords`
|
|
12
|
+
(`provider`, `kiro`, `aws`, `codewhisperer`, `amazon-q`, `claude`).
|
|
13
|
+
- Add lifecycle and convenience scripts: `check` (typecheck + test),
|
|
14
|
+
`publish:dry-run`, `prepack` (build), and a `prepublishOnly` that runs
|
|
15
|
+
the full `check`. The published tarball is now always type-checked,
|
|
16
|
+
tested, and freshly built.
|
|
17
|
+
- Adopt Changesets for versioning and changelog generation with
|
|
18
|
+
PR/commit links via `@changesets/changelog-github`.
|
|
19
|
+
- Align CI/release workflows: CI runs on push to `master` and on pull
|
|
20
|
+
requests; the release workflow runs the full `check` plus an explicit
|
|
21
|
+
`build` before `npm publish`.
|
|
22
|
+
|
|
23
|
+
## 0.1.4
|
|
24
|
+
|
|
25
|
+
- Fix: `ThinkingTagParser` runs unconditionally when `reasoning` is
|
|
26
|
+
enabled. Previously gated on `!reasoningHidden` on the assumption
|
|
27
|
+
that Anthropic's adaptive-thinking "omitted" policy was binding;
|
|
28
|
+
it isn't — Opus 4.7 intermittently leaks `<thinking>...</thinking>`
|
|
29
|
+
tags. Defensive parsing splits them into proper thinking blocks
|
|
30
|
+
instead of rendering as raw tags in text. No-tag streams are a
|
|
31
|
+
no-op (text-buffer scan).
|
|
32
|
+
- Change: the redacted-thinking breadcrumb now emits lazily. Previously
|
|
33
|
+
pushed on `start` then possibly updated after a 2s countdown,
|
|
34
|
+
leaving an empty thinking block at `content[0]` on every fast
|
|
35
|
+
response — a representation bug downstream consumers worked around
|
|
36
|
+
by filtering empty thinking blocks. Now: a 2s timer arms on `start`;
|
|
37
|
+
if content or a tool call arrives first, the timer is cancelled and
|
|
38
|
+
no shim is emitted; otherwise the full shim (`thinking_start` +
|
|
39
|
+
`thinking_delta` with marker + `thinking_end`) flushes in one shot.
|
|
40
|
+
- `reasoningHidden` still controls: (a) skipping the `<thinking_mode>`
|
|
41
|
+
system-prompt directive, (b) the lazy shim. It no longer gates the
|
|
42
|
+
parser.
|
|
43
|
+
- Consumers that filtered empty redacted-thinking blocks
|
|
44
|
+
(Inkstone, pi-coding-agent, OpenCode) see no user-visible change.
|
|
45
|
+
Consumers that relied on the literal empty-shim breadcrumb at
|
|
46
|
+
`content[0]` on fast responses should verify behavior.
|
|
47
|
+
|
|
48
|
+
## 0.1.3
|
|
49
|
+
|
|
50
|
+
- Drop `@mariozechner/pi-coding-agent` as a dependency and peer. pi-kiro
|
|
51
|
+
used it only for the `ExtensionAPI` type; the minimal shape is now
|
|
52
|
+
declared locally in `src/extension.ts`. Hosts on any pi version can
|
|
53
|
+
install pi-kiro without a resolution error.
|
|
54
|
+
- Add `@mariozechner/pi-ai` `^0.72.1` as an explicit devDep (previously
|
|
55
|
+
transitive via pi-coding-agent).
|
|
56
|
+
- `@mariozechner/pi-ai` stays declared as peer `*`.
|
|
57
|
+
- `ExtensionAPI` / `ProviderConfig` in the emitted `dist/extension.d.ts`
|
|
58
|
+
are now local, not re-exported from pi-coding-agent. Consumers should
|
|
59
|
+
keep importing these types from `@mariozechner/pi-coding-agent`
|
|
60
|
+
directly; pi-kiro does not re-export them.
|
|
61
|
+
- Public API surface (`streamKiro`, `kiroModels`, `loginKiro`,
|
|
62
|
+
`refreshKiroToken`, `resolveApiRegion`, `filterModelsByRegion`,
|
|
63
|
+
`KiroCredentials`, `KiroModel`, etc.) is unchanged.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hongyi Lyu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# pi-kiro
|
|
2
|
+
|
|
3
|
+
[Kiro](https://kiro.dev) provider for [pi](https://github.com/earendil-works/pi).
|
|
4
|
+
|
|
5
|
+
Adds the Kiro model family (AWS Builder ID login, CodeWhisperer streaming API)
|
|
6
|
+
to pi's coding agent.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pi install npm:@javargasm/pi-kiro
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Login
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pi /login kiro
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Two methods are supported:
|
|
21
|
+
|
|
22
|
+
- **AWS Builder ID** — leave the prompt blank. Opens the standard Builder ID
|
|
23
|
+
device-authorization page.
|
|
24
|
+
- **IAM Identity Center (IdC / SSO)** — paste your company start URL
|
|
25
|
+
(e.g. `https://mycompany.awsapps.com/start`). You can supply a specific
|
|
26
|
+
AWS region or leave it blank to auto-detect.
|
|
27
|
+
|
|
28
|
+
Tokens are stored in `~/.pi/agent/auth.json`.
|
|
29
|
+
|
|
30
|
+
## Supported models
|
|
31
|
+
|
|
32
|
+
All Claude models available through the Kiro service, including:
|
|
33
|
+
|
|
34
|
+
- `claude-sonnet-4-5`
|
|
35
|
+
- `claude-sonnet-4-6`
|
|
36
|
+
- `claude-opus-4-7`
|
|
37
|
+
|
|
38
|
+
Run `pi --list-models` for the full list once the extension is loaded.
|
|
39
|
+
|
|
40
|
+
## Region support
|
|
41
|
+
|
|
42
|
+
Region is inferred from your Builder ID profile. Kiro API regions currently
|
|
43
|
+
available: `us-east-1`, `eu-central-1`, and others. See `src/models.ts` for
|
|
44
|
+
the authoritative region-to-model map.
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
bun install
|
|
50
|
+
bun run typecheck
|
|
51
|
+
bun run test
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Using outside pi (standalone)
|
|
55
|
+
|
|
56
|
+
The provider logic (OAuth + streaming) is also exposed at
|
|
57
|
+
`@javargasm/pi-kiro/core` so you can embed it into your own UI — e.g. an
|
|
58
|
+
[opentui](https://github.com/sst/opentui) frontend, a backend service, or a
|
|
59
|
+
custom CLI — without pulling `pi-coding-agent`.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import {
|
|
63
|
+
loginKiro,
|
|
64
|
+
refreshKiroToken,
|
|
65
|
+
streamKiro,
|
|
66
|
+
kiroModels,
|
|
67
|
+
type KiroCredentials,
|
|
68
|
+
} from "@javargasm/pi-kiro/core";
|
|
69
|
+
|
|
70
|
+
// 1. Login. Your app implements pi-ai's OAuthLoginCallbacks (onPrompt,
|
|
71
|
+
// onAuth, onProgress, signal) however it wants — a TUI dialog, a web
|
|
72
|
+
// modal, stdin, etc.
|
|
73
|
+
const creds: KiroCredentials = await loginKiro({
|
|
74
|
+
onPrompt: async ({ message }) => await myUi.ask(message),
|
|
75
|
+
onAuth: ({ url, instructions }) => myUi.showDeviceCode(url, instructions),
|
|
76
|
+
onProgress: (msg) => myUi.setStatus(msg),
|
|
77
|
+
signal: abortController.signal,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// 2. Persist `creds` in secure storage. `creds.clientSecret` and
|
|
81
|
+
// `creds.refresh` are sensitive — treat them like passwords. Call
|
|
82
|
+
// refreshKiroToken(creds) when `Date.now() > creds.expires`.
|
|
83
|
+
|
|
84
|
+
// 3. Stream a turn. streamKiro(model, context, options?) returns an
|
|
85
|
+
// AssistantMessageEventStream that's both async-iterable for events
|
|
86
|
+
// and awaitable via .result() for the final AssistantMessage.
|
|
87
|
+
const model = kiroModels[0];
|
|
88
|
+
const stream = streamKiro(
|
|
89
|
+
model,
|
|
90
|
+
{
|
|
91
|
+
messages: [
|
|
92
|
+
{ role: "user", content: "hello", timestamp: Date.now() },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{ apiKey: creds.access },
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
for await (const event of stream) {
|
|
99
|
+
// event.type: "start" | "text_delta" | "toolcall_start" | ... | "done" | "error"
|
|
100
|
+
if (event.type === "text_delta") process.stdout.write(event.delta);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const finalMessage = await stream.result();
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Only `@earendil-works/pi-ai` is required at runtime for this path.
|
|
107
|
+
|
|
108
|
+
### Requirements
|
|
109
|
+
|
|
110
|
+
- **Published `dist/`** is plain ESM JavaScript with `.d.ts` files. Any
|
|
111
|
+
Node >= 20 or bundler (Vite, webpack, esbuild) that supports ESM works.
|
|
112
|
+
- **From source** (e.g. if you're importing `./src/core` from a monorepo
|
|
113
|
+
sibling) you need Bun, or Node with a TS loader (tsx, ts-node), or a
|
|
114
|
+
bundler — the source is TypeScript with no file extensions on relative
|
|
115
|
+
imports.
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { BUILDER_ID_REGION, BUILDER_ID_START_URL, loginKiro, refreshKiroToken, } from "./oauth";
|
|
2
|
+
export type { KiroCredentials } from "./oauth";
|
|
3
|
+
export { streamKiro } from "./stream";
|
|
4
|
+
export { filterModelsByRegion, KIRO_MODEL_IDS, kiroModels, resolveApiRegion, resolveKiroModel, resolveRuntimeUrl, } from "./models";
|
|
5
|
+
export type { KiroModel } from "./models";
|
|
6
|
+
export { isPermanentError } from "./health";
|
|
7
|
+
export { importFromKiroCli, getKiroCliCredentialsAllowExpired, saveKiroCliCredentials, } from "./kiro-cli-sync";
|
|
8
|
+
export type { KiroCliCredentials } from "./kiro-cli-sync";
|
|
9
|
+
export { MAX_KIRO_IMAGES, MAX_KIRO_IMAGE_BYTES, collapseAgenticLoops } from "./transform";
|
|
10
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAgBA,OAAO,EACN,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,gBAAgB,GAChB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EACN,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EACN,iBAAiB,EACjB,iCAAiC,EACjC,sBAAsB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|