@gleapai/kai-bridge 0.9.1 → 0.10.1
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 +2 -2
- package/npm-shrinkwrap.json +105 -101
- package/package.json +7 -7
- package/runner/acp-runner.mjs +15 -53
- package/runner/lib/acp/harnesses.mjs +15 -1
- package/runner/lib/acp/mapper.mjs +13 -31
- package/runner/lib/acp/transcripts.mjs +41 -0
- package/runner/lib/contract.mjs +1 -16
- package/runner/tools/patch-claude-acp.mjs +1 -1
- package/scripts/postinstall.mjs +7 -0
- package/src/api.mjs +16 -102
- package/src/companions.mjs +3 -2
- package/src/daemon.mjs +607 -1054
- package/src/executor.mjs +2 -2
- package/src/gateway.mjs +217 -0
- package/src/harnesses.mjs +16 -3
- package/src/playwright-patch.mjs +84 -0
- package/src/preview-errors.mjs +0 -29
- package/src/preview.mjs +291 -101
- package/src/service.mjs +0 -11
- package/src/setup.mjs +5 -5
- package/src/tunnel-binary.mjs +109 -0
- package/src/tunnel.mjs +227 -0
- package/src/workspace.mjs +1 -1
- package/runner/personas/claude/kai-verifier.md +0 -84
- package/runner/personas/codex/kai-verifier.md +0 -84
- package/runner/tools/verify-mcp.mjs +0 -442
- package/src/preview-login.mjs +0 -610
- package/src/verify.mjs +0 -387
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Kai Code Bridge
|
|
2
2
|
|
|
3
3
|
Run [Gleap Kai Code](https://gleap.io) on your computer or server with your own
|
|
4
|
-
Claude Code / Codex login, local dev-server previews
|
|
4
|
+
Claude Code / Codex login, and local dev-server previews.
|
|
5
5
|
|
|
6
6
|
```bash
|
|
7
7
|
npm i -g @gleapai/kai-bridge # one install, so the background service has a stable path
|
|
@@ -67,4 +67,4 @@ Updates install into `~/.kai/harnesses`, verify the new executable, then select
|
|
|
67
67
|
|
|
68
68
|
Codex automatically uses device-code sign-in over SSH or on headless Linux. Enable device-code sign-in in the account settings if Codex asks. Claude uses its native `auth login` flow: follow the URL and prompts in the SSH terminal. Dashboard **Sign in** opens a terminal on desktop devices; for headless servers it shows the exact command to run over SSH. The login is picked up automatically.
|
|
69
69
|
|
|
70
|
-
**Previews
|
|
70
|
+
**Previews boot local to the Kai Code Bridge device.** Open them on that computer, or click **Make public** in the dashboard's Preview popover to get a stable HTTPS link (`https://web-<repo>-<id>.gleap-preview.dev`) that works from a phone or a teammate's laptop. Public links run through a Cloudflare Tunnel: the daemon starts `cloudflared` on the device (it uses one from your PATH, else downloads a pinned release into `~/.kai/bin`; `brew install cloudflared`, `apt install cloudflared` or `winget install Cloudflare.cloudflared` also work). The address is the same for every ticket of a repo on this device, so a saved login survives from one ticket to the next, and only one ticket per repo can be public on a device at a time: making another one public points the same link at it and stops the previous preview (its owner sees a notice). Nothing leaves the device until someone clicks Make public. `kai-bridge ps` shows what is running.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gleapai/kai-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@gleapai/kai-bridge",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.10.1",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@agentclientprotocol/claude-agent-acp": "0.
|
|
14
|
-
"@agentclientprotocol/codex-acp": "1.
|
|
15
|
-
"@agentclientprotocol/sdk": "1.
|
|
16
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
17
|
-
"@openai/codex": "0.
|
|
13
|
+
"@agentclientprotocol/claude-agent-acp": "0.81.1",
|
|
14
|
+
"@agentclientprotocol/codex-acp": "1.13.1",
|
|
15
|
+
"@agentclientprotocol/sdk": "1.5.0",
|
|
16
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.280",
|
|
17
|
+
"@openai/codex": "0.156.1",
|
|
18
18
|
"@playwright/mcp": "^0.0.79",
|
|
19
19
|
"@sockudo/client": "^2.0.0",
|
|
20
20
|
"chokidar": "^4.0.1",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"license": "Apache-2.0"
|
|
36
36
|
},
|
|
37
37
|
"node_modules/@agentclientprotocol/claude-agent-acp": {
|
|
38
|
-
"version": "0.
|
|
39
|
-
"resolved": "https://registry.npmjs.org/@agentclientprotocol/claude-agent-acp/-/claude-agent-acp-0.
|
|
40
|
-
"integrity": "sha512-
|
|
38
|
+
"version": "0.81.1",
|
|
39
|
+
"resolved": "https://registry.npmjs.org/@agentclientprotocol/claude-agent-acp/-/claude-agent-acp-0.81.1.tgz",
|
|
40
|
+
"integrity": "sha512-I+7tUPsrYnI0nBmdUonoRmdCi7ohyzZ0SeCpeIUFuVZ7a8ZxDyUNO6zBJpaeAIwuPXCk8aw+7t+QiwXS6FwskQ==",
|
|
41
41
|
"license": "Apache-2.0",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@agentclientprotocol/sdk": "1.
|
|
44
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
45
|
-
"zod": "
|
|
43
|
+
"@agentclientprotocol/sdk": "1.5.0",
|
|
44
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.280",
|
|
45
|
+
"zod": "4.6.5"
|
|
46
46
|
},
|
|
47
47
|
"bin": {
|
|
48
48
|
"claude-agent-acp": "dist/index.js"
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"node_modules/@agentclientprotocol/codex-acp": {
|
|
55
|
-
"version": "1.
|
|
56
|
-
"resolved": "https://registry.npmjs.org/@agentclientprotocol/codex-acp/-/codex-acp-1.
|
|
57
|
-
"integrity": "sha512-
|
|
55
|
+
"version": "1.13.1",
|
|
56
|
+
"resolved": "https://registry.npmjs.org/@agentclientprotocol/codex-acp/-/codex-acp-1.13.1.tgz",
|
|
57
|
+
"integrity": "sha512-NAbXTb6GRReox7B+8RN9VRB+sKUqFJh5Vg7Ex7RskYCO8EsYPJKN1WJvN7mOqjCKKK9lVDrNxtP7Bp/OUKPyAg==",
|
|
58
58
|
"license": "Apache-2.0",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@agentclientprotocol/sdk": "^1.
|
|
61
|
-
"@openai/codex": "^0.
|
|
60
|
+
"@agentclientprotocol/sdk": "^1.5.0",
|
|
61
|
+
"@openai/codex": "^0.156.1",
|
|
62
62
|
"diff": "^9.0.0",
|
|
63
63
|
"open": "^11.0.1",
|
|
64
64
|
"vscode-jsonrpc": "^9.0.1",
|
|
@@ -69,31 +69,31 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"node_modules/@agentclientprotocol/sdk": {
|
|
72
|
-
"version": "1.
|
|
73
|
-
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-1.
|
|
74
|
-
"integrity": "sha512
|
|
72
|
+
"version": "1.5.0",
|
|
73
|
+
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-1.5.0.tgz",
|
|
74
|
+
"integrity": "sha512-524jwbB2iYWA+kWWyv9fhKbhU89dH/lu9u5EXwVNmfYzopV8BujCDxByBDZhxRUkB7RWIJzISCnwivdDk+bdVg==",
|
|
75
75
|
"license": "Apache-2.0",
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"zod": "^3.25.0 || ^4.0.0"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"node_modules/@anthropic-ai/claude-agent-sdk": {
|
|
81
|
-
"version": "0.3.
|
|
82
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.
|
|
83
|
-
"integrity": "sha512-
|
|
81
|
+
"version": "0.3.280",
|
|
82
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk/-/claude-agent-sdk-0.3.280.tgz",
|
|
83
|
+
"integrity": "sha512-aIQSTKcCJcOgi125GAGQaNZUYgxbEBQwV2Ac+Utp0+gGUjIEWjTqz4B8kXr9XjkcCTYiRUMTDsXPAUfIcBDjnw==",
|
|
84
84
|
"license": "SEE LICENSE IN README.md",
|
|
85
85
|
"engines": {
|
|
86
86
|
"node": ">=18.0.0"
|
|
87
87
|
},
|
|
88
88
|
"optionalDependencies": {
|
|
89
|
-
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.
|
|
90
|
-
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.
|
|
91
|
-
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.
|
|
92
|
-
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.
|
|
93
|
-
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.
|
|
94
|
-
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.
|
|
95
|
-
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.
|
|
96
|
-
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.
|
|
89
|
+
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.280",
|
|
90
|
+
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.280",
|
|
91
|
+
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.280",
|
|
92
|
+
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.280",
|
|
93
|
+
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.280",
|
|
94
|
+
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.280",
|
|
95
|
+
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.280",
|
|
96
|
+
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.280"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@anthropic-ai/sdk": ">=0.93.0",
|
|
@@ -102,9 +102,9 @@
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"node_modules/@anthropic-ai/claude-agent-sdk-darwin-arm64": {
|
|
105
|
-
"version": "0.3.
|
|
106
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.
|
|
107
|
-
"integrity": "sha512-
|
|
105
|
+
"version": "0.3.280",
|
|
106
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-arm64/-/claude-agent-sdk-darwin-arm64-0.3.280.tgz",
|
|
107
|
+
"integrity": "sha512-Yws14X5g5hgDtF565Tld/+dILAhH9QZpundjKMyO3dFasq9miXZlhU0NwXqwTO2xP0jDjJ54zduIiJwkcfcvGw==",
|
|
108
108
|
"cpu": [
|
|
109
109
|
"arm64"
|
|
110
110
|
],
|
|
@@ -115,9 +115,9 @@
|
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
117
|
"node_modules/@anthropic-ai/claude-agent-sdk-darwin-x64": {
|
|
118
|
-
"version": "0.3.
|
|
119
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.
|
|
120
|
-
"integrity": "sha512
|
|
118
|
+
"version": "0.3.280",
|
|
119
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-darwin-x64/-/claude-agent-sdk-darwin-x64-0.3.280.tgz",
|
|
120
|
+
"integrity": "sha512-B1eLx/oZ5RL1c3a13nQ4cRUksWyhGcVNS5vbCHnOVu4Pz+dH0moZ+iY8VaE6FvikVAQwFEW6VDU00b6m3tYdsQ==",
|
|
121
121
|
"cpu": [
|
|
122
122
|
"x64"
|
|
123
123
|
],
|
|
@@ -128,9 +128,9 @@
|
|
|
128
128
|
]
|
|
129
129
|
},
|
|
130
130
|
"node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64": {
|
|
131
|
-
"version": "0.3.
|
|
132
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.
|
|
133
|
-
"integrity": "sha512-
|
|
131
|
+
"version": "0.3.280",
|
|
132
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64/-/claude-agent-sdk-linux-arm64-0.3.280.tgz",
|
|
133
|
+
"integrity": "sha512-6s96OIvBHT2817hCFLIZ421JBpQnvrmZucpjlWsyCODKmwGsSxiEhlWqK2h5Q7lwS6F7bzeAhqjGvC7FzDl9Rw==",
|
|
134
134
|
"cpu": [
|
|
135
135
|
"arm64"
|
|
136
136
|
],
|
|
@@ -144,9 +144,9 @@
|
|
|
144
144
|
]
|
|
145
145
|
},
|
|
146
146
|
"node_modules/@anthropic-ai/claude-agent-sdk-linux-arm64-musl": {
|
|
147
|
-
"version": "0.3.
|
|
148
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.
|
|
149
|
-
"integrity": "sha512-
|
|
147
|
+
"version": "0.3.280",
|
|
148
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-arm64-musl/-/claude-agent-sdk-linux-arm64-musl-0.3.280.tgz",
|
|
149
|
+
"integrity": "sha512-uDh+Ggjb36l+jcVgaYxSziGHmBSSR3clqvGlQ0Bgc1v5dLF4igwqZ6ZPW/hS9dArG27fislIOetH1waEgIr+GA==",
|
|
150
150
|
"cpu": [
|
|
151
151
|
"arm64"
|
|
152
152
|
],
|
|
@@ -160,9 +160,9 @@
|
|
|
160
160
|
]
|
|
161
161
|
},
|
|
162
162
|
"node_modules/@anthropic-ai/claude-agent-sdk-linux-x64": {
|
|
163
|
-
"version": "0.3.
|
|
164
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.
|
|
165
|
-
"integrity": "sha512-
|
|
163
|
+
"version": "0.3.280",
|
|
164
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64/-/claude-agent-sdk-linux-x64-0.3.280.tgz",
|
|
165
|
+
"integrity": "sha512-vpPyxYLy+zNc7LwQDWsZf0GZtTYa0PJLxzuv2vK9iV2dG+hrbRNTl35NSKKRR9rMj6RpKz0i2NLyVQ+D4mREgw==",
|
|
166
166
|
"cpu": [
|
|
167
167
|
"x64"
|
|
168
168
|
],
|
|
@@ -176,9 +176,9 @@
|
|
|
176
176
|
]
|
|
177
177
|
},
|
|
178
178
|
"node_modules/@anthropic-ai/claude-agent-sdk-linux-x64-musl": {
|
|
179
|
-
"version": "0.3.
|
|
180
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.
|
|
181
|
-
"integrity": "sha512-
|
|
179
|
+
"version": "0.3.280",
|
|
180
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-linux-x64-musl/-/claude-agent-sdk-linux-x64-musl-0.3.280.tgz",
|
|
181
|
+
"integrity": "sha512-IVbIgvi5C0sdLg/p9hpiVvAQ/ikvTKwOOEy5C1aT7w8XLqBgfpJbzzVuk06df1Q0HlILUmf63EKPmq48lbxtqA==",
|
|
182
182
|
"cpu": [
|
|
183
183
|
"x64"
|
|
184
184
|
],
|
|
@@ -192,9 +192,9 @@
|
|
|
192
192
|
]
|
|
193
193
|
},
|
|
194
194
|
"node_modules/@anthropic-ai/claude-agent-sdk-win32-arm64": {
|
|
195
|
-
"version": "0.3.
|
|
196
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.
|
|
197
|
-
"integrity": "sha512-
|
|
195
|
+
"version": "0.3.280",
|
|
196
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-arm64/-/claude-agent-sdk-win32-arm64-0.3.280.tgz",
|
|
197
|
+
"integrity": "sha512-heTflHwciJF+Hrf7v0J53QBzD+9mxN9gt2VVmEJAN0+ejbPcOcqnGGZHvyc9aZUuGh5INN0ECaiL4Fn1X2vXQQ==",
|
|
198
198
|
"cpu": [
|
|
199
199
|
"arm64"
|
|
200
200
|
],
|
|
@@ -205,9 +205,9 @@
|
|
|
205
205
|
]
|
|
206
206
|
},
|
|
207
207
|
"node_modules/@anthropic-ai/claude-agent-sdk-win32-x64": {
|
|
208
|
-
"version": "0.3.
|
|
209
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.
|
|
210
|
-
"integrity": "sha512
|
|
208
|
+
"version": "0.3.280",
|
|
209
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/claude-agent-sdk-win32-x64/-/claude-agent-sdk-win32-x64-0.3.280.tgz",
|
|
210
|
+
"integrity": "sha512-N+Y1zJb19nx0oPTvzkl/E3ng9AtWGW+K4hySmSHCgYSsgIwfs1YzDj/F5eHDMrxgklTuzFp76TvL3S75z5ge+g==",
|
|
211
211
|
"cpu": [
|
|
212
212
|
"x64"
|
|
213
213
|
],
|
|
@@ -218,9 +218,9 @@
|
|
|
218
218
|
]
|
|
219
219
|
},
|
|
220
220
|
"node_modules/@anthropic-ai/sdk": {
|
|
221
|
-
"version": "0.
|
|
222
|
-
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.
|
|
223
|
-
"integrity": "sha512-
|
|
221
|
+
"version": "0.128.0",
|
|
222
|
+
"resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.128.0.tgz",
|
|
223
|
+
"integrity": "sha512-tl5cBFZC1jVFrTuQyvQObA4WmuNgcYVeXfriqOumgtLAHUm4gPUj18YnszBW60v0PrjDB8nBDOC6wd9CmHQFlA==",
|
|
224
224
|
"license": "MIT",
|
|
225
225
|
"peer": true,
|
|
226
226
|
"dependencies": {
|
|
@@ -313,9 +313,9 @@
|
|
|
313
313
|
}
|
|
314
314
|
},
|
|
315
315
|
"node_modules/@openai/codex": {
|
|
316
|
-
"version": "0.
|
|
317
|
-
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.
|
|
318
|
-
"integrity": "sha512-
|
|
316
|
+
"version": "0.156.1",
|
|
317
|
+
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1.tgz",
|
|
318
|
+
"integrity": "sha512-nI1iVl/n2SO2lSvlwEsJx63zdSI4C4Me2gR7AG0OWMJiGSakz2tY2hx43E39Zq5aEoeB5bZjJXzp5Sqhog6vyA==",
|
|
319
319
|
"license": "Apache-2.0",
|
|
320
320
|
"bin": {
|
|
321
321
|
"codex": "bin/codex.js"
|
|
@@ -324,19 +324,19 @@
|
|
|
324
324
|
"node": ">=16"
|
|
325
325
|
},
|
|
326
326
|
"optionalDependencies": {
|
|
327
|
-
"@openai/codex-darwin-arm64": "npm:@openai/codex@0.
|
|
328
|
-
"@openai/codex-darwin-x64": "npm:@openai/codex@0.
|
|
329
|
-
"@openai/codex-linux-arm64": "npm:@openai/codex@0.
|
|
330
|
-
"@openai/codex-linux-x64": "npm:@openai/codex@0.
|
|
331
|
-
"@openai/codex-win32-arm64": "npm:@openai/codex@0.
|
|
332
|
-
"@openai/codex-win32-x64": "npm:@openai/codex@0.
|
|
327
|
+
"@openai/codex-darwin-arm64": "npm:@openai/codex@0.156.1-darwin-arm64",
|
|
328
|
+
"@openai/codex-darwin-x64": "npm:@openai/codex@0.156.1-darwin-x64",
|
|
329
|
+
"@openai/codex-linux-arm64": "npm:@openai/codex@0.156.1-linux-arm64",
|
|
330
|
+
"@openai/codex-linux-x64": "npm:@openai/codex@0.156.1-linux-x64",
|
|
331
|
+
"@openai/codex-win32-arm64": "npm:@openai/codex@0.156.1-win32-arm64",
|
|
332
|
+
"@openai/codex-win32-x64": "npm:@openai/codex@0.156.1-win32-x64"
|
|
333
333
|
}
|
|
334
334
|
},
|
|
335
335
|
"node_modules/@openai/codex-darwin-arm64": {
|
|
336
336
|
"name": "@openai/codex",
|
|
337
|
-
"version": "0.
|
|
338
|
-
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.
|
|
339
|
-
"integrity": "sha512-
|
|
337
|
+
"version": "0.156.1-darwin-arm64",
|
|
338
|
+
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-darwin-arm64.tgz",
|
|
339
|
+
"integrity": "sha512-Jg6wbdV+wmMZczhwE74GSxOYEZlViKXn6KyCw/yfrz3PAKFD14xljuPopmdhWC1+8IKU2WdN5fdmXNPt2q4HPA==",
|
|
340
340
|
"cpu": [
|
|
341
341
|
"arm64"
|
|
342
342
|
],
|
|
@@ -351,9 +351,9 @@
|
|
|
351
351
|
},
|
|
352
352
|
"node_modules/@openai/codex-darwin-x64": {
|
|
353
353
|
"name": "@openai/codex",
|
|
354
|
-
"version": "0.
|
|
355
|
-
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.
|
|
356
|
-
"integrity": "sha512-
|
|
354
|
+
"version": "0.156.1-darwin-x64",
|
|
355
|
+
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-darwin-x64.tgz",
|
|
356
|
+
"integrity": "sha512-BVjqNOoltWrnNUrgMRepvDIIBmd4XY+ikAE4pYVHlrwiizNlEWQuCQOTrFMJKp54LFRG8jDTjLZyYQ1QrliuOg==",
|
|
357
357
|
"cpu": [
|
|
358
358
|
"x64"
|
|
359
359
|
],
|
|
@@ -368,9 +368,9 @@
|
|
|
368
368
|
},
|
|
369
369
|
"node_modules/@openai/codex-linux-arm64": {
|
|
370
370
|
"name": "@openai/codex",
|
|
371
|
-
"version": "0.
|
|
372
|
-
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.
|
|
373
|
-
"integrity": "sha512-
|
|
371
|
+
"version": "0.156.1-linux-arm64",
|
|
372
|
+
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-linux-arm64.tgz",
|
|
373
|
+
"integrity": "sha512-sTEHk31C12dqzJdjZ2u9KLFCXKL04KyCM+QheSjdQI8uzmVJS7aEF2/qAqFxXwk/jwMzC9u7IihfoIlAGR6YsA==",
|
|
374
374
|
"cpu": [
|
|
375
375
|
"arm64"
|
|
376
376
|
],
|
|
@@ -385,9 +385,9 @@
|
|
|
385
385
|
},
|
|
386
386
|
"node_modules/@openai/codex-linux-x64": {
|
|
387
387
|
"name": "@openai/codex",
|
|
388
|
-
"version": "0.
|
|
389
|
-
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.
|
|
390
|
-
"integrity": "sha512-
|
|
388
|
+
"version": "0.156.1-linux-x64",
|
|
389
|
+
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-linux-x64.tgz",
|
|
390
|
+
"integrity": "sha512-2ePo0wgOcnONKsuzp8vBjOmNY+IdsKaouaDDIdiKq9HOWNuV/GI22OeXft2A/1GaoL71ictO0/pLAsCEnQ6wew==",
|
|
391
391
|
"cpu": [
|
|
392
392
|
"x64"
|
|
393
393
|
],
|
|
@@ -402,9 +402,9 @@
|
|
|
402
402
|
},
|
|
403
403
|
"node_modules/@openai/codex-win32-arm64": {
|
|
404
404
|
"name": "@openai/codex",
|
|
405
|
-
"version": "0.
|
|
406
|
-
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.
|
|
407
|
-
"integrity": "sha512
|
|
405
|
+
"version": "0.156.1-win32-arm64",
|
|
406
|
+
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-win32-arm64.tgz",
|
|
407
|
+
"integrity": "sha512-e5DsyOHlKWulTBz/neIczpcYLQDqtaLtBj2lgncOgeQw5mlAQVZHlGvKsoKVcEPUKLb8opIMJBxXi6cz3JJ4hg==",
|
|
408
408
|
"cpu": [
|
|
409
409
|
"arm64"
|
|
410
410
|
],
|
|
@@ -419,9 +419,9 @@
|
|
|
419
419
|
},
|
|
420
420
|
"node_modules/@openai/codex-win32-x64": {
|
|
421
421
|
"name": "@openai/codex",
|
|
422
|
-
"version": "0.
|
|
423
|
-
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.
|
|
424
|
-
"integrity": "sha512-
|
|
422
|
+
"version": "0.156.1-win32-x64",
|
|
423
|
+
"resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.156.1-win32-x64.tgz",
|
|
424
|
+
"integrity": "sha512-MJyLxbBs2zzp5kbaR/99Zwe7SmbrwUkveTcT+ayYlO48V0nYh0eU+h2lalBwvC7VJ/ya/bXnUtISJfJKhGCD/g==",
|
|
425
425
|
"cpu": [
|
|
426
426
|
"x64"
|
|
427
427
|
],
|
|
@@ -1068,9 +1068,9 @@
|
|
|
1068
1068
|
"peer": true
|
|
1069
1069
|
},
|
|
1070
1070
|
"node_modules/fast-uri": {
|
|
1071
|
-
"version": "3.1.
|
|
1072
|
-
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.
|
|
1073
|
-
"integrity": "sha512-
|
|
1071
|
+
"version": "3.1.8",
|
|
1072
|
+
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz",
|
|
1073
|
+
"integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==",
|
|
1074
1074
|
"funding": [
|
|
1075
1075
|
{
|
|
1076
1076
|
"type": "github",
|
|
@@ -1235,9 +1235,9 @@
|
|
|
1235
1235
|
}
|
|
1236
1236
|
},
|
|
1237
1237
|
"node_modules/hono": {
|
|
1238
|
-
"version": "4.13.
|
|
1239
|
-
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.
|
|
1240
|
-
"integrity": "sha512
|
|
1238
|
+
"version": "4.13.8",
|
|
1239
|
+
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.8.tgz",
|
|
1240
|
+
"integrity": "sha512-/Gng7NfoykZl2pjukW5Z6+8Yxm3BPRf86GTbQnt0SbySkvax4fyL4H3HhY1cCpBGmiW9XDRFzRV+CXK2W8QudQ==",
|
|
1241
1241
|
"license": "MIT",
|
|
1242
1242
|
"peer": true,
|
|
1243
1243
|
"engines": {
|
|
@@ -1290,9 +1290,9 @@
|
|
|
1290
1290
|
"peer": true
|
|
1291
1291
|
},
|
|
1292
1292
|
"node_modules/ip-address": {
|
|
1293
|
-
"version": "10.7.
|
|
1294
|
-
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.
|
|
1295
|
-
"integrity": "sha512-
|
|
1293
|
+
"version": "10.7.2",
|
|
1294
|
+
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.2.tgz",
|
|
1295
|
+
"integrity": "sha512-7H/2gFSIitxc0hG3nOI1glS8QLo/EHBFFLk8vEUjXY/xu0AdL8jZ9U1IzO2PUm0d2D/ofQcAifb0g6OBkt8U7w==",
|
|
1296
1296
|
"license": "MIT",
|
|
1297
1297
|
"peer": true,
|
|
1298
1298
|
"engines": {
|
|
@@ -1702,9 +1702,9 @@
|
|
|
1702
1702
|
}
|
|
1703
1703
|
},
|
|
1704
1704
|
"node_modules/proxy-addr": {
|
|
1705
|
-
"version": "2.0.
|
|
1706
|
-
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.
|
|
1707
|
-
"integrity": "sha512-
|
|
1705
|
+
"version": "2.0.8",
|
|
1706
|
+
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",
|
|
1707
|
+
"integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==",
|
|
1708
1708
|
"license": "MIT",
|
|
1709
1709
|
"peer": true,
|
|
1710
1710
|
"dependencies": {
|
|
@@ -1713,6 +1713,10 @@
|
|
|
1713
1713
|
},
|
|
1714
1714
|
"engines": {
|
|
1715
1715
|
"node": ">= 0.10"
|
|
1716
|
+
},
|
|
1717
|
+
"funding": {
|
|
1718
|
+
"type": "opencollective",
|
|
1719
|
+
"url": "https://opencollective.com/express"
|
|
1716
1720
|
}
|
|
1717
1721
|
},
|
|
1718
1722
|
"node_modules/qs": {
|
|
@@ -2174,9 +2178,9 @@
|
|
|
2174
2178
|
}
|
|
2175
2179
|
},
|
|
2176
2180
|
"node_modules/zod": {
|
|
2177
|
-
"version": "4.
|
|
2178
|
-
"resolved": "https://registry.npmjs.org/zod/-/zod-4.
|
|
2179
|
-
"integrity": "sha512-
|
|
2181
|
+
"version": "4.6.5",
|
|
2182
|
+
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.5.tgz",
|
|
2183
|
+
"integrity": "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==",
|
|
2180
2184
|
"license": "MIT",
|
|
2181
2185
|
"funding": {
|
|
2182
2186
|
"url": "https://github.com/sponsors/colinhacks"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gleapai/kai-bridge",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Kai Code Bridge runs Kai Code on your computer or server with your own coding subscriptions
|
|
3
|
+
"version": "0.10.1",
|
|
4
|
+
"description": "Kai Code Bridge runs Kai Code on your computer or server with your own coding subscriptions and local previews.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"postpack": "node scripts/prepare-release.mjs --clean"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@agentclientprotocol/claude-agent-acp": "0.
|
|
32
|
-
"@agentclientprotocol/codex-acp": "1.
|
|
33
|
-
"@agentclientprotocol/sdk": "1.
|
|
31
|
+
"@agentclientprotocol/claude-agent-acp": "0.81.1",
|
|
32
|
+
"@agentclientprotocol/codex-acp": "1.13.1",
|
|
33
|
+
"@agentclientprotocol/sdk": "1.5.0",
|
|
34
34
|
"@playwright/mcp": "^0.0.79",
|
|
35
35
|
"@sockudo/client": "^2.0.0",
|
|
36
36
|
"chokidar": "^4.0.1",
|
|
37
37
|
"ws": "^8.21.3",
|
|
38
38
|
"yaml": "^2.9.0",
|
|
39
|
-
"@openai/codex": "0.
|
|
40
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
39
|
+
"@openai/codex": "0.156.1",
|
|
40
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.280"
|
|
41
41
|
},
|
|
42
42
|
"overrides": {
|
|
43
43
|
"@anthropic-ai/claude-agent-sdk": "$@anthropic-ai/claude-agent-sdk"
|
package/runner/acp-runner.mjs
CHANGED
|
@@ -28,14 +28,12 @@ import { ClientSideConnection, ndJsonStream } from "@agentclientprotocol/sdk";
|
|
|
28
28
|
|
|
29
29
|
import {
|
|
30
30
|
KAI_RESOLUTION_ANALYST_AGENT_NAME,
|
|
31
|
-
KAI_VERIFIER_AGENT_NAME,
|
|
32
31
|
captureRepoBaselines,
|
|
33
32
|
createUsageTracker,
|
|
34
33
|
debugLog,
|
|
35
34
|
emit,
|
|
36
35
|
emitSync,
|
|
37
36
|
isArtifactWriterAgent,
|
|
38
|
-
isReadOnlyAgent,
|
|
39
37
|
parseRunnerArgs,
|
|
40
38
|
revertRepoMutations,
|
|
41
39
|
setTracePrefix,
|
|
@@ -77,10 +75,6 @@ const ENGINE_MODEL = ARGS.engineModel;
|
|
|
77
75
|
const HARNESS_ID = resolveHarnessId(ARGS.argv.harness, MODEL);
|
|
78
76
|
const HARNESS = getHarness(HARNESS_ID);
|
|
79
77
|
const IS_ARTIFACT_WRITER = isArtifactWriterAgent(AGENT);
|
|
80
|
-
// Read-only agents (the verifier): build-mode tool access minus the file
|
|
81
|
-
// write tools, repos reverted after the turn — see contract.mjs.
|
|
82
|
-
const IS_READ_ONLY = isReadOnlyAgent(AGENT);
|
|
83
|
-
const IS_VERIFIER = AGENT === KAI_VERIFIER_AGENT_NAME;
|
|
84
78
|
|
|
85
79
|
if (!TASK) {
|
|
86
80
|
emitSync({ type: "error", message: "runner: missing --task-b64 argument" });
|
|
@@ -89,7 +83,7 @@ if (!TASK) {
|
|
|
89
83
|
|
|
90
84
|
const RUNNER_DIR = dirname(fileURLToPath(import.meta.url));
|
|
91
85
|
const PERSONA_DIR = process.env.KAI_PERSONA_DIR || "/opt/gleap-runners/personas";
|
|
92
|
-
const PERSONA_AGENTS = new Set(["kai-documentarian", "kai-asker", "kai-researcher", KAI_RESOLUTION_ANALYST_AGENT_NAME
|
|
86
|
+
const PERSONA_AGENTS = new Set(["kai-documentarian", "kai-asker", "kai-researcher", KAI_RESOLUTION_ANALYST_AGENT_NAME]);
|
|
93
87
|
const SCRATCH_DIR = join(tmpdir(), `kai-acp-${process.pid}`);
|
|
94
88
|
mkdirSync(SCRATCH_DIR, { recursive: true });
|
|
95
89
|
// Harness config dir lives OUTSIDE the repo tree and survives across
|
|
@@ -132,32 +126,6 @@ const PROMPT_SUGGESTION_WAIT_MS = Math.max(0, Number(process.env.KAI_PROMPT_SUGG
|
|
|
132
126
|
const PROMPT_SUGGESTIONS_ENABLED = process.env.KAI_PROMPT_SUGGESTIONS !== "0" && PROMPT_SUGGESTION_WAIT_MS > 0;
|
|
133
127
|
const TODO_SERVER_KEY = "kai_todos";
|
|
134
128
|
const TODO_MCP_PATH = process.env.KAI_TODO_MCP_PATH || join(RUNNER_DIR, "tools", "todo-mcp.mjs");
|
|
135
|
-
// Verification report bridge (tools/verify-mcp.mjs) — the verifier's
|
|
136
|
-
// verdict channel. Attached ONLY to kai-verifier turns; the mapper turns
|
|
137
|
-
// its `report_verification` calls into `verify_report` contract events.
|
|
138
|
-
const VERIFY_SERVER_KEY = "kai_verify";
|
|
139
|
-
const VERIFY_MCP_PATH = process.env.KAI_VERIFY_MCP_PATH || join(RUNNER_DIR, "tools", "verify-mcp.mjs");
|
|
140
|
-
/**
|
|
141
|
-
* `KAI_VERIFY_*` — the host's request policy for the verify MCP's
|
|
142
|
-
* `http_request` (read-only flag, allowed origins, the app's auth header,
|
|
143
|
-
* the evidence dir for `requests.jsonl`). Passed EXPLICITLY on the server
|
|
144
|
-
* entry: Codex spawns MCP servers with a scrubbed env, and the values must
|
|
145
|
-
* never ride in the prompt (the auth header is a live credential).
|
|
146
|
-
*/
|
|
147
|
-
function verifyMcpEnv() {
|
|
148
|
-
const out = {};
|
|
149
|
-
for (const k of Object.keys(process.env).sort()) {
|
|
150
|
-
if (k.startsWith("KAI_VERIFY_") && k !== "KAI_VERIFY_MCP_PATH" && process.env[k]) out[k] = String(process.env[k]);
|
|
151
|
-
}
|
|
152
|
-
return out;
|
|
153
|
-
}
|
|
154
|
-
// The verifier must not write files. Claude's bypassPermissions mode still
|
|
155
|
-
// honours disallowedTools, so the write tools are removed outright (Bash
|
|
156
|
-
// redirections are caught by the post-turn revert).
|
|
157
|
-
const READ_ONLY_DISALLOWED = ["Write", "Edit", "MultiEdit", "NotebookEdit"];
|
|
158
|
-
// The verifier tests the app, it never needs the app's secrets: env files
|
|
159
|
-
// and private keys stay unreadable (gitignore-style Read rules).
|
|
160
|
-
const VERIFIER_DISALLOWED = ["Read(**/.env*)", "Read(**/*.pem)"];
|
|
161
129
|
const TODO_NOTE =
|
|
162
130
|
"Track multi-step work as a live todo list with the `todo_write` tool " +
|
|
163
131
|
`from the \`${TODO_SERVER_KEY}\` MCP server: pass the FULL updated list ` +
|
|
@@ -311,9 +279,7 @@ function buildAppendSystemPrompt() {
|
|
|
311
279
|
if (IS_PLAN_MODE) sections.push(NEEDS_ASK_USER_MCP ? GATEWAY_PLAN_GUARD : PLAN_QUESTION_GUARD);
|
|
312
280
|
if (IS_PLAN_MODE) sections.push(PLAN_SCOPE_NOTE);
|
|
313
281
|
if (IS_PLAN_MODE && HARNESS_ID !== "claude") sections.push(READ_ONLY_PLAN_NOTE);
|
|
314
|
-
|
|
315
|
-
// the hand-off note ("the host commits your changes") would contradict it.
|
|
316
|
-
if (!IS_PLAN_MODE && !IS_READ_ONLY) sections.push(GIT_HANDOFF_PROMPT);
|
|
282
|
+
if (!IS_PLAN_MODE) sections.push(GIT_HANDOFF_PROMPT);
|
|
317
283
|
// After the safety guards (their leading position is load-bearing for
|
|
318
284
|
// cursor's prompt-prefix mode) but before project instructions.
|
|
319
285
|
if (!IS_ARTIFACT_WRITER) sections.push(TODO_NOTE);
|
|
@@ -331,9 +297,6 @@ function buildAcpMcpServers() {
|
|
|
331
297
|
if (!IS_ARTIFACT_WRITER && existsSync(TODO_MCP_PATH)) {
|
|
332
298
|
out.push({ name: TODO_SERVER_KEY, command: process.execPath, args: [TODO_MCP_PATH], env: [] });
|
|
333
299
|
}
|
|
334
|
-
if (IS_VERIFIER && existsSync(VERIFY_MCP_PATH)) {
|
|
335
|
-
out.push({ name: VERIFY_SERVER_KEY, command: process.execPath, args: [VERIFY_MCP_PATH], env: Object.entries(verifyMcpEnv()).map(([name, value]) => ({ name, value })) });
|
|
336
|
-
}
|
|
337
300
|
for (const server of MCP_SERVERS || []) {
|
|
338
301
|
if (!server || typeof server !== "object") continue;
|
|
339
302
|
const name = String(server.name || server.id || "").replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
@@ -384,8 +347,6 @@ function buildAgents() {
|
|
|
384
347
|
|
|
385
348
|
function buildDisallowedTools() {
|
|
386
349
|
const list = IS_PLAN_MODE || IS_ARTIFACT_WRITER ? [] : [...GIT_HANDOFF_DISALLOWED];
|
|
387
|
-
if (IS_READ_ONLY) list.push(...READ_ONLY_DISALLOWED);
|
|
388
|
-
if (IS_VERIFIER) list.push(...VERIFIER_DISALLOWED);
|
|
389
350
|
for (const server of MCP_SERVERS || []) {
|
|
390
351
|
const key = String(server?.name || server?.id || "").replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
391
352
|
for (const tool of [...(server?.disabledTools ?? []), ...(server?.gatedTools ?? [])]) {
|
|
@@ -503,14 +464,12 @@ async function main() {
|
|
|
503
464
|
maxSteps: MAX_STEPS,
|
|
504
465
|
isPlanMode: IS_PLAN_MODE,
|
|
505
466
|
isArtifactWriter: IS_ARTIFACT_WRITER,
|
|
506
|
-
isReadOnly: IS_READ_ONLY,
|
|
507
467
|
appendSystemPrompt,
|
|
508
468
|
instructionsPath,
|
|
509
469
|
disallowedTools: buildDisallowedTools(),
|
|
510
470
|
allowedTools: buildAllowedTools([
|
|
511
471
|
// The injected todo bridge must survive plan mode's allow-list.
|
|
512
472
|
`mcp__${TODO_SERVER_KEY}`,
|
|
513
|
-
...(IS_VERIFIER ? [`mcp__${VERIFY_SERVER_KEY}`] : []),
|
|
514
473
|
...(MCP_SERVERS || []).map((srv) => `mcp__${String(srv?.name || srv?.id || "").replace(/[^a-zA-Z0-9_-]/g, "_")}`).filter((k) => k !== "mcp__"),
|
|
515
474
|
]),
|
|
516
475
|
agents: buildAgents(),
|
|
@@ -527,9 +486,6 @@ async function main() {
|
|
|
527
486
|
...(!IS_ARTIFACT_WRITER && existsSync(TODO_MCP_PATH)
|
|
528
487
|
? [{ name: TODO_SERVER_KEY, command: process.execPath, args: [TODO_MCP_PATH] }]
|
|
529
488
|
: []),
|
|
530
|
-
...(IS_VERIFIER && existsSync(VERIFY_MCP_PATH)
|
|
531
|
-
? [{ name: VERIFY_SERVER_KEY, command: process.execPath, args: [VERIFY_MCP_PATH], env: verifyMcpEnv() }]
|
|
532
|
-
: []),
|
|
533
489
|
...(MCP_SERVERS || []),
|
|
534
490
|
]
|
|
535
491
|
: MCP_SERVERS || [],
|
|
@@ -618,7 +574,7 @@ async function main() {
|
|
|
618
574
|
isPlanMode: IS_PLAN_MODE,
|
|
619
575
|
mcpServerIds,
|
|
620
576
|
readPlanFile: readNewestPlan,
|
|
621
|
-
allowTool: permissionPolicy({ isPlanMode: IS_PLAN_MODE, isArtifactWriter: IS_ARTIFACT_WRITER,
|
|
577
|
+
allowTool: permissionPolicy({ isPlanMode: IS_PLAN_MODE, isArtifactWriter: IS_ARTIFACT_WRITER, workDir: WORK_DIR }),
|
|
622
578
|
onTurnShouldEnd: (reason) => {
|
|
623
579
|
cancelRequested = reason;
|
|
624
580
|
if (conn && acpSessionId) conn.cancel({ sessionId: acpSessionId }).catch(() => {});
|
|
@@ -686,6 +642,10 @@ async function main() {
|
|
|
686
642
|
!!SESSION_ID &&
|
|
687
643
|
!!init.agentCapabilities?.sessionCapabilities?.resume &&
|
|
688
644
|
(HARNESS.hasResumableSession ? HARNESS.hasResumableSession(ctx) : true);
|
|
645
|
+
// What the session's earlier turns already cost (Claude: the total the
|
|
646
|
+
// transcript saved — a resumed query's cost figure continues from it).
|
|
647
|
+
// Read before the resume appends this turn's record.
|
|
648
|
+
const priorTurnsCostUsd = canResume ? Number(HARNESS.priorTurnsCostUsd?.(ctx)) || 0 : 0;
|
|
689
649
|
let sessionResponse;
|
|
690
650
|
let resumed = false;
|
|
691
651
|
if (canResume) {
|
|
@@ -749,10 +709,10 @@ async function main() {
|
|
|
749
709
|
}
|
|
750
710
|
}
|
|
751
711
|
|
|
752
|
-
// Artifact writers
|
|
753
|
-
//
|
|
754
|
-
//
|
|
755
|
-
const REVERTS_REPO = IS_ARTIFACT_WRITER
|
|
712
|
+
// Artifact writers must leave the repo untouched: snapshot before, revert
|
|
713
|
+
// anything outside `.kai/` after (belt-and-braces under the permission
|
|
714
|
+
// rules — shell redirections can still write).
|
|
715
|
+
const REVERTS_REPO = IS_ARTIFACT_WRITER;
|
|
756
716
|
const baselines = REVERTS_REPO ? captureRepoBaselines(WORK_DIR) : null;
|
|
757
717
|
// Harnesses without a system-prompt channel (Cursor) get the persona as
|
|
758
718
|
// a prefix of the first prompt.
|
|
@@ -821,9 +781,11 @@ async function main() {
|
|
|
821
781
|
);
|
|
822
782
|
}
|
|
823
783
|
// The adapter's USD is the CLI's own figure — authoritative on the
|
|
824
|
-
// native Anthropic wire only; gateway turns are priced from tokens.
|
|
784
|
+
// native Anthropic wire only; gateway turns are priced from tokens. On a
|
|
785
|
+
// resumed session it is the conversation's running total (Agent SDK
|
|
786
|
+
// 0.3.280), so only the part above the saved prior total is this turn's.
|
|
825
787
|
if (typeof finished.usage?.costUsd === "number" && HARNESS_ID === "claude" && isNativeAnthropic(MODEL)) {
|
|
826
|
-
tracker.setProviderCostUsd(finished.usage.costUsd);
|
|
788
|
+
tracker.setProviderCostUsd(Math.max(0, finished.usage.costUsd - (resumed ? priorTurnsCostUsd : 0)));
|
|
827
789
|
}
|
|
828
790
|
|
|
829
791
|
const suggestionWaitStarted = Date.now();
|