@mobilerun/sdk 6.1.0 → 6.1.1

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 (275) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +3 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agents/agents.d.mts +307 -0
  12. package/resources/agents/agents.d.mts.map +1 -0
  13. package/resources/agents/agents.d.ts +307 -0
  14. package/resources/agents/agents.d.ts.map +1 -0
  15. package/resources/agents/agents.js +56 -0
  16. package/resources/agents/agents.js.map +1 -0
  17. package/resources/agents/agents.mjs +51 -0
  18. package/resources/agents/agents.mjs.map +1 -0
  19. package/resources/agents/conversations.d.mts +110 -0
  20. package/resources/agents/conversations.d.mts.map +1 -0
  21. package/resources/agents/conversations.d.ts +110 -0
  22. package/resources/agents/conversations.d.ts.map +1 -0
  23. package/resources/agents/conversations.js +24 -0
  24. package/resources/agents/conversations.js.map +1 -0
  25. package/resources/agents/conversations.mjs +20 -0
  26. package/resources/agents/conversations.mjs.map +1 -0
  27. package/resources/agents/files.d.mts +64 -0
  28. package/resources/agents/files.d.mts.map +1 -0
  29. package/resources/agents/files.d.ts +64 -0
  30. package/resources/agents/files.d.ts.map +1 -0
  31. package/resources/agents/files.js +16 -0
  32. package/resources/agents/files.js.map +1 -0
  33. package/resources/agents/files.mjs +12 -0
  34. package/resources/agents/files.mjs.map +1 -0
  35. package/resources/agents/index.d.mts +7 -0
  36. package/resources/agents/index.d.mts.map +1 -0
  37. package/resources/agents/index.d.ts +7 -0
  38. package/resources/agents/index.d.ts.map +1 -0
  39. package/resources/agents/index.js +17 -0
  40. package/resources/agents/index.js.map +1 -0
  41. package/resources/agents/index.mjs +8 -0
  42. package/resources/agents/index.mjs.map +1 -0
  43. package/resources/agents/profile.d.mts +156 -0
  44. package/resources/agents/profile.d.mts.map +1 -0
  45. package/resources/agents/profile.d.ts +156 -0
  46. package/resources/agents/profile.d.ts.map +1 -0
  47. package/resources/agents/profile.js +19 -0
  48. package/resources/agents/profile.js.map +1 -0
  49. package/resources/agents/profile.mjs +15 -0
  50. package/resources/agents/profile.mjs.map +1 -0
  51. package/resources/agents/requests.d.mts +295 -0
  52. package/resources/agents/requests.d.mts.map +1 -0
  53. package/resources/agents/requests.d.ts +295 -0
  54. package/resources/agents/requests.d.ts.map +1 -0
  55. package/resources/agents/requests.js +42 -0
  56. package/resources/agents/requests.js.map +1 -0
  57. package/resources/agents/requests.mjs +38 -0
  58. package/resources/agents/requests.mjs.map +1 -0
  59. package/resources/agents/routines.d.mts +95 -0
  60. package/resources/agents/routines.d.mts.map +1 -0
  61. package/resources/agents/routines.d.ts +95 -0
  62. package/resources/agents/routines.d.ts.map +1 -0
  63. package/resources/agents/routines.js +26 -0
  64. package/resources/agents/routines.js.map +1 -0
  65. package/resources/agents/routines.mjs +22 -0
  66. package/resources/agents/routines.mjs.map +1 -0
  67. package/resources/agents.d.mts +2 -0
  68. package/resources/agents.d.mts.map +1 -0
  69. package/resources/agents.d.ts +2 -0
  70. package/resources/agents.d.ts.map +1 -0
  71. package/resources/agents.js +6 -0
  72. package/resources/agents.js.map +1 -0
  73. package/resources/agents.mjs +3 -0
  74. package/resources/agents.mjs.map +1 -0
  75. package/resources/assistant/conversations.d.mts +114 -38
  76. package/resources/assistant/conversations.d.mts.map +1 -1
  77. package/resources/assistant/conversations.d.ts +114 -38
  78. package/resources/assistant/conversations.d.ts.map +1 -1
  79. package/resources/assistant/conversations.js +20 -19
  80. package/resources/assistant/conversations.js.map +1 -1
  81. package/resources/assistant/conversations.mjs +20 -19
  82. package/resources/assistant/conversations.mjs.map +1 -1
  83. package/resources/devices/actions.d.mts +3 -4
  84. package/resources/devices/actions.d.mts.map +1 -1
  85. package/resources/devices/actions.d.ts +3 -4
  86. package/resources/devices/actions.d.ts.map +1 -1
  87. package/resources/devices/actions.js +3 -4
  88. package/resources/devices/actions.js.map +1 -1
  89. package/resources/devices/actions.mjs +3 -4
  90. package/resources/devices/actions.mjs.map +1 -1
  91. package/resources/devices/devices.d.mts +9 -0
  92. package/resources/devices/devices.d.mts.map +1 -1
  93. package/resources/devices/devices.d.ts +9 -0
  94. package/resources/devices/devices.d.ts.map +1 -1
  95. package/resources/devices/devices.js +8 -0
  96. package/resources/devices/devices.js.map +1 -1
  97. package/resources/devices/devices.mjs +8 -0
  98. package/resources/devices/devices.mjs.map +1 -1
  99. package/resources/devices/index.d.mts +2 -0
  100. package/resources/devices/index.d.mts.map +1 -1
  101. package/resources/devices/index.d.ts +2 -0
  102. package/resources/devices/index.d.ts.map +1 -1
  103. package/resources/devices/index.js +5 -1
  104. package/resources/devices/index.js.map +1 -1
  105. package/resources/devices/index.mjs +2 -0
  106. package/resources/devices/index.mjs.map +1 -1
  107. package/resources/devices/number-bindings.d.mts +40 -0
  108. package/resources/devices/number-bindings.d.mts.map +1 -0
  109. package/resources/devices/number-bindings.d.ts +40 -0
  110. package/resources/devices/number-bindings.d.ts.map +1 -0
  111. package/resources/devices/number-bindings.js +15 -0
  112. package/resources/devices/number-bindings.js.map +1 -0
  113. package/resources/devices/number-bindings.mjs +11 -0
  114. package/resources/devices/number-bindings.mjs.map +1 -0
  115. package/resources/devices/number.d.mts +141 -0
  116. package/resources/devices/number.d.mts.map +1 -0
  117. package/resources/devices/number.d.ts +141 -0
  118. package/resources/devices/number.d.ts.map +1 -0
  119. package/resources/devices/number.js +68 -0
  120. package/resources/devices/number.js.map +1 -0
  121. package/resources/devices/number.mjs +64 -0
  122. package/resources/devices/number.mjs.map +1 -0
  123. package/resources/files.d.mts +13 -7
  124. package/resources/files.d.mts.map +1 -1
  125. package/resources/files.d.ts +13 -7
  126. package/resources/files.d.ts.map +1 -1
  127. package/resources/files.js +9 -7
  128. package/resources/files.js.map +1 -1
  129. package/resources/files.mjs +9 -7
  130. package/resources/files.mjs.map +1 -1
  131. package/resources/index.d.mts +1 -0
  132. package/resources/index.d.mts.map +1 -1
  133. package/resources/index.d.ts +1 -0
  134. package/resources/index.d.ts.map +1 -1
  135. package/resources/index.js +3 -1
  136. package/resources/index.js.map +1 -1
  137. package/resources/index.mjs +1 -0
  138. package/resources/index.mjs.map +1 -1
  139. package/resources/numbers/messages.d.mts +2 -1
  140. package/resources/numbers/messages.d.mts.map +1 -1
  141. package/resources/numbers/messages.d.ts +2 -1
  142. package/resources/numbers/messages.d.ts.map +1 -1
  143. package/resources/numbers/messages.js +2 -1
  144. package/resources/numbers/messages.js.map +1 -1
  145. package/resources/numbers/messages.mjs +2 -1
  146. package/resources/numbers/messages.mjs.map +1 -1
  147. package/resources/numbers/numbers.d.mts +48 -0
  148. package/resources/numbers/numbers.d.mts.map +1 -1
  149. package/resources/numbers/numbers.d.ts +48 -0
  150. package/resources/numbers/numbers.d.ts.map +1 -1
  151. package/resources/numbers/numbers.js.map +1 -1
  152. package/resources/numbers/numbers.mjs.map +1 -1
  153. package/resources/tasks/tasks.d.mts +24 -5
  154. package/resources/tasks/tasks.d.mts.map +1 -1
  155. package/resources/tasks/tasks.d.ts +24 -5
  156. package/resources/tasks/tasks.d.ts.map +1 -1
  157. package/resources/tasks/tasks.js.map +1 -1
  158. package/resources/tasks/tasks.mjs.map +1 -1
  159. package/resources/workflows/action-catalog.d.mts +56 -8
  160. package/resources/workflows/action-catalog.d.mts.map +1 -1
  161. package/resources/workflows/action-catalog.d.ts +56 -8
  162. package/resources/workflows/action-catalog.d.ts.map +1 -1
  163. package/resources/workflows/action-catalog.js +7 -5
  164. package/resources/workflows/action-catalog.js.map +1 -1
  165. package/resources/workflows/action-catalog.mjs +7 -5
  166. package/resources/workflows/action-catalog.mjs.map +1 -1
  167. package/resources/workflows/actions/actions.d.mts +22 -10
  168. package/resources/workflows/actions/actions.d.mts.map +1 -1
  169. package/resources/workflows/actions/actions.d.ts +22 -10
  170. package/resources/workflows/actions/actions.d.ts.map +1 -1
  171. package/resources/workflows/actions/actions.js +7 -5
  172. package/resources/workflows/actions/actions.js.map +1 -1
  173. package/resources/workflows/actions/actions.mjs +7 -5
  174. package/resources/workflows/actions/actions.mjs.map +1 -1
  175. package/resources/workflows/actions/index.d.mts +1 -1
  176. package/resources/workflows/actions/index.d.mts.map +1 -1
  177. package/resources/workflows/actions/index.d.ts +1 -1
  178. package/resources/workflows/actions/index.d.ts.map +1 -1
  179. package/resources/workflows/actions/index.js.map +1 -1
  180. package/resources/workflows/actions/index.mjs.map +1 -1
  181. package/resources/workflows/actions/services.d.mts +1 -1
  182. package/resources/workflows/actions/services.d.mts.map +1 -1
  183. package/resources/workflows/actions/services.d.ts +1 -1
  184. package/resources/workflows/actions/services.d.ts.map +1 -1
  185. package/resources/workflows/events.d.mts +25 -3
  186. package/resources/workflows/events.d.mts.map +1 -1
  187. package/resources/workflows/events.d.ts +25 -3
  188. package/resources/workflows/events.d.ts.map +1 -1
  189. package/resources/workflows/executions/executions.d.mts +16 -0
  190. package/resources/workflows/executions/executions.d.mts.map +1 -1
  191. package/resources/workflows/executions/executions.d.ts +16 -0
  192. package/resources/workflows/executions/executions.d.ts.map +1 -1
  193. package/resources/workflows/executions/executions.js.map +1 -1
  194. package/resources/workflows/executions/executions.mjs.map +1 -1
  195. package/resources/workflows/flows/flows.d.mts +547 -102
  196. package/resources/workflows/flows/flows.d.mts.map +1 -1
  197. package/resources/workflows/flows/flows.d.ts +547 -102
  198. package/resources/workflows/flows/flows.d.ts.map +1 -1
  199. package/resources/workflows/flows/flows.js +15 -2
  200. package/resources/workflows/flows/flows.js.map +1 -1
  201. package/resources/workflows/flows/flows.mjs +15 -2
  202. package/resources/workflows/flows/flows.mjs.map +1 -1
  203. package/resources/workflows/flows/index.d.mts +2 -1
  204. package/resources/workflows/flows/index.d.mts.map +1 -1
  205. package/resources/workflows/flows/index.d.ts +2 -1
  206. package/resources/workflows/flows/index.d.ts.map +1 -1
  207. package/resources/workflows/flows/index.js +3 -1
  208. package/resources/workflows/flows/index.js.map +1 -1
  209. package/resources/workflows/flows/index.mjs +1 -0
  210. package/resources/workflows/flows/index.mjs.map +1 -1
  211. package/resources/workflows/flows/state.d.mts +65 -0
  212. package/resources/workflows/flows/state.d.mts.map +1 -0
  213. package/resources/workflows/flows/state.d.ts +65 -0
  214. package/resources/workflows/flows/state.d.ts.map +1 -0
  215. package/resources/workflows/flows/state.js +33 -0
  216. package/resources/workflows/flows/state.js.map +1 -0
  217. package/resources/workflows/flows/state.mjs +29 -0
  218. package/resources/workflows/flows/state.mjs.map +1 -0
  219. package/resources/workflows/index.d.mts +3 -3
  220. package/resources/workflows/index.d.mts.map +1 -1
  221. package/resources/workflows/index.d.ts +3 -3
  222. package/resources/workflows/index.d.ts.map +1 -1
  223. package/resources/workflows/index.js.map +1 -1
  224. package/resources/workflows/index.mjs.map +1 -1
  225. package/resources/workflows/triggers.d.mts +40 -5
  226. package/resources/workflows/triggers.d.mts.map +1 -1
  227. package/resources/workflows/triggers.d.ts +40 -5
  228. package/resources/workflows/triggers.d.ts.map +1 -1
  229. package/resources/workflows/triggers.js +12 -3
  230. package/resources/workflows/triggers.js.map +1 -1
  231. package/resources/workflows/triggers.mjs +12 -3
  232. package/resources/workflows/triggers.mjs.map +1 -1
  233. package/resources/workflows/workflows.d.mts +6 -6
  234. package/resources/workflows/workflows.d.mts.map +1 -1
  235. package/resources/workflows/workflows.d.ts +6 -6
  236. package/resources/workflows/workflows.d.ts.map +1 -1
  237. package/resources/workflows/workflows.js.map +1 -1
  238. package/resources/workflows/workflows.mjs.map +1 -1
  239. package/src/client.ts +17 -0
  240. package/src/resources/agents/agents.ts +475 -0
  241. package/src/resources/agents/conversations.ts +205 -0
  242. package/src/resources/agents/files.ts +105 -0
  243. package/src/resources/agents/index.ts +34 -0
  244. package/src/resources/agents/profile.ts +225 -0
  245. package/src/resources/agents/requests.ts +495 -0
  246. package/src/resources/agents/routines.ts +156 -0
  247. package/src/resources/agents.ts +3 -0
  248. package/src/resources/assistant/conversations.ts +146 -39
  249. package/src/resources/devices/actions.ts +3 -4
  250. package/src/resources/devices/devices.ts +38 -0
  251. package/src/resources/devices/index.ts +14 -0
  252. package/src/resources/devices/number-bindings.ts +62 -0
  253. package/src/resources/devices/number.ts +261 -0
  254. package/src/resources/files.ts +17 -7
  255. package/src/resources/index.ts +7 -0
  256. package/src/resources/numbers/messages.ts +2 -1
  257. package/src/resources/numbers/numbers.ts +64 -0
  258. package/src/resources/tasks/tasks.ts +26 -5
  259. package/src/resources/workflows/action-catalog.ts +69 -8
  260. package/src/resources/workflows/actions/actions.ts +29 -10
  261. package/src/resources/workflows/actions/index.ts +1 -0
  262. package/src/resources/workflows/actions/services.ts +1 -1
  263. package/src/resources/workflows/events.ts +32 -2
  264. package/src/resources/workflows/executions/executions.ts +26 -0
  265. package/src/resources/workflows/flows/flows.ts +707 -97
  266. package/src/resources/workflows/flows/index.ts +10 -0
  267. package/src/resources/workflows/flows/state.ts +103 -0
  268. package/src/resources/workflows/index.ts +4 -0
  269. package/src/resources/workflows/triggers.ts +34 -5
  270. package/src/resources/workflows/workflows.ts +8 -0
  271. package/src/version.ts +1 -1
  272. package/version.d.mts +1 -1
  273. package/version.d.ts +1 -1
  274. package/version.js +1 -1
  275. package/version.mjs +1 -1
@@ -0,0 +1,495 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
7
+
8
+ export class Requests extends APIResource {
9
+ /**
10
+ * Owner-scoped. Returns the request with its payloads and event timeline; an
11
+ * unknown id or another owner's request is a 404.
12
+ */
13
+ retrieve(requestID: string, options?: RequestOptions): APIPromise<RequestRetrieveResponse> {
14
+ return this._client.get(path`/agents/requests/${requestID}`, options);
15
+ }
16
+
17
+ /**
18
+ * Owner-scoped. Returns newest requests first, ordered by creation time and id.
19
+ * Use nextCursor as before to read older pages. Invalid cursors return 400
20
+ * invalid_cursor. Use the single read for payloads and events.
21
+ */
22
+ list(
23
+ query: RequestListParams | null | undefined = {},
24
+ options?: RequestOptions,
25
+ ): APIPromise<RequestListResponse> {
26
+ return this._client.get('/agents/requests', { query, ...options });
27
+ }
28
+
29
+ /**
30
+ * Owner-scoped. Returns newest requests where the Agent is source or target. Use
31
+ * nextCursor as before to read older pages. Invalid cursors return 400
32
+ * invalid_cursor.
33
+ */
34
+ listForAgent(
35
+ agentID: string,
36
+ query: RequestListForAgentParams | null | undefined = {},
37
+ options?: RequestOptions,
38
+ ): APIPromise<RequestListForAgentResponse> {
39
+ return this._client.get(path`/agents/${agentID}/requests`, { query, ...options });
40
+ }
41
+
42
+ /**
43
+ * Owner-scoped. Returns the Agent-to-Agent request whose target session is
44
+ * {sessionId}, including its payloads and event timeline. Unknown sessions,
45
+ * source-only sessions, sessions without a request, and another owner's sessions
46
+ * return 404 agent_request_not_found.
47
+ */
48
+ retrieveBySession(
49
+ sessionID: string,
50
+ options?: RequestOptions,
51
+ ): APIPromise<RequestRetrieveBySessionResponse> {
52
+ return this._client.get(path`/agents/sessions/${sessionID}/request`, options);
53
+ }
54
+ }
55
+
56
+ export interface RequestRetrieveResponse {
57
+ id: string;
58
+
59
+ createdAt: string;
60
+
61
+ deadlineAt: string;
62
+
63
+ depth: number;
64
+
65
+ dispatchAttempts: number;
66
+
67
+ dispatchedAt: string | null;
68
+
69
+ error: RequestRetrieveResponse.Error | null;
70
+
71
+ events: Array<RequestRetrieveResponse.Event>;
72
+
73
+ finishedAt: string | null;
74
+
75
+ request: RequestRetrieveResponse.Request;
76
+
77
+ result: RequestRetrieveResponse.Text | RequestRetrieveResponse.Question | null;
78
+
79
+ room: RequestRetrieveResponse.Room;
80
+
81
+ sourceAgentId: string;
82
+
83
+ sourceSessionId: string;
84
+
85
+ status:
86
+ | 'queued'
87
+ | 'running'
88
+ | 'answered'
89
+ | 'failed'
90
+ | 'timed_out'
91
+ | 'cancelled'
92
+ | 'late_answer'
93
+ | 'needs_user_input';
94
+
95
+ targetAgentId: string;
96
+
97
+ targetSessionId: string;
98
+
99
+ updatedAt: string;
100
+
101
+ visited: Array<string>;
102
+ }
103
+
104
+ export namespace RequestRetrieveResponse {
105
+ export interface Error {
106
+ /**
107
+ * Why the request did not produce an answer. An open set: new codes can appear.
108
+ * Codes written today: `agent_archived`, `agent_disabled`, `dispatch_failed`,
109
+ * `timed_out`, `cancelled`, `result_too_large`, `no_answer`, `target_turn_failed`,
110
+ * `target_error`, `target_aborted`, `target_crash_recovered`,
111
+ * `target_unknown_outcome`.
112
+ */
113
+ code: string;
114
+
115
+ message: string;
116
+
117
+ preview?: string;
118
+ }
119
+
120
+ export interface Event {
121
+ createdAt: string;
122
+
123
+ kind: string;
124
+
125
+ payload: { [key: string]: unknown } | null;
126
+
127
+ seq: number;
128
+ }
129
+
130
+ export interface Request {
131
+ message: string;
132
+
133
+ sourceDisplayName: string | null;
134
+
135
+ timeoutSeconds: number;
136
+
137
+ fileIds?: Array<string>;
138
+ }
139
+
140
+ export interface Text {
141
+ text: string;
142
+ }
143
+
144
+ export interface Question {
145
+ question: string;
146
+ }
147
+
148
+ export interface Room {
149
+ id: string;
150
+
151
+ kind: 'direct' | 'group';
152
+
153
+ members: Array<Room.Member>;
154
+ }
155
+
156
+ export namespace Room {
157
+ export interface Member {
158
+ id: string;
159
+
160
+ agentId: string | null;
161
+
162
+ joinedAt: string;
163
+
164
+ leftAt: string | null;
165
+
166
+ participantType: 'agent' | 'user';
167
+
168
+ role: 'owner' | 'member';
169
+
170
+ userId: string | null;
171
+ }
172
+ }
173
+ }
174
+
175
+ export interface RequestListResponse {
176
+ /**
177
+ * Cursor for the next page; null when there are no older requests.
178
+ */
179
+ nextCursor: string | null;
180
+
181
+ requests: Array<RequestListResponse.Request>;
182
+ }
183
+
184
+ export namespace RequestListResponse {
185
+ export interface Request {
186
+ id: string;
187
+
188
+ createdAt: string;
189
+
190
+ deadlineAt: string;
191
+
192
+ depth: number;
193
+
194
+ dispatchedAt: string | null;
195
+
196
+ /**
197
+ * `error.code` of the full request, null when it has none. An open set: new codes
198
+ * can appear. Codes written today: `agent_archived`, `agent_disabled`,
199
+ * `dispatch_failed`, `timed_out`, `cancelled`, `result_too_large`, `no_answer`,
200
+ * `target_turn_failed`, `target_error`, `target_aborted`,
201
+ * `target_crash_recovered`, `target_unknown_outcome`.
202
+ */
203
+ errorCode: string | null;
204
+
205
+ finishedAt: string | null;
206
+
207
+ room: Request.Room;
208
+
209
+ sourceAgentId: string;
210
+
211
+ sourceSessionId: string;
212
+
213
+ status:
214
+ | 'queued'
215
+ | 'running'
216
+ | 'answered'
217
+ | 'failed'
218
+ | 'timed_out'
219
+ | 'cancelled'
220
+ | 'late_answer'
221
+ | 'needs_user_input';
222
+
223
+ targetAgentId: string;
224
+
225
+ targetSessionId: string;
226
+
227
+ updatedAt: string;
228
+ }
229
+
230
+ export namespace Request {
231
+ export interface Room {
232
+ id: string;
233
+
234
+ kind: 'direct' | 'group';
235
+
236
+ members: Array<Room.Member>;
237
+ }
238
+
239
+ export namespace Room {
240
+ export interface Member {
241
+ id: string;
242
+
243
+ agentId: string | null;
244
+
245
+ joinedAt: string;
246
+
247
+ leftAt: string | null;
248
+
249
+ participantType: 'agent' | 'user';
250
+
251
+ role: 'owner' | 'member';
252
+
253
+ userId: string | null;
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+ export interface RequestListForAgentResponse {
260
+ /**
261
+ * Cursor for the next page; null when there are no older requests.
262
+ */
263
+ nextCursor: string | null;
264
+
265
+ requests: Array<RequestListForAgentResponse.Request>;
266
+ }
267
+
268
+ export namespace RequestListForAgentResponse {
269
+ export interface Request {
270
+ id: string;
271
+
272
+ createdAt: string;
273
+
274
+ deadlineAt: string;
275
+
276
+ depth: number;
277
+
278
+ dispatchedAt: string | null;
279
+
280
+ /**
281
+ * `error.code` of the full request, null when it has none. An open set: new codes
282
+ * can appear. Codes written today: `agent_archived`, `agent_disabled`,
283
+ * `dispatch_failed`, `timed_out`, `cancelled`, `result_too_large`, `no_answer`,
284
+ * `target_turn_failed`, `target_error`, `target_aborted`,
285
+ * `target_crash_recovered`, `target_unknown_outcome`.
286
+ */
287
+ errorCode: string | null;
288
+
289
+ finishedAt: string | null;
290
+
291
+ room: Request.Room;
292
+
293
+ sourceAgentId: string;
294
+
295
+ sourceSessionId: string;
296
+
297
+ status:
298
+ | 'queued'
299
+ | 'running'
300
+ | 'answered'
301
+ | 'failed'
302
+ | 'timed_out'
303
+ | 'cancelled'
304
+ | 'late_answer'
305
+ | 'needs_user_input';
306
+
307
+ targetAgentId: string;
308
+
309
+ targetSessionId: string;
310
+
311
+ updatedAt: string;
312
+ }
313
+
314
+ export namespace Request {
315
+ export interface Room {
316
+ id: string;
317
+
318
+ kind: 'direct' | 'group';
319
+
320
+ members: Array<Room.Member>;
321
+ }
322
+
323
+ export namespace Room {
324
+ export interface Member {
325
+ id: string;
326
+
327
+ agentId: string | null;
328
+
329
+ joinedAt: string;
330
+
331
+ leftAt: string | null;
332
+
333
+ participantType: 'agent' | 'user';
334
+
335
+ role: 'owner' | 'member';
336
+
337
+ userId: string | null;
338
+ }
339
+ }
340
+ }
341
+ }
342
+
343
+ export interface RequestRetrieveBySessionResponse {
344
+ id: string;
345
+
346
+ createdAt: string;
347
+
348
+ deadlineAt: string;
349
+
350
+ depth: number;
351
+
352
+ dispatchAttempts: number;
353
+
354
+ dispatchedAt: string | null;
355
+
356
+ error: RequestRetrieveBySessionResponse.Error | null;
357
+
358
+ events: Array<RequestRetrieveBySessionResponse.Event>;
359
+
360
+ finishedAt: string | null;
361
+
362
+ request: RequestRetrieveBySessionResponse.Request;
363
+
364
+ result: RequestRetrieveBySessionResponse.Text | RequestRetrieveBySessionResponse.Question | null;
365
+
366
+ room: RequestRetrieveBySessionResponse.Room;
367
+
368
+ sourceAgentId: string;
369
+
370
+ sourceSessionId: string;
371
+
372
+ status:
373
+ | 'queued'
374
+ | 'running'
375
+ | 'answered'
376
+ | 'failed'
377
+ | 'timed_out'
378
+ | 'cancelled'
379
+ | 'late_answer'
380
+ | 'needs_user_input';
381
+
382
+ targetAgentId: string;
383
+
384
+ targetSessionId: string;
385
+
386
+ updatedAt: string;
387
+
388
+ visited: Array<string>;
389
+ }
390
+
391
+ export namespace RequestRetrieveBySessionResponse {
392
+ export interface Error {
393
+ /**
394
+ * Why the request did not produce an answer. An open set: new codes can appear.
395
+ * Codes written today: `agent_archived`, `agent_disabled`, `dispatch_failed`,
396
+ * `timed_out`, `cancelled`, `result_too_large`, `no_answer`, `target_turn_failed`,
397
+ * `target_error`, `target_aborted`, `target_crash_recovered`,
398
+ * `target_unknown_outcome`.
399
+ */
400
+ code: string;
401
+
402
+ message: string;
403
+
404
+ preview?: string;
405
+ }
406
+
407
+ export interface Event {
408
+ createdAt: string;
409
+
410
+ kind: string;
411
+
412
+ payload: { [key: string]: unknown } | null;
413
+
414
+ seq: number;
415
+ }
416
+
417
+ export interface Request {
418
+ message: string;
419
+
420
+ sourceDisplayName: string | null;
421
+
422
+ timeoutSeconds: number;
423
+
424
+ fileIds?: Array<string>;
425
+ }
426
+
427
+ export interface Text {
428
+ text: string;
429
+ }
430
+
431
+ export interface Question {
432
+ question: string;
433
+ }
434
+
435
+ export interface Room {
436
+ id: string;
437
+
438
+ kind: 'direct' | 'group';
439
+
440
+ members: Array<Room.Member>;
441
+ }
442
+
443
+ export namespace Room {
444
+ export interface Member {
445
+ id: string;
446
+
447
+ agentId: string | null;
448
+
449
+ joinedAt: string;
450
+
451
+ leftAt: string | null;
452
+
453
+ participantType: 'agent' | 'user';
454
+
455
+ role: 'owner' | 'member';
456
+
457
+ userId: string | null;
458
+ }
459
+ }
460
+ }
461
+
462
+ export interface RequestListParams {
463
+ /**
464
+ * Opaque nextCursor from the previous page.
465
+ */
466
+ before?: string;
467
+
468
+ /**
469
+ * Maximum number of requests to return (1–100; default 50).
470
+ */
471
+ limit?: number;
472
+ }
473
+
474
+ export interface RequestListForAgentParams {
475
+ /**
476
+ * Opaque nextCursor from the previous page.
477
+ */
478
+ before?: string;
479
+
480
+ /**
481
+ * Maximum number of requests to return (1–100; default 50).
482
+ */
483
+ limit?: number;
484
+ }
485
+
486
+ export declare namespace Requests {
487
+ export {
488
+ type RequestRetrieveResponse as RequestRetrieveResponse,
489
+ type RequestListResponse as RequestListResponse,
490
+ type RequestListForAgentResponse as RequestListForAgentResponse,
491
+ type RequestRetrieveBySessionResponse as RequestRetrieveBySessionResponse,
492
+ type RequestListParams as RequestListParams,
493
+ type RequestListForAgentParams as RequestListForAgentParams,
494
+ };
495
+ }
@@ -0,0 +1,156 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
7
+
8
+ export class Routines extends APIResource {
9
+ /**
10
+ * Forwards the scheduler CreateFlowBody unchanged and assigns the Agent selected
11
+ * in the path. Requires Idempotency-Key; reuse it after a transient failure.
12
+ */
13
+ create(
14
+ agentID: string,
15
+ body: RoutineCreateParams,
16
+ options?: RequestOptions,
17
+ ): APIPromise<RoutineCreateResponse> {
18
+ return this._client.post(path`/agents/${agentID}/routines`, { body, ...options });
19
+ }
20
+
21
+ /**
22
+ * The source must belong to the authenticated owner and be assigned to the same
23
+ * Agent or unassigned. The target is the Agent in the path. Requires
24
+ * Idempotency-Key.
25
+ */
26
+ clone(
27
+ routineID: string,
28
+ params: RoutineCloneParams,
29
+ options?: RequestOptions,
30
+ ): APIPromise<RoutineCloneResponse> {
31
+ const { agentId, ...body } = params;
32
+ return this._client.post(path`/agents/${agentId}/routines/${routineID}/clone`, { body, ...options });
33
+ }
34
+ }
35
+
36
+ export interface RoutineCreateResponse {
37
+ data: RoutineCreateResponse.Data;
38
+ }
39
+
40
+ export namespace RoutineCreateResponse {
41
+ export interface Data {
42
+ id: string;
43
+
44
+ agentId: string | null;
45
+
46
+ [k: string]: unknown;
47
+ }
48
+ }
49
+
50
+ export interface RoutineCloneResponse {
51
+ data: RoutineCloneResponse.Data;
52
+ }
53
+
54
+ export namespace RoutineCloneResponse {
55
+ export interface Data {
56
+ id: string;
57
+
58
+ agentId: string | null;
59
+
60
+ [k: string]: unknown;
61
+ }
62
+ }
63
+
64
+ export interface RoutineCreateParams {
65
+ actions: Array<RoutineCreateParams.Action>;
66
+
67
+ name: string;
68
+
69
+ triggerId: string;
70
+
71
+ cooldownScope?: 'flow' | 'device';
72
+
73
+ cooldownSeconds?: number | null;
74
+
75
+ delivery?: RoutineCreateParams.Delivery;
76
+
77
+ description?: string;
78
+
79
+ deviceIds?: Array<string>;
80
+
81
+ enabled?: boolean;
82
+
83
+ healthMonitoringEnabled?: boolean;
84
+
85
+ notifyOnFailure?: boolean;
86
+
87
+ notifyOnSuccess?: boolean;
88
+
89
+ notifyWebhookId?: string | null;
90
+
91
+ recordingEnabled?: boolean;
92
+
93
+ recordingPolicy?: RoutineCreateParams.RecordingPolicy;
94
+
95
+ selfHealingEnabled?: boolean;
96
+
97
+ selfHealingMaxAttempts?: number;
98
+
99
+ [k: string]: unknown;
100
+ }
101
+
102
+ export namespace RoutineCreateParams {
103
+ export interface Action {
104
+ actionId: string;
105
+
106
+ position: number;
107
+
108
+ [k: string]: unknown;
109
+ }
110
+
111
+ export interface Delivery {
112
+ destination: 'one_drive' | 'google_drive' | 'mobilerun';
113
+
114
+ folder?: string;
115
+
116
+ recording?: Delivery.Recording;
117
+
118
+ screenshots?: unknown;
119
+ }
120
+
121
+ export namespace Delivery {
122
+ export interface Recording {
123
+ filename: string;
124
+ }
125
+ }
126
+
127
+ export interface RecordingPolicy {
128
+ mode: 'off' | 'flow' | 'selected_steps';
129
+ }
130
+ }
131
+
132
+ export interface RoutineCloneParams {
133
+ /**
134
+ * Path param
135
+ */
136
+ agentId: string;
137
+
138
+ /**
139
+ * Body param
140
+ */
141
+ deviceIds?: Array<string>;
142
+
143
+ /**
144
+ * Body param
145
+ */
146
+ name?: string;
147
+ }
148
+
149
+ export declare namespace Routines {
150
+ export {
151
+ type RoutineCreateResponse as RoutineCreateResponse,
152
+ type RoutineCloneResponse as RoutineCloneResponse,
153
+ type RoutineCreateParams as RoutineCreateParams,
154
+ type RoutineCloneParams as RoutineCloneParams,
155
+ };
156
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './agents/index';