@nemphi/sdk 0.5.5400 → 0.6.5419

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.
Files changed (162) hide show
  1. package/dist/generated/agents/client.d.ts +28 -29
  2. package/dist/generated/agents/client.d.ts.map +1 -1
  3. package/dist/generated/agents/client.js.map +1 -1
  4. package/dist/generated/analytics/client.d.ts +4 -4
  5. package/dist/generated/analytics/client.d.ts.map +1 -1
  6. package/dist/generated/analytics/client.js.map +1 -1
  7. package/dist/generated/analytics/index.d.ts +1 -1
  8. package/dist/generated/analytics/index.d.ts.map +1 -1
  9. package/dist/generated/analytics/models.d.ts +0 -3
  10. package/dist/generated/analytics/models.d.ts.map +1 -1
  11. package/dist/generated/analytics/models.js.map +1 -1
  12. package/dist/generated/apps/client.d.ts +4 -5
  13. package/dist/generated/apps/client.d.ts.map +1 -1
  14. package/dist/generated/apps/client.js.map +1 -1
  15. package/dist/generated/callcenter/client.d.ts +2 -24
  16. package/dist/generated/callcenter/client.d.ts.map +1 -1
  17. package/dist/generated/callcenter/client.js +0 -9
  18. package/dist/generated/callcenter/client.js.map +1 -1
  19. package/dist/generated/callcenter/index.d.ts +2 -2
  20. package/dist/generated/callcenter/index.d.ts.map +1 -1
  21. package/dist/generated/callcenter/models.d.ts +0 -3
  22. package/dist/generated/callcenter/models.d.ts.map +1 -1
  23. package/dist/generated/callcenter/models.js.map +1 -1
  24. package/dist/generated/categories/client.d.ts +2 -2
  25. package/dist/generated/categories/client.d.ts.map +1 -1
  26. package/dist/generated/categories/client.js.map +1 -1
  27. package/dist/generated/categories/index.d.ts +1 -1
  28. package/dist/generated/categories/index.d.ts.map +1 -1
  29. package/dist/generated/categories/models.d.ts +0 -1
  30. package/dist/generated/categories/models.d.ts.map +1 -1
  31. package/dist/generated/categories/models.js.map +1 -1
  32. package/dist/generated/client.d.ts +0 -4
  33. package/dist/generated/client.d.ts.map +1 -1
  34. package/dist/generated/client.js +0 -10
  35. package/dist/generated/client.js.map +1 -1
  36. package/dist/generated/crm/client.d.ts +2 -2
  37. package/dist/generated/crm/client.d.ts.map +1 -1
  38. package/dist/generated/crm/client.js.map +1 -1
  39. package/dist/generated/crm/index.d.ts +1 -1
  40. package/dist/generated/crm/index.d.ts.map +1 -1
  41. package/dist/generated/crm/models.d.ts +0 -1
  42. package/dist/generated/crm/models.d.ts.map +1 -1
  43. package/dist/generated/crm/models.js.map +1 -1
  44. package/dist/generated/dashboards/client.d.ts +3 -3
  45. package/dist/generated/dashboards/client.d.ts.map +1 -1
  46. package/dist/generated/dashboards/client.js +3 -3
  47. package/dist/generated/dashboards/client.js.map +1 -1
  48. package/dist/generated/dashboards/index.d.ts +1 -1
  49. package/dist/generated/dashboards/index.d.ts.map +1 -1
  50. package/dist/generated/dashboards/models.d.ts +444 -0
  51. package/dist/generated/dashboards/models.d.ts.map +1 -1
  52. package/dist/generated/dashboards/models.js +26 -0
  53. package/dist/generated/dashboards/models.js.map +1 -1
  54. package/dist/generated/einvoice/client.d.ts +2 -2
  55. package/dist/generated/einvoice/client.d.ts.map +1 -1
  56. package/dist/generated/einvoice/client.js.map +1 -1
  57. package/dist/generated/einvoice/index.d.ts +1 -1
  58. package/dist/generated/einvoice/index.d.ts.map +1 -1
  59. package/dist/generated/einvoice/models.d.ts +0 -1
  60. package/dist/generated/einvoice/models.d.ts.map +1 -1
  61. package/dist/generated/einvoice/models.js.map +1 -1
  62. package/dist/generated/email/models.d.ts +0 -2
  63. package/dist/generated/email/models.d.ts.map +1 -1
  64. package/dist/generated/email/models.js +0 -2
  65. package/dist/generated/email/models.js.map +1 -1
  66. package/dist/generated/imports/client.d.ts +5 -6
  67. package/dist/generated/imports/client.d.ts.map +1 -1
  68. package/dist/generated/imports/client.js.map +1 -1
  69. package/dist/generated/imports/index.d.ts +0 -1
  70. package/dist/generated/imports/index.d.ts.map +1 -1
  71. package/dist/generated/ledger/client.d.ts +7 -7
  72. package/dist/generated/ledger/client.d.ts.map +1 -1
  73. package/dist/generated/ledger/client.js.map +1 -1
  74. package/dist/generated/ledger/index.d.ts +1 -1
  75. package/dist/generated/ledger/index.d.ts.map +1 -1
  76. package/dist/generated/ledger/models.d.ts +0 -6
  77. package/dist/generated/ledger/models.d.ts.map +1 -1
  78. package/dist/generated/ledger/models.js.map +1 -1
  79. package/dist/generated/marketing/client.d.ts +1 -534
  80. package/dist/generated/marketing/client.d.ts.map +1 -1
  81. package/dist/generated/marketing/client.js +3 -176
  82. package/dist/generated/marketing/client.js.map +1 -1
  83. package/dist/generated/marketing/index.d.ts +2 -2
  84. package/dist/generated/marketing/index.d.ts.map +1 -1
  85. package/dist/generated/marketing/models.d.ts +0 -151
  86. package/dist/generated/marketing/models.d.ts.map +1 -1
  87. package/dist/generated/marketing/models.js +0 -88
  88. package/dist/generated/marketing/models.js.map +1 -1
  89. package/dist/generated/messages/client.d.ts +2 -6
  90. package/dist/generated/messages/client.d.ts.map +1 -1
  91. package/dist/generated/messages/client.js.map +1 -1
  92. package/dist/generated/messages/models.d.ts +0 -1
  93. package/dist/generated/messages/models.d.ts.map +1 -1
  94. package/dist/generated/messages/models.js +0 -1
  95. package/dist/generated/messages/models.js.map +1 -1
  96. package/dist/generated/onboarding/client.d.ts +2 -2
  97. package/dist/generated/onboarding/client.d.ts.map +1 -1
  98. package/dist/generated/onboarding/client.js.map +1 -1
  99. package/dist/generated/onboarding/index.d.ts +1 -1
  100. package/dist/generated/onboarding/index.d.ts.map +1 -1
  101. package/dist/generated/onboarding/models.d.ts +0 -1
  102. package/dist/generated/onboarding/models.d.ts.map +1 -1
  103. package/dist/generated/onboarding/models.js.map +1 -1
  104. package/dist/generated/payroll/client.d.ts +2 -2
  105. package/dist/generated/payroll/client.d.ts.map +1 -1
  106. package/dist/generated/payroll/client.js.map +1 -1
  107. package/dist/generated/payroll/index.d.ts +1 -1
  108. package/dist/generated/payroll/index.d.ts.map +1 -1
  109. package/dist/generated/payroll/models.d.ts +0 -1
  110. package/dist/generated/payroll/models.d.ts.map +1 -1
  111. package/dist/generated/payroll/models.js.map +1 -1
  112. package/dist/generated/tax/client.d.ts +3 -3
  113. package/dist/generated/tax/client.d.ts.map +1 -1
  114. package/dist/generated/tax/client.js.map +1 -1
  115. package/dist/generated/tax/index.d.ts +1 -1
  116. package/dist/generated/tax/index.d.ts.map +1 -1
  117. package/dist/generated/tax/models.d.ts +0 -2
  118. package/dist/generated/tax/models.d.ts.map +1 -1
  119. package/dist/generated/tax/models.js.map +1 -1
  120. package/dist/generated/tenants/client.d.ts +37 -70
  121. package/dist/generated/tenants/client.d.ts.map +1 -1
  122. package/dist/generated/tenants/client.js +10 -18
  123. package/dist/generated/tenants/client.js.map +1 -1
  124. package/dist/generated/tenants/index.d.ts +2 -2
  125. package/dist/generated/tenants/index.d.ts.map +1 -1
  126. package/dist/generated/tenants/models.d.ts +9 -40
  127. package/dist/generated/tenants/models.d.ts.map +1 -1
  128. package/dist/generated/tenants/models.js +8 -29
  129. package/dist/generated/tenants/models.js.map +1 -1
  130. package/dist/index.d.ts +126 -387
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.js +174 -239
  133. package/dist/index.js.map +1 -1
  134. package/package.json +1 -1
  135. package/dist/generated/browser/client.d.ts +0 -106
  136. package/dist/generated/browser/client.d.ts.map +0 -1
  137. package/dist/generated/browser/client.js +0 -38
  138. package/dist/generated/browser/client.js.map +0 -1
  139. package/dist/generated/browser/index.d.ts +0 -6
  140. package/dist/generated/browser/index.d.ts.map +0 -1
  141. package/dist/generated/browser/index.js +0 -5
  142. package/dist/generated/browser/index.js.map +0 -1
  143. package/dist/generated/browser/models.d.ts +0 -49
  144. package/dist/generated/browser/models.d.ts.map +0 -1
  145. package/dist/generated/browser/models.js +0 -28
  146. package/dist/generated/browser/models.js.map +0 -1
  147. package/dist/generated/filesync/client.d.ts +0 -220
  148. package/dist/generated/filesync/client.d.ts.map +0 -1
  149. package/dist/generated/filesync/client.js +0 -73
  150. package/dist/generated/filesync/client.js.map +0 -1
  151. package/dist/generated/filesync/index.d.ts +0 -6
  152. package/dist/generated/filesync/index.d.ts.map +0 -1
  153. package/dist/generated/filesync/index.js +0 -5
  154. package/dist/generated/filesync/index.js.map +0 -1
  155. package/dist/generated/filesync/models.d.ts +0 -32
  156. package/dist/generated/filesync/models.d.ts.map +0 -1
  157. package/dist/generated/filesync/models.js +0 -19
  158. package/dist/generated/filesync/models.js.map +0 -1
  159. package/dist/generated/imports/models.d.ts +0 -6
  160. package/dist/generated/imports/models.d.ts.map +0 -1
  161. package/dist/generated/imports/models.js +0 -4
  162. package/dist/generated/imports/models.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -577,13 +577,12 @@ export interface Notification {
577
577
  seq?: number;
578
578
  }
579
579
  /**
580
- * One realtime event of the workspace (`openRealtimeSocket` and
581
- * `streamEvents`, the frames of `GET /v1/events/stream` and
582
- * `GET /v1/events/socket`), which every member hears. `action` and
583
- * `notification` are wakeups — re-read the surface, the row itself comes by
584
- * cursor; the rest is state that only matters while someone is watching. A
585
- * chat thread's answers are not among them: they are only its members' to
586
- * read, on the thread's own stream (`streamThread`, `ThreadStreamEvent`).
580
+ * One realtime event of the workspace (`openRealtimeSocket`, which polls
581
+ * `GET /v1/events/poll`; the frames of `GET /v1/events/stream` and
582
+ * `GET /v1/events/socket`).
583
+ * `action` and `notification` are wakeups — re-read the surface, the row
584
+ * itself comes by cursor; the rest is state that only matters while
585
+ * someone is watching.
587
586
  */
588
587
  export type RealtimeEvent = {
589
588
  type: "action";
@@ -604,6 +603,25 @@ export type RealtimeEvent = {
604
603
  channel_id: string;
605
604
  /** A message landed, a delivery status changed, or the thread was read. */
606
605
  change: "message" | "status" | "read";
606
+ } | {
607
+ type: "run";
608
+ /** The chat thread this run works in; only thread work is published. */
609
+ thread_id: string;
610
+ run_id: string;
611
+ agent_definition: string;
612
+ /** What the step returned: continue (still working), parked (waiting), idle (a resting session), done. */
613
+ outcome: "continue" | "parked" | "idle" | "done";
614
+ } | {
615
+ type: "run_delta";
616
+ /** The chat thread the run answers in. */
617
+ thread_id: string;
618
+ run_id: string;
619
+ /** The step the model turn will be stored as; a higher one is a new turn. */
620
+ seq: number;
621
+ /** The frame's place within the turn, from 0. */
622
+ n: number;
623
+ /** Prose the model generated since the previous frame. */
624
+ text: string;
607
625
  } | {
608
626
  type: "typing";
609
627
  /** A workspace chat thread or a marketing inbox conversation. */
@@ -635,31 +653,6 @@ export type RealtimeEvent = {
635
653
  /** ISO instant after which a reader drops them unless the signal repeats. */
636
654
  until: string;
637
655
  };
638
- /**
639
- * One frame of a chat thread's own stream (`streamThread`), which only a
640
- * member who sits in the thread may read: a piece of the answer a run is
641
- * writing (`run_delta`), or a run step's end (`run`).
642
- */
643
- export type ThreadStreamEvent = {
644
- type: "run";
645
- /** The chat thread this run works in; only thread work is published. */
646
- thread_id: string;
647
- run_id: string;
648
- agent_definition: string;
649
- /** What the step returned: continue (still working), parked (waiting), idle (a resting session), done. */
650
- outcome: "continue" | "parked" | "idle" | "done";
651
- } | {
652
- type: "run_delta";
653
- /** The chat thread the run answers in. */
654
- thread_id: string;
655
- run_id: string;
656
- /** The step the model turn will be stored as; a higher one is a new turn. */
657
- seq: number;
658
- /** The frame's place within the turn, from 0. */
659
- n: number;
660
- /** Prose the model generated since the previous frame. */
661
- text: string;
662
- };
663
656
  /** Where a person is typing: a chat thread or a marketing inbox conversation. */
664
657
  export type TypingScope = Extract<RealtimeEvent, {
665
658
  type: "typing";
@@ -678,7 +671,7 @@ export interface RealtimeSocketOptions {
678
671
  /** Called when a poll fails after one answered. */
679
672
  onClose?: () => void;
680
673
  /**
681
- * Ignored: the subscription reads `GET /v1/events/stream` over `fetch`
674
+ * Ignored: the subscription polls `GET /v1/events/poll` over `fetch`
682
675
  * rather than holding a WebSocket. Kept so existing callers compile.
683
676
  */
684
677
  webSocket?: (url: string, headers: Record<string, string>) => WebSocket;
@@ -1601,46 +1594,6 @@ export interface LiveDocumentFolder {
1601
1594
  name: string;
1602
1595
  created_at: string;
1603
1596
  }
1604
- /**
1605
- * One item of the desktop folder sync's feed (`filesync.changes`,
1606
- * docs/file-sync.md). A deleted item carries only `id` and `deleted: true`.
1607
- * `size` is null for a live document (its Office export is rendered on demand).
1608
- */
1609
- export interface FileSyncItem {
1610
- id: string;
1611
- type?: "folder" | "file" | "doc" | "sheet" | "slides";
1612
- /** `personal`, `team`, `shared`, `root` or a folder id. */
1613
- parent_id?: string;
1614
- name?: string;
1615
- size?: number | null;
1616
- content_type?: string;
1617
- /** Changes when the content or the metadata change; a write names it as `base_version`. */
1618
- version?: string;
1619
- /** Changes only when the bytes would; the content routes' ETag and If-Match. */
1620
- content_version?: string;
1621
- modified_at?: string;
1622
- writable?: boolean;
1623
- deleted: boolean;
1624
- }
1625
- /** `filesync.changes`' input: no cursor starts a full listing. */
1626
- export interface FileSyncChangesInput {
1627
- cursor?: string;
1628
- limit?: number;
1629
- }
1630
- /** `filesync.move`'s input: a new parent, a new name, or both. */
1631
- export interface FileSyncMoveInput {
1632
- id: string;
1633
- base_version: string;
1634
- parent_id?: string;
1635
- name?: string;
1636
- }
1637
- /** A page of `filesync.changes`: keep calling with `cursor` while `has_more`; `reset` means list again. */
1638
- export interface FileSyncPage {
1639
- items: FileSyncItem[];
1640
- cursor: string;
1641
- has_more: boolean;
1642
- reset: boolean;
1643
- }
1644
1597
  /** Who a personal document is shared with (`knowledge.list_doc_shares`). */
1645
1598
  export interface LiveDocumentShares {
1646
1599
  live_document_id: string;
@@ -2274,13 +2227,9 @@ export interface MessageThreadFile {
2274
2227
  shared_by_id: string | null;
2275
2228
  shared_by_name: string;
2276
2229
  }
2277
- /**
2278
- * Result of messages.list_files. `total` is the thread's whole tally,
2279
- * independent of page_size; `next_cursor` asks for the shares after this page.
2280
- */
2230
+ /** Result of messages.list_files. `total` is the thread's whole tally, independent of page_size. */
2281
2231
  export interface MessageThreadFileList {
2282
2232
  files: MessageThreadFile[];
2283
- next_cursor: string | null;
2284
2233
  total: number;
2285
2234
  }
2286
2235
  export interface MessageMention {
@@ -5116,55 +5065,6 @@ export interface MarketingInboxTopic {
5116
5065
  description?: string;
5117
5066
  }
5118
5067
  /** An inbox conversation on a connected marketing channel (WhatsApp Business threads today). */
5119
- /** A public comment under an Instagram or Facebook post, or a reply sent from the inbox. */
5120
- export interface MarketingComment {
5121
- id: string;
5122
- channel_id: string;
5123
- post_id: string | null;
5124
- external_id: string;
5125
- parent_external_id: string;
5126
- author_name: string;
5127
- body: string;
5128
- direction: "in" | "out";
5129
- status: "received" | "pending" | "sent" | "failed";
5130
- hidden: boolean;
5131
- error: string;
5132
- commented_at: string;
5133
- post_caption: string | null;
5134
- post_url: string | null;
5135
- }
5136
- /** A private note teammates left on an inbox thread. */
5137
- export interface MarketingConversationNote {
5138
- id: string;
5139
- author_user_id: string | null;
5140
- author_name: string;
5141
- body: string;
5142
- created_at: string;
5143
- }
5144
- /** An internal comment a teammate left on a post. */
5145
- export interface MarketingPostNote {
5146
- id: string;
5147
- author_user_id: string | null;
5148
- author_name: string;
5149
- body: string;
5150
- created_at: string;
5151
- }
5152
- /** A post idea in the workspace's backlog. */
5153
- export interface MarketingIdea {
5154
- id: string;
5155
- title: string;
5156
- notes: string;
5157
- created_at: string;
5158
- updated_at: string;
5159
- }
5160
- /** A saved caption or hashtag group the composer inserts. */
5161
- export interface MarketingSnippet {
5162
- id: string;
5163
- kind: "caption" | "hashtags";
5164
- name: string;
5165
- body: string;
5166
- updated_at: string;
5167
- }
5168
5068
  export interface MarketingConversation {
5169
5069
  id: string;
5170
5070
  channel_id: string;
@@ -5175,8 +5075,6 @@ export interface MarketingConversation {
5175
5075
  peer_phone: string;
5176
5076
  peer_name: string;
5177
5077
  party_id?: string | null;
5178
- /** The teammate who owns the thread. */
5179
- assignee_user_id?: string;
5180
5078
  last_message_at: string | null;
5181
5079
  last_direction?: "inbound" | "outbound";
5182
5080
  last_snippet: string;
@@ -5611,75 +5509,6 @@ export interface MarketingPost {
5611
5509
  channel_name?: string;
5612
5510
  /** The TikTok direct-post choices a TikTok post carries, as TikTok's `post_info` names them. */
5613
5511
  tiktok?: MarketingPostTikTokSettings | null;
5614
- /** The Instagram and Facebook extras: first comment, alt text, collaborators. */
5615
- details?: MarketingPostDetails | null;
5616
- /** The workspace's own labels for the post; never published. */
5617
- tags?: string[];
5618
- }
5619
- /** What an Instagram or Facebook post carries beside its caption. */
5620
- export interface MarketingPostDetails {
5621
- first_comment?: string;
5622
- alt_text?: string;
5623
- collaborators?: string[];
5624
- }
5625
- /** The extras `marketing.create_post` and `marketing.save_post_draft` take. */
5626
- export interface MarketingPostDetailChoices {
5627
- first_comment?: string;
5628
- alt_text?: string;
5629
- collaborators?: string[];
5630
- }
5631
- /** A caption the AI wrote for one network. */
5632
- export interface MarketingCaptionSuggestion {
5633
- provider: string;
5634
- caption: string;
5635
- }
5636
- /** A request for AI captions and, once done, one suggestion per network. */
5637
- export interface MarketingCaptionDraft {
5638
- id: string;
5639
- status: "queued" | "done" | "failed";
5640
- brief: string;
5641
- tone: string;
5642
- providers: string[];
5643
- suggestions: MarketingCaptionSuggestion[];
5644
- /** Starts with a code: allowance_used, not_configured or failed. */
5645
- error: string;
5646
- created_at: string;
5647
- finished_at: string | null;
5648
- }
5649
- /** A generated picture or video request; url is set once it is done. */
5650
- export interface MarketingGeneration {
5651
- id: string;
5652
- kind: "image" | "video";
5653
- status: "queued" | "rendering" | "done" | "failed";
5654
- prompt: string;
5655
- url: string | null;
5656
- error: string;
5657
- created_at: string;
5658
- }
5659
- /** One weekly posting time: 0 Sunday … 6 Saturday, and a local "HH:MM". */
5660
- export interface MarketingPostScheduleSlot {
5661
- weekday: number;
5662
- time: string;
5663
- }
5664
- /** An account's weekly posting times and the next one no post has taken. */
5665
- export interface MarketingPostSchedule {
5666
- channel_id: string;
5667
- time_zone: string | null;
5668
- slots: MarketingPostScheduleSlot[];
5669
- next_slot: string | null;
5670
- }
5671
- /** A weekday and hour an account's published posts drew the most interactions at. */
5672
- export interface MarketingBestTime {
5673
- weekday: number;
5674
- hour: number;
5675
- posts: number;
5676
- average_interactions: number;
5677
- }
5678
- /** The best times to post, best first, with how many posts they were read from. */
5679
- export interface MarketingBestTimes {
5680
- time_zone: string;
5681
- sample: number;
5682
- times: MarketingBestTime[];
5683
5512
  }
5684
5513
  /** Who can view a TikTok video, as TikTok's creator info offers the levels. */
5685
5514
  export type TikTokPrivacyLevel = "PUBLIC_TO_EVERYONE" | "MUTUAL_FOLLOW_FRIENDS" | "FOLLOWER_OF_CREATOR" | "SELF_ONLY";
@@ -6108,10 +5937,7 @@ export interface EmailMessage {
6108
5937
  provider: "gmail" | "outlook";
6109
5938
  thread_id?: string;
6110
5939
  direction: "inbound" | "outbound";
6111
- /** The sender's address. */
6112
5940
  from: string;
6113
- /** The From header's display name ("Anthropic"); absent when it names no one, or on mail synced before it was kept. */
6114
- from_name?: string;
6115
5941
  to: string[];
6116
5942
  cc?: string[];
6117
5943
  subject: string;
@@ -6170,8 +5996,6 @@ export interface EmailMessageBody {
6170
5996
  account_id: string;
6171
5997
  direction: "inbound" | "outbound";
6172
5998
  from: string;
6173
- /** The From header's display name; empty when it names no one. */
6174
- from_name: string;
6175
5999
  to: string[];
6176
6000
  cc?: string[];
6177
6001
  subject: string;
@@ -6631,6 +6455,12 @@ export interface ChatAttachment {
6631
6455
  document_id: string;
6632
6456
  filename: string;
6633
6457
  }
6458
+ export interface ChatMessage {
6459
+ role: "user" | "assistant";
6460
+ content: string;
6461
+ /** Uploaded documents attached to a user message. */
6462
+ attachments?: ChatAttachment[];
6463
+ }
6634
6464
  /**
6635
6465
  * An action parked for in-chat authorization: the exact tool call the model
6636
6466
  * attempted, held server-side until the user approves or denies it.
@@ -6640,6 +6470,17 @@ export interface ChatApproval {
6640
6470
  tool: string;
6641
6471
  input: unknown;
6642
6472
  }
6473
+ /** The outcome of deciding an in-chat authorization request. */
6474
+ export interface ChatApprovalDecision {
6475
+ decided: "approved" | "denied";
6476
+ tool: string;
6477
+ /** Tool output when approved and the call succeeded. */
6478
+ output?: unknown;
6479
+ /** Present when approved but the call failed. */
6480
+ error?: string;
6481
+ /** True when the approved call changed a dashboard. */
6482
+ dashboard_changed?: boolean;
6483
+ }
6643
6484
  /**
6644
6485
  * How a member answered an in-chat authorization, kept on the user turn
6645
6486
  * that carried the answer back to the model so the transcript can draw
@@ -6656,48 +6497,71 @@ export interface ChatApprovalOutcome {
6656
6497
  /** Present when approved but the call failed. */
6657
6498
  error?: string;
6658
6499
  }
6659
- /** How a `askSession` stood when its wait ended. */
6660
- export type SessionAskState = "answered" | "awaiting_approval" | "awaiting_input" | "working" | "failed";
6661
- /**
6662
- * What `askSession` answers: the question as a message in a session thread,
6663
- * and how that session's run stood when the wait ended.
6664
- */
6665
- export interface SessionAsk {
6666
- thread_id: string;
6667
- /** The session the ask opened; absent when it went to a thread already open. */
6668
- session_id?: string;
6669
- /** The message sent; "" for a wait that sent none. */
6670
- message_id: string;
6671
- /** The session run the message reached; "" when none did yet. */
6672
- run_id: string;
6673
- state: SessionAskState;
6674
- /** The answer's prose, markdown, when `state` is `answered`. */
6500
+ export interface OverviewChatResponse {
6675
6501
  reply: string;
6676
- /** The answer's json-render spec, when it drew one. */
6502
+ /**
6503
+ * The answer's json-render spec (ui-spec.ts), when the model drew one:
6504
+ * rendered under the reply in place of `message`, which then leads with
6505
+ * its Block Kit reading for a client that does not draw specs.
6506
+ */
6677
6507
  ui?: UISpec;
6678
- /** The answer's Block Kit blocks, when it laid some out. */
6679
- blocks?: MessageBlock[];
6680
6508
  /**
6681
- * The action that waits for a person: decide it with `approveRun` /
6682
- * `denyRun` on `run_id`, the run that holds it (the session's own, or a
6683
- * specialist's it called).
6509
+ * The answer as Block Kit blocks, when the model laid one out (a table,
6510
+ * a plan, buttons to click): rendered under the reply. See block-kit.ts.
6511
+ */
6512
+ message?: MessageBlock[];
6513
+ blocks: CanvasBlock[];
6514
+ /**
6515
+ * Questions the model posed via user.ask. Render them as a questionnaire
6516
+ * and send the answers back as the next user message.
6684
6517
  */
6685
- approval?: {
6686
- id: string;
6687
- run_id: string;
6688
- tool: string;
6689
- input: Json;
6690
- };
6691
- /** The questions the run asked: answer with `answerRun`, or by writing in the thread. */
6692
6518
  questions?: RunQuestion[];
6693
- /** What the run waits on was pending before this message: the message waits behind it. */
6694
- queued: boolean;
6695
- /** Why the run failed: `ai_allowance_used` when the plan refused the model. */
6696
- error?: {
6697
- code: string;
6698
- message: string;
6519
+ /**
6520
+ * An action awaiting the user's in-chat authorization. Render Approve/Deny;
6521
+ * decide via decideChatApproval and report the outcome back as the next
6522
+ * user message.
6523
+ */
6524
+ approval?: ChatApproval;
6525
+ usage: {
6526
+ tokens_in: number;
6527
+ tokens_out: number;
6699
6528
  };
6529
+ /** True when this turn created, appended, edited, or deleted a dashboard. */
6530
+ dashboard_changed: boolean;
6700
6531
  }
6532
+ /** How far a tool call got during a streaming chat turn. */
6533
+ export type OverviewChatToolPhase = "start" | "ok" | "error" | "approval" | "questions";
6534
+ /**
6535
+ * One event of a streaming overview chat (`overviewChatStream`).
6536
+ *
6537
+ * - `turn` — a model turn began. Text streamed before it was a preamble to
6538
+ * a tool call, so the accumulated answer starts over.
6539
+ * - `delta` — more of the answer's prose, already decoded out of the
6540
+ * model's JSON envelope.
6541
+ * - `tool` — a tool call started or finished; useful as a progress line.
6542
+ * - `done` — the authoritative payload, identical to what `overviewChat`
6543
+ * returns. Blocks, questions and approvals only exist once the turn is
6544
+ * complete, so replace the streamed text with `response.reply`.
6545
+ * - `error` — the round-trip failed; nothing further arrives.
6546
+ */
6547
+ export type OverviewChatStreamEvent = {
6548
+ type: "turn";
6549
+ n: number;
6550
+ } | {
6551
+ type: "delta";
6552
+ text: string;
6553
+ } | {
6554
+ type: "tool";
6555
+ name: string;
6556
+ phase: OverviewChatToolPhase;
6557
+ } | {
6558
+ type: "done";
6559
+ response: OverviewChatResponse;
6560
+ } | {
6561
+ type: "error";
6562
+ error: string;
6563
+ code: string;
6564
+ };
6701
6565
  /** One turn of a saved overview conversation (a historical record: blocks keep the data they were hydrated with). */
6702
6566
  export interface ConversationTurn {
6703
6567
  role: "user" | "assistant";
@@ -7868,68 +7732,12 @@ export interface NemphiClient {
7868
7732
  media_urls?: string[];
7869
7733
  media_type?: MarketingPost["media_type"];
7870
7734
  scheduled_at?: string;
7871
- /** Per-account captions keyed by channel id; an account named here gets its own text. */
7872
- captions?: Record<string, string>;
7873
- /** Schedule each account's post for its next free posting time instead of scheduled_at. */
7874
- queue?: boolean;
7875
- } & TikTokPostChoices & MarketingPostDetailChoices): Promise<{
7735
+ } & TikTokPostChoices): Promise<{
7876
7736
  batch_id: string;
7877
7737
  posts: MarketingPost[];
7878
7738
  note?: string;
7879
7739
  }>;
7880
7740
  getTikTokCreatorInfo(channelId: string): Promise<TikTokCreatorInfo>;
7881
- writeMarketingCaptions(input: {
7882
- brief: string;
7883
- providers: string[];
7884
- tone?: "friendly" | "professional" | "playful" | "bold";
7885
- language?: string;
7886
- current_caption?: string;
7887
- }): Promise<MarketingCaptionDraft>;
7888
- getMarketingCaptionDraft(draftId: string): Promise<MarketingCaptionDraft>;
7889
- generateMarketingImage(input: {
7890
- prompt: string;
7891
- orientation?: "square" | "portrait" | "landscape";
7892
- }): Promise<MarketingGeneration>;
7893
- listMarketingGenerations(input?: {
7894
- kind?: "image" | "video";
7895
- status?: MarketingGeneration["status"];
7896
- }): Promise<MarketingGeneration[]>;
7897
- listMarketingPostSchedules(): Promise<MarketingPostSchedule[]>;
7898
- setMarketingPostSchedule(input: {
7899
- channel_id: string;
7900
- time_zone: string;
7901
- slots: MarketingPostScheduleSlot[];
7902
- }): Promise<MarketingPostSchedule>;
7903
- getMarketingBestPostTimes(input: {
7904
- channel_id: string;
7905
- time_zone?: string;
7906
- }): Promise<MarketingBestTimes>;
7907
- setMarketingPostTags(input: {
7908
- post_id: string;
7909
- tags: string[];
7910
- }): Promise<MarketingPost>;
7911
- listMarketingPostNotes(postId: string): Promise<MarketingPostNote[]>;
7912
- addMarketingPostNote(input: {
7913
- post_id: string;
7914
- body: string;
7915
- }): Promise<MarketingPostNote>;
7916
- listMarketingSnippets(input?: {
7917
- kind?: MarketingSnippet["kind"];
7918
- }): Promise<MarketingSnippet[]>;
7919
- saveMarketingSnippet(input: {
7920
- id?: string;
7921
- kind: MarketingSnippet["kind"];
7922
- name: string;
7923
- body: string;
7924
- }): Promise<MarketingSnippet>;
7925
- deleteMarketingSnippet(id: string): Promise<MarketingSnippet>;
7926
- listMarketingIdeas(): Promise<MarketingIdea[]>;
7927
- saveMarketingIdea(input: {
7928
- id?: string;
7929
- title: string;
7930
- notes?: string;
7931
- }): Promise<MarketingIdea>;
7932
- deleteMarketingIdea(id: string): Promise<MarketingIdea>;
7933
7741
  listMarketingPostRevisions(input: {
7934
7742
  post_id: string;
7935
7743
  before_version?: number;
@@ -7957,7 +7765,7 @@ export interface NemphiClient {
7957
7765
  caption?: string;
7958
7766
  media_type?: MarketingPost["media_type"];
7959
7767
  media_urls?: string[];
7960
- } & TikTokPostChoices & MarketingPostDetailChoices): Promise<{
7768
+ } & TikTokPostChoices): Promise<{
7961
7769
  post: MarketingPost;
7962
7770
  }>;
7963
7771
  submitMarketingPost(postId: string): Promise<{
@@ -8038,28 +7846,6 @@ export interface NemphiClient {
8038
7846
  conversation_id: string;
8039
7847
  body: string;
8040
7848
  }): Promise<MarketingMessage>;
8041
- listMarketingComments(input?: {
8042
- channel_id?: string;
8043
- post_id?: string;
8044
- limit?: number;
8045
- }): Promise<MarketingComment[]>;
8046
- replyToMarketingComment(input: {
8047
- comment_id: string;
8048
- body: string;
8049
- }): Promise<MarketingComment>;
8050
- hideMarketingComment(input: {
8051
- comment_id: string;
8052
- hidden: boolean;
8053
- }): Promise<MarketingComment>;
8054
- assignMarketingConversation(input: {
8055
- conversation_id: string;
8056
- assignee_user_id?: string;
8057
- }): Promise<MarketingConversation>;
8058
- listMarketingConversationNotes(conversationId: string): Promise<MarketingConversationNote[]>;
8059
- addMarketingConversationNote(input: {
8060
- conversation_id: string;
8061
- body: string;
8062
- }): Promise<MarketingConversationNote>;
8063
7849
  linkMarketingConversationParty(input: {
8064
7850
  conversation_id: string;
8065
7851
  party_id: string;
@@ -8788,25 +8574,6 @@ export interface NemphiClient {
8788
8574
  * content type — for showing what was shared, not only its name.
8789
8575
  */
8790
8576
  downloadDocument(id: string): Promise<Response>;
8791
- /** The desktop folder sync's feed: no cursor lists everything, a cursor answers what changed. */
8792
- fileSyncChanges(cursor?: string, limit?: number): Promise<FileSyncPage>;
8793
- /** A synced entry's bytes (a live document exported to Word, Excel or PowerPoint); ETag is its content_version. */
8794
- downloadFileSyncContent(id: string): Promise<Response>;
8795
- /** Replaces an entry's bytes when it still holds `contentVersion`; a stale one throws ApiError 409. */
8796
- replaceFileSyncContent(id: string, contentVersion: string, body: Blob | Uint8Array): Promise<FileSyncItem>;
8797
- /** Files new bytes as a file entry under `parentId` (personal, team or a folder id). */
8798
- createFileSyncFile(parentId: string, name: string, body: Blob | Uint8Array): Promise<FileSyncItem>;
8799
- createFileSyncFolder(parentId: string, name: string): Promise<FileSyncItem>;
8800
- /** Renames or moves an item; a stale `baseVersion` throws ApiError 409. */
8801
- moveFileSyncItem(id: string, change: {
8802
- parentId?: string;
8803
- name?: string;
8804
- }, baseVersion: string): Promise<FileSyncItem>;
8805
- /** Trashes an entry, or a folder with everything in it; a stale `baseVersion` throws ApiError 409. */
8806
- deleteFileSyncItem(id: string, baseVersion: string): Promise<{
8807
- id: string;
8808
- deleted: boolean;
8809
- }>;
8810
8577
  /** Sends documents through a public link, mailed to any recipients. */
8811
8578
  createTransfer(input: TransferInput): Promise<CreatedTransfer>;
8812
8579
  /** The caller's transfers (an owner or admin: the workspace's), newest first. */
@@ -8859,48 +8626,22 @@ export interface NemphiClient {
8859
8626
  next_before?: number;
8860
8627
  }>;
8861
8628
  /**
8862
- * One connection to the workspace's realtime stream
8863
- * (`GET /v1/events/stream`, server-sent events): every frame it carries,
8864
- * checked by its `type`, until the connection ends (the server closes a
8865
- * stream after 15 minutes) or `signal` aborts. `action` and
8866
- * `notification` are wake-ups naming a row; read the row back. The
8867
- * stream keeps no position, so a reader that connects again re-reads
8868
- * what it shows. `openRealtimeSocket` reconnects for you.
8629
+ * Live tail of the action ledger (`GET /v1/events/stream`, SSE).
8630
+ * Resumes from `cursor` (last seen action id); abort via `signal`.
8869
8631
  */
8870
8632
  streamEvents(opts?: {
8871
- /** @deprecated Ignored: the stream keeps no position. */
8872
8633
  cursor?: number;
8873
8634
  signal?: AbortSignal;
8874
- }): AsyncGenerator<RealtimeEvent, void, void>;
8635
+ }): AsyncGenerator<Action, void, void>;
8875
8636
  /**
8876
- * The workspace's realtime events from `GET /v1/events/stream`, opened
8877
- * again with backoff whenever it drops, until `close()`: the ledger and
8878
- * the caller's notifications as wake-ups, the workspace's frames as they
8879
- * are, and who is online. The connection keeps the caller online.
8637
+ * The workspace's realtime events, polled from `GET /v1/events/poll`
8638
+ * every two seconds (at once while the server has more), with retries
8639
+ * until `close()`: the ledger and the caller's notifications as
8640
+ * wake-ups, the workspace's frames as they are, and who is online when
8641
+ * that changed. Each poll keeps the caller online. The web app polls the
8642
+ * same route through its own server route.
8880
8643
  */
8881
8644
  openRealtimeSocket(options: RealtimeSocketOptions): RealtimeSocket;
8882
- /**
8883
- * One chat thread's own stream (`GET /v1/threads/{id}/stream`), for a
8884
- * member who sits in it: the answers its agent runs are writing
8885
- * (`run_delta`) and each run step's end (`run`). It opens the stream
8886
- * again with backoff whenever it drops or the server ends it, until
8887
- * `signal` aborts; a refusal that will not change (401, 403, the thread
8888
- * not found as 404) throws an `ApiError`.
8889
- *
8890
- * Every connection first replays the turn being written, so a reader
8891
- * that reconnects mid-answer has all of it. Fold the pieces by
8892
- * `(seq, n)`: a later `seq` starts the run's text over, a piece already
8893
- * held (the same `seq`, an `n` at or below the last) changes nothing.
8894
- * The answer itself always lands as a message; a `run` frame whose
8895
- * outcome is `continue` or `parked` means the text so far was preamble.
8896
- * A step that ended while the stream was down is not replayed, so
8897
- * `onOpen` after the first is the moment to re-read the thread.
8898
- */
8899
- streamThread(threadId: string, opts?: {
8900
- signal?: AbortSignal;
8901
- /** Called each time the stream answers. */
8902
- onOpen?: () => void;
8903
- }): AsyncGenerator<ThreadStreamEvent, void, void>;
8904
8645
  /** Say the caller is writing in a thread or an inbox conversation (`POST /v1/events/typing`); nothing is stored. */
8905
8646
  sendTyping(input: {
8906
8647
  scope: TypingScope;
@@ -9454,23 +9195,19 @@ export interface NemphiClient {
9454
9195
  kind?: FeatureKind;
9455
9196
  only_unused?: boolean;
9456
9197
  }): Promise<FeatureUsageResponse>;
9198
+ overviewChat(input: {
9199
+ messages: ChatMessage[];
9200
+ }): Promise<OverviewChatResponse>;
9457
9201
  /**
9458
- * Asks the orchestrator one question as a message in a session thread
9459
- * (a new session, or `thread_id` to carry one on) and waits for that
9460
- * session's run: its whole answer, the approval or questions it parked
9461
- * on, or `working` once `wait_ms` (at most 55 000; 25 000 by default)
9462
- * runs out, when the reply lands in the thread. With `thread_id` and no
9463
- * `text` it sends nothing and waits on the thread as it stands: the
9464
- * answer once an approval is decided. Follow the thread live with
9465
- * `streamThread`.
9202
+ * The same round-trip as `overviewChat`, reported as it happens. Render
9203
+ * the deltas for immediate feedback and take the final answer from the
9204
+ * `done` event — it is what `overviewChat` would have returned.
9466
9205
  */
9467
- askSession(input: {
9468
- text?: string;
9469
- thread_id?: string;
9470
- context?: string;
9471
- document_ids?: string[];
9472
- wait_ms?: number;
9473
- }): Promise<SessionAsk>;
9206
+ overviewChatStream(input: {
9207
+ messages: ChatMessage[];
9208
+ }, opts?: {
9209
+ signal?: AbortSignal;
9210
+ }): AsyncGenerator<OverviewChatStreamEvent, void, void>;
9474
9211
  /** Suggested prompts ranked from the tenant's live data. */
9475
9212
  overviewSuggestions(): Promise<OverviewSuggestionsResponse>;
9476
9213
  /**
@@ -9494,6 +9231,8 @@ export interface NemphiClient {
9494
9231
  mirrorOverviewThread(turns: ConversationTurn[]): Promise<{
9495
9232
  thread_id: string;
9496
9233
  }>;
9234
+ /** Decides an in-chat authorization request; approving executes the parked call. */
9235
+ decideChatApproval(id: string, approve: boolean): Promise<ChatApprovalDecision>;
9497
9236
  listDashboards(): Promise<DashboardSummary[]>;
9498
9237
  /**
9499
9238
  * Fetches one dashboard with every block's metric query re-run (live data).