@autohq/cli 0.1.301 → 0.1.303
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/dist/agent-bridge.js +416 -326
- package/dist/index.js +736 -645
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -23399,7 +23399,7 @@ Object.assign(lookup, {
|
|
|
23399
23399
|
// package.json
|
|
23400
23400
|
var package_default = {
|
|
23401
23401
|
name: "@autohq/cli",
|
|
23402
|
-
version: "0.1.
|
|
23402
|
+
version: "0.1.303",
|
|
23403
23403
|
license: "SEE LICENSE IN README.md",
|
|
23404
23404
|
publishConfig: {
|
|
23405
23405
|
access: "public"
|
|
@@ -27170,6 +27170,323 @@ var SessionDiagnosticEventSchema = external_exports.object({
|
|
|
27170
27170
|
createdAt: external_exports.string().datetime()
|
|
27171
27171
|
});
|
|
27172
27172
|
|
|
27173
|
+
// ../../packages/schemas/src/singleton-refresh.ts
|
|
27174
|
+
var SINGLETON_RESPAWN_REASONS = ["refresh", "failure"];
|
|
27175
|
+
var SingletonRespawnReasonSchema = external_exports.enum(SINGLETON_RESPAWN_REASONS);
|
|
27176
|
+
var SingletonRespawnSchema = external_exports.object({
|
|
27177
|
+
reason: SingletonRespawnReasonSchema.default("refresh")
|
|
27178
|
+
}).strict();
|
|
27179
|
+
var SingletonRefreshEventPayloadSchema = external_exports.object({
|
|
27180
|
+
trigger: external_exports.literal("agent.refresh"),
|
|
27181
|
+
refresh: external_exports.object({
|
|
27182
|
+
reason: SingletonRespawnReasonSchema,
|
|
27183
|
+
agentResourceId: external_exports.string().trim().min(1),
|
|
27184
|
+
previousSessionId: external_exports.string().trim().min(1)
|
|
27185
|
+
})
|
|
27186
|
+
});
|
|
27187
|
+
|
|
27188
|
+
// ../../packages/schemas/src/session-commands.ts
|
|
27189
|
+
var SESSION_COMMAND_KINDS = [
|
|
27190
|
+
"message",
|
|
27191
|
+
"answer",
|
|
27192
|
+
"pause",
|
|
27193
|
+
"resume",
|
|
27194
|
+
"interrupt",
|
|
27195
|
+
"cancel",
|
|
27196
|
+
"stop"
|
|
27197
|
+
];
|
|
27198
|
+
var SESSION_DISPATCH_COMMAND_KINDS = [
|
|
27199
|
+
"start",
|
|
27200
|
+
"startWithMessage",
|
|
27201
|
+
"message",
|
|
27202
|
+
"answer",
|
|
27203
|
+
"stop"
|
|
27204
|
+
];
|
|
27205
|
+
var SESSION_PERSISTED_COMMAND_KINDS = [
|
|
27206
|
+
"message",
|
|
27207
|
+
"pause",
|
|
27208
|
+
"resume",
|
|
27209
|
+
"interrupt",
|
|
27210
|
+
"cancel",
|
|
27211
|
+
"stop",
|
|
27212
|
+
"start",
|
|
27213
|
+
"startWithMessage",
|
|
27214
|
+
"answer"
|
|
27215
|
+
];
|
|
27216
|
+
var SESSION_LIFECYCLE_COMMAND_KINDS = [
|
|
27217
|
+
"pause",
|
|
27218
|
+
"resume",
|
|
27219
|
+
"interrupt",
|
|
27220
|
+
"cancel",
|
|
27221
|
+
"stop"
|
|
27222
|
+
];
|
|
27223
|
+
var SESSION_COMMAND_STATUSES = [
|
|
27224
|
+
"pending",
|
|
27225
|
+
"dispatching",
|
|
27226
|
+
"accepted",
|
|
27227
|
+
"failed"
|
|
27228
|
+
];
|
|
27229
|
+
var SESSION_DISPATCH_COMMAND_STATUSES = [
|
|
27230
|
+
"pending",
|
|
27231
|
+
"dispatching",
|
|
27232
|
+
"accepted",
|
|
27233
|
+
"failed"
|
|
27234
|
+
];
|
|
27235
|
+
var SessionCommandKindSchema2 = external_exports.enum(SESSION_COMMAND_KINDS);
|
|
27236
|
+
var SessionPersistedCommandKindSchema = external_exports.enum(
|
|
27237
|
+
SESSION_PERSISTED_COMMAND_KINDS
|
|
27238
|
+
);
|
|
27239
|
+
var SessionDispatchCommandKindSchema = external_exports.enum(
|
|
27240
|
+
SESSION_DISPATCH_COMMAND_KINDS
|
|
27241
|
+
);
|
|
27242
|
+
var RunLifecycleCommandKindSchema = external_exports.enum(
|
|
27243
|
+
SESSION_LIFECYCLE_COMMAND_KINDS
|
|
27244
|
+
);
|
|
27245
|
+
var SessionCommandStatusSchema = external_exports.enum(SESSION_COMMAND_STATUSES);
|
|
27246
|
+
var SessionDispatchCommandStatusSchema = external_exports.enum(
|
|
27247
|
+
SESSION_DISPATCH_COMMAND_STATUSES
|
|
27248
|
+
);
|
|
27249
|
+
var SessionCommandSenderSchema = external_exports.discriminatedUnion("type", [
|
|
27250
|
+
external_exports.object({
|
|
27251
|
+
type: external_exports.literal("operator"),
|
|
27252
|
+
id: external_exports.string().trim().min(1).nullable().default(null),
|
|
27253
|
+
actor: AuthActorSchema.nullable().optional()
|
|
27254
|
+
}),
|
|
27255
|
+
external_exports.object({
|
|
27256
|
+
type: external_exports.literal("agent"),
|
|
27257
|
+
sessionId: SessionIdSchema2
|
|
27258
|
+
}),
|
|
27259
|
+
external_exports.object({
|
|
27260
|
+
type: external_exports.literal("system")
|
|
27261
|
+
})
|
|
27262
|
+
]);
|
|
27263
|
+
var MESSAGE_DELIVERY_MODES = ["interrupt", "deferred"];
|
|
27264
|
+
var MessageDeliveryModeSchema = external_exports.enum(MESSAGE_DELIVERY_MODES);
|
|
27265
|
+
var TRIGGER_INJECTION_MODALITIES = [
|
|
27266
|
+
"chat",
|
|
27267
|
+
"githubCheck",
|
|
27268
|
+
"githubCheckAction",
|
|
27269
|
+
"githubPullRequest",
|
|
27270
|
+
"other"
|
|
27271
|
+
];
|
|
27272
|
+
var TriggerInjectionModalitySchema = external_exports.enum(
|
|
27273
|
+
TRIGGER_INJECTION_MODALITIES
|
|
27274
|
+
);
|
|
27275
|
+
var RunMessageCommandPayloadSchema = external_exports.object({
|
|
27276
|
+
message: external_exports.string().trim().min(1),
|
|
27277
|
+
// Optional so existing payloads and direct operator/agent messages stay
|
|
27278
|
+
// valid without it; trigger routing sets "deferred" for GitHub check
|
|
27279
|
+
// events. An absent mode is treated as "interrupt" at the delivery
|
|
27280
|
+
// boundary (commandDeliveryPayload / the runtime handler), so the default
|
|
27281
|
+
// lives where the value is consumed rather than as a required field every
|
|
27282
|
+
// call site must construct.
|
|
27283
|
+
deliveryMode: MessageDeliveryModeSchema.optional(),
|
|
27284
|
+
metadata: JsonValueSchema2.optional()
|
|
27285
|
+
}).strict();
|
|
27286
|
+
var RunAnswerCommandPayloadSchema = external_exports.object({
|
|
27287
|
+
toolCallId: external_exports.string().trim().min(1),
|
|
27288
|
+
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
27289
|
+
response: external_exports.string().trim().min(1).optional()
|
|
27290
|
+
}).strict().refine((value2) => Object.keys(value2.answers).length > 0 || value2.response, {
|
|
27291
|
+
message: "Provide at least one answer or a freeform response"
|
|
27292
|
+
});
|
|
27293
|
+
var RunLifecycleCommandPayloadSchema = external_exports.object({
|
|
27294
|
+
reason: external_exports.string().trim().min(1).optional()
|
|
27295
|
+
}).strict();
|
|
27296
|
+
var RunStopCommandPayloadSchema = external_exports.object({
|
|
27297
|
+
reason: external_exports.string().trim().min(1).optional(),
|
|
27298
|
+
respawn: SingletonRespawnSchema.optional()
|
|
27299
|
+
}).strict();
|
|
27300
|
+
var SessionCommandPayloadSchema = external_exports.union([
|
|
27301
|
+
RunMessageCommandPayloadSchema,
|
|
27302
|
+
RunAnswerCommandPayloadSchema,
|
|
27303
|
+
RunLifecycleCommandPayloadSchema,
|
|
27304
|
+
RunStopCommandPayloadSchema
|
|
27305
|
+
]);
|
|
27306
|
+
var CreateRunMessageCommandRequestSchema = external_exports.object({
|
|
27307
|
+
message: external_exports.string().trim().min(1),
|
|
27308
|
+
metadata: JsonValueSchema2.optional()
|
|
27309
|
+
});
|
|
27310
|
+
var CreateRunAnswerCommandRequestSchema = RunAnswerCommandPayloadSchema;
|
|
27311
|
+
var CreateRunLifecycleCommandRequestSchema = external_exports.object({
|
|
27312
|
+
reason: external_exports.string().trim().min(1).optional()
|
|
27313
|
+
});
|
|
27314
|
+
var CreateRunStopCommandRequestSchema = external_exports.object({
|
|
27315
|
+
reason: external_exports.string().trim().min(1).optional(),
|
|
27316
|
+
respawn: SingletonRespawnSchema.optional()
|
|
27317
|
+
});
|
|
27318
|
+
var CreateSessionCommandRequestSchema = external_exports.discriminatedUnion("kind", [
|
|
27319
|
+
external_exports.object({
|
|
27320
|
+
kind: external_exports.literal("message"),
|
|
27321
|
+
payload: CreateRunMessageCommandRequestSchema
|
|
27322
|
+
}).strict(),
|
|
27323
|
+
external_exports.object({
|
|
27324
|
+
kind: external_exports.literal("answer"),
|
|
27325
|
+
payload: CreateRunAnswerCommandRequestSchema
|
|
27326
|
+
}).strict(),
|
|
27327
|
+
external_exports.object({
|
|
27328
|
+
kind: external_exports.literal("pause"),
|
|
27329
|
+
payload: CreateRunLifecycleCommandRequestSchema
|
|
27330
|
+
}).strict(),
|
|
27331
|
+
external_exports.object({
|
|
27332
|
+
kind: external_exports.literal("resume"),
|
|
27333
|
+
payload: CreateRunLifecycleCommandRequestSchema
|
|
27334
|
+
}).strict(),
|
|
27335
|
+
external_exports.object({
|
|
27336
|
+
kind: external_exports.literal("interrupt"),
|
|
27337
|
+
payload: CreateRunLifecycleCommandRequestSchema
|
|
27338
|
+
}).strict(),
|
|
27339
|
+
external_exports.object({
|
|
27340
|
+
kind: external_exports.literal("cancel"),
|
|
27341
|
+
payload: CreateRunLifecycleCommandRequestSchema
|
|
27342
|
+
}).strict(),
|
|
27343
|
+
external_exports.object({
|
|
27344
|
+
kind: external_exports.literal("stop"),
|
|
27345
|
+
payload: CreateRunStopCommandRequestSchema
|
|
27346
|
+
}).strict()
|
|
27347
|
+
]);
|
|
27348
|
+
var RunResolutionPolicySchema = external_exports.enum([
|
|
27349
|
+
"singletonLiveRun",
|
|
27350
|
+
"latestLiveRun",
|
|
27351
|
+
"latestRun"
|
|
27352
|
+
]);
|
|
27353
|
+
var AgentAddressedCommandTargetSchema = external_exports.object({
|
|
27354
|
+
agentId: AgentIdSchema.optional(),
|
|
27355
|
+
agentName: external_exports.string().trim().min(1).optional(),
|
|
27356
|
+
resolutionPolicy: RunResolutionPolicySchema
|
|
27357
|
+
}).refine((value2) => Boolean(value2.agentId) !== Boolean(value2.agentName), {
|
|
27358
|
+
message: "Provide exactly one of agentId or agentName"
|
|
27359
|
+
});
|
|
27360
|
+
var SessionCommandRecordBaseSchema = external_exports.object({
|
|
27361
|
+
id: SessionCommandIdSchema2,
|
|
27362
|
+
sessionId: SessionIdSchema2,
|
|
27363
|
+
sender: SessionCommandSenderSchema,
|
|
27364
|
+
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
27365
|
+
status: SessionCommandStatusSchema,
|
|
27366
|
+
attemptCount: external_exports.number().int().nonnegative(),
|
|
27367
|
+
nextAttemptAt: external_exports.string().datetime().nullable(),
|
|
27368
|
+
lastAttemptAt: external_exports.string().datetime().nullable(),
|
|
27369
|
+
acceptedAt: external_exports.string().datetime().nullable(),
|
|
27370
|
+
failedAt: external_exports.string().datetime().nullable(),
|
|
27371
|
+
error: JsonValueSchema2.nullable(),
|
|
27372
|
+
createdAt: external_exports.string().datetime(),
|
|
27373
|
+
updatedAt: external_exports.string().datetime()
|
|
27374
|
+
});
|
|
27375
|
+
var RunStartCommandPayloadSchema = external_exports.object({
|
|
27376
|
+
kind: external_exports.literal("start")
|
|
27377
|
+
}).strict();
|
|
27378
|
+
var RunStartWithMessageCommandPayloadSchema = external_exports.object({
|
|
27379
|
+
kind: external_exports.literal("startWithMessage"),
|
|
27380
|
+
message: external_exports.string().trim().min(1)
|
|
27381
|
+
}).strict();
|
|
27382
|
+
var SessionPersistedCommandPayloadSchema = external_exports.union([
|
|
27383
|
+
RunMessageCommandPayloadSchema,
|
|
27384
|
+
RunAnswerCommandPayloadSchema,
|
|
27385
|
+
RunLifecycleCommandPayloadSchema,
|
|
27386
|
+
RunStopCommandPayloadSchema,
|
|
27387
|
+
RunStartCommandPayloadSchema,
|
|
27388
|
+
RunStartWithMessageCommandPayloadSchema
|
|
27389
|
+
]);
|
|
27390
|
+
var SessionCommandRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
27391
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27392
|
+
kind: external_exports.literal("message"),
|
|
27393
|
+
payload: RunMessageCommandPayloadSchema
|
|
27394
|
+
}),
|
|
27395
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27396
|
+
kind: external_exports.literal("answer"),
|
|
27397
|
+
payload: RunAnswerCommandPayloadSchema
|
|
27398
|
+
}),
|
|
27399
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27400
|
+
kind: external_exports.literal("pause"),
|
|
27401
|
+
payload: RunLifecycleCommandPayloadSchema
|
|
27402
|
+
}),
|
|
27403
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27404
|
+
kind: external_exports.literal("resume"),
|
|
27405
|
+
payload: RunLifecycleCommandPayloadSchema
|
|
27406
|
+
}),
|
|
27407
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27408
|
+
kind: external_exports.literal("interrupt"),
|
|
27409
|
+
payload: RunLifecycleCommandPayloadSchema
|
|
27410
|
+
}),
|
|
27411
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27412
|
+
kind: external_exports.literal("cancel"),
|
|
27413
|
+
payload: RunLifecycleCommandPayloadSchema
|
|
27414
|
+
}),
|
|
27415
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27416
|
+
kind: external_exports.literal("stop"),
|
|
27417
|
+
payload: RunStopCommandPayloadSchema
|
|
27418
|
+
}),
|
|
27419
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27420
|
+
kind: external_exports.literal("start"),
|
|
27421
|
+
payload: RunStartCommandPayloadSchema
|
|
27422
|
+
}),
|
|
27423
|
+
SessionCommandRecordBaseSchema.extend({
|
|
27424
|
+
kind: external_exports.literal("startWithMessage"),
|
|
27425
|
+
payload: RunStartWithMessageCommandPayloadSchema
|
|
27426
|
+
})
|
|
27427
|
+
]);
|
|
27428
|
+
var SessionDispatchMessageCommandPayloadSchema = external_exports.object({
|
|
27429
|
+
kind: external_exports.literal("message"),
|
|
27430
|
+
message: external_exports.string().trim().min(1)
|
|
27431
|
+
}).strict();
|
|
27432
|
+
var SessionDispatchAnswerCommandPayloadSchema = external_exports.object({
|
|
27433
|
+
kind: external_exports.literal("answer"),
|
|
27434
|
+
toolCallId: external_exports.string().trim().min(1),
|
|
27435
|
+
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
27436
|
+
response: external_exports.string().trim().min(1).optional()
|
|
27437
|
+
}).strict();
|
|
27438
|
+
var SessionDispatchStopCommandPayloadSchema = external_exports.object({
|
|
27439
|
+
kind: external_exports.literal("stop"),
|
|
27440
|
+
reason: external_exports.string().trim().min(1).optional()
|
|
27441
|
+
}).strict();
|
|
27442
|
+
var SessionDispatchCommandPayloadSchema = external_exports.discriminatedUnion(
|
|
27443
|
+
"kind",
|
|
27444
|
+
[
|
|
27445
|
+
RunStartCommandPayloadSchema,
|
|
27446
|
+
RunStartWithMessageCommandPayloadSchema,
|
|
27447
|
+
SessionDispatchMessageCommandPayloadSchema,
|
|
27448
|
+
SessionDispatchAnswerCommandPayloadSchema,
|
|
27449
|
+
SessionDispatchStopCommandPayloadSchema
|
|
27450
|
+
]
|
|
27451
|
+
);
|
|
27452
|
+
var SessionDispatchCommandRecordBaseSchema = external_exports.object({
|
|
27453
|
+
id: SessionCommandIdSchema2,
|
|
27454
|
+
sessionId: SessionIdSchema2,
|
|
27455
|
+
sender: SessionCommandSenderSchema,
|
|
27456
|
+
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
27457
|
+
status: SessionDispatchCommandStatusSchema,
|
|
27458
|
+
attemptCount: external_exports.number().int().nonnegative(),
|
|
27459
|
+
nextAttemptAt: external_exports.string().datetime().nullable(),
|
|
27460
|
+
lastAttemptAt: external_exports.string().datetime().nullable(),
|
|
27461
|
+
acceptedAt: external_exports.string().datetime().nullable(),
|
|
27462
|
+
failedAt: external_exports.string().datetime().nullable(),
|
|
27463
|
+
error: JsonValueSchema2.nullable(),
|
|
27464
|
+
createdAt: external_exports.string().datetime(),
|
|
27465
|
+
updatedAt: external_exports.string().datetime()
|
|
27466
|
+
});
|
|
27467
|
+
var SessionDispatchCommandRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
27468
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27469
|
+
kind: external_exports.literal("start"),
|
|
27470
|
+
payload: RunStartCommandPayloadSchema
|
|
27471
|
+
}),
|
|
27472
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27473
|
+
kind: external_exports.literal("startWithMessage"),
|
|
27474
|
+
payload: RunStartWithMessageCommandPayloadSchema
|
|
27475
|
+
}),
|
|
27476
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27477
|
+
kind: external_exports.literal("message"),
|
|
27478
|
+
payload: SessionDispatchMessageCommandPayloadSchema
|
|
27479
|
+
}),
|
|
27480
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27481
|
+
kind: external_exports.literal("answer"),
|
|
27482
|
+
payload: SessionDispatchAnswerCommandPayloadSchema
|
|
27483
|
+
}),
|
|
27484
|
+
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27485
|
+
kind: external_exports.literal("stop"),
|
|
27486
|
+
payload: SessionDispatchStopCommandPayloadSchema
|
|
27487
|
+
})
|
|
27488
|
+
]);
|
|
27489
|
+
|
|
27173
27490
|
// ../../packages/schemas/src/sessions.ts
|
|
27174
27491
|
var SESSION_STATUSES = [
|
|
27175
27492
|
"queued",
|
|
@@ -27263,6 +27580,10 @@ var SessionRecordSchema = external_exports.object({
|
|
|
27263
27580
|
archivedAt: external_exports.string().datetime().nullable(),
|
|
27264
27581
|
error: JsonValueSchema2.nullable()
|
|
27265
27582
|
});
|
|
27583
|
+
var SessionMessageOriginSchema = external_exports.object({
|
|
27584
|
+
eventKey: external_exports.string().trim().min(1),
|
|
27585
|
+
provider: external_exports.string().trim().min(1).nullable().default(null)
|
|
27586
|
+
});
|
|
27266
27587
|
var SessionUiMessageRecordSchema = external_exports.object({
|
|
27267
27588
|
id: external_exports.string().trim().min(1),
|
|
27268
27589
|
sessionId: SessionIdSchema2,
|
|
@@ -27273,6 +27594,15 @@ var SessionUiMessageRecordSchema = external_exports.object({
|
|
|
27273
27594
|
role: SessionMessageRoleSchema,
|
|
27274
27595
|
status: SessionMessageStatusSchema,
|
|
27275
27596
|
message: JsonValueSchema2,
|
|
27597
|
+
// The sender of the command that carried this message into the session
|
|
27598
|
+
// (operator chat send, trigger delivery, or another agent's session), joined
|
|
27599
|
+
// from session_commands at read time. Null for messages that did not arrive
|
|
27600
|
+
// through a command, such as assistant output.
|
|
27601
|
+
sender: SessionCommandSenderSchema.nullable().default(null),
|
|
27602
|
+
// For trigger deliveries, the routed event behind the carrying command:
|
|
27603
|
+
// its event key plus the originating provider connection when known
|
|
27604
|
+
// (e.g. "slack" for a subscribed-thread reply, "github" for a check event).
|
|
27605
|
+
origin: SessionMessageOriginSchema.nullable().default(null),
|
|
27276
27606
|
streamCursor: external_exports.number().int().positive().nullable().default(null),
|
|
27277
27607
|
createdAt: external_exports.string().datetime(),
|
|
27278
27608
|
updatedAt: external_exports.string().datetime(),
|
|
@@ -27560,323 +27890,6 @@ var SessionTurnRecordSchema = external_exports.object({
|
|
|
27560
27890
|
updatedAt: external_exports.string().datetime()
|
|
27561
27891
|
});
|
|
27562
27892
|
|
|
27563
|
-
// ../../packages/schemas/src/singleton-refresh.ts
|
|
27564
|
-
var SINGLETON_RESPAWN_REASONS = ["refresh", "failure"];
|
|
27565
|
-
var SingletonRespawnReasonSchema = external_exports.enum(SINGLETON_RESPAWN_REASONS);
|
|
27566
|
-
var SingletonRespawnSchema = external_exports.object({
|
|
27567
|
-
reason: SingletonRespawnReasonSchema.default("refresh")
|
|
27568
|
-
}).strict();
|
|
27569
|
-
var SingletonRefreshEventPayloadSchema = external_exports.object({
|
|
27570
|
-
trigger: external_exports.literal("agent.refresh"),
|
|
27571
|
-
refresh: external_exports.object({
|
|
27572
|
-
reason: SingletonRespawnReasonSchema,
|
|
27573
|
-
agentResourceId: external_exports.string().trim().min(1),
|
|
27574
|
-
previousSessionId: external_exports.string().trim().min(1)
|
|
27575
|
-
})
|
|
27576
|
-
});
|
|
27577
|
-
|
|
27578
|
-
// ../../packages/schemas/src/session-commands.ts
|
|
27579
|
-
var SESSION_COMMAND_KINDS = [
|
|
27580
|
-
"message",
|
|
27581
|
-
"answer",
|
|
27582
|
-
"pause",
|
|
27583
|
-
"resume",
|
|
27584
|
-
"interrupt",
|
|
27585
|
-
"cancel",
|
|
27586
|
-
"stop"
|
|
27587
|
-
];
|
|
27588
|
-
var SESSION_DISPATCH_COMMAND_KINDS = [
|
|
27589
|
-
"start",
|
|
27590
|
-
"startWithMessage",
|
|
27591
|
-
"message",
|
|
27592
|
-
"answer",
|
|
27593
|
-
"stop"
|
|
27594
|
-
];
|
|
27595
|
-
var SESSION_PERSISTED_COMMAND_KINDS = [
|
|
27596
|
-
"message",
|
|
27597
|
-
"pause",
|
|
27598
|
-
"resume",
|
|
27599
|
-
"interrupt",
|
|
27600
|
-
"cancel",
|
|
27601
|
-
"stop",
|
|
27602
|
-
"start",
|
|
27603
|
-
"startWithMessage",
|
|
27604
|
-
"answer"
|
|
27605
|
-
];
|
|
27606
|
-
var SESSION_LIFECYCLE_COMMAND_KINDS = [
|
|
27607
|
-
"pause",
|
|
27608
|
-
"resume",
|
|
27609
|
-
"interrupt",
|
|
27610
|
-
"cancel",
|
|
27611
|
-
"stop"
|
|
27612
|
-
];
|
|
27613
|
-
var SESSION_COMMAND_STATUSES = [
|
|
27614
|
-
"pending",
|
|
27615
|
-
"dispatching",
|
|
27616
|
-
"accepted",
|
|
27617
|
-
"failed"
|
|
27618
|
-
];
|
|
27619
|
-
var SESSION_DISPATCH_COMMAND_STATUSES = [
|
|
27620
|
-
"pending",
|
|
27621
|
-
"dispatching",
|
|
27622
|
-
"accepted",
|
|
27623
|
-
"failed"
|
|
27624
|
-
];
|
|
27625
|
-
var SessionCommandKindSchema2 = external_exports.enum(SESSION_COMMAND_KINDS);
|
|
27626
|
-
var SessionPersistedCommandKindSchema = external_exports.enum(
|
|
27627
|
-
SESSION_PERSISTED_COMMAND_KINDS
|
|
27628
|
-
);
|
|
27629
|
-
var SessionDispatchCommandKindSchema = external_exports.enum(
|
|
27630
|
-
SESSION_DISPATCH_COMMAND_KINDS
|
|
27631
|
-
);
|
|
27632
|
-
var RunLifecycleCommandKindSchema = external_exports.enum(
|
|
27633
|
-
SESSION_LIFECYCLE_COMMAND_KINDS
|
|
27634
|
-
);
|
|
27635
|
-
var SessionCommandStatusSchema = external_exports.enum(SESSION_COMMAND_STATUSES);
|
|
27636
|
-
var SessionDispatchCommandStatusSchema = external_exports.enum(
|
|
27637
|
-
SESSION_DISPATCH_COMMAND_STATUSES
|
|
27638
|
-
);
|
|
27639
|
-
var SessionCommandSenderSchema = external_exports.discriminatedUnion("type", [
|
|
27640
|
-
external_exports.object({
|
|
27641
|
-
type: external_exports.literal("operator"),
|
|
27642
|
-
id: external_exports.string().trim().min(1).nullable().default(null),
|
|
27643
|
-
actor: AuthActorSchema.nullable().optional()
|
|
27644
|
-
}),
|
|
27645
|
-
external_exports.object({
|
|
27646
|
-
type: external_exports.literal("agent"),
|
|
27647
|
-
sessionId: SessionIdSchema2
|
|
27648
|
-
}),
|
|
27649
|
-
external_exports.object({
|
|
27650
|
-
type: external_exports.literal("system")
|
|
27651
|
-
})
|
|
27652
|
-
]);
|
|
27653
|
-
var MESSAGE_DELIVERY_MODES = ["interrupt", "deferred"];
|
|
27654
|
-
var MessageDeliveryModeSchema = external_exports.enum(MESSAGE_DELIVERY_MODES);
|
|
27655
|
-
var TRIGGER_INJECTION_MODALITIES = [
|
|
27656
|
-
"chat",
|
|
27657
|
-
"githubCheck",
|
|
27658
|
-
"githubCheckAction",
|
|
27659
|
-
"githubPullRequest",
|
|
27660
|
-
"other"
|
|
27661
|
-
];
|
|
27662
|
-
var TriggerInjectionModalitySchema = external_exports.enum(
|
|
27663
|
-
TRIGGER_INJECTION_MODALITIES
|
|
27664
|
-
);
|
|
27665
|
-
var RunMessageCommandPayloadSchema = external_exports.object({
|
|
27666
|
-
message: external_exports.string().trim().min(1),
|
|
27667
|
-
// Optional so existing payloads and direct operator/agent messages stay
|
|
27668
|
-
// valid without it; trigger routing sets "deferred" for GitHub check
|
|
27669
|
-
// events. An absent mode is treated as "interrupt" at the delivery
|
|
27670
|
-
// boundary (commandDeliveryPayload / the runtime handler), so the default
|
|
27671
|
-
// lives where the value is consumed rather than as a required field every
|
|
27672
|
-
// call site must construct.
|
|
27673
|
-
deliveryMode: MessageDeliveryModeSchema.optional(),
|
|
27674
|
-
metadata: JsonValueSchema2.optional()
|
|
27675
|
-
}).strict();
|
|
27676
|
-
var RunAnswerCommandPayloadSchema = external_exports.object({
|
|
27677
|
-
toolCallId: external_exports.string().trim().min(1),
|
|
27678
|
-
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
27679
|
-
response: external_exports.string().trim().min(1).optional()
|
|
27680
|
-
}).strict().refine((value2) => Object.keys(value2.answers).length > 0 || value2.response, {
|
|
27681
|
-
message: "Provide at least one answer or a freeform response"
|
|
27682
|
-
});
|
|
27683
|
-
var RunLifecycleCommandPayloadSchema = external_exports.object({
|
|
27684
|
-
reason: external_exports.string().trim().min(1).optional()
|
|
27685
|
-
}).strict();
|
|
27686
|
-
var RunStopCommandPayloadSchema = external_exports.object({
|
|
27687
|
-
reason: external_exports.string().trim().min(1).optional(),
|
|
27688
|
-
respawn: SingletonRespawnSchema.optional()
|
|
27689
|
-
}).strict();
|
|
27690
|
-
var SessionCommandPayloadSchema = external_exports.union([
|
|
27691
|
-
RunMessageCommandPayloadSchema,
|
|
27692
|
-
RunAnswerCommandPayloadSchema,
|
|
27693
|
-
RunLifecycleCommandPayloadSchema,
|
|
27694
|
-
RunStopCommandPayloadSchema
|
|
27695
|
-
]);
|
|
27696
|
-
var CreateRunMessageCommandRequestSchema = external_exports.object({
|
|
27697
|
-
message: external_exports.string().trim().min(1),
|
|
27698
|
-
metadata: JsonValueSchema2.optional()
|
|
27699
|
-
});
|
|
27700
|
-
var CreateRunAnswerCommandRequestSchema = RunAnswerCommandPayloadSchema;
|
|
27701
|
-
var CreateRunLifecycleCommandRequestSchema = external_exports.object({
|
|
27702
|
-
reason: external_exports.string().trim().min(1).optional()
|
|
27703
|
-
});
|
|
27704
|
-
var CreateRunStopCommandRequestSchema = external_exports.object({
|
|
27705
|
-
reason: external_exports.string().trim().min(1).optional(),
|
|
27706
|
-
respawn: SingletonRespawnSchema.optional()
|
|
27707
|
-
});
|
|
27708
|
-
var CreateSessionCommandRequestSchema = external_exports.discriminatedUnion("kind", [
|
|
27709
|
-
external_exports.object({
|
|
27710
|
-
kind: external_exports.literal("message"),
|
|
27711
|
-
payload: CreateRunMessageCommandRequestSchema
|
|
27712
|
-
}).strict(),
|
|
27713
|
-
external_exports.object({
|
|
27714
|
-
kind: external_exports.literal("answer"),
|
|
27715
|
-
payload: CreateRunAnswerCommandRequestSchema
|
|
27716
|
-
}).strict(),
|
|
27717
|
-
external_exports.object({
|
|
27718
|
-
kind: external_exports.literal("pause"),
|
|
27719
|
-
payload: CreateRunLifecycleCommandRequestSchema
|
|
27720
|
-
}).strict(),
|
|
27721
|
-
external_exports.object({
|
|
27722
|
-
kind: external_exports.literal("resume"),
|
|
27723
|
-
payload: CreateRunLifecycleCommandRequestSchema
|
|
27724
|
-
}).strict(),
|
|
27725
|
-
external_exports.object({
|
|
27726
|
-
kind: external_exports.literal("interrupt"),
|
|
27727
|
-
payload: CreateRunLifecycleCommandRequestSchema
|
|
27728
|
-
}).strict(),
|
|
27729
|
-
external_exports.object({
|
|
27730
|
-
kind: external_exports.literal("cancel"),
|
|
27731
|
-
payload: CreateRunLifecycleCommandRequestSchema
|
|
27732
|
-
}).strict(),
|
|
27733
|
-
external_exports.object({
|
|
27734
|
-
kind: external_exports.literal("stop"),
|
|
27735
|
-
payload: CreateRunStopCommandRequestSchema
|
|
27736
|
-
}).strict()
|
|
27737
|
-
]);
|
|
27738
|
-
var RunResolutionPolicySchema = external_exports.enum([
|
|
27739
|
-
"singletonLiveRun",
|
|
27740
|
-
"latestLiveRun",
|
|
27741
|
-
"latestRun"
|
|
27742
|
-
]);
|
|
27743
|
-
var AgentAddressedCommandTargetSchema = external_exports.object({
|
|
27744
|
-
agentId: AgentIdSchema.optional(),
|
|
27745
|
-
agentName: external_exports.string().trim().min(1).optional(),
|
|
27746
|
-
resolutionPolicy: RunResolutionPolicySchema
|
|
27747
|
-
}).refine((value2) => Boolean(value2.agentId) !== Boolean(value2.agentName), {
|
|
27748
|
-
message: "Provide exactly one of agentId or agentName"
|
|
27749
|
-
});
|
|
27750
|
-
var SessionCommandRecordBaseSchema = external_exports.object({
|
|
27751
|
-
id: SessionCommandIdSchema2,
|
|
27752
|
-
sessionId: SessionIdSchema2,
|
|
27753
|
-
sender: SessionCommandSenderSchema,
|
|
27754
|
-
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
27755
|
-
status: SessionCommandStatusSchema,
|
|
27756
|
-
attemptCount: external_exports.number().int().nonnegative(),
|
|
27757
|
-
nextAttemptAt: external_exports.string().datetime().nullable(),
|
|
27758
|
-
lastAttemptAt: external_exports.string().datetime().nullable(),
|
|
27759
|
-
acceptedAt: external_exports.string().datetime().nullable(),
|
|
27760
|
-
failedAt: external_exports.string().datetime().nullable(),
|
|
27761
|
-
error: JsonValueSchema2.nullable(),
|
|
27762
|
-
createdAt: external_exports.string().datetime(),
|
|
27763
|
-
updatedAt: external_exports.string().datetime()
|
|
27764
|
-
});
|
|
27765
|
-
var RunStartCommandPayloadSchema = external_exports.object({
|
|
27766
|
-
kind: external_exports.literal("start")
|
|
27767
|
-
}).strict();
|
|
27768
|
-
var RunStartWithMessageCommandPayloadSchema = external_exports.object({
|
|
27769
|
-
kind: external_exports.literal("startWithMessage"),
|
|
27770
|
-
message: external_exports.string().trim().min(1)
|
|
27771
|
-
}).strict();
|
|
27772
|
-
var SessionPersistedCommandPayloadSchema = external_exports.union([
|
|
27773
|
-
RunMessageCommandPayloadSchema,
|
|
27774
|
-
RunAnswerCommandPayloadSchema,
|
|
27775
|
-
RunLifecycleCommandPayloadSchema,
|
|
27776
|
-
RunStopCommandPayloadSchema,
|
|
27777
|
-
RunStartCommandPayloadSchema,
|
|
27778
|
-
RunStartWithMessageCommandPayloadSchema
|
|
27779
|
-
]);
|
|
27780
|
-
var SessionCommandRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
27781
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27782
|
-
kind: external_exports.literal("message"),
|
|
27783
|
-
payload: RunMessageCommandPayloadSchema
|
|
27784
|
-
}),
|
|
27785
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27786
|
-
kind: external_exports.literal("answer"),
|
|
27787
|
-
payload: RunAnswerCommandPayloadSchema
|
|
27788
|
-
}),
|
|
27789
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27790
|
-
kind: external_exports.literal("pause"),
|
|
27791
|
-
payload: RunLifecycleCommandPayloadSchema
|
|
27792
|
-
}),
|
|
27793
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27794
|
-
kind: external_exports.literal("resume"),
|
|
27795
|
-
payload: RunLifecycleCommandPayloadSchema
|
|
27796
|
-
}),
|
|
27797
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27798
|
-
kind: external_exports.literal("interrupt"),
|
|
27799
|
-
payload: RunLifecycleCommandPayloadSchema
|
|
27800
|
-
}),
|
|
27801
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27802
|
-
kind: external_exports.literal("cancel"),
|
|
27803
|
-
payload: RunLifecycleCommandPayloadSchema
|
|
27804
|
-
}),
|
|
27805
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27806
|
-
kind: external_exports.literal("stop"),
|
|
27807
|
-
payload: RunStopCommandPayloadSchema
|
|
27808
|
-
}),
|
|
27809
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27810
|
-
kind: external_exports.literal("start"),
|
|
27811
|
-
payload: RunStartCommandPayloadSchema
|
|
27812
|
-
}),
|
|
27813
|
-
SessionCommandRecordBaseSchema.extend({
|
|
27814
|
-
kind: external_exports.literal("startWithMessage"),
|
|
27815
|
-
payload: RunStartWithMessageCommandPayloadSchema
|
|
27816
|
-
})
|
|
27817
|
-
]);
|
|
27818
|
-
var SessionDispatchMessageCommandPayloadSchema = external_exports.object({
|
|
27819
|
-
kind: external_exports.literal("message"),
|
|
27820
|
-
message: external_exports.string().trim().min(1)
|
|
27821
|
-
}).strict();
|
|
27822
|
-
var SessionDispatchAnswerCommandPayloadSchema = external_exports.object({
|
|
27823
|
-
kind: external_exports.literal("answer"),
|
|
27824
|
-
toolCallId: external_exports.string().trim().min(1),
|
|
27825
|
-
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
27826
|
-
response: external_exports.string().trim().min(1).optional()
|
|
27827
|
-
}).strict();
|
|
27828
|
-
var SessionDispatchStopCommandPayloadSchema = external_exports.object({
|
|
27829
|
-
kind: external_exports.literal("stop"),
|
|
27830
|
-
reason: external_exports.string().trim().min(1).optional()
|
|
27831
|
-
}).strict();
|
|
27832
|
-
var SessionDispatchCommandPayloadSchema = external_exports.discriminatedUnion(
|
|
27833
|
-
"kind",
|
|
27834
|
-
[
|
|
27835
|
-
RunStartCommandPayloadSchema,
|
|
27836
|
-
RunStartWithMessageCommandPayloadSchema,
|
|
27837
|
-
SessionDispatchMessageCommandPayloadSchema,
|
|
27838
|
-
SessionDispatchAnswerCommandPayloadSchema,
|
|
27839
|
-
SessionDispatchStopCommandPayloadSchema
|
|
27840
|
-
]
|
|
27841
|
-
);
|
|
27842
|
-
var SessionDispatchCommandRecordBaseSchema = external_exports.object({
|
|
27843
|
-
id: SessionCommandIdSchema2,
|
|
27844
|
-
sessionId: SessionIdSchema2,
|
|
27845
|
-
sender: SessionCommandSenderSchema,
|
|
27846
|
-
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
27847
|
-
status: SessionDispatchCommandStatusSchema,
|
|
27848
|
-
attemptCount: external_exports.number().int().nonnegative(),
|
|
27849
|
-
nextAttemptAt: external_exports.string().datetime().nullable(),
|
|
27850
|
-
lastAttemptAt: external_exports.string().datetime().nullable(),
|
|
27851
|
-
acceptedAt: external_exports.string().datetime().nullable(),
|
|
27852
|
-
failedAt: external_exports.string().datetime().nullable(),
|
|
27853
|
-
error: JsonValueSchema2.nullable(),
|
|
27854
|
-
createdAt: external_exports.string().datetime(),
|
|
27855
|
-
updatedAt: external_exports.string().datetime()
|
|
27856
|
-
});
|
|
27857
|
-
var SessionDispatchCommandRecordSchema = external_exports.discriminatedUnion("kind", [
|
|
27858
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27859
|
-
kind: external_exports.literal("start"),
|
|
27860
|
-
payload: RunStartCommandPayloadSchema
|
|
27861
|
-
}),
|
|
27862
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27863
|
-
kind: external_exports.literal("startWithMessage"),
|
|
27864
|
-
payload: RunStartWithMessageCommandPayloadSchema
|
|
27865
|
-
}),
|
|
27866
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27867
|
-
kind: external_exports.literal("message"),
|
|
27868
|
-
payload: SessionDispatchMessageCommandPayloadSchema
|
|
27869
|
-
}),
|
|
27870
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27871
|
-
kind: external_exports.literal("answer"),
|
|
27872
|
-
payload: SessionDispatchAnswerCommandPayloadSchema
|
|
27873
|
-
}),
|
|
27874
|
-
SessionDispatchCommandRecordBaseSchema.extend({
|
|
27875
|
-
kind: external_exports.literal("stop"),
|
|
27876
|
-
payload: SessionDispatchStopCommandPayloadSchema
|
|
27877
|
-
})
|
|
27878
|
-
]);
|
|
27879
|
-
|
|
27880
27893
|
// ../../packages/schemas/src/setup.ts
|
|
27881
27894
|
var SetupOnboardingPullRequestCreateRequestSchema = external_exports.object({
|
|
27882
27895
|
githubConnection: external_exports.string().trim().min(1).optional(),
|
|
@@ -38210,6 +38223,7 @@ var UiMessagePartTracker = class {
|
|
|
38210
38223
|
textPartIndexById = /* @__PURE__ */ new Map();
|
|
38211
38224
|
reasoningPartIndexById = /* @__PURE__ */ new Map();
|
|
38212
38225
|
toolPartIndexByCallId = /* @__PURE__ */ new Map();
|
|
38226
|
+
approvalByCallId = /* @__PURE__ */ new Map();
|
|
38213
38227
|
dataPartIndexById = /* @__PURE__ */ new Map();
|
|
38214
38228
|
append(chunk) {
|
|
38215
38229
|
switch (chunk.type) {
|
|
@@ -38302,14 +38316,16 @@ var UiMessagePartTracker = class {
|
|
|
38302
38316
|
return [];
|
|
38303
38317
|
}
|
|
38304
38318
|
case "tool-input-available": {
|
|
38319
|
+
const pendingApproval = this.approvalByCallId.get(chunk.toolCallId);
|
|
38305
38320
|
const index = this.upsertToolPart(chunk.toolCallId, {
|
|
38306
38321
|
...toolPartShape({
|
|
38307
38322
|
toolCallId: chunk.toolCallId,
|
|
38308
38323
|
toolName: chunk.toolName,
|
|
38309
38324
|
dynamic: chunk.dynamic,
|
|
38310
|
-
state: "input-available"
|
|
38325
|
+
state: pendingApproval ? "approval-requested" : "input-available"
|
|
38311
38326
|
}),
|
|
38312
38327
|
input: chunk.input,
|
|
38328
|
+
...pendingApproval ? { approval: pendingApproval } : {},
|
|
38313
38329
|
...chunk.providerExecuted !== void 0 ? { providerExecuted: chunk.providerExecuted } : {},
|
|
38314
38330
|
...chunk.providerMetadata !== void 0 ? { callProviderMetadata: chunk.providerMetadata } : {}
|
|
38315
38331
|
});
|
|
@@ -38328,6 +38344,24 @@ var UiMessagePartTracker = class {
|
|
|
38328
38344
|
});
|
|
38329
38345
|
return this.persistable(index);
|
|
38330
38346
|
}
|
|
38347
|
+
case "tool-approval-request": {
|
|
38348
|
+
const approval = {
|
|
38349
|
+
id: chunk.approvalId,
|
|
38350
|
+
...chunk.signature != null ? { signature: chunk.signature } : {}
|
|
38351
|
+
};
|
|
38352
|
+
this.approvalByCallId.set(chunk.toolCallId, approval);
|
|
38353
|
+
const part = this.partById(
|
|
38354
|
+
this.toolPartIndexByCallId,
|
|
38355
|
+
chunk.toolCallId
|
|
38356
|
+
);
|
|
38357
|
+
const index = this.toolPartIndexByCallId.get(chunk.toolCallId);
|
|
38358
|
+
if (!part || index === void 0) {
|
|
38359
|
+
return [];
|
|
38360
|
+
}
|
|
38361
|
+
part.state = "approval-requested";
|
|
38362
|
+
part.approval = approval;
|
|
38363
|
+
return this.persistable(index);
|
|
38364
|
+
}
|
|
38331
38365
|
case "tool-output-available": {
|
|
38332
38366
|
const part = this.partById(
|
|
38333
38367
|
this.toolPartIndexByCallId,
|
|
@@ -38340,6 +38374,20 @@ var UiMessagePartTracker = class {
|
|
|
38340
38374
|
part.state = "output-available";
|
|
38341
38375
|
part.output = chunk.output;
|
|
38342
38376
|
part.preliminary = chunk.preliminary;
|
|
38377
|
+
this.settleApproval(part, chunk.toolCallId, { approved: true });
|
|
38378
|
+
return this.persistable(index);
|
|
38379
|
+
}
|
|
38380
|
+
case "tool-output-denied": {
|
|
38381
|
+
const part = this.partById(
|
|
38382
|
+
this.toolPartIndexByCallId,
|
|
38383
|
+
chunk.toolCallId
|
|
38384
|
+
);
|
|
38385
|
+
const index = this.toolPartIndexByCallId.get(chunk.toolCallId);
|
|
38386
|
+
if (!part || index === void 0) {
|
|
38387
|
+
return [];
|
|
38388
|
+
}
|
|
38389
|
+
part.state = "output-denied";
|
|
38390
|
+
this.settleApproval(part, chunk.toolCallId, { approved: false });
|
|
38343
38391
|
return this.persistable(index);
|
|
38344
38392
|
}
|
|
38345
38393
|
case "tool-output-error": {
|
|
@@ -38353,6 +38401,7 @@ var UiMessagePartTracker = class {
|
|
|
38353
38401
|
}
|
|
38354
38402
|
part.state = "output-error";
|
|
38355
38403
|
part.errorText = chunk.errorText;
|
|
38404
|
+
this.settleApproval(part, chunk.toolCallId, { approved: true });
|
|
38356
38405
|
return this.persistable(index);
|
|
38357
38406
|
}
|
|
38358
38407
|
case "start-step": {
|
|
@@ -38460,6 +38509,16 @@ var UiMessagePartTracker = class {
|
|
|
38460
38509
|
}
|
|
38461
38510
|
return this.parts[index] ?? null;
|
|
38462
38511
|
}
|
|
38512
|
+
// The UIToolInvocation contract requires `approval.approved` on settled
|
|
38513
|
+
// states (`output-available`/`output-denied`), but the settling chunks don't
|
|
38514
|
+
// carry it — the outcome is implied by which chunk arrives. Stamp it onto a
|
|
38515
|
+
// previously requested approval; parts that never parked stay approval-free.
|
|
38516
|
+
settleApproval(part, toolCallId, outcome) {
|
|
38517
|
+
const approval = this.approvalByCallId.get(toolCallId);
|
|
38518
|
+
if (approval) {
|
|
38519
|
+
part.approval = { ...approval, approved: outcome.approved };
|
|
38520
|
+
}
|
|
38521
|
+
}
|
|
38463
38522
|
reset() {
|
|
38464
38523
|
this.messageId = null;
|
|
38465
38524
|
this.messageMetadata = void 0;
|
|
@@ -38468,6 +38527,7 @@ var UiMessagePartTracker = class {
|
|
|
38468
38527
|
this.textPartIndexById = /* @__PURE__ */ new Map();
|
|
38469
38528
|
this.reasoningPartIndexById = /* @__PURE__ */ new Map();
|
|
38470
38529
|
this.toolPartIndexByCallId = /* @__PURE__ */ new Map();
|
|
38530
|
+
this.approvalByCallId = /* @__PURE__ */ new Map();
|
|
38471
38531
|
this.dataPartIndexById = /* @__PURE__ */ new Map();
|
|
38472
38532
|
}
|
|
38473
38533
|
};
|
|
@@ -38904,6 +38964,21 @@ function legacyToolEntry(chunk) {
|
|
|
38904
38964
|
]
|
|
38905
38965
|
}
|
|
38906
38966
|
};
|
|
38967
|
+
case "tool-output-denied":
|
|
38968
|
+
return {
|
|
38969
|
+
role: "tool",
|
|
38970
|
+
kind: "tool_result",
|
|
38971
|
+
content: {
|
|
38972
|
+
parts: [
|
|
38973
|
+
{
|
|
38974
|
+
type: "tool_result",
|
|
38975
|
+
toolUseId: legacyToolCallId(chunk.toolCallId),
|
|
38976
|
+
output: { denied: true },
|
|
38977
|
+
isError: true
|
|
38978
|
+
}
|
|
38979
|
+
]
|
|
38980
|
+
}
|
|
38981
|
+
};
|
|
38907
38982
|
default:
|
|
38908
38983
|
return null;
|
|
38909
38984
|
}
|
|
@@ -60613,15 +60688,19 @@ var CodexProjector = class {
|
|
|
60613
60688
|
return [];
|
|
60614
60689
|
}
|
|
60615
60690
|
}
|
|
60616
|
-
// An approval parks the turn on operator input, so
|
|
60617
|
-
//
|
|
60691
|
+
// An approval parks the turn on operator input, so both chunks mark the
|
|
60692
|
+
// delivered turn as waiting for input.
|
|
60618
60693
|
projectApproval(request) {
|
|
60619
60694
|
return [
|
|
60620
|
-
|
|
60621
|
-
type: "
|
|
60622
|
-
|
|
60623
|
-
|
|
60624
|
-
|
|
60695
|
+
{
|
|
60696
|
+
type: "ui_message_chunk",
|
|
60697
|
+
chunk: {
|
|
60698
|
+
type: "tool-approval-request",
|
|
60699
|
+
approvalId: String(request.requestId),
|
|
60700
|
+
toolCallId: request.itemId
|
|
60701
|
+
},
|
|
60702
|
+
turnStatus: "waiting_for_input"
|
|
60703
|
+
},
|
|
60625
60704
|
{
|
|
60626
60705
|
type: "ui_message_chunk",
|
|
60627
60706
|
chunk: {
|
|
@@ -60676,6 +60755,7 @@ var CodexProjector = class {
|
|
|
60676
60755
|
...item.cwd ? { cwd: item.cwd } : {}
|
|
60677
60756
|
},
|
|
60678
60757
|
output: item.aggregatedOutput ?? "",
|
|
60758
|
+
isDenied: isDeclinedStatus(item.status),
|
|
60679
60759
|
isError: isFailedStatus(item.status) || (item.exitCode ?? 0) !== 0,
|
|
60680
60760
|
title: item.command,
|
|
60681
60761
|
toolMetadata: statusMetadata(item.status, {
|
|
@@ -60689,6 +60769,7 @@ var CodexProjector = class {
|
|
|
60689
60769
|
name: "apply_patch",
|
|
60690
60770
|
input: { changes: toJsonValue(item.changes) },
|
|
60691
60771
|
output: { status: item.status ?? "unknown" },
|
|
60772
|
+
isDenied: isDeclinedStatus(item.status),
|
|
60692
60773
|
isError: isFailedStatus(item.status),
|
|
60693
60774
|
title: "apply_patch",
|
|
60694
60775
|
toolMetadata: statusMetadata(item.status)
|
|
@@ -60786,6 +60867,12 @@ function toolInputChunk(input) {
|
|
|
60786
60867
|
});
|
|
60787
60868
|
}
|
|
60788
60869
|
function toolOutputChunk(input) {
|
|
60870
|
+
if (input.isDenied) {
|
|
60871
|
+
return uiChunk2({
|
|
60872
|
+
type: "tool-output-denied",
|
|
60873
|
+
toolCallId: input.itemId
|
|
60874
|
+
});
|
|
60875
|
+
}
|
|
60789
60876
|
return uiChunk2(
|
|
60790
60877
|
input.isError ? {
|
|
60791
60878
|
type: "tool-output-error",
|
|
@@ -60856,6 +60943,9 @@ function reasoningPartId(itemId) {
|
|
|
60856
60943
|
function isFailedStatus(status) {
|
|
60857
60944
|
return status === "failed" || status === "declined";
|
|
60858
60945
|
}
|
|
60946
|
+
function isDeclinedStatus(status) {
|
|
60947
|
+
return status === "declined";
|
|
60948
|
+
}
|
|
60859
60949
|
function statusMetadata(status, fields = {}) {
|
|
60860
60950
|
return {
|
|
60861
60951
|
status: status ?? "unknown",
|