@nemphi/sdk 0.6.5419 → 0.7.5500

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 (36) hide show
  1. package/dist/generated/email/models.d.ts +2 -0
  2. package/dist/generated/email/models.d.ts.map +1 -1
  3. package/dist/generated/email/models.js +2 -0
  4. package/dist/generated/email/models.js.map +1 -1
  5. package/dist/generated/marketing/client.d.ts +531 -1
  6. package/dist/generated/marketing/client.d.ts.map +1 -1
  7. package/dist/generated/marketing/client.js +176 -3
  8. package/dist/generated/marketing/client.js.map +1 -1
  9. package/dist/generated/marketing/index.d.ts +2 -2
  10. package/dist/generated/marketing/index.d.ts.map +1 -1
  11. package/dist/generated/marketing/models.d.ts +151 -0
  12. package/dist/generated/marketing/models.d.ts.map +1 -1
  13. package/dist/generated/marketing/models.js +88 -0
  14. package/dist/generated/marketing/models.js.map +1 -1
  15. package/dist/generated/messages/client.d.ts +6 -2
  16. package/dist/generated/messages/client.d.ts.map +1 -1
  17. package/dist/generated/messages/client.js.map +1 -1
  18. package/dist/generated/messages/models.d.ts +1 -0
  19. package/dist/generated/messages/models.d.ts.map +1 -1
  20. package/dist/generated/messages/models.js +1 -0
  21. package/dist/generated/messages/models.js.map +1 -1
  22. package/dist/generated/tenants/client.d.ts +70 -37
  23. package/dist/generated/tenants/client.d.ts.map +1 -1
  24. package/dist/generated/tenants/client.js +18 -10
  25. package/dist/generated/tenants/client.js.map +1 -1
  26. package/dist/generated/tenants/index.d.ts +2 -2
  27. package/dist/generated/tenants/index.d.ts.map +1 -1
  28. package/dist/generated/tenants/models.d.ts +40 -9
  29. package/dist/generated/tenants/models.d.ts.map +1 -1
  30. package/dist/generated/tenants/models.js +29 -8
  31. package/dist/generated/tenants/models.js.map +1 -1
  32. package/dist/index.d.ts +304 -3
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +152 -0
  35. package/dist/index.js.map +1 -1
  36. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2227,9 +2227,13 @@ export interface MessageThreadFile {
2227
2227
  shared_by_id: string | null;
2228
2228
  shared_by_name: string;
2229
2229
  }
2230
- /** Result of messages.list_files. `total` is the thread's whole tally, independent of page_size. */
2230
+ /**
2231
+ * Result of messages.list_files. `total` is the thread's whole tally,
2232
+ * independent of page_size; `next_cursor` asks for the shares after this page.
2233
+ */
2231
2234
  export interface MessageThreadFileList {
2232
2235
  files: MessageThreadFile[];
2236
+ next_cursor: string | null;
2233
2237
  total: number;
2234
2238
  }
2235
2239
  export interface MessageMention {
@@ -5065,6 +5069,55 @@ export interface MarketingInboxTopic {
5065
5069
  description?: string;
5066
5070
  }
5067
5071
  /** An inbox conversation on a connected marketing channel (WhatsApp Business threads today). */
5072
+ /** A public comment under an Instagram or Facebook post, or a reply sent from the inbox. */
5073
+ export interface MarketingComment {
5074
+ id: string;
5075
+ channel_id: string;
5076
+ post_id: string | null;
5077
+ external_id: string;
5078
+ parent_external_id: string;
5079
+ author_name: string;
5080
+ body: string;
5081
+ direction: "in" | "out";
5082
+ status: "received" | "pending" | "sent" | "failed";
5083
+ hidden: boolean;
5084
+ error: string;
5085
+ commented_at: string;
5086
+ post_caption: string | null;
5087
+ post_url: string | null;
5088
+ }
5089
+ /** A private note teammates left on an inbox thread. */
5090
+ export interface MarketingConversationNote {
5091
+ id: string;
5092
+ author_user_id: string | null;
5093
+ author_name: string;
5094
+ body: string;
5095
+ created_at: string;
5096
+ }
5097
+ /** An internal comment a teammate left on a post. */
5098
+ export interface MarketingPostNote {
5099
+ id: string;
5100
+ author_user_id: string | null;
5101
+ author_name: string;
5102
+ body: string;
5103
+ created_at: string;
5104
+ }
5105
+ /** A post idea in the workspace's backlog. */
5106
+ export interface MarketingIdea {
5107
+ id: string;
5108
+ title: string;
5109
+ notes: string;
5110
+ created_at: string;
5111
+ updated_at: string;
5112
+ }
5113
+ /** A saved caption or hashtag group the composer inserts. */
5114
+ export interface MarketingSnippet {
5115
+ id: string;
5116
+ kind: "caption" | "hashtags";
5117
+ name: string;
5118
+ body: string;
5119
+ updated_at: string;
5120
+ }
5068
5121
  export interface MarketingConversation {
5069
5122
  id: string;
5070
5123
  channel_id: string;
@@ -5075,6 +5128,8 @@ export interface MarketingConversation {
5075
5128
  peer_phone: string;
5076
5129
  peer_name: string;
5077
5130
  party_id?: string | null;
5131
+ /** The teammate who owns the thread. */
5132
+ assignee_user_id?: string;
5078
5133
  last_message_at: string | null;
5079
5134
  last_direction?: "inbound" | "outbound";
5080
5135
  last_snippet: string;
@@ -5509,6 +5564,75 @@ export interface MarketingPost {
5509
5564
  channel_name?: string;
5510
5565
  /** The TikTok direct-post choices a TikTok post carries, as TikTok's `post_info` names them. */
5511
5566
  tiktok?: MarketingPostTikTokSettings | null;
5567
+ /** The Instagram and Facebook extras: first comment, alt text, collaborators. */
5568
+ details?: MarketingPostDetails | null;
5569
+ /** The workspace's own labels for the post; never published. */
5570
+ tags?: string[];
5571
+ }
5572
+ /** What an Instagram or Facebook post carries beside its caption. */
5573
+ export interface MarketingPostDetails {
5574
+ first_comment?: string;
5575
+ alt_text?: string;
5576
+ collaborators?: string[];
5577
+ }
5578
+ /** The extras `marketing.create_post` and `marketing.save_post_draft` take. */
5579
+ export interface MarketingPostDetailChoices {
5580
+ first_comment?: string;
5581
+ alt_text?: string;
5582
+ collaborators?: string[];
5583
+ }
5584
+ /** A caption the AI wrote for one network. */
5585
+ export interface MarketingCaptionSuggestion {
5586
+ provider: string;
5587
+ caption: string;
5588
+ }
5589
+ /** A request for AI captions and, once done, one suggestion per network. */
5590
+ export interface MarketingCaptionDraft {
5591
+ id: string;
5592
+ status: "queued" | "done" | "failed";
5593
+ brief: string;
5594
+ tone: string;
5595
+ providers: string[];
5596
+ suggestions: MarketingCaptionSuggestion[];
5597
+ /** Starts with a code: allowance_used, not_configured or failed. */
5598
+ error: string;
5599
+ created_at: string;
5600
+ finished_at: string | null;
5601
+ }
5602
+ /** A generated picture or video request; url is set once it is done. */
5603
+ export interface MarketingGeneration {
5604
+ id: string;
5605
+ kind: "image" | "video";
5606
+ status: "queued" | "rendering" | "done" | "failed";
5607
+ prompt: string;
5608
+ url: string | null;
5609
+ error: string;
5610
+ created_at: string;
5611
+ }
5612
+ /** One weekly posting time: 0 Sunday … 6 Saturday, and a local "HH:MM". */
5613
+ export interface MarketingPostScheduleSlot {
5614
+ weekday: number;
5615
+ time: string;
5616
+ }
5617
+ /** An account's weekly posting times and the next one no post has taken. */
5618
+ export interface MarketingPostSchedule {
5619
+ channel_id: string;
5620
+ time_zone: string | null;
5621
+ slots: MarketingPostScheduleSlot[];
5622
+ next_slot: string | null;
5623
+ }
5624
+ /** A weekday and hour an account's published posts drew the most interactions at. */
5625
+ export interface MarketingBestTime {
5626
+ weekday: number;
5627
+ hour: number;
5628
+ posts: number;
5629
+ average_interactions: number;
5630
+ }
5631
+ /** The best times to post, best first, with how many posts they were read from. */
5632
+ export interface MarketingBestTimes {
5633
+ time_zone: string;
5634
+ sample: number;
5635
+ times: MarketingBestTime[];
5512
5636
  }
5513
5637
  /** Who can view a TikTok video, as TikTok's creator info offers the levels. */
5514
5638
  export type TikTokPrivacyLevel = "PUBLIC_TO_EVERYONE" | "MUTUAL_FOLLOW_FRIENDS" | "FOLLOWER_OF_CREATOR" | "SELF_ONLY";
@@ -5937,7 +6061,10 @@ export interface EmailMessage {
5937
6061
  provider: "gmail" | "outlook";
5938
6062
  thread_id?: string;
5939
6063
  direction: "inbound" | "outbound";
6064
+ /** The sender's address. */
5940
6065
  from: string;
6066
+ /** The From header's display name ("Anthropic"); absent when it names no one, or on mail synced before it was kept. */
6067
+ from_name?: string;
5941
6068
  to: string[];
5942
6069
  cc?: string[];
5943
6070
  subject: string;
@@ -5996,6 +6123,8 @@ export interface EmailMessageBody {
5996
6123
  account_id: string;
5997
6124
  direction: "inbound" | "outbound";
5998
6125
  from: string;
6126
+ /** The From header's display name; empty when it names no one. */
6127
+ from_name: string;
5999
6128
  to: string[];
6000
6129
  cc?: string[];
6001
6130
  subject: string;
@@ -6497,6 +6626,55 @@ export interface ChatApprovalOutcome {
6497
6626
  /** Present when approved but the call failed. */
6498
6627
  error?: string;
6499
6628
  }
6629
+ /** How an `askSession` stood when its wait ended. */
6630
+ export type SessionAskState = "answered" | "awaiting_approval" | "awaiting_input" | "working" | "failed";
6631
+ /**
6632
+ * What `askSession` answers: the question as a message in a session thread,
6633
+ * and how that session's run stood when the wait ended.
6634
+ */
6635
+ export interface SessionAsk {
6636
+ thread_id: string;
6637
+ /** The session the ask opened; absent when it went to a thread already open. */
6638
+ session_id?: string;
6639
+ /** The message sent; "" for a wait that sent none. */
6640
+ message_id: string;
6641
+ /** The session run the message reached; "" when none did yet. */
6642
+ run_id: string;
6643
+ state: SessionAskState;
6644
+ /** The answer's prose, markdown, when `state` is `answered`. */
6645
+ reply: string;
6646
+ /** The answer's json-render spec, when it drew one. */
6647
+ ui?: UISpec;
6648
+ /** The answer's Block Kit blocks, when it laid some out. */
6649
+ blocks?: MessageBlock[];
6650
+ /**
6651
+ * The action that waits for a person: decide it with `approveRun` /
6652
+ * `denyRun` on `run_id`, the run that holds it (the session's own, or a
6653
+ * specialist's it called).
6654
+ */
6655
+ approval?: {
6656
+ id: string;
6657
+ run_id: string;
6658
+ tool: string;
6659
+ input: Json;
6660
+ };
6661
+ /** The questions the run asked: answer with `answerRun`, or by writing in the thread. */
6662
+ questions?: RunQuestion[];
6663
+ /** What the run waits on was pending before this message: the message waits behind it. */
6664
+ queued: boolean;
6665
+ /** Why the run failed: `ai_allowance_used` when the plan refused the model. */
6666
+ error?: {
6667
+ code: string;
6668
+ message: string;
6669
+ };
6670
+ }
6671
+ /**
6672
+ * One frame of a chat thread's own stream (`streamThread`): a piece of the
6673
+ * answer a run is writing, or a run step's end.
6674
+ */
6675
+ export type ThreadStreamEvent = Extract<RealtimeEvent, {
6676
+ type: "run" | "run_delta";
6677
+ }>;
6500
6678
  export interface OverviewChatResponse {
6501
6679
  reply: string;
6502
6680
  /**
@@ -7732,12 +7910,68 @@ export interface NemphiClient {
7732
7910
  media_urls?: string[];
7733
7911
  media_type?: MarketingPost["media_type"];
7734
7912
  scheduled_at?: string;
7735
- } & TikTokPostChoices): Promise<{
7913
+ /** Per-account captions keyed by channel id; an account named here gets its own text. */
7914
+ captions?: Record<string, string>;
7915
+ /** Schedule each account's post for its next free posting time instead of scheduled_at. */
7916
+ queue?: boolean;
7917
+ } & TikTokPostChoices & MarketingPostDetailChoices): Promise<{
7736
7918
  batch_id: string;
7737
7919
  posts: MarketingPost[];
7738
7920
  note?: string;
7739
7921
  }>;
7740
7922
  getTikTokCreatorInfo(channelId: string): Promise<TikTokCreatorInfo>;
7923
+ writeMarketingCaptions(input: {
7924
+ brief: string;
7925
+ providers: string[];
7926
+ tone?: "friendly" | "professional" | "playful" | "bold";
7927
+ language?: string;
7928
+ current_caption?: string;
7929
+ }): Promise<MarketingCaptionDraft>;
7930
+ getMarketingCaptionDraft(draftId: string): Promise<MarketingCaptionDraft>;
7931
+ generateMarketingImage(input: {
7932
+ prompt: string;
7933
+ orientation?: "square" | "portrait" | "landscape";
7934
+ }): Promise<MarketingGeneration>;
7935
+ listMarketingGenerations(input?: {
7936
+ kind?: "image" | "video";
7937
+ status?: MarketingGeneration["status"];
7938
+ }): Promise<MarketingGeneration[]>;
7939
+ listMarketingPostSchedules(): Promise<MarketingPostSchedule[]>;
7940
+ setMarketingPostSchedule(input: {
7941
+ channel_id: string;
7942
+ time_zone: string;
7943
+ slots: MarketingPostScheduleSlot[];
7944
+ }): Promise<MarketingPostSchedule>;
7945
+ getMarketingBestPostTimes(input: {
7946
+ channel_id: string;
7947
+ time_zone?: string;
7948
+ }): Promise<MarketingBestTimes>;
7949
+ setMarketingPostTags(input: {
7950
+ post_id: string;
7951
+ tags: string[];
7952
+ }): Promise<MarketingPost>;
7953
+ listMarketingPostNotes(postId: string): Promise<MarketingPostNote[]>;
7954
+ addMarketingPostNote(input: {
7955
+ post_id: string;
7956
+ body: string;
7957
+ }): Promise<MarketingPostNote>;
7958
+ listMarketingSnippets(input?: {
7959
+ kind?: MarketingSnippet["kind"];
7960
+ }): Promise<MarketingSnippet[]>;
7961
+ saveMarketingSnippet(input: {
7962
+ id?: string;
7963
+ kind: MarketingSnippet["kind"];
7964
+ name: string;
7965
+ body: string;
7966
+ }): Promise<MarketingSnippet>;
7967
+ deleteMarketingSnippet(id: string): Promise<MarketingSnippet>;
7968
+ listMarketingIdeas(): Promise<MarketingIdea[]>;
7969
+ saveMarketingIdea(input: {
7970
+ id?: string;
7971
+ title: string;
7972
+ notes?: string;
7973
+ }): Promise<MarketingIdea>;
7974
+ deleteMarketingIdea(id: string): Promise<MarketingIdea>;
7741
7975
  listMarketingPostRevisions(input: {
7742
7976
  post_id: string;
7743
7977
  before_version?: number;
@@ -7765,7 +7999,7 @@ export interface NemphiClient {
7765
7999
  caption?: string;
7766
8000
  media_type?: MarketingPost["media_type"];
7767
8001
  media_urls?: string[];
7768
- } & TikTokPostChoices): Promise<{
8002
+ } & TikTokPostChoices & MarketingPostDetailChoices): Promise<{
7769
8003
  post: MarketingPost;
7770
8004
  }>;
7771
8005
  submitMarketingPost(postId: string): Promise<{
@@ -7846,6 +8080,28 @@ export interface NemphiClient {
7846
8080
  conversation_id: string;
7847
8081
  body: string;
7848
8082
  }): Promise<MarketingMessage>;
8083
+ listMarketingComments(input?: {
8084
+ channel_id?: string;
8085
+ post_id?: string;
8086
+ limit?: number;
8087
+ }): Promise<MarketingComment[]>;
8088
+ replyToMarketingComment(input: {
8089
+ comment_id: string;
8090
+ body: string;
8091
+ }): Promise<MarketingComment>;
8092
+ hideMarketingComment(input: {
8093
+ comment_id: string;
8094
+ hidden: boolean;
8095
+ }): Promise<MarketingComment>;
8096
+ assignMarketingConversation(input: {
8097
+ conversation_id: string;
8098
+ assignee_user_id?: string;
8099
+ }): Promise<MarketingConversation>;
8100
+ listMarketingConversationNotes(conversationId: string): Promise<MarketingConversationNote[]>;
8101
+ addMarketingConversationNote(input: {
8102
+ conversation_id: string;
8103
+ body: string;
8104
+ }): Promise<MarketingConversationNote>;
7849
8105
  linkMarketingConversationParty(input: {
7850
8106
  conversation_id: string;
7851
8107
  party_id: string;
@@ -8642,6 +8898,34 @@ export interface NemphiClient {
8642
8898
  * same route through its own server route.
8643
8899
  */
8644
8900
  openRealtimeSocket(options: RealtimeSocketOptions): RealtimeSocket;
8901
+ /**
8902
+ * One chat thread's own stream (`GET /v1/threads/{id}/stream`), for a
8903
+ * member who sits in it: the answers its agent runs are writing
8904
+ * (`run_delta`) and each run step's end (`run`). It opens the stream
8905
+ * again with backoff whenever it drops or the server ends it, until
8906
+ * `signal` aborts; a refusal that will not change (401, 403, the thread
8907
+ * not found as 404) throws an `ApiError`.
8908
+ *
8909
+ * Every connection first replays the turn being written, so a reader
8910
+ * that reconnects mid-answer has all of it. Fold the pieces by
8911
+ * `(seq, n)`: a later `seq` starts the run's text over, a piece already
8912
+ * held (the same `seq`, an `n` at or below the last) changes nothing.
8913
+ * The answer itself always lands as a message; a `run` frame whose
8914
+ * outcome is `continue` or `parked` means the text so far was preamble.
8915
+ * A step that ended while the stream was down is not replayed, so
8916
+ * `onOpen` after the first is the moment to re-read the thread.
8917
+ *
8918
+ * `follow: false` reads the replay alone and ends: the turns being
8919
+ * written right now, for a reader that takes the live frames from
8920
+ * `openRealtimeSocket`.
8921
+ */
8922
+ streamThread(threadId: string, opts?: {
8923
+ signal?: AbortSignal;
8924
+ /** Called each time the stream answers. */
8925
+ onOpen?: () => void;
8926
+ /** False reads the replay once and ends; true (the default) follows the thread. */
8927
+ follow?: boolean;
8928
+ }): AsyncGenerator<ThreadStreamEvent, void, void>;
8645
8929
  /** Say the caller is writing in a thread or an inbox conversation (`POST /v1/events/typing`); nothing is stored. */
8646
8930
  sendTyping(input: {
8647
8931
  scope: TypingScope;
@@ -9195,6 +9479,23 @@ export interface NemphiClient {
9195
9479
  kind?: FeatureKind;
9196
9480
  only_unused?: boolean;
9197
9481
  }): Promise<FeatureUsageResponse>;
9482
+ /**
9483
+ * Asks the orchestrator one question as a message in a session thread
9484
+ * (a new session, or `thread_id` to carry one on) and waits for that
9485
+ * session's run: its whole answer, the approval or questions it parked
9486
+ * on, or `working` once `wait_ms` (at most 55 000; 25 000 by default)
9487
+ * runs out, when the reply lands in the thread. With `thread_id` and no
9488
+ * `text` it sends nothing and waits on the thread as it stands: the
9489
+ * answer once an approval is decided. Follow the thread live with
9490
+ * `streamThread`.
9491
+ */
9492
+ askSession(input: {
9493
+ text?: string;
9494
+ thread_id?: string;
9495
+ context?: string;
9496
+ document_ids?: string[];
9497
+ wait_ms?: number;
9498
+ }): Promise<SessionAsk>;
9198
9499
  overviewChat(input: {
9199
9500
  messages: ChatMessage[];
9200
9501
  }): Promise<OverviewChatResponse>;