@roarkanalytics/sdk 4.0.0 → 4.2.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +5 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agent-config.d.mts +394 -0
  12. package/resources/agent-config.d.mts.map +1 -0
  13. package/resources/agent-config.d.ts +394 -0
  14. package/resources/agent-config.d.ts.map +1 -0
  15. package/resources/agent-config.js +98 -0
  16. package/resources/agent-config.js.map +1 -0
  17. package/resources/agent-config.mjs +94 -0
  18. package/resources/agent-config.mjs.map +1 -0
  19. package/resources/agent.d.mts +61 -1
  20. package/resources/agent.d.mts.map +1 -1
  21. package/resources/agent.d.ts +61 -1
  22. package/resources/agent.d.ts.map +1 -1
  23. package/resources/agent.js +16 -0
  24. package/resources/agent.js.map +1 -1
  25. package/resources/agent.mjs +16 -0
  26. package/resources/agent.mjs.map +1 -1
  27. package/resources/autoimprove-job.d.mts +13 -12
  28. package/resources/autoimprove-job.d.mts.map +1 -1
  29. package/resources/autoimprove-job.d.ts +13 -12
  30. package/resources/autoimprove-job.d.ts.map +1 -1
  31. package/resources/autoimprove-job.js +3 -2
  32. package/resources/autoimprove-job.js.map +1 -1
  33. package/resources/autoimprove-job.mjs +3 -2
  34. package/resources/autoimprove-job.mjs.map +1 -1
  35. package/resources/index.d.mts +2 -1
  36. package/resources/index.d.mts.map +1 -1
  37. package/resources/index.d.ts +2 -1
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js +3 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs +1 -0
  42. package/resources/index.mjs.map +1 -1
  43. package/src/client.ts +31 -0
  44. package/src/resources/agent-config.ts +487 -0
  45. package/src/resources/agent.ts +75 -0
  46. package/src/resources/autoimprove-job.ts +13 -12
  47. package/src/resources/index.ts +14 -0
  48. package/src/version.ts +1 -1
  49. package/version.d.mts +1 -1
  50. package/version.d.ts +1 -1
  51. package/version.js +1 -1
  52. package/version.mjs +1 -1
@@ -0,0 +1,394 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as AgentConfigAPI from "./agent-config.js";
3
+ import { APIPromise } from "../core/api-promise.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ export declare class AgentConfig extends APIResource {
6
+ /**
7
+ * Write a new revision onto a channel. Writing production creates the key when it
8
+ * does not exist; writing staging stages a candidate that only Roark-recognized
9
+ * simulation sessions will read. Every write is a new revision; nothing is
10
+ * overwritten.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const agentConfig = await client.agentConfig.update('x', {
15
+ * channel: 'production',
16
+ * document: { foo: 'string' },
17
+ * });
18
+ * ```
19
+ */
20
+ update(key: string, body: AgentConfigUpdateParams, options?: RequestOptions): APIPromise<AgentConfigUpdateResponse>;
21
+ /**
22
+ * List the managed agent configs in this project, most recent first.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const agentConfigs = await client.agentConfig.list();
27
+ * ```
28
+ */
29
+ list(options?: RequestOptions): APIPromise<AgentConfigListResponse>;
30
+ /**
31
+ * Clear the staging channel. Production is untouched; recognized simulation
32
+ * sessions go back to reading production.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const response =
37
+ * await client.agentConfig.deleteStaging('x');
38
+ * ```
39
+ */
40
+ deleteStaging(key: string, options?: RequestOptions): APIPromise<AgentConfigDeleteStagingResponse>;
41
+ /**
42
+ * Fetch one managed config with its channel pointers and recent revisions, newest
43
+ * first.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const response = await client.agentConfig.getByID('x');
48
+ * ```
49
+ */
50
+ getByID(key: string, options?: RequestOptions): APIPromise<AgentConfigGetByIDResponse>;
51
+ /**
52
+ * Point the production channel at the staging revision. Real traffic reads it from
53
+ * the next session onward; roll back by writing the prior revision id to
54
+ * production (the chain preserves every state).
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const response = await client.agentConfig.promote('x');
59
+ * ```
60
+ */
61
+ promote(key: string, options?: RequestOptions): APIPromise<AgentConfigPromoteResponse>;
62
+ /**
63
+ * The call your agent makes at session start. Returns the config JSON for this
64
+ * session, with per-session simulation recognition built in: when the session was
65
+ * originated by a Roark simulation (matched by caller number against the calls
66
+ * Roark has in flight), the STAGING revision is served for that session only, so
67
+ * Autoimprove candidates are tested on your real deployment. Real traffic always
68
+ * resolves to production; any recognition miss degrades to production too.
69
+ *
70
+ * On the first fetch of an unknown key, pass `defaults` (your baked-in config):
71
+ * the key is registered and the defaults become revision 1. That makes integration
72
+ * a single call.
73
+ *
74
+ * Cache the response per session; do not fetch per turn.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const response = await client.agentConfig.resolve('x');
79
+ * ```
80
+ */
81
+ resolve(key: string, body?: AgentConfigResolveParams | null | undefined, options?: RequestOptions): APIPromise<AgentConfigResolveResponse>;
82
+ }
83
+ export interface ManagedAgentConfigRevision {
84
+ id: string;
85
+ /**
86
+ * ISO 8601.
87
+ */
88
+ createdAt: string;
89
+ /**
90
+ * Who wrote it: your own pushes, or the Autoimprove loop staging a candidate.
91
+ */
92
+ createdByType: 'CUSTOMER' | 'AUTOIMPROVE';
93
+ /**
94
+ * The config JSON, verbatim.
95
+ */
96
+ document: {
97
+ [key: string]: unknown;
98
+ };
99
+ parentRevisionId: string | null;
100
+ /**
101
+ * One-line story of the change.
102
+ */
103
+ summary: string | null;
104
+ }
105
+ export interface AgentConfigUpdateResponse {
106
+ /**
107
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
108
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
109
+ * Two channels: production for real traffic, staging for candidates under test.
110
+ */
111
+ data: AgentConfigUpdateResponse.Data;
112
+ }
113
+ export declare namespace AgentConfigUpdateResponse {
114
+ /**
115
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
116
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
117
+ * Two channels: production for real traffic, staging for candidates under test.
118
+ */
119
+ interface Data {
120
+ id: string;
121
+ /**
122
+ * The linked Roark agent, when one exists.
123
+ */
124
+ agentId: string | null;
125
+ /**
126
+ * ISO 8601.
127
+ */
128
+ createdAt: string;
129
+ /**
130
+ * The stable handle your code fetches by.
131
+ */
132
+ key: string;
133
+ /**
134
+ * The revision real traffic reads.
135
+ */
136
+ productionRevisionId: string | null;
137
+ /**
138
+ * The candidate revision Roark test calls read. Null when nothing is staged.
139
+ */
140
+ stagingRevisionId: string | null;
141
+ /**
142
+ * ISO 8601.
143
+ */
144
+ updatedAt: string;
145
+ }
146
+ }
147
+ export interface AgentConfigListResponse {
148
+ data: Array<AgentConfigListResponse.Data>;
149
+ }
150
+ export declare namespace AgentConfigListResponse {
151
+ /**
152
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
153
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
154
+ * Two channels: production for real traffic, staging for candidates under test.
155
+ */
156
+ interface Data {
157
+ id: string;
158
+ /**
159
+ * The linked Roark agent, when one exists.
160
+ */
161
+ agentId: string | null;
162
+ /**
163
+ * ISO 8601.
164
+ */
165
+ createdAt: string;
166
+ /**
167
+ * The stable handle your code fetches by.
168
+ */
169
+ key: string;
170
+ /**
171
+ * The revision real traffic reads.
172
+ */
173
+ productionRevisionId: string | null;
174
+ /**
175
+ * The candidate revision Roark test calls read. Null when nothing is staged.
176
+ */
177
+ stagingRevisionId: string | null;
178
+ /**
179
+ * ISO 8601.
180
+ */
181
+ updatedAt: string;
182
+ }
183
+ }
184
+ export interface AgentConfigDeleteStagingResponse {
185
+ /**
186
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
187
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
188
+ * Two channels: production for real traffic, staging for candidates under test.
189
+ */
190
+ data: AgentConfigDeleteStagingResponse.Data;
191
+ }
192
+ export declare namespace AgentConfigDeleteStagingResponse {
193
+ /**
194
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
195
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
196
+ * Two channels: production for real traffic, staging for candidates under test.
197
+ */
198
+ interface Data {
199
+ id: string;
200
+ /**
201
+ * The linked Roark agent, when one exists.
202
+ */
203
+ agentId: string | null;
204
+ /**
205
+ * ISO 8601.
206
+ */
207
+ createdAt: string;
208
+ /**
209
+ * The stable handle your code fetches by.
210
+ */
211
+ key: string;
212
+ /**
213
+ * The revision real traffic reads.
214
+ */
215
+ productionRevisionId: string | null;
216
+ /**
217
+ * The candidate revision Roark test calls read. Null when nothing is staged.
218
+ */
219
+ stagingRevisionId: string | null;
220
+ /**
221
+ * ISO 8601.
222
+ */
223
+ updatedAt: string;
224
+ }
225
+ }
226
+ export interface AgentConfigGetByIDResponse {
227
+ data: AgentConfigGetByIDResponse.Data;
228
+ }
229
+ export declare namespace AgentConfigGetByIDResponse {
230
+ /**
231
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
232
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
233
+ * Two channels: production for real traffic, staging for candidates under test.
234
+ */
235
+ interface Data {
236
+ id: string;
237
+ /**
238
+ * The linked Roark agent, when one exists.
239
+ */
240
+ agentId: string | null;
241
+ /**
242
+ * ISO 8601.
243
+ */
244
+ createdAt: string;
245
+ /**
246
+ * The stable handle your code fetches by.
247
+ */
248
+ key: string;
249
+ /**
250
+ * The revision real traffic reads.
251
+ */
252
+ productionRevisionId: string | null;
253
+ /**
254
+ * Recent revisions, newest first.
255
+ */
256
+ revisions: Array<AgentConfigAPI.ManagedAgentConfigRevision>;
257
+ /**
258
+ * The candidate revision Roark test calls read. Null when nothing is staged.
259
+ */
260
+ stagingRevisionId: string | null;
261
+ /**
262
+ * ISO 8601.
263
+ */
264
+ updatedAt: string;
265
+ }
266
+ }
267
+ export interface AgentConfigPromoteResponse {
268
+ /**
269
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
270
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
271
+ * Two channels: production for real traffic, staging for candidates under test.
272
+ */
273
+ data: AgentConfigPromoteResponse.Data;
274
+ }
275
+ export declare namespace AgentConfigPromoteResponse {
276
+ /**
277
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
278
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
279
+ * Two channels: production for real traffic, staging for candidates under test.
280
+ */
281
+ interface Data {
282
+ id: string;
283
+ /**
284
+ * The linked Roark agent, when one exists.
285
+ */
286
+ agentId: string | null;
287
+ /**
288
+ * ISO 8601.
289
+ */
290
+ createdAt: string;
291
+ /**
292
+ * The stable handle your code fetches by.
293
+ */
294
+ key: string;
295
+ /**
296
+ * The revision real traffic reads.
297
+ */
298
+ productionRevisionId: string | null;
299
+ /**
300
+ * The candidate revision Roark test calls read. Null when nothing is staged.
301
+ */
302
+ stagingRevisionId: string | null;
303
+ /**
304
+ * ISO 8601.
305
+ */
306
+ updatedAt: string;
307
+ }
308
+ }
309
+ export interface AgentConfigResolveResponse {
310
+ data: AgentConfigResolveResponse.Data;
311
+ }
312
+ export declare namespace AgentConfigResolveResponse {
313
+ interface Data {
314
+ /**
315
+ * Which channel this session resolved to.
316
+ */
317
+ channel: 'production' | 'staging';
318
+ /**
319
+ * The config JSON to apply.
320
+ */
321
+ document: {
322
+ [key: string]: unknown;
323
+ };
324
+ key: string;
325
+ revisionId: string;
326
+ /**
327
+ * Set when this session is a Roark simulation call. Stamp it (and the revisionId)
328
+ * into your session metadata so analysis attributes the call correctly.
329
+ */
330
+ simulationJobId: string | null;
331
+ }
332
+ }
333
+ export interface AgentConfigUpdateParams {
334
+ /**
335
+ * Which channel to write.
336
+ */
337
+ channel: 'production' | 'staging';
338
+ /**
339
+ * The full config JSON for the new revision.
340
+ */
341
+ document: {
342
+ [key: string]: unknown;
343
+ };
344
+ /**
345
+ * Link this config to a Roark agent (the one your calls report). Required before
346
+ * Autoimprove can run on it: the link is how a fix finds the config channel.
347
+ */
348
+ agentId?: string;
349
+ /**
350
+ * One-line story of the change.
351
+ */
352
+ summary?: string;
353
+ }
354
+ export interface AgentConfigResolveParams {
355
+ /**
356
+ * Your baked-in config. On the first fetch of an unknown key this registers the
357
+ * config and becomes revision 1, so integration is a single call. Ignored once the
358
+ * key exists.
359
+ */
360
+ defaults?: {
361
+ [key: string]: unknown;
362
+ };
363
+ /**
364
+ * Session context. When the call was originated by a Roark simulation, Roark
365
+ * recognizes it here and serves the staging revision for this session only; real
366
+ * traffic always gets production.
367
+ */
368
+ session?: AgentConfigResolveParams.Session;
369
+ }
370
+ export declare namespace AgentConfigResolveParams {
371
+ /**
372
+ * Session context. When the call was originated by a Roark simulation, Roark
373
+ * recognizes it here and serves the staging revision for this session only; real
374
+ * traffic always gets production.
375
+ */
376
+ interface Session {
377
+ /**
378
+ * The number your agent was reached on (E.164).
379
+ */
380
+ calledNumber?: string;
381
+ /**
382
+ * The number calling your agent (E.164). Required for simulation recognition.
383
+ */
384
+ callerNumber?: string;
385
+ /**
386
+ * Your session or room identifier, for correlation.
387
+ */
388
+ sessionId?: string;
389
+ }
390
+ }
391
+ export declare namespace AgentConfig {
392
+ export { type ManagedAgentConfigRevision as ManagedAgentConfigRevision, type AgentConfigUpdateResponse as AgentConfigUpdateResponse, type AgentConfigListResponse as AgentConfigListResponse, type AgentConfigDeleteStagingResponse as AgentConfigDeleteStagingResponse, type AgentConfigGetByIDResponse as AgentConfigGetByIDResponse, type AgentConfigPromoteResponse as AgentConfigPromoteResponse, type AgentConfigResolveResponse as AgentConfigResolveResponse, type AgentConfigUpdateParams as AgentConfigUpdateParams, type AgentConfigResolveParams as AgentConfigResolveParams, };
393
+ }
394
+ //# sourceMappingURL=agent-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-config.d.ts","sourceRoot":"","sources":["../src/resources/agent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,EAAE,MAAM,CAAC;KACpB;CACF;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AgentConfig = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const path_1 = require("../internal/utils/path.js");
7
+ class AgentConfig extends resource_1.APIResource {
8
+ /**
9
+ * Write a new revision onto a channel. Writing production creates the key when it
10
+ * does not exist; writing staging stages a candidate that only Roark-recognized
11
+ * simulation sessions will read. Every write is a new revision; nothing is
12
+ * overwritten.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const agentConfig = await client.agentConfig.update('x', {
17
+ * channel: 'production',
18
+ * document: { foo: 'string' },
19
+ * });
20
+ * ```
21
+ */
22
+ update(key, body, options) {
23
+ return this._client.put((0, path_1.path) `/v1/agent-config/${key}`, { body, ...options });
24
+ }
25
+ /**
26
+ * List the managed agent configs in this project, most recent first.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const agentConfigs = await client.agentConfig.list();
31
+ * ```
32
+ */
33
+ list(options) {
34
+ return this._client.get('/v1/agent-config', options);
35
+ }
36
+ /**
37
+ * Clear the staging channel. Production is untouched; recognized simulation
38
+ * sessions go back to reading production.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response =
43
+ * await client.agentConfig.deleteStaging('x');
44
+ * ```
45
+ */
46
+ deleteStaging(key, options) {
47
+ return this._client.delete((0, path_1.path) `/v1/agent-config/${key}/staging`, options);
48
+ }
49
+ /**
50
+ * Fetch one managed config with its channel pointers and recent revisions, newest
51
+ * first.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const response = await client.agentConfig.getByID('x');
56
+ * ```
57
+ */
58
+ getByID(key, options) {
59
+ return this._client.get((0, path_1.path) `/v1/agent-config/${key}`, options);
60
+ }
61
+ /**
62
+ * Point the production channel at the staging revision. Real traffic reads it from
63
+ * the next session onward; roll back by writing the prior revision id to
64
+ * production (the chain preserves every state).
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const response = await client.agentConfig.promote('x');
69
+ * ```
70
+ */
71
+ promote(key, options) {
72
+ return this._client.post((0, path_1.path) `/v1/agent-config/${key}/promote`, options);
73
+ }
74
+ /**
75
+ * The call your agent makes at session start. Returns the config JSON for this
76
+ * session, with per-session simulation recognition built in: when the session was
77
+ * originated by a Roark simulation (matched by caller number against the calls
78
+ * Roark has in flight), the STAGING revision is served for that session only, so
79
+ * Autoimprove candidates are tested on your real deployment. Real traffic always
80
+ * resolves to production; any recognition miss degrades to production too.
81
+ *
82
+ * On the first fetch of an unknown key, pass `defaults` (your baked-in config):
83
+ * the key is registered and the defaults become revision 1. That makes integration
84
+ * a single call.
85
+ *
86
+ * Cache the response per session; do not fetch per turn.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const response = await client.agentConfig.resolve('x');
91
+ * ```
92
+ */
93
+ resolve(key, body = {}, options) {
94
+ return this._client.post((0, path_1.path) `/v1/agent-config/${key}/resolve`, { body, ...options });
95
+ }
96
+ }
97
+ exports.AgentConfig = AgentConfig;
98
+ //# sourceMappingURL=agent-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-config.js","sourceRoot":"","sources":["../src/resources/agent-config.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/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
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { path } from "../internal/utils/path.mjs";
4
+ export class AgentConfig extends APIResource {
5
+ /**
6
+ * Write a new revision onto a channel. Writing production creates the key when it
7
+ * does not exist; writing staging stages a candidate that only Roark-recognized
8
+ * simulation sessions will read. Every write is a new revision; nothing is
9
+ * overwritten.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const agentConfig = await client.agentConfig.update('x', {
14
+ * channel: 'production',
15
+ * document: { foo: 'string' },
16
+ * });
17
+ * ```
18
+ */
19
+ update(key, body, options) {
20
+ return this._client.put(path `/v1/agent-config/${key}`, { body, ...options });
21
+ }
22
+ /**
23
+ * List the managed agent configs in this project, most recent first.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const agentConfigs = await client.agentConfig.list();
28
+ * ```
29
+ */
30
+ list(options) {
31
+ return this._client.get('/v1/agent-config', options);
32
+ }
33
+ /**
34
+ * Clear the staging channel. Production is untouched; recognized simulation
35
+ * sessions go back to reading production.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const response =
40
+ * await client.agentConfig.deleteStaging('x');
41
+ * ```
42
+ */
43
+ deleteStaging(key, options) {
44
+ return this._client.delete(path `/v1/agent-config/${key}/staging`, options);
45
+ }
46
+ /**
47
+ * Fetch one managed config with its channel pointers and recent revisions, newest
48
+ * first.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const response = await client.agentConfig.getByID('x');
53
+ * ```
54
+ */
55
+ getByID(key, options) {
56
+ return this._client.get(path `/v1/agent-config/${key}`, options);
57
+ }
58
+ /**
59
+ * Point the production channel at the staging revision. Real traffic reads it from
60
+ * the next session onward; roll back by writing the prior revision id to
61
+ * production (the chain preserves every state).
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const response = await client.agentConfig.promote('x');
66
+ * ```
67
+ */
68
+ promote(key, options) {
69
+ return this._client.post(path `/v1/agent-config/${key}/promote`, options);
70
+ }
71
+ /**
72
+ * The call your agent makes at session start. Returns the config JSON for this
73
+ * session, with per-session simulation recognition built in: when the session was
74
+ * originated by a Roark simulation (matched by caller number against the calls
75
+ * Roark has in flight), the STAGING revision is served for that session only, so
76
+ * Autoimprove candidates are tested on your real deployment. Real traffic always
77
+ * resolves to production; any recognition miss degrades to production too.
78
+ *
79
+ * On the first fetch of an unknown key, pass `defaults` (your baked-in config):
80
+ * the key is registered and the defaults become revision 1. That makes integration
81
+ * a single call.
82
+ *
83
+ * Cache the response per session; do not fetch per turn.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const response = await client.agentConfig.resolve('x');
88
+ * ```
89
+ */
90
+ resolve(key, body = {}, options) {
91
+ return this._client.post(path `/v1/agent-config/${key}/resolve`, { body, ...options });
92
+ }
93
+ }
94
+ //# sourceMappingURL=agent-config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-config.mjs","sourceRoot":"","sources":["../src/resources/agent-config.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAI/C,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CACJ,GAAW,EACX,IAA6B,EAC7B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,oBAAoB,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;;;;OASG;IACH,aAAa,CAAC,GAAW,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,oBAAoB,GAAG,UAAU,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,GAAW,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,oBAAoB,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;OASG;IACH,OAAO,CAAC,GAAW,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,oBAAoB,GAAG,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CACL,GAAW,EACX,OAAoD,EAAE,EACtD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,oBAAoB,GAAG,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;CACF"}
@@ -29,6 +29,20 @@ export declare class Agent extends APIResource {
29
29
  * ```
30
30
  */
31
31
  list(query?: AgentListParams | null | undefined, options?: RequestOptions): APIPromise<AgentListResponse>;
32
+ /**
33
+ * Creates a new Roark-hosted agent from a one-line job description. Roark authors
34
+ * the system prompt and hosts the config, so the agent is live and self-improvable
35
+ * from creation.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const response = await client.agent.build({
40
+ * jobDescription: 'x',
41
+ * name: 'x',
42
+ * });
43
+ * ```
44
+ */
45
+ build(body: AgentBuildParams, options?: RequestOptions): APIPromise<AgentBuildResponse>;
32
46
  /**
33
47
  * Returns a specific agent by its ID.
34
48
  *
@@ -147,6 +161,37 @@ export declare namespace AgentListResponse {
147
161
  total: number;
148
162
  }
149
163
  }
164
+ export interface AgentBuildResponse {
165
+ data: AgentBuildResponse.Data;
166
+ }
167
+ export declare namespace AgentBuildResponse {
168
+ interface Data {
169
+ /**
170
+ * Unique identifier of the agent
171
+ */
172
+ id: string;
173
+ /**
174
+ * Creation timestamp in ISO 8601 format
175
+ */
176
+ createdAt: string;
177
+ /**
178
+ * Custom identifier for the agent
179
+ */
180
+ customId: string | null;
181
+ /**
182
+ * Description of the agent
183
+ */
184
+ description: string | null;
185
+ /**
186
+ * Name of the agent
187
+ */
188
+ name: string;
189
+ /**
190
+ * Last update timestamp in ISO 8601 format
191
+ */
192
+ updatedAt: string;
193
+ }
194
+ }
150
195
  export interface AgentGetByIDResponse {
151
196
  data: AgentGetByIDResponse.Data;
152
197
  }
@@ -207,7 +252,22 @@ export interface AgentListParams {
207
252
  limit?: number;
208
253
  searchText?: string;
209
254
  }
255
+ export interface AgentBuildParams {
256
+ /**
257
+ * One-line description of what the agent should do. Roark authors the system
258
+ * prompt from this.
259
+ */
260
+ jobDescription: string;
261
+ /**
262
+ * Name of the agent
263
+ */
264
+ name: string;
265
+ /**
266
+ * Optional voice label for the hosted agent
267
+ */
268
+ voice?: string | null;
269
+ }
210
270
  export declare namespace Agent {
211
- export { type AgentCreateResponse as AgentCreateResponse, type AgentUpdateResponse as AgentUpdateResponse, type AgentListResponse as AgentListResponse, type AgentGetByIDResponse as AgentGetByIDResponse, type AgentCreateParams as AgentCreateParams, type AgentUpdateParams as AgentUpdateParams, type AgentListParams as AgentListParams, };
271
+ export { type AgentCreateResponse as AgentCreateResponse, type AgentUpdateResponse as AgentUpdateResponse, type AgentListResponse as AgentListResponse, type AgentBuildResponse as AgentBuildResponse, type AgentGetByIDResponse as AgentGetByIDResponse, type AgentCreateParams as AgentCreateParams, type AgentUpdateParams as AgentUpdateParams, type AgentListParams as AgentListParams, type AgentBuildParams as AgentBuildParams, };
212
272
  }
213
273
  //# sourceMappingURL=agent.d.mts.map