@archastro/sdk 0.5.0 → 0.5.3

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 (242) hide show
  1. package/README.md +86 -0
  2. package/dist/auth.d.ts +143 -0
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +187 -1
  5. package/dist/auth.js.map +1 -1
  6. package/dist/client.d.ts +26 -0
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +27 -1
  9. package/dist/client.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/types/ai.d.ts +150 -12
  15. package/dist/types/ai.d.ts.map +1 -1
  16. package/dist/types/ai.js +71 -41
  17. package/dist/types/ai.js.map +1 -1
  18. package/dist/types/artifacts.d.ts +81 -24
  19. package/dist/types/artifacts.d.ts.map +1 -1
  20. package/dist/types/artifacts.js +39 -21
  21. package/dist/types/artifacts.js.map +1 -1
  22. package/dist/types/automations.d.ts +41 -9
  23. package/dist/types/automations.d.ts.map +1 -1
  24. package/dist/types/automations.js +25 -17
  25. package/dist/types/automations.js.map +1 -1
  26. package/dist/types/chat.d.ts +21185 -39
  27. package/dist/types/chat.d.ts.map +1 -1
  28. package/dist/types/chat.js +64 -8
  29. package/dist/types/chat.js.map +1 -1
  30. package/dist/types/common.d.ts +16970 -2136
  31. package/dist/types/common.d.ts.map +1 -1
  32. package/dist/types/common.js +1695 -332
  33. package/dist/types/common.js.map +1 -1
  34. package/dist/types/config.d.ts +239 -31
  35. package/dist/types/config.d.ts.map +1 -1
  36. package/dist/types/config.js +86 -34
  37. package/dist/types/config.js.map +1 -1
  38. package/dist/types/image.d.ts +27 -4
  39. package/dist/types/image.d.ts.map +1 -1
  40. package/dist/types/image.js +17 -10
  41. package/dist/types/image.js.map +1 -1
  42. package/dist/types/index.d.ts +2 -1
  43. package/dist/types/index.d.ts.map +1 -1
  44. package/dist/types/index.js +3 -2
  45. package/dist/types/index.js.map +1 -1
  46. package/dist/types/invites.d.ts +20 -11
  47. package/dist/types/invites.d.ts.map +1 -1
  48. package/dist/types/invites.js +9 -12
  49. package/dist/types/invites.js.map +1 -1
  50. package/dist/types/notifications.d.ts +163 -0
  51. package/dist/types/notifications.d.ts.map +1 -0
  52. package/dist/types/notifications.js +44 -0
  53. package/dist/types/notifications.js.map +1 -0
  54. package/dist/types/teams.d.ts +1628 -231
  55. package/dist/types/teams.d.ts.map +1 -1
  56. package/dist/types/teams.js +76 -45
  57. package/dist/types/teams.js.map +1 -1
  58. package/dist/types/threads.d.ts +997 -243
  59. package/dist/types/threads.d.ts.map +1 -1
  60. package/dist/types/threads.js +84 -51
  61. package/dist/types/threads.js.map +1 -1
  62. package/dist/types/users.d.ts +98 -18
  63. package/dist/types/users.d.ts.map +1 -1
  64. package/dist/types/users.js +43 -18
  65. package/dist/types/users.js.map +1 -1
  66. package/dist/v1/resources/activity_feed.d.ts +89 -0
  67. package/dist/v1/resources/activity_feed.d.ts.map +1 -1
  68. package/dist/v1/resources/activity_feed.js +56 -2
  69. package/dist/v1/resources/activity_feed.js.map +1 -1
  70. package/dist/v1/resources/agent_computers.d.ts +48 -2
  71. package/dist/v1/resources/agent_computers.d.ts.map +1 -1
  72. package/dist/v1/resources/agent_computers.js +48 -1
  73. package/dist/v1/resources/agent_computers.js.map +1 -1
  74. package/dist/v1/resources/agent_env_vars.d.ts +50 -0
  75. package/dist/v1/resources/agent_env_vars.d.ts.map +1 -0
  76. package/dist/v1/resources/agent_env_vars.js +56 -0
  77. package/dist/v1/resources/agent_env_vars.js.map +1 -0
  78. package/dist/v1/resources/agent_health_actions.d.ts +43 -0
  79. package/dist/v1/resources/agent_health_actions.d.ts.map +1 -0
  80. package/dist/v1/resources/agent_health_actions.js +50 -0
  81. package/dist/v1/resources/agent_health_actions.js.map +1 -0
  82. package/dist/v1/resources/agent_installations.d.ts +100 -0
  83. package/dist/v1/resources/agent_installations.d.ts.map +1 -1
  84. package/dist/v1/resources/agent_installations.js +106 -2
  85. package/dist/v1/resources/agent_installations.js.map +1 -1
  86. package/dist/v1/resources/agent_routine_runs.d.ts +33 -0
  87. package/dist/v1/resources/agent_routine_runs.d.ts.map +1 -0
  88. package/dist/v1/resources/agent_routine_runs.js +48 -0
  89. package/dist/v1/resources/agent_routine_runs.js.map +1 -0
  90. package/dist/v1/resources/agent_routines.d.ts +148 -2
  91. package/dist/v1/resources/agent_routines.d.ts.map +1 -1
  92. package/dist/v1/resources/agent_routines.js +168 -3
  93. package/dist/v1/resources/agent_routines.js.map +1 -1
  94. package/dist/v1/resources/agent_sessions.d.ts +118 -1
  95. package/dist/v1/resources/agent_sessions.d.ts.map +1 -1
  96. package/dist/v1/resources/agent_sessions.js +134 -2
  97. package/dist/v1/resources/agent_sessions.js.map +1 -1
  98. package/dist/v1/resources/agent_skills.d.ts +83 -1
  99. package/dist/v1/resources/agent_skills.d.ts.map +1 -1
  100. package/dist/v1/resources/agent_skills.js +87 -2
  101. package/dist/v1/resources/agent_skills.js.map +1 -1
  102. package/dist/v1/resources/agent_tools.d.ts +109 -2
  103. package/dist/v1/resources/agent_tools.d.ts.map +1 -1
  104. package/dist/v1/resources/agent_tools.js +114 -2
  105. package/dist/v1/resources/agent_tools.js.map +1 -1
  106. package/dist/v1/resources/agents.d.ts +517 -9
  107. package/dist/v1/resources/agents.d.ts.map +1 -1
  108. package/dist/v1/resources/agents.js +515 -12
  109. package/dist/v1/resources/agents.js.map +1 -1
  110. package/dist/v1/resources/ai.d.ts +93 -0
  111. package/dist/v1/resources/ai.d.ts.map +1 -1
  112. package/dist/v1/resources/ai.js +89 -1
  113. package/dist/v1/resources/ai.js.map +1 -1
  114. package/dist/v1/resources/artifacts.d.ts +73 -0
  115. package/dist/v1/resources/artifacts.d.ts.map +1 -1
  116. package/dist/v1/resources/artifacts.js +74 -2
  117. package/dist/v1/resources/artifacts.js.map +1 -1
  118. package/dist/v1/resources/automation_runs.d.ts +8 -4
  119. package/dist/v1/resources/automation_runs.d.ts.map +1 -1
  120. package/dist/v1/resources/automation_runs.js +9 -5
  121. package/dist/v1/resources/automation_runs.js.map +1 -1
  122. package/dist/v1/resources/automations.d.ts +20 -0
  123. package/dist/v1/resources/automations.d.ts.map +1 -1
  124. package/dist/v1/resources/automations.js +21 -1
  125. package/dist/v1/resources/automations.js.map +1 -1
  126. package/dist/v1/resources/bug_reports.d.ts +29 -0
  127. package/dist/v1/resources/bug_reports.d.ts.map +1 -0
  128. package/dist/v1/resources/bug_reports.js +29 -0
  129. package/dist/v1/resources/bug_reports.js.map +1 -0
  130. package/dist/v1/resources/config.d.ts +429 -4
  131. package/dist/v1/resources/config.d.ts.map +1 -1
  132. package/dist/v1/resources/config.js +493 -9
  133. package/dist/v1/resources/config.js.map +1 -1
  134. package/dist/v1/resources/custom_objects.d.ts +117 -2
  135. package/dist/v1/resources/custom_objects.d.ts.map +1 -1
  136. package/dist/v1/resources/custom_objects.js +132 -3
  137. package/dist/v1/resources/custom_objects.js.map +1 -1
  138. package/dist/v1/resources/files.d.ts +62 -0
  139. package/dist/v1/resources/files.d.ts.map +1 -0
  140. package/dist/v1/resources/files.js +58 -0
  141. package/dist/v1/resources/files.js.map +1 -0
  142. package/dist/v1/resources/index.d.ts +13 -0
  143. package/dist/v1/resources/index.d.ts.map +1 -1
  144. package/dist/v1/resources/index.js +14 -1
  145. package/dist/v1/resources/index.js.map +1 -1
  146. package/dist/v1/resources/installation_sources.d.ts +12 -0
  147. package/dist/v1/resources/installation_sources.d.ts.map +1 -1
  148. package/dist/v1/resources/installation_sources.js +13 -1
  149. package/dist/v1/resources/installation_sources.js.map +1 -1
  150. package/dist/v1/resources/invites.d.ts +15 -0
  151. package/dist/v1/resources/invites.d.ts.map +1 -1
  152. package/dist/v1/resources/invites.js +16 -1
  153. package/dist/v1/resources/invites.js.map +1 -1
  154. package/dist/v1/resources/knowledge_documents.d.ts +104 -0
  155. package/dist/v1/resources/knowledge_documents.d.ts.map +1 -0
  156. package/dist/v1/resources/knowledge_documents.js +112 -0
  157. package/dist/v1/resources/knowledge_documents.js.map +1 -0
  158. package/dist/v1/resources/knowledge_sources.d.ts +190 -0
  159. package/dist/v1/resources/knowledge_sources.d.ts.map +1 -0
  160. package/dist/v1/resources/knowledge_sources.js +176 -0
  161. package/dist/v1/resources/knowledge_sources.js.map +1 -0
  162. package/dist/v1/resources/kv.d.ts +73 -0
  163. package/dist/v1/resources/kv.d.ts.map +1 -1
  164. package/dist/v1/resources/kv.js +96 -3
  165. package/dist/v1/resources/kv.js.map +1 -1
  166. package/dist/v1/resources/notification_preferences.d.ts +61 -0
  167. package/dist/v1/resources/notification_preferences.d.ts.map +1 -0
  168. package/dist/v1/resources/notification_preferences.js +65 -0
  169. package/dist/v1/resources/notification_preferences.js.map +1 -0
  170. package/dist/v1/resources/notifications.d.ts +133 -0
  171. package/dist/v1/resources/notifications.d.ts.map +1 -0
  172. package/dist/v1/resources/notifications.js +136 -0
  173. package/dist/v1/resources/notifications.js.map +1 -0
  174. package/dist/v1/resources/orgs.d.ts +18 -0
  175. package/dist/v1/resources/orgs.d.ts.map +1 -1
  176. package/dist/v1/resources/orgs.js +30 -2
  177. package/dist/v1/resources/orgs.js.map +1 -1
  178. package/dist/v1/resources/slack_channel_bindings.d.ts +101 -0
  179. package/dist/v1/resources/slack_channel_bindings.d.ts.map +1 -0
  180. package/dist/v1/resources/slack_channel_bindings.js +114 -0
  181. package/dist/v1/resources/slack_channel_bindings.js.map +1 -0
  182. package/dist/v1/resources/solution_categories.d.ts +36 -0
  183. package/dist/v1/resources/solution_categories.d.ts.map +1 -0
  184. package/dist/v1/resources/solution_categories.js +55 -0
  185. package/dist/v1/resources/solution_categories.js.map +1 -0
  186. package/dist/v1/resources/solution_tags.d.ts +37 -0
  187. package/dist/v1/resources/solution_tags.d.ts.map +1 -0
  188. package/dist/v1/resources/solution_tags.js +54 -0
  189. package/dist/v1/resources/solution_tags.js.map +1 -0
  190. package/dist/v1/resources/solutions.d.ts +309 -0
  191. package/dist/v1/resources/solutions.d.ts.map +1 -0
  192. package/dist/v1/resources/solutions.js +214 -0
  193. package/dist/v1/resources/solutions.js.map +1 -0
  194. package/dist/v1/resources/team_memberships.d.ts +31 -0
  195. package/dist/v1/resources/team_memberships.d.ts.map +1 -1
  196. package/dist/v1/resources/team_memberships.js +49 -2
  197. package/dist/v1/resources/team_memberships.js.map +1 -1
  198. package/dist/v1/resources/teams.d.ts +458 -49
  199. package/dist/v1/resources/teams.d.ts.map +1 -1
  200. package/dist/v1/resources/teams.js +319 -27
  201. package/dist/v1/resources/teams.js.map +1 -1
  202. package/dist/v1/resources/thread_messages.d.ts +70 -0
  203. package/dist/v1/resources/thread_messages.d.ts.map +1 -1
  204. package/dist/v1/resources/thread_messages.js +85 -2
  205. package/dist/v1/resources/thread_messages.js.map +1 -1
  206. package/dist/v1/resources/threads.d.ts +201 -0
  207. package/dist/v1/resources/threads.d.ts.map +1 -1
  208. package/dist/v1/resources/threads.js +220 -4
  209. package/dist/v1/resources/threads.js.map +1 -1
  210. package/dist/v1/resources/users.d.ts +213 -39
  211. package/dist/v1/resources/users.d.ts.map +1 -1
  212. package/dist/v1/resources/users.js +121 -16
  213. package/dist/v1/resources/users.js.map +1 -1
  214. package/dist/v1.d.ts +26 -0
  215. package/dist/v1.d.ts.map +1 -1
  216. package/dist/v1.js +40 -1
  217. package/dist/v1.js.map +1 -1
  218. package/package.json +4 -2
  219. package/dist/types/agents.d.ts +0 -2084
  220. package/dist/types/agents.d.ts.map +0 -1
  221. package/dist/types/agents.js +0 -203
  222. package/dist/types/agents.js.map +0 -1
  223. package/dist/types/members.d.ts +0 -99
  224. package/dist/types/members.d.ts.map +0 -1
  225. package/dist/types/members.js +0 -36
  226. package/dist/types/members.js.map +0 -1
  227. package/dist/types/orgs.d.ts +0 -193
  228. package/dist/types/orgs.d.ts.map +0 -1
  229. package/dist/types/orgs.js +0 -69
  230. package/dist/types/orgs.js.map +0 -1
  231. package/dist/types/reactions.d.ts +0 -29
  232. package/dist/types/reactions.d.ts.map +0 -1
  233. package/dist/types/reactions.js +0 -15
  234. package/dist/types/reactions.js.map +0 -1
  235. package/dist/types/schedules.d.ts +0 -32
  236. package/dist/types/schedules.d.ts.map +0 -1
  237. package/dist/types/schedules.js +0 -16
  238. package/dist/types/schedules.js.map +0 -1
  239. package/dist/types/system.d.ts +0 -23
  240. package/dist/types/system.d.ts.map +0 -1
  241. package/dist/types/system.js +0 -13
  242. package/dist/types/system.js.map +0 -1
@@ -1,11 +1,21 @@
1
1
  // Copyright (c) 2026 ArchAstro Inc. All Rights Reserved.
2
2
  // This file is auto-generated by @archastro/sdk-generator. Do not edit.
3
- // Content hash: 7a312d537f0d
3
+ // Content hash: 37dacff76964
4
4
  export class AgentRoutineRunResource {
5
5
  http;
6
6
  constructor(http) {
7
7
  this.http = http;
8
8
  }
9
+ /**
10
+ * Retrieve a routine run
11
+ * Returns a single routine run by its ID. The run includes status, payload,
12
+ * result, duration, and any structured response produced by the routine's agent.
13
+ * The authenticated principal must have access to the app that owns the run.
14
+ * When your API key is scoped to an app, the run must belong to that app or
15
+ * a 403 is returned.
16
+ * @param run - Routine run ID (`arr_...`) to retrieve.
17
+ * @returns The requested routine run.
18
+ */
9
19
  async get(run) {
10
20
  return this.http.request(`/api/v1/agent_routines/runs/${run}`);
11
21
  }
@@ -17,32 +27,187 @@ export class AgentRoutineResource {
17
27
  this.http = http;
18
28
  this.agent_routine_runs = new AgentRoutineRunResource(http);
19
29
  }
30
+ /**
31
+ * List routines
32
+ * Returns all routines within the authenticated app scope. Optionally filter by
33
+ * agent or event type. When `agent` is omitted, all routines accessible to the
34
+ * caller are returned regardless of which agent they belong to.
35
+ * If `agent` is provided but does not exist or is not accessible, the endpoint
36
+ * returns 404 rather than an empty list. Results are not paginated; all matching
37
+ * routines are returned in a single response. Requires app scope.
38
+ * @param params - Query parameters.
39
+ * @param params.agent - Agent ID (`agt_...`) to filter routines by. Omit to return routines across all agents.
40
+ * @param params.eventType - Event type string to filter by (e.g. `"agentroutine.invoked"`). Omit to return routines for all event types.
41
+ * @returns Object containing a `data` array of matching routines.
42
+ */
20
43
  async list(params) {
21
- return this.http.request(`/api/v1/agent_routines`, { query: params });
44
+ const query = {};
45
+ if (params?.agent !== undefined) {
46
+ query["agent"] = params?.agent;
47
+ }
48
+ if (params?.eventType !== undefined) {
49
+ query["event_type"] = params?.eventType;
50
+ }
51
+ return this.http.request(`/api/v1/agent_routines`, { query });
22
52
  }
53
+ /**
54
+ * List routine presets
55
+ * Returns all registered routine presets available to the authenticated app,
56
+ * including each preset's name, display metadata, and accepted configuration
57
+ * schema. Use this endpoint to discover which presets can be referenced when
58
+ * creating or updating a routine with `handler_type: "preset"`.
59
+ * The list reflects presets registered at server start time and does not change
60
+ * at runtime. Requires app scope.
61
+ * @returns Array of available routine preset objects.
62
+ */
23
63
  async presets() {
24
64
  return this.http.request(`/api/v1/agent_routines/presets`);
25
65
  }
66
+ /**
67
+ * Delete a routine
68
+ * Permanently deletes the specified routine. This action is irreversible — the
69
+ * routine and its configuration are removed immediately. Any in-flight event
70
+ * processing initiated by this routine before deletion may still complete.
71
+ * Requires app scope. Returns 204 No Content on success.
72
+ * @param routine - Routine ID (`arn_...`) of the routine to delete.
73
+ * @returns Empty response on successful deletion (HTTP 204 No Content).
74
+ */
26
75
  async delete(routine) {
27
76
  await this.http.request(`/api/v1/agent_routines/${routine}`, { method: "DELETE" });
28
77
  }
78
+ /**
79
+ * Retrieve a routine
80
+ * Returns the full routine record for the given routine ID. Use this endpoint to
81
+ * inspect a routine's current configuration, handler type, event config, schedule,
82
+ * and lifecycle status.
83
+ * Requires app scope. Returns 404 if the routine does not exist or is not
84
+ * accessible to the caller.
85
+ * @param routine - Routine ID (`arn_...`) of the routine to retrieve.
86
+ * @returns The requested routine.
87
+ */
29
88
  async get(routine) {
30
89
  return this.http.request(`/api/v1/agent_routines/${routine}`);
31
90
  }
91
+ /**
92
+ * Update a routine
93
+ * Updates one or more fields of the specified routine. Only the fields you
94
+ * include are changed; omitted fields retain their current values. To change the
95
+ * execution model, supply a new `handler_type` along with its required handler
96
+ * body field (`config`, `script`, or `preset_name`).
97
+ * When `template` is supplied, the routine's configuration is re-resolved from
98
+ * the template before applying any additional field overrides. The routine's
99
+ * `status`, `lookup_key`, and agent attachment are always preserved regardless
100
+ * of template content. Updating `steps` replaces the entire step list — send
101
+ * the full desired list, not a partial diff. Requires app scope.
102
+ * @param routine - Routine ID (`arn_...`) of the routine to update.
103
+ * @param input - Request body.
104
+ * @param input.acl - Updated access control list. Replaces the existing ACL entirely.
105
+ * @param input.config - Workflow config ID (`cfg_...`). Used when `handler_type` is `"workflow_graph"`.
106
+ * @param input.description - New human-readable description of what this routine does.
107
+ * @param input.event_config - Mapping of event types to trigger configuration. Each key is an event type string; each value is an object with a `"filters"` map and an optional `"dedupe_key_path"` (a JSON path used to deduplicate events, e.g. `"$.thread.id"`).
108
+ * @param input.event_type - Event type that triggers this routine. Deprecated — use `event_config` instead.
109
+ * @param input.handler_type - New execution model. One of `"workflow_graph"`, `"script"`, `"preset"`, or `"chain"`.
110
+ * @param input.lookup_key - New stable, unique key for deterministic lookup. Must be unique within the app.
111
+ * @param input.metadata - Updated arbitrary key-value metadata. Replaces the existing metadata entirely.
112
+ * @param input.name - New human-readable display name for the routine.
113
+ * @param input.preset_config - Updated configuration passed to the preset at runtime.
114
+ * @param input.preset_name - Name of the registered preset to use. Used when `handler_type` is `"preset"`.
115
+ * @param input.schedule - New cron expression for time-triggered routines (e.g. `"0 9 * * 1"`). Must not be more frequent than once per hour.
116
+ * @param input.script - New inline script source. Used when `handler_type` is `"script"`.
117
+ * @param input.steps - Updated ordered list of steps for a chain handler. Required when `handler_type` is `"chain"`; must be omitted or empty otherwise. Replaces the entire existing step list — send the full desired list, not a partial diff.
118
+ * @param input.template - AgentRoutineTemplate config ID (`cfg_...`) or lookup key. When provided, the routine's configuration is re-resolved from the template before applying other param overrides. The routine's `status`, `lookup_key`, and agent attachment are always preserved.
119
+ * @param input.trigger_context - Updated trigger context. One of `"chat_session"` or `"event"`.
120
+ * @returns The updated routine.
121
+ */
32
122
  async update(routine, input) {
33
123
  return this.http.request(`/api/v1/agent_routines/${routine}`, { method: "PATCH", body: input });
34
124
  }
125
+ /**
126
+ * Activate a routine
127
+ * Sets the routine's status to `"active"`, enabling it to process events or run
128
+ * on its configured schedule. Only routines that have a workflow config attached
129
+ * can be activated; attempting to activate a routine with no config returns 422.
130
+ * Scheduled routines must be configured to run no more frequently than once per
131
+ * hour. Activation fails with 422 if the cron schedule is more frequent than
132
+ * that limit. Requires app scope.
133
+ * @param routine - Routine ID (`arn_...`) of the routine to activate.
134
+ * @returns The updated routine with `status` set to `"active"`.
135
+ */
35
136
  async activate(routine) {
36
137
  return this.http.request(`/api/v1/agent_routines/${routine}/activate`, { method: "POST" });
37
138
  }
139
+ /**
140
+ * Invoke a routine
141
+ * Triggers an on-demand invocation of the specified routine, dispatching an
142
+ * asynchronous agent run and returning a run record immediately. The routine must
143
+ * be active and must have `event_type` set to `"agentroutine.invoked"`.
144
+ * The routine's `preset_config.session_mode` determines session behavior: each
145
+ * call may create a new session (`"stateless"`) or reuse an existing one
146
+ * (`"session"`). When `session_scope` is `"per_user"`, the `user` param is
147
+ * required for S2S and developer callers; authenticated client callers always
148
+ * use their own identity. When `session_scope` is `"per_key"`, `session_key`
149
+ * is required.
150
+ * Supply `idempotency_key` to safely retry invocations — if a completed run
151
+ * already exists for that key a 409 Conflict is returned rather than creating
152
+ * a duplicate run. Entitlement for LLM calls is checked at request time;
153
+ * customers on plans that do not include this feature receive 402.
154
+ * @param routine - Routine ID (`arn_...`) or `lookup_key` of the routine to invoke.
155
+ * @param input - Request body.
156
+ * @param input.idempotency_key - Unique key used to deduplicate invocations. Resubmitting the same key returns 409 if a completed run already exists.
157
+ * @param input.message - The user message to send to the agent for this invocation.
158
+ * @param input.metadata - Arbitrary key-value metadata attached to this invocation. Not interpreted by the platform.
159
+ * @param input.session_key - Arbitrary key used to identify and resume a session when `session_scope` is `"per_key"`. Required in that mode.
160
+ * @param input.thread_id - Thread ID (`thr_...`) to post the preset output into. Omit to skip thread posting.
161
+ * @param input.user - User ID to associate with the session. For S2S and developer callers only; authenticated client callers always use their own identity.
162
+ * @returns The agent routine run created by this invocation.
163
+ */
38
164
  async invoke(routine, input) {
39
165
  return this.http.request(`/api/v1/agent_routines/${routine}/invoke`, { method: "POST", body: input });
40
166
  }
167
+ /**
168
+ * Pause a routine
169
+ * Sets the routine's status to `"paused"`, suspending event processing and
170
+ * scheduled execution without deleting the routine or its configuration. A
171
+ * paused routine can be resumed at any time by calling the activate endpoint.
172
+ * Requires app scope.
173
+ * @param routine - Routine ID (`arn_...`) of the routine to pause.
174
+ * @returns The updated routine with `status` set to `"paused"`.
175
+ */
41
176
  async pause(routine) {
42
177
  return this.http.request(`/api/v1/agent_routines/${routine}/pause`, { method: "POST" });
43
178
  }
179
+ /**
180
+ * List runs for a routine
181
+ * Returns a cursor-paginated list of runs for the specified routine, ordered
182
+ * from most recent to oldest by default. Use `before_cursor` and `after_cursor`
183
+ * to page through results in either direction.
184
+ * You can filter runs by status to monitor a specific lifecycle phase. The
185
+ * authenticated principal must have access to the routine's parent app. When
186
+ * your API key is scoped to an app, only runs belonging to that app are
187
+ * returned.
188
+ * @param routine - Routine ID (`rtn_...`) whose runs you want to list.
189
+ * @param params - Query parameters.
190
+ * @param params.status - Filter runs by status. One of `"pending"`, `"running"`, `"completed"`, `"failed"`, or `"skipped"`. Omit to return runs in all statuses.
191
+ * @param params.limit - Maximum number of runs to return per page. Defaults to 50; maximum is 100.
192
+ * @param params.beforeCursor - Opaque cursor from a previous response's `before_cursor` field. Returns the page of runs older than this cursor.
193
+ * @param params.afterCursor - Opaque cursor from a previous response's `after_cursor` field. Returns the page of runs newer than this cursor.
194
+ * @returns Paginated list of routine runs.
195
+ */
44
196
  async runs(routine, params) {
45
- return this.http.request(`/api/v1/agent_routines/${routine}/runs`, { query: params });
197
+ const query = {};
198
+ if (params?.status !== undefined) {
199
+ query["status"] = params?.status;
200
+ }
201
+ if (params?.limit !== undefined) {
202
+ query["limit"] = params?.limit;
203
+ }
204
+ if (params?.beforeCursor !== undefined) {
205
+ query["before_cursor"] = params?.beforeCursor;
206
+ }
207
+ if (params?.afterCursor !== undefined) {
208
+ query["after_cursor"] = params?.afterCursor;
209
+ }
210
+ return this.http.request(`/api/v1/agent_routines/${routine}/runs`, { query });
46
211
  }
47
212
  }
48
213
  //# sourceMappingURL=agent_routines.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent_routines.js","sourceRoot":"","sources":["../../../src/v1/resources/agent_routines.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,wEAAwE;AACxE,6BAA6B;AAM7B,MAAM,OAAO,uBAAuB;IACd;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,+BAA+B,GAAG,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AAED,MAAM,OAAO,oBAAoB;IAGX;IAFX,kBAAkB,CAA0B;IAErD,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QAClC,IAAI,CAAC,kBAAkB,GAAG,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAA+C;QACxD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,MAAkG,EAAE,CAAC,CAAC;IACpK,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QAC1B,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,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AE,MAAM,CAAC;QACnC,CAAC;QACD,IAAI,MAAM,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,KAAK,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC;QACjC,CAAC;QACD,IAAI,MAAM,EAAE,YAAY,KAAK,SAAS,EAAE,CAAC;YACvC,KAAK,CAAC,eAAe,CAAC,GAAG,MAAM,EAAE,YAAY,CAAC;QAChD,CAAC;QACD,IAAI,MAAM,EAAE,WAAW,KAAK,SAAS,EAAE,CAAC;YACtC,KAAK,CAAC,cAAc,CAAC,GAAG,MAAM,EAAE,WAAW,CAAC;QAC9C,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,0BAA0B,OAAO,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAChF,CAAC;CACF"}
@@ -1,8 +1,26 @@
1
1
  import { HttpClient } from "../../runtime/http-client.js";
2
- import type { AgentSession, AgentSessionListResponse } from "../../types/agents.js";
2
+ import type { AgentSession, AgentSessionListResponse } from "../../types/common.js";
3
3
  export declare class AgentSessionResource {
4
4
  private http;
5
5
  constructor(http: HttpClient);
6
+ /**
7
+ * List agent sessions
8
+ * Returns a flat list of agent sessions visible to the authenticated app,
9
+ * ordered by creation time descending. Use the `agent`, `status`, and
10
+ * `routine_run` filters to narrow results.
11
+ * All filters are optional and can be combined. The `status` and `routine_run`
12
+ * parameters each accept multiple values; pass the parameter more than once or
13
+ * as a comma-separated array to match any of the supplied values.
14
+ * Requires an app-scoped API key. Results are limited to sessions that belong
15
+ * to agents owned by the authenticated app.
16
+ * @param params - Query parameters.
17
+ * @param params.agent - Filter by agent ID (`agi_...`). Omit to return sessions for all agents in the app.
18
+ * @param params.status - Filter by one or more session statuses. Accepted values are `"pending"`, `"running"`, `"waiting"`, `"completed"`, `"failed"`, and `"cancelled"`. Omit to return sessions in any status.
19
+ * @param params.routineRun - Filter to sessions that were created by the specified routine run IDs. Accepts up to 100 IDs. Omit to return sessions regardless of their originating routine run.
20
+ * @param params.excludeSystem - When `true`, omits sessions that were created automatically by the platform rather than by your app. Defaults to `false`.
21
+ * @param params.limit - Maximum number of sessions to return. Defaults to 25; maximum is 100.
22
+ * @returns A list of agent sessions matching the supplied filters.
23
+ */
6
24
  list(params?: {
7
25
  agent?: string;
8
26
  status?: string[];
@@ -10,6 +28,34 @@ export declare class AgentSessionResource {
10
28
  excludeSystem?: boolean;
11
29
  limit?: number;
12
30
  }): Promise<AgentSessionListResponse>;
31
+ /**
32
+ * Create an agent session
33
+ * Creates a new agent session and enqueues it for execution. The session begins
34
+ * in `"pending"` status and transitions to `"running"` once the platform picks
35
+ * it up. Subscribe to the session stream endpoint to receive real-time status
36
+ * updates.
37
+ * You must supply the ID of an agent that the authenticated app owns and a
38
+ * plain-text `instructions` string describing the task. All other parameters
39
+ * are optional and default to the agent's configured limits when omitted.
40
+ * Set `start_idle` to `true` to create the session without running an opening
41
+ * turn — it begins in `"waiting"` status and runs its first turn only once you
42
+ * post a message (see the message endpoint). Use this when you want the first
43
+ * message to drive the session instead of the `instructions` alone.
44
+ * Requires an app-scoped API key. Returns HTTP 201 on success.
45
+ * @param input - Request body.
46
+ * @param input.agent - Agent ID (`agi_...`) of the agent that will execute the session.
47
+ * @param input.instructions - Plain-text task description given to the agent as its primary objective for this session.
48
+ * @param input.max_runs_per_turn - Maximum number of tool invocations allowed within a single agent turn. Defaults to 25.
49
+ * @param input.max_tokens - Maximum number of tokens the agent may consume across all turns. Defaults to 20,000.
50
+ * @param input.max_turns - Maximum number of agent turns before the session is automatically terminated. Defaults to 100.
51
+ * @param input.metadata - Arbitrary key-value metadata to attach to the session. Stored and returned as-is; not interpreted by the platform.
52
+ * @param input.name - Human-readable display name for the session. Useful for identifying sessions in the dashboard. `null` if omitted.
53
+ * @param input.start_idle - When `true`, create the session without running an opening turn. The session starts in `"waiting"` status and runs its first turn only when you post a message. Defaults to `false`, which runs an initial turn from `instructions` immediately.
54
+ * @param input.team - Team ID (`tea_...`) to associate with this session for access-control and attribution purposes. `null` if omitted.
55
+ * @param input.thread - Thread ID (`thr_...`) to link this session to an existing conversation thread. `null` if omitted.
56
+ * @param input.user - User ID to associate with this session for attribution purposes. `null` if omitted.
57
+ * @returns The newly created agent session.
58
+ */
13
59
  create(input: {
14
60
  agent: string;
15
61
  instructions: string;
@@ -18,16 +64,87 @@ export declare class AgentSessionResource {
18
64
  max_turns?: number | undefined;
19
65
  metadata?: Record<string, unknown> | undefined;
20
66
  name?: string | undefined;
67
+ start_idle?: boolean | undefined;
21
68
  team?: string | undefined;
22
69
  thread?: string | undefined;
23
70
  user?: string | undefined;
24
71
  }): Promise<AgentSession>;
72
+ /**
73
+ * Delete an agent session
74
+ * Permanently deletes an agent session and its associated data. This action is
75
+ * irreversible — the session record, its trajectory, and all inbox messages are
76
+ * removed.
77
+ * To stop a running session without deleting it, use the cancel endpoint
78
+ * instead. The session must be in a terminal state (`"completed"`, `"failed"`,
79
+ * or `"cancelled"`) before it can be deleted; attempting to delete an active
80
+ * session returns 422.
81
+ * Requires an app-scoped API key. Returns HTTP 204 with no body on success.
82
+ * @param agentSession - Agent session ID (`ase_...`) of the session to delete.
83
+ * @returns Empty body. HTTP 204 indicates the session was permanently deleted.
84
+ */
25
85
  delete(agentSession: string): Promise<void>;
86
+ /**
87
+ * Retrieve an agent session
88
+ * Returns the agent session identified by `agent_session`. Use this endpoint
89
+ * to poll session status or to inspect the final result after execution
90
+ * completes.
91
+ * For real-time updates without polling, subscribe to the session stream
92
+ * endpoint instead, which delivers server-sent events whenever the session
93
+ * state changes.
94
+ * Requires an app-scoped API key. The session must belong to an agent owned
95
+ * by the authenticated app.
96
+ * @param agentSession - Agent session ID (`ase_...`) of the session to retrieve.
97
+ * @returns The requested agent session.
98
+ */
26
99
  get(agentSession: string): Promise<AgentSession>;
100
+ /**
101
+ * Update an agent session
102
+ * Updates the mutable fields of an agent session. Currently only `metadata`
103
+ * can be changed; supply any key-value pairs you want to store alongside the
104
+ * session. Omitting `metadata` leaves it unchanged.
105
+ * This endpoint may be called while the session is in any status, including
106
+ * while it is actively running.
107
+ * Requires an app-scoped API key. The session must belong to an agent owned
108
+ * by the authenticated app.
109
+ * @param agentSession - Agent session ID (`ase_...`) of the session to update.
110
+ * @param input - Request body.
111
+ * @param input.metadata - Arbitrary key-value metadata to attach to the session. Replaces the existing metadata map entirely. Omit to leave the current metadata unchanged.
112
+ * @returns The agent session with the updated fields applied.
113
+ */
27
114
  update(agentSession: string, input: {
28
115
  metadata?: Record<string, unknown> | undefined;
29
116
  }): Promise<AgentSession>;
117
+ /**
118
+ * Cancel an agent session
119
+ * Requests cancellation of an active agent session. The session status is set
120
+ * to `"cancelled"` and any in-progress agent turn is interrupted as soon as the
121
+ * platform can safely stop it.
122
+ * If the session is already in a terminal state (`"completed"`, `"failed"`, or
123
+ * `"cancelled"`), the call succeeds and returns the session unchanged — it is
124
+ * safe to call this endpoint more than once.
125
+ * Requires an app-scoped API key. The session must belong to an agent owned by
126
+ * the authenticated app.
127
+ * @param agentSession - Agent session ID (`ase_...`) of the session to cancel.
128
+ * @returns The agent session after the cancellation request is applied.
129
+ */
30
130
  cancel(agentSession: string): Promise<AgentSession>;
131
+ /**
132
+ * Send a message to an agent session
133
+ * Appends a message to the inbox of the specified agent session. The agent
134
+ * reads inbox messages at the start of each turn; sending a message to a
135
+ * `"waiting"` session signals it to resume execution.
136
+ * Use `role` to identify the sender type. The default role is `"user"`.
137
+ * Arbitrary key-value metadata may be attached to the message for tracking
138
+ * or display purposes.
139
+ * Requires an app-scoped API key. The session must belong to an agent owned
140
+ * by the authenticated app.
141
+ * @param agentSession - Agent session ID (`ase_...`) of the session whose inbox should receive the message.
142
+ * @param input - Request body.
143
+ * @param input.content - Plain-text body of the message to deliver to the agent.
144
+ * @param input.metadata - Arbitrary key-value metadata to attach to the message. Stored and returned as-is; not interpreted by the platform.
145
+ * @param input.role - Role of the message sender. Typically `"user"` or `"tool"`. Defaults to `"user"`.
146
+ * @returns The agent session with the new message appended to its `inbox`.
147
+ */
31
148
  message(agentSession: string, input: {
32
149
  content: string;
33
150
  metadata?: Record<string, unknown> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"agent_sessions.d.ts","sourceRoot":"","sources":["../../../src/v1/resources/agent_sessions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,qBAAa,oBAAoB;IACnB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE9B,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAIvJ,MAAM,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAIpV,MAAM,CAAC,YAAY,EAAE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AC,GAAG,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;CAGlK"}
@@ -1,29 +1,161 @@
1
1
  // Copyright (c) 2026 ArchAstro Inc. All Rights Reserved.
2
2
  // This file is auto-generated by @archastro/sdk-generator. Do not edit.
3
- // Content hash: abfc03d2a394
3
+ // Content hash: 9f8a611c75d9
4
4
  export class AgentSessionResource {
5
5
  http;
6
6
  constructor(http) {
7
7
  this.http = http;
8
8
  }
9
+ /**
10
+ * List agent sessions
11
+ * Returns a flat list of agent sessions visible to the authenticated app,
12
+ * ordered by creation time descending. Use the `agent`, `status`, and
13
+ * `routine_run` filters to narrow results.
14
+ * All filters are optional and can be combined. The `status` and `routine_run`
15
+ * parameters each accept multiple values; pass the parameter more than once or
16
+ * as a comma-separated array to match any of the supplied values.
17
+ * Requires an app-scoped API key. Results are limited to sessions that belong
18
+ * to agents owned by the authenticated app.
19
+ * @param params - Query parameters.
20
+ * @param params.agent - Filter by agent ID (`agi_...`). Omit to return sessions for all agents in the app.
21
+ * @param params.status - Filter by one or more session statuses. Accepted values are `"pending"`, `"running"`, `"waiting"`, `"completed"`, `"failed"`, and `"cancelled"`. Omit to return sessions in any status.
22
+ * @param params.routineRun - Filter to sessions that were created by the specified routine run IDs. Accepts up to 100 IDs. Omit to return sessions regardless of their originating routine run.
23
+ * @param params.excludeSystem - When `true`, omits sessions that were created automatically by the platform rather than by your app. Defaults to `false`.
24
+ * @param params.limit - Maximum number of sessions to return. Defaults to 25; maximum is 100.
25
+ * @returns A list of agent sessions matching the supplied filters.
26
+ */
9
27
  async list(params) {
10
- return this.http.request(`/api/v1/agent_sessions`, { query: params });
28
+ const query = {};
29
+ if (params?.agent !== undefined) {
30
+ query["agent"] = params?.agent;
31
+ }
32
+ if (params?.status !== undefined) {
33
+ query["status"] = params?.status;
34
+ }
35
+ if (params?.routineRun !== undefined) {
36
+ query["routine_run"] = params?.routineRun;
37
+ }
38
+ if (params?.excludeSystem !== undefined) {
39
+ query["exclude_system"] = params?.excludeSystem;
40
+ }
41
+ if (params?.limit !== undefined) {
42
+ query["limit"] = params?.limit;
43
+ }
44
+ return this.http.request(`/api/v1/agent_sessions`, { query });
11
45
  }
46
+ /**
47
+ * Create an agent session
48
+ * Creates a new agent session and enqueues it for execution. The session begins
49
+ * in `"pending"` status and transitions to `"running"` once the platform picks
50
+ * it up. Subscribe to the session stream endpoint to receive real-time status
51
+ * updates.
52
+ * You must supply the ID of an agent that the authenticated app owns and a
53
+ * plain-text `instructions` string describing the task. All other parameters
54
+ * are optional and default to the agent's configured limits when omitted.
55
+ * Set `start_idle` to `true` to create the session without running an opening
56
+ * turn — it begins in `"waiting"` status and runs its first turn only once you
57
+ * post a message (see the message endpoint). Use this when you want the first
58
+ * message to drive the session instead of the `instructions` alone.
59
+ * Requires an app-scoped API key. Returns HTTP 201 on success.
60
+ * @param input - Request body.
61
+ * @param input.agent - Agent ID (`agi_...`) of the agent that will execute the session.
62
+ * @param input.instructions - Plain-text task description given to the agent as its primary objective for this session.
63
+ * @param input.max_runs_per_turn - Maximum number of tool invocations allowed within a single agent turn. Defaults to 25.
64
+ * @param input.max_tokens - Maximum number of tokens the agent may consume across all turns. Defaults to 20,000.
65
+ * @param input.max_turns - Maximum number of agent turns before the session is automatically terminated. Defaults to 100.
66
+ * @param input.metadata - Arbitrary key-value metadata to attach to the session. Stored and returned as-is; not interpreted by the platform.
67
+ * @param input.name - Human-readable display name for the session. Useful for identifying sessions in the dashboard. `null` if omitted.
68
+ * @param input.start_idle - When `true`, create the session without running an opening turn. The session starts in `"waiting"` status and runs its first turn only when you post a message. Defaults to `false`, which runs an initial turn from `instructions` immediately.
69
+ * @param input.team - Team ID (`tea_...`) to associate with this session for access-control and attribution purposes. `null` if omitted.
70
+ * @param input.thread - Thread ID (`thr_...`) to link this session to an existing conversation thread. `null` if omitted.
71
+ * @param input.user - User ID to associate with this session for attribution purposes. `null` if omitted.
72
+ * @returns The newly created agent session.
73
+ */
12
74
  async create(input) {
13
75
  return this.http.request(`/api/v1/agent_sessions`, { method: "POST", body: input });
14
76
  }
77
+ /**
78
+ * Delete an agent session
79
+ * Permanently deletes an agent session and its associated data. This action is
80
+ * irreversible — the session record, its trajectory, and all inbox messages are
81
+ * removed.
82
+ * To stop a running session without deleting it, use the cancel endpoint
83
+ * instead. The session must be in a terminal state (`"completed"`, `"failed"`,
84
+ * or `"cancelled"`) before it can be deleted; attempting to delete an active
85
+ * session returns 422.
86
+ * Requires an app-scoped API key. Returns HTTP 204 with no body on success.
87
+ * @param agentSession - Agent session ID (`ase_...`) of the session to delete.
88
+ * @returns Empty body. HTTP 204 indicates the session was permanently deleted.
89
+ */
15
90
  async delete(agentSession) {
16
91
  await this.http.request(`/api/v1/agent_sessions/${agentSession}`, { method: "DELETE" });
17
92
  }
93
+ /**
94
+ * Retrieve an agent session
95
+ * Returns the agent session identified by `agent_session`. Use this endpoint
96
+ * to poll session status or to inspect the final result after execution
97
+ * completes.
98
+ * For real-time updates without polling, subscribe to the session stream
99
+ * endpoint instead, which delivers server-sent events whenever the session
100
+ * state changes.
101
+ * Requires an app-scoped API key. The session must belong to an agent owned
102
+ * by the authenticated app.
103
+ * @param agentSession - Agent session ID (`ase_...`) of the session to retrieve.
104
+ * @returns The requested agent session.
105
+ */
18
106
  async get(agentSession) {
19
107
  return this.http.request(`/api/v1/agent_sessions/${agentSession}`);
20
108
  }
109
+ /**
110
+ * Update an agent session
111
+ * Updates the mutable fields of an agent session. Currently only `metadata`
112
+ * can be changed; supply any key-value pairs you want to store alongside the
113
+ * session. Omitting `metadata` leaves it unchanged.
114
+ * This endpoint may be called while the session is in any status, including
115
+ * while it is actively running.
116
+ * Requires an app-scoped API key. The session must belong to an agent owned
117
+ * by the authenticated app.
118
+ * @param agentSession - Agent session ID (`ase_...`) of the session to update.
119
+ * @param input - Request body.
120
+ * @param input.metadata - Arbitrary key-value metadata to attach to the session. Replaces the existing metadata map entirely. Omit to leave the current metadata unchanged.
121
+ * @returns The agent session with the updated fields applied.
122
+ */
21
123
  async update(agentSession, input) {
22
124
  return this.http.request(`/api/v1/agent_sessions/${agentSession}`, { method: "PATCH", body: input });
23
125
  }
126
+ /**
127
+ * Cancel an agent session
128
+ * Requests cancellation of an active agent session. The session status is set
129
+ * to `"cancelled"` and any in-progress agent turn is interrupted as soon as the
130
+ * platform can safely stop it.
131
+ * If the session is already in a terminal state (`"completed"`, `"failed"`, or
132
+ * `"cancelled"`), the call succeeds and returns the session unchanged — it is
133
+ * safe to call this endpoint more than once.
134
+ * Requires an app-scoped API key. The session must belong to an agent owned by
135
+ * the authenticated app.
136
+ * @param agentSession - Agent session ID (`ase_...`) of the session to cancel.
137
+ * @returns The agent session after the cancellation request is applied.
138
+ */
24
139
  async cancel(agentSession) {
25
140
  return this.http.request(`/api/v1/agent_sessions/${agentSession}/cancel`, { method: "POST" });
26
141
  }
142
+ /**
143
+ * Send a message to an agent session
144
+ * Appends a message to the inbox of the specified agent session. The agent
145
+ * reads inbox messages at the start of each turn; sending a message to a
146
+ * `"waiting"` session signals it to resume execution.
147
+ * Use `role` to identify the sender type. The default role is `"user"`.
148
+ * Arbitrary key-value metadata may be attached to the message for tracking
149
+ * or display purposes.
150
+ * Requires an app-scoped API key. The session must belong to an agent owned
151
+ * by the authenticated app.
152
+ * @param agentSession - Agent session ID (`ase_...`) of the session whose inbox should receive the message.
153
+ * @param input - Request body.
154
+ * @param input.content - Plain-text body of the message to deliver to the agent.
155
+ * @param input.metadata - Arbitrary key-value metadata to attach to the message. Stored and returned as-is; not interpreted by the platform.
156
+ * @param input.role - Role of the message sender. Typically `"user"` or `"tool"`. Defaults to `"user"`.
157
+ * @returns The agent session with the new message appended to its `inbox`.
158
+ */
27
159
  async message(agentSession, input) {
28
160
  return this.http.request(`/api/v1/agent_sessions/${agentSession}/message`, { method: "POST", body: input });
29
161
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent_sessions.js","sourceRoot":"","sources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