@adecore/agent-contracts 0.37.0 → 0.37.2

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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { KNOWN_AGENT_KINDS, type KnownAgentKind, AGENT_KIND_MAX_LENGTH, AgentKin
2
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, 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, 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, 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 } 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
- 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, ProviderListResultSchema, type ProviderListResult, resumeCommandFor } from './model.ts';
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
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';
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ export { KNOWN_AGENT_KINDS, AGENT_KIND_MAX_LENGTH, AgentKindSchema, isKnownAgent
3
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, ChatToolItemSchema, ChatSubagentUsageSchema, HOST_TASK_ORIGIN, ChatSubagentItemSchema, ChatApprovalDecisionSchema, ChatApprovalItemSchema, ChatQuestionItemSchema, ChatCheckpointFileSchema, ChatCheckpointDiffSchema, ChatTurnItemSchema, notResumedNote, abortedByMachine, ENDED_NOTE_PREFIX, abortedByEnd, activeSubagents, 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, CHAT_FORK_TITLE_MAX, ChatForkPayloadSchema, ChatForkResultSchema, ChatContinueOnPayloadSchema, ChatContinueOnResultSchema, ChatSummarizePayloadSchema, ChatSummarizeResultSchema, ChatForkInfoPayloadSchema, ChatForkInfoResultSchema, ChatListResultSchema, GeneratedImageInputSchema, generatedImageAttachment } 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
- export { ModelOptionChoiceSchema, ModelOptionDescriptorSchema, ModelInfoSchema, ModelSelectionSchema, ModelCatalogProfileSchema, ModelCatalogEntrySchema, ModelCatalogDataSchema, RuntimeModeSchema, ProviderCapabilitiesSchema, ProviderPlatformSchema, ProviderSignInSchema, ProviderInstallSchema, ProviderInfoSchema, ProviderListResultSchema, resumeCommandFor } from './model.js';
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
8
  export { ProviderAccountIdSchema, ProviderAccountVariableSchema, ProviderAccountSchema, ProviderAccountStateSchema, ProviderAccountStatusSchema, ProviderAccountMapSchema, ProviderAccountsSchema, ProviderAccountsSavePayloadSchema, ProviderAccountCreatePayloadSchema, ProviderAccountCreateResultSchema, ProviderAccountWatchLoginPayloadSchema } from './provider-accounts.js';
9
9
  export { isRecord } from './record.js';
package/dist/model.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { type AgentKind } from './agent.ts';
2
3
  export declare const ModelOptionChoiceSchema: z.ZodObject<{
3
4
  id: z.ZodString;
4
5
  label: z.ZodString;
@@ -282,6 +283,19 @@ export declare const ProviderInfoSchema: z.ZodObject<{
282
283
  }, z.core.$strip>>;
283
284
  }, z.core.$strip>;
284
285
  export type ProviderInfo = z.infer<typeof ProviderInfoSchema>;
286
+ export declare const FRONTIER_PROVIDER_KINDS: ReadonlySet<AgentKind>;
287
+ export declare const API_PROVIDER_KINDS: ReadonlySet<AgentKind>;
288
+ export type ProviderPickerGroup = 'frontier' | 'others' | 'api';
289
+ export interface ProviderPickerGroups<T> {
290
+ frontier: T[];
291
+ others: T[];
292
+ api: T[];
293
+ }
294
+ export declare function providerGroupOf(kind: AgentKind): ProviderPickerGroup;
295
+ export declare function pickerGroupsOf<T extends {
296
+ kind: AgentKind;
297
+ name: string;
298
+ }>(providers: readonly T[]): ProviderPickerGroups<T>;
285
299
  export declare const ProviderListResultSchema: z.ZodObject<{
286
300
  providers: z.ZodArray<z.ZodObject<{
287
301
  kind: z.ZodString;
package/dist/model.js CHANGED
@@ -148,6 +148,23 @@ export const ProviderInfoSchema = z.object({
148
148
  // Absent from a host that knows no way to install this CLI, and from one older than this field.
149
149
  install: ProviderInstallSchema.optional()
150
150
  });
151
+ // The CLIs of the labs that train their own frontier models; a picker lists them before every other provider.
152
+ export const FRONTIER_PROVIDER_KINDS = new Set(['claude', 'codex']);
153
+ // Providers billed per key rather than a CLI's own sign-in; a picker lists them last. Named, since an agent of
154
+ // the ACP registry has no terminal either.
155
+ export const API_PROVIDER_KINDS = new Set(['anthropic-claude-api', 'nanogpt']);
156
+ export function providerGroupOf(kind) {
157
+ return FRONTIER_PROVIDER_KINDS.has(kind) ? 'frontier' : API_PROVIDER_KINDS.has(kind) ? 'api' : 'others';
158
+ }
159
+ let nameCollator = null;
160
+ /* The providers in the three groups of a picker, each by name. Names are proper names, so the runtime locale sorts them. */
161
+ export function pickerGroupsOf(providers) {
162
+ nameCollator ??= new Intl.Collator(undefined, { sensitivity: 'base' });
163
+ const collator = nameCollator;
164
+ const sorted = [...providers].sort((a, b) => collator.compare(a.name, b.name));
165
+ const inGroup = (group) => sorted.filter((provider) => providerGroupOf(provider.kind) === group);
166
+ return { frontier: inGroup('frontier'), others: inGroup('others'), api: inGroup('api') };
167
+ }
151
168
  export const ProviderListResultSchema = z.object({
152
169
  providers: z.array(ProviderInfoSchema)
153
170
  });
@@ -4230,6 +4230,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4230
4230
  buckets: z.ZodArray<z.ZodObject<{
4231
4231
  slot: z.ZodString;
4232
4232
  provider: z.ZodEnum<{
4233
+ "anthropic-claude-api": "anthropic-claude-api";
4233
4234
  claude: "claude";
4234
4235
  codex: "codex";
4235
4236
  copilot: "copilot";
@@ -4253,6 +4254,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4253
4254
  }, z.core.$strip>>;
4254
4255
  models: z.ZodArray<z.ZodObject<{
4255
4256
  provider: z.ZodEnum<{
4257
+ "anthropic-claude-api": "anthropic-claude-api";
4256
4258
  claude: "claude";
4257
4259
  codex: "codex";
4258
4260
  copilot: "copilot";
@@ -4284,6 +4286,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4284
4286
  name: z.ZodString;
4285
4287
  projectId: z.ZodNullable<z.ZodString>;
4286
4288
  byProvider: z.ZodRecord<z.ZodEnum<{
4289
+ "anthropic-claude-api": "anthropic-claude-api";
4287
4290
  claude: "claude";
4288
4291
  codex: "codex";
4289
4292
  copilot: "copilot";
@@ -4330,6 +4333,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4330
4333
  }, z.core.$strip>>;
4331
4334
  roots: z.ZodArray<z.ZodObject<{
4332
4335
  provider: z.ZodEnum<{
4336
+ "anthropic-claude-api": "anthropic-claude-api";
4333
4337
  claude: "claude";
4334
4338
  codex: "codex";
4335
4339
  copilot: "copilot";
@@ -4347,6 +4351,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4347
4351
  accounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
4348
4352
  id: z.ZodString;
4349
4353
  kind: z.ZodEnum<{
4354
+ "anthropic-claude-api": "anthropic-claude-api";
4350
4355
  claude: "claude";
4351
4356
  codex: "codex";
4352
4357
  copilot: "copilot";
@@ -4371,6 +4376,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4371
4376
  readonly result: z.ZodObject<{
4372
4377
  providers: z.ZodArray<z.ZodObject<{
4373
4378
  kind: z.ZodEnum<{
4379
+ "anthropic-claude-api": "anthropic-claude-api";
4374
4380
  claude: "claude";
4375
4381
  codex: "codex";
4376
4382
  copilot: "copilot";
@@ -4420,6 +4426,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
4420
4426
  readonly result: z.ZodObject<{
4421
4427
  providers: z.ZodArray<z.ZodObject<{
4422
4428
  kind: z.ZodEnum<{
4429
+ "anthropic-claude-api": "anthropic-claude-api";
4423
4430
  claude: "claude";
4424
4431
  codex: "codex";
4425
4432
  copilot: "copilot";
@@ -5937,6 +5944,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
5937
5944
  readonly 'usage.limitsChanged': z.ZodObject<{
5938
5945
  providers: z.ZodArray<z.ZodObject<{
5939
5946
  kind: z.ZodEnum<{
5947
+ "anthropic-claude-api": "anthropic-claude-api";
5940
5948
  claude: "claude";
5941
5949
  codex: "codex";
5942
5950
  copilot: "copilot";
package/dist/usage.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const UsageProviderSchema: z.ZodEnum<{
3
+ "anthropic-claude-api": "anthropic-claude-api";
3
4
  claude: "claude";
4
5
  codex: "codex";
5
6
  copilot: "copilot";
@@ -7,7 +8,7 @@ export declare const UsageProviderSchema: z.ZodEnum<{
7
8
  nanogpt: "nanogpt";
8
9
  }>;
9
10
  export type UsageProvider = z.infer<typeof UsageProviderSchema>;
10
- export declare const USAGE_PROVIDERS: ("claude" | "codex" | "copilot" | "grok" | "nanogpt")[];
11
+ export declare const USAGE_PROVIDERS: ("anthropic-claude-api" | "claude" | "codex" | "copilot" | "grok" | "nanogpt")[];
11
12
  export declare const UsageResolutionSchema: z.ZodEnum<{
12
13
  day: "day";
13
14
  hour: "hour";
@@ -29,6 +30,7 @@ export declare function addTotals(first: UsageTotals, second: UsageTotals): Usag
29
30
  export declare const UsageAccountSchema: z.ZodObject<{
30
31
  id: z.ZodString;
31
32
  kind: z.ZodEnum<{
33
+ "anthropic-claude-api": "anthropic-claude-api";
32
34
  claude: "claude";
33
35
  codex: "codex";
34
36
  copilot: "copilot";
@@ -42,6 +44,7 @@ export type UsageAccount = z.infer<typeof UsageAccountSchema>;
42
44
  export declare const UsageBucketSchema: z.ZodObject<{
43
45
  slot: z.ZodString;
44
46
  provider: z.ZodEnum<{
47
+ "anthropic-claude-api": "anthropic-claude-api";
45
48
  claude: "claude";
46
49
  codex: "codex";
47
50
  copilot: "copilot";
@@ -73,6 +76,7 @@ export declare const UsagePriceBasisSchema: z.ZodEnum<{
73
76
  export type UsagePriceBasis = z.infer<typeof UsagePriceBasisSchema>;
74
77
  export declare const UsageModelSchema: z.ZodObject<{
75
78
  provider: z.ZodEnum<{
79
+ "anthropic-claude-api": "anthropic-claude-api";
76
80
  claude: "claude";
77
81
  codex: "codex";
78
82
  copilot: "copilot";
@@ -105,6 +109,7 @@ export declare const UsageProjectSchema: z.ZodObject<{
105
109
  name: z.ZodString;
106
110
  projectId: z.ZodNullable<z.ZodString>;
107
111
  byProvider: z.ZodRecord<z.ZodEnum<{
112
+ "anthropic-claude-api": "anthropic-claude-api";
108
113
  claude: "claude";
109
114
  codex: "codex";
110
115
  copilot: "copilot";
@@ -158,6 +163,7 @@ export declare const UsagePricingSchema: z.ZodObject<{
158
163
  export type UsagePricing = z.infer<typeof UsagePricingSchema>;
159
164
  export declare const UsageRootSchema: z.ZodObject<{
160
165
  provider: z.ZodEnum<{
166
+ "anthropic-claude-api": "anthropic-claude-api";
161
167
  claude: "claude";
162
168
  codex: "codex";
163
169
  copilot: "copilot";
@@ -191,6 +197,7 @@ export declare const UsageSummaryResultSchema: z.ZodObject<{
191
197
  buckets: z.ZodArray<z.ZodObject<{
192
198
  slot: z.ZodString;
193
199
  provider: z.ZodEnum<{
200
+ "anthropic-claude-api": "anthropic-claude-api";
194
201
  claude: "claude";
195
202
  codex: "codex";
196
203
  copilot: "copilot";
@@ -214,6 +221,7 @@ export declare const UsageSummaryResultSchema: z.ZodObject<{
214
221
  }, z.core.$strip>>;
215
222
  models: z.ZodArray<z.ZodObject<{
216
223
  provider: z.ZodEnum<{
224
+ "anthropic-claude-api": "anthropic-claude-api";
217
225
  claude: "claude";
218
226
  codex: "codex";
219
227
  copilot: "copilot";
@@ -245,6 +253,7 @@ export declare const UsageSummaryResultSchema: z.ZodObject<{
245
253
  name: z.ZodString;
246
254
  projectId: z.ZodNullable<z.ZodString>;
247
255
  byProvider: z.ZodRecord<z.ZodEnum<{
256
+ "anthropic-claude-api": "anthropic-claude-api";
248
257
  claude: "claude";
249
258
  codex: "codex";
250
259
  copilot: "copilot";
@@ -291,6 +300,7 @@ export declare const UsageSummaryResultSchema: z.ZodObject<{
291
300
  }, z.core.$strip>>;
292
301
  roots: z.ZodArray<z.ZodObject<{
293
302
  provider: z.ZodEnum<{
303
+ "anthropic-claude-api": "anthropic-claude-api";
294
304
  claude: "claude";
295
305
  codex: "codex";
296
306
  copilot: "copilot";
@@ -308,6 +318,7 @@ export declare const UsageSummaryResultSchema: z.ZodObject<{
308
318
  accounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
309
319
  id: z.ZodString;
310
320
  kind: z.ZodEnum<{
321
+ "anthropic-claude-api": "anthropic-claude-api";
311
322
  claude: "claude";
312
323
  codex: "codex";
313
324
  copilot: "copilot";
@@ -345,6 +356,7 @@ export interface EvenPace {
345
356
  export declare function evenPace(window: UsageWindow, now: number): EvenPace | null;
346
357
  export declare const UsageLimitsProviderSchema: z.ZodObject<{
347
358
  kind: z.ZodEnum<{
359
+ "anthropic-claude-api": "anthropic-claude-api";
348
360
  claude: "claude";
349
361
  codex: "codex";
350
362
  copilot: "copilot";
@@ -391,6 +403,7 @@ export type UsageLimitsProvider = z.infer<typeof UsageLimitsProviderSchema>;
391
403
  export declare const UsageLimitsSnapshotSchema: z.ZodObject<{
392
404
  providers: z.ZodArray<z.ZodObject<{
393
405
  kind: z.ZodEnum<{
406
+ "anthropic-claude-api": "anthropic-claude-api";
394
407
  claude: "claude";
395
408
  codex: "codex";
396
409
  copilot: "copilot";
package/dist/usage.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { ProviderAccountIdSchema } from './provider-accounts.js';
3
3
  /* The providers whose usage the daemon reads: the CLIs' own records, and the log a host keeps of what it calls itself. A subset of `AgentKindSchema`: it grows with the readers. */
4
- export const UsageProviderSchema = z.enum(['claude', 'codex', 'nanogpt', 'grok', 'copilot']);
4
+ export const UsageProviderSchema = z.enum(['claude', 'codex', 'nanogpt', 'grok', 'copilot', 'anthropic-claude-api']);
5
5
  export const USAGE_PROVIDERS = UsageProviderSchema.options;
6
6
  export const UsageResolutionSchema = z.enum(['hour', 'day']);
7
7
  /* Token kinds are disjoint, so a total is their sum. Reasoning is a part of output and never counted twice. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agent-contracts",
3
- "version": "0.37.0",
3
+ "version": "0.37.2",
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.37.0",
89
+ "@adecore/intelligent-ui": "0.37.2",
90
90
  "zod": "^4.6.5"
91
91
  },
92
92
  "devDependencies": {
package/src/index.ts CHANGED
@@ -302,6 +302,12 @@ export {
302
302
  type ProviderInstall,
303
303
  ProviderInfoSchema,
304
304
  type ProviderInfo,
305
+ FRONTIER_PROVIDER_KINDS,
306
+ API_PROVIDER_KINDS,
307
+ type ProviderPickerGroup,
308
+ type ProviderPickerGroups,
309
+ providerGroupOf,
310
+ pickerGroupsOf,
305
311
  ProviderListResultSchema,
306
312
  type ProviderListResult,
307
313
  resumeCommandFor
package/src/model.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { AgentKindSchema } from './agent.ts';
2
+ import { AgentKindSchema, type AgentKind } from './agent.ts';
3
3
 
4
4
  // Options a model exposes (effort, context window, thinking). Generic descriptors instead of
5
5
  // per-provider enums: a new model is a catalog entry, not a code change.
@@ -178,6 +178,36 @@ export const ProviderInfoSchema = z.object({
178
178
  });
179
179
  export type ProviderInfo = z.infer<typeof ProviderInfoSchema>;
180
180
 
181
+ // The CLIs of the labs that train their own frontier models; a picker lists them before every other provider.
182
+ export const FRONTIER_PROVIDER_KINDS: ReadonlySet<AgentKind> = new Set(['claude', 'codex']);
183
+
184
+ // Providers billed per key rather than a CLI's own sign-in; a picker lists them last. Named, since an agent of
185
+ // the ACP registry has no terminal either.
186
+ export const API_PROVIDER_KINDS: ReadonlySet<AgentKind> = new Set(['anthropic-claude-api', 'nanogpt']);
187
+
188
+ export type ProviderPickerGroup = 'frontier' | 'others' | 'api';
189
+
190
+ export interface ProviderPickerGroups<T> {
191
+ frontier: T[];
192
+ others: T[];
193
+ api: T[];
194
+ }
195
+
196
+ export function providerGroupOf(kind: AgentKind): ProviderPickerGroup {
197
+ return FRONTIER_PROVIDER_KINDS.has(kind) ? 'frontier' : API_PROVIDER_KINDS.has(kind) ? 'api' : 'others';
198
+ }
199
+
200
+ let nameCollator: Intl.Collator | null = null;
201
+
202
+ /* The providers in the three groups of a picker, each by name. Names are proper names, so the runtime locale sorts them. */
203
+ export function pickerGroupsOf<T extends { kind: AgentKind; name: string }>(providers: readonly T[]): ProviderPickerGroups<T> {
204
+ nameCollator ??= new Intl.Collator(undefined, { sensitivity: 'base' });
205
+ const collator = nameCollator;
206
+ const sorted = [...providers].sort((a, b) => collator.compare(a.name, b.name));
207
+ const inGroup = (group: ProviderPickerGroup): T[] => sorted.filter((provider) => providerGroupOf(provider.kind) === group);
208
+ return { frontier: inGroup('frontier'), others: inGroup('others'), api: inGroup('api') };
209
+ }
210
+
181
211
  export const ProviderListResultSchema = z.object({
182
212
  providers: z.array(ProviderInfoSchema)
183
213
  });
package/src/usage.ts CHANGED
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { ProviderAccountIdSchema } from './provider-accounts.ts';
3
3
 
4
4
  /* The providers whose usage the daemon reads: the CLIs' own records, and the log a host keeps of what it calls itself. A subset of `AgentKindSchema`: it grows with the readers. */
5
- export const UsageProviderSchema = z.enum(['claude', 'codex', 'nanogpt', 'grok', 'copilot']);
5
+ export const UsageProviderSchema = z.enum(['claude', 'codex', 'nanogpt', 'grok', 'copilot', 'anthropic-claude-api']);
6
6
  export type UsageProvider = z.infer<typeof UsageProviderSchema>;
7
7
  export const USAGE_PROVIDERS = UsageProviderSchema.options;
8
8