@autohq/cli 0.1.592 → 0.1.593

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.
@@ -37736,7 +37736,7 @@ Object.assign(lookup, {
37736
37736
  // package.json
37737
37737
  var package_default = {
37738
37738
  name: "@autohq/cli",
37739
- version: "0.1.592",
37739
+ version: "0.1.593",
37740
37740
  license: "SEE LICENSE IN README.md",
37741
37741
  publishConfig: {
37742
37742
  access: "public"
@@ -40412,6 +40412,35 @@ var TranscriptActivitySchema = external_exports.discriminatedUnion("type", [
40412
40412
  external_exports.object({
40413
40413
  type: external_exports.literal("run"),
40414
40414
  command: external_exports.string()
40415
+ }),
40416
+ external_exports.object({
40417
+ type: external_exports.literal("edit"),
40418
+ paths: external_exports.array(external_exports.string()).optional()
40419
+ }),
40420
+ external_exports.object({
40421
+ type: external_exports.literal("tool"),
40422
+ name: external_exports.string(),
40423
+ provider: external_exports.string().optional()
40424
+ }),
40425
+ external_exports.object({
40426
+ type: external_exports.literal("webSearch"),
40427
+ query: external_exports.string()
40428
+ }),
40429
+ external_exports.object({
40430
+ type: external_exports.literal("imageView"),
40431
+ path: external_exports.string()
40432
+ }),
40433
+ external_exports.object({
40434
+ type: external_exports.literal("collaboration"),
40435
+ action: external_exports.string()
40436
+ }),
40437
+ external_exports.object({
40438
+ type: external_exports.literal("wait"),
40439
+ durationMs: external_exports.number().nonnegative()
40440
+ }),
40441
+ external_exports.object({
40442
+ type: external_exports.literal("imageGeneration"),
40443
+ savedPath: external_exports.string().optional()
40415
40444
  })
40416
40445
  ]);
40417
40446
  var TranscriptToolMetadataSchema = external_exports.object({
@@ -40499,13 +40528,74 @@ var CodexMcpToolCallItemSchema = external_exports.object({
40499
40528
  error: external_exports.object({ message: external_exports.string() }).passthrough().nullish(),
40500
40529
  durationMs: external_exports.number().nonnegative().nullish()
40501
40530
  }).passthrough();
40531
+ var CodexDynamicToolCallItemSchema = external_exports.object({
40532
+ type: external_exports.literal("dynamicToolCall"),
40533
+ id: external_exports.string(),
40534
+ namespace: external_exports.string().nullish(),
40535
+ tool: external_exports.string().default(""),
40536
+ arguments: external_exports.unknown().optional(),
40537
+ status: external_exports.string().optional(),
40538
+ contentItems: external_exports.array(external_exports.unknown()).nullish(),
40539
+ success: external_exports.boolean().nullish(),
40540
+ durationMs: external_exports.number().nonnegative().nullish()
40541
+ }).passthrough();
40542
+ var CodexCollabAgentToolCallItemSchema = external_exports.object({
40543
+ type: external_exports.literal("collabAgentToolCall"),
40544
+ id: external_exports.string(),
40545
+ tool: external_exports.string(),
40546
+ status: external_exports.string().optional(),
40547
+ senderThreadId: external_exports.string().default(""),
40548
+ receiverThreadIds: external_exports.array(external_exports.string()).default([]),
40549
+ prompt: external_exports.string().nullish(),
40550
+ model: external_exports.string().nullish(),
40551
+ reasoningEffort: external_exports.string().nullish(),
40552
+ agentsStates: external_exports.record(external_exports.string(), external_exports.unknown()).default({})
40553
+ }).passthrough();
40554
+ var CodexSubAgentActivityItemSchema = external_exports.object({
40555
+ type: external_exports.literal("subAgentActivity"),
40556
+ id: external_exports.string(),
40557
+ kind: external_exports.string(),
40558
+ agentThreadId: external_exports.string(),
40559
+ agentPath: external_exports.string()
40560
+ }).passthrough();
40561
+ var CodexWebSearchItemSchema = external_exports.object({
40562
+ type: external_exports.literal("webSearch"),
40563
+ id: external_exports.string(),
40564
+ query: external_exports.string().default(""),
40565
+ action: external_exports.unknown().nullish()
40566
+ }).passthrough();
40567
+ var CodexImageViewItemSchema = external_exports.object({
40568
+ type: external_exports.literal("imageView"),
40569
+ id: external_exports.string(),
40570
+ path: external_exports.string()
40571
+ }).passthrough();
40572
+ var CodexSleepItemSchema = external_exports.object({
40573
+ type: external_exports.literal("sleep"),
40574
+ id: external_exports.string(),
40575
+ durationMs: external_exports.number().nonnegative()
40576
+ }).passthrough();
40577
+ var CodexImageGenerationItemSchema = external_exports.object({
40578
+ type: external_exports.literal("imageGeneration"),
40579
+ id: external_exports.string(),
40580
+ status: external_exports.string().optional(),
40581
+ revisedPrompt: external_exports.string().nullish(),
40582
+ result: external_exports.string().default(""),
40583
+ savedPath: external_exports.string().optional()
40584
+ }).passthrough();
40502
40585
  var CodexItemSchema = external_exports.discriminatedUnion("type", [
40503
40586
  CodexUserMessageItemSchema,
40504
40587
  CodexAgentMessageItemSchema,
40505
40588
  CodexReasoningItemSchema,
40506
40589
  CodexCommandExecutionItemSchema,
40507
40590
  CodexFileChangeItemSchema,
40508
- CodexMcpToolCallItemSchema
40591
+ CodexMcpToolCallItemSchema,
40592
+ CodexDynamicToolCallItemSchema,
40593
+ CodexCollabAgentToolCallItemSchema,
40594
+ CodexSubAgentActivityItemSchema,
40595
+ CodexWebSearchItemSchema,
40596
+ CodexImageViewItemSchema,
40597
+ CodexSleepItemSchema,
40598
+ CodexImageGenerationItemSchema
40509
40599
  ]);
40510
40600
  var OptionalCodexItemSchema = external_exports.unknown().transform((value2) => {
40511
40601
  const parsed = CodexItemSchema.safeParse(value2);
@@ -84522,7 +84612,10 @@ var ClaudeCodeProjector = class {
84522
84612
  this.activeParts.clear();
84523
84613
  this.activeToolInputs.clear();
84524
84614
  this.interruptMarkerSeen = false;
84525
- return this.ensureResponseStarted(this.currentMessageId);
84615
+ return [
84616
+ ...this.ensureResponseStarted(this.currentMessageId),
84617
+ uiChunk({ type: "start-step" })
84618
+ ];
84526
84619
  }
84527
84620
  if (message.event.type === "message_stop") {
84528
84621
  const outputs = [
@@ -84695,7 +84788,8 @@ var ClaudeCodeProjector = class {
84695
84788
  const messageId = messageProjection?.messageId ?? toolCallProjections.find((projection) => projection.messageId)?.messageId ?? UNKNOWN_MESSAGE_ID;
84696
84789
  const standalone = this.activeResponseMessageId === null;
84697
84790
  const outputs = [
84698
- ...this.ensureResponseStarted(messageId)
84791
+ ...this.ensureResponseStarted(messageId),
84792
+ uiChunk({ type: "start-step" })
84699
84793
  ];
84700
84794
  if (messageProjection) {
84701
84795
  outputs.push(...messagePartChunks(messageProjection));
@@ -84703,7 +84797,8 @@ var ClaudeCodeProjector = class {
84703
84797
  outputs.push(
84704
84798
  ...toolCallProjections.flatMap(
84705
84799
  (projection) => toolCallChunks(projection)
84706
- )
84800
+ ),
84801
+ uiChunk({ type: "finish-step" })
84707
84802
  );
84708
84803
  if (standalone && toolCallProjections.length === 0) {
84709
84804
  outputs.push(uiChunk({ type: "finish", finishReason: "stop" }));
@@ -87245,12 +87340,14 @@ var CodexProjector = class {
87245
87340
  activeToolCalls = /* @__PURE__ */ new Set();
87246
87341
  activeToolMetadata = /* @__PURE__ */ new Map();
87247
87342
  activeToolOutput = /* @__PURE__ */ new Map();
87343
+ activeSteps = /* @__PURE__ */ new Set();
87248
87344
  activeResponseMessageId = null;
87249
87345
  project(notification) {
87250
87346
  switch (notification.type) {
87251
87347
  case "agentMessageDelta":
87252
87348
  return [
87253
87349
  ...this.ensureResponseStarted(notification.itemId),
87350
+ ...this.ensureStepStarted(notification.itemId),
87254
87351
  ...this.projectAgentMessageDelta(
87255
87352
  notification.itemId,
87256
87353
  notification.delta
@@ -87277,7 +87374,10 @@ var CodexProjector = class {
87277
87374
  case "itemCompleted":
87278
87375
  return this.projectItem(notification.item, "completed");
87279
87376
  case "turnCompleted": {
87280
- const outputs = this.endAllReasoningParts();
87377
+ const outputs = [
87378
+ ...this.endAllReasoningParts(),
87379
+ ...this.finishAllSteps()
87380
+ ];
87281
87381
  this.activeResponseMessageId = null;
87282
87382
  this.activeAgentMessages.clear();
87283
87383
  this.agentMessagePhases.clear();
@@ -87360,7 +87460,10 @@ var CodexProjector = class {
87360
87460
  if (delta.length === 0) {
87361
87461
  return [];
87362
87462
  }
87363
- const outputs = this.ensureResponseStarted(itemId);
87463
+ const outputs = [
87464
+ ...this.ensureResponseStarted(itemId),
87465
+ ...this.ensureStepStarted(itemId)
87466
+ ];
87364
87467
  const active = this.activeReasoningParts.get(itemId);
87365
87468
  if (active && active.summaryIndex !== summaryIndex) {
87366
87469
  outputs.push(...this.endReasoningPart(itemId));
@@ -87407,10 +87510,15 @@ var CodexProjector = class {
87407
87510
  }
87408
87511
  return [
87409
87512
  ...this.ensureResponseStarted(item.id),
87513
+ ...this.ensureStepStarted(item.id),
87410
87514
  ...this.projectAgentMessageItem(item, phase)
87411
87515
  ];
87412
87516
  case "reasoning":
87413
- return this.projectReasoningItem(item, phase);
87517
+ return [
87518
+ ...this.ensureResponseStarted(item.id),
87519
+ ...this.ensureStepStarted(item.id),
87520
+ ...this.projectReasoningItem(item, phase)
87521
+ ];
87414
87522
  case "commandExecution":
87415
87523
  return this.projectToolItem({
87416
87524
  phase,
@@ -87440,7 +87548,14 @@ var CodexProjector = class {
87440
87548
  isDenied: isDeclinedStatus(item.status),
87441
87549
  isError: isFailedStatus(item.status),
87442
87550
  title: "apply_patch",
87443
- toolMetadata: statusMetadata(item.status)
87551
+ toolMetadata: statusMetadata(item.status, {
87552
+ activities: [
87553
+ {
87554
+ type: "edit",
87555
+ paths: fileChangePaths(item.changes)
87556
+ }
87557
+ ]
87558
+ })
87444
87559
  });
87445
87560
  case "mcpToolCall":
87446
87561
  if (isAskUserMcpTool(item.server, item.tool)) {
@@ -87460,6 +87575,132 @@ var CodexProjector = class {
87460
87575
  ...item.durationMs != null ? { durationMs: item.durationMs } : {}
87461
87576
  })
87462
87577
  });
87578
+ case "dynamicToolCall": {
87579
+ const name23 = item.namespace ? `${item.namespace}.${item.tool}` : item.tool;
87580
+ return this.projectToolItem({
87581
+ phase,
87582
+ itemId: item.id,
87583
+ name: name23,
87584
+ input: toJsonValue(item.arguments),
87585
+ output: {
87586
+ contentItems: toJsonValue(item.contentItems),
87587
+ success: item.success
87588
+ },
87589
+ isError: isFailedStatus(item.status) || item.success === false,
87590
+ title: name23,
87591
+ toolMetadata: statusMetadata(item.status, {
87592
+ tool: item.tool,
87593
+ ...item.namespace ? { server: item.namespace } : {},
87594
+ activities: [
87595
+ {
87596
+ type: "tool",
87597
+ name: item.tool,
87598
+ ...item.namespace ? { provider: item.namespace } : {}
87599
+ }
87600
+ ],
87601
+ ...item.durationMs != null ? { durationMs: item.durationMs } : {}
87602
+ })
87603
+ });
87604
+ }
87605
+ case "collabAgentToolCall":
87606
+ return this.projectToolItem({
87607
+ phase,
87608
+ itemId: item.id,
87609
+ name: `collaboration.${item.tool}`,
87610
+ input: {
87611
+ prompt: item.prompt,
87612
+ receiverThreadIds: item.receiverThreadIds,
87613
+ model: item.model,
87614
+ reasoningEffort: item.reasoningEffort
87615
+ },
87616
+ output: {
87617
+ status: item.status ?? "unknown",
87618
+ agentsStates: item.agentsStates
87619
+ },
87620
+ isError: isFailedStatus(item.status),
87621
+ title: item.tool,
87622
+ toolMetadata: statusMetadata(item.status, {
87623
+ activities: [{ type: "collaboration", action: item.tool }]
87624
+ })
87625
+ });
87626
+ case "subAgentActivity":
87627
+ return this.projectToolItem({
87628
+ phase,
87629
+ itemId: item.id,
87630
+ name: "collaboration.sub_agent_activity",
87631
+ input: {
87632
+ kind: item.kind,
87633
+ agentThreadId: item.agentThreadId,
87634
+ agentPath: item.agentPath
87635
+ },
87636
+ output: { status: "completed" },
87637
+ isError: false,
87638
+ title: item.kind,
87639
+ toolMetadata: {
87640
+ activities: [{ type: "collaboration", action: item.kind }]
87641
+ }
87642
+ });
87643
+ case "webSearch":
87644
+ return this.projectToolItem({
87645
+ phase,
87646
+ itemId: item.id,
87647
+ name: "web_search",
87648
+ input: { query: item.query, action: toJsonValue(item.action) },
87649
+ output: { status: "completed" },
87650
+ isError: false,
87651
+ title: item.query || "Web search",
87652
+ toolMetadata: {
87653
+ activities: [{ type: "webSearch", query: item.query }]
87654
+ }
87655
+ });
87656
+ case "imageView":
87657
+ return this.projectToolItem({
87658
+ phase,
87659
+ itemId: item.id,
87660
+ name: "view_image",
87661
+ input: { path: item.path },
87662
+ output: { status: "viewed" },
87663
+ isError: false,
87664
+ title: item.path,
87665
+ toolMetadata: {
87666
+ activities: [{ type: "imageView", path: item.path }]
87667
+ }
87668
+ });
87669
+ case "sleep":
87670
+ return this.projectToolItem({
87671
+ phase,
87672
+ itemId: item.id,
87673
+ name: "wait",
87674
+ input: { durationMs: item.durationMs },
87675
+ output: { status: "completed" },
87676
+ isError: false,
87677
+ title: "Wait",
87678
+ toolMetadata: {
87679
+ activities: [{ type: "wait", durationMs: item.durationMs }],
87680
+ durationMs: item.durationMs
87681
+ }
87682
+ });
87683
+ case "imageGeneration":
87684
+ return this.projectToolItem({
87685
+ phase,
87686
+ itemId: item.id,
87687
+ name: "image_generation",
87688
+ input: { prompt: item.revisedPrompt },
87689
+ output: {
87690
+ result: item.result,
87691
+ ...item.savedPath ? { savedPath: item.savedPath } : {}
87692
+ },
87693
+ isError: isFailedStatus(item.status),
87694
+ title: item.revisedPrompt ?? "Generate image",
87695
+ toolMetadata: statusMetadata(item.status, {
87696
+ activities: [
87697
+ {
87698
+ type: "imageGeneration",
87699
+ ...item.savedPath ? { savedPath: item.savedPath } : {}
87700
+ }
87701
+ ]
87702
+ })
87703
+ });
87463
87704
  default:
87464
87705
  return [];
87465
87706
  }
@@ -87467,6 +87708,7 @@ var CodexProjector = class {
87467
87708
  projectToolItem(input) {
87468
87709
  const outputs = [];
87469
87710
  outputs.push(...this.ensureResponseStarted(input.itemId));
87711
+ outputs.push(...this.ensureStepStarted(input.itemId));
87470
87712
  if (input.toolMetadata) {
87471
87713
  this.activeToolMetadata.set(input.itemId, input.toolMetadata);
87472
87714
  }
@@ -87482,7 +87724,7 @@ var CodexProjector = class {
87482
87724
  input.output = this.activeToolOutput.get(input.itemId)?.output ?? "";
87483
87725
  }
87484
87726
  outputs.push(toolOutputChunk(input));
87485
- outputs.push(uiChunk2({ type: "finish-step" }));
87727
+ outputs.push(...this.finishStep(input.itemId));
87486
87728
  this.activeToolCalls.delete(input.itemId);
87487
87729
  this.activeToolMetadata.delete(input.itemId);
87488
87730
  this.activeToolOutput.delete(input.itemId);
@@ -87515,7 +87757,7 @@ var CodexProjector = class {
87515
87757
  }
87516
87758
  outputs.push(
87517
87759
  textBoundaryChunk("text-end", item.id, messagePhase),
87518
- uiChunk2({ type: "finish-step" })
87760
+ ...this.finishStep(item.id)
87519
87761
  );
87520
87762
  this.activeAgentMessages.delete(item.id);
87521
87763
  this.agentMessagePhases.delete(item.id);
@@ -87530,15 +87772,11 @@ var CodexProjector = class {
87530
87772
  this.streamedReasoningIndexes.delete(item.id);
87531
87773
  if (streamedIndexes && streamedIndexes.size > 0) {
87532
87774
  outputs.push(...reasoningItemChunks(item, streamedIndexes));
87533
- outputs.push(uiChunk2({ type: "finish-step" }));
87775
+ outputs.push(...this.finishStep(item.id));
87534
87776
  return outputs;
87535
87777
  }
87536
87778
  const completedChunks = reasoningItemChunks(item);
87537
- return completedChunks.length > 0 ? [
87538
- ...this.ensureResponseStarted(item.id),
87539
- ...completedChunks,
87540
- uiChunk2({ type: "finish-step" })
87541
- ] : [];
87779
+ return [...completedChunks, ...this.finishStep(item.id)];
87542
87780
  }
87543
87781
  endReasoningPart(itemId) {
87544
87782
  const active = this.activeReasoningParts.get(itemId);
@@ -87560,6 +87798,26 @@ var CodexProjector = class {
87560
87798
  this.activeResponseMessageId = messageId;
87561
87799
  return [uiChunk2({ type: "start", messageId })];
87562
87800
  }
87801
+ ensureStepStarted(itemId) {
87802
+ if (this.activeSteps.has(itemId)) {
87803
+ return [];
87804
+ }
87805
+ this.activeSteps.add(itemId);
87806
+ return [uiChunk2({ type: "start-step" })];
87807
+ }
87808
+ finishStep(itemId) {
87809
+ if (!this.activeSteps.delete(itemId)) {
87810
+ return [];
87811
+ }
87812
+ return [uiChunk2({ type: "finish-step" })];
87813
+ }
87814
+ finishAllSteps() {
87815
+ const outputs = [...this.activeSteps].map(
87816
+ () => uiChunk2({ type: "finish-step" })
87817
+ );
87818
+ this.activeSteps.clear();
87819
+ return outputs;
87820
+ }
87563
87821
  };
87564
87822
  function emptyToolOutput() {
87565
87823
  return { bytes: 0, output: "", truncated: false };
@@ -87683,6 +87941,14 @@ function commandActivities(actions) {
87683
87941
  }
87684
87942
  });
87685
87943
  }
87944
+ function fileChangePaths(changes) {
87945
+ return changes.flatMap((change) => {
87946
+ if (typeof change !== "object" || change === null || !("path" in change) || typeof change.path !== "string") {
87947
+ return [];
87948
+ }
87949
+ return [change.path];
87950
+ });
87951
+ }
87686
87952
  function turnCompletionEntry(notification) {
87687
87953
  if (notification.status === "failed") {
87688
87954
  const detail = notification.errorMessage ?? "unknown error";
package/dist/index.js CHANGED
@@ -17070,6 +17070,35 @@ var init_transcript_activity = __esm({
17070
17070
  external_exports.object({
17071
17071
  type: external_exports.literal("run"),
17072
17072
  command: external_exports.string()
17073
+ }),
17074
+ external_exports.object({
17075
+ type: external_exports.literal("edit"),
17076
+ paths: external_exports.array(external_exports.string()).optional()
17077
+ }),
17078
+ external_exports.object({
17079
+ type: external_exports.literal("tool"),
17080
+ name: external_exports.string(),
17081
+ provider: external_exports.string().optional()
17082
+ }),
17083
+ external_exports.object({
17084
+ type: external_exports.literal("webSearch"),
17085
+ query: external_exports.string()
17086
+ }),
17087
+ external_exports.object({
17088
+ type: external_exports.literal("imageView"),
17089
+ path: external_exports.string()
17090
+ }),
17091
+ external_exports.object({
17092
+ type: external_exports.literal("collaboration"),
17093
+ action: external_exports.string()
17094
+ }),
17095
+ external_exports.object({
17096
+ type: external_exports.literal("wait"),
17097
+ durationMs: external_exports.number().nonnegative()
17098
+ }),
17099
+ external_exports.object({
17100
+ type: external_exports.literal("imageGeneration"),
17101
+ savedPath: external_exports.string().optional()
17073
17102
  })
17074
17103
  ]);
17075
17104
  TranscriptToolMetadataSchema = external_exports.object({
@@ -17276,7 +17305,7 @@ function parseApprovalRequest(method, requestId, params) {
17276
17305
  return null;
17277
17306
  }
17278
17307
  }
17279
- var CodexRequestIdSchema, CodexTurnStatusSchema, CodexUserMessageItemSchema, CodexAgentMessageItemSchema, CodexReasoningItemSchema, CodexCommandActionSchema, CodexCommandExecutionItemSchema, CodexFileChangeItemSchema, CodexMcpToolCallItemSchema, CodexItemSchema, OptionalCodexItemSchema, CodexItemEnvelopeSchema, CodexTurnEnvelopeSchema, CodexTokenUsageSchema, CodexTokenUsageEnvelopeSchema, CodexFrameSchema, APPROVE_OPTION_LABEL, DECLINE_OPTION_LABEL;
17308
+ var CodexRequestIdSchema, CodexTurnStatusSchema, CodexUserMessageItemSchema, CodexAgentMessageItemSchema, CodexReasoningItemSchema, CodexCommandActionSchema, CodexCommandExecutionItemSchema, CodexFileChangeItemSchema, CodexMcpToolCallItemSchema, CodexDynamicToolCallItemSchema, CodexCollabAgentToolCallItemSchema, CodexSubAgentActivityItemSchema, CodexWebSearchItemSchema, CodexImageViewItemSchema, CodexSleepItemSchema, CodexImageGenerationItemSchema, CodexItemSchema, OptionalCodexItemSchema, CodexItemEnvelopeSchema, CodexTurnEnvelopeSchema, CodexTokenUsageSchema, CodexTokenUsageEnvelopeSchema, CodexFrameSchema, APPROVE_OPTION_LABEL, DECLINE_OPTION_LABEL;
17280
17309
  var init_codex = __esm({
17281
17310
  "../../packages/schemas/src/codex.ts"() {
17282
17311
  "use strict";
@@ -17354,13 +17383,74 @@ var init_codex = __esm({
17354
17383
  error: external_exports.object({ message: external_exports.string() }).passthrough().nullish(),
17355
17384
  durationMs: external_exports.number().nonnegative().nullish()
17356
17385
  }).passthrough();
17386
+ CodexDynamicToolCallItemSchema = external_exports.object({
17387
+ type: external_exports.literal("dynamicToolCall"),
17388
+ id: external_exports.string(),
17389
+ namespace: external_exports.string().nullish(),
17390
+ tool: external_exports.string().default(""),
17391
+ arguments: external_exports.unknown().optional(),
17392
+ status: external_exports.string().optional(),
17393
+ contentItems: external_exports.array(external_exports.unknown()).nullish(),
17394
+ success: external_exports.boolean().nullish(),
17395
+ durationMs: external_exports.number().nonnegative().nullish()
17396
+ }).passthrough();
17397
+ CodexCollabAgentToolCallItemSchema = external_exports.object({
17398
+ type: external_exports.literal("collabAgentToolCall"),
17399
+ id: external_exports.string(),
17400
+ tool: external_exports.string(),
17401
+ status: external_exports.string().optional(),
17402
+ senderThreadId: external_exports.string().default(""),
17403
+ receiverThreadIds: external_exports.array(external_exports.string()).default([]),
17404
+ prompt: external_exports.string().nullish(),
17405
+ model: external_exports.string().nullish(),
17406
+ reasoningEffort: external_exports.string().nullish(),
17407
+ agentsStates: external_exports.record(external_exports.string(), external_exports.unknown()).default({})
17408
+ }).passthrough();
17409
+ CodexSubAgentActivityItemSchema = external_exports.object({
17410
+ type: external_exports.literal("subAgentActivity"),
17411
+ id: external_exports.string(),
17412
+ kind: external_exports.string(),
17413
+ agentThreadId: external_exports.string(),
17414
+ agentPath: external_exports.string()
17415
+ }).passthrough();
17416
+ CodexWebSearchItemSchema = external_exports.object({
17417
+ type: external_exports.literal("webSearch"),
17418
+ id: external_exports.string(),
17419
+ query: external_exports.string().default(""),
17420
+ action: external_exports.unknown().nullish()
17421
+ }).passthrough();
17422
+ CodexImageViewItemSchema = external_exports.object({
17423
+ type: external_exports.literal("imageView"),
17424
+ id: external_exports.string(),
17425
+ path: external_exports.string()
17426
+ }).passthrough();
17427
+ CodexSleepItemSchema = external_exports.object({
17428
+ type: external_exports.literal("sleep"),
17429
+ id: external_exports.string(),
17430
+ durationMs: external_exports.number().nonnegative()
17431
+ }).passthrough();
17432
+ CodexImageGenerationItemSchema = external_exports.object({
17433
+ type: external_exports.literal("imageGeneration"),
17434
+ id: external_exports.string(),
17435
+ status: external_exports.string().optional(),
17436
+ revisedPrompt: external_exports.string().nullish(),
17437
+ result: external_exports.string().default(""),
17438
+ savedPath: external_exports.string().optional()
17439
+ }).passthrough();
17357
17440
  CodexItemSchema = external_exports.discriminatedUnion("type", [
17358
17441
  CodexUserMessageItemSchema,
17359
17442
  CodexAgentMessageItemSchema,
17360
17443
  CodexReasoningItemSchema,
17361
17444
  CodexCommandExecutionItemSchema,
17362
17445
  CodexFileChangeItemSchema,
17363
- CodexMcpToolCallItemSchema
17446
+ CodexMcpToolCallItemSchema,
17447
+ CodexDynamicToolCallItemSchema,
17448
+ CodexCollabAgentToolCallItemSchema,
17449
+ CodexSubAgentActivityItemSchema,
17450
+ CodexWebSearchItemSchema,
17451
+ CodexImageViewItemSchema,
17452
+ CodexSleepItemSchema,
17453
+ CodexImageGenerationItemSchema
17364
17454
  ]);
17365
17455
  OptionalCodexItemSchema = external_exports.unknown().transform((value) => {
17366
17456
  const parsed = CodexItemSchema.safeParse(value);
@@ -90615,7 +90705,7 @@ var init_package = __esm({
90615
90705
  "package.json"() {
90616
90706
  package_default = {
90617
90707
  name: "@autohq/cli",
90618
- version: "0.1.592",
90708
+ version: "0.1.593",
90619
90709
  license: "SEE LICENSE IN README.md",
90620
90710
  publishConfig: {
90621
90711
  access: "public"
@@ -105577,7 +105667,10 @@ var ClaudeCodeProjector = class {
105577
105667
  this.activeParts.clear();
105578
105668
  this.activeToolInputs.clear();
105579
105669
  this.interruptMarkerSeen = false;
105580
- return this.ensureResponseStarted(this.currentMessageId);
105670
+ return [
105671
+ ...this.ensureResponseStarted(this.currentMessageId),
105672
+ uiChunk({ type: "start-step" })
105673
+ ];
105581
105674
  }
105582
105675
  if (message.event.type === "message_stop") {
105583
105676
  const outputs = [
@@ -105750,7 +105843,8 @@ var ClaudeCodeProjector = class {
105750
105843
  const messageId = messageProjection?.messageId ?? toolCallProjections.find((projection) => projection.messageId)?.messageId ?? UNKNOWN_MESSAGE_ID;
105751
105844
  const standalone = this.activeResponseMessageId === null;
105752
105845
  const outputs = [
105753
- ...this.ensureResponseStarted(messageId)
105846
+ ...this.ensureResponseStarted(messageId),
105847
+ uiChunk({ type: "start-step" })
105754
105848
  ];
105755
105849
  if (messageProjection) {
105756
105850
  outputs.push(...messagePartChunks(messageProjection));
@@ -105758,7 +105852,8 @@ var ClaudeCodeProjector = class {
105758
105852
  outputs.push(
105759
105853
  ...toolCallProjections.flatMap(
105760
105854
  (projection) => toolCallChunks(projection)
105761
- )
105855
+ ),
105856
+ uiChunk({ type: "finish-step" })
105762
105857
  );
105763
105858
  if (standalone && toolCallProjections.length === 0) {
105764
105859
  outputs.push(uiChunk({ type: "finish", finishReason: "stop" }));
@@ -108310,12 +108405,14 @@ var CodexProjector = class {
108310
108405
  activeToolCalls = /* @__PURE__ */ new Set();
108311
108406
  activeToolMetadata = /* @__PURE__ */ new Map();
108312
108407
  activeToolOutput = /* @__PURE__ */ new Map();
108408
+ activeSteps = /* @__PURE__ */ new Set();
108313
108409
  activeResponseMessageId = null;
108314
108410
  project(notification) {
108315
108411
  switch (notification.type) {
108316
108412
  case "agentMessageDelta":
108317
108413
  return [
108318
108414
  ...this.ensureResponseStarted(notification.itemId),
108415
+ ...this.ensureStepStarted(notification.itemId),
108319
108416
  ...this.projectAgentMessageDelta(
108320
108417
  notification.itemId,
108321
108418
  notification.delta
@@ -108342,7 +108439,10 @@ var CodexProjector = class {
108342
108439
  case "itemCompleted":
108343
108440
  return this.projectItem(notification.item, "completed");
108344
108441
  case "turnCompleted": {
108345
- const outputs = this.endAllReasoningParts();
108442
+ const outputs = [
108443
+ ...this.endAllReasoningParts(),
108444
+ ...this.finishAllSteps()
108445
+ ];
108346
108446
  this.activeResponseMessageId = null;
108347
108447
  this.activeAgentMessages.clear();
108348
108448
  this.agentMessagePhases.clear();
@@ -108425,7 +108525,10 @@ var CodexProjector = class {
108425
108525
  if (delta.length === 0) {
108426
108526
  return [];
108427
108527
  }
108428
- const outputs = this.ensureResponseStarted(itemId);
108528
+ const outputs = [
108529
+ ...this.ensureResponseStarted(itemId),
108530
+ ...this.ensureStepStarted(itemId)
108531
+ ];
108429
108532
  const active = this.activeReasoningParts.get(itemId);
108430
108533
  if (active && active.summaryIndex !== summaryIndex) {
108431
108534
  outputs.push(...this.endReasoningPart(itemId));
@@ -108472,10 +108575,15 @@ var CodexProjector = class {
108472
108575
  }
108473
108576
  return [
108474
108577
  ...this.ensureResponseStarted(item.id),
108578
+ ...this.ensureStepStarted(item.id),
108475
108579
  ...this.projectAgentMessageItem(item, phase)
108476
108580
  ];
108477
108581
  case "reasoning":
108478
- return this.projectReasoningItem(item, phase);
108582
+ return [
108583
+ ...this.ensureResponseStarted(item.id),
108584
+ ...this.ensureStepStarted(item.id),
108585
+ ...this.projectReasoningItem(item, phase)
108586
+ ];
108479
108587
  case "commandExecution":
108480
108588
  return this.projectToolItem({
108481
108589
  phase,
@@ -108505,7 +108613,14 @@ var CodexProjector = class {
108505
108613
  isDenied: isDeclinedStatus(item.status),
108506
108614
  isError: isFailedStatus(item.status),
108507
108615
  title: "apply_patch",
108508
- toolMetadata: statusMetadata(item.status)
108616
+ toolMetadata: statusMetadata(item.status, {
108617
+ activities: [
108618
+ {
108619
+ type: "edit",
108620
+ paths: fileChangePaths(item.changes)
108621
+ }
108622
+ ]
108623
+ })
108509
108624
  });
108510
108625
  case "mcpToolCall":
108511
108626
  if (isAskUserMcpTool(item.server, item.tool)) {
@@ -108525,6 +108640,132 @@ var CodexProjector = class {
108525
108640
  ...item.durationMs != null ? { durationMs: item.durationMs } : {}
108526
108641
  })
108527
108642
  });
108643
+ case "dynamicToolCall": {
108644
+ const name = item.namespace ? `${item.namespace}.${item.tool}` : item.tool;
108645
+ return this.projectToolItem({
108646
+ phase,
108647
+ itemId: item.id,
108648
+ name,
108649
+ input: toJsonValue(item.arguments),
108650
+ output: {
108651
+ contentItems: toJsonValue(item.contentItems),
108652
+ success: item.success
108653
+ },
108654
+ isError: isFailedStatus(item.status) || item.success === false,
108655
+ title: name,
108656
+ toolMetadata: statusMetadata(item.status, {
108657
+ tool: item.tool,
108658
+ ...item.namespace ? { server: item.namespace } : {},
108659
+ activities: [
108660
+ {
108661
+ type: "tool",
108662
+ name: item.tool,
108663
+ ...item.namespace ? { provider: item.namespace } : {}
108664
+ }
108665
+ ],
108666
+ ...item.durationMs != null ? { durationMs: item.durationMs } : {}
108667
+ })
108668
+ });
108669
+ }
108670
+ case "collabAgentToolCall":
108671
+ return this.projectToolItem({
108672
+ phase,
108673
+ itemId: item.id,
108674
+ name: `collaboration.${item.tool}`,
108675
+ input: {
108676
+ prompt: item.prompt,
108677
+ receiverThreadIds: item.receiverThreadIds,
108678
+ model: item.model,
108679
+ reasoningEffort: item.reasoningEffort
108680
+ },
108681
+ output: {
108682
+ status: item.status ?? "unknown",
108683
+ agentsStates: item.agentsStates
108684
+ },
108685
+ isError: isFailedStatus(item.status),
108686
+ title: item.tool,
108687
+ toolMetadata: statusMetadata(item.status, {
108688
+ activities: [{ type: "collaboration", action: item.tool }]
108689
+ })
108690
+ });
108691
+ case "subAgentActivity":
108692
+ return this.projectToolItem({
108693
+ phase,
108694
+ itemId: item.id,
108695
+ name: "collaboration.sub_agent_activity",
108696
+ input: {
108697
+ kind: item.kind,
108698
+ agentThreadId: item.agentThreadId,
108699
+ agentPath: item.agentPath
108700
+ },
108701
+ output: { status: "completed" },
108702
+ isError: false,
108703
+ title: item.kind,
108704
+ toolMetadata: {
108705
+ activities: [{ type: "collaboration", action: item.kind }]
108706
+ }
108707
+ });
108708
+ case "webSearch":
108709
+ return this.projectToolItem({
108710
+ phase,
108711
+ itemId: item.id,
108712
+ name: "web_search",
108713
+ input: { query: item.query, action: toJsonValue(item.action) },
108714
+ output: { status: "completed" },
108715
+ isError: false,
108716
+ title: item.query || "Web search",
108717
+ toolMetadata: {
108718
+ activities: [{ type: "webSearch", query: item.query }]
108719
+ }
108720
+ });
108721
+ case "imageView":
108722
+ return this.projectToolItem({
108723
+ phase,
108724
+ itemId: item.id,
108725
+ name: "view_image",
108726
+ input: { path: item.path },
108727
+ output: { status: "viewed" },
108728
+ isError: false,
108729
+ title: item.path,
108730
+ toolMetadata: {
108731
+ activities: [{ type: "imageView", path: item.path }]
108732
+ }
108733
+ });
108734
+ case "sleep":
108735
+ return this.projectToolItem({
108736
+ phase,
108737
+ itemId: item.id,
108738
+ name: "wait",
108739
+ input: { durationMs: item.durationMs },
108740
+ output: { status: "completed" },
108741
+ isError: false,
108742
+ title: "Wait",
108743
+ toolMetadata: {
108744
+ activities: [{ type: "wait", durationMs: item.durationMs }],
108745
+ durationMs: item.durationMs
108746
+ }
108747
+ });
108748
+ case "imageGeneration":
108749
+ return this.projectToolItem({
108750
+ phase,
108751
+ itemId: item.id,
108752
+ name: "image_generation",
108753
+ input: { prompt: item.revisedPrompt },
108754
+ output: {
108755
+ result: item.result,
108756
+ ...item.savedPath ? { savedPath: item.savedPath } : {}
108757
+ },
108758
+ isError: isFailedStatus(item.status),
108759
+ title: item.revisedPrompt ?? "Generate image",
108760
+ toolMetadata: statusMetadata(item.status, {
108761
+ activities: [
108762
+ {
108763
+ type: "imageGeneration",
108764
+ ...item.savedPath ? { savedPath: item.savedPath } : {}
108765
+ }
108766
+ ]
108767
+ })
108768
+ });
108528
108769
  default:
108529
108770
  return [];
108530
108771
  }
@@ -108532,6 +108773,7 @@ var CodexProjector = class {
108532
108773
  projectToolItem(input) {
108533
108774
  const outputs = [];
108534
108775
  outputs.push(...this.ensureResponseStarted(input.itemId));
108776
+ outputs.push(...this.ensureStepStarted(input.itemId));
108535
108777
  if (input.toolMetadata) {
108536
108778
  this.activeToolMetadata.set(input.itemId, input.toolMetadata);
108537
108779
  }
@@ -108547,7 +108789,7 @@ var CodexProjector = class {
108547
108789
  input.output = this.activeToolOutput.get(input.itemId)?.output ?? "";
108548
108790
  }
108549
108791
  outputs.push(toolOutputChunk(input));
108550
- outputs.push(uiChunk2({ type: "finish-step" }));
108792
+ outputs.push(...this.finishStep(input.itemId));
108551
108793
  this.activeToolCalls.delete(input.itemId);
108552
108794
  this.activeToolMetadata.delete(input.itemId);
108553
108795
  this.activeToolOutput.delete(input.itemId);
@@ -108580,7 +108822,7 @@ var CodexProjector = class {
108580
108822
  }
108581
108823
  outputs.push(
108582
108824
  textBoundaryChunk("text-end", item.id, messagePhase),
108583
- uiChunk2({ type: "finish-step" })
108825
+ ...this.finishStep(item.id)
108584
108826
  );
108585
108827
  this.activeAgentMessages.delete(item.id);
108586
108828
  this.agentMessagePhases.delete(item.id);
@@ -108595,15 +108837,11 @@ var CodexProjector = class {
108595
108837
  this.streamedReasoningIndexes.delete(item.id);
108596
108838
  if (streamedIndexes && streamedIndexes.size > 0) {
108597
108839
  outputs.push(...reasoningItemChunks(item, streamedIndexes));
108598
- outputs.push(uiChunk2({ type: "finish-step" }));
108840
+ outputs.push(...this.finishStep(item.id));
108599
108841
  return outputs;
108600
108842
  }
108601
108843
  const completedChunks = reasoningItemChunks(item);
108602
- return completedChunks.length > 0 ? [
108603
- ...this.ensureResponseStarted(item.id),
108604
- ...completedChunks,
108605
- uiChunk2({ type: "finish-step" })
108606
- ] : [];
108844
+ return [...completedChunks, ...this.finishStep(item.id)];
108607
108845
  }
108608
108846
  endReasoningPart(itemId) {
108609
108847
  const active = this.activeReasoningParts.get(itemId);
@@ -108625,6 +108863,26 @@ var CodexProjector = class {
108625
108863
  this.activeResponseMessageId = messageId;
108626
108864
  return [uiChunk2({ type: "start", messageId })];
108627
108865
  }
108866
+ ensureStepStarted(itemId) {
108867
+ if (this.activeSteps.has(itemId)) {
108868
+ return [];
108869
+ }
108870
+ this.activeSteps.add(itemId);
108871
+ return [uiChunk2({ type: "start-step" })];
108872
+ }
108873
+ finishStep(itemId) {
108874
+ if (!this.activeSteps.delete(itemId)) {
108875
+ return [];
108876
+ }
108877
+ return [uiChunk2({ type: "finish-step" })];
108878
+ }
108879
+ finishAllSteps() {
108880
+ const outputs = [...this.activeSteps].map(
108881
+ () => uiChunk2({ type: "finish-step" })
108882
+ );
108883
+ this.activeSteps.clear();
108884
+ return outputs;
108885
+ }
108628
108886
  };
108629
108887
  function emptyToolOutput() {
108630
108888
  return { bytes: 0, output: "", truncated: false };
@@ -108748,6 +109006,14 @@ function commandActivities(actions) {
108748
109006
  }
108749
109007
  });
108750
109008
  }
109009
+ function fileChangePaths(changes) {
109010
+ return changes.flatMap((change) => {
109011
+ if (typeof change !== "object" || change === null || !("path" in change) || typeof change.path !== "string") {
109012
+ return [];
109013
+ }
109014
+ return [change.path];
109015
+ });
109016
+ }
108751
109017
  function turnCompletionEntry(notification) {
108752
109018
  if (notification.status === "failed") {
108753
109019
  const detail = notification.errorMessage ?? "unknown error";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.592",
3
+ "version": "0.1.593",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"