samva 0.51.0 → 0.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/AGENTS.md +5 -2
  2. package/README.md +1 -0
  3. package/dist/client/sdk.gen.d.ts +67 -28
  4. package/dist/client/sdk.gen.js +157 -29
  5. package/dist/client/types.gen.d.ts +520 -281
  6. package/dist/effect/campaigns.d.ts +56 -56
  7. package/dist/effect/descriptors/integrations-catalog.d.ts +1 -1
  8. package/dist/effect/descriptors/integrations-catalog.js +1 -1
  9. package/dist/effect/descriptors/integrations.d.ts +1 -1
  10. package/dist/effect/descriptors/integrations.js +1 -1
  11. package/dist/effect/descriptors/logs.d.ts +21 -0
  12. package/dist/effect/descriptors/logs.js +23 -0
  13. package/dist/effect/descriptors/whats-app.d.ts +1 -1
  14. package/dist/effect/descriptors/whats-app.js +1 -1
  15. package/dist/effect/generated/agents.js +4 -4
  16. package/dist/effect/generated/campaigns.d.ts +18 -6
  17. package/dist/effect/generated/campaigns.js +2 -6
  18. package/dist/effect/generated/email.js +3 -3
  19. package/dist/effect/generated/index.d.ts +3 -1
  20. package/dist/effect/generated/integrations-catalog.d.ts +93 -49
  21. package/dist/effect/generated/integrations-catalog.js +17 -28
  22. package/dist/effect/generated/integrations.d.ts +20 -40
  23. package/dist/effect/generated/integrations.js +9 -13
  24. package/dist/effect/generated/journeys.d.ts +61 -13
  25. package/dist/effect/generated/journeys.js +5 -5
  26. package/dist/effect/generated/logs.d.ts +2311 -0
  27. package/dist/effect/generated/logs.js +312 -0
  28. package/dist/effect/generated/mailboxes.d.ts +30 -24
  29. package/dist/effect/generated/mailboxes.js +20 -20
  30. package/dist/effect/generated/messages.d.ts +1 -882
  31. package/dist/effect/generated/messages.js +4 -243
  32. package/dist/effect/generated/newsletter-domains.d.ts +61 -13
  33. package/dist/effect/generated/newsletter-domains.js +5 -5
  34. package/dist/effect/generated/newsletter-issues.d.ts +166 -34
  35. package/dist/effect/generated/newsletter-issues.js +12 -12
  36. package/dist/effect/generated/newsletters.d.ts +76 -16
  37. package/dist/effect/generated/newsletters.js +6 -6
  38. package/dist/effect/generated/organizations.js +1 -1
  39. package/dist/effect/generated/scheduled-messages.js +1 -1
  40. package/dist/effect/generated/shared.d.ts +1138 -257
  41. package/dist/effect/generated/shared.js +321 -82
  42. package/dist/effect/generated/subscriptions.d.ts +4 -4
  43. package/dist/effect/generated/subscriptions.js +2 -6
  44. package/dist/effect/generated/template-registrations.d.ts +46 -10
  45. package/dist/effect/generated/template-registrations.js +4 -4
  46. package/dist/effect/generated/templates.js +2 -2
  47. package/dist/effect/generated/whats-app-flows.d.ts +151 -31
  48. package/dist/effect/generated/whats-app-flows.js +11 -11
  49. package/dist/effect/generated/whats-app-setup-links.d.ts +61 -13
  50. package/dist/effect/generated/whats-app-setup-links.js +5 -5
  51. package/dist/effect/generated/whats-app.d.ts +187 -65
  52. package/dist/effect/generated/whats-app.js +18 -24
  53. package/dist/effect/generated-metadata.d.ts +15 -3
  54. package/dist/effect/generated-metadata.js +375 -349
  55. package/dist/effect/index.d.ts +1 -0
  56. package/dist/effect/index.js +2 -1
  57. package/dist/effect/integrations-catalog.d.ts +92 -4
  58. package/dist/effect/integrations.d.ts +40 -8
  59. package/dist/effect/internal/client.js +25 -3
  60. package/dist/effect/internal/log-events.d.ts +19 -0
  61. package/dist/effect/internal/log-events.js +53 -0
  62. package/dist/effect/internal/mailbox-events.d.ts +6 -2
  63. package/dist/effect/internal/mailbox-events.js +4 -3
  64. package/dist/effect/journeys.d.ts +148 -148
  65. package/dist/effect/logs.d.ts +149 -0
  66. package/dist/effect/logs.js +18 -0
  67. package/dist/effect/mailboxes.d.ts +156 -150
  68. package/dist/effect/mailboxes.js +1 -1
  69. package/dist/effect/newsletter-domains.d.ts +2 -2
  70. package/dist/effect/whatsapp-setup-links.d.ts +2 -2
  71. package/dist/effect/whatsapp.d.ts +73 -3
  72. package/dist/mailbox-events.d.ts +50 -3
  73. package/dist/mailbox-events.js +38 -19
  74. package/dist/package.js +1 -1
  75. package/dist/promises/client.d.ts +3 -1
  76. package/dist/promises/client.js +3 -1
  77. package/dist/promises/errors.gen.d.ts +2 -0
  78. package/dist/promises/errors.gen.js +137 -34
  79. package/dist/promises/types.gen.d.ts +1 -1
  80. package/dist/request-id.d.ts +3 -0
  81. package/dist/request-id.js +7 -0
  82. package/dist/service-map.d.ts +14 -3
  83. package/package.json +6 -2
@@ -663,6 +663,7 @@ export declare const listOrganizationThreads: ((input?: {
663
663
  readonly unread?: boolean | null | undefined;
664
664
  readonly starred?: boolean | null | undefined;
665
665
  readonly snoozed?: boolean | null | undefined;
666
+ readonly order?: "wake" | undefined;
666
667
  readonly mailboxId?: string | readonly string[] | undefined;
667
668
  readonly kind?: "personal" | "shared" | undefined;
668
669
  readonly conversation?: string | undefined;
@@ -682,6 +683,7 @@ export declare const listOrganizationThreads: ((input?: {
682
683
  readonly unread?: boolean | null | undefined;
683
684
  readonly starred?: boolean | null | undefined;
684
685
  readonly snoozed?: boolean | null | undefined;
686
+ readonly order?: "wake" | undefined;
685
687
  readonly mailboxId?: string | readonly string[] | undefined;
686
688
  readonly kind?: "personal" | "shared" | undefined;
687
689
  readonly conversation?: string | undefined;
@@ -743,6 +745,7 @@ export declare const listOrganizationThreads: ((input?: {
743
745
  readonly unread?: boolean | null | undefined;
744
746
  readonly starred?: boolean | null | undefined;
745
747
  readonly snoozed?: boolean | null | undefined;
748
+ readonly order?: "wake" | undefined;
746
749
  readonly mailboxId?: string | readonly string[] | undefined;
747
750
  readonly kind?: "personal" | "shared" | undefined;
748
751
  readonly conversation?: string | undefined;
@@ -803,6 +806,7 @@ export declare const listThreads: ((input: {
803
806
  readonly unread?: boolean | null | undefined;
804
807
  readonly starred?: boolean | null | undefined;
805
808
  readonly snoozed?: boolean | null | undefined;
809
+ readonly order?: "wake" | undefined;
806
810
  }, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"mailboxesListThreads">) & {
807
811
  readonly pages: (input: {
808
812
  readonly id: string;
@@ -820,6 +824,7 @@ export declare const listThreads: ((input: {
820
824
  readonly unread?: boolean | null | undefined;
821
825
  readonly starred?: boolean | null | undefined;
822
826
  readonly snoozed?: boolean | null | undefined;
827
+ readonly order?: "wake" | undefined;
823
828
  }) => import("effect/Stream").Stream<{
824
829
  readonly items: readonly {
825
830
  readonly id: string & import("effect/Brand").Brand<"MailboxThreadId">;
@@ -874,6 +879,7 @@ export declare const listThreads: ((input: {
874
879
  readonly unread?: boolean | null | undefined;
875
880
  readonly starred?: boolean | null | undefined;
876
881
  readonly snoozed?: boolean | null | undefined;
882
+ readonly order?: "wake" | undefined;
877
883
  }) => import("effect/Stream").Stream<{
878
884
  readonly id: string & import("effect/Brand").Brand<"MailboxThreadId">;
879
885
  readonly channel: "email" | "sms" | "whatsapp";
@@ -1749,6 +1755,81 @@ export declare const listActions: ((input: {
1749
1755
  readonly before?: string | undefined;
1750
1756
  }) => import("effect/Stream").Stream<{
1751
1757
  readonly items: readonly ({
1758
+ readonly id: string & import("effect/Brand").Brand<"MailboxActionId">;
1759
+ readonly source: "aiSdkTool" | "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
1760
+ readonly proposedBy: {
1761
+ readonly kind: "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system" | "user";
1762
+ readonly id: string;
1763
+ readonly displayName?: string | null;
1764
+ };
1765
+ readonly threadId: (string & import("effect/Brand").Brand<"MailboxThreadId">) | null;
1766
+ readonly draftId: (string & import("effect/Brand").Brand<"MailboxDraftId">) | null;
1767
+ readonly decision: {
1768
+ readonly id: string & import("effect/Brand").Brand<"PolicyDecisionId">;
1769
+ readonly reviewRound: number;
1770
+ readonly requirement: "model" | "never" | "person" | "run";
1771
+ readonly decider: "agent" | "model" | "person" | "rule";
1772
+ readonly outcome: "allow" | "hold" | "refuse";
1773
+ readonly reason: string;
1774
+ readonly scopes: readonly {
1775
+ readonly kind: "agent" | "apiKey" | "integration" | "mailbox" | "organization";
1776
+ readonly id: string;
1777
+ }[];
1778
+ readonly rule?: {
1779
+ readonly scope: {
1780
+ readonly kind: "agent" | "apiKey" | "integration" | "mailbox" | "organization";
1781
+ readonly id: string;
1782
+ };
1783
+ readonly index: number;
1784
+ } | null;
1785
+ readonly guard?: string | null;
1786
+ readonly guardReason?: string | null;
1787
+ readonly resolution?: {
1788
+ readonly by: string & import("effect/Brand").Brand<"UserId">;
1789
+ readonly at: string;
1790
+ readonly as: "alwaysAllowed" | "approved" | "denied" | "edited";
1791
+ readonly diff?: {
1792
+ readonly text?: {
1793
+ readonly before: string | null;
1794
+ readonly after: string | null;
1795
+ } | null;
1796
+ readonly html?: {
1797
+ readonly before: string | null;
1798
+ readonly after: string | null;
1799
+ } | null;
1800
+ } | null;
1801
+ } | null;
1802
+ } | null;
1803
+ readonly resolution: {
1804
+ readonly outcome: "approved" | "cancelled" | "denied";
1805
+ readonly actor: {
1806
+ readonly kind: "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system" | "user";
1807
+ readonly id: string;
1808
+ readonly displayName?: string | null;
1809
+ readonly source: "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
1810
+ };
1811
+ readonly resolvedAt: string;
1812
+ readonly reason: string | null;
1813
+ } | null;
1814
+ readonly alwaysAllow: {
1815
+ readonly by: "admin" | "approver" | "owner";
1816
+ readonly allowed: boolean;
1817
+ } | null;
1818
+ readonly createdAt: string;
1819
+ readonly updatedAt: string;
1820
+ readonly type: "assignThread" | "call" | "changeThreadState" | "createNote" | "extensionRequest" | "handoff" | "toolCall" | "updateDraft";
1821
+ readonly state: "allowed" | "approvalDenied" | "approvalRequired" | "approved" | "executed" | "executing" | "failed" | "policyDenied" | "proposed";
1822
+ readonly tool: {
1823
+ readonly name: string;
1824
+ readonly argumentsHash: string;
1825
+ readonly arguments: {
1826
+ readonly [x: string]: import("./generated/index.js").JsonValue;
1827
+ };
1828
+ } | null;
1829
+ readonly handoff: {
1830
+ readonly reason: string;
1831
+ } | null;
1832
+ } | {
1752
1833
  readonly id: string & import("effect/Brand").Brand<"MailboxActionId">;
1753
1834
  readonly source: "aiSdkTool" | "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
1754
1835
  readonly proposedBy: {
@@ -1958,81 +2039,6 @@ export declare const listActions: ((input: {
1958
2039
  readonly conversationId: (string & import("effect/Brand").Brand<"ConversationId">) | null;
1959
2040
  readonly inReplyToMessageId: (string & import("effect/Brand").Brand<"MessageId">) | null;
1960
2041
  } | null;
1961
- } | {
1962
- readonly id: string & import("effect/Brand").Brand<"MailboxActionId">;
1963
- readonly source: "aiSdkTool" | "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
1964
- readonly proposedBy: {
1965
- readonly kind: "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system" | "user";
1966
- readonly id: string;
1967
- readonly displayName?: string | null;
1968
- };
1969
- readonly threadId: (string & import("effect/Brand").Brand<"MailboxThreadId">) | null;
1970
- readonly draftId: (string & import("effect/Brand").Brand<"MailboxDraftId">) | null;
1971
- readonly decision: {
1972
- readonly id: string & import("effect/Brand").Brand<"PolicyDecisionId">;
1973
- readonly reviewRound: number;
1974
- readonly requirement: "model" | "never" | "person" | "run";
1975
- readonly decider: "agent" | "model" | "person" | "rule";
1976
- readonly outcome: "allow" | "hold" | "refuse";
1977
- readonly reason: string;
1978
- readonly scopes: readonly {
1979
- readonly kind: "agent" | "apiKey" | "integration" | "mailbox" | "organization";
1980
- readonly id: string;
1981
- }[];
1982
- readonly rule?: {
1983
- readonly scope: {
1984
- readonly kind: "agent" | "apiKey" | "integration" | "mailbox" | "organization";
1985
- readonly id: string;
1986
- };
1987
- readonly index: number;
1988
- } | null;
1989
- readonly guard?: string | null;
1990
- readonly guardReason?: string | null;
1991
- readonly resolution?: {
1992
- readonly by: string & import("effect/Brand").Brand<"UserId">;
1993
- readonly at: string;
1994
- readonly as: "alwaysAllowed" | "approved" | "denied" | "edited";
1995
- readonly diff?: {
1996
- readonly text?: {
1997
- readonly before: string | null;
1998
- readonly after: string | null;
1999
- } | null;
2000
- readonly html?: {
2001
- readonly before: string | null;
2002
- readonly after: string | null;
2003
- } | null;
2004
- } | null;
2005
- } | null;
2006
- } | null;
2007
- readonly resolution: {
2008
- readonly outcome: "approved" | "cancelled" | "denied";
2009
- readonly actor: {
2010
- readonly kind: "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system" | "user";
2011
- readonly id: string;
2012
- readonly displayName?: string | null;
2013
- readonly source: "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
2014
- };
2015
- readonly resolvedAt: string;
2016
- readonly reason: string | null;
2017
- } | null;
2018
- readonly alwaysAllow: {
2019
- readonly by: "admin" | "approver" | "owner";
2020
- readonly allowed: boolean;
2021
- } | null;
2022
- readonly createdAt: string;
2023
- readonly updatedAt: string;
2024
- readonly type: "assignThread" | "call" | "changeThreadState" | "createNote" | "extensionRequest" | "handoff" | "toolCall" | "updateDraft";
2025
- readonly state: "allowed" | "approvalDenied" | "approvalRequired" | "approved" | "executed" | "executing" | "failed" | "policyDenied" | "proposed";
2026
- readonly tool: {
2027
- readonly name: string;
2028
- readonly argumentsHash: string;
2029
- readonly arguments: {
2030
- readonly [x: string]: import("./generated/index.js").JsonValue;
2031
- };
2032
- } | null;
2033
- readonly handoff: {
2034
- readonly reason: string;
2035
- } | null;
2036
2042
  })[];
2037
2043
  readonly nextCursor: string | null;
2038
2044
  }, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").ResourceNotFoundError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
@@ -2045,6 +2051,81 @@ export declare const listActions: ((input: {
2045
2051
  readonly after?: string | undefined;
2046
2052
  readonly before?: string | undefined;
2047
2053
  }) => import("effect/Stream").Stream<{
2054
+ readonly id: string & import("effect/Brand").Brand<"MailboxActionId">;
2055
+ readonly source: "aiSdkTool" | "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
2056
+ readonly proposedBy: {
2057
+ readonly kind: "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system" | "user";
2058
+ readonly id: string;
2059
+ readonly displayName?: string | null;
2060
+ };
2061
+ readonly threadId: (string & import("effect/Brand").Brand<"MailboxThreadId">) | null;
2062
+ readonly draftId: (string & import("effect/Brand").Brand<"MailboxDraftId">) | null;
2063
+ readonly decision: {
2064
+ readonly id: string & import("effect/Brand").Brand<"PolicyDecisionId">;
2065
+ readonly reviewRound: number;
2066
+ readonly requirement: "model" | "never" | "person" | "run";
2067
+ readonly decider: "agent" | "model" | "person" | "rule";
2068
+ readonly outcome: "allow" | "hold" | "refuse";
2069
+ readonly reason: string;
2070
+ readonly scopes: readonly {
2071
+ readonly kind: "agent" | "apiKey" | "integration" | "mailbox" | "organization";
2072
+ readonly id: string;
2073
+ }[];
2074
+ readonly rule?: {
2075
+ readonly scope: {
2076
+ readonly kind: "agent" | "apiKey" | "integration" | "mailbox" | "organization";
2077
+ readonly id: string;
2078
+ };
2079
+ readonly index: number;
2080
+ } | null;
2081
+ readonly guard?: string | null;
2082
+ readonly guardReason?: string | null;
2083
+ readonly resolution?: {
2084
+ readonly by: string & import("effect/Brand").Brand<"UserId">;
2085
+ readonly at: string;
2086
+ readonly as: "alwaysAllowed" | "approved" | "denied" | "edited";
2087
+ readonly diff?: {
2088
+ readonly text?: {
2089
+ readonly before: string | null;
2090
+ readonly after: string | null;
2091
+ } | null;
2092
+ readonly html?: {
2093
+ readonly before: string | null;
2094
+ readonly after: string | null;
2095
+ } | null;
2096
+ } | null;
2097
+ } | null;
2098
+ } | null;
2099
+ readonly resolution: {
2100
+ readonly outcome: "approved" | "cancelled" | "denied";
2101
+ readonly actor: {
2102
+ readonly kind: "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system" | "user";
2103
+ readonly id: string;
2104
+ readonly displayName?: string | null;
2105
+ readonly source: "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
2106
+ };
2107
+ readonly resolvedAt: string;
2108
+ readonly reason: string | null;
2109
+ } | null;
2110
+ readonly alwaysAllow: {
2111
+ readonly by: "admin" | "approver" | "owner";
2112
+ readonly allowed: boolean;
2113
+ } | null;
2114
+ readonly createdAt: string;
2115
+ readonly updatedAt: string;
2116
+ readonly type: "assignThread" | "call" | "changeThreadState" | "createNote" | "extensionRequest" | "handoff" | "toolCall" | "updateDraft";
2117
+ readonly state: "allowed" | "approvalDenied" | "approvalRequired" | "approved" | "executed" | "executing" | "failed" | "policyDenied" | "proposed";
2118
+ readonly tool: {
2119
+ readonly name: string;
2120
+ readonly argumentsHash: string;
2121
+ readonly arguments: {
2122
+ readonly [x: string]: import("./generated/index.js").JsonValue;
2123
+ };
2124
+ } | null;
2125
+ readonly handoff: {
2126
+ readonly reason: string;
2127
+ } | null;
2128
+ } | {
2048
2129
  readonly id: string & import("effect/Brand").Brand<"MailboxActionId">;
2049
2130
  readonly source: "aiSdkTool" | "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
2050
2131
  readonly proposedBy: {
@@ -2254,81 +2335,6 @@ export declare const listActions: ((input: {
2254
2335
  readonly conversationId: (string & import("effect/Brand").Brand<"ConversationId">) | null;
2255
2336
  readonly inReplyToMessageId: (string & import("effect/Brand").Brand<"MessageId">) | null;
2256
2337
  } | null;
2257
- } | {
2258
- readonly id: string & import("effect/Brand").Brand<"MailboxActionId">;
2259
- readonly source: "aiSdkTool" | "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
2260
- readonly proposedBy: {
2261
- readonly kind: "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system" | "user";
2262
- readonly id: string;
2263
- readonly displayName?: string | null;
2264
- };
2265
- readonly threadId: (string & import("effect/Brand").Brand<"MailboxThreadId">) | null;
2266
- readonly draftId: (string & import("effect/Brand").Brand<"MailboxDraftId">) | null;
2267
- readonly decision: {
2268
- readonly id: string & import("effect/Brand").Brand<"PolicyDecisionId">;
2269
- readonly reviewRound: number;
2270
- readonly requirement: "model" | "never" | "person" | "run";
2271
- readonly decider: "agent" | "model" | "person" | "rule";
2272
- readonly outcome: "allow" | "hold" | "refuse";
2273
- readonly reason: string;
2274
- readonly scopes: readonly {
2275
- readonly kind: "agent" | "apiKey" | "integration" | "mailbox" | "organization";
2276
- readonly id: string;
2277
- }[];
2278
- readonly rule?: {
2279
- readonly scope: {
2280
- readonly kind: "agent" | "apiKey" | "integration" | "mailbox" | "organization";
2281
- readonly id: string;
2282
- };
2283
- readonly index: number;
2284
- } | null;
2285
- readonly guard?: string | null;
2286
- readonly guardReason?: string | null;
2287
- readonly resolution?: {
2288
- readonly by: string & import("effect/Brand").Brand<"UserId">;
2289
- readonly at: string;
2290
- readonly as: "alwaysAllowed" | "approved" | "denied" | "edited";
2291
- readonly diff?: {
2292
- readonly text?: {
2293
- readonly before: string | null;
2294
- readonly after: string | null;
2295
- } | null;
2296
- readonly html?: {
2297
- readonly before: string | null;
2298
- readonly after: string | null;
2299
- } | null;
2300
- } | null;
2301
- } | null;
2302
- } | null;
2303
- readonly resolution: {
2304
- readonly outcome: "approved" | "cancelled" | "denied";
2305
- readonly actor: {
2306
- readonly kind: "apiKey" | "extension" | "externalAgent" | "samvaAgent" | "system" | "user";
2307
- readonly id: string;
2308
- readonly displayName?: string | null;
2309
- readonly source: "extension" | "externalAgent" | "externalApi" | "humanUi" | "samvaManagedAgent" | "system";
2310
- };
2311
- readonly resolvedAt: string;
2312
- readonly reason: string | null;
2313
- } | null;
2314
- readonly alwaysAllow: {
2315
- readonly by: "admin" | "approver" | "owner";
2316
- readonly allowed: boolean;
2317
- } | null;
2318
- readonly createdAt: string;
2319
- readonly updatedAt: string;
2320
- readonly type: "assignThread" | "call" | "changeThreadState" | "createNote" | "extensionRequest" | "handoff" | "toolCall" | "updateDraft";
2321
- readonly state: "allowed" | "approvalDenied" | "approvalRequired" | "approved" | "executed" | "executing" | "failed" | "policyDenied" | "proposed";
2322
- readonly tool: {
2323
- readonly name: string;
2324
- readonly argumentsHash: string;
2325
- readonly arguments: {
2326
- readonly [x: string]: import("./generated/index.js").JsonValue;
2327
- };
2328
- } | null;
2329
- readonly handoff: {
2330
- readonly reason: string;
2331
- } | null;
2332
2338
  }, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").ResourceNotFoundError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
2333
2339
  };
2334
2340
  export declare const getAction: (input: {
@@ -1,9 +1,9 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { MailboxEventStreamError } from "../mailbox-events.js";
3
3
  import { forGroup } from "./internal/operation.js";
4
+ import { events } from "./internal/mailbox-events.js";
4
5
  import { mailboxesOperations } from "./descriptors/mailboxes.js";
5
6
  import { MailboxesGroup } from "./generated/mailboxes.js";
6
- import { events } from "./internal/mailbox-events.js";
7
7
  // src/effect/mailboxes.ts
8
8
  var mailboxes_exports = /* @__PURE__ */ __exportAll({
9
9
  MailboxEventStreamError: () => MailboxEventStreamError,
@@ -30,7 +30,7 @@ export declare const list: ((input: {
30
30
  readonly verificationErrors: readonly string[];
31
31
  }[];
32
32
  readonly nextCursor: string | null;
33
- }, import("./errors.js").ConflictError | import("./errors.js").FlagDisabledError | import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").ResourceNotFoundError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
33
+ }, import("./errors.js").ConflictError | import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").ResourceNotFoundError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
34
34
  readonly items: (input: {
35
35
  readonly id: string;
36
36
  readonly limit?: number | null | undefined;
@@ -55,7 +55,7 @@ export declare const list: ((input: {
55
55
  readonly value: string;
56
56
  }[];
57
57
  readonly verificationErrors: readonly string[];
58
- }, import("./errors.js").ConflictError | import("./errors.js").FlagDisabledError | import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").ResourceNotFoundError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
58
+ }, import("./errors.js").ConflictError | import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").ResourceNotFoundError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
59
59
  };
60
60
  export declare const add: (input: {
61
61
  readonly id: string;
@@ -35,7 +35,7 @@ export declare const list: ((input?: {
35
35
  readonly updatedAt: string;
36
36
  }[];
37
37
  readonly nextCursor: string | null;
38
- }, import("./errors.js").FlagDisabledError | import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
38
+ }, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
39
39
  readonly items: (input?: {
40
40
  readonly limit?: number | null | undefined;
41
41
  readonly cursor?: string | undefined;
@@ -56,7 +56,7 @@ export declare const list: ((input?: {
56
56
  readonly revokedAt: string | null;
57
57
  readonly createdAt: string;
58
58
  readonly updatedAt: string;
59
- }, import("./errors.js").FlagDisabledError | import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
59
+ }, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
60
60
  };
61
61
  export declare const get: (input: {
62
62
  readonly linkId: string;
@@ -19,13 +19,83 @@ export declare const getServiceWindowBilling: (input: {
19
19
  export declare const getMediaDownloadUrl: (input: {
20
20
  readonly deliveryId: string;
21
21
  }, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappGetMediaDownloadUrl">;
22
- export declare const listBusinessAccounts: (input?: {
23
- readonly page?: number | null | undefined;
22
+ export declare const listBusinessAccounts: ((input?: {
24
23
  readonly limit?: number | null | undefined;
24
+ readonly cursor?: string | undefined;
25
25
  readonly isActive?: boolean | null | undefined;
26
26
  readonly verificationStatus?: "failed" | "pending" | "suspended" | "verified" | undefined;
27
27
  readonly namespaceId?: string | undefined;
28
- } | undefined, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappListBusinessAccounts">;
28
+ } | undefined, options?: import("./internal/operation.js").OperationOptions) => import("./internal/client.js").OperationResult<"whatsappListBusinessAccounts">) & {
29
+ readonly pages: (input?: {
30
+ readonly limit?: number | null | undefined;
31
+ readonly cursor?: string | undefined;
32
+ readonly isActive?: boolean | null | undefined;
33
+ readonly verificationStatus?: "failed" | "pending" | "suspended" | "verified" | undefined;
34
+ readonly namespaceId?: string | undefined;
35
+ } | undefined) => import("effect/Stream").Stream<{
36
+ readonly items: readonly {
37
+ readonly id: string & import("effect/Brand").Brand<"WhatsAppBusinessAccountId">;
38
+ readonly organizationId: string;
39
+ readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
40
+ readonly phoneNumber: string;
41
+ readonly phoneNumberId: string;
42
+ readonly displayName: string;
43
+ readonly whatsappBusinessAccountId: string;
44
+ readonly verificationStatus: "failed" | "pending" | "suspended" | "verified";
45
+ readonly credentialStatus: "active" | "reconnect_required";
46
+ readonly tokenExpiresAt: string | null;
47
+ readonly isDefault: boolean;
48
+ readonly webhookUrl: string | null;
49
+ readonly qualityRating: "green" | "red" | "unknown" | "yellow";
50
+ readonly messagingLimit: string | null;
51
+ readonly currentLimit: number;
52
+ readonly businessPortfolioId: string | null;
53
+ readonly businessAppConnectedAt: string | null;
54
+ readonly businessAppDisconnectedAt: string | null;
55
+ readonly businessAppDisconnectReason: "accountDisconnected" | "businessDowngrade" | "changeNumber" | "companionInactivity" | "offboarded" | "partnerRemoved" | "primaryInactivity" | "userReRegistered" | null;
56
+ readonly contactsSyncRequestedAt: string | null;
57
+ readonly historySyncStatus: "completed" | "declined" | "importing" | "requested" | null;
58
+ readonly historySyncProgress: number | null;
59
+ readonly isActive: boolean;
60
+ readonly createdAt: string;
61
+ readonly updatedAt: string;
62
+ }[];
63
+ readonly nextCursor: string | null;
64
+ }, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
65
+ readonly items: (input?: {
66
+ readonly limit?: number | null | undefined;
67
+ readonly cursor?: string | undefined;
68
+ readonly isActive?: boolean | null | undefined;
69
+ readonly verificationStatus?: "failed" | "pending" | "suspended" | "verified" | undefined;
70
+ readonly namespaceId?: string | undefined;
71
+ } | undefined) => import("effect/Stream").Stream<{
72
+ readonly id: string & import("effect/Brand").Brand<"WhatsAppBusinessAccountId">;
73
+ readonly organizationId: string;
74
+ readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
75
+ readonly phoneNumber: string;
76
+ readonly phoneNumberId: string;
77
+ readonly displayName: string;
78
+ readonly whatsappBusinessAccountId: string;
79
+ readonly verificationStatus: "failed" | "pending" | "suspended" | "verified";
80
+ readonly credentialStatus: "active" | "reconnect_required";
81
+ readonly tokenExpiresAt: string | null;
82
+ readonly isDefault: boolean;
83
+ readonly webhookUrl: string | null;
84
+ readonly qualityRating: "green" | "red" | "unknown" | "yellow";
85
+ readonly messagingLimit: string | null;
86
+ readonly currentLimit: number;
87
+ readonly businessPortfolioId: string | null;
88
+ readonly businessAppConnectedAt: string | null;
89
+ readonly businessAppDisconnectedAt: string | null;
90
+ readonly businessAppDisconnectReason: "accountDisconnected" | "businessDowngrade" | "changeNumber" | "companionInactivity" | "offboarded" | "partnerRemoved" | "primaryInactivity" | "userReRegistered" | null;
91
+ readonly contactsSyncRequestedAt: string | null;
92
+ readonly historySyncStatus: "completed" | "declined" | "importing" | "requested" | null;
93
+ readonly historySyncProgress: number | null;
94
+ readonly isActive: boolean;
95
+ readonly createdAt: string;
96
+ readonly updatedAt: string;
97
+ }, import("./errors.js").ForbiddenError | import("./errors.js").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors.js").InternalError | import("./errors.js").MalformedRequestError | import("./errors.js").SamvaTimeoutError | import("effect/Schema").SchemaError | import("./errors.js").UnauthorizedError | import("./errors.js").ValidationError, import("./client.js").Service>;
98
+ };
29
99
  export declare const connectBusinessAccount: (input: {
30
100
  readonly code: string | import("effect/Redacted").Redacted<string>;
31
101
  readonly wabaId: string;
@@ -173,15 +173,56 @@ export declare const MAILBOX_EVENT_STREAM_PING_MILLIS = 30000;
173
173
  * indistinguishable from a quiet mailbox.
174
174
  */
175
175
  export declare const MAILBOX_EVENT_STREAM_IDLE_MILLIS: number;
176
+ export type EventStreamFrame = {
177
+ readonly kind: "event";
178
+ readonly cursor: string;
179
+ readonly id: string;
180
+ readonly event: {
181
+ readonly type: string;
182
+ readonly timestamp: string;
183
+ readonly data: unknown;
184
+ readonly match: unknown;
185
+ };
186
+ } | {
187
+ readonly kind: "live" | "progress";
188
+ readonly cursor: string;
189
+ } | {
190
+ readonly kind: "pong";
191
+ };
176
192
  /** The events URL for an API origin: `https://api.samva.dev` → `wss://events.samva.dev/v1/…`. */
193
+ export declare const eventStreamUrl: (connection: Pick<MailboxEventStreamConnection, "baseUrl">, options: Pick<MailboxEventStreamOptions, "eventsUrl" | "cursor" | "mailboxIds">, path?: string) => URL;
177
194
  export declare const mailboxEventsUrl: (connection: Pick<MailboxEventStreamConnection, "baseUrl">, options: Pick<MailboxEventStreamOptions, "eventsUrl" | "cursor" | "mailboxIds">) => URL;
195
+ /** A failure and whether the stream may try again after it. */
196
+ interface Outcome {
197
+ readonly error: MailboxEventStreamError;
198
+ readonly retry: boolean;
199
+ readonly retryAfterMillis?: number | undefined;
200
+ }
201
+ /** A refused upgrade, as the plain GET that follows it read it. */
202
+ interface Refusal {
203
+ readonly status: number;
204
+ readonly body: unknown;
205
+ readonly retryAfterSeconds: number | undefined;
206
+ }
207
+ /**
208
+ * What a refusal means for the stream. Every 4xx except `408` and `429` ends it: the host will
209
+ * keep refusing the same request. `5xx`, `408`, and `429` retry, after the delay the host asked
210
+ * for when it asked for one.
211
+ */
212
+ export declare const refusalOutcome: (refusal: Refusal) => Outcome;
178
213
  /**
179
214
  * A resumable stream of mailbox events. Iterate it with `for await`; break out of the loop or call
180
215
  * {@link close} to end it.
181
216
  */
182
- export declare class MailboxEventStream implements AsyncIterable<MailboxEvent> {
217
+ export declare class EventStream<Event extends {
218
+ readonly cursor: string;
219
+ }> implements AsyncIterable<Event> {
183
220
  #private;
184
- constructor(connection: MailboxEventStreamConnection, options?: MailboxEventStreamOptions);
221
+ private readonly path;
222
+ private readonly readEvent;
223
+ constructor(connection: MailboxEventStreamConnection, options: MailboxEventStreamOptions, path: string, readEvent: (frame: Extract<EventStreamFrame, {
224
+ kind: "event";
225
+ }>) => Event | undefined);
185
226
  /**
186
227
  * The position to resume from: the last handled event's cursor, or a later position the
187
228
  * server confirmed with nothing in between for this stream. Undefined until there is one.
@@ -197,5 +238,11 @@ export declare class MailboxEventStream implements AsyncIterable<MailboxEvent> {
197
238
  * {@link markHandled} was called, so a resume repeats it. A pending iteration finishes.
198
239
  */
199
240
  close(): void;
200
- [Symbol.asyncIterator](): AsyncIterator<MailboxEvent>;
241
+ [Symbol.asyncIterator](): AsyncIterator<Event>;
242
+ }
243
+ /** The refusal's JSON body, or undefined when it is not JSON; reads at most {@link REFUSAL_BODY_LIMIT}. */
244
+ export declare const readRefusalBody: (response: Response) => Promise<unknown>;
245
+ export declare class MailboxEventStream extends EventStream<MailboxEvent> {
246
+ constructor(connection: MailboxEventStreamConnection, options?: MailboxEventStreamOptions);
201
247
  }
248
+ export {};