eve 0.88.1 → 0.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -11
- package/dist/src/channel/adapter.d.ts +12 -3
- package/dist/src/channel/adapter.js +1 -1
- package/dist/src/channel/auth/definitions.d.ts +7 -20
- package/dist/src/channel/auth/definitions.js +1 -1
- package/dist/src/channel/auth/jwt-ecdsa.js +1 -1
- package/dist/src/channel/auth/jwt-hmac.js +1 -1
- package/dist/src/channel/auth/oidc.js +1 -1
- package/dist/src/channel/auth/result.d.ts +2 -3
- package/dist/src/channel/auth/result.js +1 -1
- package/dist/src/channel/channel-address.d.ts +1 -1
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/schedule.js +1 -1
- package/dist/src/chunks/{use-eve-agent-BExXjBv6.js → use-eve-agent-Bwloorf8.js} +96 -65
- package/dist/src/chunks/{use-eve-agent-C0KHCyb9.js → use-eve-agent-XCB0-tLX.js} +96 -65
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/tui/remote-connection-probe.js +1 -1
- package/dist/src/cli/dev/tui/remote-connection-types.d.ts +1 -0
- package/dist/src/cli/dev/tui/runner.js +2 -2
- package/dist/src/cli/dev/tui/status-line.d.ts +2 -2
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/client/agent-info-schema.d.ts +341 -326
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/agent-info-types.d.ts +13 -10
- package/dist/src/client/client-error.d.ts +1 -1
- package/dist/src/client/client.d.ts +5 -3
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/conversation.js +1 -1
- package/dist/src/client/transcript.d.ts +7 -4
- package/dist/src/client/transcript.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/evals/target.js +1 -1
- package/dist/src/eve-channel/auth.d.ts +19 -0
- package/dist/src/eve-channel/auth.js +1 -0
- package/dist/src/eve-channel/index.d.ts +1 -0
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/types.d.ts +23 -4
- package/dist/src/execution/catalog/connection-entry.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/extensions/git/extension/extension.d.ts +12 -9
- package/dist/src/extensions/git/extension/extension.js +1 -1
- package/dist/src/extensions/git/extension/lib/gh-tool.d.ts +4 -12
- package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-guidance.js +4 -4
- package/dist/src/extensions/git/extension/lib/github-shell-schema.d.ts +3 -5
- package/dist/src/extensions/git/extension/lib/github-shell-schema.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-shell.d.ts +31 -21
- package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
- package/dist/src/extensions/git/extension/lib/signed-commit.js +1 -1
- package/dist/src/extensions/git/tools.d.ts +2 -10
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/authored-module-graph.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +2 -2
- package/dist/src/protocol/routes.d.ts +7 -1
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/protocol/session-events/families/delivery.d.ts +3 -2
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/github/state.d.ts +7 -0
- package/dist/src/public/channels/github/state.js +1 -1
- package/dist/src/public/channels/mcp.js +1 -1
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
- package/dist/src/public/connections/index.d.ts +1 -1
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/connections/tool-call.d.ts +2 -2
- package/dist/src/reactions/frame.js +1 -1
- package/dist/src/runtime/channels/registry.d.ts +2 -2
- package/dist/src/runtime/channels/registry.js +1 -1
- package/dist/src/runtime/connections/approval-scope.d.ts +9 -0
- package/dist/src/runtime/connections/approval-scope.js +1 -0
- package/dist/src/runtime/connections/mcp-client.d.ts +1 -1
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/provided-arguments.js +1 -1
- package/dist/src/runtime/subagents/workflow.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/agent-info-access.d.ts +5 -0
- package/dist/src/shared/agent-info-access.js +1 -0
- package/dist/src/shared/connection-types.d.ts +21 -4
- package/dist/src/shared/session-history.d.ts +4 -2
- package/dist/src/shared/session-history.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/custom.mdx +2 -0
- package/docs/channels/eve.mdx +5 -3
- package/docs/code-extension.mdx +17 -60
- package/docs/concepts/execution-model-and-durability.mdx +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +9 -3
- package/docs/connections/overview.mdx +30 -0
- package/docs/evals/targets.mdx +2 -0
- package/docs/evals/tool-stubs.mdx +4 -4
- package/docs/guides/auth-and-route-protection.md +16 -3
- package/docs/guides/client/overview.mdx +6 -2
- package/docs/guides/client/streaming.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent.mdx +1 -1
- package/docs/guides/prepare-for-1-0.md +23 -1
- package/docs/tools/human-in-the-loop.md +1 -1
- package/package.json +1 -1
|
@@ -136,29 +136,33 @@ const mountIdSchema = z.string().min(1);
|
|
|
136
136
|
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region src/client/agent-info-schema.ts
|
|
139
|
+
const AGENT_INFO_VERSION = 5;
|
|
140
|
+
function openEnum(values) {
|
|
141
|
+
return z.union([z.enum(values), z.string().transform(() => "unrecognized")]);
|
|
142
|
+
}
|
|
139
143
|
const owner = z.discriminatedUnion("kind", [
|
|
140
|
-
z.object({ kind: z.literal("application") })
|
|
144
|
+
z.object({ kind: z.literal("application") }),
|
|
141
145
|
z.object({
|
|
142
146
|
feature: z.string(),
|
|
143
147
|
kind: z.literal("framework")
|
|
144
|
-
})
|
|
148
|
+
}),
|
|
145
149
|
z.object({
|
|
146
150
|
kind: z.literal("extension"),
|
|
147
151
|
mountId: mountIdSchema.optional(),
|
|
148
152
|
namespace: z.string(),
|
|
149
153
|
packageName: z.string()
|
|
150
|
-
})
|
|
154
|
+
})
|
|
151
155
|
]);
|
|
152
156
|
const moduleBacking = z.discriminatedUnion("kind", [z.object({
|
|
153
157
|
externalDependencies: z.array(z.string()),
|
|
154
158
|
extensionScope: z.object({
|
|
155
159
|
namespace: z.string(),
|
|
156
160
|
sourceRoot: z.string()
|
|
157
|
-
}).
|
|
161
|
+
}).optional(),
|
|
158
162
|
kind: z.literal("filesystem"),
|
|
159
163
|
mountId: z.string().optional(),
|
|
160
164
|
sourcePath: z.string()
|
|
161
|
-
})
|
|
165
|
+
}), z.object({
|
|
162
166
|
dependencies: z.record(z.string(), z.string()).optional(),
|
|
163
167
|
kind: z.literal("programmatic"),
|
|
164
168
|
mountId: z.string().optional(),
|
|
@@ -167,42 +171,42 @@ const moduleBacking = z.discriminatedUnion("kind", [z.object({
|
|
|
167
171
|
registryId: z.string(),
|
|
168
172
|
revision: z.string(),
|
|
169
173
|
semanticRevision: z.string().optional()
|
|
170
|
-
})
|
|
174
|
+
})]);
|
|
171
175
|
const binding = z.object({
|
|
172
176
|
backing: moduleBacking,
|
|
173
177
|
logicalPath: z.string(),
|
|
174
178
|
owner
|
|
175
|
-
})
|
|
179
|
+
});
|
|
176
180
|
const source = z.object({
|
|
177
181
|
binding: binding.optional(),
|
|
178
182
|
exportName: z.string().optional(),
|
|
179
183
|
logicalPath: z.string(),
|
|
180
184
|
owner,
|
|
181
185
|
sourceId: z.string(),
|
|
182
|
-
sourceKind:
|
|
186
|
+
sourceKind: openEnum([
|
|
183
187
|
"markdown",
|
|
184
188
|
"module",
|
|
185
189
|
"skill-package"
|
|
186
190
|
])
|
|
187
|
-
})
|
|
188
|
-
const entry = source.extend({ name: z.string() })
|
|
189
|
-
const dynamicResolver = source.extend({ slug: z.string() })
|
|
191
|
+
});
|
|
192
|
+
const entry = source.extend({ name: z.string() });
|
|
193
|
+
const dynamicResolver = source.extend({ slug: z.string() });
|
|
190
194
|
const modelRouting = z.discriminatedUnion("kind", [z.object({
|
|
191
195
|
kind: z.literal("gateway"),
|
|
192
196
|
target: z.string(),
|
|
193
197
|
byok: z.string().optional()
|
|
194
|
-
})
|
|
198
|
+
}), z.object({
|
|
195
199
|
kind: z.literal("external"),
|
|
196
200
|
provider: z.string()
|
|
197
|
-
})
|
|
201
|
+
})]);
|
|
198
202
|
const modelEndpoint = z.union([
|
|
199
203
|
z.object({
|
|
200
204
|
kind: z.literal("external"),
|
|
201
205
|
provider: z.string()
|
|
202
|
-
})
|
|
206
|
+
}),
|
|
203
207
|
z.object({
|
|
204
208
|
kind: z.literal("chatgpt"),
|
|
205
|
-
state:
|
|
209
|
+
state: openEnum([
|
|
206
210
|
"checking",
|
|
207
211
|
"ready",
|
|
208
212
|
"signed-out",
|
|
@@ -210,21 +214,21 @@ const modelEndpoint = z.union([
|
|
|
210
214
|
"unavailable"
|
|
211
215
|
]),
|
|
212
216
|
accountLabel: z.string().optional()
|
|
213
|
-
})
|
|
217
|
+
}),
|
|
214
218
|
z.object({
|
|
215
219
|
kind: z.literal("gateway"),
|
|
216
220
|
connected: z.literal(true),
|
|
217
|
-
credential:
|
|
221
|
+
credential: openEnum([
|
|
218
222
|
"api-key",
|
|
219
223
|
"oidc",
|
|
220
224
|
"oauth"
|
|
221
225
|
]),
|
|
222
226
|
team: z.optional(z.string())
|
|
223
|
-
})
|
|
227
|
+
}),
|
|
224
228
|
z.object({
|
|
225
229
|
kind: z.literal("gateway"),
|
|
226
230
|
connected: z.literal(false)
|
|
227
|
-
})
|
|
231
|
+
})
|
|
228
232
|
]);
|
|
229
233
|
const modelBaseFields = {
|
|
230
234
|
contextWindowTokens: z.number().optional(),
|
|
@@ -245,15 +249,15 @@ const agentModel = z.union([z.object({
|
|
|
245
249
|
endpoint: modelEndpoint.optional(),
|
|
246
250
|
id: z.string(),
|
|
247
251
|
routing: modelRouting
|
|
248
|
-
})
|
|
252
|
+
}), z.object({
|
|
249
253
|
...modelBaseFields,
|
|
250
254
|
endpoint: z.never().optional(),
|
|
251
255
|
id: z.never().optional(),
|
|
252
256
|
routing: z.object({
|
|
253
257
|
kind: z.literal("dynamic"),
|
|
254
258
|
resolver: dynamicResolver
|
|
255
|
-
})
|
|
256
|
-
})
|
|
259
|
+
})
|
|
260
|
+
})]);
|
|
257
261
|
const tool = entry.extend({
|
|
258
262
|
description: z.string(),
|
|
259
263
|
hasAuth: z.boolean(),
|
|
@@ -263,23 +267,23 @@ const tool = entry.extend({
|
|
|
263
267
|
inputSchema: z.unknown(),
|
|
264
268
|
outputSchema: z.unknown().optional(),
|
|
265
269
|
requiresApproval: z.boolean()
|
|
266
|
-
})
|
|
270
|
+
});
|
|
267
271
|
const skill = entry.extend({
|
|
268
272
|
description: z.string(),
|
|
269
273
|
license: z.string().optional(),
|
|
270
274
|
markdown: z.string(),
|
|
271
275
|
metadata: z.record(z.string(), z.string()).optional()
|
|
272
|
-
})
|
|
276
|
+
});
|
|
273
277
|
const instructions = entry.extend({
|
|
274
278
|
content: z.string(),
|
|
275
|
-
role:
|
|
276
|
-
})
|
|
279
|
+
role: openEnum(["system", "user"])
|
|
280
|
+
});
|
|
277
281
|
const schedule = entry.extend({
|
|
278
282
|
cron: z.string(),
|
|
279
283
|
hasRun: z.boolean(),
|
|
280
284
|
markdown: z.string().optional()
|
|
281
|
-
})
|
|
282
|
-
const channelMethod =
|
|
285
|
+
});
|
|
286
|
+
const channelMethod = openEnum([
|
|
283
287
|
"GET",
|
|
284
288
|
"HEAD",
|
|
285
289
|
"POST",
|
|
@@ -293,14 +297,14 @@ const channelRoute = entry.extend({
|
|
|
293
297
|
adapterKind: z.string().optional(),
|
|
294
298
|
method: channelMethod,
|
|
295
299
|
urlPath: z.string()
|
|
296
|
-
})
|
|
300
|
+
});
|
|
297
301
|
const sourceDescriptor = z.object({
|
|
298
302
|
backing: z.union([moduleBacking, z.object({
|
|
299
303
|
kind: z.literal("resource"),
|
|
300
304
|
sourcePath: z.string()
|
|
301
|
-
})
|
|
302
|
-
form:
|
|
303
|
-
layer:
|
|
305
|
+
})]),
|
|
306
|
+
form: openEnum(["derived", "direct"]),
|
|
307
|
+
layer: openEnum([
|
|
304
308
|
"framework-default",
|
|
305
309
|
"extension-package",
|
|
306
310
|
"extension-override",
|
|
@@ -309,13 +313,13 @@ const sourceDescriptor = z.object({
|
|
|
309
313
|
logicalPath: z.string(),
|
|
310
314
|
owner,
|
|
311
315
|
sourceId: z.string()
|
|
312
|
-
})
|
|
316
|
+
});
|
|
313
317
|
const shadowedChannelRoute = z.object({
|
|
314
318
|
method: channelMethod,
|
|
315
319
|
source: sourceDescriptor,
|
|
316
320
|
urlPath: z.string(),
|
|
317
321
|
winnerSourceId: z.string()
|
|
318
|
-
})
|
|
322
|
+
});
|
|
319
323
|
const connection = source.extend({
|
|
320
324
|
connectionName: z.string(),
|
|
321
325
|
description: z.string(),
|
|
@@ -325,20 +329,20 @@ const connection = source.extend({
|
|
|
325
329
|
protocol: z.string(),
|
|
326
330
|
toolFilter: z.unknown().optional(),
|
|
327
331
|
url: z.string()
|
|
328
|
-
})
|
|
332
|
+
});
|
|
329
333
|
const hook = source.extend({
|
|
330
334
|
eventNames: z.array(z.string()),
|
|
331
335
|
slug: z.string()
|
|
332
|
-
})
|
|
336
|
+
});
|
|
333
337
|
const memory = source.extend({
|
|
334
338
|
description: z.string().optional(),
|
|
335
339
|
slot: z.string()
|
|
336
|
-
})
|
|
340
|
+
});
|
|
337
341
|
const sandbox = source.extend({
|
|
338
342
|
provider: z.string().optional(),
|
|
339
343
|
environmentExportName: z.string().optional(),
|
|
340
344
|
revisionHash: z.string()
|
|
341
|
-
})
|
|
345
|
+
});
|
|
342
346
|
const subagent = entry.extend({
|
|
343
347
|
configResolver: dynamicResolver.optional(),
|
|
344
348
|
description: z.string().optional(),
|
|
@@ -355,90 +359,91 @@ const subagent = entry.extend({
|
|
|
355
359
|
schedules: z.number(),
|
|
356
360
|
skills: z.number(),
|
|
357
361
|
tools: z.number()
|
|
358
|
-
})
|
|
359
|
-
})
|
|
362
|
+
})
|
|
363
|
+
});
|
|
360
364
|
const remoteAgent = entry.extend({
|
|
361
365
|
description: z.string(),
|
|
362
366
|
nodeId: z.string(),
|
|
363
367
|
parentNodeId: z.string(),
|
|
364
368
|
url: z.string().optional()
|
|
365
|
-
})
|
|
369
|
+
});
|
|
366
370
|
const kernelEffect = z.object({
|
|
367
|
-
action:
|
|
368
|
-
audience: z.array(
|
|
369
|
-
kind:
|
|
371
|
+
action: openEnum(["subagent-call", "workflow-tool-call"]).optional(),
|
|
372
|
+
audience: z.array(openEnum(["root-session"])),
|
|
373
|
+
kind: openEnum(["dispatch", "provider-tool"]),
|
|
370
374
|
sourceId: z.string()
|
|
371
|
-
})
|
|
375
|
+
});
|
|
372
376
|
const compositionDiagnostic = z.object({
|
|
373
|
-
kind:
|
|
377
|
+
kind: openEnum(["disabled", "shadowed"]),
|
|
374
378
|
logicalPath: z.string(),
|
|
375
379
|
owner,
|
|
376
380
|
sourceId: z.string(),
|
|
377
381
|
winnerSourceId: z.string().optional()
|
|
378
|
-
})
|
|
382
|
+
});
|
|
379
383
|
const AgentInfoResultSchema = z.object({
|
|
380
384
|
agent: z.object({
|
|
381
385
|
agentRoot: z.string(),
|
|
382
386
|
appRoot: z.string(),
|
|
383
|
-
config: source.extend({ binding })
|
|
387
|
+
config: source.extend({ binding }),
|
|
384
388
|
description: z.string().optional(),
|
|
385
389
|
model: agentModel,
|
|
386
390
|
name: z.string(),
|
|
387
391
|
nodeId: z.string(),
|
|
388
392
|
outputSchema: z.unknown().optional()
|
|
389
|
-
})
|
|
390
|
-
capabilities: z.object({ devRoutes: z.boolean() })
|
|
393
|
+
}),
|
|
394
|
+
capabilities: z.object({ devRoutes: z.boolean() }),
|
|
391
395
|
channels: z.object({
|
|
392
396
|
routes: z.array(channelRoute),
|
|
393
397
|
shadowed: z.array(shadowedChannelRoute)
|
|
394
|
-
})
|
|
398
|
+
}),
|
|
395
399
|
composition: z.object({
|
|
396
400
|
disabled: z.array(compositionDiagnostic),
|
|
397
401
|
shadowed: z.array(compositionDiagnostic)
|
|
398
|
-
})
|
|
402
|
+
}),
|
|
399
403
|
connections: z.array(connection),
|
|
400
404
|
diagnostics: z.object({
|
|
401
405
|
discoveryErrors: z.number(),
|
|
402
406
|
discoveryWarnings: z.number()
|
|
403
|
-
})
|
|
407
|
+
}),
|
|
404
408
|
hooks: z.array(hook),
|
|
405
409
|
instructions: z.object({
|
|
406
410
|
dynamic: z.array(dynamicResolver),
|
|
407
411
|
static: z.array(instructions)
|
|
408
|
-
})
|
|
412
|
+
}),
|
|
409
413
|
instrumentation: source.optional(),
|
|
410
414
|
kernelEffects: z.array(kernelEffect),
|
|
411
415
|
kind: z.literal("eve-agent-info"),
|
|
412
416
|
memories: z.array(memory),
|
|
413
|
-
mode:
|
|
417
|
+
mode: openEnum(["development", "production"]),
|
|
414
418
|
remoteAgents: z.object({
|
|
415
419
|
entries: z.array(remoteAgent),
|
|
416
420
|
total: z.number()
|
|
417
|
-
})
|
|
421
|
+
}),
|
|
418
422
|
sandbox,
|
|
419
423
|
schedules: z.array(schedule),
|
|
420
424
|
skills: z.object({
|
|
421
425
|
dynamic: z.array(dynamicResolver),
|
|
422
426
|
static: z.array(skill)
|
|
423
|
-
})
|
|
427
|
+
}),
|
|
424
428
|
subagents: z.object({
|
|
425
429
|
local: z.array(subagent),
|
|
426
430
|
total: z.number()
|
|
427
|
-
})
|
|
431
|
+
}),
|
|
428
432
|
tools: z.object({
|
|
429
433
|
dynamic: z.array(dynamicResolver),
|
|
430
434
|
static: z.array(tool)
|
|
431
|
-
})
|
|
435
|
+
}),
|
|
432
436
|
version: z.literal(5),
|
|
433
437
|
workspace: z.object({
|
|
434
438
|
resourceRoot: z.unknown(),
|
|
435
439
|
rootEntries: z.array(z.string())
|
|
436
|
-
})
|
|
437
|
-
}).
|
|
440
|
+
})
|
|
441
|
+
}).superRefine((value, context) => {
|
|
438
442
|
const assertUnique = (entries, identity, path) => {
|
|
439
443
|
const seen = /* @__PURE__ */ new Set();
|
|
440
444
|
entries.forEach((entry, index) => {
|
|
441
445
|
const key = identity(entry);
|
|
446
|
+
if (key === void 0) return;
|
|
442
447
|
if (seen.has(key)) context.addIssue({
|
|
443
448
|
code: "custom",
|
|
444
449
|
message: `Duplicate public identity "${key}".`,
|
|
@@ -464,7 +469,7 @@ const AgentInfoResultSchema = z.object({
|
|
|
464
469
|
assertUnique(value.connections, (entry) => entry.connectionName, ["connections"]);
|
|
465
470
|
assertUnique(value.hooks, (entry) => entry.slug, ["hooks"]);
|
|
466
471
|
assertUnique(value.memories, (entry) => entry.slot, ["memories"]);
|
|
467
|
-
assertUnique(value.channels.routes, (entry) => `${entry.method} ${normalizeRoutePattern(entry.urlPath)}`, ["channels", "routes"]);
|
|
472
|
+
assertUnique(value.channels.routes, (entry) => entry.method === "unrecognized" ? void 0 : `${entry.method} ${normalizeRoutePattern(entry.urlPath)}`, ["channels", "routes"]);
|
|
468
473
|
assertUnique(value.subagents.local, (entry) => entry.nodeId, ["subagents", "local"]);
|
|
469
474
|
assertUnique(value.remoteAgents.entries, (entry) => entry.nodeId, ["remoteAgents", "entries"]);
|
|
470
475
|
assertTotal(value.subagents.total, value.subagents.local, ["subagents", "total"]);
|
|
@@ -544,7 +549,7 @@ const AgentInfoResultSchema = z.object({
|
|
|
544
549
|
});
|
|
545
550
|
continue;
|
|
546
551
|
}
|
|
547
|
-
if (entry.sourceKind !== "module" && entry.binding !== void 0) {
|
|
552
|
+
if (entry.sourceKind !== "module" && entry.sourceKind !== "unrecognized" && entry.binding !== void 0) {
|
|
548
553
|
context.addIssue({
|
|
549
554
|
code: "custom",
|
|
550
555
|
message: `${entry.sourceKind} source cannot carry a module binding.`,
|
|
@@ -573,6 +578,13 @@ const AgentInfoResultSchema = z.object({
|
|
|
573
578
|
});
|
|
574
579
|
}
|
|
575
580
|
});
|
|
581
|
+
function describeAgentInfoVersionMismatch(payload) {
|
|
582
|
+
if (typeof payload !== "object" || payload === null) return void 0;
|
|
583
|
+
const { kind, version } = payload;
|
|
584
|
+
if (kind !== "eve-agent-info" || typeof version !== "number") return void 0;
|
|
585
|
+
if (version === 5) return void 0;
|
|
586
|
+
return `version: the server sent agent-info version ${version}, but this client reads version ${5}. ${version < 5 ? "Upgrade eve in the agent and redeploy it" : "Upgrade the eve package this client runs from"}.`;
|
|
587
|
+
}
|
|
576
588
|
function normalizeRoutePattern(path) {
|
|
577
589
|
return path.replace(/^\/+|\/+$/g, "").split("/").map((segment) => segment.startsWith(":") || /^\[[^\]]+\]$/.test(segment) ? ":" : segment).join("/");
|
|
578
590
|
}
|
|
@@ -1410,6 +1422,21 @@ function activeTurn(view) {
|
|
|
1410
1422
|
const row = latest === void 0 ? void 0 : view.turns[latest];
|
|
1411
1423
|
return row !== void 0 && row.status !== "settled" ? row : void 0;
|
|
1412
1424
|
}
|
|
1425
|
+
function conversation(view) {
|
|
1426
|
+
const selection = view.selection;
|
|
1427
|
+
const start = selection === void 0 ? view.session.latestTurnId : selection?.turnId;
|
|
1428
|
+
const turns = [];
|
|
1429
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1430
|
+
let id = start;
|
|
1431
|
+
while (id !== void 0 && id !== null && !seen.has(id)) {
|
|
1432
|
+
seen.add(id);
|
|
1433
|
+
const row = view.turns[id];
|
|
1434
|
+
if (row === void 0) break;
|
|
1435
|
+
turns.push(row);
|
|
1436
|
+
id = row.follows;
|
|
1437
|
+
}
|
|
1438
|
+
return turns.reverse();
|
|
1439
|
+
}
|
|
1413
1440
|
function failure(view, turnId) {
|
|
1414
1441
|
const row = turnId === void 0 ? void 0 : view.turns[turnId];
|
|
1415
1442
|
if (row?.outcome === "failed") return row.error ?? {
|
|
@@ -3305,6 +3332,8 @@ var Client = class {
|
|
|
3305
3332
|
} catch {
|
|
3306
3333
|
throw new AgentInfoResponseError();
|
|
3307
3334
|
}
|
|
3335
|
+
const versionMismatch = describeAgentInfoVersionMismatch(payload);
|
|
3336
|
+
if (versionMismatch !== void 0) throw new AgentInfoResponseError([versionMismatch]);
|
|
3308
3337
|
const result = AgentInfoResultSchema.safeParse(payload);
|
|
3309
3338
|
if (!result.success) throw new AgentInfoResponseError(result.error.issues.slice(0, 5).map((issue) => {
|
|
3310
3339
|
const path = issue.path.join(".");
|
|
@@ -3897,6 +3926,8 @@ var Conversation = class {
|
|
|
3897
3926
|
return interactions;
|
|
3898
3927
|
}
|
|
3899
3928
|
#orderedMessages() {
|
|
3929
|
+
const turnIds = conversation(this.view).map((turn) => turn.turnId);
|
|
3930
|
+
const inConversation = new Set(turnIds);
|
|
3900
3931
|
const sent = /* @__PURE__ */ new Map();
|
|
3901
3932
|
const imported = /* @__PURE__ */ new Map();
|
|
3902
3933
|
for (const row of Object.values(this.view.deliveries)) {
|
|
@@ -3929,7 +3960,7 @@ var Conversation = class {
|
|
|
3929
3960
|
}
|
|
3930
3961
|
const local = /* @__PURE__ */ new Map();
|
|
3931
3962
|
for (const submission of this.#submissions) {
|
|
3932
|
-
const turnId = submission.turnId !== void 0 &&
|
|
3963
|
+
const turnId = submission.turnId !== void 0 && inConversation.has(submission.turnId) ? submission.turnId : void 0;
|
|
3933
3964
|
const message = {
|
|
3934
3965
|
id: `optimistic:${submission.id}:user`,
|
|
3935
3966
|
metadata: {
|
|
@@ -3947,7 +3978,7 @@ var Conversation = class {
|
|
|
3947
3978
|
else messages.push(message);
|
|
3948
3979
|
}
|
|
3949
3980
|
const messages = [];
|
|
3950
|
-
for (const turnId of
|
|
3981
|
+
for (const turnId of turnIds) {
|
|
3951
3982
|
const placed = [
|
|
3952
3983
|
...(imported.get(turnId) ?? []).map((entry) => ({
|
|
3953
3984
|
...entry,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join,resolve}from"node:path";import{findEveProjectRoot}from"#internal/eve-project-root.js";import{DEVELOPMENT_ENV_FILE_NAMES,readDevelopmentEnvironmentValues}from"#shared/development-env-files.js";import{MODEL_CONNECTION_ENV}from"#shared/model-helper.js";import{readProviderSettingsSync}from"#setup/provider-settings.js";const developmentEnvironmentLoaders=new Map;function getDevelopmentEnvironmentFilePaths(e){return DEVELOPMENT_ENV_FILE_NAMES.map(t=>join(getDevelopmentEnvironmentLoader(e).environmentRoot,t))}async function loadDevelopmentEnvironmentFiles(e){let t=resolve(e);getDevelopmentEnvironmentLoader(t,await findEveProjectRoot(t)).reload()}function stageDevelopmentEnvironmentFiles(e){return getDevelopmentEnvironmentLoader(e).stageReload()}function readDevelopmentEnvironmentHostValues(e){let t={},n=readDevelopmentEnvironmentValues(getDevelopmentEnvironmentLoader(e).environmentRoot),r=new Set(n.keys());for(let e of[...r].sort((e,t)=>e.localeCompare(t)))t[e]=process.env[e]??null;return t}function getDevelopmentEnvironmentLoader(e,t){let n=resolve(e),r=developmentEnvironmentLoaders.get(n);if(r!==void 0&&t===void 0)return r;let i=resolve(t??n);if(r?.environmentRoot===i)return r;let a=createDevelopmentEnvironmentLoader(
|
|
1
|
+
import{join,resolve}from"node:path";import{findEveProjectRoot}from"#internal/eve-project-root.js";import{DEVELOPMENT_ENV_FILE_NAMES,readDevelopmentEnvironmentValues}from"#shared/development-env-files.js";import{MODEL_CONNECTION_ENV}from"#shared/model-helper.js";import{readProviderSettingsSync}from"#setup/provider-settings.js";const developmentEnvironmentLoaders=new Map;function getDevelopmentEnvironmentFilePaths(e){return DEVELOPMENT_ENV_FILE_NAMES.map(t=>join(getDevelopmentEnvironmentLoader(e).environmentRoot,t))}async function loadDevelopmentEnvironmentFiles(e){let t=resolve(e);getDevelopmentEnvironmentLoader(t,await findEveProjectRoot(t)).reload()}function stageDevelopmentEnvironmentFiles(e){return getDevelopmentEnvironmentLoader(e).stageReload()}function readDevelopmentEnvironmentHostValues(e){let t={},n=readDevelopmentEnvironmentValues(getDevelopmentEnvironmentLoader(e).environmentRoot),r=new Set(n.keys());for(let e of[...r].sort((e,t)=>e.localeCompare(t)))t[e]=process.env[e]??null;return t}function getDevelopmentEnvironmentLoader(e,t){let n=resolve(e),r=developmentEnvironmentLoaders.get(n);if(r!==void 0&&t===void 0)return r;let i=resolve(t??n);if(r?.environmentRoot===i)return r;let a=createDevelopmentEnvironmentLoader(i);return developmentEnvironmentLoaders.set(n,a),a}function createDevelopmentEnvironmentLoader(e){let t=new Set(Object.keys(process.env)),n=new Map,stageReload=()=>{let r=new Map(n),i=readDevelopmentEnvironmentValues(e),a=readProviderSettingsSync(e),o=new Set([...n.keys(),...i.keys(),MODEL_CONNECTION_ENV,`EVE_MODEL_TEAM`,`EVE_MODEL_TEAM_NAME`,`EVE_MODEL_KEY_SOURCE`]),s=new Map([...o].map(e=>[e,process.env[e]])),c=!1;a?process.env[MODEL_CONNECTION_ENV]=a.selected:delete process.env[MODEL_CONNECTION_ENV];let l=a?.keySource;return l?process.env.EVE_MODEL_KEY_SOURCE=l:delete process.env.EVE_MODEL_KEY_SOURCE,a?.teamId&&a.teamName?(process.env.EVE_MODEL_TEAM=a.teamId,process.env.EVE_MODEL_TEAM_NAME=a.teamName):(delete process.env.EVE_MODEL_TEAM,delete process.env.EVE_MODEL_TEAM_NAME),applyDevelopmentEnvironmentValues({managedValues:n,nextValues:i,protectedKeys:t}),{commit(){c=!0},rollback(){if(!c){c=!0,n.clear();for(let[e,t]of r)n.set(e,t);for(let[e,t]of s)t===void 0?delete process.env[e]:process.env[e]=t}}}};return{environmentRoot:e,reload(){stageReload().commit()},stageReload}}function applyDevelopmentEnvironmentValues(e){for(let[t,n]of e.managedValues)e.nextValues.has(t)||e.protectedKeys.has(t)||(process.env[t]===n&&delete process.env[t],e.managedValues.delete(t));for(let[t,n]of e.nextValues)e.protectedKeys.has(t)||(process.env[t]=n,e.managedValues.set(t,n))}export{getDevelopmentEnvironmentFilePaths,loadDevelopmentEnvironmentFiles,readDevelopmentEnvironmentHostValues,stageDevelopmentEnvironmentFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AgentInfoResponseError,ClientError}from"#client/index.js";import{isObject}from"#shared/guards.js";import{toErrorMessage}from"#shared/errors.js";import{formatVercelTrustedSourcesFailure,isVercelAuthChallenge,vercelTrustedSourcesErrorCode}from"#services/dev-client/vercel-auth-error.js";import{probeAgentInfo}from"#services/dev-client/agent-info-probe.js";function isEveOidcChallenge(e){if(!(e instanceof ClientError)||e.status!==401)return!1;try{let t=JSON.parse(e.body);return isObject(t)&&t.ok===!1&&t.code===`unauthorized`&&t.error===`Authorization is required for this route.`}catch{return!1}}function classifyRemoteError(e,t){if(isVercelAuthChallenge(e))return{state:`auth-required`,challenge:{kind:`vercel-deployment-protection`}};if(isEveOidcChallenge(e))return{state:`auth-required`,challenge:{kind:`eve-oidc`}};if(e instanceof ClientError){let n=vercelTrustedSourcesErrorCode(e.message);if(t===`connection-check`&&e.status===403&&n===`TRUSTED_SOURCES_ENVIRONMENT_MISMATCH`)return{state:`auth-required`,challenge:{kind:`vercel-deployment-protection`}};let r={message:formatVercelTrustedSourcesFailure(e.message)};return{state:`unavailable`,failure:n===void 0?r:{...r,code:n}}}return{state:`unavailable`,failure:{message:toErrorMessage(e)}}}async function probeDeploymentHealth(e){try{let t=await e.health();return isObject(t)&&t.ok===!0}catch{return!1}}async function probeRemoteInfo(e){let t=await probeAgentInfo({client:e.client});if(t.kind===`ready`)return{state:`ready`,info:t.info};let{error:n}=t;return(n instanceof AgentInfoResponseError||n instanceof ClientError&&n.status===404)&&await probeDeploymentHealth(e.client)?{state:`ready`}:classifyRemoteError(n,e.phase)}export{classifyRemoteError,probeRemoteInfo};
|
|
1
|
+
import{AgentInfoResponseError,ClientError}from"#client/index.js";import{isObject}from"#shared/guards.js";import{toErrorMessage}from"#shared/errors.js";import{formatVercelTrustedSourcesFailure,isVercelAuthChallenge,vercelTrustedSourcesErrorCode}from"#services/dev-client/vercel-auth-error.js";import{formatAgentInfoForbiddenMessage,isAgentInfoForbidden}from"#shared/agent-info-access.js";import{probeAgentInfo}from"#services/dev-client/agent-info-probe.js";function isEveOidcChallenge(e){if(!(e instanceof ClientError)||e.status!==401)return!1;try{let t=JSON.parse(e.body);return isObject(t)&&t.ok===!1&&t.code===`unauthorized`&&t.error===`Authorization is required for this route.`}catch{return!1}}function classifyRemoteError(e,t){if(isVercelAuthChallenge(e))return{state:`auth-required`,challenge:{kind:`vercel-deployment-protection`}};if(isEveOidcChallenge(e))return{state:`auth-required`,challenge:{kind:`eve-oidc`}};if(e instanceof ClientError){let n=vercelTrustedSourcesErrorCode(e.message);if(t===`connection-check`&&e.status===403&&n===`TRUSTED_SOURCES_ENVIRONMENT_MISMATCH`)return{state:`auth-required`,challenge:{kind:`vercel-deployment-protection`}};let r={message:formatVercelTrustedSourcesFailure(e.message)};return{state:`unavailable`,failure:n===void 0?r:{...r,code:n}}}return{state:`unavailable`,failure:{message:toErrorMessage(e)}}}async function probeDeploymentHealth(e){try{let t=await e.health();return isObject(t)&&t.ok===!0}catch{return!1}}async function probeRemoteInfo(e){let t=await probeAgentInfo({client:e.client});if(t.kind===`ready`)return{state:`ready`,info:t.info};let{error:n}=t;return(n instanceof AgentInfoResponseError||n instanceof ClientError&&n.status===404)&&await probeDeploymentHealth(e.client)?{state:`ready`}:isAgentInfoForbidden(n)&&await probeDeploymentHealth(e.client)?{state:`ready`,warning:formatAgentInfoForbiddenMessage(`The remote agent`)}:classifyRemoteError(n,e.phase)}export{classifyRemoteError,probeRemoteInfo};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PROMPT_COMMANDS,formatPromptCommandHelp,parsePromptCommand}from"./prompt-commands.js";import{formatFailureDetail,formatFailureMessage,interruptedError,isInterruptedError,localFailureHint}from"./errors.js";import{conversationView,isWorking,tuiSessionData}from"./conversation-view.js";import{parseLogDisplayMode}from"./log-display-mode.js";import{createMcpConnectionStatusTracker}from"./mcp-connection-status.js";import{describeRemoteAuthCompletedMutations}from"./remote-auth-result.js";import{createRemoteConnectionController}from"./remote-connection.js";import{prepareRemoteTuiAccess}from"./remote-startup.js";import{formatStrandedSessionNotice}from"./stranded-session.js";import{isTerminalToolCallPart}from"./terminal-tool-part.js";import{BOOT_DETECTIONS,CLI_MISSING_SETUP_ISSUE,LOGIN_SETUP_ISSUE,detectSetupIssues,formatSetupIssuesLine,normalizeLocalModelEndpoint,orderedSetupIssues}from"./setup-issues.js";import{TerminalRenderer}from"./terminal-renderer.js";import{createVercelStatusTracker}from"./vercel-status.js";import{optionStyle}from"#channel/interaction-prompts.js";import{activeTurn,delivery,failure,openInteractions,task,turn}from"#protocol/session-projection/public-view.js";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{getVercelAuthStatus}from"#setup/vercel-project.js";import{inspectApplication}from"#services/inspect-application.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{toErrorMessage}from"#shared/errors.js";import{isTaskAdmissionRefused}from"#protocol/task-tools.js";import{probeAgentInfo}from"#services/dev-client/agent-info-probe.js";import{APPROVE_OPTION_ID,DENY_OPTION_ID}from"#protocol/interaction-options.js";import"#client/conversation-state.js";import{SessionStore,attachSessionStore,detachSessionStore}from"#client/session-store.js";import{isAbortError}from"#client/session-store-helpers.js";import{renderApplicationInfo}from"#cli/commands/info.js";import{createDevelopmentRuntimeArtifactRefresher}from"#services/dev-client.js";function authIssueForStatus(e){if(e===`logged-out`)return LOGIN_SETUP_ISSUE;if(e===`cli-missing`)return CLI_MISSING_SETUP_ISSUE}function hasOpenTurn(e){return activeTurn(e.view)!==void 0}var EveTUIRunner=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=!1;#m;#h;#g=!0;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E=!1;#D;#O=!1;#k=new AbortController;#A=!1;#j=0;#M=0;#N=[];#P;#F;#I;#L;#R;#z=new Set;#B=new Set;#V=[];#H;#U=new Set;#W;#G=0;#K=new Set;#q=new Map;#J;constructor(e){if(this.#e=e.client,e.lifecycle!==void 0&&(this.#J=e.lifecycle),e.diagnostics!==void 0&&(this.#r=e.diagnostics),this.#n=createRenderer(e),this.#t=new SessionStore({client:e.client,followAgents:!0}),this.#t.setCallbacks({onEvent:e=>this.#Ue(e),onSessionChange:e=>{e!==void 0&&this.#n.setSessionId?.(e.sessionId)},prepareSend:e=>this.#ne(e)}),this.#i=e.name??`eve`,this.#y=e.withExclusiveTerminal,this.#a=e.formatTransportError??toErrorMessage,e.initialInput!==void 0&&(this.#l=e.initialInput),e.startup!==void 0&&(this.#u=e.startup),this.#f=e.onboard===!0,this.#m=e.onOnboardingStep,this.#h=e.onOnboardingTerminal,e.appRoot!==void 0){this.#c=e.appRoot;let t={appRoot:e.appRoot,onChange:e=>this.#n.setVercelStatus?.(e)};e.detectProjectIdentity!==void 0&&(t.detectIdentity=e.detectProjectIdentity),this.#F=createVercelStatusTracker(t),e.probeMcpConnection!==void 0&&(this.#I=createMcpConnectionStatusTracker({onChange:()=>{},probe:e.probeMcpConnection}))}e.promptCommandHandler!==void 0&&(this.#_=e.promptCommandHandler),this.#v=e.availablePromptCommands??PROMPT_COMMANDS,e.remote!==void 0&&(this.#x=e.remote.runAuthFlow,this.#b=createRemoteConnectionController({client:this.#e,credentials:e.remote.credentials,target:e.remote.target,onChange:e=>this.#n.setRemoteConnectionStatus?.(e),resolveOidcToken:e.remote.resolveOidcToken,resolveDeployment:e.remote.resolveDeployment})),this.#S=e.bootDetections??BOOT_DETECTIONS,this.#C=e.getVercelAuthStatus??getVercelAuthStatus,this.#w=e.inspectApplication??inspectApplication,e.onBootProgress!==void 0&&(this.#T=e.onBootProgress),e.serverUrl!==void 0&&(this.#s=e.serverUrl),e.serverUrl!==void 0&&e.remote===void 0&&(this.#o=createDevelopmentRuntimeArtifactRefresher({serverUrl:e.serverUrl}))}async#Y(){if(this.#s===void 0){this.#Q(),this.#f||await this.#we(void 0);return}let e;if(this.#b!==void 0){let t=await this.#b.check();t.state===`ready`&&(e=t.info)}else{let t=this.#e;if(t!==void 0)try{let n=await devBootPhase(`connecting to agent`,()=>probeAgentInfo({client:t,timeoutMs:2e3}),this.#T);n.kind===`ready`&&(e=n.info)}catch{e=void 0}}this.#Q();let t=this.#Z(e);this.#f||await this.#we(t)}#X(){let e=this.#u?.finish();return this.#d=e?.queuedPrompt,e?.draft??this.#l}#Z(e){let t=this.#c===void 0?e:normalizeLocalModelEndpoint(e,process.env);this.#L=t;let n=this.#s;if(n===void 0||this.#g)return t;let r={name:this.#i,serverUrl:n,localDevelopment:this.#c!==void 0};return t!==void 0&&(r.info=t),this.#n.renderAgentHeader?.(r),t}#Q(){let e=this.#T;this.#T=void 0,e?.({type:`before-first-paint`})}async run(){let onStop=()=>this.#n.requestInterrupt?.();this.#J?.signal.aborted===!0?onStop():this.#J?.signal.addEventListener(`abort`,onStop,{once:!0});let e=this.#t.subscribe(()=>this.#re());attachSessionStore(this.#t);try{await this.#$()}catch(e){if(!isInterruptedError(e))throw e}finally{this.#J?.signal.removeEventListener(`abort`,onStop),this.#E=!0,this.#k.abort(),this.#R?.abort(),e(),detachSessionStore(this.#t),this.#n.shutdown?.(),this.#F?.dispose(),this.#I?.dispose(),this.#b?.dispose()}}async#$(){let e=this.#i,t;this.#n.setStartupPhase?.(`starting`),await this.#Y(),this.#F?.refreshIdentity(),this.#I?.refresh();let n=(this.#f||this.#L?.agent.model.endpoint?.kind===`gateway`&&!this.#L.agent.model.endpoint.connected)&&this.#c!==void 0&&this.#_!==void 0&&this.#n.setupFlow!==void 0,r;if(this.#b!==void 0&&this.#n.setupFlow!==void 0){let e=await prepareRemoteTuiAccess({connection:this.#b,renderer:this.#n.setupFlow,signal:this.#J?.signal,runAuthFlow:this.#x});if(e?.kind===`authenticated`){let e=this.#b.current().connection;e.state===`ready`&&this.#Z(e.info)}else e?.kind===`failed`||e?.kind===`unavailable`?r={failed:!0,message:e.kind===`failed`?e.message:e.failure.message}:e?.kind===`cancelled`&&(r={cancelled:!0},e.completedMutations.length>0&&(r.message=`Completed before cancellation: ${describeRemoteAuthCompletedMutations(e.completedMutations).join(`, `)}.`))}n&&(this.#n.setStartupPhase?.(`connecting`),r=await this.#Ne(e));let
|
|
1
|
+
import{PROMPT_COMMANDS,formatPromptCommandHelp,parsePromptCommand}from"./prompt-commands.js";import{formatFailureDetail,formatFailureMessage,interruptedError,isInterruptedError,localFailureHint}from"./errors.js";import{conversationView,isWorking,tuiSessionData}from"./conversation-view.js";import{parseLogDisplayMode}from"./log-display-mode.js";import{createMcpConnectionStatusTracker}from"./mcp-connection-status.js";import{describeRemoteAuthCompletedMutations}from"./remote-auth-result.js";import{createRemoteConnectionController}from"./remote-connection.js";import{prepareRemoteTuiAccess}from"./remote-startup.js";import{formatStrandedSessionNotice}from"./stranded-session.js";import{isTerminalToolCallPart}from"./terminal-tool-part.js";import{BOOT_DETECTIONS,CLI_MISSING_SETUP_ISSUE,LOGIN_SETUP_ISSUE,detectSetupIssues,formatSetupIssuesLine,normalizeLocalModelEndpoint,orderedSetupIssues}from"./setup-issues.js";import{TerminalRenderer}from"./terminal-renderer.js";import{createVercelStatusTracker}from"./vercel-status.js";import{optionStyle}from"#channel/interaction-prompts.js";import{activeTurn,delivery,failure,openInteractions,task,turn}from"#protocol/session-projection/public-view.js";import{loadDevelopmentEnvironmentFiles}from"#cli/dev/environment.js";import{getVercelAuthStatus}from"#setup/vercel-project.js";import{inspectApplication}from"#services/inspect-application.js";import{devBootPhase}from"#internal/dev-boot-progress.js";import{toErrorMessage}from"#shared/errors.js";import{isTaskAdmissionRefused}from"#protocol/task-tools.js";import{probeAgentInfo}from"#services/dev-client/agent-info-probe.js";import{APPROVE_OPTION_ID,DENY_OPTION_ID}from"#protocol/interaction-options.js";import"#client/conversation-state.js";import{SessionStore,attachSessionStore,detachSessionStore}from"#client/session-store.js";import{isAbortError}from"#client/session-store-helpers.js";import{renderApplicationInfo}from"#cli/commands/info.js";import{createDevelopmentRuntimeArtifactRefresher}from"#services/dev-client.js";function authIssueForStatus(e){if(e===`logged-out`)return LOGIN_SETUP_ISSUE;if(e===`cli-missing`)return CLI_MISSING_SETUP_ISSUE}function hasOpenTurn(e){return activeTurn(e.view)!==void 0}var EveTUIRunner=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=!1;#m;#h;#g=!0;#_;#v;#y;#b;#x;#S;#C;#w;#T;#E=!1;#D;#O=!1;#k=new AbortController;#A=!1;#j=0;#M=0;#N=[];#P;#F;#I;#L;#R;#z=new Set;#B=new Set;#V=[];#H;#U=new Set;#W;#G=0;#K=new Set;#q=new Map;#J;constructor(e){if(this.#e=e.client,e.lifecycle!==void 0&&(this.#J=e.lifecycle),e.diagnostics!==void 0&&(this.#r=e.diagnostics),this.#n=createRenderer(e),this.#t=new SessionStore({client:e.client,followAgents:!0}),this.#t.setCallbacks({onEvent:e=>this.#Ue(e),onSessionChange:e=>{e!==void 0&&this.#n.setSessionId?.(e.sessionId)},prepareSend:e=>this.#ne(e)}),this.#i=e.name??`eve`,this.#y=e.withExclusiveTerminal,this.#a=e.formatTransportError??toErrorMessage,e.initialInput!==void 0&&(this.#l=e.initialInput),e.startup!==void 0&&(this.#u=e.startup),this.#f=e.onboard===!0,this.#m=e.onOnboardingStep,this.#h=e.onOnboardingTerminal,e.appRoot!==void 0){this.#c=e.appRoot;let t={appRoot:e.appRoot,onChange:e=>this.#n.setVercelStatus?.(e)};e.detectProjectIdentity!==void 0&&(t.detectIdentity=e.detectProjectIdentity),this.#F=createVercelStatusTracker(t),e.probeMcpConnection!==void 0&&(this.#I=createMcpConnectionStatusTracker({onChange:()=>{},probe:e.probeMcpConnection}))}e.promptCommandHandler!==void 0&&(this.#_=e.promptCommandHandler),this.#v=e.availablePromptCommands??PROMPT_COMMANDS,e.remote!==void 0&&(this.#x=e.remote.runAuthFlow,this.#b=createRemoteConnectionController({client:this.#e,credentials:e.remote.credentials,target:e.remote.target,onChange:e=>this.#n.setRemoteConnectionStatus?.(e),resolveOidcToken:e.remote.resolveOidcToken,resolveDeployment:e.remote.resolveDeployment})),this.#S=e.bootDetections??BOOT_DETECTIONS,this.#C=e.getVercelAuthStatus??getVercelAuthStatus,this.#w=e.inspectApplication??inspectApplication,e.onBootProgress!==void 0&&(this.#T=e.onBootProgress),e.serverUrl!==void 0&&(this.#s=e.serverUrl),e.serverUrl!==void 0&&e.remote===void 0&&(this.#o=createDevelopmentRuntimeArtifactRefresher({serverUrl:e.serverUrl}))}async#Y(){if(this.#s===void 0){this.#Q(),this.#f||await this.#we(void 0);return}let e;if(this.#b!==void 0){let t=await this.#b.check();t.state===`ready`&&(e=t.info)}else{let t=this.#e;if(t!==void 0)try{let n=await devBootPhase(`connecting to agent`,()=>probeAgentInfo({client:t,timeoutMs:2e3}),this.#T);n.kind===`ready`&&(e=n.info)}catch{e=void 0}}this.#Q();let t=this.#Z(e);this.#f||await this.#we(t)}#X(){let e=this.#u?.finish();return this.#d=e?.queuedPrompt,e?.draft??this.#l}#Z(e){let t=this.#c===void 0?e:normalizeLocalModelEndpoint(e,process.env);this.#L=t;let n=this.#s;if(n===void 0||this.#g)return t;let r={name:this.#i,serverUrl:n,localDevelopment:this.#c!==void 0};return t!==void 0&&(r.info=t),this.#n.renderAgentHeader?.(r),t}#Q(){let e=this.#T;this.#T=void 0,e?.({type:`before-first-paint`})}async run(){let onStop=()=>this.#n.requestInterrupt?.();this.#J?.signal.aborted===!0?onStop():this.#J?.signal.addEventListener(`abort`,onStop,{once:!0});let e=this.#t.subscribe(()=>this.#re());attachSessionStore(this.#t);try{await this.#$()}catch(e){if(!isInterruptedError(e))throw e}finally{this.#J?.signal.removeEventListener(`abort`,onStop),this.#E=!0,this.#k.abort(),this.#R?.abort(),e(),detachSessionStore(this.#t),this.#n.shutdown?.(),this.#F?.dispose(),this.#I?.dispose(),this.#b?.dispose()}}async#$(){let e=this.#i,t;this.#n.setStartupPhase?.(`starting`),await this.#Y(),this.#F?.refreshIdentity(),this.#I?.refresh();let n=(this.#f||this.#L?.agent.model.endpoint?.kind===`gateway`&&!this.#L.agent.model.endpoint.connected)&&this.#c!==void 0&&this.#_!==void 0&&this.#n.setupFlow!==void 0,r;if(this.#b!==void 0&&this.#n.setupFlow!==void 0){let e=await prepareRemoteTuiAccess({connection:this.#b,renderer:this.#n.setupFlow,signal:this.#J?.signal,runAuthFlow:this.#x});if(e?.kind===`authenticated`){let e=this.#b.current().connection;e.state===`ready`&&this.#Z(e.info)}else e?.kind===`failed`||e?.kind===`unavailable`?r={failed:!0,message:e.kind===`failed`?e.message:e.failure.message}:e?.kind===`cancelled`&&(r={cancelled:!0},e.completedMutations.length>0&&(r.message=`Completed before cancellation: ${describeRemoteAuthCompletedMutations(e.completedMutations).join(`, `)}.`))}let i=this.#b?.current().connection;r===void 0&&i?.state===`ready`&&i.warning!==void 0&&(r={message:i.warning}),n&&(this.#n.setStartupPhase?.(`connecting`),r=await this.#Ne(e));let a=this.#X();for(r?.cancelled||r?.failed?a=[this.#d,a].filter(Boolean).join(`
|
|
2
2
|
|
|
3
|
-
`)||void 0:t=this.#d,this.#g=!1,this.#Z(this.#L),this.#Te(),this.#n.setStartupPhase?.(void 0),(!n||r?.cancelled||r?.failed)&&r?.message!==void 0&&this.#Oe({kind:`result`,message:r.message});this.#J?.signal.aborted!==!0&&this.#n.exitRequested?.()!==!0;){if(this.#ie()){this.#me();continue}if(this.#de().length>0){await this.#fe(e);continue}let n=isWorking(this.#t.snapshot.status)?void 0:this.#V.shift();if(n!==void 0){this.#H=n;try{await this.#Ce(n)}finally{this.#H=void 0}continue}if(t===void 0){let n=await this.#be({title:e,initialDraft:
|
|
3
|
+
`)||void 0:t=this.#d,this.#g=!1,this.#Z(this.#L),this.#Te(),this.#n.setStartupPhase?.(void 0),(!n||r?.cancelled||r?.failed)&&r?.message!==void 0&&this.#Oe({kind:`result`,message:r.message});this.#J?.signal.aborted!==!0&&this.#n.exitRequested?.()!==!0;){if(this.#ie()){this.#me();continue}if(this.#de().length>0){await this.#fe(e);continue}let n=isWorking(this.#t.snapshot.status)?void 0:this.#V.shift();if(n!==void 0){this.#H=n;try{await this.#Ce(n)}finally{this.#H=void 0}continue}if(t===void 0){let n=await this.#be({title:e,initialDraft:a});if(a=void 0,n===void 0)continue;if(n.type===`cancel`){this.#_e();continue}if(n.type===`interrupt`){this.#me(`Stopped following the turn and started a new session. Earlier context was cleared; the interrupted turn may still be running on the server.`);continue}t=n.text}let r=t;t=void 0;let i=parsePromptCommand(r);if(i===null){this.#te(r);continue}let o=await this.#ee(i,e);if(o===`exit`)return;o!==void 0&&(a=o.draft)}}async#ee(e,t){switch(e.type){case`exit`:return this.#Oe({kind:`dismiss`}),this.#J?.requestStop(),`exit`;case`cancel`:{let e=hasOpenTurn(this.#t.snapshot);e&&this.#_e(),this.#Oe({kind:`result`,summary:e?`Cancellation requested`:`No active turn to cancel`});return}case`new`:await this.#ye();return;case`compact`:await this.#ve({absent:`No active session to compact`,accepted:`Compaction requested`,failed:`Couldn't compact the session`,invoke:()=>this.#t.compact()});return;case`clear`:await this.#ve({absent:`No active session to clear`,accepted:`Session context cleared`,failed:`Couldn't clear the session`,invoke:()=>this.#t.clear()});return;case`help`:{if(this.#n.choosePromptCommand===void 0){this.#Oe({kind:`result`,message:formatPromptCommandHelp(this.#v)});return}let e=await this.#n.choosePromptCommand(this.#v);return e===void 0?void 0:{draft:e}}case`info`:await this.#Ie();return;case`loglevel`:{let t=this.#Le(e.argument),n=t.startsWith(`/loglevel is not available`)||t.startsWith(`Unknown log level`);this.#Oe(n?{kind:`result`,message:t}:{kind:`result`,summary:t});return}case`traces`:await this.#Fe(e.argument);return;case`extension`:await this.#Me(e,t,{trigger:`command`});return}}#te(e){let t=this.#t.snapshot,n=hasOpenTurn(t),r={text:e};this.#D=r,n||(this.#O=!1);let i=n?{message:e,turnPolicy:`steer`}:t.session===void 0?{message:e}:{message:e,turnPolicy:`queue`};this.#t.send(i).then(({deliveryId:e})=>{r.deliveryId=e,this.#E||this.#ae(this.#t.snapshot)}).catch(e=>{this.#E||isAbortError(e)||this.#se(n?`Steering failed`:`Error`,e)})}async#ne(e){return e.turnPolicy===`steer`?e:(this.#o!==void 0&&await this.#o.refresh({answers:e.answers,message:typeof e.message==`string`?e.message:void 0,onRuntimeArtifactsChanged:()=>this.#Ve()}),e.message!==void 0&&this.#n.flushDelayedDevBuildErrors?.(),e)}#re(){let e=this.#t.snapshot,t=tuiSessionData(e);this.#n.renderConversation?.(conversationView(e,t,this.#c===void 0?void 0:localFailureHint)),this.#oe(e.error,t.sessionFailed),this.#We(t.failures),this.#He(e),this.#ue(e),this.#Se(e),this.#ae(e),(t.sessionFailed||this.#de().length>0||!isWorking(e.status)&&this.#V.length>0)&&this.#R?.abort()}#ie(){return tuiSessionData(this.#t.snapshot).sessionFailed}#ae(e){let t=this.#D;if(t?.deliveryId===void 0)return;let n=delivery(e.view,t.deliveryId)?.turnId;if(n===void 0)return;let r=turn(e.view,n);if(r===void 0||r.status===`running`)return;let i=r.outcome;this.#D=void 0,i===`cancelled`&&!this.#O&&failure(e.view,n)===void 0&&this.#n.restoreDraft?.(t.text)}#oe(e,t){e!==void 0&&e!==this.#W&&(this.#W=e,!t&&(this.#le(e)||(this.#b?.reportFailure(e),this.#n.renderError?.(`Error`,this.#a(e)))))}#se(e,t){this.#le(t)||this.#n.renderError?.(e,this.#a(t))}#ce(e){return formatStrandedSessionNotice(e,{localServer:this.#c!==void 0,sessionId:this.#t.snapshot.session?.sessionId})}#le(e){let t=this.#ce(e);return t!==void 0&&(this.#n.renderError?.(`Session stranded`,t),!0)}#ue(e){!this.#f||this.#p||!e.messages.some(e=>e.role===`assistant`&&e.parts.some(e=>e.type===`text`&&e.text.length>0))||(this.#p=!0,this.#m?.({flow:`onboarding`,step:`first_response`}))}#de(){return openInteractions(this.#t.snapshot.view).filter(e=>e.request.kind!==`sign-in`&&!this.#z.has(e.interactionId)&&!this.#B.has(e.interactionId))}async#fe(e){for(let t=0;;t+=1){let n=this.#de(),r=n[0];if(r===void 0)return;let i=inputContext(r,t+1,t+n.length),a=await this.#pe(r,i,e);if(a===void 0){this.#z.add(r.interactionId);continue}this.#B.add(r.interactionId),this.#t.send({answers:[a]}).catch(e=>{this.#B.delete(r.interactionId),!(this.#E||isAbortError(e))&&this.#se(`Error`,e)})}}async#pe(e,t,n){if(e.request.kind===`approval`){if(!this.#n.readToolApproval)throw Error(`Tool approval was requested, but the renderer does not support tool approval input.`);let r=await this.#n.readToolApproval(toAgentTUIToolApprovalRequest(e,t),{title:n});return{interactionId:e.interactionId,optionId:r.approved?APPROVE_OPTION_ID:DENY_OPTION_ID}}if(!this.#n.readInputQuestion)throw Error(`An interactive question was requested, but the renderer does not support input questions.`);let r=await this.#n.readInputQuestion(toAgentTUIInputQuestion(e,t),{title:n});if(r!==void 0)return{interactionId:e.interactionId,...r.optionId!==void 0&&{optionId:r.optionId},...r.text!==void 0&&{text:r.text}}}#me(e){this.#n.renderSessionBoundary===void 0?e===void 0&&this.#n.renderNotice?.(`Session ended — started a new session. Earlier context was cleared.`):this.#n.renderSessionBoundary(),e!==void 0&&this.#n.renderNotice?.(e),this.#he()}#he(){this.#t.newSession(),this.#ge()}#ge(){this.#z.clear(),this.#B.clear(),this.#U.clear(),this.#q.clear(),this.#G=0,this.#o?.clear()}#_e(){this.#O=!0,this.#t.cancel().catch(e=>{this.#n.renderNotice?.(`Couldn't cancel the turn: ${toErrorMessage(e)}`)})}async#ve(e){if(this.#t.snapshot.session===void 0){this.#Oe({kind:`result`,summary:e.absent});return}try{let t=await(await e.invoke()).result();if(t.status!==`completed`)throw Error(`The command settled ${t.status}.`);this.#Oe({kind:`result`,summary:e.accepted})}catch(t){this.#Oe({kind:`result`,message:this.#ce(t)??toErrorMessage(t),summary:e.failed})}}async#ye(){try{this.#t.snapshot.session!==void 0&&await(await this.#t.end()).result(),this.#t.newSession()}catch(e){this.#Oe({kind:`result`,message:`Couldn't end the session: ${toErrorMessage(e)}`});return}this.#ge(),this.#n.reset?.(),this.#Oe({kind:`dismiss`})}async#be(e){if(!this.#n.readInput)throw Error(`The renderer does not support prompt input.`);let t=new AbortController;this.#R=t;try{let n=await this.#xe(this.#n.readInput({...e,signal:t.signal}));if(n===void 0&&!t.signal.aborted)throw interruptedError();return n}finally{this.#R===t&&(this.#R=void 0)}}async#xe(e){let t=this.#o;if(t===void 0)return await e;let n=!1,r=!1,i,a=!1,o=0,refresh=async()=>{if(!(n||r)){r=!0;try{await t.refreshIdle({onRuntimeArtifactsChanged:()=>this.#Ve()}),this.#c!==void 0&&this.#L===void 0&&!a&&(a=!0,this.#ze().finally(()=>{a=!1}));let e=this.#L?.agent.model.endpoint,n=e?.kind===`chatgpt`&&(e.state===`signed-out`||e.state===`reauth-required`),r=Date.now();n&&r-o>=5e3&&(o=r,this.#ze())}finally{r=!1}}},startRefresh=()=>{if(n||r)return;let e=refresh().finally(()=>{i===e&&(i=void 0)});i=e};startRefresh();let s=setInterval(()=>{startRefresh()},500);s.unref?.();try{return await e}finally{n=!0,clearInterval(s),await i}}#Se(e){if(this.#c!==void 0)for(let{callId:t,address:n}of registryHandoffs(e))this.#U.has(t)||(this.#U.add(t),!(this.#H===n||this.#V.includes(n))&&this.#V.push(n))}async#Ce(e){this.#n.renderCommandInvocation?.(`/add ${e}`),await this.#Me({type:`extension`,name:`add`,argument:e},`Add to your agent`,{trigger:`command`})}async#we(e){if(this.#c===void 0)return;let t={appRoot:this.#c,env:process.env};e!==void 0&&(t.info=e),this.#N=await detectSetupIssues(t,this.#S),this.#n.renderSetupWarning!==void 0&&(this.#Te(),this.#Ee())}#Te(){if(this.#g)return;let e=orderedSetupIssues(this.#N,this.#P);e.length>0?this.#n.renderSetupWarning?.(formatSetupIssuesLine(e)):this.#n.clearSetupWarning?.()}async#Ee(){let e=this.#c;if(e===void 0||process.env.EVE_MODEL_CONNECTION!==`ai-gateway-project`)return;let t;try{t=await this.#C(e,{signal:this.#k.signal})}catch{return}this.#E||this.#A||(this.#P=authIssueForStatus(t),this.#Te())}async#De(e){let t=this.#c;if(t===void 0||this.#n.renderSetupWarning===void 0)return;let n=++this.#j,r={appRoot:t,env:process.env};e!==void 0&&(r.info=e);try{let[e,i]=await Promise.all([detectSetupIssues(r,this.#S),process.env.EVE_MODEL_CONNECTION===`ai-gateway-project`?this.#C(t,{signal:this.#k.signal}):void 0]);if(this.#E||n!==this.#j)return;this.#N=e,this.#P=i===void 0?void 0:authIssueForStatus(i),this.#Te()}catch{return}}#Oe(e){if(this.#n.finishCommand!==void 0){this.#n.finishCommand(e);return}if(e.kind===`result`){let t=[e.summary,e.message].filter(Boolean).join(`
|
|
4
4
|
`);t!==``&&this.#n.renderNotice?.(t)}}async#ke(e,t){let n=this.#_;if(n===void 0)return{message:`/${e.name} is not available in this session.`};let r=this.#L?.agent.model.endpoint,i={...t,renderer:this.#n,settleOutcome:e=>this.#je(e),chatGptAccountLabel:r?.kind===`chatgpt`&&r.state===`ready`?r.accountLabel:void 0,withExclusiveTerminal:this.#y},a=this.#I?.current(),o=a!==void 0&&Object.keys(a).length>0?{...i,disabledConnectionReasons:a}:i;return await n.handle(e,o)}async#Ae(e){if(e?.kind===`model-access-changed`){this.#F?.applyEffect({kind:`refresh-identity`}),this.#A=!0,await this.#Re(e);return}e!==void 0&&(this.#F?.applyEffect(e),this.#A=!0,this.#De(this.#L))}async#je(e){if(e.effect===void 0)return e;let t=e.effect.kind===`model-access-changed`&&e.effect.reload?setTimeout(()=>{this.#g&&this.#n.setStartupPhase?.(`updating`),this.#n.setupFlow?.setStatus(`Loading selected model…`)},150):void 0;try{await this.#Ae(e.effect);let{effect:t,...n}=e;return n}catch{return{failed:!0,message:`Settings were saved, but the agent could not reload. Retry the command or restart eve dev.`}}finally{clearTimeout(t)}}async#Me(e,t,n){let r=await this.#ke(e,{...n,title:t}),i=r===void 0?void 0:await this.#je(r);return!(n.suppressSuccessfulTranscript===!0&&i?.failed!==!0||n.suppressCancelledTranscript===!0&&i?.cancelled===!0)&&n.trigger!==`startup`&&(i===void 0?this.#Oe({kind:`result`}):this.#Oe({kind:`result`,message:i.message,summary:i.summary})),this.#Pe(),i}async#Ne(e){this.#m?.({flow:`onboarding`,step:`model_provider`});let t=await this.#Me({type:`extension`,name:`login`,argument:``},e,{trigger:`startup`,initialModelStep:`provider`});return!t?.cancelled&&t?.failed!==!0&&this.#m?.({flow:`onboarding`,step:`connection_ready`}),this.#h?.({flow:`onboarding`,step:`model_provider`,result:t?.cancelled?`cancelled`:t?.failed===!0?`error`:`completed`}),t}#Pe(){if(this.#g)return;let e=this.#b?.current().connection;e?.state===`ready`&&e.info!==this.#L&&(this.#L=e.info,this.#s!==void 0&&this.#n.renderAgentHeader?.({info:e.info,name:this.#i,serverUrl:this.#s}))}async#Fe(e){if(this.#c===void 0||this.#n.traceViewer===void 0){this.#Oe({kind:`result`,message:`/traces is only available in local dev sessions.`});return}try{await this.#n.traceViewer.open({appRoot:this.#c,sessionId:this.#t.snapshot.session?.sessionId,reference:e===``?void 0:e})}catch(e){if(isInterruptedError(e))return;throw e}finally{this.#Oe({kind:`dismiss`})}}async#Ie(){let e=this.#c;if(e===void 0){this.#Oe({kind:`result`,message:`/info is only available in local dev sessions.`});return}try{let t=renderApplicationInfo(await this.#w(e));this.#n.showInfoPanel===void 0?this.#Oe({kind:`result`,message:t}):await this.#n.showInfoPanel(t)}catch(e){this.#Oe({kind:`result`,message:`Couldn't inspect the application: ${toErrorMessage(e)}`})}}#Le(e){let t=this.#n;if(t.logDisplayMode===void 0||t.setLogDisplayMode===void 0)return`/loglevel is not available in this session.`;if(e===``)return`Logs: ${t.logDisplayMode()}. Use /loglevel none|error|warn|debug|all — logs stay buffered, so switching also hides or restores past lines.`;let n=parseLogDisplayMode(e);if(n===void 0)return`Unknown log level "${e}". Use none, error, warn, debug, or all.`;if(n===t.logDisplayMode())return`Logs already set to ${n}.`;switch(t.setLogDisplayMode(n),n){case`none`:return`Logs hidden. Output stays buffered — /loglevel all restores it.`;case`error`:return`Showing errors.`;case`warn`:return`Showing warnings and errors.`;case`debug`:return`Showing all severity-tagged logs.`;case`all`:return`Showing all logs.`}}async#Re(e){let t=this.#c;t!==void 0&&(++this.#M,++this.#j,await loadDevelopmentEnvironmentFiles(t),e.reload&&await this.#o?.refreshAfterSourceChange({}),e.model&&this.#L?this.#Z({...this.#L,agent:{...this.#L.agent,model:{...this.#L.agent.model,...e.model}}}):this.#Z(this.#L),this.#N=[],this.#P=void 0,this.#Te(),this.#ze())}async#ze(e=!1){let t=this.#L,n=++this.#M,r=await this.#Be();this.#E||n!==this.#M||r===void 0||(this.#Z(r),e&&!this.#n.renderAgentHeader&&this.#n.renderNotice?.(formatAgentUpdateNotice(t,r)),this.#De(this.#L))}async#Be(){let e=this.#e;if(e===void 0)return;let t=await probeAgentInfo({client:e});return t.kind===`ready`?t.info:void 0}#Ve(){this.#ze(!0)}#He(e){let t=this.#r;if(t!==void 0){for(let n of Object.values(e.agents))if(n.observation.status!==`not-followed`)for(let e of n.observation.conversation?.messages??[])for(let r of e.parts)r.type===`tool`&&r.state===`failed`&&(this.#K.has(r.callId)||(this.#K.add(r.callId),t.append({source:`tool`,summary:`${r.name} failed (subagent ${n.name})`,detail:r.error?.message??`Failed.`})))}}#Ue(e){let t=this.#r;if(t!==void 0)switch(e.type){case`call.requested`:this.#q.set(e.data.callId,e.data.capability.name),e.data.capability.kind===`tool`&&t.recordToolCall(e.data.capability.name);break;case`call.settled`:{let n=this.#q.get(e.data.callId)??e.data.callId;isTaskAdmissionRefused(e.data)?t.append({source:`tool`,summary:`${n} was refused for the model to retry`,detail:e.data.error?.message??`Refused.`}):e.data.outcome===`failed`&&t.append({source:`tool`,summary:`${n} failed`,detail:e.data.error?.message??`Tool failed.`});break}case`task.ended`:e.data.outcome===`failed`&&t.append({source:`tool`,summary:`${task(this.#t.snapshot.view,e.data.taskId)?.name??`A task`} ended with an error`,detail:e.data.error?.message??`Task failed.`});break;case`child.opened`:`callId`in e.data.owner&&t.recordSubagentDispatch(e.data.owner.callId);break;case`usage.recorded`:t.recordStepUsage(e.data.usage)}}#We(e){e.length<this.#G&&(this.#G=0);for(let{error:t}of e.slice(this.#G)){let e=formatFailureMessage(t),n={detail:formatFailureDetail(t)??e,source:`workflow`,summary:`Error: ${e}`};this.#r?.append(t.hint===void 0?n:{...n,hint:t.hint})}this.#G=e.length}};function createRenderer(e){return e.renderer?e.renderer:new TerminalRenderer({tools:e.tools,reasoning:e.reasoning,subagents:e.subagents,connectionAuth:e.connectionAuth,assistantResponseStats:e.assistantResponseStats,contextSize:e.contextSize,logs:e.logs,availablePromptCommands:e.availablePromptCommands,argumentSuggestions:e.argumentSuggestions,input:e.userInput,output:e.screen,diagnostics:e.diagnostics,onExitRequest:e.lifecycle?.requestStop})}function formatAgentUpdateNotice(e,t){let n=e?.agent.model.id,r=t?.agent.model.id;return n!==void 0&&r!==void 0&&n!==r?`Agent updated: Model ${n} -> ${r}`:`Agent updated.`}function registryHandoffs(e){let t=[],collect=(e,n)=>{for(let r of e.messages)for(let e of r.parts){if(!isTerminalToolCallPart(e)||e.state!==`completed`)continue;let r=registryHandoffAddress(n,e.name,e.output);r!==void 0&&t.push({callId:e.callId,address:r})}};for(let t of Object.values(e.agents)){if(t.observation.status===`not-followed`)continue;let e=t.observation.conversation;e!==void 0&&collect(e,t.name)}return t}function registryHandoffAddress(e,t,n){if(e!==`self-modification__agent`||t!==`registry_add`||typeof n!=`object`||!n)return;let r=n;return r.status===`needs-terminal`&&typeof r.address==`string`?r.address:void 0}function inputContext(e,t,n){let r={};return n>1&&(r.position={index:t,total:n}),e.taskId!==void 0&&(r.taskId=e.taskId),r.position===void 0&&r.taskId===void 0?void 0:r}function toAgentTUIToolApprovalRequest(e,t){let n={approvalId:e.interactionId,toolCallId:e.call?.callId??e.interactionId,toolName:e.call?.name??e.request.kind,prompt:e.request.prompt,input:e.call?.input??{}};return t!==void 0&&(n.context=t),n}function toAgentTUIInputQuestion(e,t){let n=e.request.display===`text`?`text`:e.request.display===`select`||e.request.options!==void 0&&e.request.options.length>0?`select`:`text`,r={requestId:e.interactionId,prompt:e.request.prompt,display:n};return e.request.options!==void 0&&(r.options=e.request.options.map(e=>{let t={id:e.id,label:e.label};e.description!==void 0&&(t.description=e.description);let n=optionStyle(e);return n!==void 0&&(t.style=n),t})),e.request.allowFreeform!==void 0&&(r.allowFreeform=e.request.allowFreeform),t!==void 0&&(r.context=t),r}export{EveTUIRunner,registryHandoffAddress};
|
|
@@ -2,7 +2,7 @@ import type { Theme } from "./theme.js";
|
|
|
2
2
|
import type { LogDisplayMode } from "./log-display-mode.js";
|
|
3
3
|
import type { RemoteConnectionSnapshot } from "./remote-connection.js";
|
|
4
4
|
import type { VercelStatusSnapshot } from "./vercel-status.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { AgentInfoResult } from "#client/index.js";
|
|
6
6
|
export interface DevBuildStatus {
|
|
7
7
|
readonly phase: "building" | "complete";
|
|
8
8
|
readonly summary: string;
|
|
@@ -26,7 +26,7 @@ interface StatusLineInput {
|
|
|
26
26
|
*/
|
|
27
27
|
logLevel?: LogDisplayMode;
|
|
28
28
|
/** Model endpoint readiness: external, or AI Gateway connected/not-connected. */
|
|
29
|
-
endpoint?:
|
|
29
|
+
endpoint?: AgentInfoResult["agent"]["model"]["endpoint"];
|
|
30
30
|
/** Workspace-scoped Vercel state; identity absent while unlinked or still resolving. */
|
|
31
31
|
vercel?: VercelStatusSnapshot;
|
|
32
32
|
/** Remote server identity and its current connection/authentication state. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{remoteHost}from"./target.js";import{clipVisible,stripAnsi,visibleLength}from"#cli/ui/terminal-text.js";import{formatModelSummary}from"#shared/model-summary.js";function formatDevBuildStatus(e,t){let n=e.phase===`complete`;return`${n?t.glyph.success:t.glyph.validating} ${n?e.summary.replace(/ changed$/u,` updated`):`${e.summary.replace(/ (?:added|changed|removed)$/u,``)} updating…`}`}function renderModel(e){let t=e.theme.colors;if(e.model===void 0&&e.dynamicModel!==!0)return;let n={model:e.model??`dynamic model`};e.reasoning!==void 0&&(n.reasoning=e.reasoning),e.remote!==void 0&&(n.model=stripAnsi(n.model).replace(/\s+/gu,` `).trim()),(e.fastMode===!0||n.model.endsWith(`-fast`))&&(n.fastGlyph=e.theme.glyph.fast);let r=`${e.dynamicModel===!0&&e.model!==void 0?`dynamic model · `:``}${formatModelSummary(n)}`;return t.dim(e.remote===void 0?r:stripAnsi(r).replace(/\s+/gu,` `).trim())}const EXTERNAL_PROVIDER_DISPLAY_NAMES={codex:`chatgpt-sub`};function renderEndpoint(e){if(e.remote!==void 0||e.endpoint===void 0)return;let t=e.theme.colors,n=e.theme.glyph,clause=(e,n)=>`${e}${t.dim(n)}`;if(e.endpoint.kind===`external`){let r=EXTERNAL_PROVIDER_DISPLAY_NAMES[e.endpoint.provider]??e.endpoint.provider;return`${t.dim(r)}${n.external}`}if(e.endpoint.kind===`chatgpt`)switch(e.endpoint.state){case`ready`:return`${t.dim(`chatgpt-sub`)}${n.external}`;case`checking`:return t.dim(`chatgpt-sub checking…`);case`signed-out`:case`reauth-required`:return t.yellow(`${n.warning} chatgpt-sub login · /login`);case`unavailable`:return t.yellow(`${n.warning} chatgpt-sub unavailable`)}if(!e.endpoint.connected)return t.yellow(`${n.warning} ai-gateway`);if(e.endpoint.credential===`api-key`)return clause(`ai-gateway`,`(api-key)`);if(e.endpoint.credential===`oauth`){let n=e.vercel?.modelTeamSlug;return t.dim(n?`Vercel · ${n}`:`Vercel`)}let r=e.vercel?.identity?.projectName;return clause(`ai-gateway`,`(${r===void 0?`oidc`:`oidc:${r}`})`)}function buildStatusLine(e){let{theme:t,width:n}=e,r=t.colors,i=e.devBuild===void 0?void 0:formatDevBuildStatus(e.devBuild,t),a=e.logLevel===void 0?void 0:r.cyan(`logs: ${e.logLevel}`),o=renderModel(e),s=e.remote===void 0?void 0:formatRemoteStatus(e.remote,t),c=renderEndpoint(e),l=s?.full,u=s?.badge,d=r.dim(` · `),compose=(e,t)=>{let n=t.filter(e=>e!==void 0).join(d);return e===void 0||n.length===0?e??n:`${e} ${n}`},f=[compose(l,[a,o,c]),compose(l,[a,o]),compose(l,[a]),compose(u,[a]),compose(u,[])];if(i!==void 0){for(let e of f){let t=visibleLength(e),r=visibleLength(i);if(!(t+(t>0?2:0)+r>n))return`${e}${` `.repeat(n-t-r)}${i}`}return clipVisible(i,n)}if(f[0].length===0)return;for(let e of f)if(e.length>0&&visibleLength(e)<=n)return e;let p=f.findLast(e=>e.length>0);return clipVisible(p,n)}function formatRemoteStatus(e,t){let n=t.colors,r=e.deployment===void 0?remoteHost(e.target):`${e.deployment.projectName} (${e.deployment.environment})`,i=formatRemoteBadge(` ${t.unicode?`↗`:`->`} ${r} `,e.connection.state,t),a;switch(e.connection.state){case`checking`:a=n.dim(`Checking access…`);break;case`ready`:break;case`auth-required`:a=n.yellow(`Authenticate via OIDC`);break;case`authenticating`:a=n.dim(`Authenticating via OIDC…`);break;case`auth-failed`:a=n.yellow(`Authentication failed`);break;case`unavailable`:a=n.yellow(`Remote unavailable`)}return{badge:i,full:a===void 0?i:`${i} ${a}`}}function formatRemoteBadge(e,t,n){let r=n.colors;switch(t){case`checking`:return r.inverse(r.gray(e));case`ready`:return r.inverse(r.blue(e));case`unavailable`:case`auth-required`:case`authenticating`:case`auth-failed`:return r.inverse(r.yellow(e))}}export{buildStatusLine};
|
|
1
|
+
import{remoteHost}from"./target.js";import{clipVisible,stripAnsi,visibleLength}from"#cli/ui/terminal-text.js";import{formatModelSummary}from"#shared/model-summary.js";function formatDevBuildStatus(e,t){let n=e.phase===`complete`;return`${n?t.glyph.success:t.glyph.validating} ${n?e.summary.replace(/ changed$/u,` updated`):`${e.summary.replace(/ (?:added|changed|removed)$/u,``)} updating…`}`}function renderModel(e){let t=e.theme.colors;if(e.model===void 0&&e.dynamicModel!==!0)return;let n={model:e.model??`dynamic model`};e.reasoning!==void 0&&(n.reasoning=e.reasoning),e.remote!==void 0&&(n.model=stripAnsi(n.model).replace(/\s+/gu,` `).trim()),(e.fastMode===!0||n.model.endsWith(`-fast`))&&(n.fastGlyph=e.theme.glyph.fast);let r=`${e.dynamicModel===!0&&e.model!==void 0?`dynamic model · `:``}${formatModelSummary(n)}`;return t.dim(e.remote===void 0?r:stripAnsi(r).replace(/\s+/gu,` `).trim())}const EXTERNAL_PROVIDER_DISPLAY_NAMES={codex:`chatgpt-sub`};function renderEndpoint(e){if(e.remote!==void 0||e.endpoint===void 0)return;let t=e.theme.colors,n=e.theme.glyph,clause=(e,n)=>`${e}${t.dim(n)}`;if(e.endpoint.kind===`external`){let r=EXTERNAL_PROVIDER_DISPLAY_NAMES[e.endpoint.provider]??e.endpoint.provider;return`${t.dim(r)}${n.external}`}if(e.endpoint.kind===`chatgpt`)switch(e.endpoint.state){case`ready`:return`${t.dim(`chatgpt-sub`)}${n.external}`;case`checking`:return t.dim(`chatgpt-sub checking…`);case`signed-out`:case`reauth-required`:return t.yellow(`${n.warning} chatgpt-sub login · /login`);case`unavailable`:return t.yellow(`${n.warning} chatgpt-sub unavailable`);case`unrecognized`:return t.dim(`chatgpt-sub`)}if(!e.endpoint.connected)return t.yellow(`${n.warning} ai-gateway`);if(e.endpoint.credential===`api-key`)return clause(`ai-gateway`,`(api-key)`);if(e.endpoint.credential===`unrecognized`)return t.dim(`ai-gateway`);if(e.endpoint.credential===`oauth`){let n=e.vercel?.modelTeamSlug;return t.dim(n?`Vercel · ${n}`:`Vercel`)}let r=e.vercel?.identity?.projectName;return clause(`ai-gateway`,`(${r===void 0?`oidc`:`oidc:${r}`})`)}function buildStatusLine(e){let{theme:t,width:n}=e,r=t.colors,i=e.devBuild===void 0?void 0:formatDevBuildStatus(e.devBuild,t),a=e.logLevel===void 0?void 0:r.cyan(`logs: ${e.logLevel}`),o=renderModel(e),s=e.remote===void 0?void 0:formatRemoteStatus(e.remote,t),c=renderEndpoint(e),l=s?.full,u=s?.badge,d=r.dim(` · `),compose=(e,t)=>{let n=t.filter(e=>e!==void 0).join(d);return e===void 0||n.length===0?e??n:`${e} ${n}`},f=[compose(l,[a,o,c]),compose(l,[a,o]),compose(l,[a]),compose(u,[a]),compose(u,[])];if(i!==void 0){for(let e of f){let t=visibleLength(e),r=visibleLength(i);if(!(t+(t>0?2:0)+r>n))return`${e}${` `.repeat(n-t-r)}${i}`}return clipVisible(i,n)}if(f[0].length===0)return;for(let e of f)if(e.length>0&&visibleLength(e)<=n)return e;let p=f.findLast(e=>e.length>0);return clipVisible(p,n)}function formatRemoteStatus(e,t){let n=t.colors,r=e.deployment===void 0?remoteHost(e.target):`${e.deployment.projectName} (${e.deployment.environment})`,i=formatRemoteBadge(` ${t.unicode?`↗`:`->`} ${r} `,e.connection.state,t),a;switch(e.connection.state){case`checking`:a=n.dim(`Checking access…`);break;case`ready`:break;case`auth-required`:a=n.yellow(`Authenticate via OIDC`);break;case`authenticating`:a=n.dim(`Authenticating via OIDC…`);break;case`auth-failed`:a=n.yellow(`Authentication failed`);break;case`unavailable`:a=n.yellow(`Remote unavailable`)}return{badge:i,full:a===void 0?i:`${i} ${a}`}}function formatRemoteBadge(e,t,n){let r=n.colors;switch(t){case`checking`:return r.inverse(r.gray(e));case`ready`:return r.inverse(r.blue(e));case`unavailable`:case`auth-required`:case`authenticating`:case`auth-failed`:return r.inverse(r.yellow(e))}}export{buildStatusLine};
|