@archastro/sdk 0.4.0 → 0.5.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 (260) hide show
  1. package/dist/auth.d.ts +1 -1
  2. package/dist/auth.d.ts.map +1 -1
  3. package/dist/auth.js +8 -8
  4. package/dist/auth.js.map +1 -1
  5. package/dist/channels/api_activity_feed_channel.d.ts +11 -3
  6. package/dist/channels/api_activity_feed_channel.d.ts.map +1 -1
  7. package/dist/channels/api_activity_feed_channel.js +24 -4
  8. package/dist/channels/api_activity_feed_channel.js.map +1 -1
  9. package/dist/channels/api_chat_channel.d.ts +53 -7
  10. package/dist/channels/api_chat_channel.d.ts.map +1 -1
  11. package/dist/channels/api_chat_channel.js +56 -8
  12. package/dist/channels/api_chat_channel.js.map +1 -1
  13. package/dist/channels/api_object_channel.d.ts +9 -3
  14. package/dist/channels/api_object_channel.d.ts.map +1 -1
  15. package/dist/channels/api_object_channel.js +22 -4
  16. package/dist/channels/api_object_channel.js.map +1 -1
  17. package/dist/client.d.ts +6 -0
  18. package/dist/client.d.ts.map +1 -1
  19. package/dist/client.js +7 -1
  20. package/dist/client.js.map +1 -1
  21. package/dist/phx_channel/channel.d.ts +10 -1
  22. package/dist/phx_channel/channel.d.ts.map +1 -1
  23. package/dist/phx_channel/channel.js +5 -5
  24. package/dist/phx_channel/channel.js.map +1 -1
  25. package/dist/phx_channel/socket.d.ts +0 -1
  26. package/dist/phx_channel/socket.d.ts.map +1 -1
  27. package/dist/phx_channel/socket.js +15 -12
  28. package/dist/phx_channel/socket.js.map +1 -1
  29. package/dist/types/agents.d.ts +987 -1388
  30. package/dist/types/agents.d.ts.map +1 -1
  31. package/dist/types/agents.js +104 -153
  32. package/dist/types/agents.js.map +1 -1
  33. package/dist/types/ai.d.ts +8 -76
  34. package/dist/types/ai.d.ts.map +1 -1
  35. package/dist/types/ai.js +1 -21
  36. package/dist/types/ai.js.map +1 -1
  37. package/dist/types/artifacts.d.ts +4 -83
  38. package/dist/types/artifacts.d.ts.map +1 -1
  39. package/dist/types/artifacts.js +1 -15
  40. package/dist/types/artifacts.js.map +1 -1
  41. package/dist/types/automations.d.ts +2 -68
  42. package/dist/types/automations.d.ts.map +1 -1
  43. package/dist/types/automations.js +1 -26
  44. package/dist/types/automations.js.map +1 -1
  45. package/dist/types/chat.d.ts +12 -12
  46. package/dist/types/common.d.ts +1716 -6242
  47. package/dist/types/common.d.ts.map +1 -1
  48. package/dist/types/common.js +247 -1202
  49. package/dist/types/common.js.map +1 -1
  50. package/dist/types/config.d.ts +10 -62
  51. package/dist/types/config.d.ts.map +1 -1
  52. package/dist/types/config.js +3 -25
  53. package/dist/types/config.js.map +1 -1
  54. package/dist/types/index.d.ts +1 -6
  55. package/dist/types/index.d.ts.map +1 -1
  56. package/dist/types/index.js +2 -7
  57. package/dist/types/index.js.map +1 -1
  58. package/dist/types/invites.d.ts +63 -0
  59. package/dist/types/invites.d.ts.map +1 -0
  60. package/dist/types/invites.js +18 -0
  61. package/dist/types/invites.js.map +1 -0
  62. package/dist/types/members.d.ts +30 -30
  63. package/dist/types/members.d.ts.map +1 -1
  64. package/dist/types/members.js +14 -14
  65. package/dist/types/members.js.map +1 -1
  66. package/dist/types/orgs.d.ts +56 -56
  67. package/dist/types/orgs.d.ts.map +1 -1
  68. package/dist/types/orgs.js +25 -25
  69. package/dist/types/orgs.js.map +1 -1
  70. package/dist/types/reactions.d.ts +2 -2
  71. package/dist/types/schedules.d.ts +4 -4
  72. package/dist/types/teams.d.ts +97 -389
  73. package/dist/types/teams.d.ts.map +1 -1
  74. package/dist/types/teams.js +5 -37
  75. package/dist/types/teams.js.map +1 -1
  76. package/dist/types/threads.d.ts +52 -682
  77. package/dist/types/threads.d.ts.map +1 -1
  78. package/dist/types/threads.js +7 -114
  79. package/dist/types/threads.js.map +1 -1
  80. package/dist/types/users.d.ts +63 -63
  81. package/dist/types/users.d.ts.map +1 -1
  82. package/dist/types/users.js +3 -15
  83. package/dist/types/users.js.map +1 -1
  84. package/dist/v1/resources/activity_feed.d.ts +83 -0
  85. package/dist/v1/resources/activity_feed.d.ts.map +1 -0
  86. package/dist/v1/resources/activity_feed.js +13 -0
  87. package/dist/v1/resources/activity_feed.js.map +1 -0
  88. package/dist/v1/resources/agent_computers.d.ts +5 -2
  89. package/dist/v1/resources/agent_computers.d.ts.map +1 -1
  90. package/dist/v1/resources/agent_computers.js +4 -4
  91. package/dist/v1/resources/agent_computers.js.map +1 -1
  92. package/dist/v1/resources/agent_installations.d.ts +9 -4
  93. package/dist/v1/resources/agent_installations.d.ts.map +1 -1
  94. package/dist/v1/resources/agent_installations.js +7 -7
  95. package/dist/v1/resources/agent_installations.js.map +1 -1
  96. package/dist/v1/resources/agent_routines.d.ts +73 -10
  97. package/dist/v1/resources/agent_routines.d.ts.map +1 -1
  98. package/dist/v1/resources/agent_routines.js +13 -13
  99. package/dist/v1/resources/agent_routines.js.map +1 -1
  100. package/dist/v1/resources/agent_sessions.d.ts +23 -6
  101. package/dist/v1/resources/agent_sessions.d.ts.map +1 -1
  102. package/dist/v1/resources/agent_sessions.js +8 -8
  103. package/dist/v1/resources/agent_sessions.js.map +1 -1
  104. package/dist/v1/resources/agent_skills.d.ts +14 -6
  105. package/dist/v1/resources/agent_skills.d.ts.map +1 -1
  106. package/dist/v1/resources/agent_skills.js +10 -10
  107. package/dist/v1/resources/agent_skills.js.map +1 -1
  108. package/dist/v1/resources/agent_tools.d.ts +17 -6
  109. package/dist/v1/resources/agent_tools.d.ts.map +1 -1
  110. package/dist/v1/resources/agent_tools.js +11 -11
  111. package/dist/v1/resources/agent_tools.js.map +1 -1
  112. package/dist/v1/resources/agents.d.ts +191 -22
  113. package/dist/v1/resources/agents.d.ts.map +1 -1
  114. package/dist/v1/resources/agents.js +22 -22
  115. package/dist/v1/resources/agents.js.map +1 -1
  116. package/dist/v1/resources/ai.d.ts +67 -3
  117. package/dist/v1/resources/ai.d.ts.map +1 -1
  118. package/dist/v1/resources/ai.js +4 -4
  119. package/dist/v1/resources/ai.js.map +1 -1
  120. package/dist/v1/resources/artifacts.d.ts +9 -2
  121. package/dist/v1/resources/artifacts.d.ts.map +1 -1
  122. package/dist/v1/resources/artifacts.js +4 -4
  123. package/dist/v1/resources/artifacts.js.map +1 -1
  124. package/dist/v1/resources/automations.d.ts +4 -1
  125. package/dist/v1/resources/automations.d.ts.map +1 -1
  126. package/dist/v1/resources/automations.js +1 -1
  127. package/dist/v1/resources/automations.js.map +1 -1
  128. package/dist/v1/resources/config.d.ts +70 -22
  129. package/dist/v1/resources/config.d.ts.map +1 -1
  130. package/dist/v1/resources/config.js +20 -20
  131. package/dist/v1/resources/config.js.map +1 -1
  132. package/dist/v1/resources/custom_objects.d.ts +5 -1
  133. package/dist/v1/resources/custom_objects.d.ts.map +1 -1
  134. package/dist/v1/resources/custom_objects.js +1 -1
  135. package/dist/v1/resources/custom_objects.js.map +1 -1
  136. package/dist/v1/resources/index.d.ts +3 -0
  137. package/dist/v1/resources/index.d.ts.map +1 -1
  138. package/dist/v1/resources/index.js +4 -1
  139. package/dist/v1/resources/index.js.map +1 -1
  140. package/dist/v1/resources/invites.d.ts +10 -0
  141. package/dist/v1/resources/invites.d.ts.map +1 -0
  142. package/dist/v1/resources/invites.js +13 -0
  143. package/dist/v1/resources/invites.js.map +1 -0
  144. package/dist/v1/resources/kv.d.ts +27 -0
  145. package/dist/v1/resources/kv.d.ts.map +1 -0
  146. package/dist/v1/resources/kv.js +25 -0
  147. package/dist/v1/resources/kv.js.map +1 -0
  148. package/dist/v1/resources/orgs.js +1 -1
  149. package/dist/v1/resources/orgs.js.map +1 -1
  150. package/dist/v1/resources/team_memberships.d.ts +1 -1
  151. package/dist/v1/resources/team_memberships.d.ts.map +1 -1
  152. package/dist/v1/resources/team_memberships.js +4 -4
  153. package/dist/v1/resources/team_memberships.js.map +1 -1
  154. package/dist/v1/resources/teams.d.ts +108 -27
  155. package/dist/v1/resources/teams.d.ts.map +1 -1
  156. package/dist/v1/resources/teams.js +13 -13
  157. package/dist/v1/resources/teams.js.map +1 -1
  158. package/dist/v1/resources/thread_messages.d.ts +7 -3
  159. package/dist/v1/resources/thread_messages.d.ts.map +1 -1
  160. package/dist/v1/resources/thread_messages.js +4 -4
  161. package/dist/v1/resources/thread_messages.js.map +1 -1
  162. package/dist/v1/resources/threads.d.ts +71 -45
  163. package/dist/v1/resources/threads.d.ts.map +1 -1
  164. package/dist/v1/resources/threads.js +19 -19
  165. package/dist/v1/resources/threads.js.map +1 -1
  166. package/dist/v1/resources/users.d.ts +43 -6
  167. package/dist/v1/resources/users.d.ts.map +1 -1
  168. package/dist/v1/resources/users.js +7 -4
  169. package/dist/v1/resources/users.js.map +1 -1
  170. package/dist/v1.d.ts +6 -0
  171. package/dist/v1.d.ts.map +1 -1
  172. package/dist/v1.js +10 -1
  173. package/dist/v1.js.map +1 -1
  174. package/package.json +6 -2
  175. package/LICENSE +0 -21
  176. package/README.md +0 -165
  177. package/dist/types/api.d.ts +0 -169
  178. package/dist/types/api.d.ts.map +0 -1
  179. package/dist/types/api.js +0 -49
  180. package/dist/types/api.js.map +0 -1
  181. package/dist/types/device.d.ts +0 -26
  182. package/dist/types/device.d.ts.map +0 -1
  183. package/dist/types/device.js +0 -14
  184. package/dist/types/device.js.map +0 -1
  185. package/dist/types/invite.d.ts +0 -17
  186. package/dist/types/invite.d.ts.map +0 -1
  187. package/dist/types/invite.js +0 -11
  188. package/dist/types/invite.js.map +0 -1
  189. package/dist/types/me.d.ts +0 -257
  190. package/dist/types/me.d.ts.map +0 -1
  191. package/dist/types/me.js +0 -42
  192. package/dist/types/me.js.map +0 -1
  193. package/dist/types/messages.d.ts +0 -517
  194. package/dist/types/messages.d.ts.map +0 -1
  195. package/dist/types/messages.js +0 -50
  196. package/dist/types/messages.js.map +0 -1
  197. package/dist/types/oauth.d.ts +0 -206
  198. package/dist/types/oauth.d.ts.map +0 -1
  199. package/dist/types/oauth.js +0 -51
  200. package/dist/types/oauth.js.map +0 -1
  201. package/dist/types/picture.d.ts +0 -20
  202. package/dist/types/picture.d.ts.map +0 -1
  203. package/dist/types/picture.js +0 -14
  204. package/dist/types/picture.js.map +0 -1
  205. package/dist/types/profile.d.ts +0 -17
  206. package/dist/types/profile.d.ts.map +0 -1
  207. package/dist/types/profile.js +0 -11
  208. package/dist/types/profile.js.map +0 -1
  209. package/dist/types/runs.d.ts +0 -46
  210. package/dist/types/runs.d.ts.map +0 -1
  211. package/dist/types/runs.js +0 -15
  212. package/dist/types/runs.js.map +0 -1
  213. package/dist/v1/resources/ai_chat_completions.d.ts +0 -49
  214. package/dist/v1/resources/ai_chat_completions.d.ts.map +0 -1
  215. package/dist/v1/resources/ai_chat_completions.js +0 -14
  216. package/dist/v1/resources/ai_chat_completions.js.map +0 -1
  217. package/dist/v1/resources/ai_chat_models.d.ts +0 -12
  218. package/dist/v1/resources/ai_chat_models.d.ts.map +0 -1
  219. package/dist/v1/resources/ai_chat_models.js +0 -14
  220. package/dist/v1/resources/ai_chat_models.js.map +0 -1
  221. package/dist/v1/resources/ai_image_edits.d.ts +0 -20
  222. package/dist/v1/resources/ai_image_edits.d.ts.map +0 -1
  223. package/dist/v1/resources/ai_image_edits.js +0 -14
  224. package/dist/v1/resources/ai_image_edits.js.map +0 -1
  225. package/dist/v1/resources/ai_image_generations.d.ts +0 -20
  226. package/dist/v1/resources/ai_image_generations.d.ts.map +0 -1
  227. package/dist/v1/resources/ai_image_generations.js +0 -14
  228. package/dist/v1/resources/ai_image_generations.js.map +0 -1
  229. package/dist/v1/resources/ai_image_models.d.ts +0 -12
  230. package/dist/v1/resources/ai_image_models.d.ts.map +0 -1
  231. package/dist/v1/resources/ai_image_models.js +0 -14
  232. package/dist/v1/resources/ai_image_models.js.map +0 -1
  233. package/dist/v1/resources/api.d.ts +0 -1026
  234. package/dist/v1/resources/api.d.ts.map +0 -1
  235. package/dist/v1/resources/api.js +0 -944
  236. package/dist/v1/resources/api.js.map +0 -1
  237. package/dist/v1/resources/completions.d.ts +0 -49
  238. package/dist/v1/resources/completions.d.ts.map +0 -1
  239. package/dist/v1/resources/completions.js +0 -14
  240. package/dist/v1/resources/completions.js.map +0 -1
  241. package/dist/v1/resources/edits.d.ts +0 -20
  242. package/dist/v1/resources/edits.d.ts.map +0 -1
  243. package/dist/v1/resources/edits.js +0 -14
  244. package/dist/v1/resources/edits.js.map +0 -1
  245. package/dist/v1/resources/generations.d.ts +0 -20
  246. package/dist/v1/resources/generations.d.ts.map +0 -1
  247. package/dist/v1/resources/generations.js +0 -14
  248. package/dist/v1/resources/generations.js.map +0 -1
  249. package/dist/v1/resources/invoke.d.ts +0 -29
  250. package/dist/v1/resources/invoke.d.ts.map +0 -1
  251. package/dist/v1/resources/invoke.js +0 -23
  252. package/dist/v1/resources/invoke.js.map +0 -1
  253. package/dist/v1/resources/models.d.ts +0 -12
  254. package/dist/v1/resources/models.d.ts.map +0 -1
  255. package/dist/v1/resources/models.js +0 -14
  256. package/dist/v1/resources/models.js.map +0 -1
  257. package/dist/v1/resources/oauth.d.ts +0 -25
  258. package/dist/v1/resources/oauth.d.ts.map +0 -1
  259. package/dist/v1/resources/oauth.js +0 -41
  260. package/dist/v1/resources/oauth.js.map +0 -1
@@ -1,9 +1,41 @@
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: 0bbab3d3f31f
3
+ // Content hash: 4303c5c9f783
4
4
  import { z } from "zod";
5
5
  import { imageSourceSchema } from "./image.js";
6
6
  import { userSchema } from "./users.js";
7
+ /** API schema for a single ACL grant entry. */
8
+ export const aclGrantSchema = z.object({
9
+ actions: z.array(z.string()), // List of allowed actions (e.g. read, write)
10
+ principal: z.string().optional(), // Principal identifier (UUID for user/team/org/agent_user, role name for org_role, omit for everyone)
11
+ principal_type: z.string(), // Principal type: user, team, org, org_role, agent, or everyone
12
+ });
13
+ /** API schema for identifying a principal to remove from an ACL. */
14
+ export const aclRemoveTargetSchema = z.object({
15
+ principal: z.string().optional(), // Principal identifier to remove (omit for everyone)
16
+ principal_type: z.string(), // Principal type to remove
17
+ });
18
+ /** Reusable API schema for access control lists.
19
+
20
+ Supports two modes (mutually exclusive):
21
+
22
+ **Replace mode** — send `grants` to replace all entries:
23
+
24
+ {"grants": [{"principal_type": "user", "principal": "...", "actions": ["read"]}]}
25
+
26
+ Use `{"grants": []}` to clear all entries.
27
+
28
+ **Patch mode** — send `add` and/or `remove`:
29
+
30
+ {"add": [...grants...], "remove": [{"principal_type": "user", "principal": "..."}]}
31
+
32
+ Cannot mix `grants` with `add`/`remove`.
33
+ */
34
+ export const aclSchema = z.object({
35
+ add: z.array(aclGrantSchema).optional(), // Patch mode: grants to add or merge into existing
36
+ grants: z.array(aclGrantSchema).optional(), // Replace mode: full list of grants (replaces all existing). Use [] to clear.
37
+ remove: z.array(aclRemoveTargetSchema).optional(), // Patch mode: principals to remove from existing
38
+ });
7
39
  /** Schema for a message actor (user or agent).
8
40
 
9
41
  Actors represent the entity that sent a message.
@@ -15,6 +47,38 @@ export const actorSchema = z.object({
15
47
  name: z.string().optional(), // Actor display name
16
48
  profile_picture: imageSourceSchema.optional(), // Profile picture
17
49
  });
50
+ /** API schema for per-routine LLM invocation settings.
51
+
52
+ Mirrors `ArchAstro.Agents.Routines.LLMConfig`. When `model` is present,
53
+ it overrides the agent's `default_model` for the routine (or step).
54
+ */
55
+ export const lLMConfigSchema = z.object({
56
+ model: z.string().optional(), // Model identifier. When set, overrides the agent's default_model.
57
+ });
58
+ /** API schema for preset handler configuration.
59
+
60
+ Mirrors `ArchAstro.Agents.Routines.PresetConfig`. Used wherever a request
61
+ or response carries a preset config — routine-level and chain-step-level.
62
+
63
+ Server-side validation (length/format rules on `instructions`, enum checks
64
+ on `session_mode`/`session_scope`, model lookup against
65
+ `ChatCompletion.models/0`) is authoritative. This schema defines the
66
+ request shape and typed response shape so OpenAPI consumers see real
67
+ types instead of an opaque object.
68
+ */
69
+ export const presetConfigSchema = z.object({
70
+ instructions: z.string().optional(), // Custom task or behavior instructions for the preset (max 10,000 chars).
71
+ llm: lLMConfigSchema.optional(), // LLM invocation settings (e.g. a `model` override for this routine/step).
72
+ session_mode: z.string().optional(), // Session mode: `stateless` (default, new session per trigger) or `session` (find-or-create a persistent session scoped by `session_scope`).
73
+ session_scope: z.string().optional(), // When `session_mode` is `session`, controls session scoping: `per_user` (default), `per_key`, `per_org`, or `global`.
74
+ structured_message_template_ids: z.array(z.string()).optional(), // Config IDs of AgentMessageSchema templates that constrain the agent's responses to predefined structured formats.
75
+ });
76
+ /** API schema for background worker status on a routine run. */
77
+ export const workerStatusSchema = z.object({
78
+ attempt: z.number().int(), // Current attempt number (0 = not yet attempted)
79
+ max_attempts: z.number().int(), // Maximum allowed attempts
80
+ status: z.string(), // Worker state: queued, executing, retrying, completed, discarded, or cancelled
81
+ });
18
82
  /** API schema for a media variant. */
19
83
  export const mediaVariantSchema = z.object({
20
84
  content_type: z.string().optional(), // File content type
@@ -55,6 +119,156 @@ export const attachmentSchema = z.object({
55
119
  version: z.number().int().optional(), // Artifact version number (artifact type)
56
120
  width: z.number().int().optional(), // Media width (media type)
57
121
  });
122
+ /** API schema for authentication token responses. */
123
+ export const authTokensSchema = z.object({
124
+ expires_in: z.number().int(), // Token TTL in seconds
125
+ metadata: z.record(z.unknown()).optional(), // Additional metadata (e.g., onboarding_job_id)
126
+ refresh_token: z.string(), // Refresh token
127
+ token: z.string(), // Access token (JWT)
128
+ token_type: z.string(), // Token type (Bearer)
129
+ user: userSchema, // Authenticated user
130
+ });
131
+ /** An individual tool within a builtin tool catalog entry. */
132
+ export const builtinToolSchema = z.object({
133
+ description: z.string().optional(), // Tool description
134
+ name: z.string(), // Tool name
135
+ });
136
+ /** A builtin tool catalog entry describing an available tool category. */
137
+ export const builtinToolCatalogEntrySchema = z.object({
138
+ config_schema: z.record(z.unknown()).optional(), // JSON schema for tool configuration
139
+ description: z.string().optional(), // Tool description
140
+ instruction: z.string().optional(), // Tool instruction
141
+ key: z.string(), // Unique tool key
142
+ label: z.string().optional(), // Display label
143
+ providers: z.array(z.string()).optional(), // Supported providers
144
+ requires_integration: z.boolean().optional(), // Whether an integration is required
145
+ server_tool_type: z.string().optional(), // Server tool type identifier
146
+ tools: z.array(builtinToolSchema).optional(), // List of individual tools
147
+ });
148
+ /** Result of executing a command on an agent computer. */
149
+ export const computerExecResultSchema = z.object({
150
+ exit_code: z.number().int().optional(), // Process exit code
151
+ output: z.string().optional(), // Command output
152
+ });
153
+ /** API schema for a custom object. */
154
+ export const customObjectSchema = z.object({
155
+ created_at: z.string().optional(), // Created timestamp
156
+ fields: z.record(z.unknown()).optional(), // Object field values
157
+ id: z.string(), // Public ID (cobj_...)
158
+ org: z.string().optional(), // Organization
159
+ row_key: z.string().optional(), // Row key
160
+ sandbox: z.string().optional(), // Sandbox identifier
161
+ schema_type: z.string().optional(), // Schema type (lookup_key)
162
+ team: z.string().optional(), // Owning team
163
+ updated_at: z.string().optional(), // Updated timestamp
164
+ user: z.string().optional(), // Owning user
165
+ version: z.number().int().optional(), // Aggregate version for OCC
166
+ });
167
+ /** API schema for OAuth device authorization responses. */
168
+ export const deviceAuthorizationResponseSchema = z.object({
169
+ device_code: z.string(), // Device verification code
170
+ expires_in: z.number().int(), // TTL in seconds
171
+ interval: z.number().int(), // Polling interval in seconds
172
+ user_code: z.string(), // User-facing verification code
173
+ verification_uri: z.string(), // Base verification URI
174
+ verification_uri_complete: z.string(), // Full verification URI with code
175
+ });
176
+ /** API schema for OAuth device authorization approval and denial responses. */
177
+ export const deviceAuthorizationStatusResponseSchema = z.object({
178
+ status: z.string(), // Authorization status (approved or denied)
179
+ });
180
+ /** API schema for an installation. */
181
+ export const installationSchema = z.object({
182
+ agent: z.string().optional(), // Owning agent
183
+ config: z.record(z.unknown()).optional(), // Configuration
184
+ created_at: z.string().optional(), // Creation timestamp
185
+ id: z.string(), // Installation ID (cin_...)
186
+ kind: z.string().optional(), // Installation kind
187
+ shared_integration: z.string().optional(), // Bound shared integration
188
+ state: z.string().optional(), // Installation state
189
+ status_payload: z.record(z.unknown()).optional(), // Status payload
190
+ updated_at: z.string().optional(), // Last update timestamp
191
+ });
192
+ /** API schema for an installation kind. */
193
+ export const installationKindSchema = z.object({
194
+ accepts_sources: z.boolean().optional(), // Whether this kind accepts sources
195
+ category: z.string().optional(), // Category
196
+ config_schema: z.record(z.unknown()).optional(), // JSON schema for configuration
197
+ description: z.string().optional(), // Description
198
+ kind: z.string(), // Installation kind identifier
199
+ label: z.string().optional(), // Display label
200
+ provider: z.string().optional(), // Integration provider
201
+ requires_integration: z.boolean().optional(), // Whether this kind requires an integration
202
+ });
203
+ /** List response for installation kinds. */
204
+ export const installationKindListResponseSchema = z.object({
205
+ data: z.array(installationKindSchema), // List of installation kinds
206
+ });
207
+ /** List response for installations. */
208
+ export const installationListResponseSchema = z.object({
209
+ data: z.array(installationSchema), // List of installations
210
+ });
211
+ /** API schema for an installation source. */
212
+ export const installationSourceSchema = z.object({
213
+ agent: z.string().optional(), // Owning agent
214
+ context_installation: z.string().optional(), // Installation ID
215
+ created_at: z.string().optional(), // Creation timestamp
216
+ id: z.string(), // Source ID (cso_...)
217
+ metadata: z.record(z.unknown()).optional(), // Arbitrary metadata
218
+ parent_source: z.string().optional(), // Parent source ID
219
+ payload: z.record(z.unknown()).optional(), // Source payload
220
+ state: z.string().optional(), // Source state
221
+ team: z.string().optional(), // Team ID
222
+ thread: z.string().optional(), // Thread ID
223
+ type: z.string().optional(), // Source type
224
+ updated_at: z.string().optional(), // Last update timestamp
225
+ user: z.string().optional(), // User ID
226
+ });
227
+ /** List response for installation sources. */
228
+ export const installationSourceListResponseSchema = z.object({
229
+ data: z.array(installationSourceSchema), // List of installation sources
230
+ });
231
+ /** Schema for a key-value storage entry.
232
+
233
+ Maps exactly to render_entry/1 output in ApiStorageController.
234
+ */
235
+ export const keyValueStorageEntrySchema = z.object({
236
+ created_at: z.string().optional(), // Creation timestamp
237
+ key: z.string(), // Storage key
238
+ updated_at: z.string().optional(), // Last update timestamp
239
+ user: z.string(), // User
240
+ value: z.string(), // Stored value
241
+ });
242
+ /** Schema for a key-value storage entry, optionally enriched with a summary of
243
+ the owning user.
244
+
245
+ Used by the dual-mode list endpoint: user-JWT callers omit the user_email /
246
+ user_name fields (they know who they are); developer / S2S callers populate
247
+ them so the portal can render an owner column without a per-row lookup.
248
+ */
249
+ export const keyValueStorageEntryWithUserSchema = z.object({
250
+ created_at: z.string(), // Creation timestamp
251
+ key: z.string(), // Storage key
252
+ updated_at: z.string(), // Last update timestamp
253
+ user: z.string(), // User ID
254
+ user_email: z.string().optional(), // User email (developer / S2S only)
255
+ user_name: z.string().optional(), // User display name (developer / S2S only)
256
+ value: z.string(), // Stored value
257
+ });
258
+ /** Response envelope for the dual-mode key-value list endpoint.
259
+
260
+ User-JWT callers receive `%{data: [...]}` (no pagination fields).
261
+ Developer / S2S callers receive `%{data: [...]}` plus pagination metadata.
262
+ */
263
+ export const keyValueStorageEntryPageSchema = z.object({
264
+ data: z.array(keyValueStorageEntryWithUserSchema), // Storage entries on this page
265
+ has_next: z.boolean().optional(), // Whether a next page exists (developer / S2S only)
266
+ has_prev: z.boolean().optional(), // Whether a previous page exists (developer / S2S only)
267
+ page: z.number().int().optional(), // Current page number (developer / S2S only)
268
+ page_size: z.number().int().optional(), // Results per page (developer / S2S only)
269
+ total_entries: z.number().int().optional(), // Total entries matching the filters (developer / S2S only)
270
+ total_pages: z.number().int().optional(), // Total number of pages (developer / S2S only)
271
+ });
58
272
  /** Schema for inline message reactions.
59
273
 
60
274
  This is the compact format used in Message.reactions[], which differs from
@@ -92,76 +306,45 @@ export const messageSchema = z.object({
92
306
  thread: z.string().optional(), // Parent thread
93
307
  user: z.string().optional(), // Author user (public ID or expanded object when loaded)
94
308
  });
95
- /** API schema for a single ACL grant entry. */
96
- export const aclGrantSchema = z.object({
97
- actions: z.array(z.string()), // List of allowed actions (e.g. read, write)
98
- principal: z.string().optional(), // Principal identifier (UUID for user/team/org/agent_user, role name for org_role, omit for everyone)
99
- principal_type: z.string(), // Principal type: user, team, org, org_role, agent, or everyone
100
- });
101
- /** API schema for identifying a principal to remove from an ACL. */
102
- export const aclRemoveTargetSchema = z.object({
103
- principal: z.string().optional(), // Principal identifier to remove (omit for everyone)
104
- principal_type: z.string(), // Principal type to remove
309
+ /** API schema for OAuth token endpoint responses. */
310
+ export const oAuthTokenResponseSchema = z.object({
311
+ access_token: z.string(), // OAuth access token
312
+ expires_in: z.number().int(), // Token TTL in seconds
313
+ refresh_token: z.string().optional(), // OAuth refresh token
314
+ scope: z.string().optional(), // Granted scopes (space-separated)
315
+ token_type: z.string(), // Token type (Bearer)
316
+ user: userSchema.optional(), // Authenticated user
105
317
  });
106
- /** Reusable API schema for access control lists.
107
-
108
- Supports two modes (mutually exclusive):
109
-
110
- **Replace mode** — send `grants` to replace all entries:
111
-
112
- {"grants": [{"principal_type": "user", "principal": "...", "actions": ["read"]}]}
113
-
114
- Use `{"grants": []}` to clear all entries.
115
-
116
- **Patch mode** — send `add` and/or `remove`:
117
-
118
- {"add": [...grants...], "remove": [{"principal_type": "user", "principal": "..."}]}
318
+ /** Schema for paginated message replies response.
119
319
 
120
- Cannot mix `grants` with `add`/`remove`.
320
+ Used by message replies list endpoints.
321
+ Note: This response is NOT wrapped in a "data" field.
121
322
  */
122
- export const aclSchema = z.object({
123
- add: z.array(aclGrantSchema).optional(), // Patch mode: grants to add or merge into existing
124
- grants: z.array(aclGrantSchema).optional(), // Replace mode: full list of grants (replaces all existing). Use [] to clear.
125
- remove: z.array(aclRemoveTargetSchema).optional(), // Patch mode: principals to remove from existing
323
+ export const paginatedRepliesSchema = z.object({
324
+ after_cursor: z.string().optional(), // Cursor for fetching items after this point
325
+ before_cursor: z.string().optional(), // Cursor for fetching items before this point
326
+ has_more: z.boolean().optional(), // Whether more replies exist beyond the current page
327
+ replies: z.array(messageSchema), // List of reply message objects
328
+ total_count: z.number().int().optional(), // Total number of replies
126
329
  });
127
- /** Schema for a thread in the developer portal.
128
-
129
- Maps to serialized thread output from developer portal API.
330
+ /** A routine preset entry in the preset listing endpoint. Describes *what*
331
+ a preset is, not a per-routine configuration — that's `PresetConfig`.
130
332
  */
131
- export const developerThreadSchema = z.object({
132
- app_name: z.string().optional(), // Associated app name
133
- created_at: z.string().optional(), // Created timestamp
134
- id: z.string(), // Public ID (thr_...)
135
- is_channel: z.boolean().optional(), // Whether this is a channel thread
136
- is_default: z.boolean().optional(), // Whether this is the default thread
137
- is_unlisted: z.boolean().optional(), // Whether thread is hidden from listings
138
- key: z.string().optional(), // Unique key within owner scope
139
- org: z.string().optional(), // Organization (nullable)
140
- owner: z.string().optional(), // Owner public
141
- owner_name: z.string().optional(), // Owner display name
142
- owner_type: z.string().optional(), // Owner type: team, user, agent, or nil
143
- sandbox: z.string().optional(), // Sandbox identifier (nullable)
144
- slug: z.string().optional(), // URL-friendly slug
145
- title: z.string(), // Thread title
146
- updated_at: z.string().optional(), // Updated timestamp
333
+ export const routinePresetSchema = z.object({
334
+ applicable_events: z.array(z.string()), // Event types this preset accepts. `["*"]` means any event. Other event types are rejected at routine validation time.
335
+ chainable: z.boolean(), // Whether this preset may appear as a step inside a `:chain` routine. Presets with session or async execution models are not chainable.
336
+ description: z.string(), // Preset description
337
+ label: z.string(), // Display label
338
+ name: z.string(), // Preset name (e.g. do_task)
339
+ sessionable: z.boolean(), // Whether this preset maintains a persistent chatroom session across turns (e.g. `participate`). Sessionable presets don't expose instructions or session-mode fields at the routine level.
340
+ unique: z.boolean(), // Whether only one routine with this preset may exist per agent. Enforced at the AgentRoutine unique-index layer.
147
341
  });
148
- /** Schema for a context ingestion.
149
-
150
- Maps to serialized context ingestion output from developer portal API.
342
+ /** Schema for config validation result.
151
343
  */
152
- export const contextIngestionSchema = z.object({
153
- agent: z.string().optional(), // Agent
154
- completed_at: z.string().optional(), // Completed timestamp
155
- created_at: z.string().optional(), // Created timestamp
156
- error: z.record(z.unknown()).optional(), // Error details (if failed)
157
- id: z.string(), // Public ID (cig_...)
158
- metadata: z.record(z.unknown()).optional(), // Additional metadata
159
- source: z.string().optional(), // Source ID
160
- started_at: z.string().optional(), // Started timestamp
161
- status: z.string(), // Status (pending, running, awaiting_callback, succeeded, failed)
162
- team: z.string().optional(), // Owning team ID
163
- updated_at: z.string().optional(), // Updated timestamp
164
- user: z.string().optional(), // Owning user ID
344
+ export const validationResultSchema = z.object({
345
+ errors: z.array(z.string()).optional(), // List of validation errors
346
+ valid: z.boolean(), // Whether the config is valid
347
+ warnings: z.array(z.string()).optional(), // Optional warnings emitted during validation
165
348
  });
166
349
  /** API schema for a working memory entry. */
167
350
  export const workingMemoryEntrySchema = z.object({
@@ -173,803 +356,6 @@ export const workingMemoryEntrySchema = z.object({
173
356
  updated_at: z.string().optional(), // Last update timestamp
174
357
  value: z.string().optional(), // Memory value
175
358
  });
176
- /** Schema for a sandbox-captured email.
177
- */
178
- export const sandboxEmailSchema = z.object({
179
- bcc: z.array(z.record(z.unknown())).optional(), // BCC recipients
180
- cc: z.array(z.record(z.unknown())).optional(), // CC recipients
181
- created_at: z.string().optional(), // When the email was captured
182
- from_address: z.string(), // Sender email address
183
- from_name: z.string().optional(), // Sender display name
184
- headers: z.record(z.unknown()).optional(), // Custom email headers
185
- html_body: z.string().optional(), // HTML body
186
- id: z.string(), // Public ID (sem_...)
187
- reply_to: z.record(z.unknown()).optional(), // Reply-to address
188
- subject: z.string().optional(), // Email subject
189
- text_body: z.string().optional(), // Plain text body
190
- to: z.array(z.record(z.unknown())), // Recipients [{name, address}]
191
- });
192
- /** Schema for an LLM session call.
193
-
194
- Maps to serialized LLM call output from developer portal API.
195
- */
196
- export const llmCallSchema = z.object({
197
- call_id: z.string(), // Unique call UUID
198
- completion_tokens: z.number().int(), // Number of completion tokens
199
- created_at: z.string().optional(), // Created timestamp
200
- error_message: z.string().optional(), // Error message if call failed
201
- id: z.string(), // Public ID (alc_...)
202
- latency_ms: z.number().int(), // Latency in milliseconds
203
- message_count: z.number().int().optional(), // Number of messages included in the call metadata
204
- metadata: z.record(z.unknown()).optional(), // Additional metadata
205
- model: z.string().optional(), // LLM model name
206
- prompt_tokens: z.number().int(), // Number of prompt tokens
207
- session_id: z.string(), // Session UUID grouping related calls
208
- source: z.string().optional(), // Machine-readable call source key
209
- status: z.string().optional(), // Call status (success or error)
210
- team: z.string().optional(), // Team if team-scoped
211
- total_tokens: z.number().int(), // Total tokens (prompt + completion)
212
- trajectory: z.string().optional(), // Trajectory identifier
213
- user: z.string().optional(), // User if user-scoped
214
- });
215
- /** Schema for a registered domain.
216
-
217
- Maps to serialized domain output from developer portal API.
218
- */
219
- export const domainSchema = z.object({
220
- created_at: z.string().optional(), // Created timestamp
221
- domain: z.string(), // Domain name
222
- id: z.string(), // Public ID (dad_...)
223
- updated_at: z.string().optional(), // Updated timestamp
224
- verified: z.boolean().optional(), // Whether domain is verified
225
- });
226
- /** Schema for a webhook event.
227
-
228
- Maps to serialized webhook event output from developer portal API.
229
- */
230
- export const webhookEventSchema = z.object({
231
- created_at: z.string().optional(), // Created timestamp
232
- error: z.string().optional(), // Error message if failed
233
- event_type: z.string().optional(), // Event type from the provider
234
- headers: z.record(z.unknown()).optional(), // Request headers
235
- id: z.string(), // Public ID (whe_...)
236
- payload: z.record(z.unknown()).optional(), // Event payload
237
- processed_at: z.string().optional(), // When the event was processed
238
- status: z.string(), // Processing status (pending, processed, failed)
239
- });
240
- /** Schema for an eval result. */
241
- export const evalResultSchema = z.object({
242
- agent_response: z.string().optional(), // Agent response
243
- created_at: z.string().optional(), // Created timestamp
244
- duration_ms: z.number().int().optional(), // Execution duration
245
- grader_details: z.record(z.unknown()).optional(), // Grader details
246
- id: z.string(), // Eval result ID
247
- run: z.string(), // Parent eval run identifier
248
- score: z.number().optional(), // Result score
249
- status: z.string(), // Result status
250
- task: z.string().optional(), // Eval task identifier
251
- task_input: z.string().optional(), // Task input summary
252
- transcript: z.record(z.unknown()).optional(), // Execution transcript
253
- updated_at: z.string().optional(), // Updated timestamp
254
- });
255
- /** Schema for an eval run. */
256
- export const evalRunSchema = z.object({
257
- agent: z.string().optional(), // Agent identifier
258
- agent_name: z.string().optional(), // Agent name
259
- completed_at: z.string().optional(), // Completion timestamp
260
- created_at: z.string().optional(), // Created timestamp
261
- id: z.string(), // Eval run ID
262
- results: z.array(evalResultSchema).optional(), // Eval results for this run
263
- started_at: z.string().optional(), // Start timestamp
264
- status: z.string(), // Run status
265
- suite: z.string(), // Eval suite identifier
266
- summary: z.record(z.unknown()).optional(), // Aggregate run summary
267
- updated_at: z.string().optional(), // Updated timestamp
268
- });
269
- /** API schema for a context entry. */
270
- export const contextEntrySchema = z.object({
271
- after_cursor: z.string().optional(), // Pagination cursor (after)
272
- agent_user: z.string().optional(), // Agent user
273
- before_cursor: z.string().optional(), // Pagination cursor (before)
274
- created_at: z.string().optional(), // Creation timestamp
275
- files: z.array(z.record(z.unknown())).optional(), // Loaded file objects
276
- id: z.string(), // Context entry ID
277
- links: z.array(z.record(z.unknown())).optional(), // Loaded link objects
278
- media: z.array(z.record(z.unknown())).optional(), // Loaded media objects
279
- metadata: z.record(z.unknown()).optional(), // Entry metadata
280
- org: z.string().optional(), // Organization
281
- sandbox: z.string().optional(), // Sandbox identifier
282
- team: z.string().optional(), // Team
283
- text: z.string().optional(), // Entry text
284
- updated_at: z.string().optional(), // Last update timestamp
285
- user: z.string().optional(), // User
286
- });
287
- /** Schema for a developer webhook.
288
-
289
- Maps to serialized webhook output from developer portal API.
290
- */
291
- export const webhookSchema = z.object({
292
- context_installation: z.string().optional(), // Bound context installation
293
- context_sources: z.array(z.string()).optional(), // Bound context sources
294
- created_at: z.string().optional(), // Created timestamp
295
- enabled: z.boolean(), // Whether the webhook is enabled
296
- id: z.string(), // Public ID (whk_...)
297
- lookup_key: z.string().optional(), // Lookup key for generic webhooks
298
- metadata: z.record(z.unknown()).optional(), // Additional metadata
299
- provider: z.string().optional(), // Provider type for known providers (github, slack), nil for generic webhooks
300
- updated_at: z.string().optional(), // Updated timestamp
301
- webhook_url: z.string(), // URL to send webhooks to
302
- });
303
- /** API schema for a secret (user, team, or user-team). */
304
- export const secretSchema = z.object({
305
- created_at: z.string().optional(), // Creation timestamp
306
- description: z.string().optional(), // Secret description
307
- id: z.string(), // Secret ID
308
- last_accessed_at: z.string().optional(), // Last accessed timestamp
309
- name: z.string().optional(), // Secret name
310
- org: z.string().optional(), // Organization
311
- sandbox: z.string().optional(), // Sandbox
312
- secret_group: z.string().optional(), // Secret group
313
- team: z.string().optional(), // Team
314
- updated_at: z.string().optional(), // Last update timestamp
315
- });
316
- /** API schema for OAuth device authorization responses. */
317
- export const deviceAuthorizationResponseSchema = z.object({
318
- device_code: z.string(), // Device verification code
319
- expires_in: z.number().int(), // TTL in seconds
320
- interval: z.number().int(), // Polling interval in seconds
321
- user_code: z.string(), // User-facing verification code
322
- verification_uri: z.string(), // Base verification URI
323
- verification_uri_complete: z.string(), // Full verification URI with code
324
- });
325
- /** API schema for OAuth token endpoint responses. */
326
- export const oAuthTokenResponseSchema = z.object({
327
- access_token: z.string(), // OAuth access token
328
- expires_in: z.number().int(), // Token TTL in seconds
329
- refresh_token: z.string().optional(), // OAuth refresh token
330
- scope: z.string().optional(), // Granted scopes (space-separated)
331
- token_type: z.string(), // Token type (Bearer)
332
- user: userSchema.optional(), // Authenticated user
333
- });
334
- /** Result of executing a command on an agent computer. */
335
- export const computerExecResultSchema = z.object({
336
- exit_code: z.number().int().optional(), // Process exit code
337
- output: z.string().optional(), // Command output
338
- });
339
- /** Schema for runtime environment variable metadata. */
340
- export const runtimeEnvVarSchema = z.object({
341
- description: z.string().optional(), // Optional description
342
- key: z.string(), // Environment variable key
343
- source: z.string(), // Source of the env var (app or org)
344
- });
345
- /** Schema for runtime environment variable metadata list responses. */
346
- export const runtimeEnvVarListSchema = z.object({
347
- data: z.array(runtimeEnvVarSchema), // Runtime environment variables available to the current script context
348
- });
349
- /** Source option metadata for LLM call filtering.
350
- */
351
- export const llmCallSourceOptionSchema = z.object({
352
- label: z.string(), // Human-friendly source label
353
- source: z.string(), // Machine-readable LLM source key
354
- });
355
- /** Schema for an app environment variable response that includes the plaintext value. */
356
- export const appEnvVarPlaintextSchema = z.object({
357
- created_at: z.string().optional(), // Created timestamp
358
- description: z.string().optional(), // Optional description
359
- id: z.string(), // Environment variable ID
360
- key: z.string(), // Environment variable key
361
- updated_at: z.string().optional(), // Updated timestamp
362
- value: z.string(), // Plaintext environment variable value
363
- });
364
- /** Schema for integration records with connector state. */
365
- export const integrationSchema = z.object({
366
- id: z.string(), // Integration ID
367
- org: z.string().optional(), // Organization (nullable)
368
- provider: z.string(), // Provider identifier
369
- sandbox: z.string().optional(), // Sandbox identifier (nullable)
370
- secret_group: z.string().optional(), // Secret group
371
- state: z.record(z.unknown()), // Connector state information
372
- team: z.string().optional(), // Team (if team-scoped)
373
- user: z.string().optional(), // User (if user-scoped)
374
- workspace_key: z.string().optional(), // Provider workspace identifier
375
- });
376
- /** Schema for a single notification setting update entry.
377
- */
378
- export const notificationSettingUpdateSchema = z.object({
379
- level: z.string(), // Notification level (global, team, thread)
380
- muted: z.boolean(), // Whether notifications are muted
381
- team: z.string().optional(), // Team (required for team-level settings)
382
- thread: z.string().optional(), // Thread (required for thread-level settings)
383
- });
384
- /** Schema for a key-value storage entry.
385
-
386
- Maps exactly to render_entry/1 output in ApiStorageController.
387
- */
388
- export const keyValueStorageEntrySchema = z.object({
389
- created_at: z.string().optional(), // Creation timestamp
390
- key: z.string(), // Storage key
391
- updated_at: z.string().optional(), // Last update timestamp
392
- user: z.string(), // User
393
- value: z.string(), // Stored value
394
- });
395
- /** API schema for an installation kind. */
396
- export const installationKindSchema = z.object({
397
- accepts_sources: z.boolean().optional(), // Whether this kind accepts sources
398
- category: z.string().optional(), // Category
399
- config_schema: z.record(z.unknown()).optional(), // JSON schema for configuration
400
- description: z.string().optional(), // Description
401
- kind: z.string(), // Installation kind identifier
402
- label: z.string().optional(), // Display label
403
- provider: z.string().optional(), // Integration provider
404
- requires_integration: z.boolean().optional(), // Whether this kind requires an integration
405
- });
406
- /** List response for installation kinds. */
407
- export const installationKindListResponseSchema = z.object({
408
- data: z.array(installationKindSchema), // List of installation kinds
409
- });
410
- /** Schema for a billing plan. */
411
- export const billingPlanSchema = z.object({
412
- description: z.string().optional(), // Plan description
413
- id: z.string().optional(), // Plan identifier (e.g. paygo)
414
- name: z.string().optional(), // Human-readable plan name
415
- target: z.string().optional(), // Entity type this plan applies to (developer or org)
416
- });
417
- /** Schema for an eval task. */
418
- export const evalTaskSchema = z.object({
419
- created_at: z.string().optional(), // Created timestamp
420
- expected_outcome: z.string(), // Expected outcome
421
- grading_criteria: z.array(z.record(z.unknown())).optional(), // Grading criteria
422
- id: z.string(), // Eval task ID
423
- input_message: z.string(), // Task input message
424
- mock_agent_memory: z.record(z.unknown()).optional(), // Mock agent memory
425
- mock_context_items: z.array(z.record(z.unknown())).optional(), // Mock context items
426
- mock_datetime: z.string().optional(), // Mock datetime
427
- mock_participants: z.array(z.record(z.unknown())).optional(), // Mock participants
428
- mock_tools: z.array(z.record(z.unknown())).optional(), // Mock tool definitions
429
- status: z.string(), // Task status
430
- suite: z.string(), // Parent eval suite identifier
431
- updated_at: z.string().optional(), // Updated timestamp
432
- });
433
- /** API schema for a task comment. */
434
- export const taskCommentSchema = z.object({
435
- author: z.string().optional(), // Legacy author
436
- author_actor: z.record(z.unknown()).optional(), // Author actor details
437
- author_persona: z.string().optional(), // Author persona
438
- author_user: z.string().optional(), // Author user
439
- body: z.string(), // Comment body text
440
- created_at: z.string().optional(), // Creation timestamp
441
- id: z.string(), // Comment ID
442
- org: z.string().optional(), // Organization
443
- sandbox: z.string().optional(), // Sandbox identifier
444
- task: z.string().optional(), // Task
445
- team: z.string().optional(), // Team
446
- updated_at: z.string().optional(), // Last update timestamp
447
- });
448
- /** Schema for eval result list responses. */
449
- export const evalResultListSchema = z.object({
450
- data: z.array(evalResultSchema), // Eval results
451
- });
452
- /** Schema for delete operations that return a deleted count. */
453
- export const deletionConfirmationSchema = z.object({
454
- deleted_count: z.number().int(), // Number of deleted records
455
- });
456
- /** An individual tool within a builtin tool catalog entry. */
457
- export const builtinToolSchema = z.object({
458
- description: z.string().optional(), // Tool description
459
- name: z.string(), // Tool name
460
- });
461
- /** Schema for an eval suite. */
462
- export const evalSuiteSchema = z.object({
463
- created_at: z.string().optional(), // Created timestamp
464
- description: z.string().optional(), // Suite description
465
- id: z.string(), // Eval suite ID
466
- name: z.string(), // Suite name
467
- org: z.string().optional(), // Owner organization identifier
468
- status: z.string(), // Suite status
469
- tasks: z.array(evalTaskSchema).optional(), // Eval tasks included in the suite
470
- updated_at: z.string().optional(), // Updated timestamp
471
- user: z.string().optional(), // Owner user identifier
472
- });
473
- /** Schema for eval suite list responses. */
474
- export const evalSuiteListSchema = z.object({
475
- data: z.array(evalSuiteSchema), // Eval suites
476
- });
477
- /** Schema for a sandbox API key.
478
- */
479
- export const sandboxKeySchema = z.object({
480
- created_at: z.string().optional(), // Created timestamp
481
- expires_at: z.string().optional(), // Expiry timestamp
482
- full_key: z.string().optional(), // Full key shown only once at creation
483
- id: z.string(), // Public ID (dsk_...)
484
- key_hint: z.string().optional(), // Last 4 chars hint
485
- key_value: z.string().optional(), // Full key (publishable only)
486
- last_used_at: z.string().optional(), // Last used timestamp
487
- status: z.string(), // Status (active, revoked)
488
- type: z.string(), // Key type (publishable, secret)
489
- });
490
- /** Schema for a developer sandbox.
491
- */
492
- export const sandboxSchema = z.object({
493
- created_at: z.string().optional(), // Created timestamp
494
- id: z.string(), // Public ID (dsb_...)
495
- keys: z.array(sandboxKeySchema).optional(), // Sandbox API keys
496
- name: z.string(), // Sandbox name
497
- slug: z.string(), // Sandbox slug (unique per app)
498
- updated_at: z.string().optional(), // Updated timestamp
499
- });
500
- /** API schema for an AI trajectory. */
501
- export const trajectorySchema = z.object({
502
- created_at: z.string().optional(), // Creation timestamp
503
- file: z.string().optional(), // Storage file
504
- id: z.string(), // Trajectory ID (trj_...)
505
- messages: z.record(z.unknown()).optional(), // Trajectory messages
506
- org: z.string().optional(), // Organization
507
- sandbox: z.string().optional(), // Sandbox
508
- team: z.string().optional(), // Team
509
- updated_at: z.string().optional(), // Last update timestamp
510
- });
511
- /** Schema for an event type available for automation triggers.
512
-
513
- Represents events from the workflow event catalog.
514
- */
515
- export const eventTypeSchema = z.object({
516
- description: z.string(), // Human-readable description
517
- name: z.string(), // Event name (e.g., thread.created)
518
- });
519
- /** Schema for paginated message replies response.
520
-
521
- Used by message replies list endpoints.
522
- Note: This response is NOT wrapped in a "data" field.
523
- */
524
- export const paginatedRepliesSchema = z.object({
525
- after_cursor: z.string().optional(), // Cursor for fetching items after this point
526
- before_cursor: z.string().optional(), // Cursor for fetching items before this point
527
- has_more: z.boolean().optional(), // Whether more replies exist beyond the current page
528
- replies: z.array(messageSchema), // List of reply message objects
529
- total_count: z.number().int().optional(), // Total number of replies
530
- });
531
- /** A routine preset with its metadata. */
532
- export const routinePresetSchema = z.object({
533
- config: z.record(z.unknown()).optional(), // Default configuration
534
- description: z.string().optional(), // Preset description
535
- event_type: z.string().optional(), // Event type
536
- label: z.string().optional(), // Display label
537
- name: z.string(), // Preset name
538
- });
539
- /** API schema for a persona. */
540
- export const personaSchema = z.object({
541
- activated: z.boolean().optional(), // Whether persona is activated
542
- agent: z.string().optional(), // Associated agent (always nil)
543
- created_at: z.string().optional(), // Creation timestamp
544
- id: z.string(), // Persona ID
545
- is_active: z.boolean().optional(), // Whether persona is active
546
- is_enabled_for_thread: z.boolean().optional(), // Whether persona is enabled for thread
547
- metadata: z.record(z.unknown()).optional(), // Persona metadata
548
- name: z.string().optional(), // Persona display name
549
- org: z.string().optional(), // Organization
550
- personality: z.string().optional(), // Persona personality description
551
- sandbox: z.string().optional(), // Sandbox
552
- team: z.string().optional(), // Owning team
553
- updated_at: z.string().optional(), // Last update timestamp
554
- user: z.string().optional(), // Owning user
555
- });
556
- /** API schema for an installation. */
557
- export const installationSchema = z.object({
558
- agent: z.string().optional(), // Owning agent
559
- config: z.record(z.unknown()).optional(), // Configuration
560
- created_at: z.string().optional(), // Creation timestamp
561
- id: z.string(), // Installation ID (cin_...)
562
- kind: z.string().optional(), // Installation kind
563
- shared_integration: z.string().optional(), // Bound shared integration
564
- state: z.string().optional(), // Installation state
565
- status_payload: z.record(z.unknown()).optional(), // Status payload
566
- updated_at: z.string().optional(), // Last update timestamp
567
- });
568
- /** Schema for persona update parameters.
569
- */
570
- export const personaUpdateParamsSchema = z.object({
571
- metadata: z.record(z.unknown()).optional(), // Additional metadata
572
- name: z.string().optional(), // Persona display name
573
- personality: z.string().optional(), // Persona personality description
574
- });
575
- /** Schema for a dataset dimension field.
576
- */
577
- export const datasetDimensionSchema = z.object({
578
- label: z.string(), // Human-readable label
579
- name: z.string(), // Dimension identifier
580
- type: z.string(), // Data type (string, integer, boolean, datetime, date)
581
- });
582
- /** Schema for an app environment variable response with a masked value. */
583
- export const appEnvVarMaskedSchema = z.object({
584
- created_at: z.string().optional(), // Created timestamp
585
- description: z.string().optional(), // Optional description
586
- id: z.string(), // Environment variable ID
587
- key: z.string(), // Environment variable key
588
- masked_value: z.string(), // Masked environment variable value
589
- updated_at: z.string().optional(), // Updated timestamp
590
- });
591
- /** Schema for masked app environment variable list responses. */
592
- export const appEnvVarMaskedListSchema = z.object({
593
- data: z.array(appEnvVarMaskedSchema), // Environment variables
594
- });
595
- /** Schema for eval run list responses. */
596
- export const evalRunListSchema = z.object({
597
- data: z.array(evalRunSchema), // Eval runs
598
- });
599
- /** Schema for LLM call trajectory contents. */
600
- export const llmCallTrajectorySchema = z.object({
601
- download_url: z.string().optional(), // Signed transcript download URL
602
- messages: z.array(z.record(z.unknown())), // Trajectory messages
603
- });
604
- /** API schema for a user credential. */
605
- export const credentialSchema = z.object({
606
- alt_domains: z.record(z.unknown()).optional(), // Alternative domains
607
- created_at: z.string().optional(), // Creation timestamp
608
- description: z.string().optional(), // Description
609
- domain: z.string().optional(), // Primary domain
610
- id: z.string(), // Credential ID (ucr_...)
611
- last_accessed_at: z.string().optional(), // Last accessed timestamp
612
- org: z.string().optional(), // Organization
613
- sandbox: z.string().optional(), // Sandbox
614
- secret_group: z.string().optional(), // Secret group ID
615
- updated_at: z.string().optional(), // Last update timestamp
616
- });
617
- /** API schema for an activity feed entry. */
618
- export const activityFeedEntrySchema = z.object({
619
- agent: z.union([z.string(), z.object({ acl: z.object({ add: z.array(z.object({ actions: z.array(z.string()), principal: z.string().optional(), principal_type: z.string() })).optional(), grants: z.array(z.object({ actions: z.array(z.string()), principal: z.string().optional(), principal_type: z.string() })).optional(), remove: z.array(z.object({ principal: z.string().optional(), principal_type: z.string() })).optional() }).optional(), app: z.string().optional(), created_at: z.string().optional(), default_model: z.string().optional(), email: z.string().optional(), id: z.string(), identity: z.string().optional(), lookup_key: z.string().optional(), metadata: z.record(z.unknown()).optional(), name: z.string().optional(), org: z.string().optional(), phone_number: z.string().optional(), sandbox: z.string().optional(), team: z.string().optional(), updated_at: z.string().optional(), user: z.string().optional() })]).optional(), // Agent (public ID or expanded object when loaded)
620
- app: z.string().optional(), // Application
621
- attachments: z.array(z.record(z.unknown())).optional(), // Entry attachments
622
- automation_run: z.string().optional(), // Automation run
623
- content: z.string().optional(), // Longer explanation (markdown)
624
- correlation_id: z.string().optional(), // Correlation ID for grouped entries
625
- created_at: z.string().optional(), // Creation timestamp
626
- id: z.string(), // Entry ID (afe_...)
627
- kind: z.string().optional(), // Entry kind
628
- level: z.string().optional(), // Severity level
629
- metadata: z.record(z.unknown()).optional(), // Entry metadata
630
- org: z.string().optional(), // Organization
631
- routine_run: z.string().optional(), // Routine run
632
- sandbox: z.string().optional(), // Sandbox identifier
633
- session_record: z.string().optional(), // Agent session
634
- team: z.string().optional(), // Team
635
- thread: z.string().optional(), // Thread
636
- title: z.string().optional(), // One-line summary
637
- updated_at: z.string().optional(), // Last update timestamp
638
- user: z.union([z.string(), z.object({ alias: z.string().optional(), email: z.string().optional(), id: z.string(), metadata: z.record(z.unknown()).optional(), name: z.string().optional(), org: z.string().optional(), sandbox: z.string().optional() })]).optional(), // User (public ID or expanded object when loaded)
639
- });
640
- /** Schema for a dataset metric field.
641
- */
642
- export const datasetMetricSchema = z.object({
643
- aggregation: z.string(), // Aggregation function (sum, count, avg, min, max, count_distinct)
644
- label: z.string(), // Human-readable label
645
- name: z.string(), // Metric identifier
646
- type: z.string(), // Output type (integer, float)
647
- });
648
- /** Schema for an analytics dataset definition.
649
- */
650
- export const datasetSchema = z.object({
651
- dimensions: z.array(datasetDimensionSchema), // Available dimensions
652
- metrics: z.array(datasetMetricSchema), // Available metrics
653
- name: z.string(), // Dataset identifier
654
- time_dimension: datasetDimensionSchema.optional(), // Time dimension for time series queries
655
- });
656
- /** Schema for paginated messages response.
657
-
658
- Used by thread messages list endpoints.
659
- */
660
- export const paginatedMessagesSchema = z.object({
661
- after_cursor: z.string().optional(), // Cursor for fetching items after this point
662
- before_cursor: z.string().optional(), // Cursor for fetching items before this point
663
- messages: z.array(messageSchema), // List of message objects
664
- });
665
- /** Schema for an event catalog entry with full payload schema and sample.
666
- */
667
- export const eventCatalogEntrySchema = z.object({
668
- description: z.string(), // Human-readable description
669
- name: z.string(), // Event name (e.g., thread.created)
670
- parent: z.string().optional(), // Parent envelope name (only present for sub_event entries)
671
- sample: z.record(z.unknown()), // Sample payload for this event
672
- schema: z.record(z.unknown()), // JSON Schema describing the event payload
673
- sub_events: z.array(z.string()).optional(), // Known sub-event types (only present for envelope entries)
674
- type: z.string().optional(), // Entry type: "event" for exact events, "envelope" for wildcard families
675
- });
676
- /** Schema for a developer portal domain event. */
677
- export const domainEventSchema = z.object({
678
- agent: z.string().optional(), // Agent identifier
679
- created_at: z.string().optional(), // Created timestamp
680
- event_name: z.string(), // Event name
681
- id: z.string(), // Domain event ID
682
- idempotency_key: z.string().optional(), // Idempotency key for the event
683
- payload: z.record(z.unknown()), // Event payload
684
- team: z.string().optional(), // Team identifier
685
- user: z.string().optional(), // User identifier
686
- });
687
- /** Filter object for matching thread metadata. */
688
- export const metadataFilterSchema = z.object({
689
- key: z.string(), // Metadata key to match
690
- type: z.string(), // Filter type (must be "metadata")
691
- value: z.string(), // Metadata value to match
692
- });
693
- /** List response for installations. */
694
- export const installationListResponseSchema = z.object({
695
- data: z.array(installationSchema), // List of installations
696
- });
697
- /** Public org schema for authenticated endpoints.
698
-
699
- Only exposes fields safe for any authenticated user: id, name, domain,
700
- and logo. Does NOT expose sandbox, status, industry, description, or
701
- other internal fields that the Developer.Org schema includes.
702
- */
703
- export const publicOrgSchema = z.object({
704
- domain: z.string(), // Primary domain
705
- id: z.string(), // Public ID (org_...)
706
- name: z.string(), // Organization name
707
- });
708
- /** API schema for background worker status on a routine run. */
709
- export const workerStatusSchema = z.object({
710
- attempt: z.number().int(), // Current attempt number (0 = not yet attempted)
711
- max_attempts: z.number().int(), // Maximum allowed attempts
712
- status: z.string(), // Worker state: queued, executing, retrying, completed, discarded, or cancelled
713
- });
714
- /** API schema for authentication token responses. */
715
- export const authTokensSchema = z.object({
716
- expires_in: z.number().int(), // Token TTL in seconds
717
- metadata: z.record(z.unknown()).optional(), // Additional metadata (e.g., onboarding_job_id)
718
- refresh_token: z.string(), // Refresh token
719
- token: z.string(), // Access token (JWT)
720
- token_type: z.string(), // Token type (Bearer)
721
- user: userSchema, // Authenticated user
722
- });
723
- /** Filter object for matching personas by template ID. */
724
- export const templateFilterSchema = z.object({
725
- id: z.string(), // Persona template ID to match
726
- type: z.string(), // Filter type (must be "template")
727
- });
728
- /** API schema for a decrypted secret value response. */
729
- export const secretValueSchema = z.object({
730
- name: z.string(), // Secret name
731
- value: z.string(), // Decrypted secret value
732
- });
733
- /** A builtin tool catalog entry describing an available tool category. */
734
- export const builtinToolCatalogEntrySchema = z.object({
735
- config_schema: z.record(z.unknown()).optional(), // JSON schema for tool configuration
736
- description: z.string().optional(), // Tool description
737
- instruction: z.string().optional(), // Tool instruction
738
- key: z.string(), // Unique tool key
739
- label: z.string().optional(), // Display label
740
- providers: z.array(z.string()).optional(), // Supported providers
741
- requires_integration: z.boolean().optional(), // Whether an integration is required
742
- server_tool_type: z.string().optional(), // Server tool type identifier
743
- tools: z.array(builtinToolSchema).optional(), // List of individual tools
744
- });
745
- /** Schema for developer account billing settings. */
746
- export const developerSchema = z.object({
747
- billing_provider_environment: z.string().optional(), // Stripe environment (live or test)
748
- billing_provider_id: z.string().optional(), // Stripe customer ID
749
- plan: z.string().optional(), // Billing plan (e.g. paygo)
750
- });
751
- /** Schema for a task activity entry.
752
-
753
- Maps exactly to the activity entries produced by TaskActivitySentenceGenerator.
754
- */
755
- export const taskActivityEntrySchema = z.object({
756
- event_id: z.string().optional(), // Event ID
757
- event_type: z.string().optional(), // Type of event
758
- sentence: z.string().optional(), // Human-readable description of the activity
759
- timestamp: z.string().optional(), // When the event occurred
760
- });
761
- /** API schema for file URL refresh responses. */
762
- export const fileRefreshResultSchema = z.object({
763
- image_source: imageSourceSchema, // Updated image source with fresh URL
764
- success: z.boolean(), // Whether the refresh succeeded
765
- });
766
- /** Schema for a dataset query result.
767
- */
768
- export const datasetQueryResultSchema = z.object({
769
- columns: z.array(z.record(z.unknown())), // Column definitions with name, type, and label
770
- meta: z.record(z.unknown()), // Query metadata (total_rows, query_time_ms)
771
- rows: z.array(z.record(z.unknown())), // Result rows as maps of column_name → value
772
- });
773
- /** Schema for an API call record.
774
-
775
- Maps to serialized API call output from developer portal API.
776
- */
777
- export const apiCallSchema = z.object({
778
- api_key_type: z.string().optional(), // API key type (publishable or secret)
779
- created_at: z.string().optional(), // Created timestamp
780
- error_message: z.string().optional(), // Error message if request failed
781
- event_type: z.string().optional(), // Webhook event type (e.g. push, pull_request)
782
- full_url: z.string(), // Full request URL with query string
783
- handler_module: z.string().optional(), // ApiDsl action module
784
- id: z.string(), // Public ID (aac_...)
785
- ip_address: z.string().optional(), // Client IP address
786
- latency_ms: z.number().int(), // Latency in milliseconds
787
- metadata: z.record(z.unknown()).optional(), // Additional metadata (e.g. integration_ids for webhooks)
788
- method: z.string(), // HTTP method
789
- org: z.string().optional(), // Org if org-scoped
790
- path: z.string(), // Sanitized path with param placeholders
791
- query_string: z.string().optional(), // Query string
792
- request_body: z.record(z.unknown()).optional(), // Request body payload (webhooks only)
793
- request_headers: z.record(z.unknown()).optional(), // Request headers (webhooks only)
794
- request_id: z.string().optional(), // Request ID from Plug.RequestId
795
- status_code: z.number().int(), // HTTP status code
796
- team: z.string().optional(), // Team if team-scoped
797
- thread: z.string().optional(), // Thread if thread-scoped
798
- user: z.string().optional(), // User if user-scoped
799
- });
800
- /** Schema for paginated domain event responses. */
801
- export const domainEventPageSchema = z.object({
802
- data: z.array(domainEventSchema), // Domain events
803
- has_next: z.boolean(), // Whether a next page exists
804
- has_prev: z.boolean(), // Whether a previous page exists
805
- page: z.number().int(), // Current page number
806
- page_size: z.number().int(), // Page size
807
- total_entries: z.number().int(), // Total entries
808
- total_pages: z.number().int(), // Total pages
809
- });
810
- /** Schema for a documented API endpoint in the developer API explorer. */
811
- export const apiExplorerEndpointSchema = z.object({
812
- deprecated: z.boolean(), // Whether the route is deprecated
813
- description: z.string().optional(), // Endpoint description
814
- errors: z.array(z.record(z.unknown())), // Documented error responses
815
- method: z.string(), // HTTP method
816
- params: z.array(z.record(z.unknown())), // Documented params
817
- path: z.string(), // Route path
818
- returns: z.record(z.unknown()).optional(), // Return schema description
819
- scope: z.string(), // Endpoint scope
820
- tags: z.array(z.string()), // Route tags
821
- });
822
- export const resolvedToolSchema = z.object({
823
- description: z.string().optional(), // What this tool does
824
- name: z.string(), // Callable tool function name
825
- parameters: z.record(z.unknown()).optional(), // JSON Schema describing the expected input
826
- });
827
- /** Schema for an encrypted secret payload. */
828
- export const encryptedSecretSchema = z.object({
829
- encrypted_value: z.string(), // Encrypted ciphertext value
830
- });
831
- /** API schema for a custom object. */
832
- export const customObjectSchema = z.object({
833
- created_at: z.string().optional(), // Created timestamp
834
- fields: z.record(z.unknown()).optional(), // Object field values
835
- id: z.string(), // Public ID (cobj_...)
836
- org: z.string().optional(), // Organization
837
- row_key: z.string().optional(), // Row key
838
- sandbox: z.string().optional(), // Sandbox identifier
839
- schema_type: z.string().optional(), // Schema type (lookup_key)
840
- team: z.string().optional(), // Owning team
841
- updated_at: z.string().optional(), // Updated timestamp
842
- user: z.string().optional(), // Owning user
843
- version: z.number().int().optional(), // Aggregate version for OCC
844
- });
845
- /** Schema for task creation parameters.
846
-
847
- Used by both Users.Tasks.Create and Teams.Tasks.Create actions.
848
- */
849
- export const taskCreateParamsSchema = z.object({
850
- description: z.string().optional(), // Task description
851
- due_date: z.string().optional(), // Due date
852
- links: z.record(z.unknown()).optional(), // Related links
853
- metadata: z.record(z.unknown()).optional(), // Additional metadata
854
- name: z.string(), // Task name
855
- owner_persona: z.string().optional(), // Owner persona if assigned to agent
856
- owner_user: z.string().optional(), // Owner user if assigned to user
857
- priority: z.number().int().optional(), // Priority level (0-4)
858
- status: z.string().optional(), // Task status (open, in_progress, done)
859
- task: z.string().optional(), // Custom task ID (optional, auto-generated if not provided)
860
- });
861
- /** Schema for message update request parameters.
862
-
863
- Used as the body wrapper when updating a message.
864
- */
865
- export const messageUpdateParamsSchema = z.object({
866
- content: z.string().optional(), // New message content
867
- });
868
- /** API schema for an installation source. */
869
- export const installationSourceSchema = z.object({
870
- agent: z.string().optional(), // Owning agent
871
- context_installation: z.string().optional(), // Installation ID
872
- created_at: z.string().optional(), // Creation timestamp
873
- id: z.string(), // Source ID (cso_...)
874
- metadata: z.record(z.unknown()).optional(), // Arbitrary metadata
875
- parent_source: z.string().optional(), // Parent source ID
876
- payload: z.record(z.unknown()).optional(), // Source payload
877
- state: z.string().optional(), // Source state
878
- team: z.string().optional(), // Team ID
879
- thread: z.string().optional(), // Thread ID
880
- type: z.string().optional(), // Source type
881
- updated_at: z.string().optional(), // Last update timestamp
882
- user: z.string().optional(), // User ID
883
- });
884
- /** Schema for persona creation parameters.
885
- */
886
- export const personaCreateParamsSchema = z.object({
887
- name: z.string(), // Persona display name
888
- personality: z.string(), // Persona personality description
889
- profile_picture_style: z.string().optional(), // Profile picture generation style
890
- });
891
- /** API schema for a task. */
892
- export const taskSchema = z.object({
893
- closed_at: z.string().optional(), // When the task was closed
894
- comments_count: z.number().int().optional(), // Number of comments
895
- created_at: z.string().optional(), // Creation timestamp
896
- created_by: z.string().optional(), // Legacy creator
897
- created_by_actor: z.record(z.unknown()).optional(), // Creator actor details
898
- created_by_persona: z.string().optional(), // Creator persona
899
- created_by_type: z.string().optional(), // Creator type (user, agent)
900
- created_by_user: z.string().optional(), // Creator user
901
- description: z.string().optional(), // Task description
902
- due_date: z.string().optional(), // Due date
903
- id: z.string(), // Task ID (tsk_...)
904
- links: z.record(z.unknown()).optional(), // Related links
905
- metadata: z.record(z.unknown()).optional(), // Additional metadata
906
- name: z.string(), // Task name
907
- org: z.string().optional(), // Organization
908
- owner: z.string().optional(), // Legacy owner
909
- owner_actor: z.record(z.unknown()).optional(), // Owner actor details
910
- owner_persona: z.string().optional(), // Owner persona
911
- owner_user: z.string().optional(), // Owner user
912
- priority: z.number().int().optional(), // Priority level (0-4)
913
- sandbox: z.string().optional(), // Sandbox identifier
914
- status: z.string(), // Task status
915
- team: z.string().optional(), // Team
916
- updated_at: z.string().optional(), // Last update timestamp
917
- });
918
- /** Schema for a developer app.
919
-
920
- Maps to serialized app output from developer portal API.
921
- */
922
- export const appSchema = z.object({
923
- app_slug: z.string().optional(), // Workspace slug (if set)
924
- app_url: z.string().optional(), // App URL
925
- brand_name: z.string().optional(), // Brand name for emails
926
- created_at: z.string().optional(), // Created timestamp
927
- description: z.string().optional(), // App description
928
- from_name: z.string().optional(), // From name for emails
929
- id: z.string(), // Public ID (dap_...)
930
- marketing_url: z.string().optional(), // Marketing URL
931
- muted_color: z.string().optional(), // Muted hex color
932
- name: z.string(), // App name
933
- primary_color: z.string().optional(), // Primary hex color
934
- sandboxes: z.array(sandboxSchema).optional(), // App sandboxes with keys
935
- status: z.string(), // Status (active, suspended)
936
- support_email: z.string().optional(), // Support email address
937
- third_party_oauth_enabled: z.boolean().optional(), // Third-party OAuth enabled
938
- updated_at: z.string().optional(), // Updated timestamp
939
- });
940
- /** Schema for a system access token (developer admin view).
941
-
942
- Maps to serialized system access token output from developer portal API.
943
- */
944
- export const developerSystemAccessTokenSchema = z.object({
945
- created_at: z.string().optional(), // Created timestamp
946
- id: z.string(), // Public ID (sat_...)
947
- last_used_at: z.string().optional(), // Last used timestamp
948
- name: z.string().optional(), // Optional label for the token
949
- revoked_at: z.string().optional(), // Revoked timestamp
950
- token: z.string().optional(), // Raw JWT (only present on creation)
951
- });
952
- /** Schema for a context source.
953
-
954
- Maps to serialized context source output from developer portal API.
955
- */
956
- export const contextSourceSchema = z.object({
957
- agent: z.string().optional(), // Owning agent
958
- context_installation: z.string().optional(), // Associated installation
959
- created_at: z.string().optional(), // Created timestamp
960
- id: z.string(), // Public ID (cso_...)
961
- metadata: z.record(z.unknown()).optional(), // Additional metadata
962
- org: z.string().optional(), // Owning organization
963
- parent_source: z.string().optional(), // Parent source
964
- payload: z.record(z.unknown()).optional(), // Type-specific configuration
965
- sandbox: z.string().optional(), // Owning sandbox
966
- state: z.string(), // State: active or paused
967
- team: z.string().optional(), // Owning team
968
- thread: z.string().optional(), // Associated thread
969
- type: z.string(), // Source type (e.g., gmail, github_activity)
970
- updated_at: z.string().optional(), // Updated timestamp
971
- user: z.string().optional(), // Owning user
972
- });
973
359
  /** Paginated list response for working memory entries. */
974
360
  export const workingMemoryEntryListResponseSchema = z.object({
975
361
  data: z.array(workingMemoryEntrySchema), // List of working memory entries
@@ -980,345 +366,4 @@ export const workingMemoryEntryListResponseSchema = z.object({
980
366
  total_entries: z.number().int().optional(), // Total number of entries
981
367
  total_pages: z.number().int().optional(), // Total number of pages
982
368
  });
983
- /** API schema for OAuth device authorization approval and denial responses. */
984
- export const deviceAuthorizationStatusResponseSchema = z.object({
985
- status: z.string(), // Authorization status (approved or denied)
986
- });
987
- /** Integration fields for auto-creating the underlying integration.
988
-
989
- When creating an agent installation for an `integration/*` kind, callers
990
- can pass this object to auto-create the underlying Integration record.
991
- Required fields depend on the kind's auth type:
992
-
993
- - `app_installation` kinds (slack_bot, github_app): requires `installation_id`
994
- - `oauth` kinds (gmail, outlook, slack): requires `access_token`
995
- */
996
- export const integrationCreateParamsSchema = z.object({
997
- access_token: z.string().optional(), // OAuth access token or API key
998
- installation_id: z.string().optional(), // External installation ID (e.g. GitHub App installation ID, Slack team_id)
999
- metadata: z.record(z.unknown()).optional(), // Provider-specific metadata (e.g. bot_user_id)
1000
- refresh_token: z.string().optional(), // OAuth refresh token
1001
- workspace_key: z.string().optional(), // Workspace name or identifier
1002
- });
1003
- /** Schema for a user credential.
1004
-
1005
- Maps to serialized credential output from developer portal API.
1006
- */
1007
- export const contextCredentialSchema = z.object({
1008
- alt_domains: z.array(z.string()).optional(), // Alternative domains
1009
- created_at: z.string().optional(), // Created timestamp
1010
- description: z.string().optional(), // Human-readable description
1011
- domain: z.string(), // Domain (e.g., app.schoology.com)
1012
- id: z.string(), // Public ID (ucr_...)
1013
- last_accessed_at: z.string().optional(), // Last accessed timestamp
1014
- updated_at: z.string().optional(), // Updated timestamp
1015
- user: z.string().optional(), // Owning user
1016
- });
1017
- /** API schema for the status/ping health check response. */
1018
- export const statusPingSchema = z.object({
1019
- success: z.boolean(), // Whether the ping succeeded
1020
- token: z.record(z.unknown()), // Token status details
1021
- user: userSchema.optional(), // Authenticated user (if token is valid)
1022
- });
1023
- /** Schema for an OAuth provider configuration.
1024
-
1025
- Maps to serialized OAuth provider output from developer portal API.
1026
- */
1027
- export const oAuthProviderSchema = z.object({
1028
- callback_urls: z.array(z.string()).optional(), // Allowed callback URLs
1029
- client_id: z.string(), // OAuth client ID
1030
- created_at: z.string().optional(), // Created timestamp
1031
- display_name: z.string().optional(), // Display name
1032
- enabled: z.boolean().optional(), // Whether provider is enabled
1033
- id: z.string(), // Public ID (dop_...)
1034
- provider: z.string(), // Provider type (github, google)
1035
- scopes: z.array(z.string()).optional(), // OAuth scopes
1036
- updated_at: z.string().optional(), // Updated timestamp
1037
- });
1038
- /** Schema for config validation result.
1039
- */
1040
- export const validationResultSchema = z.object({
1041
- errors: z.array(z.string()).optional(), // List of validation errors
1042
- valid: z.boolean(), // Whether the config is valid
1043
- warnings: z.array(z.string()).optional(), // Optional warnings emitted during validation
1044
- });
1045
- /** OAuth error response per RFC 6749 */
1046
- export const oAuthErrorSchema = z.object({
1047
- error: z.string(), // Error code (e.g. slow_down, invalid_grant)
1048
- error_description: z.string().optional(), // Human-readable error description
1049
- });
1050
- /** Schema for the current developer account. */
1051
- export const accountSchema = z.object({
1052
- alias: z.string().optional(), // Developer alias
1053
- created_at: z.string(), // Account creation date
1054
- email: z.string(), // Email address
1055
- email_verified: z.boolean(), // Whether email is verified
1056
- full_name: z.string().optional(), // Full name
1057
- id: z.string(), // Account ID
1058
- system_role: z.string(), // System role
1059
- timezone: z.string().optional(), // IANA timezone
1060
- });
1061
- /** Schema for eval task list responses. */
1062
- export const evalTaskListSchema = z.object({
1063
- data: z.array(evalTaskSchema), // Eval tasks
1064
- });
1065
- /** API schema for a knowledge search result item. */
1066
- export const knowledgeSearchResultSchema = z.object({
1067
- content: z.string().optional(), // Normalized content text
1068
- content_type: z.string().optional(), // Content MIME type
1069
- created_at: z.string().optional(), // Creation timestamp
1070
- id: z.string(), // Item ID (cim_...)
1071
- metadata: z.record(z.unknown()).optional(), // Additional metadata
1072
- raw_content: z.record(z.unknown()).optional(), // Raw content data
1073
- type: z.string().optional(), // Source type (requires preloaded :source association)
1074
- });
1075
- /** Schema for org billing settings. */
1076
- export const billingSettingsOrgSchema = z.object({
1077
- billing_provider_environment: z.string().optional(), // Stripe environment (live or test)
1078
- billing_provider_id: z.string().optional(), // Stripe customer ID
1079
- plan: z.string().optional(), // Billing plan (e.g. enterprise-pilot)
1080
- primary_user: z.string().optional(), // Org admin user who is the billing contact (public ID)
1081
- });
1082
- /** API schema for a media item. */
1083
- export const mediaSchema = z.object({
1084
- content_type: z.string().optional(), // Original variant content type
1085
- created_at: z.string().optional(), // Creation timestamp
1086
- filename: z.string().optional(), // Original variant filename
1087
- height: z.number().int().optional(), // Original variant height
1088
- id: z.string(), // Media ID
1089
- media_type: z.string().optional(), // Media type
1090
- name: z.string().optional(), // Media name
1091
- org: z.string().optional(), // Organization
1092
- sandbox: z.string().optional(), // Sandbox
1093
- updated_at: z.string().optional(), // Last update timestamp
1094
- url: z.string().optional(), // Original variant URL
1095
- variants: z.array(mediaVariantSchema).optional(), // Media variants
1096
- width: z.number().int().optional(), // Original variant width
1097
- });
1098
- /** Schema for an integration provider entry.
1099
-
1100
- Represents an available integration provider (OAuth or MCP) that can be
1101
- used with `create integration --provider <provider>`.
1102
- */
1103
- export const integrationProviderSchema = z.object({
1104
- auth_type: z.string(), // Auth mechanism: oauth, bearer, or app_installation
1105
- description: z.string().optional(), // Short description of the provider
1106
- display_name: z.string(), // Human-readable display name
1107
- provider: z.string(), // Provider key (e.g., google, mcp:system:mcp-github)
1108
- type: z.string(), // Provider type: oauth, mcp, or app_installation
1109
- });
1110
- /** Schema for an organization.
1111
-
1112
- Maps to serialized org output from developer portal API.
1113
- */
1114
- export const developerOrgSchema = z.object({
1115
- created_at: z.string().optional(), // Created timestamp
1116
- description: z.string().optional(), // Organization description
1117
- domain: z.string(), // Primary domain
1118
- id: z.string(), // Public ID (org_...)
1119
- industry: z.string().optional(), // Industry category
1120
- name: z.string(), // Organization name
1121
- sandbox: z.string().optional(), // Sandbox identifier (nullable)
1122
- slug: z.string(), // URL-safe slug
1123
- status: z.string().optional(), // Status (active, suspended, trialing)
1124
- updated_at: z.string().optional(), // Updated timestamp
1125
- website: z.string().optional(), // Website URL
1126
- });
1127
- /** API schema for a credential with decrypted secret values. */
1128
- export const credentialWithSecretsSchema = z.object({
1129
- credential: z.record(z.unknown()), // The credential with decrypted values
1130
- });
1131
- /** API schema for a storage file. */
1132
- export const storageFileSchema = z.object({
1133
- content_type: z.string().optional(), // MIME content type
1134
- created_at: z.string().optional(), // Creation timestamp
1135
- filename: z.string().optional(), // Original filename
1136
- id: z.string(), // File ID
1137
- image_source: imageSourceSchema.optional(), // Image source metadata
1138
- org: z.string().optional(), // Organization
1139
- sandbox: z.string().optional(), // Sandbox
1140
- size: z.number().int().optional(), // File size in bytes
1141
- updated_at: z.string().optional(), // Last update timestamp
1142
- url: z.string().optional(), // Signed download URL
1143
- });
1144
- /** Schema for picture upload parameters.
1145
-
1146
- Used for uploading profile pictures via base64 encoded data.
1147
- */
1148
- export const pictureParamsSchema = z.object({
1149
- data: z.string(), // Base64 encoded image data
1150
- filename: z.string(), // Original filename
1151
- mime_type: z.string(), // MIME type of the image
1152
- });
1153
- /** Schema for the API explorer response. */
1154
- export const apiExplorerIndexSchema = z.object({
1155
- data: z.array(apiExplorerEndpointSchema), // Documented API endpoints
1156
- schemas: z.record(z.unknown()).optional(), // Collected schema definitions
1157
- });
1158
- /** Schema for an app slug mapping. */
1159
- export const appSlugSchema = z.object({
1160
- app: z.string(), // App identifier
1161
- created_at: z.string().optional(), // Created timestamp
1162
- creator: z.string().optional(), // Creator identifier
1163
- id: z.string(), // Slug record ID
1164
- slug: z.string(), // Globally unique slug
1165
- updated_at: z.string().optional(), // Updated timestamp
1166
- });
1167
- /** Schema for a context item.
1168
-
1169
- Maps to serialized context item output from developer portal API.
1170
- */
1171
- export const contextItemSchema = z.object({
1172
- agent: z.string().optional(), // Agent
1173
- content_type: z.string().optional(), // Content type
1174
- created_at: z.string().optional(), // Created timestamp
1175
- id: z.string(), // Public ID (cim_...)
1176
- item_group: z.string().optional(), // Item group if part of a group
1177
- metadata: z.record(z.unknown()).optional(), // Additional metadata
1178
- normalized_content: z.string().optional(), // Normalized content text
1179
- raw_content: z.record(z.unknown()).optional(), // Raw content data
1180
- source: z.string().optional(), // Source
1181
- team: z.string().optional(), // Owning team
1182
- updated_at: z.string().optional(), // Updated timestamp
1183
- user: z.string().optional(), // Owning user
1184
- });
1185
- /** API schema for push notification test results. */
1186
- export const pushNotificationResultSchema = z.object({
1187
- results: z.array(z.record(z.unknown())).optional(), // Per-device results
1188
- success: z.boolean(), // Whether the notification was sent
1189
- total_sent: z.number().int().optional(), // Number of notifications sent
1190
- });
1191
- /** Schema for an OAuth client registration. */
1192
- export const oAuthClientSchema = z.object({
1193
- client_id: z.string(), // Public OAuth client ID
1194
- client_name: z.string(), // Display name for the client
1195
- client_secret: z.string().optional(), // Client secret shown only at creation
1196
- created_at: z.string().optional(), // Created timestamp
1197
- enabled: z.boolean(), // Whether the client is enabled
1198
- id: z.string(), // OAuth client registration ID
1199
- redirect_uris: z.array(z.string()), // Allowed redirect URIs
1200
- scopes: z.array(z.string()), // Allowed OAuth scopes
1201
- updated_at: z.string().optional(), // Updated timestamp
1202
- });
1203
- /** Schema for integration action metadata. */
1204
- export const integrationActionSchema = z.object({
1205
- description: z.string().optional(), // Action description
1206
- json_schema: z.record(z.unknown()), // JSON Schema for action parameters
1207
- key: z.string(), // Action key (e.g., gmail.list_messages)
1208
- scopes_any_of: z.record(z.unknown()).optional(), // Required scope sets for this action
1209
- });
1210
- /** Schema for app billing settings. */
1211
- export const billingSettingsAppSchema = z.object({
1212
- billing_account: z.string().optional(), // Developer account that owns billing (public ID)
1213
- org_billing_enabled: z.boolean().optional(), // Whether orgs get their own Stripe customers
1214
- });
1215
- /** Schema for an API key.
1216
-
1217
- Maps to serialized app key output from developer portal API.
1218
- */
1219
- export const appKeySchema = z.object({
1220
- created_at: z.string().optional(), // Created timestamp
1221
- full_key: z.string().optional(), // Full key shown only once at creation
1222
- id: z.string(), // Public ID (dak_...)
1223
- key_hint: z.string().optional(), // Last 4 chars hint
1224
- key_value: z.string().optional(), // Full key (publishable only)
1225
- last_used_at: z.string().optional(), // Last used timestamp
1226
- status: z.string(), // Status (active, revoked)
1227
- type: z.string(), // Key type (publishable, secret)
1228
- });
1229
- /** Schema for task update parameters.
1230
-
1231
- Used by both Users.Tasks.Update and Teams.Tasks.Update actions.
1232
- All fields are optional since updates only modify provided fields.
1233
- */
1234
- export const taskUpdateParamsSchema = z.object({
1235
- description: z.string().optional(), // Task description
1236
- due_date: z.string().optional(), // Due date
1237
- links: z.record(z.unknown()).optional(), // Related links
1238
- metadata: z.record(z.unknown()).optional(), // Additional metadata
1239
- name: z.string().optional(), // Task name
1240
- owner_persona: z.string().optional(), // Owner persona if assigned to agent
1241
- owner_user: z.string().optional(), // Owner user if assigned to user
1242
- priority: z.number().int().optional(), // Priority level (0-4)
1243
- status: z.string().optional(), // Task status (open, in_progress, done)
1244
- });
1245
- /** Schema for a context integration.
1246
-
1247
- Maps to serialized integration output from developer portal API.
1248
- */
1249
- export const contextIntegrationSchema = z.object({
1250
- agent: z.string().optional(), // Owning agent
1251
- auth_type: z.string(), // Auth type: oauth or app_installation
1252
- connected_at: z.string().optional(), // Connection timestamp
1253
- created_at: z.string().optional(), // Created timestamp
1254
- expires_at: z.string().optional(), // Token expiration timestamp
1255
- id: z.string(), // Public ID (int_...)
1256
- installation: z.string().optional(), // External installation (e.g. GitHub App installation)
1257
- last_refreshed_at: z.string().optional(), // Last token refresh timestamp
1258
- metadata: z.record(z.unknown()).optional(), // Additional metadata
1259
- org: z.string().optional(), // Owning org
1260
- provider: z.string(), // Provider name (e.g., google, github)
1261
- scopes: z.array(z.string()).optional(), // OAuth scopes
1262
- status: z.string(), // Connection status: connected, disconnected, or token_expired
1263
- team: z.string().optional(), // Owning team
1264
- updated_at: z.string().optional(), // Updated timestamp
1265
- user: z.string().optional(), // Owning user
1266
- workspace_key: z.string().optional(), // Workspace key
1267
- });
1268
- /** API schema for a scrape result. */
1269
- export const scrapeSchema = z.object({
1270
- created_at: z.string().optional(), // Creation timestamp
1271
- description: z.string().optional(), // Page description
1272
- id: z.string(), // Scrape ID (scp_...)
1273
- image_height: z.number().int().optional(), // Image height in pixels
1274
- image_url: z.string().optional(), // Image URL
1275
- image_width: z.number().int().optional(), // Image width in pixels
1276
- last_scraped_at: z.string().optional(), // Last scraped timestamp
1277
- metadata: z.record(z.unknown()).optional(), // Scrape metadata
1278
- status: z.string().optional(), // Scrape status
1279
- title: z.string().optional(), // Page title
1280
- updated_at: z.string().optional(), // Last update timestamp
1281
- url: z.string().optional(), // Scraped URL
1282
- version: z.number().int().optional(), // Scrape version
1283
- });
1284
- /** Schema for comment creation parameters.
1285
-
1286
- Used by both Users.Tasks.CreateComment and Teams.Tasks.CreateComment actions.
1287
- */
1288
- export const commentCreateParamsSchema = z.object({
1289
- body: z.string(), // Comment body text
1290
- });
1291
- /** List response for installation sources. */
1292
- export const installationSourceListResponseSchema = z.object({
1293
- data: z.array(installationSourceSchema), // List of installation sources
1294
- });
1295
- /** Schema for a user (developer admin view).
1296
-
1297
- Maps to serialized user output from developer portal API.
1298
- */
1299
- export const developerUserSchema = z.object({
1300
- alias: z.string().optional(), // User alias
1301
- confirmed_at: z.string().optional(), // Email confirmed timestamp
1302
- created_at: z.string().optional(), // Created timestamp
1303
- email: z.string(), // Email address
1304
- full_name: z.string().optional(), // Full name
1305
- id: z.string(), // Public ID (usr_...)
1306
- is_system_user: z.boolean().optional(), // Whether this is a system user
1307
- org: z.string().optional(), // Organization (nullable)
1308
- org_name: z.string().optional(), // Organization display name (nullable)
1309
- org_role: z.string().optional(), // Organization role (admin, member, viewer; nullable)
1310
- password: z.string().optional(), // Temporary plaintext password returned on reset
1311
- sandbox: z.string().optional(), // Sandbox identifier (nullable)
1312
- updated_at: z.string().optional(), // Updated timestamp
1313
- });
1314
- /** Schema for password update parameters.
1315
- */
1316
- export const passwordUpdateParamsSchema = z.object({
1317
- password: z.string(), // New password
1318
- password_confirmation: z.string(), // New password confirmation
1319
- });
1320
- /** Schema for OAuth client list responses. */
1321
- export const oAuthClientListSchema = z.object({
1322
- data: z.array(oAuthClientSchema), // OAuth clients
1323
- });
1324
369
  //# sourceMappingURL=common.js.map