@adecore/agent-contracts 0.45.1 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chat.d.ts CHANGED
@@ -765,6 +765,7 @@ export declare const ChatWorkflowSchema: z.ZodObject<{
765
765
  }, z.core.$strip>>;
766
766
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
767
767
  stalledAt: z.ZodOptional<z.ZodNumber>;
768
+ finishedAt: z.ZodOptional<z.ZodNumber>;
768
769
  }, z.core.$strip>;
769
770
  export type ChatWorkflow = z.infer<typeof ChatWorkflowSchema>;
770
771
  export declare function workflowAgentRef(agentId: string): string;
@@ -831,6 +832,7 @@ export declare const ChatToolItemSchema: z.ZodObject<{
831
832
  }, z.core.$strip>>;
832
833
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
833
834
  stalledAt: z.ZodOptional<z.ZodNumber>;
835
+ finishedAt: z.ZodOptional<z.ZodNumber>;
834
836
  }, z.core.$strip>>;
835
837
  outputRef: z.ZodOptional<z.ZodObject<{
836
838
  id: z.ZodString;
@@ -1257,6 +1259,7 @@ export declare const ChatItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1257
1259
  }, z.core.$strip>>;
1258
1260
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
1259
1261
  stalledAt: z.ZodOptional<z.ZodNumber>;
1262
+ finishedAt: z.ZodOptional<z.ZodNumber>;
1260
1263
  }, z.core.$strip>>;
1261
1264
  outputRef: z.ZodOptional<z.ZodObject<{
1262
1265
  id: z.ZodString;
@@ -1439,6 +1442,8 @@ export type ChatTurnItem = z.infer<typeof ChatTurnItemSchema>;
1439
1442
  export type ChatNoteItem = z.infer<typeof ChatNoteItemSchema>;
1440
1443
  export type ChatCompactionItem = z.infer<typeof ChatCompactionItemSchema>;
1441
1444
  export declare function activeSubagents(items: readonly ChatItem[]): ChatSubagentItem[];
1445
+ export declare function workflowEndedAt(workflow: ChatWorkflow): number | null;
1446
+ export declare function activeWorkflows(items: readonly ChatItem[]): ChatToolItem[];
1442
1447
  export declare const CHAT_OUTLINE_TEXT_CHARS = 280;
1443
1448
  export declare function outlineItems(items: readonly ChatItem[], marked?: ReadonlySet<string>): ChatItem[];
1444
1449
  export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -1623,6 +1628,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1623
1628
  }, z.core.$strip>>;
1624
1629
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
1625
1630
  stalledAt: z.ZodOptional<z.ZodNumber>;
1631
+ finishedAt: z.ZodOptional<z.ZodNumber>;
1626
1632
  }, z.core.$strip>>;
1627
1633
  outputRef: z.ZodOptional<z.ZodObject<{
1628
1634
  id: z.ZodString;
@@ -2374,6 +2380,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2374
2380
  }, z.core.$strip>>;
2375
2381
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
2376
2382
  stalledAt: z.ZodOptional<z.ZodNumber>;
2383
+ finishedAt: z.ZodOptional<z.ZodNumber>;
2377
2384
  }, z.core.$strip>>;
2378
2385
  outputRef: z.ZodOptional<z.ZodObject<{
2379
2386
  id: z.ZodString;
@@ -2730,6 +2737,7 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
2730
2737
  }, z.core.$strip>>;
2731
2738
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
2732
2739
  stalledAt: z.ZodOptional<z.ZodNumber>;
2740
+ finishedAt: z.ZodOptional<z.ZodNumber>;
2733
2741
  }, z.core.$strip>>;
2734
2742
  outputRef: z.ZodOptional<z.ZodObject<{
2735
2743
  id: z.ZodString;
@@ -3481,6 +3489,7 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
3481
3489
  }, z.core.$strip>>;
3482
3490
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
3483
3491
  stalledAt: z.ZodOptional<z.ZodNumber>;
3492
+ finishedAt: z.ZodOptional<z.ZodNumber>;
3484
3493
  }, z.core.$strip>>;
3485
3494
  outputRef: z.ZodOptional<z.ZodObject<{
3486
3495
  id: z.ZodString;
@@ -3919,6 +3928,7 @@ export declare const ChatHistoryResultSchema: z.ZodObject<{
3919
3928
  }, z.core.$strip>>;
3920
3929
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
3921
3930
  stalledAt: z.ZodOptional<z.ZodNumber>;
3931
+ finishedAt: z.ZodOptional<z.ZodNumber>;
3922
3932
  }, z.core.$strip>>;
3923
3933
  outputRef: z.ZodOptional<z.ZodObject<{
3924
3934
  id: z.ZodString;
@@ -4318,6 +4328,7 @@ export declare const ChatSubagentResultSchema: z.ZodObject<{
4318
4328
  }, z.core.$strip>>;
4319
4329
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
4320
4330
  stalledAt: z.ZodOptional<z.ZodNumber>;
4331
+ finishedAt: z.ZodOptional<z.ZodNumber>;
4321
4332
  }, z.core.$strip>>;
4322
4333
  outputRef: z.ZodOptional<z.ZodObject<{
4323
4334
  id: z.ZodString;
@@ -5163,6 +5174,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5163
5174
  }, z.core.$strip>>;
5164
5175
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
5165
5176
  stalledAt: z.ZodOptional<z.ZodNumber>;
5177
+ finishedAt: z.ZodOptional<z.ZodNumber>;
5166
5178
  }, z.core.$strip>>;
5167
5179
  outputRef: z.ZodOptional<z.ZodObject<{
5168
5180
  id: z.ZodString;
@@ -5517,6 +5529,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5517
5529
  }, z.core.$strip>>;
5518
5530
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
5519
5531
  stalledAt: z.ZodOptional<z.ZodNumber>;
5532
+ finishedAt: z.ZodOptional<z.ZodNumber>;
5520
5533
  }, z.core.$strip>>;
5521
5534
  outputRef: z.ZodOptional<z.ZodObject<{
5522
5535
  id: z.ZodString;
@@ -5870,6 +5883,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5870
5883
  }, z.core.$strip>>;
5871
5884
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
5872
5885
  stalledAt: z.ZodOptional<z.ZodNumber>;
5886
+ finishedAt: z.ZodOptional<z.ZodNumber>;
5873
5887
  }, z.core.$strip>>;
5874
5888
  outputRef: z.ZodOptional<z.ZodObject<{
5875
5889
  id: z.ZodString;
@@ -6621,6 +6635,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
6621
6635
  }, z.core.$strip>>;
6622
6636
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
6623
6637
  stalledAt: z.ZodOptional<z.ZodNumber>;
6638
+ finishedAt: z.ZodOptional<z.ZodNumber>;
6624
6639
  }, z.core.$strip>>;
6625
6640
  outputRef: z.ZodOptional<z.ZodObject<{
6626
6641
  id: z.ZodString;
@@ -6850,6 +6865,69 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
6850
6865
  childId: z.ZodOptional<z.ZodString>;
6851
6866
  parentToolUseId: z.ZodOptional<z.ZodString>;
6852
6867
  }, z.core.$strip>>>;
6868
+ workflows: z.ZodOptional<z.ZodArray<z.ZodObject<{
6869
+ id: z.ZodString;
6870
+ createdAt: z.ZodNumber;
6871
+ turnId: z.ZodNullable<z.ZodString>;
6872
+ kind: z.ZodLiteral<"tool">;
6873
+ toolUseId: z.ZodString;
6874
+ name: z.ZodString;
6875
+ input: z.ZodUnknown;
6876
+ output: z.ZodNullable<z.ZodString>;
6877
+ state: z.ZodEnum<{
6878
+ done: "done";
6879
+ error: "error";
6880
+ running: "running";
6881
+ }>;
6882
+ parentToolUseId: z.ZodNullable<z.ZodString>;
6883
+ progress: z.ZodOptional<z.ZodObject<{
6884
+ startedAt: z.ZodNullable<z.ZodNumber>;
6885
+ description: z.ZodNullable<z.ZodString>;
6886
+ output: z.ZodNullable<z.ZodString>;
6887
+ }, z.core.$strip>>;
6888
+ changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
6889
+ path: z.ZodString;
6890
+ kind: z.ZodEnum<{
6891
+ add: "add";
6892
+ delete: "delete";
6893
+ update: "update";
6894
+ }>;
6895
+ diff: z.ZodString;
6896
+ }, z.core.$strip>>>;
6897
+ workflow: z.ZodOptional<z.ZodObject<{
6898
+ name: z.ZodNullable<z.ZodString>;
6899
+ taskId: z.ZodOptional<z.ZodString>;
6900
+ phases: z.ZodArray<z.ZodObject<{
6901
+ index: z.ZodNumber;
6902
+ title: z.ZodString;
6903
+ }, z.core.$strip>>;
6904
+ agents: z.ZodArray<z.ZodObject<{
6905
+ index: z.ZodNumber;
6906
+ label: z.ZodString;
6907
+ phaseIndex: z.ZodNullable<z.ZodNumber>;
6908
+ agentId: z.ZodNullable<z.ZodString>;
6909
+ status: z.ZodEnum<{
6910
+ done: "done";
6911
+ failed: "failed";
6912
+ running: "running";
6913
+ }>;
6914
+ startedAt: z.ZodNullable<z.ZodNumber>;
6915
+ durationMs: z.ZodNullable<z.ZodNumber>;
6916
+ lastTool: z.ZodNullable<z.ZodString>;
6917
+ lastToolSummary: z.ZodOptional<z.ZodString>;
6918
+ promptPreview: z.ZodOptional<z.ZodString>;
6919
+ resultPreview: z.ZodOptional<z.ZodString>;
6920
+ error: z.ZodOptional<z.ZodString>;
6921
+ }, z.core.$strip>>;
6922
+ lastProgressAt: z.ZodOptional<z.ZodNumber>;
6923
+ stalledAt: z.ZodOptional<z.ZodNumber>;
6924
+ finishedAt: z.ZodOptional<z.ZodNumber>;
6925
+ }, z.core.$strip>>;
6926
+ outputRef: z.ZodOptional<z.ZodObject<{
6927
+ id: z.ZodString;
6928
+ bytes: z.ZodNumber;
6929
+ }, z.core.$strip>>;
6930
+ }, z.core.$strip>>>;
6853
6931
  outline: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
6854
6932
  id: z.ZodString;
6855
6933
  createdAt: z.ZodNumber;
@@ -7030,6 +7108,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
7030
7108
  }, z.core.$strip>>;
7031
7109
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
7032
7110
  stalledAt: z.ZodOptional<z.ZodNumber>;
7111
+ finishedAt: z.ZodOptional<z.ZodNumber>;
7033
7112
  }, z.core.$strip>>;
7034
7113
  outputRef: z.ZodOptional<z.ZodObject<{
7035
7114
  id: z.ZodString;
package/dist/chat.js CHANGED
@@ -408,7 +408,9 @@ export const ChatWorkflowSchema = z.object({
408
408
  phases: z.array(ChatWorkflowPhaseSchema),
409
409
  agents: z.array(ChatWorkflowAgentSchema),
410
410
  lastProgressAt: z.number().optional(),
411
- stalledAt: z.number().optional()
411
+ stalledAt: z.number().optional(),
412
+ // Set by the host once the Workflow call settled; a call stored before it was kept has none.
413
+ finishedAt: z.number().optional()
412
414
  });
413
415
  // A workflow's agent has no call of its own, so `chat.subagent` names it by its agent id under this prefix.
414
416
  const WORKFLOW_AGENT_REF = 'workflow-agent:';
@@ -637,6 +639,36 @@ export function activeSubagents(items) {
637
639
  (item.turnId !== null && turns.has(item.turnId)))
638
640
  .map(({ item }) => item);
639
641
  }
642
+ /*
643
+ * When a workflow last did something it could be shown for: the end the host noted, else the last end
644
+ * of an agent, else its last report. Null for one that never reported, which counts as long ago.
645
+ */
646
+ export function workflowEndedAt(workflow) {
647
+ if (workflow.finishedAt !== undefined) {
648
+ return workflow.finishedAt;
649
+ }
650
+ const ends = workflow.agents.flatMap((agent) => (agent.startedAt !== null && agent.durationMs !== null ? [agent.startedAt + agent.durationMs] : []));
651
+ return ends.length > 0 ? Math.max(...ends) : (workflow.lastProgressAt ?? null);
652
+ }
653
+ /*
654
+ * The Workflow calls a chat still speaks of beside its thread, by the rule of `activeSubagents`: every
655
+ * one that runs, and the ones that ended since the last message, so a finished workflow stays until the
656
+ * next message is sent. Only a call that reported what it runs counts. `items` is in thread order.
657
+ */
658
+ export function activeWorkflows(items) {
659
+ const lastMessage = items.findLastIndex((item) => item.kind === 'user');
660
+ const lastMessageAt = lastMessage < 0 ? null : items[lastMessage].createdAt;
661
+ return items.filter((item, index) => {
662
+ if (item.kind !== 'tool' || item.name !== 'Workflow' || item.workflow === undefined) {
663
+ return false;
664
+ }
665
+ if (item.state === 'running' || index > lastMessage) {
666
+ return true;
667
+ }
668
+ const endedAt = workflowEndedAt(item.workflow);
669
+ return lastMessageAt !== null && endedAt !== null && endedAt > lastMessageAt;
670
+ });
671
+ }
640
672
  /* How much of a message the outline keeps: what a hover card over its tick shows. */
641
673
  export const CHAT_OUTLINE_TEXT_CHARS = 280;
642
674
  /*
@@ -827,6 +859,8 @@ export const ChatAttachResultSchema = z.object({
827
859
  visuals: ChatVisualsSchema.optional(),
828
860
  // With a page: the active sub-agents (`activeSubagents`) from before it, so the pill over the composer never waits on a scroll.
829
861
  subagents: z.array(ChatSubagentItemSchema).optional(),
862
+ // With a page: the active Workflow calls (`activeWorkflows`) from before it, so what shows a workflow beside the thread never waits on a scroll.
863
+ workflows: z.array(ChatToolItemSchema).optional(),
830
864
  // With a page: the thread before it as `outlineItems` cuts it, so the scrubber reaches the whole thread before a scroll does.
831
865
  outline: z.array(ChatItemSchema).optional()
832
866
  });
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { KNOWN_AGENT_KINDS, type KnownAgentKind, AGENT_KIND_MAX_LENGTH, AgentKindSchema, type AgentKind, isKnownAgentKind, AgentStatusSchema, type AgentStatus, SUGGESTED_TITLE_LIMIT, SuggestedTitleSchema, AgentRequestSchema, type AgentRequest, AgentInfoSchema, type AgentInfo, SessionStatusEventSchema, type SessionStatusEvent, AgentResumePayloadSchema, type AgentResumePayload, ApprovalChoiceSchema, type ApprovalChoice, ApprovalRequestSchema, type ApprovalRequest, SessionApprovalsEventSchema, type SessionApprovalsEvent, ApprovalAnswerPayloadSchema, type ApprovalAnswerPayload, ApprovalAnswerResultSchema, type ApprovalAnswerResult, ApprovalPreferencePayloadSchema, type ApprovalPreferencePayload } from './agent.ts';
2
- export { ChatIdSchema, type ChatId, ChatContextBreakdownSchema, type ChatContextBreakdown, ChatUsageSchema, type ChatUsage, CHAT_ATTACHMENTS_MAX_BYTES, CHAT_ATTACHMENT_MAX_BYTES, CHAT_ATTACHMENTS_MAX_COUNT, attachmentBytes, attachmentImageMime, ChatAttachmentUploadSchema, type ChatAttachmentUpload, ChatAttachmentUploadsSchema, ChatAttachmentSchema, type ChatAttachment, ChatUiChoiceOriginSchema, type ChatUiChoiceOrigin, ChatUiAnswerSchema, type ChatUiAnswer, ChatQuoteSourceSchema, type ChatQuoteSource, ChatQueuedMessageSchema, type ChatQueuedMessage, ChatBackgroundTaskSchema, type ChatBackgroundTask, ChatTurnLimitSchema, type ChatTurnLimit, ChatGoalStatusSchema, type ChatGoalStatus, ChatGoalSchema, type ChatGoal, ChatQuestionSchema, type ChatQuestion, ChatRequestKindSchema, type ChatRequestKind, CHAT_REQUEST_LIMITS, ChatRequestApprovalSchema, type ChatRequestApproval, ChatRequestSummarySchema, type ChatRequestSummary, ChatInfoSchema, type ChatInfo, ChatSkillSourceSchema, type ChatSkillSource, ChatSkillSchema, type ChatSkill, SkillsListPayloadSchema, type SkillsListPayload, SkillsListResultSchema, type SkillsListResult, ChatUserItemSchema, ChatUiQueryReadingSchema, type ChatUiQueryReading, ChatUiLinkReadingSchema, type ChatUiLinkReading, ChatUiPlaceReadingSchema, type ChatUiPlaceReading, ChatUiQueryStateSchema, type ChatUiQueryState, ChatAssistantItemSchema, ChatThinkingItemSchema, ChatToolStateSchema, type ChatToolState, ChatToolProgressSchema, type ChatToolProgress, ChatFileChangeSchema, type ChatFileChange, ChatSubagentStatusSchema, type ChatSubagentStatus, ChatWorkflowPhaseSchema, type ChatWorkflowPhase, ChatWorkflowAgentSchema, type ChatWorkflowAgent, ChatWorkflowSchema, type ChatWorkflow, workflowAgentRef, workflowAgentIdOf, CHAT_PAYLOAD_INLINE_BYTES, ChatPayloadRefSchema, type ChatPayloadRef, ChatToolItemSchema, ChatSubagentUsageSchema, type ChatSubagentUsage, HOST_TASK_ORIGIN, ChatSubagentItemSchema, ChatApprovalDecisionSchema, type ChatApprovalDecision, ChatApprovalItemSchema, ChatQuestionItemSchema, ChatCheckpointFileSchema, type ChatCheckpointFile, ChatCheckpointDiffSchema, type ChatCheckpointDiff, ChatTurnItemSchema, notResumedNote, abortedByMachine, ENDED_NOTE_PREFIX, abortedByEnd, activeSubagents, CHAT_OUTLINE_TEXT_CHARS, outlineItems, WAITING_NOTE_PREFIX, ChatNoteItemSchema, ChatCompactionItemSchema, ChatItemSchema, type ChatItem, type ChatUserItem, type ChatAssistantItem, type ChatThinkingItem, type ChatToolItem, type ChatSubagentItem, type ChatApprovalItem, type ChatQuestionItem, type ChatTurnItem, type ChatNoteItem, type ChatCompactionItem, ChatEventSchema, type ChatEvent, ChatEventEnvelopeSchema, type ChatEventEnvelope, ChatCreatePayloadSchema, type ChatCreatePayload, ChatConfigurePayloadSchema, type ChatConfigurePayload, ChatPreferencesPayloadSchema, type ChatPreferencesPayload, ChatTargetPayloadSchema, type ChatTargetPayload, ChatClearPayloadSchema, type ChatClearPayload, ChatCancelPayloadSchema, type ChatCancelPayload, ChatAttachPayloadSchema, ChatHistoryPayloadSchema, ChatHistoryPageSchema, ChatHistoryResultSchema, type ChatHistoryResult, ChatSubagentPayloadSchema, type ChatSubagentPayload, ChatStopSubagentPayloadSchema, type ChatStopSubagentPayload, ChatGoalActionSchema, type ChatGoalAction, ChatGoalPayloadSchema, type ChatGoalPayload, ChatStopTaskPayloadSchema, type ChatStopTaskPayload, ChatSubagentPageSchema, ChatSubagentSourceSchema, type ChatSubagentSource, ChatSubagentResultSchema, type ChatSubagentResult, ChatStatusEventSchema, type ChatStatusEvent, ChatSubagentChangedEventSchema, type ChatSubagentChangedEvent, CHAT_BOOKMARK_LIMITS, ChatBookmarkSchema, type ChatBookmark, ChatBookmarksSchema, ChatAddBookmarkPayloadSchema, type ChatAddBookmarkPayload, ChatRenameBookmarkPayloadSchema, type ChatRenameBookmarkPayload, ChatRemoveBookmarkPayloadSchema, type ChatRemoveBookmarkPayload, ChatBookmarksResultSchema, type ChatBookmarksResult, ChatBookmarksEventSchema, type ChatBookmarksEvent, ChatRemoveVisualPayloadSchema, type ChatRemoveVisualPayload, ChatVisualsResultSchema, type ChatVisualsResult, ChatVisualsEventSchema, type ChatVisualsEvent, ChatAttachResultSchema, type ChatAttachResult, ChatDeliverySchema, type ChatDelivery, ChatSendPayloadSchema, type ChatSendPayload, ChatSendResultSchema, type ChatSendResult, ChatUiChoicePayloadSchema, type ChatUiChoicePayload, ChatUiQueryPayloadSchema, type ChatUiQueryPayload, ChatUiLinkPayloadSchema, type ChatUiLinkPayload, ChatQueuePayloadSchema, type ChatQueuePayload, ChatUnqueueResultSchema, type ChatUnqueueResult, ChatApprovePayloadSchema, type ChatApprovePayload, ChatDismissPayloadSchema, type ChatDismissPayload, ChatAnswerPayloadSchema, type ChatAnswerPayload, ChatTurnDiffPayloadSchema, type ChatTurnDiffPayload, ChatTurnDiffResultSchema, type ChatTurnDiffResult, ChatToolOutputPayloadSchema, type ChatToolOutputPayload, ChatToolOutputResultSchema, type ChatToolOutputResult, CHAT_FORK_TITLE_MAX, ChatForkPayloadSchema, type ChatForkPayload, ChatForkResultSchema, type ChatForkResult, ChatContinueOnPayloadSchema, type ChatContinueOnPayload, ChatContinueOnResultSchema, type ChatContinueOnResult, ChatSummarizePayloadSchema, type ChatSummarizePayload, ChatSummarizeResultSchema, type ChatSummarizeResult, ChatForkInfoPayloadSchema, type ChatForkInfoPayload, ChatForkInfoResultSchema, type ChatForkInfoResult, ChatListResultSchema, type ChatListResult, GeneratedImageInputSchema, type GeneratedImageInput, generatedImageAttachment, holdsConversation } from './chat.ts';
2
+ export { ChatIdSchema, type ChatId, ChatContextBreakdownSchema, type ChatContextBreakdown, ChatUsageSchema, type ChatUsage, CHAT_ATTACHMENTS_MAX_BYTES, CHAT_ATTACHMENT_MAX_BYTES, CHAT_ATTACHMENTS_MAX_COUNT, attachmentBytes, attachmentImageMime, ChatAttachmentUploadSchema, type ChatAttachmentUpload, ChatAttachmentUploadsSchema, ChatAttachmentSchema, type ChatAttachment, ChatUiChoiceOriginSchema, type ChatUiChoiceOrigin, ChatUiAnswerSchema, type ChatUiAnswer, ChatQuoteSourceSchema, type ChatQuoteSource, ChatQueuedMessageSchema, type ChatQueuedMessage, ChatBackgroundTaskSchema, type ChatBackgroundTask, ChatTurnLimitSchema, type ChatTurnLimit, ChatGoalStatusSchema, type ChatGoalStatus, ChatGoalSchema, type ChatGoal, ChatQuestionSchema, type ChatQuestion, ChatRequestKindSchema, type ChatRequestKind, CHAT_REQUEST_LIMITS, ChatRequestApprovalSchema, type ChatRequestApproval, ChatRequestSummarySchema, type ChatRequestSummary, ChatInfoSchema, type ChatInfo, ChatSkillSourceSchema, type ChatSkillSource, ChatSkillSchema, type ChatSkill, SkillsListPayloadSchema, type SkillsListPayload, SkillsListResultSchema, type SkillsListResult, ChatUserItemSchema, ChatUiQueryReadingSchema, type ChatUiQueryReading, ChatUiLinkReadingSchema, type ChatUiLinkReading, ChatUiPlaceReadingSchema, type ChatUiPlaceReading, ChatUiQueryStateSchema, type ChatUiQueryState, ChatAssistantItemSchema, ChatThinkingItemSchema, ChatToolStateSchema, type ChatToolState, ChatToolProgressSchema, type ChatToolProgress, ChatFileChangeSchema, type ChatFileChange, ChatSubagentStatusSchema, type ChatSubagentStatus, ChatWorkflowPhaseSchema, type ChatWorkflowPhase, ChatWorkflowAgentSchema, type ChatWorkflowAgent, ChatWorkflowSchema, type ChatWorkflow, workflowAgentRef, workflowAgentIdOf, CHAT_PAYLOAD_INLINE_BYTES, ChatPayloadRefSchema, type ChatPayloadRef, ChatToolItemSchema, ChatSubagentUsageSchema, type ChatSubagentUsage, HOST_TASK_ORIGIN, ChatSubagentItemSchema, ChatApprovalDecisionSchema, type ChatApprovalDecision, ChatApprovalItemSchema, ChatQuestionItemSchema, ChatCheckpointFileSchema, type ChatCheckpointFile, ChatCheckpointDiffSchema, type ChatCheckpointDiff, ChatTurnItemSchema, notResumedNote, abortedByMachine, ENDED_NOTE_PREFIX, abortedByEnd, activeSubagents, activeWorkflows, workflowEndedAt, CHAT_OUTLINE_TEXT_CHARS, outlineItems, WAITING_NOTE_PREFIX, ChatNoteItemSchema, ChatCompactionItemSchema, ChatItemSchema, type ChatItem, type ChatUserItem, type ChatAssistantItem, type ChatThinkingItem, type ChatToolItem, type ChatSubagentItem, type ChatApprovalItem, type ChatQuestionItem, type ChatTurnItem, type ChatNoteItem, type ChatCompactionItem, ChatEventSchema, type ChatEvent, ChatEventEnvelopeSchema, type ChatEventEnvelope, ChatCreatePayloadSchema, type ChatCreatePayload, ChatConfigurePayloadSchema, type ChatConfigurePayload, ChatPreferencesPayloadSchema, type ChatPreferencesPayload, ChatTargetPayloadSchema, type ChatTargetPayload, ChatClearPayloadSchema, type ChatClearPayload, ChatCancelPayloadSchema, type ChatCancelPayload, ChatAttachPayloadSchema, ChatHistoryPayloadSchema, ChatHistoryPageSchema, ChatHistoryResultSchema, type ChatHistoryResult, ChatSubagentPayloadSchema, type ChatSubagentPayload, ChatStopSubagentPayloadSchema, type ChatStopSubagentPayload, ChatGoalActionSchema, type ChatGoalAction, ChatGoalPayloadSchema, type ChatGoalPayload, ChatStopTaskPayloadSchema, type ChatStopTaskPayload, ChatSubagentPageSchema, ChatSubagentSourceSchema, type ChatSubagentSource, ChatSubagentResultSchema, type ChatSubagentResult, ChatStatusEventSchema, type ChatStatusEvent, ChatSubagentChangedEventSchema, type ChatSubagentChangedEvent, CHAT_BOOKMARK_LIMITS, ChatBookmarkSchema, type ChatBookmark, ChatBookmarksSchema, ChatAddBookmarkPayloadSchema, type ChatAddBookmarkPayload, ChatRenameBookmarkPayloadSchema, type ChatRenameBookmarkPayload, ChatRemoveBookmarkPayloadSchema, type ChatRemoveBookmarkPayload, ChatBookmarksResultSchema, type ChatBookmarksResult, ChatBookmarksEventSchema, type ChatBookmarksEvent, ChatRemoveVisualPayloadSchema, type ChatRemoveVisualPayload, ChatVisualsResultSchema, type ChatVisualsResult, ChatVisualsEventSchema, type ChatVisualsEvent, ChatAttachResultSchema, type ChatAttachResult, ChatDeliverySchema, type ChatDelivery, ChatSendPayloadSchema, type ChatSendPayload, ChatSendResultSchema, type ChatSendResult, ChatUiChoicePayloadSchema, type ChatUiChoicePayload, ChatUiQueryPayloadSchema, type ChatUiQueryPayload, ChatUiLinkPayloadSchema, type ChatUiLinkPayload, ChatQueuePayloadSchema, type ChatQueuePayload, ChatUnqueueResultSchema, type ChatUnqueueResult, ChatApprovePayloadSchema, type ChatApprovePayload, ChatDismissPayloadSchema, type ChatDismissPayload, ChatAnswerPayloadSchema, type ChatAnswerPayload, ChatTurnDiffPayloadSchema, type ChatTurnDiffPayload, ChatTurnDiffResultSchema, type ChatTurnDiffResult, ChatToolOutputPayloadSchema, type ChatToolOutputPayload, ChatToolOutputResultSchema, type ChatToolOutputResult, CHAT_FORK_TITLE_MAX, ChatForkPayloadSchema, type ChatForkPayload, ChatForkResultSchema, type ChatForkResult, ChatContinueOnPayloadSchema, type ChatContinueOnPayload, ChatContinueOnResultSchema, type ChatContinueOnResult, ChatSummarizePayloadSchema, type ChatSummarizePayload, ChatSummarizeResultSchema, type ChatSummarizeResult, ChatForkInfoPayloadSchema, type ChatForkInfoPayload, ChatForkInfoResultSchema, type ChatForkInfoResult, ChatListResultSchema, type ChatListResult, GeneratedImageInputSchema, type GeneratedImageInput, generatedImageAttachment, holdsConversation } from './chat.ts';
3
3
  export { ErrorSchema, type WireError, RequestSchema, type Request, ReplyOkSchema, type ReplyOk, ReplyErrorSchema, type ReplyError, ReplySchema, type Reply, EventSchema, type Event, ServerFrameSchema, type ServerFrame, type ParseResult, parseRequest, parseServerFrame } from './envelope.ts';
4
4
  export { SessionIdSchema, type SessionId } from './ids.ts';
5
5
  export { ModelOptionChoiceSchema, type ModelOptionChoice, ModelOptionDescriptorSchema, type ModelOptionDescriptor, ModelInfoSchema, type ModelInfo, ModelSelectionSchema, type ModelSelection, ModelCatalogProfileSchema, type ModelCatalogProfile, ModelCatalogEntrySchema, type ModelCatalogEntry, ModelCatalogDataSchema, type ModelCatalogData, RuntimeModeSchema, type RuntimeMode, ProviderCapabilitiesSchema, type ProviderCapabilities, ProviderPlatformSchema, type ProviderPlatform, ProviderSignInSchema, type ProviderSignIn, ProviderInstallSchema, type ProviderInstall, ProviderInfoSchema, type ProviderInfo, FRONTIER_PROVIDER_KINDS, API_PROVIDER_KINDS, type ProviderPickerGroup, type ProviderPickerGroups, providerGroupOf, pickerGroupsOf, ProviderListResultSchema, type ProviderListResult, resumeCommandFor } from './model.ts';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Public API: exports.test.ts snapshots this list, so a name added or dropped here is an API change.
2
2
  export { KNOWN_AGENT_KINDS, AGENT_KIND_MAX_LENGTH, AgentKindSchema, isKnownAgentKind, AgentStatusSchema, SUGGESTED_TITLE_LIMIT, SuggestedTitleSchema, AgentRequestSchema, AgentInfoSchema, SessionStatusEventSchema, AgentResumePayloadSchema, ApprovalChoiceSchema, ApprovalRequestSchema, SessionApprovalsEventSchema, ApprovalAnswerPayloadSchema, ApprovalAnswerResultSchema, ApprovalPreferencePayloadSchema } from './agent.js';
3
- export { ChatIdSchema, ChatContextBreakdownSchema, ChatUsageSchema, CHAT_ATTACHMENTS_MAX_BYTES, CHAT_ATTACHMENT_MAX_BYTES, CHAT_ATTACHMENTS_MAX_COUNT, attachmentBytes, attachmentImageMime, ChatAttachmentUploadSchema, ChatAttachmentUploadsSchema, ChatAttachmentSchema, ChatUiChoiceOriginSchema, ChatUiAnswerSchema, ChatQuoteSourceSchema, ChatQueuedMessageSchema, ChatBackgroundTaskSchema, ChatTurnLimitSchema, ChatGoalStatusSchema, ChatGoalSchema, ChatQuestionSchema, ChatRequestKindSchema, CHAT_REQUEST_LIMITS, ChatRequestApprovalSchema, ChatRequestSummarySchema, ChatInfoSchema, ChatSkillSourceSchema, ChatSkillSchema, SkillsListPayloadSchema, SkillsListResultSchema, ChatUserItemSchema, ChatUiQueryReadingSchema, ChatUiLinkReadingSchema, ChatUiPlaceReadingSchema, ChatUiQueryStateSchema, ChatAssistantItemSchema, ChatThinkingItemSchema, ChatToolStateSchema, ChatToolProgressSchema, ChatFileChangeSchema, ChatSubagentStatusSchema, ChatWorkflowPhaseSchema, ChatWorkflowAgentSchema, ChatWorkflowSchema, workflowAgentRef, workflowAgentIdOf, CHAT_PAYLOAD_INLINE_BYTES, ChatPayloadRefSchema, ChatToolItemSchema, ChatSubagentUsageSchema, HOST_TASK_ORIGIN, ChatSubagentItemSchema, ChatApprovalDecisionSchema, ChatApprovalItemSchema, ChatQuestionItemSchema, ChatCheckpointFileSchema, ChatCheckpointDiffSchema, ChatTurnItemSchema, notResumedNote, abortedByMachine, ENDED_NOTE_PREFIX, abortedByEnd, activeSubagents, CHAT_OUTLINE_TEXT_CHARS, outlineItems, WAITING_NOTE_PREFIX, ChatNoteItemSchema, ChatCompactionItemSchema, ChatItemSchema, ChatEventSchema, ChatEventEnvelopeSchema, ChatCreatePayloadSchema, ChatConfigurePayloadSchema, ChatPreferencesPayloadSchema, ChatTargetPayloadSchema, ChatClearPayloadSchema, ChatCancelPayloadSchema, ChatAttachPayloadSchema, ChatHistoryPayloadSchema, ChatHistoryPageSchema, ChatHistoryResultSchema, ChatSubagentPayloadSchema, ChatStopSubagentPayloadSchema, ChatGoalActionSchema, ChatGoalPayloadSchema, ChatStopTaskPayloadSchema, ChatSubagentPageSchema, ChatSubagentSourceSchema, ChatSubagentResultSchema, ChatStatusEventSchema, ChatSubagentChangedEventSchema, CHAT_BOOKMARK_LIMITS, ChatBookmarkSchema, ChatBookmarksSchema, ChatAddBookmarkPayloadSchema, ChatRenameBookmarkPayloadSchema, ChatRemoveBookmarkPayloadSchema, ChatBookmarksResultSchema, ChatBookmarksEventSchema, ChatRemoveVisualPayloadSchema, ChatVisualsResultSchema, ChatVisualsEventSchema, ChatAttachResultSchema, ChatDeliverySchema, ChatSendPayloadSchema, ChatSendResultSchema, ChatUiChoicePayloadSchema, ChatUiQueryPayloadSchema, ChatUiLinkPayloadSchema, ChatQueuePayloadSchema, ChatUnqueueResultSchema, ChatApprovePayloadSchema, ChatDismissPayloadSchema, ChatAnswerPayloadSchema, ChatTurnDiffPayloadSchema, ChatTurnDiffResultSchema, ChatToolOutputPayloadSchema, ChatToolOutputResultSchema, CHAT_FORK_TITLE_MAX, ChatForkPayloadSchema, ChatForkResultSchema, ChatContinueOnPayloadSchema, ChatContinueOnResultSchema, ChatSummarizePayloadSchema, ChatSummarizeResultSchema, ChatForkInfoPayloadSchema, ChatForkInfoResultSchema, ChatListResultSchema, GeneratedImageInputSchema, generatedImageAttachment, holdsConversation } from './chat.js';
3
+ export { ChatIdSchema, ChatContextBreakdownSchema, ChatUsageSchema, CHAT_ATTACHMENTS_MAX_BYTES, CHAT_ATTACHMENT_MAX_BYTES, CHAT_ATTACHMENTS_MAX_COUNT, attachmentBytes, attachmentImageMime, ChatAttachmentUploadSchema, ChatAttachmentUploadsSchema, ChatAttachmentSchema, ChatUiChoiceOriginSchema, ChatUiAnswerSchema, ChatQuoteSourceSchema, ChatQueuedMessageSchema, ChatBackgroundTaskSchema, ChatTurnLimitSchema, ChatGoalStatusSchema, ChatGoalSchema, ChatQuestionSchema, ChatRequestKindSchema, CHAT_REQUEST_LIMITS, ChatRequestApprovalSchema, ChatRequestSummarySchema, ChatInfoSchema, ChatSkillSourceSchema, ChatSkillSchema, SkillsListPayloadSchema, SkillsListResultSchema, ChatUserItemSchema, ChatUiQueryReadingSchema, ChatUiLinkReadingSchema, ChatUiPlaceReadingSchema, ChatUiQueryStateSchema, ChatAssistantItemSchema, ChatThinkingItemSchema, ChatToolStateSchema, ChatToolProgressSchema, ChatFileChangeSchema, ChatSubagentStatusSchema, ChatWorkflowPhaseSchema, ChatWorkflowAgentSchema, ChatWorkflowSchema, workflowAgentRef, workflowAgentIdOf, CHAT_PAYLOAD_INLINE_BYTES, ChatPayloadRefSchema, ChatToolItemSchema, ChatSubagentUsageSchema, HOST_TASK_ORIGIN, ChatSubagentItemSchema, ChatApprovalDecisionSchema, ChatApprovalItemSchema, ChatQuestionItemSchema, ChatCheckpointFileSchema, ChatCheckpointDiffSchema, ChatTurnItemSchema, notResumedNote, abortedByMachine, ENDED_NOTE_PREFIX, abortedByEnd, activeSubagents, activeWorkflows, workflowEndedAt, CHAT_OUTLINE_TEXT_CHARS, outlineItems, WAITING_NOTE_PREFIX, ChatNoteItemSchema, ChatCompactionItemSchema, ChatItemSchema, ChatEventSchema, ChatEventEnvelopeSchema, ChatCreatePayloadSchema, ChatConfigurePayloadSchema, ChatPreferencesPayloadSchema, ChatTargetPayloadSchema, ChatClearPayloadSchema, ChatCancelPayloadSchema, ChatAttachPayloadSchema, ChatHistoryPayloadSchema, ChatHistoryPageSchema, ChatHistoryResultSchema, ChatSubagentPayloadSchema, ChatStopSubagentPayloadSchema, ChatGoalActionSchema, ChatGoalPayloadSchema, ChatStopTaskPayloadSchema, ChatSubagentPageSchema, ChatSubagentSourceSchema, ChatSubagentResultSchema, ChatStatusEventSchema, ChatSubagentChangedEventSchema, CHAT_BOOKMARK_LIMITS, ChatBookmarkSchema, ChatBookmarksSchema, ChatAddBookmarkPayloadSchema, ChatRenameBookmarkPayloadSchema, ChatRemoveBookmarkPayloadSchema, ChatBookmarksResultSchema, ChatBookmarksEventSchema, ChatRemoveVisualPayloadSchema, ChatVisualsResultSchema, ChatVisualsEventSchema, ChatAttachResultSchema, ChatDeliverySchema, ChatSendPayloadSchema, ChatSendResultSchema, ChatUiChoicePayloadSchema, ChatUiQueryPayloadSchema, ChatUiLinkPayloadSchema, ChatQueuePayloadSchema, ChatUnqueueResultSchema, ChatApprovePayloadSchema, ChatDismissPayloadSchema, ChatAnswerPayloadSchema, ChatTurnDiffPayloadSchema, ChatTurnDiffResultSchema, ChatToolOutputPayloadSchema, ChatToolOutputResultSchema, CHAT_FORK_TITLE_MAX, ChatForkPayloadSchema, ChatForkResultSchema, ChatContinueOnPayloadSchema, ChatContinueOnResultSchema, ChatSummarizePayloadSchema, ChatSummarizeResultSchema, ChatForkInfoPayloadSchema, ChatForkInfoResultSchema, ChatListResultSchema, GeneratedImageInputSchema, generatedImageAttachment, holdsConversation } from './chat.js';
4
4
  export { ErrorSchema, RequestSchema, ReplyOkSchema, ReplyErrorSchema, ReplySchema, EventSchema, ServerFrameSchema, parseRequest, parseServerFrame } from './envelope.js';
5
5
  export { SessionIdSchema } from './ids.js';
6
6
  export { ModelOptionChoiceSchema, ModelOptionDescriptorSchema, ModelInfoSchema, ModelSelectionSchema, ModelCatalogProfileSchema, ModelCatalogEntrySchema, ModelCatalogDataSchema, RuntimeModeSchema, ProviderCapabilitiesSchema, ProviderPlatformSchema, ProviderSignInSchema, ProviderInstallSchema, ProviderInfoSchema, FRONTIER_PROVIDER_KINDS, API_PROVIDER_KINDS, providerGroupOf, pickerGroupsOf, ProviderListResultSchema, resumeCommandFor } from './model.js';
@@ -372,6 +372,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
372
372
  }, z.core.$strip>>;
373
373
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
374
374
  stalledAt: z.ZodOptional<z.ZodNumber>;
375
+ finishedAt: z.ZodOptional<z.ZodNumber>;
375
376
  }, z.core.$strip>>;
376
377
  outputRef: z.ZodOptional<z.ZodObject<{
377
378
  id: z.ZodString;
@@ -900,6 +901,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
900
901
  }, z.core.$strip>>;
901
902
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
902
903
  stalledAt: z.ZodOptional<z.ZodNumber>;
904
+ finishedAt: z.ZodOptional<z.ZodNumber>;
903
905
  }, z.core.$strip>>;
904
906
  outputRef: z.ZodOptional<z.ZodObject<{
905
907
  id: z.ZodString;
@@ -1254,6 +1256,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1254
1256
  }, z.core.$strip>>;
1255
1257
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
1256
1258
  stalledAt: z.ZodOptional<z.ZodNumber>;
1259
+ finishedAt: z.ZodOptional<z.ZodNumber>;
1257
1260
  }, z.core.$strip>>;
1258
1261
  outputRef: z.ZodOptional<z.ZodObject<{
1259
1262
  id: z.ZodString;
@@ -1607,6 +1610,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1607
1610
  }, z.core.$strip>>;
1608
1611
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
1609
1612
  stalledAt: z.ZodOptional<z.ZodNumber>;
1613
+ finishedAt: z.ZodOptional<z.ZodNumber>;
1610
1614
  }, z.core.$strip>>;
1611
1615
  outputRef: z.ZodOptional<z.ZodObject<{
1612
1616
  id: z.ZodString;
@@ -2358,6 +2362,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2358
2362
  }, z.core.$strip>>;
2359
2363
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
2360
2364
  stalledAt: z.ZodOptional<z.ZodNumber>;
2365
+ finishedAt: z.ZodOptional<z.ZodNumber>;
2361
2366
  }, z.core.$strip>>;
2362
2367
  outputRef: z.ZodOptional<z.ZodObject<{
2363
2368
  id: z.ZodString;
@@ -2587,6 +2592,69 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2587
2592
  childId: z.ZodOptional<z.ZodString>;
2588
2593
  parentToolUseId: z.ZodOptional<z.ZodString>;
2589
2594
  }, z.core.$strip>>>;
2595
+ workflows: z.ZodOptional<z.ZodArray<z.ZodObject<{
2596
+ id: z.ZodString;
2597
+ createdAt: z.ZodNumber;
2598
+ turnId: z.ZodNullable<z.ZodString>;
2599
+ kind: z.ZodLiteral<"tool">;
2600
+ toolUseId: z.ZodString;
2601
+ name: z.ZodString;
2602
+ input: z.ZodUnknown;
2603
+ output: z.ZodNullable<z.ZodString>;
2604
+ state: z.ZodEnum<{
2605
+ done: "done";
2606
+ error: "error";
2607
+ running: "running";
2608
+ }>;
2609
+ parentToolUseId: z.ZodNullable<z.ZodString>;
2610
+ progress: z.ZodOptional<z.ZodObject<{
2611
+ startedAt: z.ZodNullable<z.ZodNumber>;
2612
+ description: z.ZodNullable<z.ZodString>;
2613
+ output: z.ZodNullable<z.ZodString>;
2614
+ }, z.core.$strip>>;
2615
+ changes: z.ZodOptional<z.ZodArray<z.ZodObject<{
2616
+ path: z.ZodString;
2617
+ kind: z.ZodEnum<{
2618
+ add: "add";
2619
+ delete: "delete";
2620
+ update: "update";
2621
+ }>;
2622
+ diff: z.ZodString;
2623
+ }, z.core.$strip>>>;
2624
+ workflow: z.ZodOptional<z.ZodObject<{
2625
+ name: z.ZodNullable<z.ZodString>;
2626
+ taskId: z.ZodOptional<z.ZodString>;
2627
+ phases: z.ZodArray<z.ZodObject<{
2628
+ index: z.ZodNumber;
2629
+ title: z.ZodString;
2630
+ }, z.core.$strip>>;
2631
+ agents: z.ZodArray<z.ZodObject<{
2632
+ index: z.ZodNumber;
2633
+ label: z.ZodString;
2634
+ phaseIndex: z.ZodNullable<z.ZodNumber>;
2635
+ agentId: z.ZodNullable<z.ZodString>;
2636
+ status: z.ZodEnum<{
2637
+ done: "done";
2638
+ failed: "failed";
2639
+ running: "running";
2640
+ }>;
2641
+ startedAt: z.ZodNullable<z.ZodNumber>;
2642
+ durationMs: z.ZodNullable<z.ZodNumber>;
2643
+ lastTool: z.ZodNullable<z.ZodString>;
2644
+ lastToolSummary: z.ZodOptional<z.ZodString>;
2645
+ promptPreview: z.ZodOptional<z.ZodString>;
2646
+ resultPreview: z.ZodOptional<z.ZodString>;
2647
+ error: z.ZodOptional<z.ZodString>;
2648
+ }, z.core.$strip>>;
2649
+ lastProgressAt: z.ZodOptional<z.ZodNumber>;
2650
+ stalledAt: z.ZodOptional<z.ZodNumber>;
2651
+ finishedAt: z.ZodOptional<z.ZodNumber>;
2652
+ }, z.core.$strip>>;
2653
+ outputRef: z.ZodOptional<z.ZodObject<{
2654
+ id: z.ZodString;
2655
+ bytes: z.ZodNumber;
2656
+ }, z.core.$strip>>;
2657
+ }, z.core.$strip>>>;
2590
2658
  outline: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2591
2659
  id: z.ZodString;
2592
2660
  createdAt: z.ZodNumber;
@@ -2767,6 +2835,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2767
2835
  }, z.core.$strip>>;
2768
2836
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
2769
2837
  stalledAt: z.ZodOptional<z.ZodNumber>;
2838
+ finishedAt: z.ZodOptional<z.ZodNumber>;
2770
2839
  }, z.core.$strip>>;
2771
2840
  outputRef: z.ZodOptional<z.ZodObject<{
2772
2841
  id: z.ZodString;
@@ -4001,6 +4070,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4001
4070
  }, z.core.$strip>>;
4002
4071
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
4003
4072
  stalledAt: z.ZodOptional<z.ZodNumber>;
4073
+ finishedAt: z.ZodOptional<z.ZodNumber>;
4004
4074
  }, z.core.$strip>>;
4005
4075
  outputRef: z.ZodOptional<z.ZodObject<{
4006
4076
  id: z.ZodString;
@@ -5261,6 +5331,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
5261
5331
  }, z.core.$strip>>;
5262
5332
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
5263
5333
  stalledAt: z.ZodOptional<z.ZodNumber>;
5334
+ finishedAt: z.ZodOptional<z.ZodNumber>;
5264
5335
  }, z.core.$strip>>;
5265
5336
  outputRef: z.ZodOptional<z.ZodObject<{
5266
5337
  id: z.ZodString;
@@ -6012,6 +6083,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
6012
6083
  }, z.core.$strip>>;
6013
6084
  lastProgressAt: z.ZodOptional<z.ZodNumber>;
6014
6085
  stalledAt: z.ZodOptional<z.ZodNumber>;
6086
+ finishedAt: z.ZodOptional<z.ZodNumber>;
6015
6087
  }, z.core.$strip>>;
6016
6088
  outputRef: z.ZodOptional<z.ZodObject<{
6017
6089
  id: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agent-contracts",
3
- "version": "0.45.1",
3
+ "version": "0.46.0",
4
4
  "description": "Schemas and port contracts for agent chats, provider accounts, models and usage.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -86,7 +86,7 @@
86
86
  "test": "bun --conditions=source test"
87
87
  },
88
88
  "dependencies": {
89
- "@adecore/intelligent-ui": "0.45.1",
89
+ "@adecore/intelligent-ui": "0.46.0",
90
90
  "zod": "^4.6.7"
91
91
  },
92
92
  "devDependencies": {
package/src/chat.ts CHANGED
@@ -494,7 +494,9 @@ export const ChatWorkflowSchema = z.object({
494
494
  phases: z.array(ChatWorkflowPhaseSchema),
495
495
  agents: z.array(ChatWorkflowAgentSchema),
496
496
  lastProgressAt: z.number().optional(),
497
- stalledAt: z.number().optional()
497
+ stalledAt: z.number().optional(),
498
+ // Set by the host once the Workflow call settled; a call stored before it was kept has none.
499
+ finishedAt: z.number().optional()
498
500
  });
499
501
  export type ChatWorkflow = z.infer<typeof ChatWorkflowSchema>;
500
502
 
@@ -775,6 +777,44 @@ export function activeSubagents(items: readonly ChatItem[]): ChatSubagentItem[]
775
777
  .map(({ item }) => item);
776
778
  }
777
779
 
780
+ /*
781
+ * When a workflow last did something it could be shown for: the end the host noted, else the last end
782
+ * of an agent, else its last report. Null for one that never reported, which counts as long ago.
783
+ */
784
+ export function workflowEndedAt(workflow: ChatWorkflow): number | null {
785
+ if (workflow.finishedAt !== undefined) {
786
+ return workflow.finishedAt;
787
+ }
788
+
789
+ const ends = workflow.agents.flatMap((agent) => (agent.startedAt !== null && agent.durationMs !== null ? [agent.startedAt + agent.durationMs] : []));
790
+
791
+ return ends.length > 0 ? Math.max(...ends) : (workflow.lastProgressAt ?? null);
792
+ }
793
+
794
+ /*
795
+ * The Workflow calls a chat still speaks of beside its thread, by the rule of `activeSubagents`: every
796
+ * one that runs, and the ones that ended since the last message, so a finished workflow stays until the
797
+ * next message is sent. Only a call that reported what it runs counts. `items` is in thread order.
798
+ */
799
+ export function activeWorkflows(items: readonly ChatItem[]): ChatToolItem[] {
800
+ const lastMessage = items.findLastIndex((item) => item.kind === 'user');
801
+ const lastMessageAt = lastMessage < 0 ? null : items[lastMessage]!.createdAt;
802
+
803
+ return items.filter((item, index): item is ChatToolItem => {
804
+ if (item.kind !== 'tool' || item.name !== 'Workflow' || item.workflow === undefined) {
805
+ return false;
806
+ }
807
+
808
+ if (item.state === 'running' || index > lastMessage) {
809
+ return true;
810
+ }
811
+
812
+ const endedAt = workflowEndedAt(item.workflow);
813
+
814
+ return lastMessageAt !== null && endedAt !== null && endedAt > lastMessageAt;
815
+ });
816
+ }
817
+
778
818
  /* How much of a message the outline keeps: what a hover card over its tick shows. */
779
819
  export const CHAT_OUTLINE_TEXT_CHARS = 280;
780
820
 
@@ -1033,6 +1073,8 @@ export const ChatAttachResultSchema = z.object({
1033
1073
  visuals: ChatVisualsSchema.optional(),
1034
1074
  // With a page: the active sub-agents (`activeSubagents`) from before it, so the pill over the composer never waits on a scroll.
1035
1075
  subagents: z.array(ChatSubagentItemSchema).optional(),
1076
+ // With a page: the active Workflow calls (`activeWorkflows`) from before it, so what shows a workflow beside the thread never waits on a scroll.
1077
+ workflows: z.array(ChatToolItemSchema).optional(),
1036
1078
  // With a page: the thread before it as `outlineItems` cuts it, so the scrubber reaches the whole thread before a scroll does.
1037
1079
  outline: z.array(ChatItemSchema).optional()
1038
1080
  });
package/src/index.ts CHANGED
@@ -132,6 +132,8 @@ export {
132
132
  ENDED_NOTE_PREFIX,
133
133
  abortedByEnd,
134
134
  activeSubagents,
135
+ activeWorkflows,
136
+ workflowEndedAt,
135
137
  CHAT_OUTLINE_TEXT_CHARS,
136
138
  outlineItems,
137
139
  WAITING_NOTE_PREFIX,