@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.
- package/dist/client/AgentOsClient.d.ts +141 -0
- package/dist/client/AgentOsClient.d.ts.map +1 -0
- package/{src/client/AgentOsClient.ts → dist/client/AgentOsClient.js} +61 -105
- package/dist/client/HttpRequestBuilder.d.ts +50 -0
- package/dist/client/HttpRequestBuilder.d.ts.map +1 -0
- package/{src/client/HttpRequestBuilder.ts → dist/client/HttpRequestBuilder.js} +9 -41
- package/{src/client/OperationContext.ts → dist/client/OperationContext.d.ts} +6 -9
- package/dist/client/OperationContext.d.ts.map +1 -0
- package/dist/client/OperationContext.js +13 -0
- package/dist/client/OperationContextProvider.d.ts +54 -0
- package/dist/client/OperationContextProvider.d.ts.map +1 -0
- package/{src/client/OperationContextProvider.ts → dist/client/OperationContextProvider.js} +17 -35
- package/{src/client/auth.ts → dist/client/auth.d.ts} +29 -65
- package/dist/client/auth.d.ts.map +1 -0
- package/dist/client/auth.js +38 -0
- package/dist/client/config.d.ts +49 -0
- package/dist/client/config.d.ts.map +1 -0
- package/{src/client/config.ts → dist/client/config.js} +5 -43
- package/dist/client/helpers.d.ts +63 -0
- package/dist/client/helpers.d.ts.map +1 -0
- package/{src/client/helpers.ts → dist/client/helpers.js} +9 -52
- package/dist/client/pagination.d.ts +105 -0
- package/dist/client/pagination.d.ts.map +1 -0
- package/{src/client/pagination.ts → dist/client/pagination.js} +15 -116
- package/dist/client/raw.d.ts +277 -0
- package/dist/client/raw.d.ts.map +1 -0
- package/dist/client/raw.js +337 -0
- package/dist/client/retry.d.ts +37 -0
- package/dist/client/retry.d.ts.map +1 -0
- package/{src/client/retry.ts → dist/client/retry.js} +13 -55
- package/dist/client/sanitize.d.ts +19 -0
- package/dist/client/sanitize.d.ts.map +1 -0
- package/{src/client/sanitize.ts → dist/client/sanitize.js} +4 -7
- package/dist/client/timeout.d.ts +26 -0
- package/dist/client/timeout.d.ts.map +1 -0
- package/{src/client/timeout.ts → dist/client/timeout.js} +10 -18
- package/dist/errors/factory.d.ts +22 -0
- package/dist/errors/factory.d.ts.map +1 -0
- package/{src/errors/factory.ts → dist/errors/factory.js} +18 -57
- package/dist/errors/index.d.ts +210 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/{src/errors/index.ts → dist/errors/index.js} +74 -156
- package/{src/generated/client.ts → dist/generated/client.d.ts} +5 -17
- package/dist/generated/client.d.ts.map +1 -0
- package/dist/generated/client.js +15 -0
- package/{src/generated/index.ts → dist/generated/index.d.ts} +1 -1
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +1 -0
- package/{src/generated/openapi.ts → dist/generated/openapi.d.ts} +1 -1
- package/dist/generated/openapi.d.ts.map +1 -0
- package/dist/generated/openapi.js +5 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/{src/index.ts → dist/index.js} +13 -63
- package/dist/modules/a2a.d.ts +48 -0
- package/dist/modules/a2a.d.ts.map +1 -0
- package/dist/modules/a2a.js +37 -0
- package/dist/modules/agents.d.ts +346 -0
- package/dist/modules/agents.d.ts.map +1 -0
- package/dist/modules/agents.js +296 -0
- package/dist/modules/apiTokens.d.ts +62 -0
- package/dist/modules/apiTokens.d.ts.map +1 -0
- package/dist/modules/apiTokens.js +56 -0
- package/dist/modules/approvals.d.ts +75 -0
- package/dist/modules/approvals.d.ts.map +1 -0
- package/dist/modules/approvals.js +91 -0
- package/dist/modules/audit.d.ts +78 -0
- package/dist/modules/audit.d.ts.map +1 -0
- package/{src/modules/audit.ts → dist/modules/audit.js} +23 -74
- package/{src/modules/auth.ts → dist/modules/auth.d.ts} +6 -11
- package/dist/modules/auth.d.ts.map +1 -0
- package/dist/modules/auth.js +22 -0
- package/dist/modules/builder.d.ts +242 -0
- package/dist/modules/builder.d.ts.map +1 -0
- package/dist/modules/builder.js +248 -0
- package/dist/modules/catalog.d.ts +142 -0
- package/dist/modules/catalog.d.ts.map +1 -0
- package/dist/modules/catalog.js +136 -0
- package/dist/modules/chatwoot.d.ts +59 -0
- package/dist/modules/chatwoot.d.ts.map +1 -0
- package/dist/modules/chatwoot.js +200 -0
- package/dist/modules/checkpoints.d.ts +62 -0
- package/dist/modules/checkpoints.d.ts.map +1 -0
- package/dist/modules/checkpoints.js +48 -0
- package/dist/modules/contracts.d.ts +48 -0
- package/dist/modules/contracts.d.ts.map +1 -0
- package/dist/modules/contracts.js +25 -0
- package/dist/modules/credentials.d.ts +105 -0
- package/dist/modules/credentials.d.ts.map +1 -0
- package/dist/modules/credentials.js +135 -0
- package/dist/modules/crons.d.ts +73 -0
- package/dist/modules/crons.d.ts.map +1 -0
- package/dist/modules/crons.js +67 -0
- package/dist/modules/datasets.d.ts +80 -0
- package/dist/modules/datasets.d.ts.map +1 -0
- package/dist/modules/datasets.js +91 -0
- package/{src/modules/evaluation.ts → dist/modules/evaluation.d.ts} +23 -109
- package/dist/modules/evaluation.d.ts.map +1 -0
- package/dist/modules/evaluation.js +108 -0
- package/dist/modules/files.d.ts +89 -0
- package/dist/modules/files.d.ts.map +1 -0
- package/dist/modules/files.js +133 -0
- package/dist/modules/graphs.d.ts +120 -0
- package/dist/modules/graphs.d.ts.map +1 -0
- package/dist/modules/graphs.js +69 -0
- package/{src/modules/improvements.ts → dist/modules/improvements.d.ts} +8 -27
- package/dist/modules/improvements.d.ts.map +1 -0
- package/dist/modules/improvements.js +27 -0
- package/dist/modules/info.d.ts +76 -0
- package/dist/modules/info.d.ts.map +1 -0
- package/{src/modules/info.ts → dist/modules/info.js} +16 -66
- package/dist/modules/knowledge.d.ts +91 -0
- package/dist/modules/knowledge.d.ts.map +1 -0
- package/dist/modules/knowledge.js +80 -0
- package/{src/modules/me.ts → dist/modules/me.d.ts} +7 -23
- package/dist/modules/me.d.ts.map +1 -0
- package/dist/modules/me.js +28 -0
- package/dist/modules/members.d.ts +124 -0
- package/dist/modules/members.d.ts.map +1 -0
- package/dist/modules/members.js +142 -0
- package/dist/modules/memberships.d.ts +25 -0
- package/dist/modules/memberships.d.ts.map +1 -0
- package/dist/modules/memberships.js +20 -0
- package/{src/modules/metaAgent.ts → dist/modules/metaAgent.d.ts} +8 -44
- package/dist/modules/metaAgent.d.ts.map +1 -0
- package/dist/modules/metaAgent.js +32 -0
- package/dist/modules/metrics.d.ts +20 -0
- package/dist/modules/metrics.d.ts.map +1 -0
- package/{src/modules/metrics.ts → dist/modules/metrics.js} +7 -14
- package/dist/modules/observability.d.ts +19 -0
- package/dist/modules/observability.d.ts.map +1 -0
- package/dist/modules/observability.js +14 -0
- package/dist/modules/playground.d.ts +42 -0
- package/dist/modules/playground.d.ts.map +1 -0
- package/dist/modules/playground.js +48 -0
- package/dist/modules/presets.d.ts +32 -0
- package/dist/modules/presets.d.ts.map +1 -0
- package/dist/modules/presets.js +199 -0
- package/dist/modules/prompts.d.ts +87 -0
- package/dist/modules/prompts.d.ts.map +1 -0
- package/dist/modules/prompts.js +87 -0
- package/dist/modules/roles.d.ts +64 -0
- package/dist/modules/roles.d.ts.map +1 -0
- package/dist/modules/roles.js +79 -0
- package/dist/modules/runs.d.ts +451 -0
- package/dist/modules/runs.d.ts.map +1 -0
- package/{src/modules/runs.ts → dist/modules/runs.js} +96 -438
- package/dist/modules/store.d.ts +37 -0
- package/dist/modules/store.d.ts.map +1 -0
- package/dist/modules/store.js +48 -0
- package/{src/modules/templates.ts → dist/modules/templates.d.ts} +8 -32
- package/dist/modules/templates.d.ts.map +1 -0
- package/dist/modules/templates.js +26 -0
- package/dist/modules/tenants.d.ts +49 -0
- package/dist/modules/tenants.d.ts.map +1 -0
- package/dist/modules/tenants.js +56 -0
- package/dist/modules/threads.d.ts +205 -0
- package/dist/modules/threads.d.ts.map +1 -0
- package/dist/modules/threads.js +225 -0
- package/dist/modules/tools.d.ts +62 -0
- package/dist/modules/tools.d.ts.map +1 -0
- package/dist/modules/tools.js +45 -0
- package/dist/modules/traces.d.ts +89 -0
- package/dist/modules/traces.d.ts.map +1 -0
- package/dist/modules/traces.js +65 -0
- package/{src/modules/triggers.ts → dist/modules/triggers.d.ts} +24 -153
- package/dist/modules/triggers.d.ts.map +1 -0
- package/dist/modules/triggers.js +176 -0
- package/{src/modules/usage.ts → dist/modules/usage.d.ts} +14 -46
- package/dist/modules/usage.d.ts.map +1 -0
- package/dist/modules/usage.js +43 -0
- package/dist/modules/vectorStores.d.ts +100 -0
- package/dist/modules/vectorStores.d.ts.map +1 -0
- package/dist/modules/vectorStores.js +159 -0
- package/dist/modules/workspaces.d.ts +138 -0
- package/dist/modules/workspaces.d.ts.map +1 -0
- package/dist/modules/workspaces.js +121 -0
- package/dist/sse/client.d.ts +140 -0
- package/dist/sse/client.d.ts.map +1 -0
- package/{src/sse/client.ts → dist/sse/client.js} +24 -100
- package/package.json +8 -15
- package/src/client/raw.ts +0 -609
- package/src/generated/swagger.json +0 -17014
- package/src/modules/a2a.ts +0 -64
- package/src/modules/agents.ts +0 -604
- package/src/modules/apiTokens.ts +0 -101
- package/src/modules/approvals.ts +0 -151
- package/src/modules/catalog.ts +0 -241
- package/src/modules/chatwoot.ts +0 -242
- package/src/modules/checkpoints.ts +0 -87
- package/src/modules/contracts.ts +0 -80
- package/src/modules/credentials.ts +0 -216
- package/src/modules/crons.ts +0 -115
- package/src/modules/datasets.ts +0 -142
- package/src/modules/files.ts +0 -208
- package/src/modules/members.ts +0 -199
- package/src/modules/memberships.ts +0 -42
- package/src/modules/observability.ts +0 -28
- package/src/modules/playground.ts +0 -68
- package/src/modules/presets.ts +0 -246
- package/src/modules/prompts.ts +0 -147
- package/src/modules/roles.ts +0 -112
- package/src/modules/store.ts +0 -65
- package/src/modules/tenants.ts +0 -79
- package/src/modules/threads.ts +0 -343
- package/src/modules/tools.ts +0 -91
- package/src/modules/traces.ts +0 -133
- package/src/modules/vectorStores.ts +0 -257
- package/src/modules/workspaces.ts +0 -216
|
@@ -0,0 +1,225 @@
|
|
|
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
|
+
export class ThreadsModule {
|
|
12
|
+
client;
|
|
13
|
+
headers;
|
|
14
|
+
constructor(client, headers) {
|
|
15
|
+
this.client = client;
|
|
16
|
+
this.headers = headers;
|
|
17
|
+
}
|
|
18
|
+
// ======================== CRUD ========================
|
|
19
|
+
/**
|
|
20
|
+
* Create a new thread.
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const { data: thread } = await client.threads.create();
|
|
24
|
+
*
|
|
25
|
+
* // With idempotency (safe to retry)
|
|
26
|
+
* const { data: thread } = await client.threads.create({
|
|
27
|
+
* idempotency_key: "my-unique-key"
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
async create(body) {
|
|
32
|
+
// Send canonical X-Idempotency-Key header + body idempotency_key for backend contract parity.
|
|
33
|
+
const headers = { ...this.headers() };
|
|
34
|
+
if (body?.idempotency_key) {
|
|
35
|
+
headers["X-Idempotency-Key"] = body.idempotency_key;
|
|
36
|
+
}
|
|
37
|
+
return this.client.POST("/v1/api/threads", {
|
|
38
|
+
body: body ?? {},
|
|
39
|
+
headers,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get a thread by ID.
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const { data: thread } = await client.threads.get("thread-uuid");
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
async get(threadId) {
|
|
50
|
+
return this.client.GET("/v1/api/threads/{id}", {
|
|
51
|
+
params: { path: { id: threadId } },
|
|
52
|
+
headers: this.headers(),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* List all threads.
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const { data } = await client.threads.list({ limit: 20 });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
async list(params) {
|
|
63
|
+
return this.client.GET("/v1/api/threads", {
|
|
64
|
+
params: { query: params },
|
|
65
|
+
headers: this.headers(),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Iterate through all threads with automatic pagination.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* for await (const thread of client.threads.iterate()) {
|
|
74
|
+
* console.log(thread.id);
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
async *iterate(filters, options) {
|
|
79
|
+
const pageSize = options?.pageSize ?? 100;
|
|
80
|
+
const maxItems = options?.maxItems ?? Infinity;
|
|
81
|
+
let offset = 0;
|
|
82
|
+
let yielded = 0;
|
|
83
|
+
let hasMore = true;
|
|
84
|
+
while (hasMore && yielded < maxItems) {
|
|
85
|
+
if (options?.signal?.aborted)
|
|
86
|
+
return;
|
|
87
|
+
const response = await this.list({
|
|
88
|
+
...filters,
|
|
89
|
+
limit: Math.min(pageSize, maxItems - yielded),
|
|
90
|
+
offset,
|
|
91
|
+
});
|
|
92
|
+
if (response.error)
|
|
93
|
+
throw response.error;
|
|
94
|
+
const data = response.data;
|
|
95
|
+
for (const thread of data.items) {
|
|
96
|
+
if (yielded >= maxItems)
|
|
97
|
+
return;
|
|
98
|
+
yield thread;
|
|
99
|
+
yielded++;
|
|
100
|
+
}
|
|
101
|
+
offset += data.items.length;
|
|
102
|
+
hasMore = offset < data.total && data.items.length > 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Delete a thread.
|
|
107
|
+
*/
|
|
108
|
+
async delete(threadId) {
|
|
109
|
+
return this.client.DELETE("/v1/api/threads/{id}", {
|
|
110
|
+
params: { path: { id: threadId } },
|
|
111
|
+
headers: this.headers(),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// ======================== State ========================
|
|
115
|
+
/**
|
|
116
|
+
* Get the current state of a thread.
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const { data: state } = await client.threads.getState("thread-uuid");
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
async getState(threadId) {
|
|
123
|
+
return this.client.GET("/v1/api/threads/{id}/state", {
|
|
124
|
+
params: { path: { id: threadId } },
|
|
125
|
+
headers: this.headers(),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** Alias: threads.state() -> threads.getState() */
|
|
129
|
+
state = (threadId) => this.getState(threadId);
|
|
130
|
+
// ======================== History ========================
|
|
131
|
+
/**
|
|
132
|
+
* Get the history of a thread.
|
|
133
|
+
*/
|
|
134
|
+
async getHistory(threadId) {
|
|
135
|
+
return this.client.GET("/v1/api/threads/{id}/history", {
|
|
136
|
+
params: { path: { id: threadId } },
|
|
137
|
+
headers: this.headers(),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** Alias: threads.history() -> threads.getHistory() */
|
|
141
|
+
history = (threadId) => this.getHistory(threadId);
|
|
142
|
+
// ======================== Runs ========================
|
|
143
|
+
/**
|
|
144
|
+
* Get runs for a thread.
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* const { data } = await client.threads.getRuns("thread-uuid");
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
async getRuns(threadId, params) {
|
|
151
|
+
return this.client.GET("/v1/api/threads/{id}/runs", {
|
|
152
|
+
params: { path: { id: threadId }, query: params },
|
|
153
|
+
headers: this.headers(),
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/** Alias: threads.runs() -> threads.getRuns() */
|
|
157
|
+
runs = (threadId, params) => this.getRuns(threadId, params);
|
|
158
|
+
/**
|
|
159
|
+
* Create a run within a thread.
|
|
160
|
+
*/
|
|
161
|
+
async createRun(threadId, body) {
|
|
162
|
+
return this.client.POST("/v1/api/threads/{id}/runs", {
|
|
163
|
+
params: { path: { id: threadId } },
|
|
164
|
+
body,
|
|
165
|
+
headers: this.headers(),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
// ======================== Messages ========================
|
|
169
|
+
/**
|
|
170
|
+
* Get messages in a thread.
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* const { data } = await client.threads.getMessages("thread-uuid");
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
async getMessages(threadId, params) {
|
|
177
|
+
return this.client.GET("/v1/api/threads/{id}/messages", {
|
|
178
|
+
params: { path: { id: threadId }, query: params },
|
|
179
|
+
headers: this.headers(),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/** Alias: threads.messages() -> threads.getMessages() */
|
|
183
|
+
messages = (threadId, params) => this.getMessages(threadId, params);
|
|
184
|
+
/**
|
|
185
|
+
* Add a message to a thread.
|
|
186
|
+
*/
|
|
187
|
+
async addMessage(threadId, body) {
|
|
188
|
+
return this.client.POST("/v1/api/threads/{id}/messages", {
|
|
189
|
+
params: { path: { id: threadId } },
|
|
190
|
+
body,
|
|
191
|
+
headers: this.headers(),
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
// ======================== Search ========================
|
|
195
|
+
/**
|
|
196
|
+
* Search threads.
|
|
197
|
+
*/
|
|
198
|
+
async search(body) {
|
|
199
|
+
return this.client.POST("/v1/api/threads/search", {
|
|
200
|
+
body,
|
|
201
|
+
headers: this.headers(),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
// ======================== Copy/Fork ========================
|
|
205
|
+
/**
|
|
206
|
+
* Copy/fork a thread.
|
|
207
|
+
*/
|
|
208
|
+
async copy(threadId, options) {
|
|
209
|
+
return this.client.POST("/v1/api/threads/{id}/copy", {
|
|
210
|
+
params: { path: { id: threadId } },
|
|
211
|
+
body: options ?? {},
|
|
212
|
+
headers: this.headers(),
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
// ======================== Prune ========================
|
|
216
|
+
/**
|
|
217
|
+
* Prune old threads.
|
|
218
|
+
*/
|
|
219
|
+
async prune(body) {
|
|
220
|
+
return this.client.POST("/v1/api/threads/prune", {
|
|
221
|
+
body,
|
|
222
|
+
headers: this.headers(),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tools Module - Fully Typed
|
|
3
|
+
*/
|
|
4
|
+
import type { RawClient, APIResponse } from "../client/raw.js";
|
|
5
|
+
export interface Tool {
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
category?: string;
|
|
9
|
+
parameters?: Record<string, unknown>;
|
|
10
|
+
required_credentials: string[];
|
|
11
|
+
is_builtin: boolean;
|
|
12
|
+
created_at?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ToolListResponse {
|
|
15
|
+
items: Tool[];
|
|
16
|
+
total: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ToolDefinition {
|
|
19
|
+
capability_ref: string;
|
|
20
|
+
capability_version: string;
|
|
21
|
+
execution_binding: string;
|
|
22
|
+
slug?: string;
|
|
23
|
+
required_credentials: string[];
|
|
24
|
+
name: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
type: string;
|
|
27
|
+
version?: number;
|
|
28
|
+
input_schema?: Record<string, unknown>;
|
|
29
|
+
output_schema?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface ToolDefinitionsResponse {
|
|
32
|
+
version: string;
|
|
33
|
+
tools: ToolDefinition[];
|
|
34
|
+
}
|
|
35
|
+
export interface ToolCallResult {
|
|
36
|
+
success: boolean;
|
|
37
|
+
output?: unknown;
|
|
38
|
+
error?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class ToolsModule {
|
|
41
|
+
private client;
|
|
42
|
+
private headers;
|
|
43
|
+
constructor(client: RawClient, headers: () => Record<string, string>);
|
|
44
|
+
/**
|
|
45
|
+
* List all available tools.
|
|
46
|
+
*/
|
|
47
|
+
list(params?: {
|
|
48
|
+
category?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
offset?: number;
|
|
51
|
+
}): Promise<APIResponse<ToolListResponse>>;
|
|
52
|
+
/**
|
|
53
|
+
* Get a tool by name.
|
|
54
|
+
*/
|
|
55
|
+
get(toolName: string): Promise<APIResponse<Tool>>;
|
|
56
|
+
getDefinitions(version?: string): Promise<APIResponse<ToolDefinitionsResponse>>;
|
|
57
|
+
/**
|
|
58
|
+
* Call a tool directly (testing).
|
|
59
|
+
*/
|
|
60
|
+
call(toolName: string, args: unknown): Promise<APIResponse<ToolCallResult>>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/modules/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,WAAW,IAAI;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBA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OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;CAOpF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tools Module - Fully Typed
|
|
3
|
+
*/
|
|
4
|
+
export class ToolsModule {
|
|
5
|
+
client;
|
|
6
|
+
headers;
|
|
7
|
+
constructor(client, headers) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
this.headers = headers;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* List all available tools.
|
|
13
|
+
*/
|
|
14
|
+
async list(params) {
|
|
15
|
+
return this.client.GET("/v1/api/tools", {
|
|
16
|
+
params: { query: params },
|
|
17
|
+
headers: this.headers(),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a tool by name.
|
|
22
|
+
*/
|
|
23
|
+
async get(toolName) {
|
|
24
|
+
return this.client.GET("/v1/api/tools/{name}", {
|
|
25
|
+
params: { path: { name: toolName } },
|
|
26
|
+
headers: this.headers(),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async getDefinitions(version = "1") {
|
|
30
|
+
return this.client.GET("/v1/api/tools/definitions", {
|
|
31
|
+
params: { query: { version } },
|
|
32
|
+
headers: this.headers(),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Call a tool directly (testing).
|
|
37
|
+
*/
|
|
38
|
+
async call(toolName, args) {
|
|
39
|
+
return this.client.POST("/v1/api/tools/{name}/call", {
|
|
40
|
+
params: { path: { name: toolName } },
|
|
41
|
+
body: { arguments: args },
|
|
42
|
+
headers: this.headers(),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traces Module - Fully Typed
|
|
3
|
+
*/
|
|
4
|
+
import type { RawClient, APIResponse, components } from "../client/raw.js";
|
|
5
|
+
export type SpanData = components["schemas"]["SpanData"];
|
|
6
|
+
export interface FeedbackRequest {
|
|
7
|
+
span_id: string;
|
|
8
|
+
score?: string;
|
|
9
|
+
comment?: string;
|
|
10
|
+
corrections?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface Trace {
|
|
13
|
+
trace_id: string;
|
|
14
|
+
run_id?: string;
|
|
15
|
+
root_span_id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
status: "ok" | "error" | "pending";
|
|
18
|
+
start_time: string;
|
|
19
|
+
end_time?: string;
|
|
20
|
+
duration_ms?: number;
|
|
21
|
+
span_count: number;
|
|
22
|
+
}
|
|
23
|
+
export interface Span {
|
|
24
|
+
trace_id: string;
|
|
25
|
+
span_id: string;
|
|
26
|
+
parent_span_id?: string;
|
|
27
|
+
name: string;
|
|
28
|
+
kind: string;
|
|
29
|
+
status: string;
|
|
30
|
+
status_message?: string;
|
|
31
|
+
start_time_unix_nano: number;
|
|
32
|
+
end_time_unix_nano?: number;
|
|
33
|
+
run_id?: string;
|
|
34
|
+
attributes?: Record<string, unknown>;
|
|
35
|
+
events?: unknown[];
|
|
36
|
+
}
|
|
37
|
+
export interface TraceListResponse {
|
|
38
|
+
items: Trace[];
|
|
39
|
+
total: number;
|
|
40
|
+
}
|
|
41
|
+
export interface SpanListResponse {
|
|
42
|
+
items: Span[];
|
|
43
|
+
total: number;
|
|
44
|
+
}
|
|
45
|
+
export interface TraceDetail extends Trace {
|
|
46
|
+
spans: Span[];
|
|
47
|
+
}
|
|
48
|
+
export interface SpansByRunResponse {
|
|
49
|
+
run_id: string;
|
|
50
|
+
spans: Span[];
|
|
51
|
+
count: number;
|
|
52
|
+
}
|
|
53
|
+
export declare class TracesModule {
|
|
54
|
+
private client;
|
|
55
|
+
private headers;
|
|
56
|
+
constructor(client: RawClient, headers: () => Record<string, string>);
|
|
57
|
+
/**
|
|
58
|
+
* List traces.
|
|
59
|
+
*/
|
|
60
|
+
list(params?: {
|
|
61
|
+
run_id?: string;
|
|
62
|
+
from?: string;
|
|
63
|
+
to?: string;
|
|
64
|
+
limit?: number;
|
|
65
|
+
offset?: number;
|
|
66
|
+
}): Promise<APIResponse<TraceListResponse>>;
|
|
67
|
+
/**
|
|
68
|
+
* Get a trace by ID.
|
|
69
|
+
*/
|
|
70
|
+
get(traceId: string): Promise<APIResponse<TraceDetail>>;
|
|
71
|
+
/**
|
|
72
|
+
* Get spans for a trace.
|
|
73
|
+
*/
|
|
74
|
+
getSpans(traceId: string): Promise<APIResponse<SpanListResponse>>;
|
|
75
|
+
/**
|
|
76
|
+
* Get all spans associated with a run.
|
|
77
|
+
* Maps to: GET /v1/api/traces/by-run/{runId}
|
|
78
|
+
*/
|
|
79
|
+
getByRun(runId: string): Promise<APIResponse<SpansByRunResponse>>;
|
|
80
|
+
/**
|
|
81
|
+
* Ingest spans (batch).
|
|
82
|
+
*/
|
|
83
|
+
ingest(spans: SpanData[]): Promise<APIResponse<void>>;
|
|
84
|
+
/**
|
|
85
|
+
* Add feedback to a span.
|
|
86
|
+
*/
|
|
87
|
+
addFeedback(feedback: FeedbackRequest): Promise<APIResponse<void>>;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=traces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../../src/modules/traces.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;AAIzD,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,KAAK;IAClB,QAAQ,E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AAO;gBAAlC,MAAM,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEpF;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAO3C;;OAEG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAO7D;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAOvE;;;OAGG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAMvE;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAO3D;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;CAM3E"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traces Module - Fully Typed
|
|
3
|
+
*/
|
|
4
|
+
export class TracesModule {
|
|
5
|
+
client;
|
|
6
|
+
headers;
|
|
7
|
+
constructor(client, headers) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
this.headers = headers;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* List traces.
|
|
13
|
+
*/
|
|
14
|
+
async list(params) {
|
|
15
|
+
return this.client.GET("/v1/api/traces", {
|
|
16
|
+
params: { query: params },
|
|
17
|
+
headers: this.headers(),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a trace by ID.
|
|
22
|
+
*/
|
|
23
|
+
async get(traceId) {
|
|
24
|
+
return this.client.GET("/v1/api/traces/{id}", {
|
|
25
|
+
params: { path: { id: traceId } },
|
|
26
|
+
headers: this.headers(),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get spans for a trace.
|
|
31
|
+
*/
|
|
32
|
+
async getSpans(traceId) {
|
|
33
|
+
return this.client.GET("/v1/api/traces/{id}/spans", {
|
|
34
|
+
params: { path: { id: traceId } },
|
|
35
|
+
headers: this.headers(),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get all spans associated with a run.
|
|
40
|
+
* Maps to: GET /v1/api/traces/by-run/{runId}
|
|
41
|
+
*/
|
|
42
|
+
async getByRun(runId) {
|
|
43
|
+
return this.client.GET(`/v1/api/traces/by-run/${runId}`, {
|
|
44
|
+
headers: this.headers(),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Ingest spans (batch).
|
|
49
|
+
*/
|
|
50
|
+
async ingest(spans) {
|
|
51
|
+
return this.client.POST("/v1/api/traces/ingest", {
|
|
52
|
+
body: { spans },
|
|
53
|
+
headers: this.headers(),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Add feedback to a span.
|
|
58
|
+
*/
|
|
59
|
+
async addFeedback(feedback) {
|
|
60
|
+
return this.client.POST("/v1/api/traces/feedback", {
|
|
61
|
+
body: feedback,
|
|
62
|
+
headers: this.headers(),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|