@postonus/cli 0.1.28 → 0.1.30

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.js CHANGED
@@ -7010,6 +7010,87 @@ var adminContract = {
7010
7010
  }).errors(authedErrors).input(object({ audience: AdminAudienceSchema })).output(DeveloperUsageSchema)
7011
7011
  };
7012
7012
 
7013
+ // ../../packages/api-contract/src/analytics.ts
7014
+ var AnalyticsPeriodSchema = _enum(["7d", "30d", "90d"]).default("7d");
7015
+ var AnalyticsTotalsSchema = object({
7016
+ impressions: number2().int(),
7017
+ engagements: number2().int(),
7018
+ clicks: number2().int(),
7019
+ shares: number2().int(),
7020
+ comments: number2().int(),
7021
+ engagementRate: number2(),
7022
+ publishedCount: number2().int()
7023
+ });
7024
+ var AnalyticsTimeSeriesPointSchema = object({
7025
+ date: string2(),
7026
+ impressions: number2().int(),
7027
+ engagements: number2().int(),
7028
+ clicks: number2().int(),
7029
+ shares: number2().int()
7030
+ });
7031
+ var AnalyticsTopPostSchema = object({
7032
+ postId: Uuid,
7033
+ scheduleId: Uuid,
7034
+ platform: PlatformSchema,
7035
+ scheduledAt: Timestamp,
7036
+ content: string2(),
7037
+ impressions: number2().int(),
7038
+ engagements: number2().int(),
7039
+ clicks: number2().int(),
7040
+ shares: number2().int(),
7041
+ comments: number2().int(),
7042
+ engagementRate: number2()
7043
+ });
7044
+ var AnalyticsTakeawaysSchema = object({
7045
+ headline: string2(),
7046
+ whatWorked: array(string2()),
7047
+ whatToImprove: array(string2()),
7048
+ recommendedActions: array(string2()),
7049
+ generatedAt: Timestamp
7050
+ });
7051
+ var AnalyticsSummarySchema = object({
7052
+ period: AnalyticsPeriodSchema,
7053
+ totals: AnalyticsTotalsSchema,
7054
+ timeSeries: array(AnalyticsTimeSeriesPointSchema),
7055
+ topPosts: array(AnalyticsTopPostSchema),
7056
+ takeaways: AnalyticsTakeawaysSchema.nullable()
7057
+ });
7058
+ var AnalyticsExportFormatSchema = _enum(["csv", "json"]).default("csv");
7059
+ var AnalyticsExportSchema = object({
7060
+ format: AnalyticsExportFormatSchema,
7061
+ filename: string2(),
7062
+ data: string2()
7063
+ });
7064
+ var GetAnalyticsSummaryInputSchema = object({
7065
+ period: AnalyticsPeriodSchema.optional(),
7066
+ platform: PlatformSchema.optional()
7067
+ });
7068
+ var GenerateAnalyticsTakeawaysInputSchema = object({
7069
+ period: AnalyticsPeriodSchema.optional()
7070
+ });
7071
+ var ExportAnalyticsInputSchema = object({
7072
+ period: AnalyticsPeriodSchema.optional(),
7073
+ format: AnalyticsExportFormatSchema.optional()
7074
+ });
7075
+ var publicTagged = base.route({ tags: ["Analytics"] });
7076
+ var internal2 = publicTagged.meta({ internal: true });
7077
+ var analyticsTakeawayErrors = {
7078
+ ...writableErrors,
7079
+ AI_CREDITS_EXHAUSTED: {
7080
+ status: 402,
7081
+ message: "AI credits exhausted. Upgrade your plan or wait for your credits to renew."
7082
+ },
7083
+ NO_ANALYTICS_DATA: {
7084
+ status: 400,
7085
+ message: "No published posts or metrics found for this period to generate takeaways."
7086
+ }
7087
+ };
7088
+ var analyticsContract = {
7089
+ getSummary: publicTagged.route({ method: "GET", path: "/analytics/summary", summary: "Get workspace analytics summary" }).errors(orgErrors).input(GetAnalyticsSummaryInputSchema).output(AnalyticsSummarySchema),
7090
+ generateTakeaways: internal2.route({ method: "POST", path: "/analytics/takeaways", summary: "Generate AI analytics takeaways" }).errors(analyticsTakeawayErrors).input(GenerateAnalyticsTakeawaysInputSchema).output(AnalyticsTakeawaysSchema),
7091
+ exportData: publicTagged.route({ method: "GET", path: "/analytics/export", summary: "Export workspace analytics data" }).errors(orgErrors).input(ExportAnalyticsInputSchema).output(AnalyticsExportSchema)
7092
+ };
7093
+
7013
7094
  // ../../packages/api-contract/src/api-keys.ts
7014
7095
  var ApiKeySchema = object({
7015
7096
  id: string2(),
@@ -7308,11 +7389,11 @@ var UpdateChannelGroupInputSchema = object({
7308
7389
  name: ChannelGroupNameSchema.optional(),
7309
7390
  integrationIds: ChannelGroupIntegrationIdsSchema.optional()
7310
7391
  });
7311
- var publicTagged = base.route({ tags: ["Channel Groups"] });
7312
- var tagged5 = publicTagged.meta({ internal: true });
7392
+ var publicTagged2 = base.route({ tags: ["Channel Groups"] });
7393
+ var tagged5 = publicTagged2.meta({ internal: true });
7313
7394
  var channelGroupsContract = {
7314
7395
  // Public read: the composer in the browser extension shows group chips.
7315
- get: publicTagged.route({ method: "GET", path: "/channel-groups", summary: "List channel groups" }).errors(orgErrors).output(array(ChannelGroupSchema)),
7396
+ get: publicTagged2.route({ method: "GET", path: "/channel-groups", summary: "List channel groups" }).errors(orgErrors).output(array(ChannelGroupSchema)),
7316
7397
  create: tagged5.route({ method: "POST", path: "/channel-groups", summary: "Create a channel group", successStatus: 201 }).errors({ ...orgErrors, CONFLICT: { message: "A Channel Group with this name already exists." } }).input(CreateChannelGroupInputSchema).output(ChannelGroupSchema),
7317
7398
  update: tagged5.route({ method: "PATCH", path: "/channel-groups/{id}", summary: "Rename or re-member a channel group" }).errors({ ...orgErrors, CONFLICT: { message: "A Channel Group with this name already exists." } }).input(UpdateChannelGroupInputSchema).output(ChannelGroupSchema),
7318
7399
  delete: tagged5.route({ method: "DELETE", path: "/channel-groups/{id}", summary: "Delete a channel group" }).errors(orgErrors).input(IdPathParam).output(object({ success: literal(true) }))
@@ -7525,29 +7606,29 @@ var DisconnectImpactSchema = object({
7525
7606
  isLastBinding: boolean2()
7526
7607
  });
7527
7608
  var tagged8 = base.route({ tags: ["Integrations"] });
7528
- var internal2 = tagged8.meta({ internal: true });
7609
+ var internal3 = tagged8.meta({ internal: true });
7529
7610
  var integrationsContract = {
7530
7611
  get: tagged8.route({ method: "GET", path: "/integrations", summary: "List active integrations with health" }).errors(orgErrors).output(array(IntegrationSchema)),
7531
- getCapacity: internal2.route({ method: "GET", path: "/integrations/capacity", summary: "Social-account plan capacity" }).errors(orgErrors).output(IntegrationCapacitySchema),
7532
- listUnhealthy: internal2.route({ method: "GET", path: "/integrations/unhealthy", summary: "Integrations needing reconnect" }).errors(orgErrors).output(array(UnhealthyIntegrationSchema)),
7533
- listAtRiskSchedules: internal2.route({
7612
+ getCapacity: internal3.route({ method: "GET", path: "/integrations/capacity", summary: "Social-account plan capacity" }).errors(orgErrors).output(IntegrationCapacitySchema),
7613
+ listUnhealthy: internal3.route({ method: "GET", path: "/integrations/unhealthy", summary: "Integrations needing reconnect" }).errors(orgErrors).output(array(UnhealthyIntegrationSchema)),
7614
+ listAtRiskSchedules: internal3.route({
7534
7615
  method: "GET",
7535
7616
  path: "/integrations/at-risk-schedules",
7536
7617
  summary: "Scheduled posts whose channel cannot currently publish"
7537
7618
  }).errors(orgErrors).output(array(AtRiskScheduleSchema)),
7538
- listPendingSelection: internal2.route({ method: "GET", path: "/integrations/pending-selection", summary: "Channels stuck at the account picker" }).errors(orgErrors).output(array(PendingSelectionIntegrationSchema)),
7619
+ listPendingSelection: internal3.route({ method: "GET", path: "/integrations/pending-selection", summary: "Channels stuck at the account picker" }).errors(orgErrors).output(array(PendingSelectionIntegrationSchema)),
7539
7620
  connectIntegration: tagged8.route({ method: "POST", path: "/integrations/connect", summary: "Start an OAuth connect" }).errors(writableErrors).input(ConnectIntegrationInputSchema).output(object({ redirectUrl: string2() })),
7540
- connectCredentialIntegration: internal2.route({
7621
+ connectCredentialIntegration: internal3.route({
7541
7622
  method: "POST",
7542
7623
  path: "/integrations/connect-with-credentials",
7543
7624
  summary: "Connect a platform with an app password or bot token"
7544
7625
  }).errors(writableErrors).input(ConnectCredentialIntegrationInputSchema).output(ConnectCredentialResultSchema),
7545
- listConnectAccounts: internal2.route({ method: "GET", path: "/integrations/{id}/accounts", summary: "Accounts a pending connect may select" }).errors(orgErrors).input(IdPathParam).output(array(SelectableAccountSchema)),
7546
- finalizeConnect: internal2.route({ method: "POST", path: "/integrations/{id}/select", summary: "Finalize a picked account" }).errors(writableErrors).input(FinalizeConnectInputSchema).output(FinalizeConnectResultSchema),
7547
- disconnectIntegration: internal2.route({ method: "DELETE", path: "/integrations/{id}", summary: "Disconnect an integration" }).errors(orgErrors).input(IdPathParam).output(DisconnectResultSchema),
7548
- disconnectImpact: internal2.route({ method: "GET", path: "/integrations/{id}/disconnect-impact", summary: "What a disconnect would cost" }).errors(orgErrors).input(IdPathParam).output(DisconnectImpactSchema),
7549
- cancelPendingSelection: internal2.route({ method: "POST", path: "/integrations/{id}/cancel-selection", summary: "Abandon a half-finished connect" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema),
7550
- refreshIntegration: internal2.route({ method: "POST", path: "/integrations/{id}/refresh", summary: "Manually refresh a credential" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema)
7626
+ listConnectAccounts: internal3.route({ method: "GET", path: "/integrations/{id}/accounts", summary: "Accounts a pending connect may select" }).errors(orgErrors).input(IdPathParam).output(array(SelectableAccountSchema)),
7627
+ finalizeConnect: internal3.route({ method: "POST", path: "/integrations/{id}/select", summary: "Finalize a picked account" }).errors(writableErrors).input(FinalizeConnectInputSchema).output(FinalizeConnectResultSchema),
7628
+ disconnectIntegration: internal3.route({ method: "DELETE", path: "/integrations/{id}", summary: "Disconnect an integration" }).errors(orgErrors).input(IdPathParam).output(DisconnectResultSchema),
7629
+ disconnectImpact: internal3.route({ method: "GET", path: "/integrations/{id}/disconnect-impact", summary: "What a disconnect would cost" }).errors(orgErrors).input(IdPathParam).output(DisconnectImpactSchema),
7630
+ cancelPendingSelection: internal3.route({ method: "POST", path: "/integrations/{id}/cancel-selection", summary: "Abandon a half-finished connect" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema),
7631
+ refreshIntegration: internal3.route({ method: "POST", path: "/integrations/{id}/refresh", summary: "Manually refresh a credential" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema)
7551
7632
  };
7552
7633
 
7553
7634
  // ../../packages/api-contract/src/upload.ts
@@ -7727,23 +7808,23 @@ var DeleteMediaOutputSchema = object({
7727
7808
  blocked: array(object({ mediaId: Uuid, usedInPostsCount: number2().int() }))
7728
7809
  });
7729
7810
  var tagged10 = base.route({ tags: ["Media library"] });
7730
- var internal3 = tagged10.meta({ internal: true });
7811
+ var internal4 = tagged10.meta({ internal: true });
7731
7812
  var folderErrors = {
7732
7813
  ...writableErrors,
7733
7814
  FOLDER_CYCLE: { status: 422, message: "A folder cannot be moved inside itself." }
7734
7815
  };
7735
7816
  var mediaContract = {
7736
- list: internal3.route({ method: "GET", path: "/media", summary: "List library media" }).errors(orgErrors).input(ListMediaInputSchema).output(ListMediaOutputSchema),
7817
+ list: internal4.route({ method: "GET", path: "/media", summary: "List library media" }).errors(orgErrors).input(ListMediaInputSchema).output(ListMediaOutputSchema),
7737
7818
  // Declared before `getById` for readability only — oRPC matches a literal
7738
7819
  // segment ahead of a path parameter regardless of declaration order.
7739
- listFolders: internal3.route({ method: "GET", path: "/media/folders", summary: "List media folders with counts" }).errors(orgErrors).output(ListMediaFoldersOutputSchema),
7740
- createFolder: internal3.route({ method: "POST", path: "/media/folders", summary: "Create a media folder", successStatus: 201 }).errors({ ...writableErrors, CONFLICT: { message: "A folder with that name already exists here." } }).input(CreateMediaFolderInputSchema).output(MediaFolderSchema),
7741
- updateFolder: internal3.route({ method: "PATCH", path: "/media/folders/{id}", summary: "Rename or move a media folder" }).errors({ ...folderErrors, CONFLICT: { message: "A folder with that name already exists here." } }).input(UpdateMediaFolderInputSchema).output(MediaFolderSchema),
7742
- deleteFolder: internal3.route({ method: "DELETE", path: "/media/folders/{id}", summary: "Delete a media folder" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema),
7743
- getById: internal3.route({ method: "GET", path: "/media/{id}", summary: "Get a library asset" }).errors(orgErrors).input(IdPathParam).output(LibraryMediaSchema),
7744
- update: internal3.route({ method: "PATCH", path: "/media/{id}", summary: "Rename or refile a library asset" }).errors(writableErrors).input(UpdateMediaInputSchema).output(LibraryMediaSchema),
7745
- move: internal3.route({ method: "POST", path: "/media/move", summary: "File assets into a folder" }).errors(writableErrors).input(MoveMediaInputSchema).output(object({ movedIds: array(Uuid) })),
7746
- delete: internal3.route({ method: "POST", path: "/media/delete", summary: "Delete library assets" }).errors(writableErrors).input(DeleteMediaInputSchema).output(DeleteMediaOutputSchema)
7820
+ listFolders: internal4.route({ method: "GET", path: "/media/folders", summary: "List media folders with counts" }).errors(orgErrors).output(ListMediaFoldersOutputSchema),
7821
+ createFolder: internal4.route({ method: "POST", path: "/media/folders", summary: "Create a media folder", successStatus: 201 }).errors({ ...writableErrors, CONFLICT: { message: "A folder with that name already exists here." } }).input(CreateMediaFolderInputSchema).output(MediaFolderSchema),
7822
+ updateFolder: internal4.route({ method: "PATCH", path: "/media/folders/{id}", summary: "Rename or move a media folder" }).errors({ ...folderErrors, CONFLICT: { message: "A folder with that name already exists here." } }).input(UpdateMediaFolderInputSchema).output(MediaFolderSchema),
7823
+ deleteFolder: internal4.route({ method: "DELETE", path: "/media/folders/{id}", summary: "Delete a media folder" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema),
7824
+ getById: internal4.route({ method: "GET", path: "/media/{id}", summary: "Get a library asset" }).errors(orgErrors).input(IdPathParam).output(LibraryMediaSchema),
7825
+ update: internal4.route({ method: "PATCH", path: "/media/{id}", summary: "Rename or refile a library asset" }).errors(writableErrors).input(UpdateMediaInputSchema).output(LibraryMediaSchema),
7826
+ move: internal4.route({ method: "POST", path: "/media/move", summary: "File assets into a folder" }).errors(writableErrors).input(MoveMediaInputSchema).output(object({ movedIds: array(Uuid) })),
7827
+ delete: internal4.route({ method: "POST", path: "/media/delete", summary: "Delete library assets" }).errors(writableErrors).input(DeleteMediaInputSchema).output(DeleteMediaOutputSchema)
7747
7828
  };
7748
7829
 
7749
7830
  // ../../packages/api-contract/src/media-sources.ts
@@ -8242,14 +8323,14 @@ var idempotent = tagged13.route({
8242
8323
  ]
8243
8324
  })
8244
8325
  });
8245
- var internal4 = tagged13.meta({ internal: true });
8326
+ var internal5 = tagged13.meta({ internal: true });
8246
8327
  var postsContract = {
8247
8328
  list: tagged13.route({ method: "GET", path: "/posts", summary: "List posts" }).errors(orgErrors).input(ListPostsInputSchema).output(PostsListOutputSchema),
8248
8329
  // Declared before `getById` so `/posts/counts` is not read as `/posts/{id}`.
8249
8330
  // Dashboard plumbing: the status segment row on `/posts`.
8250
- counts: internal4.route({ method: "GET", path: "/posts/counts", summary: "Count posts per status" }).errors(orgErrors).input(CountPostsInputSchema).output(CountPostsOutputSchema),
8331
+ counts: internal5.route({ method: "GET", path: "/posts/counts", summary: "Count posts per status" }).errors(orgErrors).input(CountPostsInputSchema).output(CountPostsOutputSchema),
8251
8332
  getById: tagged13.route({ method: "GET", path: "/posts/{id}", summary: "Get a post" }).errors(orgErrors).input(IdPathParam).output(PostWithRelationsSchema),
8252
- mediaById: internal4.route({ method: "GET", path: "/posts/media/{id}", summary: "Get post media metadata" }).errors(orgErrors).input(IdPathParam).output(MediaMetadataSchema),
8333
+ mediaById: internal5.route({ method: "GET", path: "/posts/media/{id}", summary: "Get post media metadata" }).errors(orgErrors).input(IdPathParam).output(MediaMetadataSchema),
8253
8334
  create: idempotent.route({ method: "POST", path: "/posts", summary: "Create posts in bulk", successStatus: 201 }).errors({ ...writableErrors, ...postDomainErrors }).input(CreatePostsInputSchema).output(CreatePostsOutputSchema),
8254
8335
  update: idempotent.route({ method: "PATCH", path: "/posts/{id}", summary: "Update a post" }).errors({ ...writableErrors, ...postDomainErrors }).input(UpdatePostInputSchema).output(PostStateSchema),
8255
8336
  scheduleDraft: idempotent.route({ method: "POST", path: "/posts/{id}/schedule", summary: "Schedule a draft" }).errors({ ...writableErrors, ...postDomainErrors }).input(ScheduleDraftInputSchema).output(PostStateSchema),
@@ -8260,17 +8341,17 @@ var postsContract = {
8260
8341
  path: "/posts/schedules/{scheduleId}/reschedule",
8261
8342
  summary: "Move a schedule to a new time"
8262
8343
  }).errors({ ...writableErrors, ...postDomainErrors }).input(RescheduleInputSchema).output(PostStateSchema),
8263
- bulkScheduleInWindows: internal4.route({
8344
+ bulkScheduleInWindows: internal5.route({
8264
8345
  method: "POST",
8265
8346
  path: "/posts/schedules/bulk-schedule-windows",
8266
8347
  summary: "Spread schedules across optimal windows"
8267
8348
  }).errors({ ...writableErrors, ...postDomainErrors }).input(BulkScheduleInWindowsInputSchema).output(BulkScheduleInWindowsOutputSchema),
8268
- addChannels: internal4.route({
8349
+ addChannels: internal5.route({
8269
8350
  method: "POST",
8270
8351
  path: "/posts/{id}/channels",
8271
8352
  summary: "Schedule an existing post to more channels"
8272
8353
  }).errors({ ...publishErrors, ...postDomainErrors }).input(AddChannelsInputSchema).output(AddChannelsOutputSchema),
8273
- applyReviewComments: internal4.route({
8354
+ applyReviewComments: internal5.route({
8274
8355
  method: "POST",
8275
8356
  path: "/posts/{id}/apply-review-comments",
8276
8357
  summary: "Rewrite post or variant from unresolved review and client comments"
@@ -9135,13 +9216,13 @@ var CreateSnippetInputSchema = object({
9135
9216
  content: SnippetContentSchema,
9136
9217
  tags: array(SnippetTagSchema).default([])
9137
9218
  });
9138
- var publicTagged2 = base.route({ tags: ["Snippets"] });
9139
- var internal5 = publicTagged2.meta({ internal: true });
9219
+ var publicTagged3 = base.route({ tags: ["Snippets"] });
9220
+ var internal6 = publicTagged3.meta({ internal: true });
9140
9221
  var snippetsContract = {
9141
- list: publicTagged2.route({ method: "GET", path: "/snippets", summary: "List saved snippets and hashtag groups" }).errors(orgErrors).output(array(SnippetSchema)),
9142
- getById: publicTagged2.route({ method: "GET", path: "/snippets/{id}", summary: "Get a snippet" }).errors(orgErrors).input(IdPathParam).output(SnippetSchema),
9143
- create: internal5.route({ method: "POST", path: "/snippets", summary: "Create a snippet", successStatus: 201 }).errors(writableErrors).input(CreateSnippetInputSchema).output(SnippetSchema),
9144
- delete: internal5.route({ method: "DELETE", path: "/snippets/{id}", summary: "Delete a snippet" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema)
9222
+ list: publicTagged3.route({ method: "GET", path: "/snippets", summary: "List saved snippets and hashtag groups" }).errors(orgErrors).output(array(SnippetSchema)),
9223
+ getById: publicTagged3.route({ method: "GET", path: "/snippets/{id}", summary: "Get a snippet" }).errors(orgErrors).input(IdPathParam).output(SnippetSchema),
9224
+ create: internal6.route({ method: "POST", path: "/snippets", summary: "Create a snippet", successStatus: 201 }).errors(writableErrors).input(CreateSnippetInputSchema).output(SnippetSchema),
9225
+ delete: internal6.route({ method: "DELETE", path: "/snippets/{id}", summary: "Delete a snippet" }).errors(writableErrors).input(IdPathParam).output(DeletedSchema)
9145
9226
  };
9146
9227
 
9147
9228
  // ../../packages/api-contract/src/support.ts
@@ -9191,19 +9272,19 @@ var UpdateTicketStatusInputSchema = object({
9191
9272
  status: _enum(["waiting_on_user", "resolved"])
9192
9273
  });
9193
9274
  var ticketErrors = { ...authedErrors, NOT_FOUND: { message: "Ticket not found." } };
9194
- var internal6 = base.route({ tags: ["Support"] }).meta({ internal: true });
9275
+ var internal7 = base.route({ tags: ["Support"] }).meta({ internal: true });
9195
9276
  var supportContract = {
9196
- createTicket: internal6.route({ method: "POST", path: "/internal/support/tickets", summary: "Open a support ticket", successStatus: 201 }).errors(authedErrors).input(CreateTicketInputSchema).output(SupportTicketSchema),
9197
- getMyTickets: internal6.route({ method: "GET", path: "/internal/support/tickets", summary: "List the caller\u2019s support tickets" }).errors(authedErrors).output(array(TicketWithUserSchema)),
9198
- getTicket: internal6.route({ method: "GET", path: "/internal/support/tickets/{ticketId}", summary: "Get a ticket and its messages" }).errors(ticketErrors).input(GetTicketInputSchema).output(TicketWithMessagesSchema),
9199
- createMessage: internal6.route({
9277
+ createTicket: internal7.route({ method: "POST", path: "/internal/support/tickets", summary: "Open a support ticket", successStatus: 201 }).errors(authedErrors).input(CreateTicketInputSchema).output(SupportTicketSchema),
9278
+ getMyTickets: internal7.route({ method: "GET", path: "/internal/support/tickets", summary: "List the caller\u2019s support tickets" }).errors(authedErrors).output(array(TicketWithUserSchema)),
9279
+ getTicket: internal7.route({ method: "GET", path: "/internal/support/tickets/{ticketId}", summary: "Get a ticket and its messages" }).errors(ticketErrors).input(GetTicketInputSchema).output(TicketWithMessagesSchema),
9280
+ createMessage: internal7.route({
9200
9281
  method: "POST",
9201
9282
  path: "/internal/support/tickets/{ticketId}/messages",
9202
9283
  summary: "Reply on a support ticket",
9203
9284
  successStatus: 201
9204
9285
  }).errors(ticketErrors).input(CreateMessageInputSchema).output(SupportMessageSchema),
9205
- getAdminTickets: internal6.route({ method: "GET", path: "/internal/support/admin/tickets", summary: "List tickets for staff triage" }).errors(authedErrors).input(GetAdminTicketsInputSchema).output(array(TicketWithUserSchema)),
9206
- updateTicketStatus: internal6.route({
9286
+ getAdminTickets: internal7.route({ method: "GET", path: "/internal/support/admin/tickets", summary: "List tickets for staff triage" }).errors(authedErrors).input(GetAdminTicketsInputSchema).output(array(TicketWithUserSchema)),
9287
+ updateTicketStatus: internal7.route({
9207
9288
  method: "PATCH",
9208
9289
  path: "/internal/support/admin/tickets/{ticketId}/status",
9209
9290
  summary: "Update a ticket\u2019s status"
@@ -9225,7 +9306,7 @@ var CreateTagInputSchema = object({ name: TagNameSchema });
9225
9306
  var UpdateTagInputSchema = object({ id: Uuid, name: TagNameSchema });
9226
9307
  var TagUsageCountSchema = object({ tagId: Uuid, count: AggregateCount });
9227
9308
  var tagged17 = base.route({ tags: ["Tags"] });
9228
- var internal7 = tagged17.meta({ internal: true });
9309
+ var internal8 = tagged17.meta({ internal: true });
9229
9310
  var tagsContract = {
9230
9311
  list: tagged17.route({ method: "GET", path: "/tags", summary: "List tags" }).errors(orgErrors).output(array(TagSchema)),
9231
9312
  /**
@@ -9233,11 +9314,11 @@ var tagsContract = {
9233
9314
  * segment ahead of a path parameter regardless of declaration order, so
9234
9315
  * `/tags/usage-counts` never resolves as `/tags/{id}`.
9235
9316
  */
9236
- getUsageCounts: internal7.route({ method: "GET", path: "/tags/usage-counts", summary: "Count posts per tag" }).errors(orgErrors).output(array(TagUsageCountSchema)),
9317
+ getUsageCounts: internal8.route({ method: "GET", path: "/tags/usage-counts", summary: "Count posts per tag" }).errors(orgErrors).output(array(TagUsageCountSchema)),
9237
9318
  getById: tagged17.route({ method: "GET", path: "/tags/{id}", summary: "Get a tag" }).errors(orgErrors).input(IdPathParam).output(TagSchema),
9238
- create: internal7.route({ method: "POST", path: "/tags", summary: "Create a tag", successStatus: 201 }).errors({ ...writableErrors, CONFLICT: { message: "A tag with that name already exists." } }).input(CreateTagInputSchema).output(TagSchema),
9239
- update: internal7.route({ method: "PATCH", path: "/tags/{id}", summary: "Rename a tag" }).errors(writableErrors).input(UpdateTagInputSchema).output(TagSchema),
9240
- delete: internal7.route({ method: "DELETE", path: "/tags/{id}", summary: "Delete a tag" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema)
9319
+ create: internal8.route({ method: "POST", path: "/tags", summary: "Create a tag", successStatus: 201 }).errors({ ...writableErrors, CONFLICT: { message: "A tag with that name already exists." } }).input(CreateTagInputSchema).output(TagSchema),
9320
+ update: internal8.route({ method: "PATCH", path: "/tags/{id}", summary: "Rename a tag" }).errors(writableErrors).input(UpdateTagInputSchema).output(TagSchema),
9321
+ delete: internal8.route({ method: "DELETE", path: "/tags/{id}", summary: "Delete a tag" }).errors(orgErrors).input(IdPathParam).output(DeletedSchema)
9241
9322
  };
9242
9323
 
9243
9324
  // ../../packages/api-contract/src/usage.ts
@@ -9273,11 +9354,11 @@ var UsageEventSchema = object({
9273
9354
  createdAt: Timestamp
9274
9355
  });
9275
9356
  var tagged18 = base.route({ tags: ["Usage"] });
9276
- var internal8 = tagged18.meta({ internal: true });
9357
+ var internal9 = tagged18.meta({ internal: true });
9277
9358
  var usageContract = {
9278
9359
  summary: tagged18.route({ method: "GET", path: "/usage", summary: "Get API and MCP call totals for the workspace" }).errors(orgErrors).input(object({ days: WindowDays })).output(UsageSummarySchema),
9279
- daily: internal8.route({ method: "GET", path: "/usage/daily", summary: "Get daily call counts for one surface" }).errors(orgErrors).input(object({ surface: UsageSurfaceSchema, days: WindowDays })).output(object({ items: array(UsageDailyPointSchema) })),
9280
- events: internal8.route({ method: "GET", path: "/usage/events", summary: "List recent API and MCP calls" }).errors(orgErrors).input(
9360
+ daily: internal9.route({ method: "GET", path: "/usage/daily", summary: "Get daily call counts for one surface" }).errors(orgErrors).input(object({ surface: UsageSurfaceSchema, days: WindowDays })).output(object({ items: array(UsageDailyPointSchema) })),
9361
+ events: internal9.route({ method: "GET", path: "/usage/events", summary: "List recent API and MCP calls" }).errors(orgErrors).input(
9281
9362
  object({
9282
9363
  surface: UsageSurfaceSchema.optional(),
9283
9364
  limit: coerce_exports.number().int().min(1).max(100).default(25),
@@ -9427,16 +9508,16 @@ var AiQuotaSchema = object({
9427
9508
  unlimited: boolean2()
9428
9509
  });
9429
9510
  var tagged19 = base.route({ tags: ["User"] });
9430
- var internal9 = tagged19.meta({ internal: true });
9511
+ var internal10 = tagged19.meta({ internal: true });
9431
9512
  var userContract = {
9432
9513
  me: tagged19.route({ method: "GET", path: "/users/me", summary: "Get the current user" }).errors({ ...authedErrors, NOT_FOUND: { message: "User not found." } }).output(MeSchema),
9433
- update: internal9.route({ method: "PATCH", path: "/users/me", summary: "Update the current user" }).errors({ ...authedErrors, NOT_FOUND: { message: "User not found." } }).input(UpdateUserInputSchema).output(UserAccountSchema),
9514
+ update: internal10.route({ method: "PATCH", path: "/users/me", summary: "Update the current user" }).errors({ ...authedErrors, NOT_FOUND: { message: "User not found." } }).input(UpdateUserInputSchema).output(UserAccountSchema),
9434
9515
  getPreferences: tagged19.route({ method: "GET", path: "/users/me/preferences", summary: "Get the current user's preferences" }).errors(authedErrors).output(UserPreferencesSchema),
9435
- updatePreferences: internal9.route({ method: "PATCH", path: "/users/me/preferences", summary: "Update the current user's preferences" }).errors(authedErrors).input(UpdatePreferencesInputSchema).output(UserPreferencesSchema),
9436
- resetPreferences: internal9.route({ method: "DELETE", path: "/users/me/preferences", summary: "Reset the current user's preferences" }).errors(authedErrors).output(object({ message: string2() })),
9516
+ updatePreferences: internal10.route({ method: "PATCH", path: "/users/me/preferences", summary: "Update the current user's preferences" }).errors(authedErrors).input(UpdatePreferencesInputSchema).output(UserPreferencesSchema),
9517
+ resetPreferences: internal10.route({ method: "DELETE", path: "/users/me/preferences", summary: "Reset the current user's preferences" }).errors(authedErrors).output(object({ message: string2() })),
9437
9518
  getPlanQuota: tagged19.route({ method: "GET", path: "/users/me/plan-quota", summary: "Get the active workspace's plan quota" }).errors(orgErrors).input(object({ platforms: array(PlatformEnum).optional() })).output(PlanQuotaSchema),
9438
- getAiQuota: internal9.route({ method: "GET", path: "/users/me/ai-quota", summary: "Get the active workspace's AI credit quota" }).errors(orgErrors).output(AiQuotaSchema),
9439
- setDefaultWorkspace: internal9.route({ method: "POST", path: "/users/me/default-workspace", summary: "Set the current user's default workspace" }).errors({ ...authedErrors, FORBIDDEN: { message: "You are not a member of this workspace." } }).input(object({ organizationId: string2() })).output(DeletedSchema)
9519
+ getAiQuota: internal10.route({ method: "GET", path: "/users/me/ai-quota", summary: "Get the active workspace's AI credit quota" }).errors(orgErrors).output(AiQuotaSchema),
9520
+ setDefaultWorkspace: internal10.route({ method: "POST", path: "/users/me/default-workspace", summary: "Set the current user's default workspace" }).errors({ ...authedErrors, FORBIDDEN: { message: "You are not a member of this workspace." } }).input(object({ organizationId: string2() })).output(DeletedSchema)
9440
9521
  };
9441
9522
 
9442
9523
  // ../../packages/api-contract/src/workspace.ts
@@ -9496,15 +9577,15 @@ var WorkspaceSummarySchema = object({
9496
9577
  logo: string2().nullable(),
9497
9578
  role: string2()
9498
9579
  });
9499
- var publicTagged3 = base.route({ tags: ["Workspace"] });
9500
- var tagged20 = publicTagged3.meta({ internal: true });
9580
+ var publicTagged4 = base.route({ tags: ["Workspace"] });
9581
+ var tagged20 = publicTagged4.meta({ internal: true });
9501
9582
  var workspaceContract = {
9502
9583
  /**
9503
9584
  * Public, so an OAuth client can offer a workspace switcher: the chosen id goes
9504
9585
  * back as `x-workspace-id`. An API key is pinned to one workspace, so it lists
9505
9586
  * only that one.
9506
9587
  */
9507
- list: publicTagged3.route({ method: "GET", path: "/workspaces", summary: "List your workspaces" }).errors(authedErrors).output(array(WorkspaceSummarySchema)),
9588
+ list: publicTagged4.route({ method: "GET", path: "/workspaces", summary: "List your workspaces" }).errors(authedErrors).output(array(WorkspaceSummarySchema)),
9508
9589
  getOwnedCapacity: tagged20.route({ method: "GET", path: "/workspaces/owned-capacity", summary: "Get owned workspace capacity" }).errors(authedErrors).output(OwnedCapacitySchema),
9509
9590
  create: tagged20.route({ method: "POST", path: "/workspaces", summary: "Create a workspace", successStatus: 201 }).errors({
9510
9591
  ...authedErrors,
@@ -9549,6 +9630,7 @@ var workspaceContract = {
9549
9630
  var contract = {
9550
9631
  activity: activityContract,
9551
9632
  admin: adminContract,
9633
+ analytics: analyticsContract,
9552
9634
  apiKeys: apiKeysContract,
9553
9635
  assistants: assistantsContract,
9554
9636
  billing: billingContract,
@@ -12253,7 +12335,7 @@ function formatTable(headers, rows) {
12253
12335
  }
12254
12336
 
12255
12337
  // src/version.ts
12256
- var CLI_VERSION = "0.1.28";
12338
+ var CLI_VERSION = "0.1.30";
12257
12339
 
12258
12340
  // src/client.ts
12259
12341
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
@@ -12690,6 +12772,7 @@ async function whoami() {
12690
12772
  import { render as render3 } from "ink";
12691
12773
  import open3 from "open";
12692
12774
  import { jsx as jsx3 } from "react/jsx-runtime";
12775
+ var UNDERSCORE_GLOBAL_REGEX = /_/g;
12693
12776
  function healthy(channel) {
12694
12777
  return channel.connectStatus === "ACTIVE" && channel.tokenStatus === "VALID";
12695
12778
  }
@@ -12753,7 +12836,7 @@ async function pickPlatform(existing) {
12753
12836
  const credential = isCredentialPlatform(platform);
12754
12837
  return {
12755
12838
  value: platform,
12756
- label: platform.toLowerCase().replace(/_/g, " "),
12839
+ label: platform.toLowerCase().replace(UNDERSCORE_GLOBAL_REGEX, " "),
12757
12840
  hint: credential ? "(connect in the dashboard)" : connected > 0 ? `(${connected} connected)` : void 0,
12758
12841
  disabled: credential
12759
12842
  };
@@ -12838,13 +12921,15 @@ import { createInterface } from "readline";
12838
12921
  function isString2(val) {
12839
12922
  return typeof val === "string";
12840
12923
  }
12924
+ var DOUBLE_NEWLINE_REGEX = /\r?\n\r?\n/;
12925
+ var SINGLE_NEWLINE_REGEX = /\r?\n/;
12841
12926
  function decodeMessages(contentType, body) {
12842
12927
  if (!contentType?.includes("text/event-stream")) {
12843
12928
  const trimmed = body.trim();
12844
12929
  return trimmed.length > 0 ? [trimmed] : [];
12845
12930
  }
12846
- return body.split(/\r?\n\r?\n/).map(
12847
- (event) => event.split(/\r?\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice("data:".length).trimStart()).join("\n")
12931
+ return body.split(DOUBLE_NEWLINE_REGEX).map(
12932
+ (event) => event.split(SINGLE_NEWLINE_REGEX).filter((line) => line.startsWith("data:")).map((line) => line.slice("data:".length).trimStart()).join("\n")
12848
12933
  ).filter((data) => data.length > 0);
12849
12934
  }
12850
12935
  function tokenAudiences(accessToken) {
@@ -13092,8 +13177,9 @@ async function readContent(text, options) {
13092
13177
  function readFileOrFail(path) {
13093
13178
  return readFile2(path, "utf8").catch(() => fail(`Could not read ${path}`));
13094
13179
  }
13180
+ var THREAD_DIVIDER_REGEX = /^---[ \t]*$/m;
13095
13181
  async function readThread(path) {
13096
- const segments = (await readFileOrFail(path)).split(/^---[ \t]*$/m).map((segment) => segment.trim()).filter(Boolean);
13182
+ const segments = (await readFileOrFail(path)).split(THREAD_DIVIDER_REGEX).map((segment) => segment.trim()).filter(Boolean);
13097
13183
  if (segments.length < 2) failUsage(`${path} holds one segment. Separate thread segments with a line of \`---\`.`);
13098
13184
  return segments;
13099
13185
  }
@@ -13292,8 +13378,9 @@ function formatWhen(scheduledAt) {
13292
13378
  minute: "2-digit"
13293
13379
  });
13294
13380
  }
13381
+ var WHITESPACE_RUN_REGEX = /\s+/g;
13295
13382
  function truncate(text, length = 44) {
13296
- const collapsed = text.replace(/\s+/g, " ").trim();
13383
+ const collapsed = text.replace(WHITESPACE_RUN_REGEX, " ").trim();
13297
13384
  return collapsed.length <= length ? collapsed : `${collapsed.slice(0, length - 1)}\u2026`;
13298
13385
  }
13299
13386
  async function listQueue(options) {