@roarkanalytics/sdk 4.2.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/client.d.mts +8 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +8 -2
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +7 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/index.d.mts +3 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -1
- package/resources/index.mjs.map +1 -1
- package/resources/simulation-job-tool-mock.d.mts +56 -0
- package/resources/simulation-job-tool-mock.d.mts.map +1 -0
- package/resources/simulation-job-tool-mock.d.ts +56 -0
- package/resources/simulation-job-tool-mock.d.ts.map +1 -0
- package/resources/simulation-job-tool-mock.js +28 -0
- package/resources/simulation-job-tool-mock.js.map +1 -0
- package/resources/simulation-job-tool-mock.mjs +24 -0
- package/resources/simulation-job-tool-mock.mjs.map +1 -0
- package/resources/simulation-run-plan-job.d.mts +1 -1
- package/resources/simulation-run-plan-job.d.mts.map +1 -1
- package/resources/simulation-run-plan-job.d.ts +1 -1
- package/resources/simulation-run-plan-job.d.ts.map +1 -1
- package/resources/simulation-tool-fixture.d.mts +217 -0
- package/resources/simulation-tool-fixture.d.mts.map +1 -0
- package/resources/simulation-tool-fixture.d.ts +217 -0
- package/resources/simulation-tool-fixture.d.ts.map +1 -0
- package/resources/simulation-tool-fixture.js +69 -0
- package/resources/simulation-tool-fixture.js.map +1 -0
- package/resources/simulation-tool-fixture.mjs +65 -0
- package/resources/simulation-tool-fixture.mjs.map +1 -0
- package/resources/simulation.d.mts +88 -1
- package/resources/simulation.d.mts.map +1 -1
- package/resources/simulation.d.ts +88 -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 +43 -1
- package/src/resources/index.ts +18 -1
- package/src/resources/simulation-job-tool-mock.ts +70 -0
- package/src/resources/simulation-run-plan-job.ts +1 -0
- package/src/resources/simulation-tool-fixture.ts +288 -0
- package/src/resources/simulation.ts +101 -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
|
@@ -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,45 @@ 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
|
+
/**
|
|
94
|
+
* GENERATED = the scenario-aware model answered; FIXTURE = a pinned deterministic
|
|
95
|
+
* response you configured answered.
|
|
96
|
+
*/
|
|
97
|
+
source: 'GENERATED' | 'FIXTURE';
|
|
98
|
+
|
|
99
|
+
toolName: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The simulated tool response: valid JSON, shaped by the tool contract, consistent
|
|
103
|
+
* with the test scenario and with earlier mocked responses in the same call.
|
|
104
|
+
* Return this from your tool instead of executing it.
|
|
105
|
+
*/
|
|
106
|
+
result?: unknown;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
41
110
|
export interface SimulationRunResponse {
|
|
42
111
|
/**
|
|
43
112
|
* A started simulation run.
|
|
@@ -97,6 +166,36 @@ export namespace SimulationRunResponse {
|
|
|
97
166
|
}
|
|
98
167
|
}
|
|
99
168
|
|
|
169
|
+
export interface SimulationMockToolParams {
|
|
170
|
+
/**
|
|
171
|
+
* The simulation this session belongs to, from the agent-config resolve response
|
|
172
|
+
* (`simulationJobId`). Roark re-validates it against the live simulation before
|
|
173
|
+
* answering.
|
|
174
|
+
*/
|
|
175
|
+
simulationJobId: string;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The tool the agent invoked.
|
|
179
|
+
*/
|
|
180
|
+
toolName: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The arguments the agent called the tool with, verbatim.
|
|
184
|
+
*/
|
|
185
|
+
arguments?: { [key: string]: unknown };
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Your session or room identifier, echoed back in logs for correlation.
|
|
189
|
+
*/
|
|
190
|
+
sessionId?: string;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The tool's contract: its description and, ideally, its parameter and return
|
|
194
|
+
* shape. The more contract you pass, the more faithful the simulated response.
|
|
195
|
+
*/
|
|
196
|
+
toolDescription?: string;
|
|
197
|
+
}
|
|
198
|
+
|
|
100
199
|
export type SimulationRunParams =
|
|
101
200
|
| SimulationRunParams.RunSimulationFromConfig
|
|
102
201
|
| SimulationRunParams.RunSimulationFromPlanID
|
|
@@ -882,7 +981,9 @@ export declare namespace SimulationRunParams {
|
|
|
882
981
|
|
|
883
982
|
export declare namespace Simulation {
|
|
884
983
|
export {
|
|
984
|
+
type SimulationMockToolResponse as SimulationMockToolResponse,
|
|
885
985
|
type SimulationRunResponse as SimulationRunResponse,
|
|
986
|
+
type SimulationMockToolParams as SimulationMockToolParams,
|
|
886
987
|
type SimulationRunParams as SimulationRunParams,
|
|
887
988
|
};
|
|
888
989
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.4.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.4.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.4.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.4.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|