@roarkanalytics/sdk 4.1.0 → 4.3.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.
- package/CHANGELOG.md +24 -0
- package/client.d.mts +4 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -4
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agent.d.mts +61 -1
- package/resources/agent.d.mts.map +1 -1
- package/resources/agent.d.ts +61 -1
- package/resources/agent.d.ts.map +1 -1
- package/resources/agent.js +16 -0
- package/resources/agent.js.map +1 -1
- package/resources/agent.mjs +16 -0
- package/resources/agent.mjs.map +1 -1
- package/resources/index.d.mts +2 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/simulation.d.mts +83 -1
- package/resources/simulation.d.mts.map +1 -1
- package/resources/simulation.d.ts +83 -1
- package/resources/simulation.d.ts.map +1 -1
- package/resources/simulation.js +29 -0
- package/resources/simulation.js.map +1 -1
- package/resources/simulation.mjs +29 -0
- package/resources/simulation.mjs.map +1 -1
- package/src/client.ts +13 -1
- package/src/resources/agent.ts +75 -0
- package/src/resources/index.ts +9 -1
- package/src/resources/simulation.ts +95 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/resources/simulation.mjs
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
3
|
export class Simulation extends APIResource {
|
|
4
|
+
/**
|
|
5
|
+
* The server half of the tool guard for code-first agents. When a guarded tool
|
|
6
|
+
* fires during a Roark test call, send the invocation here instead of executing
|
|
7
|
+
* it: Roark answers with a simulated backend response that is valid JSON, shaped
|
|
8
|
+
* by the tool contract you pass, consistent with the test scenario, and consistent
|
|
9
|
+
* with earlier mocked responses in the same call. Real callers are never affected:
|
|
10
|
+
* the guard only diverts when the agent-config resolve response identified the
|
|
11
|
+
* session as a Roark simulation, and this endpoint independently re-validates the
|
|
12
|
+
* simulation before answering.
|
|
13
|
+
*
|
|
14
|
+
* Failure contract for your wrapper: `404` means the simulation id is unknown to
|
|
15
|
+
* this project (treat the session as real). `409` means the simulation has already
|
|
16
|
+
* ended (stale session state: do NOT execute the real tool; return your static
|
|
17
|
+
* fallback). `5xx` means generation failed (return your static fallback).
|
|
18
|
+
*
|
|
19
|
+
* Identical retries (same tool, same arguments) within a few minutes return the
|
|
20
|
+
* stored response, so double-fired handlers stay consistent.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const response = await client.simulation.mockTool({
|
|
25
|
+
* simulationJobId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
26
|
+
* toolName: 'book_appointment',
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
mockTool(body, options) {
|
|
31
|
+
return this._client.post('/v1/simulation/tool-mock', { body, ...options });
|
|
32
|
+
}
|
|
4
33
|
/**
|
|
5
34
|
* Starts a simulation and returns the run.
|
|
6
35
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulation.mjs","sourceRoot":"","sources":["../src/resources/simulation.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAI/C,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,GAAG,CAAC,IAAyB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"simulation.mjs","sourceRoot":"","sources":["../src/resources/simulation.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAI/C,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CAAC,IAA8B,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,GAAG,CAAC,IAAyB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -19,6 +19,8 @@ import * as API from './resources/index';
|
|
|
19
19
|
import { APIPromise } from './core/api-promise';
|
|
20
20
|
import {
|
|
21
21
|
Agent,
|
|
22
|
+
AgentBuildParams,
|
|
23
|
+
AgentBuildResponse,
|
|
22
24
|
AgentCreateParams,
|
|
23
25
|
AgentCreateResponse,
|
|
24
26
|
AgentGetByIDResponse,
|
|
@@ -190,7 +192,13 @@ import {
|
|
|
190
192
|
MetricVariantUpdateParams,
|
|
191
193
|
MetricVariantUpdateResponse,
|
|
192
194
|
} from './resources/metric-variant';
|
|
193
|
-
import {
|
|
195
|
+
import {
|
|
196
|
+
Simulation,
|
|
197
|
+
SimulationMockToolParams,
|
|
198
|
+
SimulationMockToolResponse,
|
|
199
|
+
SimulationRunParams,
|
|
200
|
+
SimulationRunResponse,
|
|
201
|
+
} from './resources/simulation';
|
|
194
202
|
import {
|
|
195
203
|
SimulationEnvironment,
|
|
196
204
|
SimulationEnvironmentCreateParams,
|
|
@@ -1083,7 +1091,9 @@ export declare namespace Roark {
|
|
|
1083
1091
|
|
|
1084
1092
|
export {
|
|
1085
1093
|
Simulation as Simulation,
|
|
1094
|
+
type SimulationMockToolResponse as SimulationMockToolResponse,
|
|
1086
1095
|
type SimulationRunResponse as SimulationRunResponse,
|
|
1096
|
+
type SimulationMockToolParams as SimulationMockToolParams,
|
|
1087
1097
|
type SimulationRunParams as SimulationRunParams,
|
|
1088
1098
|
};
|
|
1089
1099
|
|
|
@@ -1209,10 +1219,12 @@ export declare namespace Roark {
|
|
|
1209
1219
|
type AgentCreateResponse as AgentCreateResponse,
|
|
1210
1220
|
type AgentUpdateResponse as AgentUpdateResponse,
|
|
1211
1221
|
type AgentListResponse as AgentListResponse,
|
|
1222
|
+
type AgentBuildResponse as AgentBuildResponse,
|
|
1212
1223
|
type AgentGetByIDResponse as AgentGetByIDResponse,
|
|
1213
1224
|
type AgentCreateParams as AgentCreateParams,
|
|
1214
1225
|
type AgentUpdateParams as AgentUpdateParams,
|
|
1215
1226
|
type AgentListParams as AgentListParams,
|
|
1227
|
+
type AgentBuildParams as AgentBuildParams,
|
|
1216
1228
|
};
|
|
1217
1229
|
|
|
1218
1230
|
export {
|
package/src/resources/agent.ts
CHANGED
|
@@ -49,6 +49,23 @@ export class Agent extends APIResource {
|
|
|
49
49
|
return this._client.get('/v1/agent', { query, ...options });
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Creates a new Roark-hosted agent from a one-line job description. Roark authors
|
|
54
|
+
* the system prompt and hosts the config, so the agent is live and self-improvable
|
|
55
|
+
* from creation.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const response = await client.agent.build({
|
|
60
|
+
* jobDescription: 'x',
|
|
61
|
+
* name: 'x',
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
build(body: AgentBuildParams, options?: RequestOptions): APIPromise<AgentBuildResponse> {
|
|
66
|
+
return this._client.post('/v1/agent/build', { body, ...options });
|
|
67
|
+
}
|
|
68
|
+
|
|
52
69
|
/**
|
|
53
70
|
* Returns a specific agent by its ID.
|
|
54
71
|
*
|
|
@@ -195,6 +212,44 @@ export namespace AgentListResponse {
|
|
|
195
212
|
}
|
|
196
213
|
}
|
|
197
214
|
|
|
215
|
+
export interface AgentBuildResponse {
|
|
216
|
+
data: AgentBuildResponse.Data;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export namespace AgentBuildResponse {
|
|
220
|
+
export interface Data {
|
|
221
|
+
/**
|
|
222
|
+
* Unique identifier of the agent
|
|
223
|
+
*/
|
|
224
|
+
id: string;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Creation timestamp in ISO 8601 format
|
|
228
|
+
*/
|
|
229
|
+
createdAt: string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Custom identifier for the agent
|
|
233
|
+
*/
|
|
234
|
+
customId: string | null;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Description of the agent
|
|
238
|
+
*/
|
|
239
|
+
description: string | null;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Name of the agent
|
|
243
|
+
*/
|
|
244
|
+
name: string;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Last update timestamp in ISO 8601 format
|
|
248
|
+
*/
|
|
249
|
+
updatedAt: string;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
198
253
|
export interface AgentGetByIDResponse {
|
|
199
254
|
data: AgentGetByIDResponse.Data;
|
|
200
255
|
}
|
|
@@ -270,14 +325,34 @@ export interface AgentListParams {
|
|
|
270
325
|
searchText?: string;
|
|
271
326
|
}
|
|
272
327
|
|
|
328
|
+
export interface AgentBuildParams {
|
|
329
|
+
/**
|
|
330
|
+
* One-line description of what the agent should do. Roark authors the system
|
|
331
|
+
* prompt from this.
|
|
332
|
+
*/
|
|
333
|
+
jobDescription: string;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Name of the agent
|
|
337
|
+
*/
|
|
338
|
+
name: string;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Optional voice label for the hosted agent
|
|
342
|
+
*/
|
|
343
|
+
voice?: string | null;
|
|
344
|
+
}
|
|
345
|
+
|
|
273
346
|
export declare namespace Agent {
|
|
274
347
|
export {
|
|
275
348
|
type AgentCreateResponse as AgentCreateResponse,
|
|
276
349
|
type AgentUpdateResponse as AgentUpdateResponse,
|
|
277
350
|
type AgentListResponse as AgentListResponse,
|
|
351
|
+
type AgentBuildResponse as AgentBuildResponse,
|
|
278
352
|
type AgentGetByIDResponse as AgentGetByIDResponse,
|
|
279
353
|
type AgentCreateParams as AgentCreateParams,
|
|
280
354
|
type AgentUpdateParams as AgentUpdateParams,
|
|
281
355
|
type AgentListParams as AgentListParams,
|
|
356
|
+
type AgentBuildParams as AgentBuildParams,
|
|
282
357
|
};
|
|
283
358
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -5,10 +5,12 @@ export {
|
|
|
5
5
|
type AgentCreateResponse,
|
|
6
6
|
type AgentUpdateResponse,
|
|
7
7
|
type AgentListResponse,
|
|
8
|
+
type AgentBuildResponse,
|
|
8
9
|
type AgentGetByIDResponse,
|
|
9
10
|
type AgentCreateParams,
|
|
10
11
|
type AgentUpdateParams,
|
|
11
12
|
type AgentListParams,
|
|
13
|
+
type AgentBuildParams,
|
|
12
14
|
} from './agent';
|
|
13
15
|
export {
|
|
14
16
|
AgentConfig,
|
|
@@ -173,7 +175,13 @@ export {
|
|
|
173
175
|
type MetricVariantDeleteParams,
|
|
174
176
|
type MetricVariantGetByIDParams,
|
|
175
177
|
} from './metric-variant';
|
|
176
|
-
export {
|
|
178
|
+
export {
|
|
179
|
+
Simulation,
|
|
180
|
+
type SimulationMockToolResponse,
|
|
181
|
+
type SimulationRunResponse,
|
|
182
|
+
type SimulationMockToolParams,
|
|
183
|
+
type SimulationRunParams,
|
|
184
|
+
} from './simulation';
|
|
177
185
|
export {
|
|
178
186
|
SimulationEnvironment,
|
|
179
187
|
type SimulationEnvironmentCreateResponse,
|
|
@@ -5,6 +5,36 @@ import { APIPromise } from '../core/api-promise';
|
|
|
5
5
|
import { RequestOptions } from '../internal/request-options';
|
|
6
6
|
|
|
7
7
|
export class Simulation extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* The server half of the tool guard for code-first agents. When a guarded tool
|
|
10
|
+
* fires during a Roark test call, send the invocation here instead of executing
|
|
11
|
+
* it: Roark answers with a simulated backend response that is valid JSON, shaped
|
|
12
|
+
* by the tool contract you pass, consistent with the test scenario, and consistent
|
|
13
|
+
* with earlier mocked responses in the same call. Real callers are never affected:
|
|
14
|
+
* the guard only diverts when the agent-config resolve response identified the
|
|
15
|
+
* session as a Roark simulation, and this endpoint independently re-validates the
|
|
16
|
+
* simulation before answering.
|
|
17
|
+
*
|
|
18
|
+
* Failure contract for your wrapper: `404` means the simulation id is unknown to
|
|
19
|
+
* this project (treat the session as real). `409` means the simulation has already
|
|
20
|
+
* ended (stale session state: do NOT execute the real tool; return your static
|
|
21
|
+
* fallback). `5xx` means generation failed (return your static fallback).
|
|
22
|
+
*
|
|
23
|
+
* Identical retries (same tool, same arguments) within a few minutes return the
|
|
24
|
+
* stored response, so double-fired handlers stay consistent.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const response = await client.simulation.mockTool({
|
|
29
|
+
* simulationJobId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
30
|
+
* toolName: 'book_appointment',
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
mockTool(body: SimulationMockToolParams, options?: RequestOptions): APIPromise<SimulationMockToolResponse> {
|
|
35
|
+
return this._client.post('/v1/simulation/tool-mock', { body, ...options });
|
|
36
|
+
}
|
|
37
|
+
|
|
8
38
|
/**
|
|
9
39
|
* Starts a simulation and returns the run.
|
|
10
40
|
*
|
|
@@ -38,6 +68,39 @@ export class Simulation extends APIResource {
|
|
|
38
68
|
}
|
|
39
69
|
}
|
|
40
70
|
|
|
71
|
+
export interface SimulationMockToolResponse {
|
|
72
|
+
/**
|
|
73
|
+
* A simulated backend response for a guarded tool during a Roark test call. The
|
|
74
|
+
* real tool was not, and must not be, executed.
|
|
75
|
+
*/
|
|
76
|
+
data: SimulationMockToolResponse.Data;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export namespace SimulationMockToolResponse {
|
|
80
|
+
/**
|
|
81
|
+
* A simulated backend response for a guarded tool during a Roark test call. The
|
|
82
|
+
* real tool was not, and must not be, executed.
|
|
83
|
+
*/
|
|
84
|
+
export interface Data {
|
|
85
|
+
/**
|
|
86
|
+
* True when this exact invocation (same tool, same arguments) was answered moments
|
|
87
|
+
* ago and the stored response was returned, e.g. on a retry.
|
|
88
|
+
*/
|
|
89
|
+
reused: boolean;
|
|
90
|
+
|
|
91
|
+
simulationJobId: string;
|
|
92
|
+
|
|
93
|
+
toolName: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The simulated tool response: valid JSON, shaped by the tool contract, consistent
|
|
97
|
+
* with the test scenario and with earlier mocked responses in the same call.
|
|
98
|
+
* Return this from your tool instead of executing it.
|
|
99
|
+
*/
|
|
100
|
+
result?: unknown;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
41
104
|
export interface SimulationRunResponse {
|
|
42
105
|
/**
|
|
43
106
|
* A started simulation run.
|
|
@@ -97,6 +160,36 @@ export namespace SimulationRunResponse {
|
|
|
97
160
|
}
|
|
98
161
|
}
|
|
99
162
|
|
|
163
|
+
export interface SimulationMockToolParams {
|
|
164
|
+
/**
|
|
165
|
+
* The simulation this session belongs to, from the agent-config resolve response
|
|
166
|
+
* (`simulationJobId`). Roark re-validates it against the live simulation before
|
|
167
|
+
* answering.
|
|
168
|
+
*/
|
|
169
|
+
simulationJobId: string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The tool the agent invoked.
|
|
173
|
+
*/
|
|
174
|
+
toolName: string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The arguments the agent called the tool with, verbatim.
|
|
178
|
+
*/
|
|
179
|
+
arguments?: { [key: string]: unknown };
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Your session or room identifier, echoed back in logs for correlation.
|
|
183
|
+
*/
|
|
184
|
+
sessionId?: string;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The tool's contract: its description and, ideally, its parameter and return
|
|
188
|
+
* shape. The more contract you pass, the more faithful the simulated response.
|
|
189
|
+
*/
|
|
190
|
+
toolDescription?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
100
193
|
export type SimulationRunParams =
|
|
101
194
|
| SimulationRunParams.RunSimulationFromConfig
|
|
102
195
|
| SimulationRunParams.RunSimulationFromPlanID
|
|
@@ -882,7 +975,9 @@ export declare namespace SimulationRunParams {
|
|
|
882
975
|
|
|
883
976
|
export declare namespace Simulation {
|
|
884
977
|
export {
|
|
978
|
+
type SimulationMockToolResponse as SimulationMockToolResponse,
|
|
885
979
|
type SimulationRunResponse as SimulationRunResponse,
|
|
980
|
+
type SimulationMockToolParams as SimulationMockToolParams,
|
|
886
981
|
type SimulationRunParams as SimulationRunParams,
|
|
887
982
|
};
|
|
888
983
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.3.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.3.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.3.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.3.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|