@agent-os-sdk/client 0.9.26 → 0.9.28

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 (209) hide show
  1. package/dist/client/AgentOsClient.d.ts +141 -0
  2. package/dist/client/AgentOsClient.d.ts.map +1 -0
  3. package/{src/client/AgentOsClient.ts → dist/client/AgentOsClient.js} +61 -105
  4. package/dist/client/HttpRequestBuilder.d.ts +50 -0
  5. package/dist/client/HttpRequestBuilder.d.ts.map +1 -0
  6. package/{src/client/HttpRequestBuilder.ts → dist/client/HttpRequestBuilder.js} +9 -41
  7. package/{src/client/OperationContext.ts → dist/client/OperationContext.d.ts} +6 -9
  8. package/dist/client/OperationContext.d.ts.map +1 -0
  9. package/dist/client/OperationContext.js +13 -0
  10. package/dist/client/OperationContextProvider.d.ts +54 -0
  11. package/dist/client/OperationContextProvider.d.ts.map +1 -0
  12. package/{src/client/OperationContextProvider.ts → dist/client/OperationContextProvider.js} +17 -35
  13. package/{src/client/auth.ts → dist/client/auth.d.ts} +29 -65
  14. package/dist/client/auth.d.ts.map +1 -0
  15. package/dist/client/auth.js +38 -0
  16. package/dist/client/config.d.ts +49 -0
  17. package/dist/client/config.d.ts.map +1 -0
  18. package/{src/client/config.ts → dist/client/config.js} +5 -43
  19. package/dist/client/helpers.d.ts +63 -0
  20. package/dist/client/helpers.d.ts.map +1 -0
  21. package/{src/client/helpers.ts → dist/client/helpers.js} +9 -52
  22. package/dist/client/pagination.d.ts +105 -0
  23. package/dist/client/pagination.d.ts.map +1 -0
  24. package/{src/client/pagination.ts → dist/client/pagination.js} +15 -116
  25. package/dist/client/raw.d.ts +277 -0
  26. package/dist/client/raw.d.ts.map +1 -0
  27. package/dist/client/raw.js +337 -0
  28. package/dist/client/retry.d.ts +37 -0
  29. package/dist/client/retry.d.ts.map +1 -0
  30. package/{src/client/retry.ts → dist/client/retry.js} +13 -55
  31. package/dist/client/sanitize.d.ts +19 -0
  32. package/dist/client/sanitize.d.ts.map +1 -0
  33. package/{src/client/sanitize.ts → dist/client/sanitize.js} +4 -7
  34. package/dist/client/timeout.d.ts +26 -0
  35. package/dist/client/timeout.d.ts.map +1 -0
  36. package/{src/client/timeout.ts → dist/client/timeout.js} +10 -18
  37. package/dist/errors/factory.d.ts +22 -0
  38. package/dist/errors/factory.d.ts.map +1 -0
  39. package/{src/errors/factory.ts → dist/errors/factory.js} +18 -57
  40. package/dist/errors/index.d.ts +210 -0
  41. package/dist/errors/index.d.ts.map +1 -0
  42. package/{src/errors/index.ts → dist/errors/index.js} +74 -156
  43. package/{src/generated/client.ts → dist/generated/client.d.ts} +5 -17
  44. package/dist/generated/client.d.ts.map +1 -0
  45. package/dist/generated/client.js +15 -0
  46. package/{src/generated/index.ts → dist/generated/index.d.ts} +1 -1
  47. package/dist/generated/index.d.ts.map +1 -0
  48. package/dist/generated/index.js +1 -0
  49. package/{src/generated/openapi.ts → dist/generated/openapi.d.ts} +1 -1
  50. package/dist/generated/openapi.d.ts.map +1 -0
  51. package/dist/generated/openapi.js +5 -0
  52. package/dist/index.d.ts +69 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/{src/index.ts → dist/index.js} +13 -63
  55. package/dist/modules/a2a.d.ts +48 -0
  56. package/dist/modules/a2a.d.ts.map +1 -0
  57. package/dist/modules/a2a.js +37 -0
  58. package/dist/modules/agents.d.ts +346 -0
  59. package/dist/modules/agents.d.ts.map +1 -0
  60. package/dist/modules/agents.js +296 -0
  61. package/dist/modules/apiTokens.d.ts +62 -0
  62. package/dist/modules/apiTokens.d.ts.map +1 -0
  63. package/dist/modules/apiTokens.js +56 -0
  64. package/dist/modules/approvals.d.ts +77 -0
  65. package/dist/modules/approvals.d.ts.map +1 -0
  66. package/dist/modules/approvals.js +91 -0
  67. package/dist/modules/audit.d.ts +78 -0
  68. package/dist/modules/audit.d.ts.map +1 -0
  69. package/{src/modules/audit.ts → dist/modules/audit.js} +23 -74
  70. package/{src/modules/auth.ts → dist/modules/auth.d.ts} +6 -11
  71. package/dist/modules/auth.d.ts.map +1 -0
  72. package/dist/modules/auth.js +22 -0
  73. package/dist/modules/builder.d.ts +242 -0
  74. package/dist/modules/builder.d.ts.map +1 -0
  75. package/dist/modules/builder.js +248 -0
  76. package/dist/modules/catalog.d.ts +142 -0
  77. package/dist/modules/catalog.d.ts.map +1 -0
  78. package/dist/modules/catalog.js +136 -0
  79. package/dist/modules/chatwoot.d.ts +59 -0
  80. package/dist/modules/chatwoot.d.ts.map +1 -0
  81. package/dist/modules/chatwoot.js +200 -0
  82. package/dist/modules/checkpoints.d.ts +62 -0
  83. package/dist/modules/checkpoints.d.ts.map +1 -0
  84. package/dist/modules/checkpoints.js +48 -0
  85. package/dist/modules/contracts.d.ts +48 -0
  86. package/dist/modules/contracts.d.ts.map +1 -0
  87. package/dist/modules/contracts.js +25 -0
  88. package/dist/modules/credentials.d.ts +105 -0
  89. package/dist/modules/credentials.d.ts.map +1 -0
  90. package/dist/modules/credentials.js +135 -0
  91. package/dist/modules/crons.d.ts +73 -0
  92. package/dist/modules/crons.d.ts.map +1 -0
  93. package/dist/modules/crons.js +67 -0
  94. package/dist/modules/datasets.d.ts +80 -0
  95. package/dist/modules/datasets.d.ts.map +1 -0
  96. package/dist/modules/datasets.js +91 -0
  97. package/{src/modules/evaluation.ts → dist/modules/evaluation.d.ts} +23 -109
  98. package/dist/modules/evaluation.d.ts.map +1 -0
  99. package/dist/modules/evaluation.js +108 -0
  100. package/dist/modules/files.d.ts +89 -0
  101. package/dist/modules/files.d.ts.map +1 -0
  102. package/dist/modules/files.js +133 -0
  103. package/dist/modules/graphs.d.ts +120 -0
  104. package/dist/modules/graphs.d.ts.map +1 -0
  105. package/dist/modules/graphs.js +69 -0
  106. package/{src/modules/improvements.ts → dist/modules/improvements.d.ts} +8 -27
  107. package/dist/modules/improvements.d.ts.map +1 -0
  108. package/dist/modules/improvements.js +27 -0
  109. package/dist/modules/info.d.ts +76 -0
  110. package/dist/modules/info.d.ts.map +1 -0
  111. package/{src/modules/info.ts → dist/modules/info.js} +16 -66
  112. package/dist/modules/knowledge.d.ts +91 -0
  113. package/dist/modules/knowledge.d.ts.map +1 -0
  114. package/dist/modules/knowledge.js +80 -0
  115. package/{src/modules/me.ts → dist/modules/me.d.ts} +7 -23
  116. package/dist/modules/me.d.ts.map +1 -0
  117. package/dist/modules/me.js +28 -0
  118. package/dist/modules/members.d.ts +124 -0
  119. package/dist/modules/members.d.ts.map +1 -0
  120. package/dist/modules/members.js +142 -0
  121. package/dist/modules/memberships.d.ts +25 -0
  122. package/dist/modules/memberships.d.ts.map +1 -0
  123. package/dist/modules/memberships.js +20 -0
  124. package/{src/modules/metaAgent.ts → dist/modules/metaAgent.d.ts} +8 -44
  125. package/dist/modules/metaAgent.d.ts.map +1 -0
  126. package/dist/modules/metaAgent.js +32 -0
  127. package/dist/modules/metrics.d.ts +20 -0
  128. package/dist/modules/metrics.d.ts.map +1 -0
  129. package/{src/modules/metrics.ts → dist/modules/metrics.js} +7 -14
  130. package/dist/modules/observability.d.ts +19 -0
  131. package/dist/modules/observability.d.ts.map +1 -0
  132. package/dist/modules/observability.js +14 -0
  133. package/dist/modules/playground.d.ts +42 -0
  134. package/dist/modules/playground.d.ts.map +1 -0
  135. package/dist/modules/playground.js +48 -0
  136. package/dist/modules/presets.d.ts +32 -0
  137. package/dist/modules/presets.d.ts.map +1 -0
  138. package/dist/modules/presets.js +199 -0
  139. package/dist/modules/prompts.d.ts +87 -0
  140. package/dist/modules/prompts.d.ts.map +1 -0
  141. package/dist/modules/prompts.js +87 -0
  142. package/dist/modules/roles.d.ts +64 -0
  143. package/dist/modules/roles.d.ts.map +1 -0
  144. package/dist/modules/roles.js +79 -0
  145. package/dist/modules/runs.d.ts +451 -0
  146. package/dist/modules/runs.d.ts.map +1 -0
  147. package/{src/modules/runs.ts → dist/modules/runs.js} +96 -438
  148. package/dist/modules/store.d.ts +37 -0
  149. package/dist/modules/store.d.ts.map +1 -0
  150. package/dist/modules/store.js +48 -0
  151. package/{src/modules/templates.ts → dist/modules/templates.d.ts} +8 -32
  152. package/dist/modules/templates.d.ts.map +1 -0
  153. package/dist/modules/templates.js +26 -0
  154. package/dist/modules/tenants.d.ts +49 -0
  155. package/dist/modules/tenants.d.ts.map +1 -0
  156. package/dist/modules/tenants.js +56 -0
  157. package/dist/modules/threads.d.ts +205 -0
  158. package/dist/modules/threads.d.ts.map +1 -0
  159. package/dist/modules/threads.js +225 -0
  160. package/dist/modules/tools.d.ts +62 -0
  161. package/dist/modules/tools.d.ts.map +1 -0
  162. package/dist/modules/tools.js +45 -0
  163. package/dist/modules/traces.d.ts +89 -0
  164. package/dist/modules/traces.d.ts.map +1 -0
  165. package/dist/modules/traces.js +65 -0
  166. package/{src/modules/triggers.ts → dist/modules/triggers.d.ts} +24 -153
  167. package/dist/modules/triggers.d.ts.map +1 -0
  168. package/dist/modules/triggers.js +176 -0
  169. package/{src/modules/usage.ts → dist/modules/usage.d.ts} +14 -46
  170. package/dist/modules/usage.d.ts.map +1 -0
  171. package/dist/modules/usage.js +43 -0
  172. package/dist/modules/vectorStores.d.ts +100 -0
  173. package/dist/modules/vectorStores.d.ts.map +1 -0
  174. package/dist/modules/vectorStores.js +159 -0
  175. package/dist/modules/workspaces.d.ts +138 -0
  176. package/dist/modules/workspaces.d.ts.map +1 -0
  177. package/dist/modules/workspaces.js +121 -0
  178. package/dist/sse/client.d.ts +140 -0
  179. package/dist/sse/client.d.ts.map +1 -0
  180. package/{src/sse/client.ts → dist/sse/client.js} +24 -100
  181. package/package.json +8 -15
  182. package/src/client/raw.ts +0 -609
  183. package/src/generated/swagger.json +0 -17014
  184. package/src/modules/a2a.ts +0 -64
  185. package/src/modules/agents.ts +0 -604
  186. package/src/modules/apiTokens.ts +0 -101
  187. package/src/modules/approvals.ts +0 -151
  188. package/src/modules/catalog.ts +0 -241
  189. package/src/modules/chatwoot.ts +0 -242
  190. package/src/modules/checkpoints.ts +0 -87
  191. package/src/modules/contracts.ts +0 -80
  192. package/src/modules/credentials.ts +0 -216
  193. package/src/modules/crons.ts +0 -115
  194. package/src/modules/datasets.ts +0 -142
  195. package/src/modules/files.ts +0 -208
  196. package/src/modules/members.ts +0 -199
  197. package/src/modules/memberships.ts +0 -42
  198. package/src/modules/observability.ts +0 -28
  199. package/src/modules/playground.ts +0 -68
  200. package/src/modules/presets.ts +0 -246
  201. package/src/modules/prompts.ts +0 -147
  202. package/src/modules/roles.ts +0 -112
  203. package/src/modules/store.ts +0 -65
  204. package/src/modules/tenants.ts +0 -79
  205. package/src/modules/threads.ts +0 -343
  206. package/src/modules/tools.ts +0 -91
  207. package/src/modules/traces.ts +0 -133
  208. package/src/modules/vectorStores.ts +0 -257
  209. package/src/modules/workspaces.ts +0 -216
@@ -0,0 +1,296 @@
1
+ /**
2
+ * Agents Module - Fully Typed
3
+ *
4
+ * Naming conventions:
5
+ * - get* for singular items: getAgent(id)
6
+ * - list* for collections: listAgents()
7
+ * - create*, update*, delete* for mutations
8
+ */
9
+ export class AgentsModule {
10
+ client;
11
+ headers;
12
+ constructor(client, headers) {
13
+ this.client = client;
14
+ this.headers = headers;
15
+ }
16
+ // ======================== CRUD ========================
17
+ /**
18
+ * List all agents in the workspace.
19
+ * @example
20
+ * ```ts
21
+ * const { data } = await client.agents.list({ limit: 10 });
22
+ * data?.items.forEach(agent => console.log(agent.name));
23
+ * ```
24
+ */
25
+ async list(params) {
26
+ return this.client.GET("/v1/api/agents", {
27
+ params: { query: params },
28
+ headers: this.headers(),
29
+ });
30
+ }
31
+ /**
32
+ * Get a single agent by ID.
33
+ * @example
34
+ * ```ts
35
+ * const { data: agent } = await client.agents.get("agent-uuid");
36
+ * ```
37
+ */
38
+ async get(agentId) {
39
+ return this.client.GET("/v1/api/agents/{agentId}", {
40
+ params: { path: { agentId } },
41
+ headers: this.headers(),
42
+ });
43
+ }
44
+ /**
45
+ * Create a new agent.
46
+ * Backend only accepts `name` per CreateAgentRequest DTO.
47
+ * @example
48
+ * ```ts
49
+ * const { data: agent } = await client.agents.create({ name: "My Agent" });
50
+ *
51
+ * // With idempotency (safe to retry)
52
+ * const { data: agent } = await client.agents.create({
53
+ * name: "My Agent",
54
+ * idempotency_key: "unique-key"
55
+ * });
56
+ * ```
57
+ */
58
+ async create(body) {
59
+ const headers = { ...this.headers() };
60
+ if (body.idempotency_key) {
61
+ headers["X-Idempotency-Key"] = body.idempotency_key;
62
+ }
63
+ return this.client.POST("/v1/api/agents", {
64
+ body: {
65
+ name: body.name,
66
+ metadata: body.metadata
67
+ },
68
+ headers,
69
+ });
70
+ }
71
+ /**
72
+ * Update an existing agent.
73
+ * Uses PATCH per backend AgentsController.
74
+ */
75
+ async update(agentId, body) {
76
+ return this.client.PATCH("/v1/api/agents/{id}", {
77
+ params: { path: { id: agentId } },
78
+ body,
79
+ headers: this.headers(),
80
+ });
81
+ }
82
+ /**
83
+ * Delete an agent.
84
+ */
85
+ async delete(agentId) {
86
+ return this.client.DELETE("/v1/api/agents/{agentId}", {
87
+ params: { path: { agentId } },
88
+ headers: this.headers(),
89
+ });
90
+ }
91
+ // ======================== Runtime Contexts ========================
92
+ /**
93
+ * List current runtime contexts for an agent.
94
+ */
95
+ async listRuntimeContexts(agentId) {
96
+ return this.client.GET("/v1/api/agents/{agentId}/runtime-contexts", {
97
+ params: { path: { agentId } },
98
+ headers: this.headers(),
99
+ });
100
+ }
101
+ /**
102
+ * Get the current runtime context for a given key.
103
+ */
104
+ async getRuntimeContext(agentId, contextKey) {
105
+ return this.client.GET("/v1/api/agents/{agentId}/runtime-contexts/{contextKey}", {
106
+ params: { path: { agentId, contextKey } },
107
+ headers: this.headers(),
108
+ });
109
+ }
110
+ /**
111
+ * Create or update the current runtime context for a given key.
112
+ */
113
+ async upsertRuntimeContext(agentId, contextKey, body) {
114
+ return this.client.PUT("/v1/api/agents/{agentId}/runtime-contexts/{contextKey}", {
115
+ params: { path: { agentId, contextKey } },
116
+ body: {
117
+ content: body.content,
118
+ source: body.source ?? null,
119
+ },
120
+ headers: this.headers(),
121
+ });
122
+ }
123
+ // ======================== Portability ========================
124
+ /**
125
+ * Export an agent as a JSON bundle.
126
+ */
127
+ async export(agentId) {
128
+ return this.client.GET("/v1/api/agents/{id}/export", {
129
+ params: { path: { id: agentId } },
130
+ headers: this.headers(),
131
+ });
132
+ }
133
+ /**
134
+ * Import an agent bundle.
135
+ */
136
+ async import(bundle) {
137
+ return this.client.POST("/v1/api/agents/import", {
138
+ body: bundle,
139
+ headers: this.headers(),
140
+ });
141
+ }
142
+ // ======================== Graph ========================
143
+ /**
144
+ * Get the graph for an agent (Mermaid or JSON).
145
+ */
146
+ async getGraph(agentId, format) {
147
+ return this.client.GET("/v1/api/agents/{agentId}/graph", {
148
+ params: { path: { agentId }, query: { format } },
149
+ headers: this.headers(),
150
+ });
151
+ }
152
+ /** Alias for getGraph (convenience) */
153
+ graph = (agentId, format) => this.getGraph(agentId, format);
154
+ /**
155
+ * Validate the graph configuration.
156
+ */
157
+ async validateGraph(agentId) {
158
+ return this.client.POST("/v1/api/agents/{agentId}/graph/validate", {
159
+ params: { path: { agentId } },
160
+ headers: this.headers(),
161
+ });
162
+ }
163
+ async getPublishPreview(agentId, irJson) {
164
+ if (irJson) {
165
+ return this.client.POST("/v1/api/agents/{id}/publish-preview", {
166
+ params: { path: { id: agentId } },
167
+ body: { ir_json: irJson },
168
+ headers: this.headers(),
169
+ });
170
+ }
171
+ return this.client.GET("/v1/api/agents/{id}/publish-preview", {
172
+ params: { path: { id: agentId } },
173
+ headers: this.headers(),
174
+ });
175
+ }
176
+ // ======================== Draft IR ========================
177
+ async getDraftIr(agentId) {
178
+ return this.client.GET("/v1/api/agents/{id}/draft/ir", {
179
+ params: { path: { id: agentId } },
180
+ headers: this.headers(),
181
+ });
182
+ }
183
+ async updateDraftIr(agentId, irJson, options) {
184
+ const headers = { ...this.headers() };
185
+ if (options?.if_match) {
186
+ headers["If-Match"] = options.if_match;
187
+ }
188
+ const response = await this.client.PUT("/v1/api/agents/{id}/draft/ir", {
189
+ params: { path: { id: agentId } },
190
+ body: {
191
+ ir_json: irJson,
192
+ },
193
+ headers,
194
+ });
195
+ const unwrapped = response.data &&
196
+ typeof response.data === "object" &&
197
+ "data" in response.data &&
198
+ typeof response.data.data === "object"
199
+ ? (response.data.data ?? undefined)
200
+ : response.data;
201
+ return {
202
+ ...response,
203
+ data: unwrapped,
204
+ };
205
+ }
206
+ // ======================== Publishing ========================
207
+ /**
208
+ * Publish the committed agent artifact pointed to by the current authoring revision.
209
+ * The client does not send authoring JSON anymore.
210
+ * @param agentId The agent UUID
211
+ * @param options Optional settings: version_label for tagging, set_as_live to make this the active version, idempotency_key for safe retries
212
+ * @returns Bundle response with version details
213
+ * @example
214
+ * ```ts
215
+ * const { data: bundle } = await client.agents.publish(agentId, {
216
+ * idempotency_key: "publish-unique-key"
217
+ * });
218
+ * ```
219
+ */
220
+ async publish(agentId, options) {
221
+ const headers = { ...this.headers() };
222
+ if (options?.idempotency_key) {
223
+ headers["X-Idempotency-Key"] = options.idempotency_key;
224
+ }
225
+ return this.client.POST("/v1/api/agents/{id}/publish", {
226
+ params: { path: { id: agentId } },
227
+ body: {
228
+ version_label: options?.version_label ?? null,
229
+ set_as_live: options?.set_as_live ?? true,
230
+ required_tools: options?.required_tools ?? []
231
+ },
232
+ headers
233
+ });
234
+ }
235
+ async listPublishes(agentId) {
236
+ return this.client.GET("/v1/api/agents/{id}/publishes", {
237
+ params: { path: { id: agentId } },
238
+ headers: this.headers(),
239
+ });
240
+ }
241
+ async rollback(agentId, body) {
242
+ return this.client.POST("/v1/api/agents/{id}/rollback", {
243
+ params: { path: { id: agentId } },
244
+ body,
245
+ headers: this.headers(),
246
+ });
247
+ }
248
+ // ======================== Bundles ========================
249
+ /**
250
+ * Get the manifest for a specific bundle.
251
+ * Returns artifact metadata only.
252
+ * @example
253
+ * ```ts
254
+ * const { data } = await client.agents.getBundleManifest(agentId, bundleId);
255
+ * console.log(data?.artifact_hash);
256
+ * ```
257
+ */
258
+ async getBundleManifest(agentId, bundleId) {
259
+ return this.client.GET("/v1/api/agents/{agentId}/bundles/{bundleId}/manifest", {
260
+ params: { path: { agentId, bundleId } },
261
+ headers: this.headers(),
262
+ });
263
+ }
264
+ /**
265
+ * Get Mermaid diagram for a specific bundle graph.
266
+ */
267
+ async getBundleMermaid(agentId, bundleId) {
268
+ return this.client.GET("/v1/api/agents/{agentId}/bundles/{bundleId}/graph/mermaid", {
269
+ params: { path: { agentId, bundleId } },
270
+ headers: this.headers(),
271
+ });
272
+ }
273
+ /**
274
+ * Creates or updates an agent credential binding by binding key.
275
+ */
276
+ async upsertCredentialBinding(agentId, body) {
277
+ return this.client.POST("/v1/api/agents/{id}/credential-bindings", {
278
+ params: { path: { id: agentId } },
279
+ body: {
280
+ credential_instance_ref: body.credential_instance_ref,
281
+ binding_key: body.binding_key,
282
+ priority: body.priority ?? 0,
283
+ },
284
+ headers: this.headers(),
285
+ });
286
+ }
287
+ /**
288
+ * Lists credential bindings for an agent.
289
+ */
290
+ async listCredentialBindings(agentId) {
291
+ return this.client.GET("/v1/api/agents/{id}/credential-bindings", {
292
+ params: { path: { id: agentId } },
293
+ headers: this.headers(),
294
+ });
295
+ }
296
+ }
@@ -0,0 +1,62 @@
1
+ import type { APIResponse, RawClient } from "../client/raw.js";
2
+ export interface ApiToken {
3
+ id: string;
4
+ name: string;
5
+ token_prefix: string;
6
+ scopes: string[];
7
+ created_at: string;
8
+ expires_at?: string | null;
9
+ last_used_at?: string | null;
10
+ }
11
+ export interface ApiTokenSecret extends ApiToken {
12
+ token: string;
13
+ workspace_id: string;
14
+ }
15
+ export interface CreateTokenRequest {
16
+ name: string;
17
+ scopes?: string[];
18
+ expires_at?: string | null;
19
+ environment?: "live" | "test";
20
+ }
21
+ export interface RotateTokenResponse extends ApiTokenSecret {
22
+ rotated_from: string;
23
+ }
24
+ export interface ScopeInfo {
25
+ key: string;
26
+ description: string;
27
+ }
28
+ export interface ScopeListResponse {
29
+ scopes: ScopeInfo[];
30
+ }
31
+ export declare class ApiTokensModule {
32
+ private client;
33
+ constructor(client: RawClient);
34
+ private headers;
35
+ /**
36
+ * List all API tokens for the current workspace.
37
+ */
38
+ list(): Promise<APIResponse<{
39
+ tokens: ApiToken[];
40
+ }>>;
41
+ /**
42
+ * Create a new API token.
43
+ * The full token secret is only returned in this response.
44
+ */
45
+ create(body: CreateTokenRequest): Promise<APIResponse<ApiTokenSecret>>;
46
+ /**
47
+ * List all available scopes.
48
+ */
49
+ listScopes(): Promise<APIResponse<ScopeListResponse>>;
50
+ /**
51
+ * Revoke an API token immediately.
52
+ */
53
+ revoke(id: string): Promise<APIResponse<{
54
+ message: string;
55
+ }>>;
56
+ /**
57
+ * Rotate a token (revoke old, create new).
58
+ * Returns the new token secret.
59
+ */
60
+ rotate(id: string): Promise<APIResponse<RotateTokenResponse>>;
61
+ }
62
+ //# sourceMappingURL=apiTokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiTokens.d.ts","sourceRoot":"","sources":["../../src/modules/apiTokens.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACvD,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,SAAS,EAAE,CAAC;CACvB;AAED,qBAAa,eAAe;IACxB,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B,OAAO,CAAC,OAAO;IAMf;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;QAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;KAAE,CAAC,CAAC;IAM1D;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAO5E;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAM3D;;OAEG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAOnE;;;OAGG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;CAMtE"}
@@ -0,0 +1,56 @@
1
+ export class ApiTokensModule {
2
+ client;
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ headers() {
7
+ return {
8
+ "Content-Type": "application/json",
9
+ };
10
+ }
11
+ /**
12
+ * List all API tokens for the current workspace.
13
+ */
14
+ async list() {
15
+ return this.client.GET("/v1/api/tokens", {
16
+ headers: this.headers(),
17
+ });
18
+ }
19
+ /**
20
+ * Create a new API token.
21
+ * The full token secret is only returned in this response.
22
+ */
23
+ async create(body) {
24
+ return this.client.POST("/v1/api/tokens", {
25
+ body,
26
+ headers: this.headers(),
27
+ });
28
+ }
29
+ /**
30
+ * List all available scopes.
31
+ */
32
+ async listScopes() {
33
+ return this.client.GET("/v1/api/tokens/available-scopes", {
34
+ headers: this.headers(),
35
+ });
36
+ }
37
+ /**
38
+ * Revoke an API token immediately.
39
+ */
40
+ async revoke(id) {
41
+ return this.client.DELETE("/v1/api/tokens/{id}", {
42
+ params: { path: { id } },
43
+ headers: this.headers(),
44
+ });
45
+ }
46
+ /**
47
+ * Rotate a token (revoke old, create new).
48
+ * Returns the new token secret.
49
+ */
50
+ async rotate(id) {
51
+ return this.client.POST("/v1/api/tokens/{id}/rotate", {
52
+ params: { path: { id } },
53
+ headers: this.headers(),
54
+ });
55
+ }
56
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Approvals Module - Human-in-the-Loop Native
3
+ *
4
+ * Wave 2.x: Real implementation for HITL workflow.
5
+ * Endpoints: /v1/api/workspaces/{workspaceId}/approvals
6
+ */
7
+ import type { RawClient, APIResponse } from "../client/raw.js";
8
+ export type ApprovalStatus = "pending" | "approved" | "denied" | "expired";
9
+ export interface Approval {
10
+ id: string;
11
+ run_id: string;
12
+ attempt_id: string;
13
+ policy_name: string;
14
+ reason: string;
15
+ status: ApprovalStatus;
16
+ created_at: string;
17
+ expires_at?: string;
18
+ decided_at?: string;
19
+ decided_by_actor?: string;
20
+ payload?: Record<string, unknown>;
21
+ }
22
+ export interface ApprovalDecision {
23
+ decision: "approve" | "deny";
24
+ comment?: string;
25
+ }
26
+ export interface ApprovalListResponse {
27
+ items: Approval[];
28
+ total: number;
29
+ }
30
+ export interface ApprovalStatusResponse {
31
+ id: string;
32
+ status: ApprovalStatus;
33
+ expires_at?: string;
34
+ decided_at?: string;
35
+ decided_by_actor?: string;
36
+ decision_comment?: string;
37
+ }
38
+ export declare class ApprovalsModule {
39
+ private client;
40
+ private headers;
41
+ constructor(client: RawClient, headers: () => Record<string, string>);
42
+ /**
43
+ * List approvals for a workspace.
44
+ * @param workspaceId - Workspace ID
45
+ * @param params - Filter options
46
+ */
47
+ list(workspaceId: string, params?: {
48
+ status?: ApprovalStatus;
49
+ limit?: number;
50
+ }): Promise<APIResponse<ApprovalListResponse>>;
51
+ /**
52
+ * Get a specific approval by ID.
53
+ * @param workspaceId - Workspace ID
54
+ * @param approvalId - Approval ID
55
+ */
56
+ get(workspaceId: string, approvalId: string): Promise<APIResponse<Approval>>;
57
+ /**
58
+ * Approve an approval request.
59
+ * @param workspaceId - Workspace ID
60
+ * @param approvalId - Approval ID
61
+ * @param comment - Optional reason for approval
62
+ */
63
+ approve(workspaceId: string, approvalId: string, comment?: string): Promise<APIResponse<ApprovalStatusResponse>>;
64
+ /**
65
+ * Deny an approval request.
66
+ * @param workspaceId - Workspace ID
67
+ * @param approvalId - Approval ID
68
+ * @param comment - Optional reason for denial
69
+ */
70
+ deny(workspaceId: string, approvalId: string, comment?: string): Promise<APIResponse<ApprovalStatusResponse>>;
71
+ /**
72
+ * Shorthand: List pending approvals for a workspace.
73
+ */
74
+ listPending(workspaceId: string, limit?: number): Promise<APIResponse<ApprovalListResponse>>;
75
+ reject: (workspaceId: string, approvalId: string, comment?: string) => Promise<APIResponse<ApprovalStatusResponse>>;
76
+ }
77
+ //# sourceMappingURL=approvals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../src/modules/approvals.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/D,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3E,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MA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AC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAgBtH;;;;;OAKG;IACG,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAgBnH;;OAEG;IACG,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAK9F,MAAM,gBAxBkB,MAAM,cAAc,MAAM,YAAY,MAAM,KAAG,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAwBhG;CACtB"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Approvals Module - Human-in-the-Loop Native
3
+ *
4
+ * Wave 2.x: Real implementation for HITL workflow.
5
+ * Endpoints: /v1/api/workspaces/{workspaceId}/approvals
6
+ */
7
+ // ============================================================================
8
+ // Module
9
+ // ============================================================================
10
+ export class ApprovalsModule {
11
+ client;
12
+ headers;
13
+ constructor(client, headers) {
14
+ this.client = client;
15
+ this.headers = headers;
16
+ }
17
+ /**
18
+ * List approvals for a workspace.
19
+ * @param workspaceId - Workspace ID
20
+ * @param params - Filter options
21
+ */
22
+ async list(workspaceId, params) {
23
+ return this.client.GET("/v1/api/workspaces/{workspaceId}/approvals", {
24
+ params: {
25
+ path: { workspaceId },
26
+ query: {
27
+ status: params?.status,
28
+ limit: params?.limit ?? 50
29
+ }
30
+ },
31
+ headers: this.headers(),
32
+ });
33
+ }
34
+ /**
35
+ * Get a specific approval by ID.
36
+ * @param workspaceId - Workspace ID
37
+ * @param approvalId - Approval ID
38
+ */
39
+ async get(workspaceId, approvalId) {
40
+ return this.client.GET("/v1/api/workspaces/{workspaceId}/approvals/{approvalId}", {
41
+ params: {
42
+ path: { workspaceId, approvalId }
43
+ },
44
+ headers: this.headers(),
45
+ });
46
+ }
47
+ /**
48
+ * Approve an approval request.
49
+ * @param workspaceId - Workspace ID
50
+ * @param approvalId - Approval ID
51
+ * @param comment - Optional reason for approval
52
+ */
53
+ async approve(workspaceId, approvalId, comment) {
54
+ return this.client.POST("/v1/api/workspaces/{workspaceId}/approvals/{approvalId}/decision", {
55
+ params: {
56
+ path: { workspaceId, approvalId }
57
+ },
58
+ body: {
59
+ decision: "approve",
60
+ comment
61
+ },
62
+ headers: this.headers(),
63
+ });
64
+ }
65
+ /**
66
+ * Deny an approval request.
67
+ * @param workspaceId - Workspace ID
68
+ * @param approvalId - Approval ID
69
+ * @param comment - Optional reason for denial
70
+ */
71
+ async deny(workspaceId, approvalId, comment) {
72
+ return this.client.POST("/v1/api/workspaces/{workspaceId}/approvals/{approvalId}/decision", {
73
+ params: {
74
+ path: { workspaceId, approvalId }
75
+ },
76
+ body: {
77
+ decision: "deny",
78
+ comment
79
+ },
80
+ headers: this.headers(),
81
+ });
82
+ }
83
+ /**
84
+ * Shorthand: List pending approvals for a workspace.
85
+ */
86
+ async listPending(workspaceId, limit = 50) {
87
+ return this.list(workspaceId, { status: "pending", limit });
88
+ }
89
+ // Convenience aliases
90
+ reject = this.deny;
91
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Audit Module - Fully Typed
3
+ */
4
+ import type { RawClient, APIResponse } from "../client/raw.js";
5
+ export interface AuditLogEntry {
6
+ id: string;
7
+ tenant_id: string;
8
+ workspace_id?: string;
9
+ actor: string;
10
+ actor_type: "user" | "system" | "api_token";
11
+ action: string;
12
+ resource: string;
13
+ resource_id?: string;
14
+ metadata?: Record<string, unknown>;
15
+ ip_address?: string;
16
+ user_agent?: string;
17
+ created_at: string;
18
+ }
19
+ export interface AuditListResponse {
20
+ items: AuditLogEntry[];
21
+ total: number;
22
+ }
23
+ export declare class AuditModule {
24
+ private client;
25
+ private headers;
26
+ constructor(client: RawClient, headers: () => Record<string, string>);
27
+ /**
28
+ * List audit log entries.
29
+ */
30
+ list(params?: {
31
+ actor?: string;
32
+ action?: string;
33
+ resource?: string;
34
+ workspace_id?: string;
35
+ from?: string;
36
+ to?: string;
37
+ limit?: number;
38
+ offset?: number;
39
+ }): Promise<APIResponse<AuditListResponse>>;
40
+ /**
41
+ * Get a specific audit log entry.
42
+ */
43
+ get(auditId: string): Promise<APIResponse<AuditLogEntry>>;
44
+ /**
45
+ * Search audit logs by action pattern.
46
+ */
47
+ search(params?: {
48
+ query?: string;
49
+ from?: string;
50
+ to?: string;
51
+ limit?: number;
52
+ offset?: number;
53
+ }): Promise<APIResponse<AuditListResponse>>;
54
+ /**
55
+ * Iterate through all audit logs with automatic pagination.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * // Get all audit logs for a specific action
60
+ * for await (const entry of client.audit.iterate({ action: "agent.created" })) {
61
+ * console.log(entry.actor, entry.action);
62
+ * }
63
+ * ```
64
+ */
65
+ iterate(filters?: {
66
+ actor?: string;
67
+ action?: string;
68
+ resource?: string;
69
+ workspace_id?: string;
70
+ from?: string;
71
+ to?: string;
72
+ }, options?: {
73
+ pageSize?: number;
74
+ maxItems?: number;
75
+ signal?: AbortSignal;
76
+ }): AsyncGenerator<AuditLogEntry, void, unknown>;
77
+ }
78
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/modules/audit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC5C,MAAM,EAAE,MAAM,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