@getmodus/sdk 0.3.0 → 0.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 +6 -89
- package/README.md +4 -0
- package/dist/{chunk-D3NU2M6B.js → chunk-I56O44TR.js} +123 -3
- package/dist/chunk-I56O44TR.js.map +1 -0
- package/dist/{conversations-GNBMPpyr.d.cts → conversations-Cq6OVlpQ.d.cts} +371 -14
- package/dist/{conversations-GNBMPpyr.d.ts → conversations-Cq6OVlpQ.d.ts} +371 -14
- package/dist/index.cjs +476 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +484 -9
- package/dist/index.d.ts +484 -9
- package/dist/index.js +355 -1
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +568 -8
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +450 -6
- package/dist/management/index.d.ts +450 -6
- package/dist/management/index.js +447 -7
- package/dist/management/index.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-D3NU2M6B.js.map +0 -1
package/dist/management/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
omitUndefined,
|
|
10
10
|
validateId,
|
|
11
11
|
validatePageSize
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-I56O44TR.js";
|
|
13
13
|
|
|
14
14
|
// src/_query.ts
|
|
15
15
|
function updateMaskQuery(updateMask) {
|
|
@@ -60,6 +60,7 @@ var WorkflowInterfacesResource = class {
|
|
|
60
60
|
this.config = config;
|
|
61
61
|
this.workflowId = workflowId;
|
|
62
62
|
}
|
|
63
|
+
/** List interfaces attached to this workflow. */
|
|
63
64
|
async list() {
|
|
64
65
|
validateId(this.workflowId, "workflow_id");
|
|
65
66
|
const data = await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_list", {
|
|
@@ -67,6 +68,12 @@ var WorkflowInterfacesResource = class {
|
|
|
67
68
|
});
|
|
68
69
|
return data.interfaces;
|
|
69
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Add an interface to this workflow.
|
|
73
|
+
*
|
|
74
|
+
* @param options - Interface configuration to attach.
|
|
75
|
+
* @returns The created interface.
|
|
76
|
+
*/
|
|
70
77
|
async create(options) {
|
|
71
78
|
validateId(this.workflowId, "workflow_id");
|
|
72
79
|
return await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_add", {
|
|
@@ -74,6 +81,14 @@ var WorkflowInterfacesResource = class {
|
|
|
74
81
|
jsonBody: omitUndefined(options)
|
|
75
82
|
});
|
|
76
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Update an interface attached to this workflow.
|
|
86
|
+
*
|
|
87
|
+
* @param interfaceId - Interface id.
|
|
88
|
+
* @param options - Updated interface values.
|
|
89
|
+
* @param updateMask - Optional comma-separated field names to update.
|
|
90
|
+
* @returns The updated interface.
|
|
91
|
+
*/
|
|
77
92
|
async update(interfaceId, options, updateMask) {
|
|
78
93
|
validateId(this.workflowId, "workflow_id");
|
|
79
94
|
validateId(interfaceId, "interface_id");
|
|
@@ -83,6 +98,11 @@ var WorkflowInterfacesResource = class {
|
|
|
83
98
|
jsonBody: updateMask === void 0 ? omitUndefined(options) : options
|
|
84
99
|
});
|
|
85
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Delete an interface from this workflow.
|
|
103
|
+
*
|
|
104
|
+
* @param interfaceId - Interface id.
|
|
105
|
+
*/
|
|
86
106
|
async delete(interfaceId) {
|
|
87
107
|
validateId(this.workflowId, "workflow_id");
|
|
88
108
|
validateId(interfaceId, "interface_id");
|
|
@@ -90,6 +110,7 @@ var WorkflowInterfacesResource = class {
|
|
|
90
110
|
pathParams: { id: this.workflowId, interfaceId }
|
|
91
111
|
});
|
|
92
112
|
}
|
|
113
|
+
/** Delete every interface from this workflow. */
|
|
93
114
|
async deleteAll() {
|
|
94
115
|
validateId(this.workflowId, "workflow_id");
|
|
95
116
|
await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_deleteAll", {
|
|
@@ -129,6 +150,17 @@ var ManagementWorkflowsResource = class {
|
|
|
129
150
|
this.config = config;
|
|
130
151
|
this.ops = MANAGEMENT_WORKFLOW_OPERATIONS;
|
|
131
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* List workflows in the organization.
|
|
155
|
+
*
|
|
156
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
157
|
+
* @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
|
|
158
|
+
* @param options.search - Case-insensitive substring filter on the workflow name.
|
|
159
|
+
* @param options.type - Filter by workflow type: `"task"` or `"workflow"`.
|
|
160
|
+
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
161
|
+
* @param options.includeVariation - Include variation payload on each list row.
|
|
162
|
+
* @returns A page of workflows.
|
|
163
|
+
*/
|
|
132
164
|
list(options = {}) {
|
|
133
165
|
const pageSize = options.pageSize ?? 25;
|
|
134
166
|
validatePageSize(pageSize);
|
|
@@ -154,6 +186,13 @@ var ManagementWorkflowsResource = class {
|
|
|
154
186
|
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
155
187
|
);
|
|
156
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Retrieve a workflow with full configuration.
|
|
191
|
+
*
|
|
192
|
+
* @param workflowId - Workflow id.
|
|
193
|
+
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
194
|
+
* @returns The workflow.
|
|
195
|
+
*/
|
|
157
196
|
async get(workflowId, options = {}) {
|
|
158
197
|
validateId(workflowId, "workflow_id");
|
|
159
198
|
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
@@ -163,9 +202,28 @@ var ManagementWorkflowsResource = class {
|
|
|
163
202
|
});
|
|
164
203
|
return parseWorkflow(data);
|
|
165
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Interfaces attached to a workflow.
|
|
207
|
+
*
|
|
208
|
+
* @param workflowId - Workflow id.
|
|
209
|
+
* @returns An interfaces resource scoped to the workflow.
|
|
210
|
+
*/
|
|
166
211
|
interfaces(workflowId) {
|
|
167
212
|
return new WorkflowInterfacesResource(this.http, this.config, workflowId);
|
|
168
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Create a new workflow in the organization.
|
|
216
|
+
*
|
|
217
|
+
* @param options.name - Display name for the workflow.
|
|
218
|
+
* @param options.type - `"task"` for single-step orchestration, or `"workflow"` for a multi-step graph.
|
|
219
|
+
* @param options.trigger - Optional trigger configuration.
|
|
220
|
+
* @param options.guardrails - Runtime guardrail labels (for example `"no-pii"`). Omit to create with no guardrails.
|
|
221
|
+
* @returns The created workflow (draft).
|
|
222
|
+
* @example
|
|
223
|
+
* ```ts
|
|
224
|
+
* const wf = await mgmt.workflows.create({ name: 'Daily report', type: WorkflowType.Task })
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
169
227
|
async create(options) {
|
|
170
228
|
const body = omitUndefined({
|
|
171
229
|
name: options.name,
|
|
@@ -181,6 +239,17 @@ var ManagementWorkflowsResource = class {
|
|
|
181
239
|
});
|
|
182
240
|
return parseWorkflow(data);
|
|
183
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Update a workflow's configuration.
|
|
244
|
+
*
|
|
245
|
+
* Only the fields you pass are changed. To clear a field, name it in
|
|
246
|
+
* `updateMask` and leave its argument unset.
|
|
247
|
+
*
|
|
248
|
+
* @param workflowId - Workflow id.
|
|
249
|
+
* @param options.guardrails - Guardrail labels to set. Fetches the current workflow first to merge. Pass `[]` to clear all.
|
|
250
|
+
* @param options.updateMask - Comma-separated field names to update or clear.
|
|
251
|
+
* @returns The updated workflow.
|
|
252
|
+
*/
|
|
184
253
|
async update(workflowId, options = {}) {
|
|
185
254
|
validateId(workflowId, "workflow_id");
|
|
186
255
|
const accessConfig = await accessConfigBodyForUpdate(
|
|
@@ -208,6 +277,17 @@ var ManagementWorkflowsResource = class {
|
|
|
208
277
|
});
|
|
209
278
|
return parseWorkflow(data);
|
|
210
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* Publish the current draft of a workflow.
|
|
282
|
+
*
|
|
283
|
+
* @param workflowId - Workflow id.
|
|
284
|
+
* @returns The published workflow.
|
|
285
|
+
* @example
|
|
286
|
+
* ```ts
|
|
287
|
+
* await mgmt.workflows.update(workflowId, { description: 'Runs every morning' })
|
|
288
|
+
* const published = await mgmt.workflows.deploy(workflowId)
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
211
291
|
async deploy(workflowId) {
|
|
212
292
|
validateId(workflowId, "workflow_id");
|
|
213
293
|
const data = asRecord(
|
|
@@ -218,6 +298,13 @@ var ManagementWorkflowsResource = class {
|
|
|
218
298
|
);
|
|
219
299
|
return parseWorkflow(data.workflow);
|
|
220
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Enable or disable a workflow without deleting it.
|
|
303
|
+
*
|
|
304
|
+
* @param workflowId - Workflow id.
|
|
305
|
+
* @param options.active - `true` to activate, `false` to deactivate.
|
|
306
|
+
* @returns The updated workflow.
|
|
307
|
+
*/
|
|
221
308
|
async toggle(workflowId, options) {
|
|
222
309
|
validateId(workflowId, "workflow_id");
|
|
223
310
|
const data = await invokeWithRetry(this.config, this.http, this.ops.toggle, {
|
|
@@ -226,12 +313,24 @@ var ManagementWorkflowsResource = class {
|
|
|
226
313
|
});
|
|
227
314
|
return parseWorkflow(data);
|
|
228
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Delete a workflow.
|
|
318
|
+
*
|
|
319
|
+
* @param workflowId - Workflow id.
|
|
320
|
+
* @returns Resolves when the workflow is deleted.
|
|
321
|
+
*/
|
|
229
322
|
async delete(workflowId) {
|
|
230
323
|
validateId(workflowId, "workflow_id");
|
|
231
324
|
await invokeWithRetry(this.config, this.http, this.ops.delete, {
|
|
232
325
|
pathParams: { id: workflowId }
|
|
233
326
|
});
|
|
234
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Restore a previously deleted workflow.
|
|
330
|
+
*
|
|
331
|
+
* @param workflowId - Workflow id.
|
|
332
|
+
* @returns The restored workflow.
|
|
333
|
+
*/
|
|
235
334
|
async restore(workflowId) {
|
|
236
335
|
validateId(workflowId, "workflow_id");
|
|
237
336
|
const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
|
|
@@ -240,6 +339,13 @@ var ManagementWorkflowsResource = class {
|
|
|
240
339
|
});
|
|
241
340
|
return parseWorkflow(data);
|
|
242
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Start transferring ownership of a workflow to another organization member.
|
|
344
|
+
*
|
|
345
|
+
* @param workflowId - Workflow id.
|
|
346
|
+
* @param options.newOwnerUserId - User id of the proposed new owner.
|
|
347
|
+
* @returns The workflow with a pending ownership transfer.
|
|
348
|
+
*/
|
|
243
349
|
async requestOwnershipTransfer(workflowId, options) {
|
|
244
350
|
validateId(workflowId, "workflow_id");
|
|
245
351
|
const data = await invokeWithRetry(
|
|
@@ -253,6 +359,7 @@ var ManagementWorkflowsResource = class {
|
|
|
253
359
|
);
|
|
254
360
|
return parseWorkflow(data);
|
|
255
361
|
}
|
|
362
|
+
/** Cancel a pending workflow ownership transfer. */
|
|
256
363
|
async cancelOwnershipTransfer(workflowId) {
|
|
257
364
|
validateId(workflowId, "workflow_id");
|
|
258
365
|
const data = await invokeWithRetry(
|
|
@@ -263,6 +370,7 @@ var ManagementWorkflowsResource = class {
|
|
|
263
370
|
);
|
|
264
371
|
return parseWorkflow(data);
|
|
265
372
|
}
|
|
373
|
+
/** Accept a pending workflow ownership transfer. */
|
|
266
374
|
async acceptOwnershipTransfer(workflowId) {
|
|
267
375
|
validateId(workflowId, "workflow_id");
|
|
268
376
|
const data = await invokeWithRetry(
|
|
@@ -377,6 +485,14 @@ var ManagementContextItemsResource = class {
|
|
|
377
485
|
this.http = http;
|
|
378
486
|
this.config = config;
|
|
379
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* List context items in the knowledge base.
|
|
490
|
+
*
|
|
491
|
+
* @param options.pageSize - Items per page (default 25).
|
|
492
|
+
* @param options.pageToken - Token from a previous page's `nextPageToken`.
|
|
493
|
+
* @param options.contextType - Filter to one context type (for example `"note"`).
|
|
494
|
+
* @returns A page of context items.
|
|
495
|
+
*/
|
|
380
496
|
list(options = {}) {
|
|
381
497
|
const pageSize = options.pageSize ?? 25;
|
|
382
498
|
validatePageSize(pageSize);
|
|
@@ -395,12 +511,33 @@ var ManagementContextItemsResource = class {
|
|
|
395
511
|
(token) => this.listPage(pageSize, token, contextType)
|
|
396
512
|
);
|
|
397
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* Retrieve one context item by uid.
|
|
516
|
+
*
|
|
517
|
+
* @param uid - Context item uid.
|
|
518
|
+
* @returns The context item.
|
|
519
|
+
*/
|
|
398
520
|
async get(uid) {
|
|
399
521
|
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_get", {
|
|
400
522
|
pathParams: { uid }
|
|
401
523
|
});
|
|
402
524
|
return parseContextItem(data);
|
|
403
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Update a context item.
|
|
528
|
+
*
|
|
529
|
+
* Only the fields you pass are changed. To clear a field, name it in
|
|
530
|
+
* `updateMask` and leave its argument unset.
|
|
531
|
+
*
|
|
532
|
+
* @param uid - Context item uid.
|
|
533
|
+
* @param options.content - Replacement type-specific content.
|
|
534
|
+
* @param options.contextType - Item type (for example `"note"`). Required when `content` is supplied.
|
|
535
|
+
* @param options.description - New description.
|
|
536
|
+
* @param options.userFeedback - Feedback verdict: `"positive"`, `"neutral"`, or `"negative"`.
|
|
537
|
+
* @param options.topics - Replacement topic tags. Pass `[]` to clear all tags.
|
|
538
|
+
* @param options.updateMask - Comma-separated field names to update or clear.
|
|
539
|
+
* @returns The updated context item.
|
|
540
|
+
*/
|
|
404
541
|
async update(uid, options = {}) {
|
|
405
542
|
const body = options.updateMask !== void 0 ? {
|
|
406
543
|
content: options.content,
|
|
@@ -422,6 +559,12 @@ var ManagementContextItemsResource = class {
|
|
|
422
559
|
});
|
|
423
560
|
return this.get(uid);
|
|
424
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* Delete a context item.
|
|
564
|
+
*
|
|
565
|
+
* @param uid - Context item uid.
|
|
566
|
+
* @returns Deletion confirmation details.
|
|
567
|
+
*/
|
|
425
568
|
async delete(uid) {
|
|
426
569
|
const data = await invokeWithRetry(this.config, this.http, "ContextItemsController_delete", {
|
|
427
570
|
pathParams: { uid }
|
|
@@ -432,24 +575,51 @@ var ManagementContextItemsResource = class {
|
|
|
432
575
|
|
|
433
576
|
// src/management/context/context.ts
|
|
434
577
|
var ManagementContextResource = class {
|
|
578
|
+
/** @internal */
|
|
435
579
|
constructor(http, config) {
|
|
436
580
|
this.http = http;
|
|
437
581
|
this.config = config;
|
|
438
582
|
this.items = new ManagementContextItemsResource(http, config);
|
|
439
583
|
this.customItems = new CustomContextItemsResource(http, config);
|
|
440
584
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
585
|
+
/**
|
|
586
|
+
* Add a free-form text note to the knowledge base.
|
|
587
|
+
*
|
|
588
|
+
* @param title - Note title.
|
|
589
|
+
* @param content - Note body (markdown).
|
|
590
|
+
* @returns The created context item.
|
|
591
|
+
* @example
|
|
592
|
+
* ```ts
|
|
593
|
+
* const note = await mgmt.context.createNote('Runbook', '# Steps\n1. Check logs')
|
|
594
|
+
* ```
|
|
595
|
+
*/
|
|
447
596
|
createNote(title, content) {
|
|
448
597
|
return this.create("ContextCreatorsController_createNote", omitUndefined({ title, content }));
|
|
449
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* Update a note's title and markdown body.
|
|
601
|
+
*
|
|
602
|
+
* Preserves server-owned fields on the existing content blob. Pass `existing`
|
|
603
|
+
* to skip a fetch when you already have the item from a list call.
|
|
604
|
+
*
|
|
605
|
+
* @param uid - Context item uid.
|
|
606
|
+
* @param options.title - New title.
|
|
607
|
+
* @param options.body - New markdown body.
|
|
608
|
+
* @param options.existing - Optional cached item to avoid a GET.
|
|
609
|
+
* @returns The updated context item.
|
|
610
|
+
*/
|
|
450
611
|
updateNote(uid, options) {
|
|
451
612
|
return resolveAndUpdateNote(this.items, uid, options);
|
|
452
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
* Save a SQL query to the knowledge base.
|
|
616
|
+
*
|
|
617
|
+
* @param name - Display name for the query.
|
|
618
|
+
* @param options.connectionId - Connection the query runs against.
|
|
619
|
+
* @param options.query - SQL text.
|
|
620
|
+
* @param options.path - Optional hierarchy path segments.
|
|
621
|
+
* @returns The created context item.
|
|
622
|
+
*/
|
|
453
623
|
createSavedQuery(name, options) {
|
|
454
624
|
return this.create(
|
|
455
625
|
"ContextCreatorsController_createSavedQuery",
|
|
@@ -462,9 +632,27 @@ var ManagementContextResource = class {
|
|
|
462
632
|
})
|
|
463
633
|
);
|
|
464
634
|
}
|
|
635
|
+
/**
|
|
636
|
+
* Update a saved query's name, SQL, and optional connection metadata.
|
|
637
|
+
*
|
|
638
|
+
* @param uid - Context item uid.
|
|
639
|
+
* @param options.name - New display name.
|
|
640
|
+
* @param options.query - New SQL text.
|
|
641
|
+
* @param options.existing - Optional cached item to avoid a GET.
|
|
642
|
+
* @returns The updated context item.
|
|
643
|
+
*/
|
|
465
644
|
updateSavedQuery(uid, options) {
|
|
466
645
|
return resolveAndUpdateSavedQuery(this.items, uid, options);
|
|
467
646
|
}
|
|
647
|
+
/**
|
|
648
|
+
* Add a URL to the knowledge base.
|
|
649
|
+
*
|
|
650
|
+
* @param url - Link URL.
|
|
651
|
+
* @param options.title - Optional display title.
|
|
652
|
+
* @param options.isCrawl - When true, crawl linked pages into context.
|
|
653
|
+
* @param options.pageLimit - Maximum pages to crawl when `isCrawl` is true.
|
|
654
|
+
* @returns The created context item.
|
|
655
|
+
*/
|
|
468
656
|
createLink(url, options = {}) {
|
|
469
657
|
return this.create(
|
|
470
658
|
"ContextCreatorsController_createLink",
|
|
@@ -476,9 +664,27 @@ var ManagementContextResource = class {
|
|
|
476
664
|
})
|
|
477
665
|
);
|
|
478
666
|
}
|
|
667
|
+
/**
|
|
668
|
+
* Update link metadata on an existing item.
|
|
669
|
+
*
|
|
670
|
+
* Merges `title` and/or `url` into the stored content blob. Does not re-fetch or re-crawl the URL.
|
|
671
|
+
*
|
|
672
|
+
* @param uid - Context item uid.
|
|
673
|
+
* @param options.title - New display title.
|
|
674
|
+
* @param options.url - New URL.
|
|
675
|
+
* @param options.existing - Optional cached item to avoid a GET.
|
|
676
|
+
* @returns The updated context item.
|
|
677
|
+
*/
|
|
479
678
|
updateLink(uid, options) {
|
|
480
679
|
return resolveAndUpdateLink(this.items, uid, options);
|
|
481
680
|
}
|
|
681
|
+
/** @internal */
|
|
682
|
+
async create(operationId, payload) {
|
|
683
|
+
const data = await invokeWithRetry(this.config, this.http, operationId, {
|
|
684
|
+
jsonBody: payload
|
|
685
|
+
});
|
|
686
|
+
return withCreatedUid(data);
|
|
687
|
+
}
|
|
482
688
|
};
|
|
483
689
|
|
|
484
690
|
// src/management/scopes/memories.ts
|
|
@@ -491,6 +697,14 @@ var ScopeMemoriesResource = class {
|
|
|
491
697
|
this.config = config;
|
|
492
698
|
this.scopeId = scopeId;
|
|
493
699
|
}
|
|
700
|
+
/**
|
|
701
|
+
* List memories stored for this scope.
|
|
702
|
+
*
|
|
703
|
+
* @param options.pageSize - Items per page (default 25).
|
|
704
|
+
* @param options.pageToken - Token from a previous page's `nextPageToken`.
|
|
705
|
+
* @param options.userId - Optional end-user id when memories are scoped per user.
|
|
706
|
+
* @returns A page of memories.
|
|
707
|
+
*/
|
|
494
708
|
list(options = {}) {
|
|
495
709
|
const pageSize = options.pageSize ?? 25;
|
|
496
710
|
validatePageSize(pageSize);
|
|
@@ -513,6 +727,12 @@ var ScopeMemoriesResource = class {
|
|
|
513
727
|
(token) => this.listPage(pageSize, token, userId)
|
|
514
728
|
);
|
|
515
729
|
}
|
|
730
|
+
/**
|
|
731
|
+
* Search this scope's memories by natural-language query.
|
|
732
|
+
*
|
|
733
|
+
* @param request - Query text and optional `userId` / `limit`.
|
|
734
|
+
* @returns Matching memories and relevance scores.
|
|
735
|
+
*/
|
|
516
736
|
async search(request) {
|
|
517
737
|
validateId(this.scopeId, "scope_id");
|
|
518
738
|
const data = await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_search", {
|
|
@@ -521,6 +741,14 @@ var ScopeMemoriesResource = class {
|
|
|
521
741
|
});
|
|
522
742
|
return data;
|
|
523
743
|
}
|
|
744
|
+
/**
|
|
745
|
+
* Update one memory. Requires manage permission on the scope.
|
|
746
|
+
*
|
|
747
|
+
* @param memoryId - Id from list or search.
|
|
748
|
+
* @param update - Fields to change (`memory` and/or `metadata`).
|
|
749
|
+
* @param options.updateMask - Optional comma-separated field names to update.
|
|
750
|
+
* @returns The updated memory.
|
|
751
|
+
*/
|
|
524
752
|
async update(memoryId, update, options = {}) {
|
|
525
753
|
validateId(memoryId, "memory_id");
|
|
526
754
|
validateId(this.scopeId, "scope_id");
|
|
@@ -531,6 +759,7 @@ var ScopeMemoriesResource = class {
|
|
|
531
759
|
});
|
|
532
760
|
return parseMemory(data);
|
|
533
761
|
}
|
|
762
|
+
/** Delete one memory (idempotent). */
|
|
534
763
|
async delete(memoryId) {
|
|
535
764
|
validateId(memoryId, "memory_id");
|
|
536
765
|
validateId(this.scopeId, "scope_id");
|
|
@@ -553,6 +782,7 @@ var ScopeEvaluationsResource = class {
|
|
|
553
782
|
this.config = config;
|
|
554
783
|
this.scopeId = scopeId;
|
|
555
784
|
}
|
|
785
|
+
/** Get the evaluation configuration for this scope. */
|
|
556
786
|
async getConfig() {
|
|
557
787
|
validateId(this.scopeId, "scope_id");
|
|
558
788
|
const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_getConfig", {
|
|
@@ -560,6 +790,12 @@ var ScopeEvaluationsResource = class {
|
|
|
560
790
|
});
|
|
561
791
|
return parseConfig(data);
|
|
562
792
|
}
|
|
793
|
+
/**
|
|
794
|
+
* Update the evaluation configuration for this scope.
|
|
795
|
+
*
|
|
796
|
+
* @param update - Configuration fields to change.
|
|
797
|
+
* @returns The updated evaluation configuration.
|
|
798
|
+
*/
|
|
563
799
|
async updateConfig(update) {
|
|
564
800
|
validateId(this.scopeId, "scope_id");
|
|
565
801
|
const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_updateConfig", {
|
|
@@ -568,6 +804,11 @@ var ScopeEvaluationsResource = class {
|
|
|
568
804
|
});
|
|
569
805
|
return parseConfig(data);
|
|
570
806
|
}
|
|
807
|
+
/**
|
|
808
|
+
* Trigger a manual evaluation run for this scope.
|
|
809
|
+
*
|
|
810
|
+
* @returns The triggered run id and status.
|
|
811
|
+
*/
|
|
571
812
|
async triggerRun() {
|
|
572
813
|
validateId(this.scopeId, "scope_id");
|
|
573
814
|
const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_triggerRun", {
|
|
@@ -575,6 +816,13 @@ var ScopeEvaluationsResource = class {
|
|
|
575
816
|
});
|
|
576
817
|
return data;
|
|
577
818
|
}
|
|
819
|
+
/**
|
|
820
|
+
* List evaluation runs for this scope.
|
|
821
|
+
*
|
|
822
|
+
* @param options.pageSize - Items per page (default 25).
|
|
823
|
+
* @param options.pageToken - Token from a previous page's `nextPageToken`.
|
|
824
|
+
* @returns A page of evaluation runs.
|
|
825
|
+
*/
|
|
578
826
|
listRuns(options = {}) {
|
|
579
827
|
const pageSize = options.pageSize ?? 25;
|
|
580
828
|
validatePageSize(pageSize);
|
|
@@ -590,6 +838,12 @@ var ScopeEvaluationsResource = class {
|
|
|
590
838
|
);
|
|
591
839
|
return buildAipPage(data, "runs", parseRun, (token) => this.listRunsPage(pageSize, token));
|
|
592
840
|
}
|
|
841
|
+
/**
|
|
842
|
+
* Retrieve one evaluation run with full results.
|
|
843
|
+
*
|
|
844
|
+
* @param runId - Evaluation run id.
|
|
845
|
+
* @returns The run and its result details.
|
|
846
|
+
*/
|
|
593
847
|
async getRun(runId) {
|
|
594
848
|
validateId(this.scopeId, "scope_id");
|
|
595
849
|
validateId(runId, "run_id");
|
|
@@ -607,6 +861,12 @@ var ScopeSupervisionResource = class {
|
|
|
607
861
|
this.config = config;
|
|
608
862
|
this.scopeId = scopeId;
|
|
609
863
|
}
|
|
864
|
+
/**
|
|
865
|
+
* Get this scope's supervision configuration.
|
|
866
|
+
*
|
|
867
|
+
* @param options.view - Optional scope variation to inspect.
|
|
868
|
+
* @returns The supervision configuration.
|
|
869
|
+
*/
|
|
610
870
|
async get(options = {}) {
|
|
611
871
|
validateId(this.scopeId, "scope_id");
|
|
612
872
|
return await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_get", {
|
|
@@ -614,9 +874,21 @@ var ScopeSupervisionResource = class {
|
|
|
614
874
|
query: options.view === void 0 ? void 0 : { view: options.view }
|
|
615
875
|
});
|
|
616
876
|
}
|
|
877
|
+
/**
|
|
878
|
+
* Replace this scope's subordinate scopes.
|
|
879
|
+
*
|
|
880
|
+
* @param request - Replacement supervision configuration.
|
|
881
|
+
* @returns The updated supervision configuration.
|
|
882
|
+
*/
|
|
617
883
|
async set(request) {
|
|
618
884
|
return this.write("ScopeSupervisionController_set", request);
|
|
619
885
|
}
|
|
886
|
+
/**
|
|
887
|
+
* Replace subordinate scopes on the active (deployed) scope version.
|
|
888
|
+
*
|
|
889
|
+
* @param request - Replacement supervision configuration.
|
|
890
|
+
* @returns The updated supervision configuration.
|
|
891
|
+
*/
|
|
620
892
|
async setActive(request) {
|
|
621
893
|
return this.write("ScopeSupervisionController_setActive", request);
|
|
622
894
|
}
|
|
@@ -655,23 +927,58 @@ function parseScope(raw) {
|
|
|
655
927
|
return raw;
|
|
656
928
|
}
|
|
657
929
|
var ManagementScopesResource = class {
|
|
930
|
+
/** @internal */
|
|
658
931
|
constructor(http, config) {
|
|
659
932
|
this.http = http;
|
|
660
933
|
this.config = config;
|
|
661
934
|
this.ops = MANAGEMENT_SCOPE_OPERATIONS;
|
|
662
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* Conversations for a scope.
|
|
938
|
+
*
|
|
939
|
+
* @param scopeId - Scope id.
|
|
940
|
+
* @returns A conversations resource scoped to the scope.
|
|
941
|
+
*/
|
|
663
942
|
conversations(scopeId) {
|
|
664
943
|
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
665
944
|
}
|
|
945
|
+
/**
|
|
946
|
+
* Long-term memories for a scope.
|
|
947
|
+
*
|
|
948
|
+
* @param scopeId - Scope id.
|
|
949
|
+
* @returns A memories resource scoped to the scope.
|
|
950
|
+
*/
|
|
666
951
|
memories(scopeId) {
|
|
667
952
|
return new ScopeMemoriesResource(this.http, this.config, scopeId);
|
|
668
953
|
}
|
|
954
|
+
/**
|
|
955
|
+
* Evaluations for a scope.
|
|
956
|
+
*
|
|
957
|
+
* @param scopeId - Scope id.
|
|
958
|
+
* @returns An evaluations resource scoped to the scope.
|
|
959
|
+
*/
|
|
669
960
|
evaluations(scopeId) {
|
|
670
961
|
return new ScopeEvaluationsResource(this.http, this.config, scopeId);
|
|
671
962
|
}
|
|
963
|
+
/**
|
|
964
|
+
* Supervision (subordinate scopes) for a scope.
|
|
965
|
+
*
|
|
966
|
+
* @param scopeId - Scope id.
|
|
967
|
+
* @returns A supervision resource scoped to the scope.
|
|
968
|
+
*/
|
|
672
969
|
supervision(scopeId) {
|
|
673
970
|
return new ScopeSupervisionResource(this.http, this.config, scopeId);
|
|
674
971
|
}
|
|
972
|
+
/**
|
|
973
|
+
* List scopes in the organization.
|
|
974
|
+
*
|
|
975
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
976
|
+
* @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
|
|
977
|
+
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
978
|
+
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
979
|
+
* @param options.managerId - Return only scopes supervised by this manager scope id.
|
|
980
|
+
* @returns A page of scopes.
|
|
981
|
+
*/
|
|
675
982
|
list(options = {}) {
|
|
676
983
|
const pageSize = options.pageSize ?? 25;
|
|
677
984
|
validatePageSize(pageSize);
|
|
@@ -696,6 +1003,13 @@ var ManagementScopesResource = class {
|
|
|
696
1003
|
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
697
1004
|
);
|
|
698
1005
|
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Retrieve a scope with full configuration.
|
|
1008
|
+
*
|
|
1009
|
+
* @param scopeId - Scope id.
|
|
1010
|
+
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
1011
|
+
* @returns The scope.
|
|
1012
|
+
*/
|
|
699
1013
|
async get(scopeId, options = {}) {
|
|
700
1014
|
validateId(scopeId, "scope_id");
|
|
701
1015
|
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
@@ -705,6 +1019,21 @@ var ManagementScopesResource = class {
|
|
|
705
1019
|
});
|
|
706
1020
|
return parseScope(data);
|
|
707
1021
|
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Create a new scope in the organization.
|
|
1024
|
+
*
|
|
1025
|
+
* @param options.name - Display name for the scope.
|
|
1026
|
+
* @param options.description - Optional description.
|
|
1027
|
+
* @param options.instructions - Optional system instructions.
|
|
1028
|
+
* @param options.model - Optional model id.
|
|
1029
|
+
* @param options.toolset - Optional tool selection for the scope.
|
|
1030
|
+
* @param options.guardrails - Runtime guardrail labels (for example `"no-pii"`). Omit to create with no guardrails.
|
|
1031
|
+
* @returns The created scope (draft).
|
|
1032
|
+
* @example
|
|
1033
|
+
* ```ts
|
|
1034
|
+
* const scope = await mgmt.scopes.create({ name: 'Support assistant', model: 'claude-sonnet-5' })
|
|
1035
|
+
* ```
|
|
1036
|
+
*/
|
|
708
1037
|
async create(options) {
|
|
709
1038
|
const body = omitUndefined({
|
|
710
1039
|
name: options.name,
|
|
@@ -723,6 +1052,17 @@ var ManagementScopesResource = class {
|
|
|
723
1052
|
});
|
|
724
1053
|
return parseScope(data);
|
|
725
1054
|
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Update a scope's configuration.
|
|
1057
|
+
*
|
|
1058
|
+
* Only the fields you pass are changed. To clear a field, name it in
|
|
1059
|
+
* `updateMask` (comma-separated field names) and leave its argument unset.
|
|
1060
|
+
*
|
|
1061
|
+
* @param scopeId - Scope id.
|
|
1062
|
+
* @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.
|
|
1063
|
+
* @param options.updateMask - Comma-separated field names to update or clear.
|
|
1064
|
+
* @returns The updated scope.
|
|
1065
|
+
*/
|
|
726
1066
|
async update(scopeId, options = {}) {
|
|
727
1067
|
validateId(scopeId, "scope_id");
|
|
728
1068
|
const accessConfig = await accessConfigBodyForUpdate(
|
|
@@ -756,6 +1096,17 @@ var ManagementScopesResource = class {
|
|
|
756
1096
|
});
|
|
757
1097
|
return parseScope(data);
|
|
758
1098
|
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Publish the current draft of a scope.
|
|
1101
|
+
*
|
|
1102
|
+
* @param scopeId - Scope id.
|
|
1103
|
+
* @returns The published scope.
|
|
1104
|
+
* @example
|
|
1105
|
+
* ```ts
|
|
1106
|
+
* await mgmt.scopes.update(scopeId, { instructions: ['Be concise.'] })
|
|
1107
|
+
* const published = await mgmt.scopes.deploy(scopeId)
|
|
1108
|
+
* ```
|
|
1109
|
+
*/
|
|
759
1110
|
async deploy(scopeId) {
|
|
760
1111
|
validateId(scopeId, "scope_id");
|
|
761
1112
|
const data = asRecord(
|
|
@@ -766,12 +1117,24 @@ var ManagementScopesResource = class {
|
|
|
766
1117
|
);
|
|
767
1118
|
return parseScope(data.scope);
|
|
768
1119
|
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Delete a scope.
|
|
1122
|
+
*
|
|
1123
|
+
* @param scopeId - Scope id.
|
|
1124
|
+
* @returns Resolves when the scope is deleted.
|
|
1125
|
+
*/
|
|
769
1126
|
async delete(scopeId) {
|
|
770
1127
|
validateId(scopeId, "scope_id");
|
|
771
1128
|
await invokeWithRetry(this.config, this.http, this.ops.delete, {
|
|
772
1129
|
pathParams: { id: scopeId }
|
|
773
1130
|
});
|
|
774
1131
|
}
|
|
1132
|
+
/**
|
|
1133
|
+
* Restore a previously deleted scope.
|
|
1134
|
+
*
|
|
1135
|
+
* @param scopeId - Scope id.
|
|
1136
|
+
* @returns The restored scope.
|
|
1137
|
+
*/
|
|
775
1138
|
async restore(scopeId) {
|
|
776
1139
|
validateId(scopeId, "scope_id");
|
|
777
1140
|
const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
|
|
@@ -780,6 +1143,13 @@ var ManagementScopesResource = class {
|
|
|
780
1143
|
});
|
|
781
1144
|
return parseScope(data);
|
|
782
1145
|
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Start transferring ownership of a scope to another organization member.
|
|
1148
|
+
*
|
|
1149
|
+
* @param scopeId - Scope id.
|
|
1150
|
+
* @param options.newOwnerUserId - User id of the proposed new owner.
|
|
1151
|
+
* @returns The scope with a pending ownership transfer.
|
|
1152
|
+
*/
|
|
783
1153
|
async requestOwnershipTransfer(scopeId, options) {
|
|
784
1154
|
validateId(scopeId, "scope_id");
|
|
785
1155
|
const data = await invokeWithRetry(
|
|
@@ -793,6 +1163,7 @@ var ManagementScopesResource = class {
|
|
|
793
1163
|
);
|
|
794
1164
|
return parseScope(data);
|
|
795
1165
|
}
|
|
1166
|
+
/** Cancel a pending scope ownership transfer. */
|
|
796
1167
|
async cancelOwnershipTransfer(scopeId) {
|
|
797
1168
|
validateId(scopeId, "scope_id");
|
|
798
1169
|
const data = await invokeWithRetry(
|
|
@@ -803,6 +1174,7 @@ var ManagementScopesResource = class {
|
|
|
803
1174
|
);
|
|
804
1175
|
return parseScope(data);
|
|
805
1176
|
}
|
|
1177
|
+
/** Accept a pending scope ownership transfer. */
|
|
806
1178
|
async acceptOwnershipTransfer(scopeId) {
|
|
807
1179
|
validateId(scopeId, "scope_id");
|
|
808
1180
|
const data = await invokeWithRetry(
|
|
@@ -813,6 +1185,12 @@ var ManagementScopesResource = class {
|
|
|
813
1185
|
);
|
|
814
1186
|
return parseScope(data);
|
|
815
1187
|
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Update MCP server configuration for a scope.
|
|
1190
|
+
*
|
|
1191
|
+
* @param scopeId - Scope id.
|
|
1192
|
+
* @param options.mcpConfig - MCP configuration object.
|
|
1193
|
+
*/
|
|
816
1194
|
async patchMcpConfig(scopeId, options) {
|
|
817
1195
|
validateId(scopeId, "scope_id");
|
|
818
1196
|
await invokeWithRetry(this.config, this.http, this.ops.patchMcpConfig, {
|
|
@@ -820,6 +1198,13 @@ var ManagementScopesResource = class {
|
|
|
820
1198
|
jsonBody: omitUndefined({ config: options.mcpConfig })
|
|
821
1199
|
});
|
|
822
1200
|
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Retrieve a specific scope variation by uid.
|
|
1203
|
+
*
|
|
1204
|
+
* @param scopeId - Scope id.
|
|
1205
|
+
* @param options.variationUid - Variation uid.
|
|
1206
|
+
* @returns The scope variation.
|
|
1207
|
+
*/
|
|
823
1208
|
async getVariation(scopeId, options) {
|
|
824
1209
|
validateId(scopeId, "scope_id");
|
|
825
1210
|
validateId(options.variationUid, "variation_uid");
|
|
@@ -836,6 +1221,18 @@ var ManagementUsageResource = class {
|
|
|
836
1221
|
this.http = http;
|
|
837
1222
|
this.config = config;
|
|
838
1223
|
}
|
|
1224
|
+
/**
|
|
1225
|
+
* List usage metrics for your organization over a time window.
|
|
1226
|
+
*
|
|
1227
|
+
* @param options.since - Start of the window (ISO 8601, inclusive).
|
|
1228
|
+
* @param options.until - End of the window (ISO 8601, exclusive).
|
|
1229
|
+
* @param options.rollup - Bucket size for each row: `"hour"` or `"day"`.
|
|
1230
|
+
* @param options.model - Optional filter to a single model name.
|
|
1231
|
+
* @param options.userEmail - Optional filter to one or more acting-user emails.
|
|
1232
|
+
* @returns Usage report rows for the window.
|
|
1233
|
+
* @throws {UnprocessableError} When the request is rejected by the API.
|
|
1234
|
+
* @throws {AuthenticationError} When the API key is invalid or missing.
|
|
1235
|
+
*/
|
|
839
1236
|
async list(options) {
|
|
840
1237
|
const query = {
|
|
841
1238
|
since: options.since,
|
|
@@ -847,6 +1244,15 @@ var ManagementUsageResource = class {
|
|
|
847
1244
|
const data = await invokeWithRetry(this.config, this.http, "UsageController_list", { query });
|
|
848
1245
|
return data;
|
|
849
1246
|
}
|
|
1247
|
+
/**
|
|
1248
|
+
* List distinct acting-user emails observed in a time window.
|
|
1249
|
+
*
|
|
1250
|
+
* @param options.since - Start of the window (ISO 8601, inclusive).
|
|
1251
|
+
* @param options.until - End of the window (ISO 8601, exclusive).
|
|
1252
|
+
* @returns User emails seen in usage during the window.
|
|
1253
|
+
* @throws {UnprocessableError} When the request is rejected by the API.
|
|
1254
|
+
* @throws {AuthenticationError} When the API key is invalid or missing.
|
|
1255
|
+
*/
|
|
850
1256
|
async listUsers(options) {
|
|
851
1257
|
const query = {
|
|
852
1258
|
since: options.since,
|
|
@@ -859,12 +1265,44 @@ var ManagementUsageResource = class {
|
|
|
859
1265
|
}
|
|
860
1266
|
};
|
|
861
1267
|
|
|
1268
|
+
// src/management/tools.ts
|
|
1269
|
+
function parseToolCatalogEntry(raw) {
|
|
1270
|
+
return raw;
|
|
1271
|
+
}
|
|
1272
|
+
var ManagementToolsResource = class {
|
|
1273
|
+
constructor(http, config) {
|
|
1274
|
+
this.http = http;
|
|
1275
|
+
this.config = config;
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* List tool and integration surfaces a scope can select in its toolset.
|
|
1279
|
+
*
|
|
1280
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
1281
|
+
* @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
|
|
1282
|
+
* @returns A page of tool catalog entries.
|
|
1283
|
+
*/
|
|
1284
|
+
list(options = {}) {
|
|
1285
|
+
const pageSize = options.pageSize ?? 25;
|
|
1286
|
+
validatePageSize(pageSize);
|
|
1287
|
+
return this.listPage(pageSize, options.pageToken);
|
|
1288
|
+
}
|
|
1289
|
+
async listPage(pageSize, pageToken) {
|
|
1290
|
+
const data = asRecord(
|
|
1291
|
+
await invokeWithRetry(this.config, this.http, "ToolsController_list", {
|
|
1292
|
+
query: aipListParams(pageSize, pageToken)
|
|
1293
|
+
})
|
|
1294
|
+
);
|
|
1295
|
+
return buildAipPage(data, "tools", parseToolCatalogEntry, (token) => this.listPage(pageSize, token));
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
|
|
862
1299
|
// src/management/users.ts
|
|
863
1300
|
var ManagementUsersResource = class {
|
|
864
1301
|
constructor(http, config) {
|
|
865
1302
|
this.http = http;
|
|
866
1303
|
this.config = config;
|
|
867
1304
|
}
|
|
1305
|
+
/** List member groups in the organization. */
|
|
868
1306
|
async listMemberGroups() {
|
|
869
1307
|
const data = await invokeWithRetry(
|
|
870
1308
|
this.config,
|
|
@@ -873,6 +1311,7 @@ var ManagementUsersResource = class {
|
|
|
873
1311
|
);
|
|
874
1312
|
return data.groups;
|
|
875
1313
|
}
|
|
1314
|
+
/** List organization members. */
|
|
876
1315
|
async listOrgMembers() {
|
|
877
1316
|
const data = await invokeWithRetry(
|
|
878
1317
|
this.config,
|
|
@@ -891,6 +1330,7 @@ var ModusManagement = class extends ModusClientBase {
|
|
|
891
1330
|
this.workflows = new ManagementWorkflowsResource(this.http, this.config);
|
|
892
1331
|
this.context = new ManagementContextResource(this.http, this.config);
|
|
893
1332
|
this.usage = new ManagementUsageResource(this.http, this.config);
|
|
1333
|
+
this.tools = new ManagementToolsResource(this.http, this.config);
|
|
894
1334
|
this.users = new ManagementUsersResource(this.http, this.config);
|
|
895
1335
|
}
|
|
896
1336
|
};
|