@adecore/agent-contracts 0.46.3 → 0.48.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 +71 -0
- package/dist/chat.js +5 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/protocol.d.ts +99 -0
- package/dist/protocol.js +2 -1
- package/dist/provider-accounts.d.ts +12 -0
- package/dist/provider-accounts.js +25 -1
- package/package.json +2 -2
- package/src/chat.ts +7 -1
- package/src/index.ts +7 -1
- package/src/protocol.ts +2 -0
- package/src/provider-accounts.ts +32 -1
package/dist/chat.d.ts
CHANGED
|
@@ -1059,6 +1059,11 @@ export declare function abortedByEnd(turn: {
|
|
|
1059
1059
|
turnId: string | null;
|
|
1060
1060
|
}[]): boolean;
|
|
1061
1061
|
export declare const WAITING_NOTE_PREFIX = "waiting-";
|
|
1062
|
+
export declare const ChatNoteMessageSchema: z.ZodObject<{
|
|
1063
|
+
from: z.ZodString;
|
|
1064
|
+
title: z.ZodString;
|
|
1065
|
+
text: z.ZodString;
|
|
1066
|
+
}, z.core.$strip>;
|
|
1062
1067
|
export declare const ChatNoteItemSchema: z.ZodObject<{
|
|
1063
1068
|
id: z.ZodString;
|
|
1064
1069
|
createdAt: z.ZodNumber;
|
|
@@ -1071,6 +1076,11 @@ export declare const ChatNoteItemSchema: z.ZodObject<{
|
|
|
1071
1076
|
}>;
|
|
1072
1077
|
text: z.ZodString;
|
|
1073
1078
|
from: z.ZodOptional<z.ZodString>;
|
|
1079
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
1080
|
+
from: z.ZodString;
|
|
1081
|
+
title: z.ZodString;
|
|
1082
|
+
text: z.ZodString;
|
|
1083
|
+
}, z.core.$strip>>;
|
|
1074
1084
|
}, z.core.$strip>;
|
|
1075
1085
|
export declare const ChatCompactionItemSchema: z.ZodObject<{
|
|
1076
1086
|
id: z.ZodString;
|
|
@@ -1423,6 +1433,11 @@ export declare const ChatItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1423
1433
|
}>;
|
|
1424
1434
|
text: z.ZodString;
|
|
1425
1435
|
from: z.ZodOptional<z.ZodString>;
|
|
1436
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
1437
|
+
from: z.ZodString;
|
|
1438
|
+
title: z.ZodString;
|
|
1439
|
+
text: z.ZodString;
|
|
1440
|
+
}, z.core.$strip>>;
|
|
1426
1441
|
}, z.core.$strip>, z.ZodObject<{
|
|
1427
1442
|
id: z.ZodString;
|
|
1428
1443
|
createdAt: z.ZodNumber;
|
|
@@ -1440,6 +1455,7 @@ export type ChatApprovalItem = z.infer<typeof ChatApprovalItemSchema>;
|
|
|
1440
1455
|
export type ChatQuestionItem = z.infer<typeof ChatQuestionItemSchema>;
|
|
1441
1456
|
export type ChatTurnItem = z.infer<typeof ChatTurnItemSchema>;
|
|
1442
1457
|
export type ChatNoteItem = z.infer<typeof ChatNoteItemSchema>;
|
|
1458
|
+
export type ChatNoteMessage = z.infer<typeof ChatNoteMessageSchema>;
|
|
1443
1459
|
export type ChatCompactionItem = z.infer<typeof ChatCompactionItemSchema>;
|
|
1444
1460
|
export declare function activeSubagents(items: readonly ChatItem[]): ChatSubagentItem[];
|
|
1445
1461
|
export declare function workflowEndedAt(workflow: ChatWorkflow): number | null;
|
|
@@ -1792,6 +1808,11 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1792
1808
|
}>;
|
|
1793
1809
|
text: z.ZodString;
|
|
1794
1810
|
from: z.ZodOptional<z.ZodString>;
|
|
1811
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
1812
|
+
from: z.ZodString;
|
|
1813
|
+
title: z.ZodString;
|
|
1814
|
+
text: z.ZodString;
|
|
1815
|
+
}, z.core.$strip>>;
|
|
1795
1816
|
}, z.core.$strip>, z.ZodObject<{
|
|
1796
1817
|
id: z.ZodString;
|
|
1797
1818
|
createdAt: z.ZodNumber;
|
|
@@ -2544,6 +2565,11 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2544
2565
|
}>;
|
|
2545
2566
|
text: z.ZodString;
|
|
2546
2567
|
from: z.ZodOptional<z.ZodString>;
|
|
2568
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
2569
|
+
from: z.ZodString;
|
|
2570
|
+
title: z.ZodString;
|
|
2571
|
+
text: z.ZodString;
|
|
2572
|
+
}, z.core.$strip>>;
|
|
2547
2573
|
}, z.core.$strip>, z.ZodObject<{
|
|
2548
2574
|
id: z.ZodString;
|
|
2549
2575
|
createdAt: z.ZodNumber;
|
|
@@ -2901,6 +2927,11 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
|
|
|
2901
2927
|
}>;
|
|
2902
2928
|
text: z.ZodString;
|
|
2903
2929
|
from: z.ZodOptional<z.ZodString>;
|
|
2930
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
2931
|
+
from: z.ZodString;
|
|
2932
|
+
title: z.ZodString;
|
|
2933
|
+
text: z.ZodString;
|
|
2934
|
+
}, z.core.$strip>>;
|
|
2904
2935
|
}, z.core.$strip>, z.ZodObject<{
|
|
2905
2936
|
id: z.ZodString;
|
|
2906
2937
|
createdAt: z.ZodNumber;
|
|
@@ -3653,6 +3684,11 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
|
|
|
3653
3684
|
}>;
|
|
3654
3685
|
text: z.ZodString;
|
|
3655
3686
|
from: z.ZodOptional<z.ZodString>;
|
|
3687
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
3688
|
+
from: z.ZodString;
|
|
3689
|
+
title: z.ZodString;
|
|
3690
|
+
text: z.ZodString;
|
|
3691
|
+
}, z.core.$strip>>;
|
|
3656
3692
|
}, z.core.$strip>, z.ZodObject<{
|
|
3657
3693
|
id: z.ZodString;
|
|
3658
3694
|
createdAt: z.ZodNumber;
|
|
@@ -4092,6 +4128,11 @@ export declare const ChatHistoryResultSchema: z.ZodObject<{
|
|
|
4092
4128
|
}>;
|
|
4093
4129
|
text: z.ZodString;
|
|
4094
4130
|
from: z.ZodOptional<z.ZodString>;
|
|
4131
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
4132
|
+
from: z.ZodString;
|
|
4133
|
+
title: z.ZodString;
|
|
4134
|
+
text: z.ZodString;
|
|
4135
|
+
}, z.core.$strip>>;
|
|
4095
4136
|
}, z.core.$strip>, z.ZodObject<{
|
|
4096
4137
|
id: z.ZodString;
|
|
4097
4138
|
createdAt: z.ZodNumber;
|
|
@@ -4492,6 +4533,11 @@ export declare const ChatSubagentResultSchema: z.ZodObject<{
|
|
|
4492
4533
|
}>;
|
|
4493
4534
|
text: z.ZodString;
|
|
4494
4535
|
from: z.ZodOptional<z.ZodString>;
|
|
4536
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
4537
|
+
from: z.ZodString;
|
|
4538
|
+
title: z.ZodString;
|
|
4539
|
+
text: z.ZodString;
|
|
4540
|
+
}, z.core.$strip>>;
|
|
4495
4541
|
}, z.core.$strip>, z.ZodObject<{
|
|
4496
4542
|
id: z.ZodString;
|
|
4497
4543
|
createdAt: z.ZodNumber;
|
|
@@ -5338,6 +5384,11 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
5338
5384
|
}>;
|
|
5339
5385
|
text: z.ZodString;
|
|
5340
5386
|
from: z.ZodOptional<z.ZodString>;
|
|
5387
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
5388
|
+
from: z.ZodString;
|
|
5389
|
+
title: z.ZodString;
|
|
5390
|
+
text: z.ZodString;
|
|
5391
|
+
}, z.core.$strip>>;
|
|
5341
5392
|
}, z.core.$strip>, z.ZodObject<{
|
|
5342
5393
|
id: z.ZodString;
|
|
5343
5394
|
createdAt: z.ZodNumber;
|
|
@@ -5693,6 +5744,11 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
5693
5744
|
}>;
|
|
5694
5745
|
text: z.ZodString;
|
|
5695
5746
|
from: z.ZodOptional<z.ZodString>;
|
|
5747
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
5748
|
+
from: z.ZodString;
|
|
5749
|
+
title: z.ZodString;
|
|
5750
|
+
text: z.ZodString;
|
|
5751
|
+
}, z.core.$strip>>;
|
|
5696
5752
|
}, z.core.$strip>, z.ZodObject<{
|
|
5697
5753
|
id: z.ZodString;
|
|
5698
5754
|
createdAt: z.ZodNumber;
|
|
@@ -6047,6 +6103,11 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
6047
6103
|
}>;
|
|
6048
6104
|
text: z.ZodString;
|
|
6049
6105
|
from: z.ZodOptional<z.ZodString>;
|
|
6106
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
6107
|
+
from: z.ZodString;
|
|
6108
|
+
title: z.ZodString;
|
|
6109
|
+
text: z.ZodString;
|
|
6110
|
+
}, z.core.$strip>>;
|
|
6050
6111
|
}, z.core.$strip>, z.ZodObject<{
|
|
6051
6112
|
id: z.ZodString;
|
|
6052
6113
|
createdAt: z.ZodNumber;
|
|
@@ -6799,6 +6860,11 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
6799
6860
|
}>;
|
|
6800
6861
|
text: z.ZodString;
|
|
6801
6862
|
from: z.ZodOptional<z.ZodString>;
|
|
6863
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
6864
|
+
from: z.ZodString;
|
|
6865
|
+
title: z.ZodString;
|
|
6866
|
+
text: z.ZodString;
|
|
6867
|
+
}, z.core.$strip>>;
|
|
6802
6868
|
}, z.core.$strip>, z.ZodObject<{
|
|
6803
6869
|
id: z.ZodString;
|
|
6804
6870
|
createdAt: z.ZodNumber;
|
|
@@ -7272,6 +7338,11 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
7272
7338
|
}>;
|
|
7273
7339
|
text: z.ZodString;
|
|
7274
7340
|
from: z.ZodOptional<z.ZodString>;
|
|
7341
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
7342
|
+
from: z.ZodString;
|
|
7343
|
+
title: z.ZodString;
|
|
7344
|
+
text: z.ZodString;
|
|
7345
|
+
}, z.core.$strip>>;
|
|
7275
7346
|
}, z.core.$strip>, z.ZodObject<{
|
|
7276
7347
|
id: z.ZodString;
|
|
7277
7348
|
createdAt: z.ZodNumber;
|
package/dist/chat.js
CHANGED
|
@@ -591,13 +591,17 @@ export function abortedByEnd(turn, items) {
|
|
|
591
591
|
}
|
|
592
592
|
/* The id prefix of the note a host leaves in a parent about a child that waits on a request. */
|
|
593
593
|
export const WAITING_NOTE_PREFIX = 'waiting-';
|
|
594
|
+
/* A message another node sent a chat: its id, the name it had on the canvas then, and what it said. */
|
|
595
|
+
export const ChatNoteMessageSchema = z.object({ from: z.string().min(1), title: z.string(), text: z.string() });
|
|
594
596
|
export const ChatNoteItemSchema = z.object({
|
|
595
597
|
...base,
|
|
596
598
|
kind: z.literal('note'),
|
|
597
599
|
level: z.enum(['info', 'warning', 'error']),
|
|
598
600
|
text: z.string(),
|
|
599
601
|
// The chat a delivered summary came from, so a client can offer to open it.
|
|
600
|
-
from: ChatIdSchema.optional()
|
|
602
|
+
from: ChatIdSchema.optional(),
|
|
603
|
+
// A message another node sent, which a client draws as said to this chat; `text` holds it as a line for one that does not know this.
|
|
604
|
+
message: ChatNoteMessageSchema.optional()
|
|
601
605
|
});
|
|
602
606
|
export const ChatCompactionItemSchema = z.object({
|
|
603
607
|
...base,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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, 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';
|
|
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, ChatNoteMessageSchema, ChatCompactionItemSchema, ChatItemSchema, type ChatItem, type ChatUserItem, type ChatAssistantItem, type ChatThinkingItem, type ChatToolItem, type ChatSubagentItem, type ChatApprovalItem, type ChatQuestionItem, type ChatTurnItem, type ChatNoteItem, type ChatNoteMessage, 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';
|
|
6
6
|
export type { FramePort } from './port.ts';
|
|
7
7
|
export { EmptySchema, AGENT_REQUEST_SCHEMAS, AGENT_EVENT_SCHEMAS, type AgentRequestType, type AgentEventType } from './protocol.ts';
|
|
8
|
-
export { ProviderAccountIdSchema, type ProviderAccountId, ProviderAccountVariableSchema, type ProviderAccountVariable, ProviderAccountSchema, type ProviderAccount, ProviderAccountStateSchema, type ProviderAccountState, ProviderAccountStatusSchema, type ProviderAccountStatus, ProviderAccountMapSchema, type ProviderAccountMap, ProviderAccountsSchema, type ProviderAccounts, ProviderAccountsSavePayloadSchema, type ProviderAccountsSavePayload, ProviderAccountCreatePayloadSchema, type ProviderAccountCreatePayload, ProviderAccountCreateResultSchema, type ProviderAccountCreateResult, ProviderAccountWatchLoginPayloadSchema, type ProviderAccountWatchLoginPayload } from './provider-accounts.ts';
|
|
8
|
+
export { ProviderAccountIdSchema, type ProviderAccountId, ProviderAccountVariableSchema, type ProviderAccountVariable, ProviderAccountSchema, type ProviderAccount, ProviderAccountStateSchema, type ProviderAccountState, ProviderAccountStatusSchema, type ProviderAccountStatus, ProviderAccountMapSchema, type ProviderAccountMap, ProviderAccountsSchema, type ProviderAccounts, ProviderAccountsSavePayloadSchema, type ProviderAccountsSavePayload, ProviderAccountCreatePayloadSchema, type ProviderAccountCreatePayload, ProviderAccountCreateResultSchema, type ProviderAccountCreateResult, ProviderAccountWatchLoginPayloadSchema, type ProviderAccountWatchLoginPayload, ProviderAccountsReorderPayloadSchema, type ProviderAccountsReorderPayload, orderedAccountIds, topAccountOf } from './provider-accounts.ts';
|
|
9
9
|
export { isRecord } from './record.ts';
|
|
10
10
|
export { TaskStatusSchema, type TaskStatus, TaskResultSchema, type TaskResult, TaskSchema, type Task, TaskChangedEventSchema, type TaskChangedEvent } from './task.ts';
|
|
11
11
|
export { clipText, TOOL_OUTPUT_TAIL, appendToolOutput } from './text.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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, 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';
|
|
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, ChatNoteMessageSchema, 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';
|
|
7
7
|
export { EmptySchema, AGENT_REQUEST_SCHEMAS, AGENT_EVENT_SCHEMAS } from './protocol.js';
|
|
8
|
-
export { ProviderAccountIdSchema, ProviderAccountVariableSchema, ProviderAccountSchema, ProviderAccountStateSchema, ProviderAccountStatusSchema, ProviderAccountMapSchema, ProviderAccountsSchema, ProviderAccountsSavePayloadSchema, ProviderAccountCreatePayloadSchema, ProviderAccountCreateResultSchema, ProviderAccountWatchLoginPayloadSchema } from './provider-accounts.js';
|
|
8
|
+
export { ProviderAccountIdSchema, ProviderAccountVariableSchema, ProviderAccountSchema, ProviderAccountStateSchema, ProviderAccountStatusSchema, ProviderAccountMapSchema, ProviderAccountsSchema, ProviderAccountsSavePayloadSchema, ProviderAccountCreatePayloadSchema, ProviderAccountCreateResultSchema, ProviderAccountWatchLoginPayloadSchema, ProviderAccountsReorderPayloadSchema, orderedAccountIds, topAccountOf } from './provider-accounts.js';
|
|
9
9
|
export { isRecord } from './record.js';
|
|
10
10
|
export { TaskStatusSchema, TaskResultSchema, TaskSchema, TaskChangedEventSchema } from './task.js';
|
|
11
11
|
export { clipText, TOOL_OUTPUT_TAIL, appendToolOutput } from './text.js';
|
package/dist/protocol.d.ts
CHANGED
|
@@ -536,6 +536,11 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
536
536
|
}>;
|
|
537
537
|
text: z.ZodString;
|
|
538
538
|
from: z.ZodOptional<z.ZodString>;
|
|
539
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
540
|
+
from: z.ZodString;
|
|
541
|
+
title: z.ZodString;
|
|
542
|
+
text: z.ZodString;
|
|
543
|
+
}, z.core.$strip>>;
|
|
539
544
|
}, z.core.$strip>, z.ZodObject<{
|
|
540
545
|
id: z.ZodString;
|
|
541
546
|
createdAt: z.ZodNumber;
|
|
@@ -1065,6 +1070,11 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
1065
1070
|
}>;
|
|
1066
1071
|
text: z.ZodString;
|
|
1067
1072
|
from: z.ZodOptional<z.ZodString>;
|
|
1073
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
1074
|
+
from: z.ZodString;
|
|
1075
|
+
title: z.ZodString;
|
|
1076
|
+
text: z.ZodString;
|
|
1077
|
+
}, z.core.$strip>>;
|
|
1068
1078
|
}, z.core.$strip>, z.ZodObject<{
|
|
1069
1079
|
id: z.ZodString;
|
|
1070
1080
|
createdAt: z.ZodNumber;
|
|
@@ -1420,6 +1430,11 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
1420
1430
|
}>;
|
|
1421
1431
|
text: z.ZodString;
|
|
1422
1432
|
from: z.ZodOptional<z.ZodString>;
|
|
1433
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
1434
|
+
from: z.ZodString;
|
|
1435
|
+
title: z.ZodString;
|
|
1436
|
+
text: z.ZodString;
|
|
1437
|
+
}, z.core.$strip>>;
|
|
1423
1438
|
}, z.core.$strip>, z.ZodObject<{
|
|
1424
1439
|
id: z.ZodString;
|
|
1425
1440
|
createdAt: z.ZodNumber;
|
|
@@ -1774,6 +1789,11 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
1774
1789
|
}>;
|
|
1775
1790
|
text: z.ZodString;
|
|
1776
1791
|
from: z.ZodOptional<z.ZodString>;
|
|
1792
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
1793
|
+
from: z.ZodString;
|
|
1794
|
+
title: z.ZodString;
|
|
1795
|
+
text: z.ZodString;
|
|
1796
|
+
}, z.core.$strip>>;
|
|
1777
1797
|
}, z.core.$strip>, z.ZodObject<{
|
|
1778
1798
|
id: z.ZodString;
|
|
1779
1799
|
createdAt: z.ZodNumber;
|
|
@@ -2526,6 +2546,11 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
2526
2546
|
}>;
|
|
2527
2547
|
text: z.ZodString;
|
|
2528
2548
|
from: z.ZodOptional<z.ZodString>;
|
|
2549
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
2550
|
+
from: z.ZodString;
|
|
2551
|
+
title: z.ZodString;
|
|
2552
|
+
text: z.ZodString;
|
|
2553
|
+
}, z.core.$strip>>;
|
|
2529
2554
|
}, z.core.$strip>, z.ZodObject<{
|
|
2530
2555
|
id: z.ZodString;
|
|
2531
2556
|
createdAt: z.ZodNumber;
|
|
@@ -2999,6 +3024,11 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
2999
3024
|
}>;
|
|
3000
3025
|
text: z.ZodString;
|
|
3001
3026
|
from: z.ZodOptional<z.ZodString>;
|
|
3027
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
3028
|
+
from: z.ZodString;
|
|
3029
|
+
title: z.ZodString;
|
|
3030
|
+
text: z.ZodString;
|
|
3031
|
+
}, z.core.$strip>>;
|
|
3002
3032
|
}, z.core.$strip>, z.ZodObject<{
|
|
3003
3033
|
id: z.ZodString;
|
|
3004
3034
|
createdAt: z.ZodNumber;
|
|
@@ -4234,6 +4264,11 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
4234
4264
|
}>;
|
|
4235
4265
|
text: z.ZodString;
|
|
4236
4266
|
from: z.ZodOptional<z.ZodString>;
|
|
4267
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
4268
|
+
from: z.ZodString;
|
|
4269
|
+
title: z.ZodString;
|
|
4270
|
+
text: z.ZodString;
|
|
4271
|
+
}, z.core.$strip>>;
|
|
4237
4272
|
}, z.core.$strip>, z.ZodObject<{
|
|
4238
4273
|
id: z.ZodString;
|
|
4239
4274
|
createdAt: z.ZodNumber;
|
|
@@ -4514,6 +4549,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
4514
4549
|
sensitive: z.ZodBoolean;
|
|
4515
4550
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
4516
4551
|
}, z.core.$strip>>>;
|
|
4552
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
4517
4553
|
}, z.core.$strip>>;
|
|
4518
4554
|
statuses: z.ZodArray<z.ZodObject<{
|
|
4519
4555
|
id: z.ZodString;
|
|
@@ -4557,6 +4593,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
4557
4593
|
sensitive: z.ZodBoolean;
|
|
4558
4594
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
4559
4595
|
}, z.core.$strip>>>;
|
|
4596
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
4560
4597
|
}, z.core.$strip>>;
|
|
4561
4598
|
}, z.core.$strip>;
|
|
4562
4599
|
readonly result: z.ZodObject<{
|
|
@@ -4573,6 +4610,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
4573
4610
|
sensitive: z.ZodBoolean;
|
|
4574
4611
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
4575
4612
|
}, z.core.$strip>>>;
|
|
4613
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
4576
4614
|
}, z.core.$strip>>;
|
|
4577
4615
|
statuses: z.ZodArray<z.ZodObject<{
|
|
4578
4616
|
id: z.ZodString;
|
|
@@ -4617,6 +4655,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
4617
4655
|
sensitive: z.ZodBoolean;
|
|
4618
4656
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
4619
4657
|
}, z.core.$strip>>>;
|
|
4658
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
4620
4659
|
}, z.core.$strip>>;
|
|
4621
4660
|
statuses: z.ZodArray<z.ZodObject<{
|
|
4622
4661
|
id: z.ZodString;
|
|
@@ -4665,6 +4704,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
4665
4704
|
sensitive: z.ZodBoolean;
|
|
4666
4705
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
4667
4706
|
}, z.core.$strip>>>;
|
|
4707
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
4668
4708
|
}, z.core.$strip>>;
|
|
4669
4709
|
statuses: z.ZodArray<z.ZodObject<{
|
|
4670
4710
|
id: z.ZodString;
|
|
@@ -4700,6 +4740,54 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
4700
4740
|
}, z.core.$strip>;
|
|
4701
4741
|
readonly result: z.ZodObject<{}, z.core.$strip>;
|
|
4702
4742
|
};
|
|
4743
|
+
readonly 'accounts.reorder': {
|
|
4744
|
+
readonly payload: z.ZodObject<{
|
|
4745
|
+
kind: z.ZodString;
|
|
4746
|
+
ids: z.ZodArray<z.ZodString>;
|
|
4747
|
+
}, z.core.$strip>;
|
|
4748
|
+
readonly result: z.ZodObject<{
|
|
4749
|
+
accounts: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
4750
|
+
kind: z.ZodString;
|
|
4751
|
+
label: z.ZodOptional<z.ZodString>;
|
|
4752
|
+
color: z.ZodOptional<z.ZodString>;
|
|
4753
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
4754
|
+
home: z.ZodOptional<z.ZodString>;
|
|
4755
|
+
shadowHome: z.ZodOptional<z.ZodString>;
|
|
4756
|
+
env: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4757
|
+
name: z.ZodString;
|
|
4758
|
+
value: z.ZodString;
|
|
4759
|
+
sensitive: z.ZodBoolean;
|
|
4760
|
+
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
4761
|
+
}, z.core.$strip>>>;
|
|
4762
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
4763
|
+
}, z.core.$strip>>;
|
|
4764
|
+
statuses: z.ZodArray<z.ZodObject<{
|
|
4765
|
+
id: z.ZodString;
|
|
4766
|
+
kind: z.ZodString;
|
|
4767
|
+
state: z.ZodEnum<{
|
|
4768
|
+
checking: "checking";
|
|
4769
|
+
disabled: "disabled";
|
|
4770
|
+
failed: "failed";
|
|
4771
|
+
"folder-missing": "folder-missing";
|
|
4772
|
+
"not-found": "not-found";
|
|
4773
|
+
ready: "ready";
|
|
4774
|
+
"signed-out": "signed-out";
|
|
4775
|
+
unavailable: "unavailable";
|
|
4776
|
+
}>;
|
|
4777
|
+
email: z.ZodNullable<z.ZodString>;
|
|
4778
|
+
plan: z.ZodNullable<z.ZodString>;
|
|
4779
|
+
organization: z.ZodNullable<z.ZodString>;
|
|
4780
|
+
home: z.ZodString;
|
|
4781
|
+
transcripts: z.ZodOptional<z.ZodString>;
|
|
4782
|
+
message: z.ZodNullable<z.ZodString>;
|
|
4783
|
+
checkedAt: z.ZodNumber;
|
|
4784
|
+
}, z.core.$strip>>;
|
|
4785
|
+
secretsAvailable: z.ZodOptional<z.ZodBoolean>;
|
|
4786
|
+
loginCommands: z.ZodOptional<z.ZodRecord<z.ZodString & z.core.$partial, z.ZodString>>;
|
|
4787
|
+
chatLogins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4788
|
+
silentLogins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4789
|
+
}, z.core.$strip>;
|
|
4790
|
+
};
|
|
4703
4791
|
readonly 'usage.summary': {
|
|
4704
4792
|
readonly payload: z.ZodObject<{
|
|
4705
4793
|
from: z.ZodString;
|
|
@@ -5495,6 +5583,11 @@ export declare const AGENT_EVENT_SCHEMAS: {
|
|
|
5495
5583
|
}>;
|
|
5496
5584
|
text: z.ZodString;
|
|
5497
5585
|
from: z.ZodOptional<z.ZodString>;
|
|
5586
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
5587
|
+
from: z.ZodString;
|
|
5588
|
+
title: z.ZodString;
|
|
5589
|
+
text: z.ZodString;
|
|
5590
|
+
}, z.core.$strip>>;
|
|
5498
5591
|
}, z.core.$strip>, z.ZodObject<{
|
|
5499
5592
|
id: z.ZodString;
|
|
5500
5593
|
createdAt: z.ZodNumber;
|
|
@@ -6247,6 +6340,11 @@ export declare const AGENT_EVENT_SCHEMAS: {
|
|
|
6247
6340
|
}>;
|
|
6248
6341
|
text: z.ZodString;
|
|
6249
6342
|
from: z.ZodOptional<z.ZodString>;
|
|
6343
|
+
message: z.ZodOptional<z.ZodObject<{
|
|
6344
|
+
from: z.ZodString;
|
|
6345
|
+
title: z.ZodString;
|
|
6346
|
+
text: z.ZodString;
|
|
6347
|
+
}, z.core.$strip>>;
|
|
6250
6348
|
}, z.core.$strip>, z.ZodObject<{
|
|
6251
6349
|
id: z.ZodString;
|
|
6252
6350
|
createdAt: z.ZodNumber;
|
|
@@ -6518,6 +6616,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
|
|
|
6518
6616
|
sensitive: z.ZodBoolean;
|
|
6519
6617
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
6520
6618
|
}, z.core.$strip>>>;
|
|
6619
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
6521
6620
|
}, z.core.$strip>>;
|
|
6522
6621
|
statuses: z.ZodArray<z.ZodObject<{
|
|
6523
6622
|
id: z.ZodString;
|
package/dist/protocol.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ChatAddBookmarkPayloadSchema, ChatAnswerPayloadSchema, ChatApprovePayloadSchema, ChatAttachPayloadSchema, ChatAttachResultSchema, ChatBookmarksEventSchema, ChatBookmarksResultSchema, ChatCancelPayloadSchema, ChatClearPayloadSchema, ChatConfigurePayloadSchema, ChatContinueOnPayloadSchema, ChatContinueOnResultSchema, ChatCreatePayloadSchema, ChatDismissPayloadSchema, ChatEventEnvelopeSchema, ChatForkInfoPayloadSchema, ChatForkInfoResultSchema, ChatForkPayloadSchema, ChatForkResultSchema, ChatGoalPayloadSchema, ChatHistoryPayloadSchema, ChatHistoryResultSchema, ChatInfoSchema, ChatListResultSchema, ChatPreferencesPayloadSchema, ChatQueuePayloadSchema, ChatRemoveBookmarkPayloadSchema, ChatRemoveVisualPayloadSchema, ChatRenameBookmarkPayloadSchema, ChatSendPayloadSchema, ChatSendResultSchema, ChatUiChoicePayloadSchema, ChatUiLinkPayloadSchema, ChatUiLinkReadingSchema, ChatUiQueryPayloadSchema, ChatUiQueryReadingSchema, ChatStatusEventSchema, ChatStopSubagentPayloadSchema, ChatStopTaskPayloadSchema, ChatSubagentChangedEventSchema, ChatSubagentPayloadSchema, ChatSubagentResultSchema, ChatSummarizePayloadSchema, ChatSummarizeResultSchema, ChatTargetPayloadSchema, ChatTurnDiffPayloadSchema, ChatTurnDiffResultSchema, ChatToolOutputPayloadSchema, ChatToolOutputResultSchema, ChatUnqueueResultSchema, ChatVisualsEventSchema, ChatVisualsResultSchema, SkillsListPayloadSchema, SkillsListResultSchema } from './chat.js';
|
|
3
3
|
import { ProviderListResultSchema } from './model.js';
|
|
4
|
-
import { ProviderAccountCreatePayloadSchema, ProviderAccountCreateResultSchema, ProviderAccountWatchLoginPayloadSchema, ProviderAccountsSavePayloadSchema, ProviderAccountsSchema } from './provider-accounts.js';
|
|
4
|
+
import { ProviderAccountCreatePayloadSchema, ProviderAccountCreateResultSchema, ProviderAccountWatchLoginPayloadSchema, ProviderAccountsReorderPayloadSchema, ProviderAccountsSavePayloadSchema, ProviderAccountsSchema } from './provider-accounts.js';
|
|
5
5
|
import { UsageChangedEventSchema, UsageLimitsSnapshotSchema, UsageSummaryPayloadSchema, UsageSummaryResultSchema } from './usage.js';
|
|
6
6
|
export const EmptySchema = z.object({});
|
|
7
7
|
/*
|
|
@@ -51,6 +51,7 @@ export const AGENT_REQUEST_SCHEMAS = {
|
|
|
51
51
|
'accounts.create': { payload: ProviderAccountCreatePayloadSchema, result: ProviderAccountCreateResultSchema },
|
|
52
52
|
// Answers at once; what the CLI says arrives as `accounts.changed`.
|
|
53
53
|
'accounts.watchLogin': { payload: ProviderAccountWatchLoginPayloadSchema, result: EmptySchema },
|
|
54
|
+
'accounts.reorder': { payload: ProviderAccountsReorderPayloadSchema, result: ProviderAccountsSchema },
|
|
54
55
|
'usage.summary': { payload: UsageSummaryPayloadSchema, result: UsageSummaryResultSchema },
|
|
55
56
|
'usage.subscribe': { payload: EmptySchema, result: EmptySchema },
|
|
56
57
|
'usage.unsubscribe': { payload: EmptySchema, result: EmptySchema },
|
|
@@ -21,6 +21,7 @@ export declare const ProviderAccountSchema: z.ZodObject<{
|
|
|
21
21
|
sensitive: z.ZodBoolean;
|
|
22
22
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
23
23
|
}, z.core.$strip>>>;
|
|
24
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
24
25
|
}, z.core.$strip>;
|
|
25
26
|
export type ProviderAccount = z.infer<typeof ProviderAccountSchema>;
|
|
26
27
|
export declare const ProviderAccountStateSchema: z.ZodEnum<{
|
|
@@ -69,6 +70,7 @@ export declare const ProviderAccountMapSchema: z.ZodRecord<z.ZodString, z.ZodObj
|
|
|
69
70
|
sensitive: z.ZodBoolean;
|
|
70
71
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
71
72
|
}, z.core.$strip>>>;
|
|
73
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
72
74
|
}, z.core.$strip>>;
|
|
73
75
|
export type ProviderAccountMap = z.infer<typeof ProviderAccountMapSchema>;
|
|
74
76
|
export declare const ProviderAccountsSchema: z.ZodObject<{
|
|
@@ -85,6 +87,7 @@ export declare const ProviderAccountsSchema: z.ZodObject<{
|
|
|
85
87
|
sensitive: z.ZodBoolean;
|
|
86
88
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
87
89
|
}, z.core.$strip>>>;
|
|
90
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
88
91
|
}, z.core.$strip>>;
|
|
89
92
|
statuses: z.ZodArray<z.ZodObject<{
|
|
90
93
|
id: z.ZodString;
|
|
@@ -127,9 +130,17 @@ export declare const ProviderAccountsSavePayloadSchema: z.ZodObject<{
|
|
|
127
130
|
sensitive: z.ZodBoolean;
|
|
128
131
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
129
132
|
}, z.core.$strip>>>;
|
|
133
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
130
134
|
}, z.core.$strip>>;
|
|
131
135
|
}, z.core.$strip>;
|
|
132
136
|
export type ProviderAccountsSavePayload = z.infer<typeof ProviderAccountsSavePayloadSchema>;
|
|
137
|
+
export declare const ProviderAccountsReorderPayloadSchema: z.ZodObject<{
|
|
138
|
+
kind: z.ZodString;
|
|
139
|
+
ids: z.ZodArray<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
export type ProviderAccountsReorderPayload = z.infer<typeof ProviderAccountsReorderPayloadSchema>;
|
|
142
|
+
export declare function orderedAccountIds(accounts: ProviderAccountMap, kind: string): string[];
|
|
143
|
+
export declare function topAccountOf(accounts: ProviderAccountMap, kind: string): string;
|
|
133
144
|
export declare const ProviderAccountCreatePayloadSchema: z.ZodObject<{
|
|
134
145
|
kind: z.ZodString;
|
|
135
146
|
label: z.ZodString;
|
|
@@ -150,6 +161,7 @@ export declare const ProviderAccountCreateResultSchema: z.ZodObject<{
|
|
|
150
161
|
sensitive: z.ZodBoolean;
|
|
151
162
|
valueRedacted: z.ZodOptional<z.ZodBoolean>;
|
|
152
163
|
}, z.core.$strip>>>;
|
|
164
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
153
165
|
}, z.core.$strip>>;
|
|
154
166
|
statuses: z.ZodArray<z.ZodObject<{
|
|
155
167
|
id: z.ZodString;
|
|
@@ -31,7 +31,9 @@ export const ProviderAccountSchema = z.object({
|
|
|
31
31
|
// Codex only: a folder of its own for the login, sharing everything else with `home`.
|
|
32
32
|
shadowHome: z.string().min(1).optional(),
|
|
33
33
|
// Set on the CLI's environment after the login variables are taken off, so a key here is one a person chose.
|
|
34
|
-
env: z.array(ProviderAccountVariableSchema).optional()
|
|
34
|
+
env: z.array(ProviderAccountVariableSchema).optional(),
|
|
35
|
+
// Its place among the accounts of its CLI, lowest first; only `accounts.reorder` sets it, and a save without it keeps it.
|
|
36
|
+
order: z.number().int().nonnegative().optional()
|
|
35
37
|
});
|
|
36
38
|
export const ProviderAccountStateSchema = z.enum([
|
|
37
39
|
'checking',
|
|
@@ -79,6 +81,28 @@ export const ProviderAccountsSchema = z.object({
|
|
|
79
81
|
export const ProviderAccountsSavePayloadSchema = z.object({
|
|
80
82
|
accounts: ProviderAccountMapSchema
|
|
81
83
|
});
|
|
84
|
+
/* The accounts of one CLI in a person's order; an account of that CLI left out loses its place and falls in after the ordered ones. */
|
|
85
|
+
export const ProviderAccountsReorderPayloadSchema = z.object({
|
|
86
|
+
kind: AgentKindSchema,
|
|
87
|
+
ids: z.array(ProviderAccountIdSchema)
|
|
88
|
+
});
|
|
89
|
+
/*
|
|
90
|
+
* The ids of the accounts of one CLI in a person's order: the ordered ones first, then the default
|
|
91
|
+
* account, then the rest by id, so a machine where nobody reordered keeps the default on top.
|
|
92
|
+
*/
|
|
93
|
+
export function orderedAccountIds(accounts, kind) {
|
|
94
|
+
const rank = (id, account) => [account.order ?? Number.POSITIVE_INFINITY, id === kind ? 0 : 1, id];
|
|
95
|
+
return (Object.entries(accounts)
|
|
96
|
+
.filter(([, account]) => account.kind === kind)
|
|
97
|
+
.map(([id, account]) => ({ id, rank: rank(id, account) }))
|
|
98
|
+
// Ids compare by code point, the way the iPhone app compares them, so both name the same account first.
|
|
99
|
+
.sort((a, b) => a.rank[0] - b.rank[0] || a.rank[1] - b.rank[1] || (a.rank[2] < b.rank[2] ? -1 : a.rank[2] > b.rank[2] ? 1 : 0))
|
|
100
|
+
.map((entry) => entry.id));
|
|
101
|
+
}
|
|
102
|
+
/* The account a start of this CLI takes when nothing names one: the first in the order that is on, else the CLI's default account. */
|
|
103
|
+
export function topAccountOf(accounts, kind) {
|
|
104
|
+
return orderedAccountIds(accounts, kind).find((id) => accounts[id]?.enabled !== false) ?? kind;
|
|
105
|
+
}
|
|
82
106
|
/* An account in a folder the daemon makes for it under its account data directory; a Codex one is a shadow home over the CLI's own folder. */
|
|
83
107
|
export const ProviderAccountCreatePayloadSchema = z.object({
|
|
84
108
|
kind: AgentKindSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agent-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.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.
|
|
89
|
+
"@adecore/intelligent-ui": "0.48.0",
|
|
90
90
|
"zod": "^4.6.7"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
package/src/chat.ts
CHANGED
|
@@ -710,13 +710,18 @@ export function abortedByEnd(turn: { id: string; state: string }, items: readonl
|
|
|
710
710
|
/* The id prefix of the note a host leaves in a parent about a child that waits on a request. */
|
|
711
711
|
export const WAITING_NOTE_PREFIX = 'waiting-';
|
|
712
712
|
|
|
713
|
+
/* A message another node sent a chat: its id, the name it had on the canvas then, and what it said. */
|
|
714
|
+
export const ChatNoteMessageSchema = z.object({ from: z.string().min(1), title: z.string(), text: z.string() });
|
|
715
|
+
|
|
713
716
|
export const ChatNoteItemSchema = z.object({
|
|
714
717
|
...base,
|
|
715
718
|
kind: z.literal('note'),
|
|
716
719
|
level: z.enum(['info', 'warning', 'error']),
|
|
717
720
|
text: z.string(),
|
|
718
721
|
// The chat a delivered summary came from, so a client can offer to open it.
|
|
719
|
-
from: ChatIdSchema.optional()
|
|
722
|
+
from: ChatIdSchema.optional(),
|
|
723
|
+
// A message another node sent, which a client draws as said to this chat; `text` holds it as a line for one that does not know this.
|
|
724
|
+
message: ChatNoteMessageSchema.optional()
|
|
720
725
|
});
|
|
721
726
|
|
|
722
727
|
export const ChatCompactionItemSchema = z.object({
|
|
@@ -752,6 +757,7 @@ export type ChatApprovalItem = z.infer<typeof ChatApprovalItemSchema>;
|
|
|
752
757
|
export type ChatQuestionItem = z.infer<typeof ChatQuestionItemSchema>;
|
|
753
758
|
export type ChatTurnItem = z.infer<typeof ChatTurnItemSchema>;
|
|
754
759
|
export type ChatNoteItem = z.infer<typeof ChatNoteItemSchema>;
|
|
760
|
+
export type ChatNoteMessage = z.infer<typeof ChatNoteMessageSchema>;
|
|
755
761
|
export type ChatCompactionItem = z.infer<typeof ChatCompactionItemSchema>;
|
|
756
762
|
|
|
757
763
|
/*
|
package/src/index.ts
CHANGED
|
@@ -138,6 +138,7 @@ export {
|
|
|
138
138
|
outlineItems,
|
|
139
139
|
WAITING_NOTE_PREFIX,
|
|
140
140
|
ChatNoteItemSchema,
|
|
141
|
+
ChatNoteMessageSchema,
|
|
141
142
|
ChatCompactionItemSchema,
|
|
142
143
|
ChatItemSchema,
|
|
143
144
|
type ChatItem,
|
|
@@ -150,6 +151,7 @@ export {
|
|
|
150
151
|
type ChatQuestionItem,
|
|
151
152
|
type ChatTurnItem,
|
|
152
153
|
type ChatNoteItem,
|
|
154
|
+
type ChatNoteMessage,
|
|
153
155
|
type ChatCompactionItem,
|
|
154
156
|
ChatEventSchema,
|
|
155
157
|
type ChatEvent,
|
|
@@ -348,7 +350,11 @@ export {
|
|
|
348
350
|
ProviderAccountCreateResultSchema,
|
|
349
351
|
type ProviderAccountCreateResult,
|
|
350
352
|
ProviderAccountWatchLoginPayloadSchema,
|
|
351
|
-
type ProviderAccountWatchLoginPayload
|
|
353
|
+
type ProviderAccountWatchLoginPayload,
|
|
354
|
+
ProviderAccountsReorderPayloadSchema,
|
|
355
|
+
type ProviderAccountsReorderPayload,
|
|
356
|
+
orderedAccountIds,
|
|
357
|
+
topAccountOf
|
|
352
358
|
} from './provider-accounts.ts';
|
|
353
359
|
export { isRecord } from './record.ts';
|
|
354
360
|
export {
|
package/src/protocol.ts
CHANGED
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
ProviderAccountCreatePayloadSchema,
|
|
61
61
|
ProviderAccountCreateResultSchema,
|
|
62
62
|
ProviderAccountWatchLoginPayloadSchema,
|
|
63
|
+
ProviderAccountsReorderPayloadSchema,
|
|
63
64
|
ProviderAccountsSavePayloadSchema,
|
|
64
65
|
ProviderAccountsSchema
|
|
65
66
|
} from './provider-accounts.ts';
|
|
@@ -114,6 +115,7 @@ export const AGENT_REQUEST_SCHEMAS = {
|
|
|
114
115
|
'accounts.create': { payload: ProviderAccountCreatePayloadSchema, result: ProviderAccountCreateResultSchema },
|
|
115
116
|
// Answers at once; what the CLI says arrives as `accounts.changed`.
|
|
116
117
|
'accounts.watchLogin': { payload: ProviderAccountWatchLoginPayloadSchema, result: EmptySchema },
|
|
118
|
+
'accounts.reorder': { payload: ProviderAccountsReorderPayloadSchema, result: ProviderAccountsSchema },
|
|
117
119
|
'usage.summary': { payload: UsageSummaryPayloadSchema, result: UsageSummaryResultSchema },
|
|
118
120
|
'usage.subscribe': { payload: EmptySchema, result: EmptySchema },
|
|
119
121
|
'usage.unsubscribe': { payload: EmptySchema, result: EmptySchema },
|
package/src/provider-accounts.ts
CHANGED
|
@@ -37,7 +37,9 @@ export const ProviderAccountSchema = z.object({
|
|
|
37
37
|
// Codex only: a folder of its own for the login, sharing everything else with `home`.
|
|
38
38
|
shadowHome: z.string().min(1).optional(),
|
|
39
39
|
// Set on the CLI's environment after the login variables are taken off, so a key here is one a person chose.
|
|
40
|
-
env: z.array(ProviderAccountVariableSchema).optional()
|
|
40
|
+
env: z.array(ProviderAccountVariableSchema).optional(),
|
|
41
|
+
// Its place among the accounts of its CLI, lowest first; only `accounts.reorder` sets it, and a save without it keeps it.
|
|
42
|
+
order: z.number().int().nonnegative().optional()
|
|
41
43
|
});
|
|
42
44
|
export type ProviderAccount = z.infer<typeof ProviderAccountSchema>;
|
|
43
45
|
|
|
@@ -97,6 +99,35 @@ export const ProviderAccountsSavePayloadSchema = z.object({
|
|
|
97
99
|
});
|
|
98
100
|
export type ProviderAccountsSavePayload = z.infer<typeof ProviderAccountsSavePayloadSchema>;
|
|
99
101
|
|
|
102
|
+
/* The accounts of one CLI in a person's order; an account of that CLI left out loses its place and falls in after the ordered ones. */
|
|
103
|
+
export const ProviderAccountsReorderPayloadSchema = z.object({
|
|
104
|
+
kind: AgentKindSchema,
|
|
105
|
+
ids: z.array(ProviderAccountIdSchema)
|
|
106
|
+
});
|
|
107
|
+
export type ProviderAccountsReorderPayload = z.infer<typeof ProviderAccountsReorderPayloadSchema>;
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
* The ids of the accounts of one CLI in a person's order: the ordered ones first, then the default
|
|
111
|
+
* account, then the rest by id, so a machine where nobody reordered keeps the default on top.
|
|
112
|
+
*/
|
|
113
|
+
export function orderedAccountIds(accounts: ProviderAccountMap, kind: string): string[] {
|
|
114
|
+
const rank = (id: string, account: ProviderAccount): [number, number, string] => [account.order ?? Number.POSITIVE_INFINITY, id === kind ? 0 : 1, id];
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
Object.entries(accounts)
|
|
118
|
+
.filter(([, account]) => account.kind === kind)
|
|
119
|
+
.map(([id, account]) => ({ id, rank: rank(id, account) }))
|
|
120
|
+
// Ids compare by code point, the way the iPhone app compares them, so both name the same account first.
|
|
121
|
+
.sort((a, b) => a.rank[0] - b.rank[0] || a.rank[1] - b.rank[1] || (a.rank[2] < b.rank[2] ? -1 : a.rank[2] > b.rank[2] ? 1 : 0))
|
|
122
|
+
.map((entry) => entry.id)
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* The account a start of this CLI takes when nothing names one: the first in the order that is on, else the CLI's default account. */
|
|
127
|
+
export function topAccountOf(accounts: ProviderAccountMap, kind: string): string {
|
|
128
|
+
return orderedAccountIds(accounts, kind).find((id) => accounts[id]?.enabled !== false) ?? kind;
|
|
129
|
+
}
|
|
130
|
+
|
|
100
131
|
/* An account in a folder the daemon makes for it under its account data directory; a Codex one is a shadow home over the CLI's own folder. */
|
|
101
132
|
export const ProviderAccountCreatePayloadSchema = z.object({
|
|
102
133
|
kind: AgentKindSchema,
|