zapagent 1.14.29 → 1.14.30
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/bundled-dependencies.json +200 -200
- package/package.json +1 -1
- package/src/App.tsx +5 -3
- package/src/agent/outputThroughput.ts +27 -0
- package/src/agent/remote-agent.ts +2 -1
- package/src/agent/remote-turn.ts +26 -5
- package/src/agent/wireRunHandlers.ts +4 -2
- package/src/hooks/useAgentRunner.ts +9 -1
- package/src/ui/dialog-model.tsx +76 -19
- package/src/ui/footer.tsx +10 -8
- package/zapsdk/acp-client/event-mapper.ts +2 -1
- package/zapsdk/acp-client/run.ts +5 -1
|
@@ -1,192 +1,232 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"name": "
|
|
4
|
-
"version": "
|
|
3
|
+
"name": "auto-bind",
|
|
4
|
+
"version": "5.0.1",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"path": "node_modules/
|
|
6
|
+
"path": "node_modules/auto-bind",
|
|
7
7
|
"notices": [
|
|
8
8
|
{
|
|
9
|
-
"path": "node_modules/
|
|
9
|
+
"path": "node_modules/auto-bind/license",
|
|
10
10
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
"name": "
|
|
16
|
-
"version": "
|
|
15
|
+
"name": "react-reconciler",
|
|
16
|
+
"version": "0.33.0",
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"path": "node_modules/
|
|
18
|
+
"path": "node_modules/react-reconciler",
|
|
19
19
|
"notices": [
|
|
20
20
|
{
|
|
21
|
-
"path": "node_modules/
|
|
22
|
-
"sha256": "
|
|
21
|
+
"path": "node_modules/react-reconciler/LICENSE",
|
|
22
|
+
"sha256": "da6d3703ed11cbe42bd212c725957c98da23cbff1998c05fa4b3d976d1a58e93"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
"name": "
|
|
28
|
-
"version": "
|
|
27
|
+
"name": "ansi-styles",
|
|
28
|
+
"version": "6.2.3",
|
|
29
29
|
"license": "MIT",
|
|
30
|
-
"path": "node_modules/
|
|
30
|
+
"path": "node_modules/ansi-styles",
|
|
31
31
|
"notices": [
|
|
32
32
|
{
|
|
33
|
-
"path": "node_modules/
|
|
33
|
+
"path": "node_modules/ansi-styles/license",
|
|
34
34
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
35
35
|
}
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
"name": "
|
|
40
|
-
"version": "
|
|
41
|
-
"license": "MIT",
|
|
42
|
-
"path": "node_modules/
|
|
39
|
+
"name": "type-fest",
|
|
40
|
+
"version": "5.7.0",
|
|
41
|
+
"license": "(MIT OR CC0-1.0)",
|
|
42
|
+
"path": "node_modules/type-fest",
|
|
43
43
|
"notices": [
|
|
44
44
|
{
|
|
45
|
-
"path": "node_modules/
|
|
45
|
+
"path": "node_modules/type-fest/license-cc0",
|
|
46
|
+
"sha256": "a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"path": "node_modules/type-fest/license-mit",
|
|
46
50
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
47
51
|
}
|
|
48
52
|
]
|
|
49
53
|
},
|
|
50
54
|
{
|
|
51
|
-
"name": "
|
|
52
|
-
"version": "2.
|
|
55
|
+
"name": "mimic-fn",
|
|
56
|
+
"version": "2.1.0",
|
|
53
57
|
"license": "MIT",
|
|
54
|
-
"path": "node_modules/
|
|
58
|
+
"path": "node_modules/mimic-fn",
|
|
55
59
|
"notices": [
|
|
56
60
|
{
|
|
57
|
-
"path": "node_modules/
|
|
61
|
+
"path": "node_modules/mimic-fn/license",
|
|
58
62
|
"sha256": "48da2f39e100d4085767e94966b43f4fa95ff6a0698fba57ed460914e35f94a0"
|
|
59
63
|
}
|
|
60
64
|
]
|
|
61
65
|
},
|
|
62
66
|
{
|
|
63
|
-
"name": "
|
|
64
|
-
"version": "
|
|
67
|
+
"name": "ansi-escapes",
|
|
68
|
+
"version": "7.3.0",
|
|
65
69
|
"license": "MIT",
|
|
66
|
-
"path": "node_modules/
|
|
70
|
+
"path": "node_modules/ansi-escapes",
|
|
67
71
|
"notices": [
|
|
68
72
|
{
|
|
69
|
-
"path": "node_modules/
|
|
70
|
-
"sha256": "
|
|
73
|
+
"path": "node_modules/ansi-escapes/license",
|
|
74
|
+
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
71
75
|
}
|
|
72
76
|
]
|
|
73
77
|
},
|
|
74
78
|
{
|
|
75
|
-
"name": "
|
|
76
|
-
"version": "
|
|
79
|
+
"name": "strip-ansi",
|
|
80
|
+
"version": "7.2.0",
|
|
77
81
|
"license": "MIT",
|
|
78
|
-
"path": "node_modules/
|
|
82
|
+
"path": "node_modules/strip-ansi",
|
|
79
83
|
"notices": [
|
|
80
84
|
{
|
|
81
|
-
"path": "node_modules/
|
|
85
|
+
"path": "node_modules/strip-ansi/license",
|
|
82
86
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
83
87
|
}
|
|
84
88
|
]
|
|
85
89
|
},
|
|
86
90
|
{
|
|
87
|
-
"name": "
|
|
88
|
-
"version": "
|
|
91
|
+
"name": "signal-exit",
|
|
92
|
+
"version": "3.0.7",
|
|
93
|
+
"license": "ISC",
|
|
94
|
+
"path": "node_modules/signal-exit",
|
|
95
|
+
"notices": [
|
|
96
|
+
{
|
|
97
|
+
"path": "node_modules/signal-exit/LICENSE.txt",
|
|
98
|
+
"sha256": "e05b1eaf5b5f99b7ad75cd1f38858ff9a311780b97715ead67936d60bf96aa7e"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "yoga-layout",
|
|
104
|
+
"version": "3.2.1",
|
|
89
105
|
"license": "MIT",
|
|
90
|
-
"path": "node_modules/
|
|
106
|
+
"path": "node_modules/yoga-layout",
|
|
91
107
|
"notices": [
|
|
92
108
|
{
|
|
93
|
-
"path": "node_modules/
|
|
94
|
-
"sha256": "
|
|
109
|
+
"path": "node_modules/yoga-layout/LICENSE",
|
|
110
|
+
"sha256": "52412d7bc7ce4157ea628bbaacb8829e0a9cb3c58f57f99176126bc8cf2bfc85"
|
|
95
111
|
}
|
|
96
112
|
]
|
|
97
113
|
},
|
|
98
114
|
{
|
|
99
|
-
"name": "
|
|
100
|
-
"version": "
|
|
115
|
+
"name": "get-east-asian-width",
|
|
116
|
+
"version": "1.6.0",
|
|
101
117
|
"license": "MIT",
|
|
102
|
-
"path": "node_modules/
|
|
118
|
+
"path": "node_modules/get-east-asian-width",
|
|
103
119
|
"notices": [
|
|
104
120
|
{
|
|
105
|
-
"path": "node_modules/
|
|
121
|
+
"path": "node_modules/get-east-asian-width/license",
|
|
106
122
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
107
123
|
}
|
|
108
124
|
]
|
|
109
125
|
},
|
|
110
126
|
{
|
|
111
|
-
"name": "
|
|
112
|
-
"version": "
|
|
127
|
+
"name": "es-toolkit",
|
|
128
|
+
"version": "1.49.0",
|
|
113
129
|
"license": "MIT",
|
|
114
|
-
"path": "node_modules/
|
|
130
|
+
"path": "node_modules/es-toolkit",
|
|
115
131
|
"notices": [
|
|
116
132
|
{
|
|
117
|
-
"path": "node_modules/
|
|
118
|
-
"sha256": "
|
|
133
|
+
"path": "node_modules/es-toolkit/LICENSE",
|
|
134
|
+
"sha256": "51f3674294d988d89dbebd31273baaeb3c697a15482d9699b14d1fded2e132a7"
|
|
119
135
|
}
|
|
120
136
|
]
|
|
121
137
|
},
|
|
122
138
|
{
|
|
123
|
-
"name": "
|
|
124
|
-
"version": "
|
|
139
|
+
"name": "wrap-ansi",
|
|
140
|
+
"version": "10.0.0",
|
|
125
141
|
"license": "MIT",
|
|
126
|
-
"path": "node_modules/
|
|
142
|
+
"path": "node_modules/wrap-ansi",
|
|
127
143
|
"notices": [
|
|
128
144
|
{
|
|
129
|
-
"path": "node_modules/
|
|
130
|
-
"sha256": "
|
|
145
|
+
"path": "node_modules/wrap-ansi/license",
|
|
146
|
+
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
131
147
|
}
|
|
132
148
|
]
|
|
133
149
|
},
|
|
134
150
|
{
|
|
135
|
-
"name": "
|
|
136
|
-
"version": "
|
|
151
|
+
"name": "chalk",
|
|
152
|
+
"version": "5.6.2",
|
|
137
153
|
"license": "MIT",
|
|
138
|
-
"path": "node_modules/
|
|
154
|
+
"path": "node_modules/chalk",
|
|
139
155
|
"notices": [
|
|
140
156
|
{
|
|
141
|
-
"path": "node_modules/
|
|
142
|
-
"sha256": "
|
|
157
|
+
"path": "node_modules/chalk/license",
|
|
158
|
+
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
143
159
|
}
|
|
144
160
|
]
|
|
145
161
|
},
|
|
146
162
|
{
|
|
147
|
-
"name": "
|
|
148
|
-
"version": "
|
|
163
|
+
"name": "terminal-size",
|
|
164
|
+
"version": "4.0.1",
|
|
149
165
|
"license": "MIT",
|
|
150
|
-
"path": "node_modules/
|
|
166
|
+
"path": "node_modules/terminal-size",
|
|
151
167
|
"notices": [
|
|
152
168
|
{
|
|
153
|
-
"path": "node_modules/
|
|
169
|
+
"path": "node_modules/terminal-size/license",
|
|
154
170
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
155
171
|
}
|
|
156
172
|
]
|
|
157
173
|
},
|
|
158
174
|
{
|
|
159
|
-
"name": "
|
|
160
|
-
"version": "
|
|
175
|
+
"name": "cli-spinners",
|
|
176
|
+
"version": "2.9.2",
|
|
161
177
|
"license": "MIT",
|
|
162
|
-
"path": "node_modules/
|
|
178
|
+
"path": "node_modules/cli-spinners",
|
|
163
179
|
"notices": [
|
|
164
180
|
{
|
|
165
|
-
"path": "node_modules/
|
|
181
|
+
"path": "node_modules/cli-spinners/license",
|
|
166
182
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
167
183
|
}
|
|
168
184
|
]
|
|
169
185
|
},
|
|
170
186
|
{
|
|
171
|
-
"name": "
|
|
172
|
-
"version": "
|
|
187
|
+
"name": "cli-boxes",
|
|
188
|
+
"version": "4.0.1",
|
|
173
189
|
"license": "MIT",
|
|
174
|
-
"path": "node_modules/
|
|
190
|
+
"path": "node_modules/cli-boxes",
|
|
175
191
|
"notices": [
|
|
176
192
|
{
|
|
177
|
-
"path": "node_modules/
|
|
178
|
-
"sha256": "
|
|
193
|
+
"path": "node_modules/cli-boxes/license",
|
|
194
|
+
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
179
195
|
}
|
|
180
196
|
]
|
|
181
197
|
},
|
|
182
198
|
{
|
|
183
|
-
"name": "
|
|
184
|
-
"version": "
|
|
199
|
+
"name": "code-excerpt",
|
|
200
|
+
"version": "4.0.0",
|
|
185
201
|
"license": "MIT",
|
|
186
|
-
"path": "node_modules/
|
|
202
|
+
"path": "node_modules/code-excerpt",
|
|
187
203
|
"notices": [
|
|
188
204
|
{
|
|
189
|
-
"path": "node_modules/
|
|
205
|
+
"path": "node_modules/code-excerpt/license",
|
|
206
|
+
"sha256": "b53ca5a0db1b07785cbd9627341b6bd731ef6104bc3b74d44c15c5e7a8990f20"
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "slice-ansi",
|
|
212
|
+
"version": "9.0.0",
|
|
213
|
+
"license": "MIT",
|
|
214
|
+
"path": "node_modules/slice-ansi",
|
|
215
|
+
"notices": [
|
|
216
|
+
{
|
|
217
|
+
"path": "node_modules/slice-ansi/license",
|
|
218
|
+
"sha256": "c91d87c3bca16ab6d96d82da08edc54377d14b679547a331eecc4adef3c353c8"
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "cli-cursor",
|
|
224
|
+
"version": "4.0.0",
|
|
225
|
+
"license": "MIT",
|
|
226
|
+
"path": "node_modules/cli-cursor",
|
|
227
|
+
"notices": [
|
|
228
|
+
{
|
|
229
|
+
"path": "node_modules/cli-cursor/license",
|
|
190
230
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
191
231
|
}
|
|
192
232
|
]
|
|
@@ -204,113 +244,109 @@
|
|
|
204
244
|
]
|
|
205
245
|
},
|
|
206
246
|
{
|
|
207
|
-
"name": "
|
|
208
|
-
"version": "
|
|
247
|
+
"name": "ansi-regex",
|
|
248
|
+
"version": "6.2.2",
|
|
209
249
|
"license": "MIT",
|
|
210
|
-
"path": "node_modules/
|
|
250
|
+
"path": "node_modules/ansi-regex",
|
|
211
251
|
"notices": [
|
|
212
252
|
{
|
|
213
|
-
"path": "node_modules/
|
|
253
|
+
"path": "node_modules/ansi-regex/license",
|
|
214
254
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
215
255
|
}
|
|
216
256
|
]
|
|
217
257
|
},
|
|
218
258
|
{
|
|
219
|
-
"name": "
|
|
220
|
-
"version": "
|
|
259
|
+
"name": "escape-string-regexp",
|
|
260
|
+
"version": "2.0.0",
|
|
221
261
|
"license": "MIT",
|
|
222
|
-
"path": "node_modules/
|
|
262
|
+
"path": "node_modules/escape-string-regexp",
|
|
223
263
|
"notices": [
|
|
224
264
|
{
|
|
225
|
-
"path": "node_modules/
|
|
226
|
-
"sha256": "
|
|
265
|
+
"path": "node_modules/escape-string-regexp/license",
|
|
266
|
+
"sha256": "48da2f39e100d4085767e94966b43f4fa95ff6a0698fba57ed460914e35f94a0"
|
|
227
267
|
}
|
|
228
268
|
]
|
|
229
269
|
},
|
|
230
270
|
{
|
|
231
|
-
"name": "
|
|
232
|
-
"version": "
|
|
271
|
+
"name": "is-fullwidth-code-point",
|
|
272
|
+
"version": "5.1.0",
|
|
233
273
|
"license": "MIT",
|
|
234
|
-
"path": "node_modules/
|
|
274
|
+
"path": "node_modules/is-fullwidth-code-point",
|
|
235
275
|
"notices": [
|
|
236
276
|
{
|
|
237
|
-
"path": "node_modules/
|
|
238
|
-
"sha256": "
|
|
277
|
+
"path": "node_modules/is-fullwidth-code-point/license",
|
|
278
|
+
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
239
279
|
}
|
|
240
280
|
]
|
|
241
281
|
},
|
|
242
282
|
{
|
|
243
|
-
"name": "
|
|
244
|
-
"version": "
|
|
283
|
+
"name": "patch-console",
|
|
284
|
+
"version": "2.0.0",
|
|
245
285
|
"license": "MIT",
|
|
246
|
-
"path": "node_modules/
|
|
286
|
+
"path": "node_modules/patch-console",
|
|
247
287
|
"notices": [
|
|
248
288
|
{
|
|
249
|
-
"path": "node_modules/
|
|
250
|
-
"sha256": "
|
|
289
|
+
"path": "node_modules/patch-console/license",
|
|
290
|
+
"sha256": "67726f6c8adeaf7d7e1a3af90fc88c76f7b9747552e5187a8ba62bf781297b49"
|
|
251
291
|
}
|
|
252
292
|
]
|
|
253
293
|
},
|
|
254
294
|
{
|
|
255
|
-
"name": "
|
|
256
|
-
"version": "
|
|
295
|
+
"name": "onetime",
|
|
296
|
+
"version": "5.1.2",
|
|
257
297
|
"license": "MIT",
|
|
258
|
-
"path": "node_modules/
|
|
298
|
+
"path": "node_modules/onetime",
|
|
259
299
|
"notices": [
|
|
260
300
|
{
|
|
261
|
-
"path": "node_modules/
|
|
301
|
+
"path": "node_modules/onetime/license",
|
|
262
302
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
263
303
|
}
|
|
264
304
|
]
|
|
265
305
|
},
|
|
266
306
|
{
|
|
267
|
-
"name": "
|
|
268
|
-
"version": "
|
|
269
|
-
"license": "
|
|
270
|
-
"path": "node_modules/
|
|
307
|
+
"name": "widest-line",
|
|
308
|
+
"version": "6.0.0",
|
|
309
|
+
"license": "MIT",
|
|
310
|
+
"path": "node_modules/widest-line",
|
|
271
311
|
"notices": [
|
|
272
312
|
{
|
|
273
|
-
"path": "node_modules/
|
|
274
|
-
"sha256": "a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499"
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
"path": "node_modules/type-fest/license-mit",
|
|
313
|
+
"path": "node_modules/widest-line/license",
|
|
278
314
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
279
315
|
}
|
|
280
316
|
]
|
|
281
317
|
},
|
|
282
318
|
{
|
|
283
|
-
"name": "
|
|
284
|
-
"version": "1.
|
|
319
|
+
"name": "ink",
|
|
320
|
+
"version": "7.1.1",
|
|
285
321
|
"license": "MIT",
|
|
286
|
-
"path": "node_modules/
|
|
322
|
+
"path": "node_modules/ink",
|
|
287
323
|
"notices": [
|
|
288
324
|
{
|
|
289
|
-
"path": "node_modules/
|
|
290
|
-
"sha256": "
|
|
325
|
+
"path": "node_modules/ink/license",
|
|
326
|
+
"sha256": "de84e62e27d9a970b50446d0af1f713c1439a4180faa098adfa5da94f5158a55"
|
|
291
327
|
}
|
|
292
328
|
]
|
|
293
329
|
},
|
|
294
330
|
{
|
|
295
|
-
"name": "
|
|
296
|
-
"version": "
|
|
297
|
-
"license": "
|
|
298
|
-
"path": "node_modules/
|
|
331
|
+
"name": "string-width",
|
|
332
|
+
"version": "8.2.1",
|
|
333
|
+
"license": "MIT",
|
|
334
|
+
"path": "node_modules/string-width",
|
|
299
335
|
"notices": [
|
|
300
336
|
{
|
|
301
|
-
"path": "node_modules/
|
|
302
|
-
"sha256": "
|
|
337
|
+
"path": "node_modules/string-width/license",
|
|
338
|
+
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
303
339
|
}
|
|
304
340
|
]
|
|
305
341
|
},
|
|
306
342
|
{
|
|
307
|
-
"name": "
|
|
308
|
-
"version": "
|
|
343
|
+
"name": "scheduler",
|
|
344
|
+
"version": "0.27.0",
|
|
309
345
|
"license": "MIT",
|
|
310
|
-
"path": "node_modules/
|
|
346
|
+
"path": "node_modules/scheduler",
|
|
311
347
|
"notices": [
|
|
312
348
|
{
|
|
313
|
-
"path": "node_modules/
|
|
349
|
+
"path": "node_modules/scheduler/LICENSE",
|
|
314
350
|
"sha256": "da6d3703ed11cbe42bd212c725957c98da23cbff1998c05fa4b3d976d1a58e93"
|
|
315
351
|
}
|
|
316
352
|
]
|
|
@@ -344,38 +380,26 @@
|
|
|
344
380
|
]
|
|
345
381
|
},
|
|
346
382
|
{
|
|
347
|
-
"name": "
|
|
348
|
-
"version": "0.
|
|
349
|
-
"license": "MIT",
|
|
350
|
-
"path": "node_modules/scheduler",
|
|
351
|
-
"notices": [
|
|
352
|
-
{
|
|
353
|
-
"path": "node_modules/scheduler/LICENSE",
|
|
354
|
-
"sha256": "da6d3703ed11cbe42bd212c725957c98da23cbff1998c05fa4b3d976d1a58e93"
|
|
355
|
-
}
|
|
356
|
-
]
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
"name": "auto-bind",
|
|
360
|
-
"version": "5.0.1",
|
|
383
|
+
"name": "tagged-tag",
|
|
384
|
+
"version": "1.0.0",
|
|
361
385
|
"license": "MIT",
|
|
362
|
-
"path": "node_modules/
|
|
386
|
+
"path": "node_modules/tagged-tag",
|
|
363
387
|
"notices": [
|
|
364
388
|
{
|
|
365
|
-
"path": "node_modules/
|
|
389
|
+
"path": "node_modules/tagged-tag/license",
|
|
366
390
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
367
391
|
}
|
|
368
392
|
]
|
|
369
393
|
},
|
|
370
394
|
{
|
|
371
|
-
"name": "
|
|
372
|
-
"version": "2.
|
|
395
|
+
"name": "stack-utils",
|
|
396
|
+
"version": "2.0.6",
|
|
373
397
|
"license": "MIT",
|
|
374
|
-
"path": "node_modules/
|
|
398
|
+
"path": "node_modules/stack-utils",
|
|
375
399
|
"notices": [
|
|
376
400
|
{
|
|
377
|
-
"path": "node_modules/
|
|
378
|
-
"sha256": "
|
|
401
|
+
"path": "node_modules/stack-utils/LICENSE.md",
|
|
402
|
+
"sha256": "9be2ec8089dfa4059a78e4e3e0443c416b2d63dedffb246c7473d0f3d763c6c4"
|
|
379
403
|
}
|
|
380
404
|
]
|
|
381
405
|
},
|
|
@@ -392,122 +416,98 @@
|
|
|
392
416
|
]
|
|
393
417
|
},
|
|
394
418
|
{
|
|
395
|
-
"name": "
|
|
396
|
-
"version": "
|
|
397
|
-
"license": "MIT",
|
|
398
|
-
"path": "node_modules/yoga-layout",
|
|
399
|
-
"notices": [
|
|
400
|
-
{
|
|
401
|
-
"path": "node_modules/yoga-layout/LICENSE",
|
|
402
|
-
"sha256": "52412d7bc7ce4157ea628bbaacb8829e0a9cb3c58f57f99176126bc8cf2bfc85"
|
|
403
|
-
}
|
|
404
|
-
]
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
"name": "slice-ansi",
|
|
408
|
-
"version": "9.0.0",
|
|
409
|
-
"license": "MIT",
|
|
410
|
-
"path": "node_modules/slice-ansi",
|
|
411
|
-
"notices": [
|
|
412
|
-
{
|
|
413
|
-
"path": "node_modules/slice-ansi/license",
|
|
414
|
-
"sha256": "c91d87c3bca16ab6d96d82da08edc54377d14b679547a331eecc4adef3c353c8"
|
|
415
|
-
}
|
|
416
|
-
]
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
"name": "ansi-regex",
|
|
420
|
-
"version": "6.2.2",
|
|
419
|
+
"name": "restore-cursor",
|
|
420
|
+
"version": "4.0.0",
|
|
421
421
|
"license": "MIT",
|
|
422
|
-
"path": "node_modules/
|
|
422
|
+
"path": "node_modules/restore-cursor",
|
|
423
423
|
"notices": [
|
|
424
424
|
{
|
|
425
|
-
"path": "node_modules/
|
|
425
|
+
"path": "node_modules/restore-cursor/license",
|
|
426
426
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
427
427
|
}
|
|
428
428
|
]
|
|
429
429
|
},
|
|
430
430
|
{
|
|
431
|
-
"name": "
|
|
432
|
-
"version": "
|
|
431
|
+
"name": "ws",
|
|
432
|
+
"version": "8.21.0",
|
|
433
433
|
"license": "MIT",
|
|
434
|
-
"path": "node_modules/
|
|
434
|
+
"path": "node_modules/ws",
|
|
435
435
|
"notices": [
|
|
436
436
|
{
|
|
437
|
-
"path": "node_modules/
|
|
438
|
-
"sha256": "
|
|
437
|
+
"path": "node_modules/ws/LICENSE",
|
|
438
|
+
"sha256": "2b29dcfe0d6471f7e8c92c5fb38c9f93edee10330937055440192f1832b1ecef"
|
|
439
439
|
}
|
|
440
440
|
]
|
|
441
441
|
},
|
|
442
442
|
{
|
|
443
|
-
"name": "
|
|
444
|
-
"version": "
|
|
443
|
+
"name": "is-in-ci",
|
|
444
|
+
"version": "2.0.0",
|
|
445
445
|
"license": "MIT",
|
|
446
|
-
"path": "node_modules/
|
|
446
|
+
"path": "node_modules/is-in-ci",
|
|
447
447
|
"notices": [
|
|
448
448
|
{
|
|
449
|
-
"path": "node_modules/
|
|
449
|
+
"path": "node_modules/is-in-ci/license",
|
|
450
450
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
451
451
|
}
|
|
452
452
|
]
|
|
453
453
|
},
|
|
454
454
|
{
|
|
455
|
-
"name": "
|
|
456
|
-
"version": "
|
|
455
|
+
"name": "environment",
|
|
456
|
+
"version": "1.1.0",
|
|
457
457
|
"license": "MIT",
|
|
458
|
-
"path": "node_modules/
|
|
458
|
+
"path": "node_modules/environment",
|
|
459
459
|
"notices": [
|
|
460
460
|
{
|
|
461
|
-
"path": "node_modules/
|
|
461
|
+
"path": "node_modules/environment/license",
|
|
462
462
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
463
463
|
}
|
|
464
464
|
]
|
|
465
465
|
},
|
|
466
466
|
{
|
|
467
|
-
"name": "
|
|
468
|
-
"version": "
|
|
467
|
+
"name": "ink-spinner",
|
|
468
|
+
"version": "5.0.0",
|
|
469
469
|
"license": "MIT",
|
|
470
|
-
"path": "node_modules/
|
|
470
|
+
"path": "node_modules/ink-spinner",
|
|
471
471
|
"notices": [
|
|
472
472
|
{
|
|
473
|
-
"path": "node_modules/
|
|
474
|
-
"sha256": "
|
|
473
|
+
"path": "node_modules/ink-spinner/license",
|
|
474
|
+
"sha256": "198d506def2360aa9781fad04cc15125a096f4983a44479b366e657c9b1d3138"
|
|
475
475
|
}
|
|
476
476
|
]
|
|
477
477
|
},
|
|
478
478
|
{
|
|
479
|
-
"name": "
|
|
480
|
-
"version": "
|
|
479
|
+
"name": "cli-truncate",
|
|
480
|
+
"version": "6.1.0",
|
|
481
481
|
"license": "MIT",
|
|
482
|
-
"path": "node_modules/
|
|
482
|
+
"path": "node_modules/cli-truncate",
|
|
483
483
|
"notices": [
|
|
484
484
|
{
|
|
485
|
-
"path": "node_modules/
|
|
485
|
+
"path": "node_modules/cli-truncate/license",
|
|
486
486
|
"sha256": "5c932d88256b4ab958f64a856fa48e8bd1f55bc1d96b8149c65689e0c61789d3"
|
|
487
487
|
}
|
|
488
488
|
]
|
|
489
489
|
},
|
|
490
490
|
{
|
|
491
|
-
"name": "
|
|
492
|
-
"version": "
|
|
491
|
+
"name": "convert-to-spaces",
|
|
492
|
+
"version": "2.0.1",
|
|
493
493
|
"license": "MIT",
|
|
494
|
-
"path": "node_modules/
|
|
494
|
+
"path": "node_modules/convert-to-spaces",
|
|
495
495
|
"notices": [
|
|
496
496
|
{
|
|
497
|
-
"path": "node_modules/
|
|
498
|
-
"sha256": "
|
|
497
|
+
"path": "node_modules/convert-to-spaces/license",
|
|
498
|
+
"sha256": "49810fde850fee8647c52ae2d5debb9272c3b26634b9f6a800242b8aa823bad2"
|
|
499
499
|
}
|
|
500
500
|
]
|
|
501
501
|
},
|
|
502
502
|
{
|
|
503
|
-
"name": "
|
|
504
|
-
"version": "
|
|
503
|
+
"name": "react",
|
|
504
|
+
"version": "19.3.0",
|
|
505
505
|
"license": "MIT",
|
|
506
|
-
"path": "node_modules/
|
|
506
|
+
"path": "node_modules/react",
|
|
507
507
|
"notices": [
|
|
508
508
|
{
|
|
509
|
-
"path": "node_modules/
|
|
510
|
-
"sha256": "
|
|
509
|
+
"path": "node_modules/react/LICENSE",
|
|
510
|
+
"sha256": "da6d3703ed11cbe42bd212c725957c98da23cbff1998c05fa4b3d976d1a58e93"
|
|
511
511
|
}
|
|
512
512
|
]
|
|
513
513
|
}
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -551,6 +551,7 @@ export function App() {
|
|
|
551
551
|
abortRef,
|
|
552
552
|
status: runnerStatus,
|
|
553
553
|
providerRequest,
|
|
554
|
+
remoteContext,
|
|
554
555
|
outputThroughput,
|
|
555
556
|
setStatus,
|
|
556
557
|
step,
|
|
@@ -1006,7 +1007,8 @@ export function App() {
|
|
|
1006
1007
|
const persistedMatchesActiveModel = !!persisted && (
|
|
1007
1008
|
!persisted.cacheScope || samePromptCacheScope(persisted.cacheScope, activeCacheScope)
|
|
1008
1009
|
)
|
|
1009
|
-
|
|
1010
|
+
// Native agents resume with a fresh window; their saved usage sums every request in a turn.
|
|
1011
|
+
if (persisted && persistedMatchesActiveModel && !conversationAgentId(config)) {
|
|
1010
1012
|
const restoredUsage = resolveRestoredUsageContext(
|
|
1011
1013
|
persisted,
|
|
1012
1014
|
conversation.estimatedTokens,
|
|
@@ -1111,7 +1113,7 @@ export function App() {
|
|
|
1111
1113
|
<ToastContainer toasts={toasts} />
|
|
1112
1114
|
<UpdateNotice state={updateCheck} />
|
|
1113
1115
|
|
|
1114
|
-
<TokenWarning contextBudget={contextBudget} />
|
|
1116
|
+
{!agentId && <TokenWarning contextBudget={contextBudget} />}
|
|
1115
1117
|
|
|
1116
1118
|
{dialog !== "queue" && <QueuePanel entries={inputQueue} mode={config.followUpMode ?? "queue"} active={isAgentRunning} foregroundId={turnActivity.foregroundId} />}
|
|
1117
1119
|
{editingMessageId && <Text color={c.accent}>Editing queued message · Enter saves · Esc cancels · original draft is kept</Text>}
|
|
@@ -1348,7 +1350,7 @@ export function App() {
|
|
|
1348
1350
|
step={step}
|
|
1349
1351
|
maxSteps={config.maxSteps}
|
|
1350
1352
|
contextBudget={contextBudget}
|
|
1351
|
-
|
|
1353
|
+
remoteContext={agentId ? remoteContext ?? null : undefined}
|
|
1352
1354
|
hasApiKey={hasKey}
|
|
1353
1355
|
showWelcome={logs.length === 0 && !isRunning && !isStreaming}
|
|
1354
1356
|
shellMode={isShellMode()}
|
|
@@ -3,6 +3,8 @@ import type { ProviderRequestEvent } from "../../zapsdk/core/llm.js"
|
|
|
3
3
|
export interface OutputThroughputSample {
|
|
4
4
|
tokensPerSecond: number
|
|
5
5
|
estimated: boolean
|
|
6
|
+
/** Output tokens over the full prompt turn, including tools and first-token latency. */
|
|
7
|
+
turnAverage?: boolean
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
/** Latest root request's decode throughput, excluding TTFT and tool time.
|
|
@@ -51,3 +53,28 @@ export class OutputThroughput {
|
|
|
51
53
|
return { tokensPerSecond, estimated }
|
|
52
54
|
}
|
|
53
55
|
}
|
|
56
|
+
|
|
57
|
+
/** ACP exposes message chunks and turn totals, but no per-request decode clock. */
|
|
58
|
+
export class AgentOutputThroughput {
|
|
59
|
+
private segment?: { id: string; firstAt: number; charsAfterFirst: number }
|
|
60
|
+
private latest?: OutputThroughputSample
|
|
61
|
+
|
|
62
|
+
chunk(id: string, text: string, now: number): OutputThroughputSample | undefined {
|
|
63
|
+
if (!text) return
|
|
64
|
+
if (this.segment?.id !== id) {
|
|
65
|
+
this.segment = { id, firstAt: now, charsAfterFirst: 0 }
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
this.segment.charsAfterFirst += text.length
|
|
69
|
+
const elapsed = now - this.segment.firstAt
|
|
70
|
+
if (elapsed < 250) return
|
|
71
|
+
this.latest = { tokensPerSecond: this.segment.charsAfterFirst * 250 / elapsed, estimated: true }
|
|
72
|
+
return this.latest
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
finish(outputTokens: number | undefined, elapsedMs: number): OutputThroughputSample | undefined {
|
|
76
|
+
if (this.latest) return this.latest
|
|
77
|
+
if (!outputTokens || outputTokens <= 0 || !Number.isFinite(outputTokens) || elapsedMs <= 0) return
|
|
78
|
+
return { tokensPerSecond: outputTokens * 1000 / elapsedMs, estimated: false, turnAverage: true }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -52,6 +52,7 @@ export class RemoteAgentManager {
|
|
|
52
52
|
async prompt(spec: AcpAgentSpec, cwd: string, text: string, images: ImageContent[] | undefined, options: {
|
|
53
53
|
signal: AbortSignal
|
|
54
54
|
onEvent: (event: AgentEvent) => void
|
|
55
|
+
onContextUsage?: (usage: { used: number; size: number }) => void
|
|
55
56
|
onStarted?: (session: AcpAgentSession) => void
|
|
56
57
|
/** Called once the agent is ready and the prompt is about to be sent. */
|
|
57
58
|
onAccepted?: () => void
|
|
@@ -68,7 +69,7 @@ export class RemoteAgentManager {
|
|
|
68
69
|
options.onAccepted?.()
|
|
69
70
|
this.turnSignal = options.signal
|
|
70
71
|
try {
|
|
71
|
-
const result = await live.session.prompt(content, { signal: options.signal, onEvent: options.onEvent })
|
|
72
|
+
const result = await live.session.prompt(content, { signal: options.signal, onEvent: options.onEvent, onContextUsage: options.onContextUsage })
|
|
72
73
|
return { ...result, session: live.session }
|
|
73
74
|
} catch (error) {
|
|
74
75
|
// A cooperative cancel resolves with stopReason "cancelled"; a throw
|
package/src/agent/remote-turn.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PlanEntry } from "@agentclientprotocol/sdk"
|
|
2
|
-
import { AgentEventEmitter } from "../../zapsdk/agent/events.js"
|
|
2
|
+
import { AgentEventEmitter, type AgentEvent } from "../../zapsdk/agent/events.js"
|
|
3
3
|
import type { LoopAgentResult } from "../../zapsdk/agent/loop.js"
|
|
4
4
|
import type { ImageContent } from "../../zapsdk/core/types.js"
|
|
5
5
|
import type { ConversationManager } from "../../zapsdk/memory/conversation.js"
|
|
@@ -7,10 +7,12 @@ import type { AcpAgentSpec } from "../../zapsdk/acp-client/types.js"
|
|
|
7
7
|
import type { StreamingPreview } from "./streamingPreview.js"
|
|
8
8
|
import { createRunHandlers, type RunHandlersDeps } from "./wireRunHandlers.js"
|
|
9
9
|
import { promptClaudeCode } from "./claude-code.js"
|
|
10
|
+
import { AgentOutputThroughput } from "./outputThroughput.js"
|
|
10
11
|
import { remoteAgents } from "./remote-agent.js"
|
|
11
12
|
|
|
12
13
|
export interface RemoteTurnDeps extends Omit<RunHandlersDeps, "preview" | "setContextTokens" | "setContextPending" | "currentConfig"> {
|
|
13
14
|
currentConfig: RunHandlersDeps["currentConfig"]
|
|
15
|
+
setRemoteContext: (usage: { used: number; size: number } | undefined) => void
|
|
14
16
|
nativeClaude?: boolean
|
|
15
17
|
spec: AcpAgentSpec
|
|
16
18
|
cwd: string
|
|
@@ -32,7 +34,7 @@ const claudeSessions = new WeakMap<ConversationManager, { tip: unknown; sessionI
|
|
|
32
34
|
* keeps the context. Throws after reporting when the turn fails. */
|
|
33
35
|
export async function runRemoteTurn(deps: RemoteTurnDeps, task: string, images?: ImageContent[]): Promise<LoopAgentResult> {
|
|
34
36
|
const preview = deps.createPreview()
|
|
35
|
-
const handlers = createRunHandlers({ ...deps, preview, setContextTokens() {}, setContextPending() {} })
|
|
37
|
+
const handlers = createRunHandlers({ ...deps, externalContext: true, preview, setContextTokens() {}, setContextPending() {} })
|
|
36
38
|
const emitter = new AgentEventEmitter()
|
|
37
39
|
handlers.wire(emitter)
|
|
38
40
|
const { spec, controller } = deps
|
|
@@ -42,23 +44,42 @@ export async function runRemoteTurn(deps: RemoteTurnDeps, task: string, images?:
|
|
|
42
44
|
const previous = claudeSessions.get(deps.conversation)
|
|
43
45
|
claudeSessions.delete(deps.conversation)
|
|
44
46
|
const epoch = remoteAgents.epoch
|
|
47
|
+
const throughput = new AgentOutputThroughput()
|
|
48
|
+
const onEvent = (event: AgentEvent) => {
|
|
49
|
+
emitter.emit(event)
|
|
50
|
+
if (event.type === "content_delta" && !event.path?.length && !controller.signal.aborted && (event.kind === "thinking" || event.kind === "text")) {
|
|
51
|
+
const sample = throughput.chunk(event.id, event.text, performance.now())
|
|
52
|
+
if (sample) deps.setOutputThroughput?.(sample)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
let acceptedAt: number | undefined
|
|
56
|
+
const onAccepted = () => {
|
|
57
|
+
acceptedAt = performance.now()
|
|
58
|
+
deps.onInputAccepted?.()
|
|
59
|
+
}
|
|
45
60
|
const turn = deps.nativeClaude ? await promptClaudeCode({
|
|
46
61
|
command: spec.command, args: spec.args, cwd: deps.cwd, text: task, images, signal: controller.signal,
|
|
47
62
|
plan: deps.currentConfig.permissionMode === "plan", approve: remoteAgents.host.approve,
|
|
48
63
|
resume: previous?.cwd === deps.cwd && previous.epoch === epoch && previous.tip === deps.conversation.getTurns().at(-1) ? previous.sessionId : undefined,
|
|
49
|
-
onEvent
|
|
64
|
+
onEvent, onAccepted,
|
|
50
65
|
}) : await remoteAgents.prompt(spec, deps.cwd, task, images, {
|
|
51
66
|
signal: controller.signal,
|
|
52
|
-
onEvent
|
|
53
|
-
onAccepted
|
|
67
|
+
onEvent,
|
|
68
|
+
onAccepted,
|
|
69
|
+
onContextUsage: usage => { if (!controller.signal.aborted) deps.setRemoteContext(usage) },
|
|
54
70
|
onStarted: session => {
|
|
71
|
+
deps.setRemoteContext(undefined)
|
|
55
72
|
deps.addLog("system", `Connected to ${session.agentName} (${spec.id}) over ACP${session.warnings.length ? ` · ${session.warnings.join("; ")}` : ""}`)
|
|
56
73
|
},
|
|
57
74
|
})
|
|
75
|
+
const elapsedMs = acceptedAt === undefined ? 0 : performance.now() - acceptedAt
|
|
58
76
|
deps.conversation.add({ role: "user", content: task })
|
|
59
77
|
deps.conversation.add({ role: "assistant", content: `[${spec.id}] ${turn.report || "(no message)"}` })
|
|
60
78
|
if ("sessionId" in turn) claudeSessions.set(deps.conversation, { tip: deps.conversation.getTurns().at(-1), epoch, cwd: deps.cwd, sessionId: turn.sessionId })
|
|
61
79
|
if (turn.usage) emitter.emit({ type: "run_usage", step: turn.toolCalls, ...turn.usage })
|
|
80
|
+
if (!controller.signal.aborted) {
|
|
81
|
+
deps.setOutputThroughput?.(throughput.finish(turn.usage?.providerUsageReported === false ? undefined : turn.usage?.outputTokens, elapsedMs))
|
|
82
|
+
}
|
|
62
83
|
if (turn.plan.length) deps.addLog("system", formatPlan(spec.id, turn.plan))
|
|
63
84
|
if (turn.stopReason !== "end_turn" && turn.stopReason !== "cancelled") deps.addLog("system", `${spec.id} stopped: ${turn.stopReason}`)
|
|
64
85
|
if (turn.report) deps.saveLastOutput(turn.report)
|
|
@@ -47,6 +47,8 @@ type ReplaceLog = (
|
|
|
47
47
|
) => void
|
|
48
48
|
|
|
49
49
|
export interface RunHandlersDeps {
|
|
50
|
+
/** External agents own their context and report aggregate, multi-request turn usage. */
|
|
51
|
+
externalContext?: boolean
|
|
50
52
|
/** Live snapshot of the app config — read once at handler-creation time
|
|
51
53
|
* for warning thresholds. Doesn't need to be reactive: a handler set up
|
|
52
54
|
* for run N reads the config that was active when run N started. */
|
|
@@ -459,7 +461,7 @@ export function createRunHandlers(deps: RunHandlersDeps): RunHandlers {
|
|
|
459
461
|
// against the context window, even though cache reads are billed
|
|
460
462
|
// cheaper. Without this sum the Footer / TokenWarning silently
|
|
461
463
|
// under-report usage by an order of magnitude in long sessions.
|
|
462
|
-
const used = contextTokensFromRunUsage(e)
|
|
464
|
+
const used = deps.externalContext ? null : contextTokensFromRunUsage(e)
|
|
463
465
|
if (used !== null) deps.setContextTokens(used, "provider")
|
|
464
466
|
deps.setContextPending(false)
|
|
465
467
|
deps.onRunUsage?.({
|
|
@@ -495,7 +497,7 @@ export function createRunHandlers(deps: RunHandlersDeps): RunHandlers {
|
|
|
495
497
|
}, {
|
|
496
498
|
getLocalEstimate: () => localAtTime,
|
|
497
499
|
appendUsage: deps.appendUsage ?? appendUsage,
|
|
498
|
-
setPromptOverhead: (overhead) => { tokenAccounting.promptOverhead = overhead },
|
|
500
|
+
setPromptOverhead: deps.externalContext ? undefined : (overhead) => { tokenAccounting.promptOverhead = overhead },
|
|
499
501
|
})
|
|
500
502
|
deps.onUsagePersistenceFailure?.(undefined)
|
|
501
503
|
} catch (err) {
|
|
@@ -367,6 +367,7 @@ export function useAgentRunner({
|
|
|
367
367
|
const { view: goalStatus, select: selectGoalView, update: updateGoalView, clear: resetGoalView } = useGoalView(currentSessionId, cwd, goalRunning, undefined, appLogger)
|
|
368
368
|
const [goalTodoId, setGoalTodoId] = useState<string>()
|
|
369
369
|
useEffect(() => { setGoalTodoId(undefined) }, [currentSessionId])
|
|
370
|
+
const [remoteContext, setRemoteContext] = useState<{ used: number; size: number }>()
|
|
370
371
|
const [outputThroughput, setOutputThroughput] = useState<OutputThroughputSample>()
|
|
371
372
|
const [providerRequest, setProviderRequest] = useState<ProviderRequestEvent>()
|
|
372
373
|
const [step, setStep] = useState(0)
|
|
@@ -409,6 +410,11 @@ export function useAgentRunner({
|
|
|
409
410
|
)
|
|
410
411
|
const imageTokenContext = resolveModelImageTokenContext(getActiveProvider(config), config.active.model)
|
|
411
412
|
const imageTokenScope = `${config.active.providerId}\0${config.active.model}\0${JSON.stringify(imageTokenContext)}`
|
|
413
|
+
const remoteAgentId = conversationAgentId(config)
|
|
414
|
+
useEffect(() => {
|
|
415
|
+
setRemoteContext(undefined)
|
|
416
|
+
setOutputThroughput(undefined)
|
|
417
|
+
}, [remoteAgentId, currentSessionId, imageTokenScope, config.permissionMode])
|
|
412
418
|
const contextScopeRef = useRef(imageTokenScope)
|
|
413
419
|
useEffect(() => {
|
|
414
420
|
const nextScope = imageTokenScope
|
|
@@ -502,6 +508,7 @@ export function useAgentRunner({
|
|
|
502
508
|
) => {
|
|
503
509
|
const next = buildResetRunDiagnosticsState(usage, context, restoredUsageHistory, restoredContextHistory, promptCache)
|
|
504
510
|
setOutputThroughput(undefined)
|
|
511
|
+
setRemoteContext(undefined)
|
|
505
512
|
setTokens(next.tokens)
|
|
506
513
|
setUsageHistory(next.usageHistory)
|
|
507
514
|
setContextDiagnostics(next.contextDiagnostics)
|
|
@@ -608,7 +615,7 @@ export function useAgentRunner({
|
|
|
608
615
|
if (invocation?.goalTurn) throw new Error("/goal runs on zap's own model; /agent zap switches back")
|
|
609
616
|
if (systemPrompt) throw new Error("This command runs on zap's own model; /agent zap switches back")
|
|
610
617
|
completedResult = await runRemoteTurn({
|
|
611
|
-
spec: remoteSpec, nativeClaude, cwd, conversation, currentConfig: config, controller,
|
|
618
|
+
spec: remoteSpec, nativeClaude, setRemoteContext, cwd, conversation, currentConfig: config, controller,
|
|
612
619
|
createPreview: () => {
|
|
613
620
|
const next = createStreamingPreview({ addLog, setStreamingText, setIsStreaming, setThinkingText, setIsThinking, getIsFrozen: getIsFrozen ?? (() => false) })
|
|
614
621
|
registerStaticFlushCallback?.(() => next.onStaticFlushed())
|
|
@@ -1124,6 +1131,7 @@ export function useAgentRunner({
|
|
|
1124
1131
|
abortRef,
|
|
1125
1132
|
status,
|
|
1126
1133
|
providerRequest,
|
|
1134
|
+
remoteContext,
|
|
1127
1135
|
outputThroughput,
|
|
1128
1136
|
setStatus,
|
|
1129
1137
|
step,
|
package/src/ui/dialog-model.tsx
CHANGED
|
@@ -10,12 +10,43 @@ import { TextField } from "./text-field.js"
|
|
|
10
10
|
import { commandInput, isReturnInput } from "./controlled-input.js"
|
|
11
11
|
import { c } from "./theme.js"
|
|
12
12
|
import { useTermWidth } from "./term-width.js"
|
|
13
|
-
import { truncateToWidth } from "./truncate.js"
|
|
13
|
+
import { displayWidth, truncateToWidth } from "./truncate.js"
|
|
14
14
|
import { ModelMetadataDialog } from "./dialog-model-metadata.js"
|
|
15
15
|
import { ContextWindowDialog } from "./dialog-context-window.js"
|
|
16
16
|
|
|
17
17
|
interface Props { config: AppConfig; initialProviderId?: string; setup?: boolean; onSave: (next: AppConfig) => void; onCommit: (next: AppConfig) => void; onCancel: () => void }
|
|
18
18
|
|
|
19
|
+
interface ProviderTab { id: string | null; label: string }
|
|
20
|
+
|
|
21
|
+
function ProviderTabs({ tabs, index, width }: { tabs: ProviderTab[]; index: number; width: number }) {
|
|
22
|
+
const labels = tabs.map((tab, i) => {
|
|
23
|
+
const name = truncateToWidth(tab.label, Math.max(1, width - 6))
|
|
24
|
+
return i === index ? `[${name}]` : name
|
|
25
|
+
})
|
|
26
|
+
// Keep the focused tab in view even with wide Unicode names or a small terminal.
|
|
27
|
+
let first = index
|
|
28
|
+
let last = index
|
|
29
|
+
let used = displayWidth(labels[index])
|
|
30
|
+
const fits = (left: number, right: number, extra: number) =>
|
|
31
|
+
used + 2 + extra + (left > 0 ? 2 : 0) + (right < tabs.length - 1 ? 2 : 0) <= width
|
|
32
|
+
while (first > 0 && fits(first - 1, last, displayWidth(labels[first - 1]))) {
|
|
33
|
+
first -= 1
|
|
34
|
+
used += 2 + displayWidth(labels[first])
|
|
35
|
+
}
|
|
36
|
+
while (last + 1 < tabs.length && fits(first, last + 1, displayWidth(labels[last + 1]))) {
|
|
37
|
+
last += 1
|
|
38
|
+
used += 2 + displayWidth(labels[last])
|
|
39
|
+
}
|
|
40
|
+
return <Text wrap="truncate-end">
|
|
41
|
+
{first > 0 && <Text color={c.text.faint}>‹ </Text>}
|
|
42
|
+
{tabs.slice(first, last + 1).map((tab, offset) => <Text key={tab.id === null ? "all" : `provider:${tab.id}`}
|
|
43
|
+
bold={first + offset === index} color={first + offset === index ? c.accent : c.text.muted}>
|
|
44
|
+
{offset > 0 ? " " : ""}{labels[first + offset]}
|
|
45
|
+
</Text>)}
|
|
46
|
+
{last + 1 < tabs.length && <Text color={c.text.faint}> ›</Text>}
|
|
47
|
+
</Text>
|
|
48
|
+
}
|
|
49
|
+
|
|
19
50
|
export function ModelDialog({ config, initialProviderId, setup = false, onSave, onCommit, onCancel }: Props) {
|
|
20
51
|
const width = Math.max(10, useTermWidth() - 2)
|
|
21
52
|
const [height, setHeight] = useState(process.stdout.rows ?? 24)
|
|
@@ -24,7 +55,12 @@ export function ModelDialog({ config, initialProviderId, setup = false, onSave,
|
|
|
24
55
|
process.stdout.on("resize", resize)
|
|
25
56
|
return () => { process.stdout.off("resize", resize) }
|
|
26
57
|
}, [])
|
|
27
|
-
const [
|
|
58
|
+
const [tabId, setTabId] = useState<string | null>(initialProviderId ?? (config.active.providerId || config.providers[0]?.id || null))
|
|
59
|
+
const tabs: ProviderTab[] = config.providers.map(item => ({ id: item.id, label: item.name || item.id }))
|
|
60
|
+
if (!setup && tabs.length > 1) tabs.push({ id: null, label: "All" })
|
|
61
|
+
const tabIndex = Math.max(0, tabs.findIndex(tab => tab.id === tabId))
|
|
62
|
+
const providerFilter = tabs[tabIndex]?.id ?? null
|
|
63
|
+
const lastModel = useRef(new Map<string | null, string>())
|
|
28
64
|
const [phase, setPhase] = useState<"models" | "providers" | "manual" | "search" | "metadata" | "context">("models")
|
|
29
65
|
const [providerAction, setProviderAction] = useState<"filter" | "manual">("filter")
|
|
30
66
|
const [target, setTarget] = useState<ConnectionModelRow | null>(null)
|
|
@@ -64,12 +100,24 @@ export function ModelDialog({ config, initialProviderId, setup = false, onSave,
|
|
|
64
100
|
return discoverConfiguredModels(requested, update)
|
|
65
101
|
}, [config.providers, refresh, setupProviderId])
|
|
66
102
|
|
|
103
|
+
function switchProvider(id: string | null) {
|
|
104
|
+
if (displayedKey) lastModel.current.set(providerFilter, displayedKey)
|
|
105
|
+
setTabId(id)
|
|
106
|
+
setQuery("")
|
|
107
|
+
setSelectedKey(lastModel.current.get(id) ?? modelCatalogKey(config.active.providerId, config.active.model))
|
|
108
|
+
setPhase("models")
|
|
109
|
+
}
|
|
110
|
+
|
|
67
111
|
useInput((input, key) => {
|
|
68
112
|
const state = live.current
|
|
69
113
|
if (state.phase !== "models") return
|
|
70
114
|
const cmd = commandInput(input, key)
|
|
71
115
|
if (key.escape) { state.onCancel(); return }
|
|
72
116
|
if (!state.provider) return
|
|
117
|
+
if (!setup && tabs.length > 1 && (key.leftArrow || key.rightArrow)) {
|
|
118
|
+
switchProvider(tabs[(tabIndex + (key.leftArrow ? -1 : 1) + tabs.length) % tabs.length].id)
|
|
119
|
+
return
|
|
120
|
+
}
|
|
73
121
|
if (cmd === "p" && !setup) { setProviderAction("filter"); setPhase("providers"); return }
|
|
74
122
|
if (cmd === "t") {
|
|
75
123
|
setManual("")
|
|
@@ -115,16 +163,16 @@ export function ModelDialog({ config, initialProviderId, setup = false, onSave,
|
|
|
115
163
|
setPhase("models")
|
|
116
164
|
}} />
|
|
117
165
|
if (phase === "providers") return <PickerDialog key={providerAction} title={providerAction === "manual" ? "Manual model · choose connection" : "Models · filter connections"}
|
|
118
|
-
options={[...(providerAction === "filter" ? [{ id: "all", label: "All configured connections", meta: `${config.providers.length} connections` }] : []),
|
|
166
|
+
options={[...(providerAction === "filter" && config.providers.length > 1 ? [{ id: "all", label: "All configured connections", meta: `${config.providers.length} connections` }] : []),
|
|
119
167
|
...config.providers.map(item => ({ id: `provider:${item.id}`, label: item.name || item.baseURL, meta: item.baseURL }))]}
|
|
120
|
-
initialIndex={providerAction === "filter" ? providerFilter === null ? 0 : Math.max(0, config.providers.findIndex(item => item.id === providerFilter) + 1)
|
|
168
|
+
initialIndex={providerAction === "filter" ? providerFilter === null ? 0 : Math.max(0, config.providers.findIndex(item => item.id === providerFilter) + Number(config.providers.length > 1))
|
|
121
169
|
: Math.max(0, config.providers.findIndex(item => item.id === provider.id))}
|
|
122
170
|
onCancel={() => setPhase("models")} onSelect={id => {
|
|
123
171
|
if (providerAction === "manual") { setManualProviderId(id.slice("provider:".length)); setPhase("manual") }
|
|
124
|
-
else
|
|
172
|
+
else switchProvider(id === "all" ? null : id.slice("provider:".length))
|
|
125
173
|
}} />
|
|
126
174
|
if (phase === "search" || phase === "manual" && manualProvider) return <DialogFrame
|
|
127
|
-
title={phase === "manual" ? `Manual model ID · ${manualProvider!.name}` :
|
|
175
|
+
title={phase === "manual" ? `Manual model ID · ${manualProvider!.name}` : `Search models · ${providerFilter === null ? "All" : provider.name}`} hint="enter confirm · esc back">
|
|
128
176
|
<Text color={c.text.faint}>{phase === "manual" ? "Manual IDs are unverified. The endpoint must support this exact ID." : "Search model IDs, connection names or endpoints. Selection changes only on Enter."}</Text>
|
|
129
177
|
<TextField key={phase} isActive value={phase === "manual" ? manual : query}
|
|
130
178
|
onChange={phase === "manual" ? setManual : setQuery} onCancel={() => setPhase("models")}
|
|
@@ -138,26 +186,35 @@ export function ModelDialog({ config, initialProviderId, setup = false, onSave,
|
|
|
138
186
|
const loading = scopedCatalogs.filter(item => item.loading).length
|
|
139
187
|
const failed = scopedCatalogs.filter(item => item.error).length
|
|
140
188
|
const error = catalogs.find(item => item.providerId === provider.id)?.error
|
|
141
|
-
const count = Math.max(1, Math.min(
|
|
142
|
-
const start = Math.max(0, selectedIndex - Math.floor(count / 2))
|
|
189
|
+
const count = Math.max(1, Math.min(12, height - 18))
|
|
190
|
+
const start = Math.max(0, Math.min(shown.length - count, selectedIndex - Math.floor(count / 2)))
|
|
143
191
|
const activeProvider = config.providers.find(item => item.id === config.active.providerId)
|
|
144
|
-
return <DialogFrame title={
|
|
145
|
-
hint={setup ? "↑↓
|
|
192
|
+
return <DialogFrame title={setup ? `Choose a model · ${provider.name || provider.baseURL}` : "Models"}
|
|
193
|
+
hint={setup ? "↑↓ model · enter select and finish · m metadata · c context · / search · t manual · esc choose later" : `${tabs.length > 1 ? "←→ provider · " : ""}↑↓ model · enter select · / search · p providers · m metadata · c context · r refresh · t manual · esc close`}>
|
|
146
194
|
{setup && <Text color={c.accent}>Connection saved. Choose a model to use it, or press esc to choose later with /model.</Text>}
|
|
195
|
+
{!setup && <ProviderTabs tabs={tabs} index={tabIndex} width={width} />}
|
|
147
196
|
<Text color={c.text.faint}>{truncateToWidth(`Current: ${agentModel ?? `${config.active.model || "none"} · ${activeProvider?.name || "none"}`}`, width)}</Text>
|
|
148
|
-
<Text color={c.text.
|
|
149
|
-
<Text color={c.text.faint}>{truncateToWidth((provider.contextWindowMode ?? inferLegacyContextWindowMode(provider)) === "manual"
|
|
150
|
-
? `${provider.name}: manual context ${provider.contextWindow.toLocaleString("en-US")} tokens · c to change`
|
|
151
|
-
: `${provider.name}: automatic context · m to link metadata · fallback ${provider.contextWindow.toLocaleString("en-US")} tokens`, width)}</Text>
|
|
197
|
+
<Text color={c.text.muted}>{truncateToWidth(`${providerFilter !== null ? provider.baseURL + " · " : ""}${shown.length} models${loading ? " · discovering…" : ""}${failed && providerFilter === null ? ` · ${failed} offline` : ""}${query ? ` · filter: ${query}` : ""}`, width)}</Text>
|
|
152
198
|
{error && <Text color={c.warning}>{truncateToWidth(`${provider.name}: ${error}`, width)}</Text>}
|
|
153
199
|
<Box flexDirection="column" marginTop={1}>
|
|
154
|
-
{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
200
|
+
{start > 0 && <Text color={c.text.faint}>… {start} above</Text>}
|
|
201
|
+
{shown.slice(start, start + count).map((row, i) => {
|
|
202
|
+
const focused = start + i === selectedIndex
|
|
203
|
+
const current = !agent && row.provider.id === config.active.providerId && row.id === config.active.model
|
|
204
|
+
const owner = providerFilter === null ? ` · ${row.provider.name || row.provider.id}` : ""
|
|
205
|
+
return <Text key={modelCatalogKey(row.provider.id, row.id)} color={focused ? c.accent : c.text.primary} bold={focused}>
|
|
206
|
+
{truncateToWidth(`${focused ? "›" : " "} ${row.id}${current ? " (current)" : ""}${owner}`, width)}
|
|
207
|
+
</Text>
|
|
208
|
+
})}
|
|
159
209
|
{!shown.length && <Text color={c.text.faint}>{loading ? "Discovering models… You can enter an ID with t." : "No matching models. Press t to enter an ID or / to change the filter."}</Text>}
|
|
160
210
|
{start + count < shown.length && <Text color={c.text.faint}>{`… ${shown.length - start - count} more`}</Text>}
|
|
161
211
|
</Box>
|
|
212
|
+
{selected && <Box flexDirection="column" marginTop={1}>
|
|
213
|
+
{providerFilter === null && <Text color={c.text.faint}>{truncateToWidth(provider.baseURL, width)}</Text>}
|
|
214
|
+
<Text color={c.text.muted}>{truncateToWidth(describeCatalogRow(selected), width)}</Text>
|
|
215
|
+
<Text color={c.text.faint}>{truncateToWidth((provider.contextWindowMode ?? inferLegacyContextWindowMode(provider)) === "manual"
|
|
216
|
+
? `${provider.name}: manual context ${provider.contextWindow.toLocaleString("en-US")} tokens · c to change`
|
|
217
|
+
: `${provider.name}: automatic context · fallback ${provider.contextWindow.toLocaleString("en-US")} tokens`, width)}</Text>
|
|
218
|
+
</Box>}
|
|
162
219
|
</DialogFrame>
|
|
163
220
|
}
|
package/src/ui/footer.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export function contextFooterText(contextBudget: ContextBudgetSnapshot): string
|
|
|
32
32
|
|
|
33
33
|
export function throughputFooterText(sample: OutputThroughputSample | undefined): string {
|
|
34
34
|
if (!sample || !Number.isFinite(sample.tokensPerSecond) || sample.tokensPerSecond <= 0) return ""
|
|
35
|
-
return `${sample.estimated ? "~" : ""}${sample.tokensPerSecond.toFixed(1)} token/s`
|
|
35
|
+
return `${sample.turnAverage ? "avg " : ""}${sample.estimated ? "~" : ""}${sample.tokensPerSecond.toFixed(1)} token/s`
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
interface FooterProps {
|
|
@@ -45,8 +45,8 @@ interface FooterProps {
|
|
|
45
45
|
step: number
|
|
46
46
|
maxSteps: number
|
|
47
47
|
contextBudget: ContextBudgetSnapshot
|
|
48
|
-
/**
|
|
49
|
-
|
|
48
|
+
/** null while an external agent has not reported its window. */
|
|
49
|
+
remoteContext?: { used: number; size: number } | null
|
|
50
50
|
hasApiKey: boolean
|
|
51
51
|
showWelcome?: boolean
|
|
52
52
|
shellMode?: boolean
|
|
@@ -68,7 +68,7 @@ export const Footer = memo(function Footer({
|
|
|
68
68
|
effort,
|
|
69
69
|
isRunning,
|
|
70
70
|
contextBudget,
|
|
71
|
-
|
|
71
|
+
remoteContext,
|
|
72
72
|
hasApiKey,
|
|
73
73
|
showWelcome,
|
|
74
74
|
shellMode,
|
|
@@ -81,9 +81,11 @@ export const Footer = memo(function Footer({
|
|
|
81
81
|
// computed centrally against compactAt, so Footer, TokenWarning and /status
|
|
82
82
|
// cannot drift into three different threshold systems.
|
|
83
83
|
const tpsText = throughputFooterText(outputThroughput)
|
|
84
|
-
const ctxText = contextFooterText(contextBudget)
|
|
84
|
+
const ctxText = remoteContext === undefined ? contextFooterText(contextBudget)
|
|
85
|
+
: remoteContext ? `ctx ${formatTokensK(remoteContext.used)}/${formatTokensK(remoteContext.size)} (${Math.round(100 * remoteContext.used / remoteContext.size)}%)` : ""
|
|
85
86
|
const ctxColor =
|
|
86
|
-
|
|
87
|
+
remoteContext ? c.text.muted
|
|
88
|
+
: contextBudget.severity === "critical" ? c.error
|
|
87
89
|
: contextBudget.severity === "warning" ? c.warning
|
|
88
90
|
: contextBudget.severity === "notice" ? c.accent
|
|
89
91
|
: c.text.faint
|
|
@@ -108,7 +110,7 @@ export const Footer = memo(function Footer({
|
|
|
108
110
|
if (!hasApiKey && !showWelcome) rightSegments.push({ text: "! /connect", fg: c.warning, key: "connect" })
|
|
109
111
|
if (showWelcome && !hasApiKey) rightSegments.push({ text: "/connect", fg: c.accent, key: "connect" })
|
|
110
112
|
if (tpsText) rightSegments.push({ text: tpsText, fg: c.text.muted, key: "tps" })
|
|
111
|
-
if (ctxText
|
|
113
|
+
if (ctxText) rightSegments.push({ text: ctxText, fg: ctxColor, key: "ctx" })
|
|
112
114
|
if (mcp && mcp.total > 0) {
|
|
113
115
|
const hasError = mcp.error > 0 || mcp.needsAuth > 0
|
|
114
116
|
const hasDegraded = mcp.degraded > 0 || mcp.ready < mcp.total - mcp.error - mcp.needsAuth
|
|
@@ -132,7 +134,7 @@ export const Footer = memo(function Footer({
|
|
|
132
134
|
let rightWidth = computeRightWidth(rightSegments)
|
|
133
135
|
const cwdWidth = displayWidth(cwd)
|
|
134
136
|
for (const key of DROP_ORDER) {
|
|
135
|
-
if (cwdWidth + rightWidth + 1 <= safeWidth) break
|
|
137
|
+
if (Math.min(cwdWidth, 12) + rightWidth + 1 <= safeWidth) break
|
|
136
138
|
const idx = rightSegments.findIndex(s => s.key === key)
|
|
137
139
|
if (idx >= 0) {
|
|
138
140
|
rightSegments.splice(idx, 1)
|
|
@@ -103,7 +103,8 @@ export class AcpEventMapper {
|
|
|
103
103
|
this.plan = update.entries;
|
|
104
104
|
break;
|
|
105
105
|
case "usage_update":
|
|
106
|
-
this.contextUsage =
|
|
106
|
+
this.contextUsage = Number.isSafeInteger(update.used) && update.used >= 0 && Number.isSafeInteger(update.size) && update.size > 0
|
|
107
|
+
? { used: update.used, size: update.size } : undefined;
|
|
107
108
|
break;
|
|
108
109
|
default:
|
|
109
110
|
break;
|
package/zapsdk/acp-client/run.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface AcpTurnOptions {
|
|
|
27
27
|
/** Event path prefix for nested rendering (subagent path). */
|
|
28
28
|
path?: string[];
|
|
29
29
|
onEvent?: (event: AgentEvent) => void;
|
|
30
|
+
onContextUsage?: (usage: { used: number; size: number }) => void;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export interface AcpTurnResult {
|
|
@@ -101,7 +102,10 @@ export class AcpAgentSession {
|
|
|
101
102
|
async prompt(content: string | ContentBlock[], options: AcpTurnOptions = {}): Promise<AcpTurnResult> {
|
|
102
103
|
const mapper = new AcpEventMapper(options.path ?? []);
|
|
103
104
|
const emit = (events: AgentEvent[]) => { for (const event of events) options.onEvent?.(event); };
|
|
104
|
-
this.turn = update =>
|
|
105
|
+
this.turn = update => {
|
|
106
|
+
emit(mapper.map(update));
|
|
107
|
+
if (update.sessionUpdate === "usage_update" && mapper.contextUsage) options.onContextUsage?.(mapper.contextUsage);
|
|
108
|
+
};
|
|
105
109
|
const blocks = typeof content === "string" ? [{ type: "text" as const, text: content }] : content;
|
|
106
110
|
let response;
|
|
107
111
|
try {
|