@archastro/sdk 0.1.0 → 0.4.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 (155) hide show
  1. package/README.md +165 -0
  2. package/dist/client.d.ts +13 -13
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +27 -27
  5. package/dist/client.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/runtime/http-client.d.ts +7 -0
  11. package/dist/runtime/http-client.d.ts.map +1 -1
  12. package/dist/runtime/http-client.js +55 -0
  13. package/dist/runtime/http-client.js.map +1 -1
  14. package/dist/types/agents.d.ts +662 -431
  15. package/dist/types/agents.d.ts.map +1 -1
  16. package/dist/types/agents.js +51 -37
  17. package/dist/types/agents.js.map +1 -1
  18. package/dist/types/ai.d.ts +49 -49
  19. package/dist/types/ai.js +6 -6
  20. package/dist/types/ai.js.map +1 -1
  21. package/dist/types/api.d.ts +169 -0
  22. package/dist/types/api.d.ts.map +1 -0
  23. package/dist/types/api.js +49 -0
  24. package/dist/types/api.js.map +1 -0
  25. package/dist/types/artifacts.d.ts +102 -22
  26. package/dist/types/artifacts.d.ts.map +1 -1
  27. package/dist/types/artifacts.js +4 -3
  28. package/dist/types/artifacts.js.map +1 -1
  29. package/dist/types/automations.d.ts +13 -13
  30. package/dist/types/automations.js +4 -4
  31. package/dist/types/automations.js.map +1 -1
  32. package/dist/types/chat.d.ts +258 -6
  33. package/dist/types/chat.d.ts.map +1 -1
  34. package/dist/types/chat.js +5 -3
  35. package/dist/types/chat.js.map +1 -1
  36. package/dist/types/common.d.ts +3596 -980
  37. package/dist/types/common.d.ts.map +1 -1
  38. package/dist/types/common.js +281 -166
  39. package/dist/types/common.js.map +1 -1
  40. package/dist/types/config.d.ts +30 -30
  41. package/dist/types/config.js +6 -6
  42. package/dist/types/config.js.map +1 -1
  43. package/dist/types/device.d.ts +26 -0
  44. package/dist/types/device.d.ts.map +1 -0
  45. package/dist/types/device.js +14 -0
  46. package/dist/types/device.js.map +1 -0
  47. package/dist/types/index.d.ts +0 -4
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/index.js +1 -5
  50. package/dist/types/index.js.map +1 -1
  51. package/dist/types/me.d.ts +176 -20
  52. package/dist/types/me.d.ts.map +1 -1
  53. package/dist/types/me.js +4 -3
  54. package/dist/types/me.js.map +1 -1
  55. package/dist/types/members.d.ts +3 -3
  56. package/dist/types/members.js +2 -2
  57. package/dist/types/members.js.map +1 -1
  58. package/dist/types/messages.d.ts +457 -49
  59. package/dist/types/messages.d.ts.map +1 -1
  60. package/dist/types/messages.js +19 -18
  61. package/dist/types/messages.js.map +1 -1
  62. package/dist/types/oauth.d.ts +206 -0
  63. package/dist/types/oauth.d.ts.map +1 -0
  64. package/dist/types/oauth.js +51 -0
  65. package/dist/types/oauth.js.map +1 -0
  66. package/dist/types/orgs.d.ts +6 -6
  67. package/dist/types/picture.d.ts +2 -2
  68. package/dist/types/profile.d.ts +2 -2
  69. package/dist/types/reactions.d.ts +3 -3
  70. package/dist/types/reactions.js +2 -2
  71. package/dist/types/reactions.js.map +1 -1
  72. package/dist/types/schedules.d.ts +5 -5
  73. package/dist/types/schedules.js +2 -2
  74. package/dist/types/schedules.js.map +1 -1
  75. package/dist/types/system.d.ts +2 -2
  76. package/dist/types/teams.d.ts +750 -70
  77. package/dist/types/teams.d.ts.map +1 -1
  78. package/dist/types/teams.js +13 -10
  79. package/dist/types/teams.js.map +1 -1
  80. package/dist/types/threads.d.ts +1158 -194
  81. package/dist/types/threads.d.ts.map +1 -1
  82. package/dist/types/threads.js +26 -26
  83. package/dist/types/threads.js.map +1 -1
  84. package/dist/types/users.d.ts +53 -13
  85. package/dist/types/users.d.ts.map +1 -1
  86. package/dist/types/users.js +4 -4
  87. package/dist/types/users.js.map +1 -1
  88. package/dist/v1/resources/agent_installations.d.ts +4 -4
  89. package/dist/v1/resources/agent_installations.d.ts.map +1 -1
  90. package/dist/v1/resources/agent_installations.js +3 -3
  91. package/dist/v1/resources/agent_installations.js.map +1 -1
  92. package/dist/v1/resources/agent_routines.d.ts +9 -14
  93. package/dist/v1/resources/agent_routines.d.ts.map +1 -1
  94. package/dist/v1/resources/agent_routines.js +11 -19
  95. package/dist/v1/resources/agent_routines.js.map +1 -1
  96. package/dist/v1/resources/agent_sessions.d.ts +1 -0
  97. package/dist/v1/resources/agent_sessions.d.ts.map +1 -1
  98. package/dist/v1/resources/agent_sessions.js +1 -1
  99. package/dist/v1/resources/agent_sessions.js.map +1 -1
  100. package/dist/v1/resources/agent_tools.d.ts +1 -6
  101. package/dist/v1/resources/agent_tools.d.ts.map +1 -1
  102. package/dist/v1/resources/agent_tools.js +4 -12
  103. package/dist/v1/resources/agent_tools.js.map +1 -1
  104. package/dist/v1/resources/agents.d.ts +24 -26
  105. package/dist/v1/resources/agents.d.ts.map +1 -1
  106. package/dist/v1/resources/agents.js +25 -31
  107. package/dist/v1/resources/agents.js.map +1 -1
  108. package/dist/v1/resources/ai.d.ts +5 -15
  109. package/dist/v1/resources/ai.d.ts.map +1 -1
  110. package/dist/v1/resources/ai.js +6 -22
  111. package/dist/v1/resources/ai.js.map +1 -1
  112. package/dist/v1/resources/api.d.ts +1026 -0
  113. package/dist/v1/resources/api.d.ts.map +1 -0
  114. package/dist/v1/resources/api.js +944 -0
  115. package/dist/v1/resources/api.js.map +1 -0
  116. package/dist/v1/resources/artifacts.d.ts +7 -9
  117. package/dist/v1/resources/artifacts.d.ts.map +1 -1
  118. package/dist/v1/resources/artifacts.js +5 -13
  119. package/dist/v1/resources/artifacts.js.map +1 -1
  120. package/dist/v1/resources/config.d.ts +41 -53
  121. package/dist/v1/resources/config.d.ts.map +1 -1
  122. package/dist/v1/resources/config.js +18 -42
  123. package/dist/v1/resources/config.js.map +1 -1
  124. package/dist/v1/resources/custom_objects.d.ts +2 -2
  125. package/dist/v1/resources/custom_objects.d.ts.map +1 -1
  126. package/dist/v1/resources/custom_objects.js +1 -1
  127. package/dist/v1/resources/index.d.ts +13 -13
  128. package/dist/v1/resources/index.d.ts.map +1 -1
  129. package/dist/v1/resources/index.js +14 -14
  130. package/dist/v1/resources/index.js.map +1 -1
  131. package/dist/v1/resources/oauth.d.ts +25 -0
  132. package/dist/v1/resources/oauth.d.ts.map +1 -0
  133. package/dist/v1/resources/oauth.js +41 -0
  134. package/dist/v1/resources/oauth.js.map +1 -0
  135. package/dist/v1/resources/teams.d.ts +212 -55
  136. package/dist/v1/resources/teams.d.ts.map +1 -1
  137. package/dist/v1/resources/teams.js +18 -26
  138. package/dist/v1/resources/teams.js.map +1 -1
  139. package/dist/v1/resources/thread_messages.d.ts +5 -11
  140. package/dist/v1/resources/thread_messages.d.ts.map +1 -1
  141. package/dist/v1/resources/thread_messages.js +4 -12
  142. package/dist/v1/resources/thread_messages.js.map +1 -1
  143. package/dist/v1/resources/threads.d.ts +131 -65
  144. package/dist/v1/resources/threads.d.ts.map +1 -1
  145. package/dist/v1/resources/threads.js +20 -68
  146. package/dist/v1/resources/threads.js.map +1 -1
  147. package/dist/v1/resources/users.d.ts +144 -45
  148. package/dist/v1/resources/users.d.ts.map +1 -1
  149. package/dist/v1/resources/users.js +10 -34
  150. package/dist/v1/resources/users.js.map +1 -1
  151. package/dist/v1.d.ts +13 -13
  152. package/dist/v1.d.ts.map +1 -1
  153. package/dist/v1.js +27 -27
  154. package/dist/v1.js.map +1 -1
  155. package/package.json +1 -1
@@ -1,10 +1,129 @@
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: 52d854ce8966
3
+ // Content hash: 0bbab3d3f31f
4
4
  import { z } from "zod";
5
5
  import { imageSourceSchema } from "./image.js";
6
- import { messageSchema } from "./messages.js";
7
6
  import { userSchema } from "./users.js";
7
+ /** Schema for a message actor (user or agent).
8
+
9
+ Actors represent the entity that sent a message.
10
+ Maps to the actor format from MessageActorHelper.build_actor/1.
11
+ */
12
+ export const actorSchema = z.object({
13
+ alias: z.string().optional(), // Actor alias/handle
14
+ id: z.string().optional(), // Actor ID (format: user-xxx or agent-xxx)
15
+ name: z.string().optional(), // Actor display name
16
+ profile_picture: imageSourceSchema.optional(), // Profile picture
17
+ });
18
+ /** API schema for a media variant. */
19
+ export const mediaVariantSchema = z.object({
20
+ content_type: z.string().optional(), // File content type
21
+ created_at: z.string().optional(), // Creation timestamp
22
+ file: z.string().optional(), // Storage file
23
+ filename: z.string().optional(), // Original filename
24
+ height: z.number().int().optional(), // Height in pixels
25
+ id: z.string(), // Variant ID
26
+ image_source: imageSourceSchema.optional(), // Image source metadata
27
+ updated_at: z.string().optional(), // Last update timestamp
28
+ url: z.string().optional(), // Signed download URL
29
+ variant_key: z.string().optional(), // Variant key (original, thumbnail, etc)
30
+ width: z.number().int().optional(), // Width in pixels
31
+ });
32
+ /** Schema for a message attachment.
33
+
34
+ Attachments can be of various types (file, scraped_link, artifact, task, media, action).
35
+ Fields present depend on the attachment type.
36
+ Maps to format_attachments_for_client/1 output.
37
+ */
38
+ export const attachmentSchema = z.object({
39
+ content_type: z.string().optional(), // MIME content type (file, artifact, media types)
40
+ description: z.string().optional(), // Description (scraped_link, artifact, task types)
41
+ filename: z.string().optional(), // File name (file, artifact, media types)
42
+ height: z.number().int().optional(), // Media height (media type)
43
+ id: z.string(), // Attachment ID
44
+ image_height: z.number().int().optional(), // Preview image height (scraped_link type)
45
+ image_source: imageSourceSchema.optional(), // Image metadata (file, scraped_link, artifact, media types)
46
+ image_url: z.string().optional(), // Preview image URL (scraped_link type)
47
+ image_width: z.number().int().optional(), // Preview image width (scraped_link type)
48
+ media_type: z.string().optional(), // Media type (media type)
49
+ name: z.string().optional(), // Media name (media type)
50
+ object: z.record(z.unknown()).optional(), // Embedded object (task, action types)
51
+ title: z.string().optional(), // Title (scraped_link, artifact, task types)
52
+ type: z.string(), // Attachment type: file, scraped_link, artifact, task, media, action
53
+ url: z.string().optional(), // URL to the resource (file, scraped_link, artifact, media types)
54
+ variants: z.array(mediaVariantSchema).optional(), // Media variants (media type)
55
+ version: z.number().int().optional(), // Artifact version number (artifact type)
56
+ width: z.number().int().optional(), // Media width (media type)
57
+ });
58
+ /** Schema for inline message reactions.
59
+
60
+ This is the compact format used in Message.reactions[], which differs from
61
+ the full Reaction schema used in standalone reaction endpoints.
62
+ Maps to format_reactions_for_client/1 output.
63
+ */
64
+ export const messageReactionSchema = z.object({
65
+ payload: z.record(z.unknown()).optional(), // Reaction payload (e.g., {emoji: '👍'})
66
+ type: z.string(), // Reaction type (e.g., emoji_reaction)
67
+ user: z.string().optional(), // User who added the reaction
68
+ });
69
+ /** API schema for a chat message. */
70
+ export const messageSchema = z.object({
71
+ actors: z.array(actorSchema).optional(), // Message actors
72
+ agent: z.string().optional(), // Agent if sent by an agent user
73
+ attachments: z.array(attachmentSchema).optional(), // Message attachments
74
+ branched_thread: z.string().optional(), // Branched thread (if message spawned a thread)
75
+ content: z.string().optional(), // Message content
76
+ created_at: z.string().optional(), // Creation timestamp
77
+ has_replies: z.boolean().optional(), // Whether message has replies
78
+ id: z.string(), // Message ID (msg_...)
79
+ idempotency_key: z.string().optional(), // Client-provided idempotency key
80
+ legacy_agent: z.string().optional(), // Legacy agent if sent by legacy chat agent
81
+ metadata: z.record(z.unknown()).optional(), // Message metadata
82
+ org: z.string().optional(), // Organization
83
+ reactions: z.array(messageReactionSchema).optional(), // Message reactions
84
+ rendering_mode: z.string().optional(), // Rendering mode hint
85
+ replies: z.array(z.record(z.unknown())).optional(), // Inline replies (if loaded)
86
+ replies_after_cursor: z.string().optional(), // Cursor for replies pagination
87
+ replies_before_cursor: z.string().optional(), // Cursor for replies pagination
88
+ reply_count: z.number().int().optional(), // Number of replies
89
+ reply_to: z.record(z.unknown()).optional(), // Parent message object (if loaded)
90
+ sandbox: z.string().optional(), // Sandbox identifier
91
+ team: z.string().optional(), // Team
92
+ thread: z.string().optional(), // Parent thread
93
+ user: z.string().optional(), // Author user (public ID or expanded object when loaded)
94
+ });
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
105
+ });
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": "..."}]}
119
+
120
+ Cannot mix `grants` with `add`/`remove`.
121
+ */
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
126
+ });
8
127
  /** Schema for a thread in the developer portal.
9
128
 
10
129
  Maps to serialized thread output from developer portal API.
@@ -34,9 +153,9 @@ export const contextIngestionSchema = z.object({
34
153
  agent: z.string().optional(), // Agent
35
154
  completed_at: z.string().optional(), // Completed timestamp
36
155
  created_at: z.string().optional(), // Created timestamp
37
- error: z.unknown().optional(), // Error details (if failed)
156
+ error: z.record(z.unknown()).optional(), // Error details (if failed)
38
157
  id: z.string(), // Public ID (cig_...)
39
- metadata: z.unknown().optional(), // Additional metadata
158
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
40
159
  source: z.string().optional(), // Source ID
41
160
  started_at: z.string().optional(), // Started timestamp
42
161
  status: z.string(), // Status (pending, running, awaiting_callback, succeeded, failed)
@@ -57,18 +176,18 @@ export const workingMemoryEntrySchema = z.object({
57
176
  /** Schema for a sandbox-captured email.
58
177
  */
59
178
  export const sandboxEmailSchema = z.object({
60
- bcc: z.array(z.unknown()).optional(), // BCC recipients
61
- cc: z.array(z.unknown()).optional(), // CC recipients
179
+ bcc: z.array(z.record(z.unknown())).optional(), // BCC recipients
180
+ cc: z.array(z.record(z.unknown())).optional(), // CC recipients
62
181
  created_at: z.string().optional(), // When the email was captured
63
182
  from_address: z.string(), // Sender email address
64
183
  from_name: z.string().optional(), // Sender display name
65
- headers: z.unknown().optional(), // Custom email headers
184
+ headers: z.record(z.unknown()).optional(), // Custom email headers
66
185
  html_body: z.string().optional(), // HTML body
67
186
  id: z.string(), // Public ID (sem_...)
68
- reply_to: z.unknown().optional(), // Reply-to address
187
+ reply_to: z.record(z.unknown()).optional(), // Reply-to address
69
188
  subject: z.string().optional(), // Email subject
70
189
  text_body: z.string().optional(), // Plain text body
71
- to: z.array(z.unknown()), // Recipients [{name, address}]
190
+ to: z.array(z.record(z.unknown())), // Recipients [{name, address}]
72
191
  });
73
192
  /** Schema for an LLM session call.
74
193
 
@@ -82,7 +201,7 @@ export const llmCallSchema = z.object({
82
201
  id: z.string(), // Public ID (alc_...)
83
202
  latency_ms: z.number().int(), // Latency in milliseconds
84
203
  message_count: z.number().int().optional(), // Number of messages included in the call metadata
85
- metadata: z.unknown().optional(), // Additional metadata
204
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
86
205
  model: z.string().optional(), // LLM model name
87
206
  prompt_tokens: z.number().int(), // Number of prompt tokens
88
207
  session_id: z.string(), // Session UUID grouping related calls
@@ -112,22 +231,26 @@ export const webhookEventSchema = z.object({
112
231
  created_at: z.string().optional(), // Created timestamp
113
232
  error: z.string().optional(), // Error message if failed
114
233
  event_type: z.string().optional(), // Event type from the provider
115
- headers: z.unknown().optional(), // Request headers
234
+ headers: z.record(z.unknown()).optional(), // Request headers
116
235
  id: z.string(), // Public ID (whe_...)
117
- payload: z.unknown().optional(), // Event payload
236
+ payload: z.record(z.unknown()).optional(), // Event payload
118
237
  processed_at: z.string().optional(), // When the event was processed
119
238
  status: z.string(), // Processing status (pending, processed, failed)
120
239
  });
121
- /** Schema for a message actor (user or agent).
122
-
123
- Actors represent the entity that sent a message.
124
- Maps to the actor format from MessageActorHelper.build_actor/1.
125
- */
126
- export const actorSchema = z.object({
127
- alias: z.string().optional(), // Actor alias/handle
128
- id: z.string().optional(), // Actor ID (format: user-xxx or agent-xxx)
129
- name: z.string().optional(), // Actor display name
130
- profile_picture: imageSourceSchema.optional(), // Profile picture
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
131
254
  });
132
255
  /** Schema for an eval run. */
133
256
  export const evalRunSchema = z.object({
@@ -136,11 +259,11 @@ export const evalRunSchema = z.object({
136
259
  completed_at: z.string().optional(), // Completion timestamp
137
260
  created_at: z.string().optional(), // Created timestamp
138
261
  id: z.string(), // Eval run ID
139
- results: z.array(z.unknown()).optional(), // Eval results for this run
262
+ results: z.array(evalResultSchema).optional(), // Eval results for this run
140
263
  started_at: z.string().optional(), // Start timestamp
141
264
  status: z.string(), // Run status
142
265
  suite: z.string(), // Eval suite identifier
143
- summary: z.unknown().optional(), // Aggregate run summary
266
+ summary: z.record(z.unknown()).optional(), // Aggregate run summary
144
267
  updated_at: z.string().optional(), // Updated timestamp
145
268
  });
146
269
  /** API schema for a context entry. */
@@ -149,11 +272,11 @@ export const contextEntrySchema = z.object({
149
272
  agent_user: z.string().optional(), // Agent user
150
273
  before_cursor: z.string().optional(), // Pagination cursor (before)
151
274
  created_at: z.string().optional(), // Creation timestamp
152
- files: z.array(z.unknown()).optional(), // Loaded file objects
275
+ files: z.array(z.record(z.unknown())).optional(), // Loaded file objects
153
276
  id: z.string(), // Context entry ID
154
- links: z.array(z.unknown()).optional(), // Loaded link objects
155
- media: z.array(z.unknown()).optional(), // Loaded media objects
156
- metadata: z.unknown().optional(), // Entry metadata
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
157
280
  org: z.string().optional(), // Organization
158
281
  sandbox: z.string().optional(), // Sandbox identifier
159
282
  team: z.string().optional(), // Team
@@ -172,7 +295,7 @@ export const webhookSchema = z.object({
172
295
  enabled: z.boolean(), // Whether the webhook is enabled
173
296
  id: z.string(), // Public ID (whk_...)
174
297
  lookup_key: z.string().optional(), // Lookup key for generic webhooks
175
- metadata: z.unknown().optional(), // Additional metadata
298
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
176
299
  provider: z.string().optional(), // Provider type for known providers (github, slack), nil for generic webhooks
177
300
  updated_at: z.string().optional(), // Updated timestamp
178
301
  webhook_url: z.string(), // URL to send webhooks to
@@ -199,12 +322,6 @@ export const deviceAuthorizationResponseSchema = z.object({
199
322
  verification_uri: z.string(), // Base verification URI
200
323
  verification_uri_complete: z.string(), // Full verification URI with code
201
324
  });
202
- /** API schema for a single ACL grant entry. */
203
- export const aclGrantSchema = z.object({
204
- actions: z.array(z.string()), // List of allowed actions (e.g. read, write)
205
- principal: z.string().optional(), // Principal identifier (UUID for user/team/org/agent_user, role name for org_role, omit for everyone)
206
- principal_type: z.string(), // Principal type: user, team, org, org_role, agent, or everyone
207
- });
208
325
  /** API schema for OAuth token endpoint responses. */
209
326
  export const oAuthTokenResponseSchema = z.object({
210
327
  access_token: z.string(), // OAuth access token
@@ -219,38 +336,22 @@ export const computerExecResultSchema = z.object({
219
336
  exit_code: z.number().int().optional(), // Process exit code
220
337
  output: z.string().optional(), // Command output
221
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
+ });
222
349
  /** Source option metadata for LLM call filtering.
223
350
  */
224
351
  export const llmCallSourceOptionSchema = z.object({
225
352
  label: z.string(), // Human-friendly source label
226
353
  source: z.string(), // Machine-readable LLM source key
227
354
  });
228
- /** API schema for identifying a principal to remove from an ACL. */
229
- export const aclRemoveTargetSchema = z.object({
230
- principal: z.string().optional(), // Principal identifier to remove (omit for everyone)
231
- principal_type: z.string(), // Principal type to remove
232
- });
233
- /** Reusable API schema for access control lists.
234
-
235
- Supports two modes (mutually exclusive):
236
-
237
- **Replace mode** — send `grants` to replace all entries:
238
-
239
- {"grants": [{"principal_type": "user", "principal": "...", "actions": ["read"]}]}
240
-
241
- Use `{"grants": []}` to clear all entries.
242
-
243
- **Patch mode** — send `add` and/or `remove`:
244
-
245
- {"add": [...grants...], "remove": [{"principal_type": "user", "principal": "..."}]}
246
-
247
- Cannot mix `grants` with `add`/`remove`.
248
- */
249
- export const aclSchema = z.object({
250
- add: z.array(aclGrantSchema).optional(), // Patch mode: grants to add or merge into existing
251
- grants: z.array(aclGrantSchema).optional(), // Replace mode: full list of grants (replaces all existing). Use [] to clear.
252
- remove: z.array(aclRemoveTargetSchema).optional(), // Patch mode: principals to remove from existing
253
- });
254
355
  /** Schema for an app environment variable response that includes the plaintext value. */
255
356
  export const appEnvVarPlaintextSchema = z.object({
256
357
  created_at: z.string().optional(), // Created timestamp
@@ -267,7 +368,7 @@ export const integrationSchema = z.object({
267
368
  provider: z.string(), // Provider identifier
268
369
  sandbox: z.string().optional(), // Sandbox identifier (nullable)
269
370
  secret_group: z.string().optional(), // Secret group
270
- state: z.unknown(), // Connector state information
371
+ state: z.record(z.unknown()), // Connector state information
271
372
  team: z.string().optional(), // Team (if team-scoped)
272
373
  user: z.string().optional(), // User (if user-scoped)
273
374
  workspace_key: z.string().optional(), // Provider workspace identifier
@@ -295,7 +396,7 @@ export const keyValueStorageEntrySchema = z.object({
295
396
  export const installationKindSchema = z.object({
296
397
  accepts_sources: z.boolean().optional(), // Whether this kind accepts sources
297
398
  category: z.string().optional(), // Category
298
- config_schema: z.unknown().optional(), // JSON schema for configuration
399
+ config_schema: z.record(z.unknown()).optional(), // JSON schema for configuration
299
400
  description: z.string().optional(), // Description
300
401
  kind: z.string(), // Installation kind identifier
301
402
  label: z.string().optional(), // Display label
@@ -306,18 +407,25 @@ export const installationKindSchema = z.object({
306
407
  export const installationKindListResponseSchema = z.object({
307
408
  data: z.array(installationKindSchema), // List of installation kinds
308
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
+ });
309
417
  /** Schema for an eval task. */
310
418
  export const evalTaskSchema = z.object({
311
419
  created_at: z.string().optional(), // Created timestamp
312
420
  expected_outcome: z.string(), // Expected outcome
313
- grading_criteria: z.array(z.unknown()).optional(), // Grading criteria
421
+ grading_criteria: z.array(z.record(z.unknown())).optional(), // Grading criteria
314
422
  id: z.string(), // Eval task ID
315
423
  input_message: z.string(), // Task input message
316
- mock_agent_memory: z.unknown().optional(), // Mock agent memory
317
- mock_context_items: z.array(z.unknown()).optional(), // Mock context items
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
318
426
  mock_datetime: z.string().optional(), // Mock datetime
319
- mock_participants: z.array(z.unknown()).optional(), // Mock participants
320
- mock_tools: z.array(z.unknown()).optional(), // Mock tool definitions
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
321
429
  status: z.string(), // Task status
322
430
  suite: z.string(), // Parent eval suite identifier
323
431
  updated_at: z.string().optional(), // Updated timestamp
@@ -325,7 +433,7 @@ export const evalTaskSchema = z.object({
325
433
  /** API schema for a task comment. */
326
434
  export const taskCommentSchema = z.object({
327
435
  author: z.string().optional(), // Legacy author
328
- author_actor: z.unknown().optional(), // Author actor details
436
+ author_actor: z.record(z.unknown()).optional(), // Author actor details
329
437
  author_persona: z.string().optional(), // Author persona
330
438
  author_user: z.string().optional(), // Author user
331
439
  body: z.string(), // Comment body text
@@ -337,21 +445,6 @@ export const taskCommentSchema = z.object({
337
445
  team: z.string().optional(), // Team
338
446
  updated_at: z.string().optional(), // Last update timestamp
339
447
  });
340
- /** Schema for an eval result. */
341
- export const evalResultSchema = z.object({
342
- agent_response: z.string().optional(), // Agent response
343
- created_at: z.string().optional(), // Created timestamp
344
- duration_ms: z.number().int().optional(), // Execution duration
345
- grader_details: z.unknown().optional(), // Grader details
346
- id: z.string(), // Eval result ID
347
- run: z.string(), // Parent eval run identifier
348
- score: z.number().optional(), // Result score
349
- status: z.string(), // Result status
350
- task: z.string().optional(), // Eval task identifier
351
- task_input: z.string().optional(), // Task input summary
352
- transcript: z.unknown().optional(), // Execution transcript
353
- updated_at: z.string().optional(), // Updated timestamp
354
- });
355
448
  /** Schema for eval result list responses. */
356
449
  export const evalResultListSchema = z.object({
357
450
  data: z.array(evalResultSchema), // Eval results
@@ -373,7 +466,7 @@ export const evalSuiteSchema = z.object({
373
466
  name: z.string(), // Suite name
374
467
  org: z.string().optional(), // Owner organization identifier
375
468
  status: z.string(), // Suite status
376
- tasks: z.array(z.unknown()).optional(), // Eval tasks included in the suite
469
+ tasks: z.array(evalTaskSchema).optional(), // Eval tasks included in the suite
377
470
  updated_at: z.string().optional(), // Updated timestamp
378
471
  user: z.string().optional(), // Owner user identifier
379
472
  });
@@ -409,7 +502,7 @@ export const trajectorySchema = z.object({
409
502
  created_at: z.string().optional(), // Creation timestamp
410
503
  file: z.string().optional(), // Storage file
411
504
  id: z.string(), // Trajectory ID (trj_...)
412
- messages: z.unknown().optional(), // Trajectory messages
505
+ messages: z.record(z.unknown()).optional(), // Trajectory messages
413
506
  org: z.string().optional(), // Organization
414
507
  sandbox: z.string().optional(), // Sandbox
415
508
  team: z.string().optional(), // Team
@@ -437,7 +530,7 @@ export const paginatedRepliesSchema = z.object({
437
530
  });
438
531
  /** A routine preset with its metadata. */
439
532
  export const routinePresetSchema = z.object({
440
- config: z.unknown().optional(), // Default configuration
533
+ config: z.record(z.unknown()).optional(), // Default configuration
441
534
  description: z.string().optional(), // Preset description
442
535
  event_type: z.string().optional(), // Event type
443
536
  label: z.string().optional(), // Display label
@@ -451,7 +544,7 @@ export const personaSchema = z.object({
451
544
  id: z.string(), // Persona ID
452
545
  is_active: z.boolean().optional(), // Whether persona is active
453
546
  is_enabled_for_thread: z.boolean().optional(), // Whether persona is enabled for thread
454
- metadata: z.unknown().optional(), // Persona metadata
547
+ metadata: z.record(z.unknown()).optional(), // Persona metadata
455
548
  name: z.string().optional(), // Persona display name
456
549
  org: z.string().optional(), // Organization
457
550
  personality: z.string().optional(), // Persona personality description
@@ -460,48 +553,22 @@ export const personaSchema = z.object({
460
553
  updated_at: z.string().optional(), // Last update timestamp
461
554
  user: z.string().optional(), // Owning user
462
555
  });
463
- /** Schema for a message attachment.
464
-
465
- Attachments can be of various types (file, scraped_link, artifact, task, media, action).
466
- Fields present depend on the attachment type.
467
- Maps to format_attachments_for_client/1 output.
468
- */
469
- export const attachmentSchema = z.object({
470
- content_type: z.string().optional(), // MIME content type (file, artifact, media types)
471
- description: z.string().optional(), // Description (scraped_link, artifact, task types)
472
- filename: z.string().optional(), // File name (file, artifact, media types)
473
- height: z.number().int().optional(), // Media height (media type)
474
- id: z.string(), // Attachment ID
475
- image_height: z.number().int().optional(), // Preview image height (scraped_link type)
476
- image_source: imageSourceSchema.optional(), // Image metadata (file, scraped_link, artifact, media types)
477
- image_url: z.string().optional(), // Preview image URL (scraped_link type)
478
- image_width: z.number().int().optional(), // Preview image width (scraped_link type)
479
- media_type: z.string().optional(), // Media type (media type)
480
- name: z.string().optional(), // Media name (media type)
481
- object: z.unknown().optional(), // Embedded object (task, action types)
482
- title: z.string().optional(), // Title (scraped_link, artifact, task types)
483
- type: z.string(), // Attachment type: file, scraped_link, artifact, task, media, action
484
- url: z.string().optional(), // URL to the resource (file, scraped_link, artifact, media types)
485
- variants: z.array(z.unknown()).optional(), // Media variants (media type)
486
- version: z.number().int().optional(), // Artifact version number (artifact type)
487
- width: z.number().int().optional(), // Media width (media type)
488
- });
489
556
  /** API schema for an installation. */
490
557
  export const installationSchema = z.object({
491
558
  agent: z.string().optional(), // Owning agent
492
- config: z.unknown().optional(), // Configuration
559
+ config: z.record(z.unknown()).optional(), // Configuration
493
560
  created_at: z.string().optional(), // Creation timestamp
494
561
  id: z.string(), // Installation ID (cin_...)
495
562
  kind: z.string().optional(), // Installation kind
496
563
  shared_integration: z.string().optional(), // Bound shared integration
497
564
  state: z.string().optional(), // Installation state
498
- status_payload: z.unknown().optional(), // Status payload
565
+ status_payload: z.record(z.unknown()).optional(), // Status payload
499
566
  updated_at: z.string().optional(), // Last update timestamp
500
567
  });
501
568
  /** Schema for persona update parameters.
502
569
  */
503
570
  export const personaUpdateParamsSchema = z.object({
504
- metadata: z.unknown().optional(), // Additional metadata
571
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
505
572
  name: z.string().optional(), // Persona display name
506
573
  personality: z.string().optional(), // Persona personality description
507
574
  });
@@ -532,11 +599,11 @@ export const evalRunListSchema = z.object({
532
599
  /** Schema for LLM call trajectory contents. */
533
600
  export const llmCallTrajectorySchema = z.object({
534
601
  download_url: z.string().optional(), // Signed transcript download URL
535
- messages: z.array(z.unknown()), // Trajectory messages
602
+ messages: z.array(z.record(z.unknown())), // Trajectory messages
536
603
  });
537
604
  /** API schema for a user credential. */
538
605
  export const credentialSchema = z.object({
539
- alt_domains: z.unknown().optional(), // Alternative domains
606
+ alt_domains: z.record(z.unknown()).optional(), // Alternative domains
540
607
  created_at: z.string().optional(), // Creation timestamp
541
608
  description: z.string().optional(), // Description
542
609
  domain: z.string().optional(), // Primary domain
@@ -549,9 +616,9 @@ export const credentialSchema = z.object({
549
616
  });
550
617
  /** API schema for an activity feed entry. */
551
618
  export const activityFeedEntrySchema = z.object({
552
- 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.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)
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)
553
620
  app: z.string().optional(), // Application
554
- attachments: z.array(z.unknown()).optional(), // Entry attachments
621
+ attachments: z.array(z.record(z.unknown())).optional(), // Entry attachments
555
622
  automation_run: z.string().optional(), // Automation run
556
623
  content: z.string().optional(), // Longer explanation (markdown)
557
624
  correlation_id: z.string().optional(), // Correlation ID for grouped entries
@@ -559,7 +626,7 @@ export const activityFeedEntrySchema = z.object({
559
626
  id: z.string(), // Entry ID (afe_...)
560
627
  kind: z.string().optional(), // Entry kind
561
628
  level: z.string().optional(), // Severity level
562
- metadata: z.unknown().optional(), // Entry metadata
629
+ metadata: z.record(z.unknown()).optional(), // Entry metadata
563
630
  org: z.string().optional(), // Organization
564
631
  routine_run: z.string().optional(), // Routine run
565
632
  sandbox: z.string().optional(), // Sandbox identifier
@@ -568,7 +635,7 @@ export const activityFeedEntrySchema = z.object({
568
635
  thread: z.string().optional(), // Thread
569
636
  title: z.string().optional(), // One-line summary
570
637
  updated_at: z.string().optional(), // Last update timestamp
571
- user: z.union([z.string(), z.object({ alias: z.string().optional(), email: z.string().optional(), id: z.string(), metadata: z.unknown().optional(), name: z.string().optional(), org: z.string().optional(), sandbox: z.string().optional() })]).optional(), // User (public ID or expanded object when loaded)
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)
572
639
  });
573
640
  /** Schema for a dataset metric field.
574
641
  */
@@ -593,7 +660,7 @@ Used by thread messages list endpoints.
593
660
  export const paginatedMessagesSchema = z.object({
594
661
  after_cursor: z.string().optional(), // Cursor for fetching items after this point
595
662
  before_cursor: z.string().optional(), // Cursor for fetching items before this point
596
- messages: z.array(z.unknown()), // List of message objects
663
+ messages: z.array(messageSchema), // List of message objects
597
664
  });
598
665
  /** Schema for an event catalog entry with full payload schema and sample.
599
666
  */
@@ -601,8 +668,8 @@ export const eventCatalogEntrySchema = z.object({
601
668
  description: z.string(), // Human-readable description
602
669
  name: z.string(), // Event name (e.g., thread.created)
603
670
  parent: z.string().optional(), // Parent envelope name (only present for sub_event entries)
604
- sample: z.unknown(), // Sample payload for this event
605
- schema: z.unknown(), // JSON Schema describing the event payload
671
+ sample: z.record(z.unknown()), // Sample payload for this event
672
+ schema: z.record(z.unknown()), // JSON Schema describing the event payload
606
673
  sub_events: z.array(z.string()).optional(), // Known sub-event types (only present for envelope entries)
607
674
  type: z.string().optional(), // Entry type: "event" for exact events, "envelope" for wildcard families
608
675
  });
@@ -613,10 +680,16 @@ export const domainEventSchema = z.object({
613
680
  event_name: z.string(), // Event name
614
681
  id: z.string(), // Domain event ID
615
682
  idempotency_key: z.string().optional(), // Idempotency key for the event
616
- payload: z.unknown(), // Event payload
683
+ payload: z.record(z.unknown()), // Event payload
617
684
  team: z.string().optional(), // Team identifier
618
685
  user: z.string().optional(), // User identifier
619
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
+ });
620
693
  /** List response for installations. */
621
694
  export const installationListResponseSchema = z.object({
622
695
  data: z.array(installationSchema), // List of installations
@@ -641,7 +714,7 @@ export const workerStatusSchema = z.object({
641
714
  /** API schema for authentication token responses. */
642
715
  export const authTokensSchema = z.object({
643
716
  expires_in: z.number().int(), // Token TTL in seconds
644
- metadata: z.unknown().optional(), // Additional metadata (e.g., onboarding_job_id)
717
+ metadata: z.record(z.unknown()).optional(), // Additional metadata (e.g., onboarding_job_id)
645
718
  refresh_token: z.string(), // Refresh token
646
719
  token: z.string(), // Access token (JWT)
647
720
  token_type: z.string(), // Token type (Bearer)
@@ -659,7 +732,7 @@ export const secretValueSchema = z.object({
659
732
  });
660
733
  /** A builtin tool catalog entry describing an available tool category. */
661
734
  export const builtinToolCatalogEntrySchema = z.object({
662
- config_schema: z.unknown().optional(), // JSON schema for tool configuration
735
+ config_schema: z.record(z.unknown()).optional(), // JSON schema for tool configuration
663
736
  description: z.string().optional(), // Tool description
664
737
  instruction: z.string().optional(), // Tool instruction
665
738
  key: z.string(), // Unique tool key
@@ -673,6 +746,7 @@ export const builtinToolCatalogEntrySchema = z.object({
673
746
  export const developerSchema = z.object({
674
747
  billing_provider_environment: z.string().optional(), // Stripe environment (live or test)
675
748
  billing_provider_id: z.string().optional(), // Stripe customer ID
749
+ plan: z.string().optional(), // Billing plan (e.g. paygo)
676
750
  });
677
751
  /** Schema for a task activity entry.
678
752
 
@@ -692,9 +766,9 @@ export const fileRefreshResultSchema = z.object({
692
766
  /** Schema for a dataset query result.
693
767
  */
694
768
  export const datasetQueryResultSchema = z.object({
695
- columns: z.array(z.unknown()), // Column definitions with name, type, and label
696
- meta: z.unknown(), // Query metadata (total_rows, query_time_ms)
697
- rows: z.array(z.unknown()), // Result rows as maps of column_name → value
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
698
772
  });
699
773
  /** Schema for an API call record.
700
774
 
@@ -710,13 +784,13 @@ export const apiCallSchema = z.object({
710
784
  id: z.string(), // Public ID (aac_...)
711
785
  ip_address: z.string().optional(), // Client IP address
712
786
  latency_ms: z.number().int(), // Latency in milliseconds
713
- metadata: z.unknown().optional(), // Additional metadata (e.g. integration_ids for webhooks)
787
+ metadata: z.record(z.unknown()).optional(), // Additional metadata (e.g. integration_ids for webhooks)
714
788
  method: z.string(), // HTTP method
715
789
  org: z.string().optional(), // Org if org-scoped
716
790
  path: z.string(), // Sanitized path with param placeholders
717
791
  query_string: z.string().optional(), // Query string
718
- request_body: z.unknown().optional(), // Request body payload (webhooks only)
719
- request_headers: z.unknown().optional(), // Request headers (webhooks only)
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)
720
794
  request_id: z.string().optional(), // Request ID from Plug.RequestId
721
795
  status_code: z.number().int(), // HTTP status code
722
796
  team: z.string().optional(), // Team if team-scoped
@@ -737,18 +811,18 @@ export const domainEventPageSchema = z.object({
737
811
  export const apiExplorerEndpointSchema = z.object({
738
812
  deprecated: z.boolean(), // Whether the route is deprecated
739
813
  description: z.string().optional(), // Endpoint description
740
- errors: z.array(z.unknown()), // Documented error responses
814
+ errors: z.array(z.record(z.unknown())), // Documented error responses
741
815
  method: z.string(), // HTTP method
742
- params: z.array(z.unknown()), // Documented params
816
+ params: z.array(z.record(z.unknown())), // Documented params
743
817
  path: z.string(), // Route path
744
- returns: z.unknown().optional(), // Return schema description
818
+ returns: z.record(z.unknown()).optional(), // Return schema description
745
819
  scope: z.string(), // Endpoint scope
746
820
  tags: z.array(z.string()), // Route tags
747
821
  });
748
822
  export const resolvedToolSchema = z.object({
749
823
  description: z.string().optional(), // What this tool does
750
824
  name: z.string(), // Callable tool function name
751
- parameters: z.unknown().optional(), // JSON Schema describing the expected input
825
+ parameters: z.record(z.unknown()).optional(), // JSON Schema describing the expected input
752
826
  });
753
827
  /** Schema for an encrypted secret payload. */
754
828
  export const encryptedSecretSchema = z.object({
@@ -757,7 +831,7 @@ export const encryptedSecretSchema = z.object({
757
831
  /** API schema for a custom object. */
758
832
  export const customObjectSchema = z.object({
759
833
  created_at: z.string().optional(), // Created timestamp
760
- fields: z.unknown().optional(), // Object field values
834
+ fields: z.record(z.unknown()).optional(), // Object field values
761
835
  id: z.string(), // Public ID (cobj_...)
762
836
  org: z.string().optional(), // Organization
763
837
  row_key: z.string().optional(), // Row key
@@ -775,8 +849,8 @@ Used by both Users.Tasks.Create and Teams.Tasks.Create actions.
775
849
  export const taskCreateParamsSchema = z.object({
776
850
  description: z.string().optional(), // Task description
777
851
  due_date: z.string().optional(), // Due date
778
- links: z.unknown().optional(), // Related links
779
- metadata: z.unknown().optional(), // Additional metadata
852
+ links: z.record(z.unknown()).optional(), // Related links
853
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
780
854
  name: z.string(), // Task name
781
855
  owner_persona: z.string().optional(), // Owner persona if assigned to agent
782
856
  owner_user: z.string().optional(), // Owner user if assigned to user
@@ -784,15 +858,22 @@ export const taskCreateParamsSchema = z.object({
784
858
  status: z.string().optional(), // Task status (open, in_progress, done)
785
859
  task: z.string().optional(), // Custom task ID (optional, auto-generated if not provided)
786
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
+ });
787
868
  /** API schema for an installation source. */
788
869
  export const installationSourceSchema = z.object({
789
870
  agent: z.string().optional(), // Owning agent
790
871
  context_installation: z.string().optional(), // Installation ID
791
872
  created_at: z.string().optional(), // Creation timestamp
792
873
  id: z.string(), // Source ID (cso_...)
793
- metadata: z.unknown().optional(), // Arbitrary metadata
874
+ metadata: z.record(z.unknown()).optional(), // Arbitrary metadata
794
875
  parent_source: z.string().optional(), // Parent source ID
795
- payload: z.unknown().optional(), // Source payload
876
+ payload: z.record(z.unknown()).optional(), // Source payload
796
877
  state: z.string().optional(), // Source state
797
878
  team: z.string().optional(), // Team ID
798
879
  thread: z.string().optional(), // Thread ID
@@ -813,19 +894,19 @@ export const taskSchema = z.object({
813
894
  comments_count: z.number().int().optional(), // Number of comments
814
895
  created_at: z.string().optional(), // Creation timestamp
815
896
  created_by: z.string().optional(), // Legacy creator
816
- created_by_actor: z.unknown().optional(), // Creator actor details
897
+ created_by_actor: z.record(z.unknown()).optional(), // Creator actor details
817
898
  created_by_persona: z.string().optional(), // Creator persona
818
899
  created_by_type: z.string().optional(), // Creator type (user, agent)
819
900
  created_by_user: z.string().optional(), // Creator user
820
901
  description: z.string().optional(), // Task description
821
902
  due_date: z.string().optional(), // Due date
822
903
  id: z.string(), // Task ID (tsk_...)
823
- links: z.unknown().optional(), // Related links
824
- metadata: z.unknown().optional(), // Additional metadata
904
+ links: z.record(z.unknown()).optional(), // Related links
905
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
825
906
  name: z.string(), // Task name
826
907
  org: z.string().optional(), // Organization
827
908
  owner: z.string().optional(), // Legacy owner
828
- owner_actor: z.unknown().optional(), // Owner actor details
909
+ owner_actor: z.record(z.unknown()).optional(), // Owner actor details
829
910
  owner_persona: z.string().optional(), // Owner persona
830
911
  owner_user: z.string().optional(), // Owner user
831
912
  priority: z.number().int().optional(), // Priority level (0-4)
@@ -877,10 +958,10 @@ export const contextSourceSchema = z.object({
877
958
  context_installation: z.string().optional(), // Associated installation
878
959
  created_at: z.string().optional(), // Created timestamp
879
960
  id: z.string(), // Public ID (cso_...)
880
- metadata: z.unknown().optional(), // Additional metadata
961
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
881
962
  org: z.string().optional(), // Owning organization
882
963
  parent_source: z.string().optional(), // Parent source
883
- payload: z.unknown().optional(), // Type-specific configuration
964
+ payload: z.record(z.unknown()).optional(), // Type-specific configuration
884
965
  sandbox: z.string().optional(), // Owning sandbox
885
966
  state: z.string(), // State: active or paused
886
967
  team: z.string().optional(), // Owning team
@@ -899,6 +980,10 @@ export const workingMemoryEntryListResponseSchema = z.object({
899
980
  total_entries: z.number().int().optional(), // Total number of entries
900
981
  total_pages: z.number().int().optional(), // Total number of pages
901
982
  });
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
+ });
902
987
  /** Integration fields for auto-creating the underlying integration.
903
988
 
904
989
  When creating an agent installation for an `integration/*` kind, callers
@@ -911,7 +996,7 @@ Required fields depend on the kind's auth type:
911
996
  export const integrationCreateParamsSchema = z.object({
912
997
  access_token: z.string().optional(), // OAuth access token or API key
913
998
  installation_id: z.string().optional(), // External installation ID (e.g. GitHub App installation ID, Slack team_id)
914
- metadata: z.unknown().optional(), // Provider-specific metadata (e.g. bot_user_id)
999
+ metadata: z.record(z.unknown()).optional(), // Provider-specific metadata (e.g. bot_user_id)
915
1000
  refresh_token: z.string().optional(), // OAuth refresh token
916
1001
  workspace_key: z.string().optional(), // Workspace name or identifier
917
1002
  });
@@ -932,7 +1017,7 @@ export const contextCredentialSchema = z.object({
932
1017
  /** API schema for the status/ping health check response. */
933
1018
  export const statusPingSchema = z.object({
934
1019
  success: z.boolean(), // Whether the ping succeeded
935
- token: z.unknown(), // Token status details
1020
+ token: z.record(z.unknown()), // Token status details
936
1021
  user: userSchema.optional(), // Authenticated user (if token is valid)
937
1022
  });
938
1023
  /** Schema for an OAuth provider configuration.
@@ -983,16 +1068,33 @@ export const knowledgeSearchResultSchema = z.object({
983
1068
  content_type: z.string().optional(), // Content MIME type
984
1069
  created_at: z.string().optional(), // Creation timestamp
985
1070
  id: z.string(), // Item ID (cim_...)
986
- metadata: z.unknown().optional(), // Additional metadata
987
- raw_content: z.unknown().optional(), // Raw content data
1071
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
1072
+ raw_content: z.record(z.unknown()).optional(), // Raw content data
988
1073
  type: z.string().optional(), // Source type (requires preloaded :source association)
989
1074
  });
990
1075
  /** Schema for org billing settings. */
991
1076
  export const billingSettingsOrgSchema = z.object({
992
1077
  billing_provider_environment: z.string().optional(), // Stripe environment (live or test)
993
1078
  billing_provider_id: z.string().optional(), // Stripe customer ID
1079
+ plan: z.string().optional(), // Billing plan (e.g. enterprise-pilot)
994
1080
  primary_user: z.string().optional(), // Org admin user who is the billing contact (public ID)
995
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
+ });
996
1098
  /** Schema for an integration provider entry.
997
1099
 
998
1100
  Represents an available integration provider (OAuth or MCP) that can be
@@ -1024,7 +1126,7 @@ export const developerOrgSchema = z.object({
1024
1126
  });
1025
1127
  /** API schema for a credential with decrypted secret values. */
1026
1128
  export const credentialWithSecretsSchema = z.object({
1027
- credential: z.unknown(), // The credential with decrypted values
1129
+ credential: z.record(z.unknown()), // The credential with decrypted values
1028
1130
  });
1029
1131
  /** API schema for a storage file. */
1030
1132
  export const storageFileSchema = z.object({
@@ -1032,17 +1134,26 @@ export const storageFileSchema = z.object({
1032
1134
  created_at: z.string().optional(), // Creation timestamp
1033
1135
  filename: z.string().optional(), // Original filename
1034
1136
  id: z.string(), // File ID
1035
- image_source: z.unknown().optional(), // Image source metadata
1137
+ image_source: imageSourceSchema.optional(), // Image source metadata
1036
1138
  org: z.string().optional(), // Organization
1037
1139
  sandbox: z.string().optional(), // Sandbox
1038
1140
  size: z.number().int().optional(), // File size in bytes
1039
1141
  updated_at: z.string().optional(), // Last update timestamp
1040
1142
  url: z.string().optional(), // Signed download URL
1041
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
+ });
1042
1153
  /** Schema for the API explorer response. */
1043
1154
  export const apiExplorerIndexSchema = z.object({
1044
1155
  data: z.array(apiExplorerEndpointSchema), // Documented API endpoints
1045
- schemas: z.unknown().optional(), // Collected schema definitions
1156
+ schemas: z.record(z.unknown()).optional(), // Collected schema definitions
1046
1157
  });
1047
1158
  /** Schema for an app slug mapping. */
1048
1159
  export const appSlugSchema = z.object({
@@ -1063,9 +1174,9 @@ export const contextItemSchema = z.object({
1063
1174
  created_at: z.string().optional(), // Created timestamp
1064
1175
  id: z.string(), // Public ID (cim_...)
1065
1176
  item_group: z.string().optional(), // Item group if part of a group
1066
- metadata: z.unknown().optional(), // Additional metadata
1177
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
1067
1178
  normalized_content: z.string().optional(), // Normalized content text
1068
- raw_content: z.unknown().optional(), // Raw content data
1179
+ raw_content: z.record(z.unknown()).optional(), // Raw content data
1069
1180
  source: z.string().optional(), // Source
1070
1181
  team: z.string().optional(), // Owning team
1071
1182
  updated_at: z.string().optional(), // Updated timestamp
@@ -1073,7 +1184,7 @@ export const contextItemSchema = z.object({
1073
1184
  });
1074
1185
  /** API schema for push notification test results. */
1075
1186
  export const pushNotificationResultSchema = z.object({
1076
- results: z.array(z.unknown()).optional(), // Per-device results
1187
+ results: z.array(z.record(z.unknown())).optional(), // Per-device results
1077
1188
  success: z.boolean(), // Whether the notification was sent
1078
1189
  total_sent: z.number().int().optional(), // Number of notifications sent
1079
1190
  });
@@ -1092,9 +1203,9 @@ export const oAuthClientSchema = z.object({
1092
1203
  /** Schema for integration action metadata. */
1093
1204
  export const integrationActionSchema = z.object({
1094
1205
  description: z.string().optional(), // Action description
1095
- json_schema: z.unknown(), // JSON Schema for action parameters
1206
+ json_schema: z.record(z.unknown()), // JSON Schema for action parameters
1096
1207
  key: z.string(), // Action key (e.g., gmail.list_messages)
1097
- scopes_any_of: z.unknown().optional(), // Required scope sets for this action
1208
+ scopes_any_of: z.record(z.unknown()).optional(), // Required scope sets for this action
1098
1209
  });
1099
1210
  /** Schema for app billing settings. */
1100
1211
  export const billingSettingsAppSchema = z.object({
@@ -1123,8 +1234,8 @@ All fields are optional since updates only modify provided fields.
1123
1234
  export const taskUpdateParamsSchema = z.object({
1124
1235
  description: z.string().optional(), // Task description
1125
1236
  due_date: z.string().optional(), // Due date
1126
- links: z.unknown().optional(), // Related links
1127
- metadata: z.unknown().optional(), // Additional metadata
1237
+ links: z.record(z.unknown()).optional(), // Related links
1238
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
1128
1239
  name: z.string().optional(), // Task name
1129
1240
  owner_persona: z.string().optional(), // Owner persona if assigned to agent
1130
1241
  owner_user: z.string().optional(), // Owner user if assigned to user
@@ -1144,7 +1255,7 @@ export const contextIntegrationSchema = z.object({
1144
1255
  id: z.string(), // Public ID (int_...)
1145
1256
  installation: z.string().optional(), // External installation (e.g. GitHub App installation)
1146
1257
  last_refreshed_at: z.string().optional(), // Last token refresh timestamp
1147
- metadata: z.unknown().optional(), // Additional metadata
1258
+ metadata: z.record(z.unknown()).optional(), // Additional metadata
1148
1259
  org: z.string().optional(), // Owning org
1149
1260
  provider: z.string(), // Provider name (e.g., google, github)
1150
1261
  scopes: z.array(z.string()).optional(), // OAuth scopes
@@ -1163,7 +1274,7 @@ export const scrapeSchema = z.object({
1163
1274
  image_url: z.string().optional(), // Image URL
1164
1275
  image_width: z.number().int().optional(), // Image width in pixels
1165
1276
  last_scraped_at: z.string().optional(), // Last scraped timestamp
1166
- metadata: z.unknown().optional(), // Scrape metadata
1277
+ metadata: z.record(z.unknown()).optional(), // Scrape metadata
1167
1278
  status: z.string().optional(), // Scrape status
1168
1279
  title: z.string().optional(), // Page title
1169
1280
  updated_at: z.string().optional(), // Last update timestamp
@@ -1177,6 +1288,10 @@ Used by both Users.Tasks.CreateComment and Teams.Tasks.CreateComment actions.
1177
1288
  export const commentCreateParamsSchema = z.object({
1178
1289
  body: z.string(), // Comment body text
1179
1290
  });
1291
+ /** List response for installation sources. */
1292
+ export const installationSourceListResponseSchema = z.object({
1293
+ data: z.array(installationSourceSchema), // List of installation sources
1294
+ });
1180
1295
  /** Schema for a user (developer admin view).
1181
1296
 
1182
1297
  Maps to serialized user output from developer portal API.