ns-omp-provider-kiro 0.1.2 → 0.1.4
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/README.md +15 -4
- package/dist/index.js +15 -9
- package/dist/models.d.ts +10 -0
- package/dist/stream.d.ts +22 -0
- package/package.json +8 -7
- package/LICENSE +0 -22
package/README.md
CHANGED
|
@@ -2,12 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Kiro (AWS CodeWhisperer/Q) models in [OMP](https://github.com/can1357/oh-my-pi).
|
|
4
4
|
|
|
5
|
-
Published on npm as `ns-omp-provider-kiro
|
|
6
|
-
local path, not a registry name, so install from a clone of
|
|
7
|
-
[ns-kiro-provider](https://github.com/ngosangns/ns-kiro-provider):
|
|
5
|
+
Published on npm as `ns-omp-provider-kiro`:
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
|
|
8
|
+
omp plugin install ns-omp-provider-kiro
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Pin a version with `omp plugin install ns-omp-provider-kiro@0.1.2` — bare
|
|
12
|
+
names, scoped names, and `name@version` all resolve as npm specs.
|
|
13
|
+
|
|
14
|
+
### From a local build
|
|
15
|
+
|
|
16
|
+
To build from a clone instead — for developing this package or
|
|
17
|
+
`ns-kiro-core` before a release — install from the path:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git clone git@github.com:ngosangns/ns-kiro-provider.git
|
|
21
|
+
cd ns-kiro-provider && pnpm install && pnpm -r build
|
|
11
22
|
omp plugin install ./packages/omp-provider-kiro
|
|
12
23
|
```
|
|
13
24
|
|
package/dist/index.js
CHANGED
|
@@ -4475,7 +4475,9 @@ function toOmpModelConfig(model) {
|
|
|
4475
4475
|
input: [...model.input],
|
|
4476
4476
|
cost: { ...model.cost },
|
|
4477
4477
|
contextWindow: model.contextWindow,
|
|
4478
|
-
maxTokens: model.maxTokens
|
|
4478
|
+
maxTokens: model.maxTokens,
|
|
4479
|
+
kiroModelId: model.kiroModelId,
|
|
4480
|
+
...model.additionalModelRequestFieldsSchema ? { additionalModelRequestFieldsSchema: model.additionalModelRequestFieldsSchema } : {}
|
|
4479
4481
|
};
|
|
4480
4482
|
}
|
|
4481
4483
|
function kiroBaseUrl(region) {
|
|
@@ -4565,13 +4567,18 @@ var ZERO_USAGE = () => ({
|
|
|
4565
4567
|
totalTokens: 0,
|
|
4566
4568
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
4567
4569
|
});
|
|
4568
|
-
function toKiroModel(model,
|
|
4569
|
-
const
|
|
4570
|
-
const known = catalog.find((candidate) => candidate.id === model.id);
|
|
4570
|
+
function toKiroModel(model, region) {
|
|
4571
|
+
const known = getCachedModels(region).find((candidate) => candidate.id === model.id);
|
|
4571
4572
|
return {
|
|
4572
4573
|
...known ?? {
|
|
4573
4574
|
id: model.id,
|
|
4574
|
-
|
|
4575
|
+
// No fallback to `model.id`: that dash-spelled local id is not a valid
|
|
4576
|
+
// Kiro wire id. Falls back to `""` rather than `model.id` — falsy, so
|
|
4577
|
+
// `resolveKiroModel`'s `if (exactKiroModelId) return exactKiroModelId`
|
|
4578
|
+
// treats it as no override and runs its own cache/bootstrap/dot-normalize
|
|
4579
|
+
// resolution instead of being short-circuited by a value that is really
|
|
4580
|
+
// just `model.id` again.
|
|
4581
|
+
kiroModelId: model.kiroModelId ?? "",
|
|
4575
4582
|
name: model.name,
|
|
4576
4583
|
reasoning: model.reasoning,
|
|
4577
4584
|
input: [...model.input],
|
|
@@ -4608,8 +4615,9 @@ function streamKiroForOmp(model, context, options) {
|
|
|
4608
4615
|
return contentIndex;
|
|
4609
4616
|
};
|
|
4610
4617
|
const at = (coreIndex) => indexes.get(coreIndex);
|
|
4618
|
+
const region = model.kiroRegion ?? getKiroRegionFromEndpoint(model.baseUrl) ?? credentials.region;
|
|
4611
4619
|
for await (const event of streamKiro({
|
|
4612
|
-
model: toKiroModel(model,
|
|
4620
|
+
model: toKiroModel(model, region),
|
|
4613
4621
|
messages: toKiroMessages(context.messages),
|
|
4614
4622
|
systemPrompt: context.systemPrompt?.join("\n\n"),
|
|
4615
4623
|
tools: toKiroTools(context.tools),
|
|
@@ -4850,10 +4858,8 @@ function index_default(pi) {
|
|
|
4850
4858
|
api: "kiro-api",
|
|
4851
4859
|
provider: "kiro",
|
|
4852
4860
|
baseUrl: kiroBaseUrl(region),
|
|
4853
|
-
kiroModelId: model.kiroModelId,
|
|
4854
4861
|
kiroRegion: region,
|
|
4855
|
-
...kiroCredentials.profileArn ? { kiroProfileArn: kiroCredentials.profileArn } : {}
|
|
4856
|
-
...model.additionalModelRequestFieldsSchema ? { additionalModelRequestFieldsSchema: model.additionalModelRequestFieldsSchema } : {}
|
|
4862
|
+
...kiroCredentials.profileArn ? { kiroProfileArn: kiroCredentials.profileArn } : {}
|
|
4857
4863
|
})
|
|
4858
4864
|
);
|
|
4859
4865
|
return [...others, ...kiro];
|
package/dist/models.d.ts
CHANGED
|
@@ -15,6 +15,16 @@ export interface OmpKiroModelConfig {
|
|
|
15
15
|
};
|
|
16
16
|
contextWindow: number;
|
|
17
17
|
maxTokens: number;
|
|
18
|
+
/**
|
|
19
|
+
* Wire id Kiro accepts, when it differs from {@link id}. Registration and
|
|
20
|
+
* dynamic-discovery models carry no per-credential region or profile, but
|
|
21
|
+
* request time still needs the exact catalog id — a model absent from
|
|
22
|
+
* kiro-core's bootstrap list would otherwise fall back to guessing the wire
|
|
23
|
+
* id from the dash-spelled local `id`, which Kiro rejects as `INVALID_MODEL_ID`.
|
|
24
|
+
*/
|
|
25
|
+
kiroModelId: string;
|
|
26
|
+
/** Catalog schema this model's structured effort/thinking fields derive from. */
|
|
27
|
+
additionalModelRequestFieldsSchema?: Record<string, unknown>;
|
|
18
28
|
}
|
|
19
29
|
export declare function toOmpModelConfig(model: KiroModel): OmpKiroModelConfig;
|
|
20
30
|
export declare function kiroBaseUrl(region: string): string;
|
package/dist/stream.d.ts
CHANGED
|
@@ -1,2 +1,24 @@
|
|
|
1
1
|
import type { Api, AssistantMessageEventStream, Context, Model, SimpleStreamOptions } from "@oh-my-pi/pi-ai";
|
|
2
|
+
import { type KiroModel } from "ns-kiro-core";
|
|
3
|
+
/** Catalog metadata this provider attaches to the models it registers. */
|
|
4
|
+
export type KiroBackedModel = Model<Api> & {
|
|
5
|
+
kiroModelId?: string;
|
|
6
|
+
kiroRegion?: string;
|
|
7
|
+
kiroProfileArn?: string;
|
|
8
|
+
additionalModelRequestFieldsSchema?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Rebuild the core's model descriptor from what OMP hands back at request time.
|
|
12
|
+
*
|
|
13
|
+
* OMP's registry keeps its own `Model`, built from the config this provider
|
|
14
|
+
* registered, so the catalog entry is looked up again here rather than carried
|
|
15
|
+
* through: the ladder and the request-fields schema decide effort mapping, and
|
|
16
|
+
* a request must use the same ones the catalog advertised.
|
|
17
|
+
*
|
|
18
|
+
* Looks up the region's authenticated cache, not the static bootstrap list:
|
|
19
|
+
* models discovered only through the authenticated catalog (no bootstrap
|
|
20
|
+
* entry) would otherwise miss this lookup and fall through to guessing a wire
|
|
21
|
+
* id from the dash-spelled local `id`, which Kiro rejects as `INVALID_MODEL_ID`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function toKiroModel(model: KiroBackedModel, region: string): KiroModel;
|
|
2
24
|
export declare function streamKiroForOmp(model: Model<Api>, context: Context, options?: SimpleStreamOptions): AssistantMessageEventStream;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ns-omp-provider-kiro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "OMP (oh-my-pi) provider plugin: adds Kiro (AWS CodeWhisperer/Q) models via your kiro-cli login",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,8 +36,13 @@
|
|
|
36
36
|
"dist",
|
|
37
37
|
"README.md"
|
|
38
38
|
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --banner:js=\"import{createRequire as __kiroCreateRequire}from'node:module';const require=__kiroCreateRequire(import.meta.url);\" --external:@oh-my-pi/pi-ai --external:@oh-my-pi/pi-catalog --external:@oh-my-pi/pi-coding-agent --external:@oh-my-pi/pi-tui && tsc -p tsconfig.json --emitDeclarationOnly",
|
|
41
|
+
"check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json",
|
|
42
|
+
"prepublishOnly": "pnpm run check && pnpm run build"
|
|
43
|
+
},
|
|
39
44
|
"dependencies": {
|
|
40
|
-
"ns-kiro-core": "
|
|
45
|
+
"ns-kiro-core": "workspace:*"
|
|
41
46
|
},
|
|
42
47
|
"peerDependencies": {
|
|
43
48
|
"@oh-my-pi/pi-ai": ">=18.1.0",
|
|
@@ -55,9 +60,5 @@
|
|
|
55
60
|
"@oh-my-pi/pi-ai": "18.1.5",
|
|
56
61
|
"@oh-my-pi/pi-coding-agent": "18.1.5",
|
|
57
62
|
"@types/node": "^22.10.0"
|
|
58
|
-
},
|
|
59
|
-
"scripts": {
|
|
60
|
-
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --banner:js=\"import{createRequire as __kiroCreateRequire}from'node:module';const require=__kiroCreateRequire(import.meta.url);\" --external:@oh-my-pi/pi-ai --external:@oh-my-pi/pi-catalog --external:@oh-my-pi/pi-coding-agent --external:@oh-my-pi/pi-tui && tsc -p tsconfig.json --emitDeclarationOnly",
|
|
61
|
-
"check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json"
|
|
62
63
|
}
|
|
63
|
-
}
|
|
64
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 ngosangns
|
|
4
|
-
Copyright (c) 2025-2026 Mike O'Brien (pi-provider-kiro)
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|