@autohq/cli 0.1.208 → 0.1.210
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 +87 -17
- package/dist/index.js +106 -17
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -19469,6 +19469,11 @@ var ConversationEntryStatusSchema = external_exports.enum([
|
|
|
19469
19469
|
"completed",
|
|
19470
19470
|
"failed"
|
|
19471
19471
|
]);
|
|
19472
|
+
var RuntimeTurnStatusSchema = external_exports.enum([
|
|
19473
|
+
"waiting_for_input",
|
|
19474
|
+
"completed",
|
|
19475
|
+
"failed"
|
|
19476
|
+
]);
|
|
19472
19477
|
var ConversationTextContentPartSchema = external_exports.object({
|
|
19473
19478
|
type: external_exports.literal("text"),
|
|
19474
19479
|
text: external_exports.string()
|
|
@@ -19622,7 +19627,7 @@ var RuntimeBridgeCommandDeliveryAcceptedSchema = external_exports.object({
|
|
|
19622
19627
|
result: external_exports.enum(["injected", "duplicate"]),
|
|
19623
19628
|
at: external_exports.string().datetime()
|
|
19624
19629
|
}).strict();
|
|
19625
|
-
var
|
|
19630
|
+
var RuntimeBridgeOutputEntryEnvelopeWireSchema = external_exports.object({
|
|
19626
19631
|
type: external_exports.literal("conversation.entry"),
|
|
19627
19632
|
sessionId: SessionIdSchema,
|
|
19628
19633
|
runtimeId: RuntimeIdSchema,
|
|
@@ -19635,8 +19640,18 @@ var RuntimeBridgeOutputEntryEnvelopeSchema = external_exports.object({
|
|
|
19635
19640
|
content: ConversationEntryContentSchema,
|
|
19636
19641
|
createdAt: external_exports.string().datetime(),
|
|
19637
19642
|
completedAt: external_exports.string().datetime().nullable(),
|
|
19638
|
-
|
|
19643
|
+
turnStatus: RuntimeTurnStatusSchema.optional()
|
|
19639
19644
|
}).strict();
|
|
19645
|
+
var LegacyRuntimeBridgeOutputEntryEnvelopeSchema = RuntimeBridgeOutputEntryEnvelopeWireSchema.omit({ turnStatus: true }).extend({
|
|
19646
|
+
sessionStatusAfter: external_exports.enum(["awaiting", "failed"])
|
|
19647
|
+
}).strict().transform(({ sessionStatusAfter, ...entry }) => ({
|
|
19648
|
+
...entry,
|
|
19649
|
+
turnStatus: legacyRuntimeTurnStatus(entry, sessionStatusAfter)
|
|
19650
|
+
}));
|
|
19651
|
+
var RuntimeBridgeOutputEntryEnvelopeSchema = external_exports.union([
|
|
19652
|
+
RuntimeBridgeOutputEntryEnvelopeWireSchema,
|
|
19653
|
+
LegacyRuntimeBridgeOutputEntryEnvelopeSchema
|
|
19654
|
+
]);
|
|
19640
19655
|
var RuntimeBridgeOutputDeltaEnvelopeSchema = external_exports.object({
|
|
19641
19656
|
type: external_exports.literal("conversation.delta"),
|
|
19642
19657
|
sessionId: SessionIdSchema,
|
|
@@ -19650,10 +19665,16 @@ var RuntimeBridgeOutputDeltaEnvelopeSchema = external_exports.object({
|
|
|
19650
19665
|
delta: ConversationTextDeltaSchema,
|
|
19651
19666
|
createdAt: external_exports.string().datetime()
|
|
19652
19667
|
}).strict();
|
|
19653
|
-
var RuntimeBridgeOutputEnvelopeSchema = external_exports.
|
|
19668
|
+
var RuntimeBridgeOutputEnvelopeSchema = external_exports.union([
|
|
19654
19669
|
RuntimeBridgeOutputEntryEnvelopeSchema,
|
|
19655
19670
|
RuntimeBridgeOutputDeltaEnvelopeSchema
|
|
19656
19671
|
]);
|
|
19672
|
+
function legacyRuntimeTurnStatus(entry, sessionStatusAfter) {
|
|
19673
|
+
if (sessionStatusAfter === "failed" || entry.status === "failed") {
|
|
19674
|
+
return "failed";
|
|
19675
|
+
}
|
|
19676
|
+
return entry.kind === "question" ? "waiting_for_input" : "completed";
|
|
19677
|
+
}
|
|
19657
19678
|
var RuntimeBridgeOutputAckSchema = external_exports.object({
|
|
19658
19679
|
type: external_exports.literal("runtime.output.ack"),
|
|
19659
19680
|
sessionId: SessionIdSchema,
|
|
@@ -22691,6 +22712,40 @@ var RunSummarySchema = external_exports.object({
|
|
|
22691
22712
|
)
|
|
22692
22713
|
});
|
|
22693
22714
|
|
|
22715
|
+
// ../../packages/schemas/src/session-turns.ts
|
|
22716
|
+
var SESSION_TURN_STATUSES = [
|
|
22717
|
+
"accepted",
|
|
22718
|
+
"in_progress",
|
|
22719
|
+
"waiting_for_input",
|
|
22720
|
+
"completed",
|
|
22721
|
+
"failed",
|
|
22722
|
+
"stale"
|
|
22723
|
+
];
|
|
22724
|
+
var SESSION_TURN_FAILURE_SCOPES = ["turn", "session"];
|
|
22725
|
+
var SessionTurnStatusSchema = external_exports.enum(SESSION_TURN_STATUSES);
|
|
22726
|
+
var SessionTurnFailureScopeSchema = external_exports.enum(
|
|
22727
|
+
SESSION_TURN_FAILURE_SCOPES
|
|
22728
|
+
);
|
|
22729
|
+
var SessionTurnRecordSchema = external_exports.object({
|
|
22730
|
+
id: external_exports.string().trim().min(1),
|
|
22731
|
+
sessionId: SessionIdSchema2,
|
|
22732
|
+
commandId: SessionCommandIdSchema2,
|
|
22733
|
+
runtimeId: RuntimeIdSchema2.nullable(),
|
|
22734
|
+
bridgeLeaseId: RuntimeBridgeLeaseIdSchema2.nullable(),
|
|
22735
|
+
status: SessionTurnStatusSchema,
|
|
22736
|
+
failureScope: SessionTurnFailureScopeSchema.nullable(),
|
|
22737
|
+
lastOutputSeq: external_exports.number().int().positive().nullable(),
|
|
22738
|
+
acceptedAt: external_exports.string().datetime().nullable(),
|
|
22739
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
22740
|
+
lastProgressAt: external_exports.string().datetime().nullable(),
|
|
22741
|
+
completedAt: external_exports.string().datetime().nullable(),
|
|
22742
|
+
failedAt: external_exports.string().datetime().nullable(),
|
|
22743
|
+
staleAt: external_exports.string().datetime().nullable(),
|
|
22744
|
+
error: JsonValueSchema2.nullable(),
|
|
22745
|
+
createdAt: external_exports.string().datetime(),
|
|
22746
|
+
updatedAt: external_exports.string().datetime()
|
|
22747
|
+
});
|
|
22748
|
+
|
|
22694
22749
|
// ../../packages/schemas/src/session-commands.ts
|
|
22695
22750
|
var SESSION_COMMAND_KINDS = [
|
|
22696
22751
|
"message",
|
|
@@ -23034,10 +23089,33 @@ function runtimeLogLevelEnabled(configured, lineLevel) {
|
|
|
23034
23089
|
return LEVEL_SEVERITY[lineLevel] >= LEVEL_SEVERITY[configured];
|
|
23035
23090
|
}
|
|
23036
23091
|
|
|
23092
|
+
// ../../packages/schemas/src/runtime-log-tailer.ts
|
|
23093
|
+
var RuntimeLogTailerWorkflowInputSchema = external_exports.object({
|
|
23094
|
+
sessionId: SessionIdSchema2,
|
|
23095
|
+
sandboxId: external_exports.string().trim().min(1)
|
|
23096
|
+
}).strict();
|
|
23097
|
+
var RUNTIME_TAIL_SANDBOX_STATES = [
|
|
23098
|
+
"running",
|
|
23099
|
+
"paused",
|
|
23100
|
+
"gone"
|
|
23101
|
+
];
|
|
23102
|
+
var RuntimeTailSandboxStateSchema = external_exports.enum(
|
|
23103
|
+
RUNTIME_TAIL_SANDBOX_STATES
|
|
23104
|
+
);
|
|
23105
|
+
var TailRuntimeLogResultSchema = external_exports.object({
|
|
23106
|
+
state: RuntimeTailSandboxStateSchema,
|
|
23107
|
+
forwardedLineCount: external_exports.number().int().nonnegative(),
|
|
23108
|
+
newOffset: external_exports.number().int().nonnegative(),
|
|
23109
|
+
// True when the durable log still has bytes past newOffset, so the workflow
|
|
23110
|
+
// should drain again immediately instead of waiting the poll interval.
|
|
23111
|
+
hadMore: external_exports.boolean()
|
|
23112
|
+
});
|
|
23113
|
+
|
|
23037
23114
|
// ../../packages/schemas/src/runtimes.ts
|
|
23038
23115
|
var RuntimeRecordSchema = external_exports.object({
|
|
23039
23116
|
id: RuntimeIdSchema2,
|
|
23040
23117
|
sandboxId: external_exports.string().trim().min(1).nullable(),
|
|
23118
|
+
logTailOffset: external_exports.number().int().nonnegative(),
|
|
23041
23119
|
createdAt: external_exports.string().datetime(),
|
|
23042
23120
|
updatedAt: external_exports.string().datetime()
|
|
23043
23121
|
});
|
|
@@ -26694,7 +26772,7 @@ Object.assign(lookup, {
|
|
|
26694
26772
|
// package.json
|
|
26695
26773
|
var package_default = {
|
|
26696
26774
|
name: "@autohq/cli",
|
|
26697
|
-
version: "0.1.
|
|
26775
|
+
version: "0.1.210",
|
|
26698
26776
|
license: "SEE LICENSE IN README.md",
|
|
26699
26777
|
publishConfig: {
|
|
26700
26778
|
access: "public"
|
|
@@ -27118,7 +27196,7 @@ function buildOutputEnvelope(context, outputSeq, projection) {
|
|
|
27118
27196
|
content: entry.content,
|
|
27119
27197
|
createdAt,
|
|
27120
27198
|
completedAt: entry.status === "in_progress" ? null : createdAt,
|
|
27121
|
-
...entry.
|
|
27199
|
+
...entry.turnStatus ? { turnStatus: entry.turnStatus } : {}
|
|
27122
27200
|
});
|
|
27123
27201
|
}
|
|
27124
27202
|
function isSuccessfulOutputAck(ack) {
|
|
@@ -27151,9 +27229,9 @@ var ClaudeCodeProjector = class {
|
|
|
27151
27229
|
const outputs = parsed.projections.map(
|
|
27152
27230
|
(entry) => ({
|
|
27153
27231
|
type: "entry",
|
|
27154
|
-
// A question
|
|
27155
|
-
// for an operator answer
|
|
27156
|
-
entry: entry.kind === "question" ? { ...entry,
|
|
27232
|
+
// A question means the delivered turn is parked on AskUserQuestion
|
|
27233
|
+
// waiting for an operator answer.
|
|
27234
|
+
entry: entry.kind === "question" ? { ...entry, turnStatus: "waiting_for_input" } : entry
|
|
27157
27235
|
})
|
|
27158
27236
|
);
|
|
27159
27237
|
if (parsed.result) {
|
|
@@ -27163,14 +27241,13 @@ var ClaudeCodeProjector = class {
|
|
|
27163
27241
|
}
|
|
27164
27242
|
};
|
|
27165
27243
|
function projectClaudeCodeResult(result) {
|
|
27166
|
-
const failedButRecoverable = isRecoverableToolUseDiagnostic(result);
|
|
27167
27244
|
return {
|
|
27168
27245
|
type: "entry",
|
|
27169
27246
|
entry: {
|
|
27170
27247
|
role: "system",
|
|
27171
27248
|
kind: "status",
|
|
27172
27249
|
status: result.isError ? "failed" : "completed",
|
|
27173
|
-
|
|
27250
|
+
turnStatus: result.isError ? "failed" : "completed",
|
|
27174
27251
|
content: {
|
|
27175
27252
|
parts: [
|
|
27176
27253
|
{
|
|
@@ -27182,13 +27259,6 @@ function projectClaudeCodeResult(result) {
|
|
|
27182
27259
|
}
|
|
27183
27260
|
};
|
|
27184
27261
|
}
|
|
27185
|
-
function isRecoverableToolUseDiagnostic(result) {
|
|
27186
|
-
if (!result.isError) {
|
|
27187
|
-
return false;
|
|
27188
|
-
}
|
|
27189
|
-
const message = result.errorMessage ?? "";
|
|
27190
|
-
return message.startsWith("[ede_diagnostic]") && message.includes("stop_reason=tool_use");
|
|
27191
|
-
}
|
|
27192
27262
|
function anthropicMessageIdFromStreamStart(message) {
|
|
27193
27263
|
const event = message.event;
|
|
27194
27264
|
if (event.type !== "message_start") {
|
package/dist/index.js
CHANGED
|
@@ -18589,6 +18589,49 @@ var init_session_introspection = __esm({
|
|
|
18589
18589
|
}
|
|
18590
18590
|
});
|
|
18591
18591
|
|
|
18592
|
+
// ../../packages/schemas/src/session-turns.ts
|
|
18593
|
+
var SESSION_TURN_STATUSES, SESSION_TURN_FAILURE_SCOPES, SessionTurnStatusSchema, SessionTurnFailureScopeSchema, SessionTurnRecordSchema;
|
|
18594
|
+
var init_session_turns = __esm({
|
|
18595
|
+
"../../packages/schemas/src/session-turns.ts"() {
|
|
18596
|
+
"use strict";
|
|
18597
|
+
init_zod();
|
|
18598
|
+
init_ids();
|
|
18599
|
+
init_primitives();
|
|
18600
|
+
SESSION_TURN_STATUSES = [
|
|
18601
|
+
"accepted",
|
|
18602
|
+
"in_progress",
|
|
18603
|
+
"waiting_for_input",
|
|
18604
|
+
"completed",
|
|
18605
|
+
"failed",
|
|
18606
|
+
"stale"
|
|
18607
|
+
];
|
|
18608
|
+
SESSION_TURN_FAILURE_SCOPES = ["turn", "session"];
|
|
18609
|
+
SessionTurnStatusSchema = external_exports.enum(SESSION_TURN_STATUSES);
|
|
18610
|
+
SessionTurnFailureScopeSchema = external_exports.enum(
|
|
18611
|
+
SESSION_TURN_FAILURE_SCOPES
|
|
18612
|
+
);
|
|
18613
|
+
SessionTurnRecordSchema = external_exports.object({
|
|
18614
|
+
id: external_exports.string().trim().min(1),
|
|
18615
|
+
sessionId: SessionIdSchema,
|
|
18616
|
+
commandId: SessionCommandIdSchema,
|
|
18617
|
+
runtimeId: RuntimeIdSchema.nullable(),
|
|
18618
|
+
bridgeLeaseId: RuntimeBridgeLeaseIdSchema.nullable(),
|
|
18619
|
+
status: SessionTurnStatusSchema,
|
|
18620
|
+
failureScope: SessionTurnFailureScopeSchema.nullable(),
|
|
18621
|
+
lastOutputSeq: external_exports.number().int().positive().nullable(),
|
|
18622
|
+
acceptedAt: external_exports.string().datetime().nullable(),
|
|
18623
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
18624
|
+
lastProgressAt: external_exports.string().datetime().nullable(),
|
|
18625
|
+
completedAt: external_exports.string().datetime().nullable(),
|
|
18626
|
+
failedAt: external_exports.string().datetime().nullable(),
|
|
18627
|
+
staleAt: external_exports.string().datetime().nullable(),
|
|
18628
|
+
error: JsonValueSchema.nullable(),
|
|
18629
|
+
createdAt: external_exports.string().datetime(),
|
|
18630
|
+
updatedAt: external_exports.string().datetime()
|
|
18631
|
+
});
|
|
18632
|
+
}
|
|
18633
|
+
});
|
|
18634
|
+
|
|
18592
18635
|
// ../../packages/schemas/src/session-commands.ts
|
|
18593
18636
|
var SESSION_COMMAND_KINDS, SESSION_DISPATCH_COMMAND_KINDS, SESSION_PERSISTED_COMMAND_KINDS, SESSION_LIFECYCLE_COMMAND_KINDS, SESSION_COMMAND_STATUSES, SESSION_DISPATCH_COMMAND_STATUSES, SessionCommandKindSchema, SessionPersistedCommandKindSchema, SessionDispatchCommandKindSchema, RunLifecycleCommandKindSchema, SessionCommandStatusSchema, SessionDispatchCommandStatusSchema, SessionCommandSenderSchema, MESSAGE_DELIVERY_MODES, MessageDeliveryModeSchema, TRIGGER_INJECTION_MODALITIES, TriggerInjectionModalitySchema, RunMessageCommandPayloadSchema, RunAnswerCommandPayloadSchema, RunLifecycleCommandPayloadSchema, SessionCommandPayloadSchema, CreateRunMessageCommandRequestSchema, CreateRunAnswerCommandRequestSchema, CreateRunLifecycleCommandRequestSchema, CreateSessionCommandRequestSchema, RunResolutionPolicySchema, AgentAddressedCommandTargetSchema, SessionCommandRecordBaseSchema, RunStartCommandPayloadSchema, RunStartWithMessageCommandPayloadSchema, SessionPersistedCommandPayloadSchema, SessionCommandRecordSchema, SessionDispatchMessageCommandPayloadSchema, SessionDispatchAnswerCommandPayloadSchema, SessionDispatchStopCommandPayloadSchema, SessionDispatchCommandPayloadSchema, SessionDispatchCommandRecordBaseSchema, SessionDispatchCommandRecordSchema;
|
|
18594
18637
|
var init_session_commands = __esm({
|
|
@@ -18957,6 +19000,36 @@ var init_runtime_log = __esm({
|
|
|
18957
19000
|
}
|
|
18958
19001
|
});
|
|
18959
19002
|
|
|
19003
|
+
// ../../packages/schemas/src/runtime-log-tailer.ts
|
|
19004
|
+
var RuntimeLogTailerWorkflowInputSchema, RUNTIME_TAIL_SANDBOX_STATES, RuntimeTailSandboxStateSchema, TailRuntimeLogResultSchema;
|
|
19005
|
+
var init_runtime_log_tailer = __esm({
|
|
19006
|
+
"../../packages/schemas/src/runtime-log-tailer.ts"() {
|
|
19007
|
+
"use strict";
|
|
19008
|
+
init_zod();
|
|
19009
|
+
init_ids();
|
|
19010
|
+
RuntimeLogTailerWorkflowInputSchema = external_exports.object({
|
|
19011
|
+
sessionId: SessionIdSchema,
|
|
19012
|
+
sandboxId: external_exports.string().trim().min(1)
|
|
19013
|
+
}).strict();
|
|
19014
|
+
RUNTIME_TAIL_SANDBOX_STATES = [
|
|
19015
|
+
"running",
|
|
19016
|
+
"paused",
|
|
19017
|
+
"gone"
|
|
19018
|
+
];
|
|
19019
|
+
RuntimeTailSandboxStateSchema = external_exports.enum(
|
|
19020
|
+
RUNTIME_TAIL_SANDBOX_STATES
|
|
19021
|
+
);
|
|
19022
|
+
TailRuntimeLogResultSchema = external_exports.object({
|
|
19023
|
+
state: RuntimeTailSandboxStateSchema,
|
|
19024
|
+
forwardedLineCount: external_exports.number().int().nonnegative(),
|
|
19025
|
+
newOffset: external_exports.number().int().nonnegative(),
|
|
19026
|
+
// True when the durable log still has bytes past newOffset, so the workflow
|
|
19027
|
+
// should drain again immediately instead of waiting the poll interval.
|
|
19028
|
+
hadMore: external_exports.boolean()
|
|
19029
|
+
});
|
|
19030
|
+
}
|
|
19031
|
+
});
|
|
19032
|
+
|
|
18960
19033
|
// ../../packages/schemas/src/runtimes.ts
|
|
18961
19034
|
var RuntimeRecordSchema, SessionCommandDispatchWorkflowInputSchema, SessionCommandDispatchSignalPayloadSchema, RealtimeRunCursorSchema;
|
|
18962
19035
|
var init_runtimes = __esm({
|
|
@@ -18967,6 +19040,7 @@ var init_runtimes = __esm({
|
|
|
18967
19040
|
RuntimeRecordSchema = external_exports.object({
|
|
18968
19041
|
id: RuntimeIdSchema,
|
|
18969
19042
|
sandboxId: external_exports.string().trim().min(1).nullable(),
|
|
19043
|
+
logTailOffset: external_exports.number().int().nonnegative(),
|
|
18970
19044
|
createdAt: external_exports.string().datetime(),
|
|
18971
19045
|
updatedAt: external_exports.string().datetime()
|
|
18972
19046
|
});
|
|
@@ -19021,10 +19095,12 @@ var init_src = __esm({
|
|
|
19021
19095
|
init_resources();
|
|
19022
19096
|
init_session_diagnostics();
|
|
19023
19097
|
init_session_introspection();
|
|
19098
|
+
init_session_turns();
|
|
19024
19099
|
init_secrets();
|
|
19025
19100
|
init_session_commands();
|
|
19026
19101
|
init_setup();
|
|
19027
19102
|
init_runtime_log();
|
|
19103
|
+
init_runtime_log_tailer();
|
|
19028
19104
|
init_runtimes();
|
|
19029
19105
|
init_sessions();
|
|
19030
19106
|
init_agents();
|
|
@@ -21715,7 +21791,7 @@ var init_package = __esm({
|
|
|
21715
21791
|
"package.json"() {
|
|
21716
21792
|
package_default = {
|
|
21717
21793
|
name: "@autohq/cli",
|
|
21718
|
-
version: "0.1.
|
|
21794
|
+
version: "0.1.210",
|
|
21719
21795
|
license: "SEE LICENSE IN README.md",
|
|
21720
21796
|
publishConfig: {
|
|
21721
21797
|
access: "public"
|
|
@@ -31121,6 +31197,11 @@ var ConversationEntryStatusSchema2 = external_exports.enum([
|
|
|
31121
31197
|
"completed",
|
|
31122
31198
|
"failed"
|
|
31123
31199
|
]);
|
|
31200
|
+
var RuntimeTurnStatusSchema = external_exports.enum([
|
|
31201
|
+
"waiting_for_input",
|
|
31202
|
+
"completed",
|
|
31203
|
+
"failed"
|
|
31204
|
+
]);
|
|
31124
31205
|
var ConversationTextContentPartSchema2 = external_exports.object({
|
|
31125
31206
|
type: external_exports.literal("text"),
|
|
31126
31207
|
text: external_exports.string()
|
|
@@ -31274,7 +31355,7 @@ var RuntimeBridgeCommandDeliveryAcceptedSchema = external_exports.object({
|
|
|
31274
31355
|
result: external_exports.enum(["injected", "duplicate"]),
|
|
31275
31356
|
at: external_exports.string().datetime()
|
|
31276
31357
|
}).strict();
|
|
31277
|
-
var
|
|
31358
|
+
var RuntimeBridgeOutputEntryEnvelopeWireSchema = external_exports.object({
|
|
31278
31359
|
type: external_exports.literal("conversation.entry"),
|
|
31279
31360
|
sessionId: SessionIdSchema2,
|
|
31280
31361
|
runtimeId: RuntimeIdSchema2,
|
|
@@ -31287,8 +31368,18 @@ var RuntimeBridgeOutputEntryEnvelopeSchema = external_exports.object({
|
|
|
31287
31368
|
content: ConversationEntryContentSchema2,
|
|
31288
31369
|
createdAt: external_exports.string().datetime(),
|
|
31289
31370
|
completedAt: external_exports.string().datetime().nullable(),
|
|
31290
|
-
|
|
31371
|
+
turnStatus: RuntimeTurnStatusSchema.optional()
|
|
31291
31372
|
}).strict();
|
|
31373
|
+
var LegacyRuntimeBridgeOutputEntryEnvelopeSchema = RuntimeBridgeOutputEntryEnvelopeWireSchema.omit({ turnStatus: true }).extend({
|
|
31374
|
+
sessionStatusAfter: external_exports.enum(["awaiting", "failed"])
|
|
31375
|
+
}).strict().transform(({ sessionStatusAfter, ...entry }) => ({
|
|
31376
|
+
...entry,
|
|
31377
|
+
turnStatus: legacyRuntimeTurnStatus(entry, sessionStatusAfter)
|
|
31378
|
+
}));
|
|
31379
|
+
var RuntimeBridgeOutputEntryEnvelopeSchema = external_exports.union([
|
|
31380
|
+
RuntimeBridgeOutputEntryEnvelopeWireSchema,
|
|
31381
|
+
LegacyRuntimeBridgeOutputEntryEnvelopeSchema
|
|
31382
|
+
]);
|
|
31292
31383
|
var RuntimeBridgeOutputDeltaEnvelopeSchema = external_exports.object({
|
|
31293
31384
|
type: external_exports.literal("conversation.delta"),
|
|
31294
31385
|
sessionId: SessionIdSchema2,
|
|
@@ -31302,10 +31393,16 @@ var RuntimeBridgeOutputDeltaEnvelopeSchema = external_exports.object({
|
|
|
31302
31393
|
delta: ConversationTextDeltaSchema2,
|
|
31303
31394
|
createdAt: external_exports.string().datetime()
|
|
31304
31395
|
}).strict();
|
|
31305
|
-
var RuntimeBridgeOutputEnvelopeSchema = external_exports.
|
|
31396
|
+
var RuntimeBridgeOutputEnvelopeSchema = external_exports.union([
|
|
31306
31397
|
RuntimeBridgeOutputEntryEnvelopeSchema,
|
|
31307
31398
|
RuntimeBridgeOutputDeltaEnvelopeSchema
|
|
31308
31399
|
]);
|
|
31400
|
+
function legacyRuntimeTurnStatus(entry, sessionStatusAfter) {
|
|
31401
|
+
if (sessionStatusAfter === "failed" || entry.status === "failed") {
|
|
31402
|
+
return "failed";
|
|
31403
|
+
}
|
|
31404
|
+
return entry.kind === "question" ? "waiting_for_input" : "completed";
|
|
31405
|
+
}
|
|
31309
31406
|
var RuntimeBridgeOutputAckSchema = external_exports.object({
|
|
31310
31407
|
type: external_exports.literal("runtime.output.ack"),
|
|
31311
31408
|
sessionId: SessionIdSchema2,
|
|
@@ -31772,7 +31869,7 @@ function buildOutputEnvelope(context, outputSeq, projection) {
|
|
|
31772
31869
|
content: entry.content,
|
|
31773
31870
|
createdAt,
|
|
31774
31871
|
completedAt: entry.status === "in_progress" ? null : createdAt,
|
|
31775
|
-
...entry.
|
|
31872
|
+
...entry.turnStatus ? { turnStatus: entry.turnStatus } : {}
|
|
31776
31873
|
});
|
|
31777
31874
|
}
|
|
31778
31875
|
function isSuccessfulOutputAck(ack) {
|
|
@@ -31806,9 +31903,9 @@ var ClaudeCodeProjector = class {
|
|
|
31806
31903
|
const outputs = parsed.projections.map(
|
|
31807
31904
|
(entry) => ({
|
|
31808
31905
|
type: "entry",
|
|
31809
|
-
// A question
|
|
31810
|
-
// for an operator answer
|
|
31811
|
-
entry: entry.kind === "question" ? { ...entry,
|
|
31906
|
+
// A question means the delivered turn is parked on AskUserQuestion
|
|
31907
|
+
// waiting for an operator answer.
|
|
31908
|
+
entry: entry.kind === "question" ? { ...entry, turnStatus: "waiting_for_input" } : entry
|
|
31812
31909
|
})
|
|
31813
31910
|
);
|
|
31814
31911
|
if (parsed.result) {
|
|
@@ -31818,14 +31915,13 @@ var ClaudeCodeProjector = class {
|
|
|
31818
31915
|
}
|
|
31819
31916
|
};
|
|
31820
31917
|
function projectClaudeCodeResult(result) {
|
|
31821
|
-
const failedButRecoverable = isRecoverableToolUseDiagnostic(result);
|
|
31822
31918
|
return {
|
|
31823
31919
|
type: "entry",
|
|
31824
31920
|
entry: {
|
|
31825
31921
|
role: "system",
|
|
31826
31922
|
kind: "status",
|
|
31827
31923
|
status: result.isError ? "failed" : "completed",
|
|
31828
|
-
|
|
31924
|
+
turnStatus: result.isError ? "failed" : "completed",
|
|
31829
31925
|
content: {
|
|
31830
31926
|
parts: [
|
|
31831
31927
|
{
|
|
@@ -31837,13 +31933,6 @@ function projectClaudeCodeResult(result) {
|
|
|
31837
31933
|
}
|
|
31838
31934
|
};
|
|
31839
31935
|
}
|
|
31840
|
-
function isRecoverableToolUseDiagnostic(result) {
|
|
31841
|
-
if (!result.isError) {
|
|
31842
|
-
return false;
|
|
31843
|
-
}
|
|
31844
|
-
const message = result.errorMessage ?? "";
|
|
31845
|
-
return message.startsWith("[ede_diagnostic]") && message.includes("stop_reason=tool_use");
|
|
31846
|
-
}
|
|
31847
31936
|
function anthropicMessageIdFromStreamStart(message) {
|
|
31848
31937
|
const event = message.event;
|
|
31849
31938
|
if (event.type !== "message_start") {
|