@agent-os-sdk/client 0.9.26 → 0.9.27

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 +75 -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
@@ -1,79 +0,0 @@
1
- /**
2
- * Tenants Module - Fully Typed
3
- */
4
-
5
- import type { RawClient, APIResponse, components } from "../client/raw.js";
6
-
7
- type UpdateTenantRequest = components["schemas"]["UpdateTenantRequest"];
8
-
9
- export interface Tenant {
10
- id: string;
11
- name: string;
12
- slug: string;
13
- owner_id?: string;
14
- settings?: Record<string, unknown>;
15
- created_at: string;
16
- updated_at: string;
17
- }
18
-
19
- export interface TenantListResponse {
20
- items: Tenant[];
21
- total: number;
22
- }
23
-
24
- export class TenantsModule {
25
- constructor(private client: RawClient, private headers: () => Record<string, string>) { }
26
-
27
- /**
28
- * List all tenants the user has access to.
29
- */
30
- /**
31
- * List all tenants the user has access to.
32
- */
33
- async list(): Promise<APIResponse<TenantListResponse>> {
34
- return this.client.GET<TenantListResponse>("/v1/api/tenants", {
35
- headers: this.headers(),
36
- });
37
- }
38
-
39
- /**
40
- * Get the current tenant.
41
- */
42
- async get(): Promise<APIResponse<Tenant>> {
43
- return this.client.GET<Tenant>("/v1/api/tenants/current", {
44
- headers: this.headers(),
45
- });
46
- }
47
-
48
- /**
49
- * Update the current tenant.
50
- */
51
- async update(body: {
52
- name?: string;
53
- slug?: string;
54
- }): Promise<APIResponse<Tenant>> {
55
- return this.client.PUT<Tenant>("/v1/api/tenants/current", {
56
- body,
57
- headers: this.headers(),
58
- });
59
- }
60
-
61
- /**
62
- * Get tenant settings.
63
- */
64
- async getSettings(): Promise<APIResponse<Record<string, unknown>>> {
65
- return this.client.GET<Record<string, unknown>>("/v1/api/tenants/current/settings", {
66
- headers: this.headers(),
67
- });
68
- }
69
-
70
- /**
71
- * Update tenant settings.
72
- */
73
- async updateSettings(settings: Record<string, unknown>): Promise<APIResponse<void>> {
74
- return this.client.PUT<void>("/v1/api/tenants/current/settings", {
75
- body: settings,
76
- headers: this.headers(),
77
- });
78
- }
79
- }
@@ -1,343 +0,0 @@
1
- /**
2
- * Threads Module - Fully Typed
3
- *
4
- * Naming conventions:
5
- * - get* for singular items
6
- * - list* for collections
7
- * - create*, update*, delete* for mutations
8
- *
9
- * Convenience aliases are provided for common access patterns.
10
- */
11
-
12
- import type { RawClient, APIResponse } from "../client/raw.js";
13
- import type { PaginationParams, PaginatedResponse } from "../client/helpers.js";
14
-
15
- // Response types
16
- export interface Thread {
17
- id: string;
18
- workspace_id: string;
19
- tenant_id: string;
20
- channel?: string;
21
- external_conversation_id?: string;
22
- metadata?: Record<string, unknown>;
23
- created_at: string;
24
- updated_at: string;
25
- }
26
-
27
- export interface ThreadState {
28
- thread_id: string;
29
- values: Record<string, unknown>;
30
- next?: string[];
31
- tasks?: unknown[];
32
- metadata?: Record<string, unknown>;
33
- }
34
-
35
- export interface ThreadHistory {
36
- thread_id: string;
37
- checkpoints: unknown[];
38
- }
39
-
40
- export interface ThreadMessage {
41
- id: string;
42
- thread_id: string;
43
- role: "human" | "assistant" | "system" | "developer";
44
- content: string;
45
- metadata?: Record<string, unknown>;
46
- created_at: string;
47
- }
48
-
49
- export interface ThreadRun {
50
- run_id: string;
51
- thread_id: string;
52
- agent_id: string;
53
- status: string;
54
- created_at: string;
55
- completed_at?: string;
56
- }
57
-
58
- export type ThreadListResponse = PaginatedResponse<Thread>;
59
- export type ThreadMessagesResponse = PaginatedResponse<ThreadMessage>;
60
- export type ThreadRunsResponse = PaginatedResponse<ThreadRun>;
61
-
62
- export interface ThreadSearchResponse {
63
- items: Thread[];
64
- total: number;
65
- }
66
-
67
- export interface ThreadPruneResponse {
68
- deleted_count: number;
69
- thread_ids: string[];
70
- }
71
-
72
- export class ThreadsModule {
73
- constructor(private client: RawClient, private headers: () => Record<string, string>) { }
74
-
75
- // ======================== CRUD ========================
76
-
77
- /**
78
- * Create a new thread.
79
- * @example
80
- * ```ts
81
- * const { data: thread } = await client.threads.create();
82
- *
83
- * // With idempotency (safe to retry)
84
- * const { data: thread } = await client.threads.create({
85
- * idempotency_key: "my-unique-key"
86
- * });
87
- * ```
88
- */
89
- async create(body?: {
90
- channel?: string;
91
- external_conversation_id?: string;
92
- metadata?: Record<string, unknown>;
93
- /** Idempotency key for safe retries. When set, duplicate requests with the same key return the original response. */
94
- idempotency_key?: string;
95
- }): Promise<APIResponse<Thread>> {
96
- // Send canonical X-Idempotency-Key header + body idempotency_key for backend contract parity.
97
- const headers: Record<string, string> = { ...this.headers() };
98
- if (body?.idempotency_key) {
99
- headers["X-Idempotency-Key"] = body.idempotency_key;
100
- }
101
-
102
- return this.client.POST<Thread>("/v1/api/threads", {
103
- body: body ?? {},
104
- headers,
105
- });
106
- }
107
-
108
- /**
109
- * Get a thread by ID.
110
- * @example
111
- * ```ts
112
- * const { data: thread } = await client.threads.get("thread-uuid");
113
- * ```
114
- */
115
- async get(threadId: string): Promise<APIResponse<Thread>> {
116
- return this.client.GET<Thread>("/v1/api/threads/{id}", {
117
- params: { path: { id: threadId } },
118
- headers: this.headers(),
119
- });
120
- }
121
-
122
- /**
123
- * List all threads.
124
- * @example
125
- * ```ts
126
- * const { data } = await client.threads.list({ limit: 20 });
127
- * ```
128
- */
129
- async list(params?: PaginationParams & {
130
- workspace_id?: string;
131
- }): Promise<APIResponse<ThreadListResponse>> {
132
- return this.client.GET<ThreadListResponse>("/v1/api/threads", {
133
- params: { query: params },
134
- headers: this.headers(),
135
- });
136
- }
137
-
138
- /**
139
- * Iterate through all threads with automatic pagination.
140
- *
141
- * @example
142
- * ```ts
143
- * for await (const thread of client.threads.iterate()) {
144
- * console.log(thread.id);
145
- * }
146
- * ```
147
- */
148
- async *iterate(
149
- filters?: { workspace_id?: string },
150
- options?: { pageSize?: number; maxItems?: number; signal?: AbortSignal }
151
- ): AsyncGenerator<Thread, void, unknown> {
152
- const pageSize = options?.pageSize ?? 100;
153
- const maxItems = options?.maxItems ?? Infinity;
154
- let offset = 0;
155
- let yielded = 0;
156
- let hasMore = true;
157
-
158
- while (hasMore && yielded < maxItems) {
159
- if (options?.signal?.aborted) return;
160
-
161
- const response = await this.list({
162
- ...filters,
163
- limit: Math.min(pageSize, maxItems - yielded),
164
- offset,
165
- });
166
-
167
- if (response.error) throw response.error;
168
- const data = response.data!;
169
-
170
- for (const thread of data.items) {
171
- if (yielded >= maxItems) return;
172
- yield thread;
173
- yielded++;
174
- }
175
-
176
- offset += data.items.length;
177
- hasMore = offset < data.total && data.items.length > 0;
178
- }
179
- }
180
-
181
- /**
182
- * Delete a thread.
183
- */
184
- async delete(threadId: string): Promise<APIResponse<void>> {
185
- return this.client.DELETE<void>("/v1/api/threads/{id}", {
186
- params: { path: { id: threadId } },
187
- headers: this.headers(),
188
- });
189
- }
190
-
191
- // ======================== State ========================
192
-
193
- /**
194
- * Get the current state of a thread.
195
- * @example
196
- * ```ts
197
- * const { data: state } = await client.threads.getState("thread-uuid");
198
- * ```
199
- */
200
- async getState(threadId: string): Promise<APIResponse<ThreadState>> {
201
- return this.client.GET<ThreadState>("/v1/api/threads/{id}/state", {
202
- params: { path: { id: threadId } },
203
- headers: this.headers(),
204
- });
205
- }
206
-
207
- /** Alias: threads.state() -> threads.getState() */
208
- state = (threadId: string) => this.getState(threadId);
209
-
210
- // ======================== History ========================
211
-
212
- /**
213
- * Get the history of a thread.
214
- */
215
- async getHistory(threadId: string): Promise<APIResponse<ThreadHistory>> {
216
- return this.client.GET<ThreadHistory>("/v1/api/threads/{id}/history", {
217
- params: { path: { id: threadId } },
218
- headers: this.headers(),
219
- });
220
- }
221
-
222
- /** Alias: threads.history() -> threads.getHistory() */
223
- history = (threadId: string) => this.getHistory(threadId);
224
-
225
- // ======================== Runs ========================
226
-
227
- /**
228
- * Get runs for a thread.
229
- * @example
230
- * ```ts
231
- * const { data } = await client.threads.getRuns("thread-uuid");
232
- * ```
233
- */
234
- async getRuns(threadId: string, params?: PaginationParams & {
235
- status?: string
236
- }): Promise<APIResponse<ThreadRunsResponse>> {
237
- return this.client.GET<ThreadRunsResponse>("/v1/api/threads/{id}/runs", {
238
- params: { path: { id: threadId }, query: params },
239
- headers: this.headers(),
240
- });
241
- }
242
-
243
- /** Alias: threads.runs() -> threads.getRuns() */
244
- runs = (threadId: string, params?: PaginationParams & { status?: string }) =>
245
- this.getRuns(threadId, params);
246
-
247
- /**
248
- * Create a run within a thread.
249
- */
250
- async createRun(threadId: string, body: {
251
- agent_id: string;
252
- input?: unknown;
253
- idempotency_key?: string;
254
- }): Promise<APIResponse<ThreadRun>> {
255
- return this.client.POST<ThreadRun>("/v1/api/threads/{id}/runs", {
256
- params: { path: { id: threadId } },
257
- body,
258
- headers: this.headers(),
259
- });
260
- }
261
-
262
- // ======================== Messages ========================
263
-
264
- /**
265
- * Get messages in a thread.
266
- * @example
267
- * ```ts
268
- * const { data } = await client.threads.getMessages("thread-uuid");
269
- * ```
270
- */
271
- async getMessages(threadId: string, params?: PaginationParams): Promise<APIResponse<ThreadMessagesResponse>> {
272
- return this.client.GET<ThreadMessagesResponse>("/v1/api/threads/{id}/messages", {
273
- params: { path: { id: threadId }, query: params },
274
- headers: this.headers(),
275
- });
276
- }
277
-
278
- /** Alias: threads.messages() -> threads.getMessages() */
279
- messages = (threadId: string, params?: PaginationParams) => this.getMessages(threadId, params);
280
-
281
- /**
282
- * Add a message to a thread.
283
- */
284
- async addMessage(threadId: string, body: {
285
- role?: "human" | "system" | "developer";
286
- content: string;
287
- metadata?: Record<string, unknown>;
288
- }): Promise<APIResponse<ThreadMessage>> {
289
- return this.client.POST<ThreadMessage>("/v1/api/threads/{id}/messages", {
290
- params: { path: { id: threadId } },
291
- body,
292
- headers: this.headers(),
293
- });
294
- }
295
-
296
- // ======================== Search ========================
297
-
298
- /**
299
- * Search threads.
300
- */
301
- async search(body: {
302
- workspace_id?: string;
303
- agent_id?: string;
304
- created_after?: string;
305
- created_before?: string;
306
- sort_by?: string;
307
- sort_desc?: boolean;
308
- } & PaginationParams): Promise<APIResponse<ThreadSearchResponse>> {
309
- return this.client.POST<ThreadSearchResponse>("/v1/api/threads/search", {
310
- body,
311
- headers: this.headers(),
312
- });
313
- }
314
-
315
- // ======================== Copy/Fork ========================
316
-
317
- /**
318
- * Copy/fork a thread.
319
- */
320
- async copy(threadId: string, options?: { copy_history?: boolean }): Promise<APIResponse<Thread>> {
321
- return this.client.POST<Thread>("/v1/api/threads/{id}/copy", {
322
- params: { path: { id: threadId } },
323
- body: options ?? {},
324
- headers: this.headers(),
325
- });
326
- }
327
-
328
- // ======================== Prune ========================
329
-
330
- /**
331
- * Prune old threads.
332
- */
333
- async prune(body: {
334
- workspace_id?: string;
335
- older_than_days?: number;
336
- dry_run?: boolean;
337
- } & PaginationParams): Promise<APIResponse<ThreadPruneResponse>> {
338
- return this.client.POST<ThreadPruneResponse>("/v1/api/threads/prune", {
339
- body,
340
- headers: this.headers(),
341
- });
342
- }
343
- }
@@ -1,91 +0,0 @@
1
- /**
2
- * Tools Module - Fully Typed
3
- */
4
-
5
- import type { RawClient, APIResponse } from "../client/raw.js";
6
-
7
- export interface Tool {
8
- name: string;
9
- description?: string;
10
- category?: string;
11
- parameters?: Record<string, unknown>;
12
- required_credentials: string[];
13
- is_builtin: boolean;
14
- created_at?: string;
15
- }
16
-
17
- export interface ToolListResponse {
18
- items: Tool[];
19
- total: number;
20
- }
21
-
22
- export interface ToolDefinition {
23
- capability_ref: string;
24
- capability_version: string;
25
- execution_binding: string;
26
- slug?: string; // compatibility/display only
27
- required_credentials: string[];
28
- name: string;
29
- description?: string;
30
- type: string;
31
- version?: number;
32
- input_schema?: Record<string, unknown>;
33
- output_schema?: Record<string, unknown>;
34
- }
35
-
36
- export interface ToolDefinitionsResponse {
37
- version: string;
38
- tools: ToolDefinition[];
39
- }
40
-
41
- export interface ToolCallResult {
42
- success: boolean;
43
- output?: unknown;
44
- error?: string;
45
- }
46
-
47
- export class ToolsModule {
48
- constructor(private client: RawClient, private headers: () => Record<string, string>) { }
49
-
50
- /**
51
- * List all available tools.
52
- */
53
- async list(params?: {
54
- category?: string;
55
- limit?: number;
56
- offset?: number;
57
- }): Promise<APIResponse<ToolListResponse>> {
58
- return this.client.GET<ToolListResponse>("/v1/api/tools", {
59
- params: { query: params },
60
- headers: this.headers(),
61
- });
62
- }
63
-
64
- /**
65
- * Get a tool by name.
66
- */
67
- async get(toolName: string): Promise<APIResponse<Tool>> {
68
- return this.client.GET<Tool>("/v1/api/tools/{name}", {
69
- params: { path: { name: toolName } },
70
- headers: this.headers(),
71
- });
72
- }
73
-
74
- async getDefinitions(version: string = "1"): Promise<APIResponse<ToolDefinitionsResponse>> {
75
- return this.client.GET<ToolDefinitionsResponse>("/v1/api/tools/definitions", {
76
- params: { query: { version } },
77
- headers: this.headers(),
78
- });
79
- }
80
-
81
- /**
82
- * Call a tool directly (testing).
83
- */
84
- async call(toolName: string, args: unknown): Promise<APIResponse<ToolCallResult>> {
85
- return this.client.POST<ToolCallResult>("/v1/api/tools/{name}/call", {
86
- params: { path: { name: toolName } },
87
- body: { arguments: args },
88
- headers: this.headers(),
89
- });
90
- }
91
- }
@@ -1,133 +0,0 @@
1
- /**
2
- * Traces Module - Fully Typed
3
- */
4
-
5
- import type { RawClient, APIResponse, components } from "../client/raw.js";
6
-
7
- export type SpanData = components["schemas"]["SpanData"];
8
- type BatchIngestRequest = components["schemas"]["BatchIngestRequest"];
9
- type AddFeedbackRequest = components["schemas"]["AddFeedbackRequest"];
10
-
11
- export interface FeedbackRequest {
12
- span_id: string;
13
- score?: string;
14
- comment?: string;
15
- corrections?: Record<string, unknown>;
16
- }
17
-
18
- export interface Trace {
19
- trace_id: string;
20
- run_id?: string;
21
- root_span_id: string;
22
- name: string;
23
- status: "ok" | "error" | "pending";
24
- start_time: string;
25
- end_time?: string;
26
- duration_ms?: number;
27
- span_count: number;
28
- }
29
-
30
- export interface Span {
31
- trace_id: string;
32
- span_id: string;
33
- parent_span_id?: string;
34
- name: string;
35
- kind: string;
36
- status: string;
37
- status_message?: string;
38
- start_time_unix_nano: number;
39
- end_time_unix_nano?: number;
40
- run_id?: string;
41
- attributes?: Record<string, unknown>;
42
- events?: unknown[];
43
- }
44
-
45
- export interface TraceListResponse {
46
- items: Trace[];
47
- total: number;
48
- }
49
-
50
- export interface SpanListResponse {
51
- items: Span[];
52
- total: number;
53
- }
54
-
55
- export interface TraceDetail extends Trace {
56
- spans: Span[];
57
- }
58
-
59
- export interface SpansByRunResponse {
60
- run_id: string;
61
- spans: Span[];
62
- count: number;
63
- }
64
-
65
- export class TracesModule {
66
- constructor(private client: RawClient, private headers: () => Record<string, string>) { }
67
-
68
- /**
69
- * List traces.
70
- */
71
- async list(params?: {
72
- run_id?: string;
73
- from?: string;
74
- to?: string;
75
- limit?: number;
76
- offset?: number;
77
- }): Promise<APIResponse<TraceListResponse>> {
78
- return this.client.GET<TraceListResponse>("/v1/api/traces", {
79
- params: { query: params },
80
- headers: this.headers(),
81
- });
82
- }
83
-
84
- /**
85
- * Get a trace by ID.
86
- */
87
- async get(traceId: string): Promise<APIResponse<TraceDetail>> {
88
- return this.client.GET<TraceDetail>("/v1/api/traces/{id}", {
89
- params: { path: { id: traceId } },
90
- headers: this.headers(),
91
- });
92
- }
93
-
94
- /**
95
- * Get spans for a trace.
96
- */
97
- async getSpans(traceId: string): Promise<APIResponse<SpanListResponse>> {
98
- return this.client.GET<SpanListResponse>("/v1/api/traces/{id}/spans", {
99
- params: { path: { id: traceId } },
100
- headers: this.headers(),
101
- });
102
- }
103
-
104
- /**
105
- * Get all spans associated with a run.
106
- * Maps to: GET /v1/api/traces/by-run/{runId}
107
- */
108
- async getByRun(runId: string): Promise<APIResponse<SpansByRunResponse>> {
109
- return this.client.GET<SpansByRunResponse>(`/v1/api/traces/by-run/${runId}`, {
110
- headers: this.headers(),
111
- });
112
- }
113
-
114
- /**
115
- * Ingest spans (batch).
116
- */
117
- async ingest(spans: SpanData[]): Promise<APIResponse<void>> {
118
- return this.client.POST<void>("/v1/api/traces/ingest", {
119
- body: { spans },
120
- headers: this.headers(),
121
- });
122
- }
123
-
124
- /**
125
- * Add feedback to a span.
126
- */
127
- async addFeedback(feedback: FeedbackRequest): Promise<APIResponse<void>> {
128
- return this.client.POST<void>("/v1/api/traces/feedback", {
129
- body: feedback,
130
- headers: this.headers(),
131
- });
132
- }
133
- }