@omp-provider-capabilities/kiro 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +37 -2
- package/package.json +38 -4
- package/src/agent-sdk.ts +94 -0
- package/src/index.ts +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Enver Francisco
|
|
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
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @omp-provider-capabilities/kiro
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Kiro harness adapter (ACP) and Kiro models
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Kiro harness (ACP)
|
|
8
|
+
- Kiro model metadata
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Install via OMP plugin manager:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
omp plugin install @omp-provider-capabilities/kiro
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Install from GitHub:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
omp plugin install https://github.com/blyzer/omp-provider-capabilities/tree/main/packages/kiro
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Link a local checkout:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
omp plugin link /path/to/omp-provider-capabilities/packages/kiro
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Load the extension source for one invocation:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
omp -e /path/to/omp-provider-capabilities/packages/kiro/src/index.ts
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omp-provider-capabilities/kiro",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Kiro provider extension: Kiro harness (ACP), Kiro models",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"src/",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"omp": {
|
|
14
|
+
"extensions": [
|
|
15
|
+
"./src/index.ts"
|
|
16
|
+
],
|
|
17
|
+
"settings": {
|
|
18
|
+
"harness.enabled": {
|
|
19
|
+
"type": "boolean",
|
|
20
|
+
"default": true,
|
|
21
|
+
"description": "Enable Kiro harness"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"omp-package",
|
|
30
|
+
"omp-plugin",
|
|
31
|
+
"omp-extension",
|
|
32
|
+
"oh-my-pi",
|
|
33
|
+
"kiro"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@omp-provider-capabilities/core": "^0.1.0",
|
|
37
|
+
"@omp-provider-capabilities/harness": "^0.1.0"
|
|
38
|
+
},
|
|
39
|
+
"license": "MIT"
|
|
40
|
+
}
|
package/src/agent-sdk.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kiro Agent SDK wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Wraps Kiro's API for multi-turn agent loops via direct HTTP.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
AgentSDK,
|
|
9
|
+
AgentConfig,
|
|
10
|
+
AgentResult,
|
|
11
|
+
AgentMessage,
|
|
12
|
+
AgentTool,
|
|
13
|
+
} from "@omp-provider-capabilities/core";
|
|
14
|
+
|
|
15
|
+
export class KiroAgentSDK implements AgentSDK {
|
|
16
|
+
public provider = "kiro";
|
|
17
|
+
private apiKey: string;
|
|
18
|
+
|
|
19
|
+
constructor(apiKey: string) {
|
|
20
|
+
this.apiKey = apiKey;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
isAvailable(): boolean {
|
|
24
|
+
return !!this.apiKey;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async run(prompt: string, config: AgentConfig): Promise<AgentResult> {
|
|
28
|
+
const history: AgentMessage[] = [...(config.history || [])];
|
|
29
|
+
const maxTurns = config.maxTurns || 10;
|
|
30
|
+
let toolCallCount = 0;
|
|
31
|
+
|
|
32
|
+
const messages: Array<{ role: string; content: string }> = [
|
|
33
|
+
...(config.history || []).map((m) => ({ role: m.role, content: m.content })),
|
|
34
|
+
{ role: "user", content: prompt },
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
if (config.instruction) {
|
|
38
|
+
messages.unshift({ role: "system", content: config.instruction });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (let turn = 0; turn < maxTurns; turn++) {
|
|
42
|
+
const response = await fetch("https://api.kiro.com/v1/chat/completions", {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
model: config.model || "kiro-2.0",
|
|
50
|
+
messages,
|
|
51
|
+
max_tokens: 4096,
|
|
52
|
+
tools: config.tools?.map((t) => ({
|
|
53
|
+
type: "function",
|
|
54
|
+
function: { name: t.name, description: t.description, parameters: t.parameters },
|
|
55
|
+
})),
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
const errorText = await response.text();
|
|
61
|
+
return { output: "", history, toolCallCount, error: `Kiro API error: ${response.status} ${errorText}` };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const data = await response.json();
|
|
65
|
+
const choices = data.choices || [];
|
|
66
|
+
if (choices.length === 0) break;
|
|
67
|
+
|
|
68
|
+
const message = choices[0].message;
|
|
69
|
+
if (message.tool_calls) {
|
|
70
|
+
toolCallCount += message.tool_calls.length;
|
|
71
|
+
for (const tc of message.tool_calls) {
|
|
72
|
+
messages.push({ role: "assistant", content: JSON.stringify(tc) });
|
|
73
|
+
const tool = config.tools?.find((t) => t.name === tc.function?.name);
|
|
74
|
+
let result = "Tool not found";
|
|
75
|
+
if (tool) {
|
|
76
|
+
try {
|
|
77
|
+
result = await tool.execute(tc.function?.arguments ? JSON.parse(tc.function.arguments) : {});
|
|
78
|
+
} catch (e) {
|
|
79
|
+
result = `Tool error: ${e instanceof Error ? e.message : String(e)}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
messages.push({ role: "tool", content: result });
|
|
83
|
+
history.push({ role: "tool", content: result, toolCallId: tc.id, toolName: tc.function?.name });
|
|
84
|
+
}
|
|
85
|
+
} else if (message.content) {
|
|
86
|
+
messages.push({ role: "assistant", content: message.content });
|
|
87
|
+
history.push({ role: "assistant", content: message.content });
|
|
88
|
+
return { output: message.content, history, toolCallCount };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { output: "", history, toolCallCount };
|
|
93
|
+
}
|
|
94
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kiro provider extension for OMPv1.
|
|
3
|
+
*
|
|
4
|
+
* Covers: Kiro models with Agent SDK wrapper.
|
|
5
|
+
*
|
|
6
|
+
* OMPv1 native: `kiro.kdl` catalog, `kiro/stream.ts` AI provider.
|
|
7
|
+
* The Kiro CLI wrapper was removed — it was a CLI abstraction.
|
|
8
|
+
*/
|
|
9
|
+
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
|
|
10
|
+
|
|
11
|
+
export const KIRO_PROVIDER_ID = "kiro";
|
|
12
|
+
|
|
13
|
+
export default function kiroExtension(pi: ExtensionAPI) {
|
|
14
|
+
pi.on("session_start", async () => {
|
|
15
|
+
pi.logger.debug("Kiro provider extension loaded");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
pi.on("session_shutdown", async () => {
|
|
19
|
+
// cleanup
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export { KiroAgentSDK } from './agent-sdk';
|