@getmodus/sdk 0.2.3 → 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.
@@ -9,7 +9,7 @@ import {
9
9
  omitUndefined,
10
10
  validateId,
11
11
  validatePageSize
12
- } from "../chunk-ZFZQ2UMA.js";
12
+ } from "../chunk-I56O44TR.js";
13
13
 
14
14
  // src/_query.ts
15
15
  function updateMaskQuery(updateMask) {
@@ -53,13 +53,14 @@ async function accessConfigBodyForUpdate(guardrails, loadResource) {
53
53
  return accessConfigWireForUpdate(existing, guardrails);
54
54
  }
55
55
 
56
- // src/management/agents/interfaces.ts
56
+ // src/management/workflows/interfaces.ts
57
57
  var WorkflowInterfacesResource = class {
58
58
  constructor(http, config, workflowId) {
59
59
  this.http = http;
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", {
@@ -98,7 +119,7 @@ var WorkflowInterfacesResource = class {
98
119
  }
99
120
  };
100
121
 
101
- // src/management/agents/agents.ts
122
+ // src/management/workflows/agents.ts
102
123
  var MANAGEMENT_WORKFLOW_OPERATIONS = {
103
124
  list: "WorkflowsController_list",
104
125
  get: "WorkflowsController_get",
@@ -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);
@@ -149,11 +181,18 @@ var ManagementWorkflowsResource = class {
149
181
  );
150
182
  return buildAipPage(
151
183
  data,
152
- "agents",
184
+ "workflows",
153
185
  parseWorkflow,
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(
@@ -216,8 +296,15 @@ var ManagementWorkflowsResource = class {
216
296
  jsonBody: {}
217
297
  })
218
298
  );
219
- return parseWorkflow(data.agent);
220
- }
299
+ return parseWorkflow(data.workflow);
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
- async create(operationId, payload) {
442
- const data = await invokeWithRetry(this.config, this.http, operationId, {
443
- jsonBody: payload
444
- });
445
- return withCreatedUid(data);
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,23 +664,30 @@ 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
  }
482
- };
483
-
484
- // src/management/organization.ts
485
- var ManagementOrganizationResource = class {
486
- constructor(http, config) {
487
- this.http = http;
488
- this.config = config;
489
- }
490
- async delete() {
491
- await invokeWithRetry(this.config, this.http, "OrganizationController_deleteOrganization");
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);
492
687
  }
493
688
  };
494
689
 
495
- // src/management/skills/memories.ts
690
+ // src/management/scopes/memories.ts
496
691
  function parseMemory(raw) {
497
692
  return raw;
498
693
  }
@@ -502,6 +697,14 @@ var ScopeMemoriesResource = class {
502
697
  this.config = config;
503
698
  this.scopeId = scopeId;
504
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
+ */
505
708
  list(options = {}) {
506
709
  const pageSize = options.pageSize ?? 25;
507
710
  validatePageSize(pageSize);
@@ -524,6 +727,12 @@ var ScopeMemoriesResource = class {
524
727
  (token) => this.listPage(pageSize, token, userId)
525
728
  );
526
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
+ */
527
736
  async search(request) {
528
737
  validateId(this.scopeId, "scope_id");
529
738
  const data = await invokeWithRetry(this.config, this.http, "ScopeMemoriesController_search", {
@@ -532,6 +741,14 @@ var ScopeMemoriesResource = class {
532
741
  });
533
742
  return data;
534
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
+ */
535
752
  async update(memoryId, update, options = {}) {
536
753
  validateId(memoryId, "memory_id");
537
754
  validateId(this.scopeId, "scope_id");
@@ -542,6 +759,7 @@ var ScopeMemoriesResource = class {
542
759
  });
543
760
  return parseMemory(data);
544
761
  }
762
+ /** Delete one memory (idempotent). */
545
763
  async delete(memoryId) {
546
764
  validateId(memoryId, "memory_id");
547
765
  validateId(this.scopeId, "scope_id");
@@ -551,7 +769,7 @@ var ScopeMemoriesResource = class {
551
769
  }
552
770
  };
553
771
 
554
- // src/management/skills/evaluations.ts
772
+ // src/management/scopes/evaluations.ts
555
773
  function parseConfig(raw) {
556
774
  return raw;
557
775
  }
@@ -564,6 +782,7 @@ var ScopeEvaluationsResource = class {
564
782
  this.config = config;
565
783
  this.scopeId = scopeId;
566
784
  }
785
+ /** Get the evaluation configuration for this scope. */
567
786
  async getConfig() {
568
787
  validateId(this.scopeId, "scope_id");
569
788
  const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_getConfig", {
@@ -571,6 +790,12 @@ var ScopeEvaluationsResource = class {
571
790
  });
572
791
  return parseConfig(data);
573
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
+ */
574
799
  async updateConfig(update) {
575
800
  validateId(this.scopeId, "scope_id");
576
801
  const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_updateConfig", {
@@ -579,6 +804,11 @@ var ScopeEvaluationsResource = class {
579
804
  });
580
805
  return parseConfig(data);
581
806
  }
807
+ /**
808
+ * Trigger a manual evaluation run for this scope.
809
+ *
810
+ * @returns The triggered run id and status.
811
+ */
582
812
  async triggerRun() {
583
813
  validateId(this.scopeId, "scope_id");
584
814
  const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_triggerRun", {
@@ -586,6 +816,13 @@ var ScopeEvaluationsResource = class {
586
816
  });
587
817
  return data;
588
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
+ */
589
826
  listRuns(options = {}) {
590
827
  const pageSize = options.pageSize ?? 25;
591
828
  validatePageSize(pageSize);
@@ -601,6 +838,12 @@ var ScopeEvaluationsResource = class {
601
838
  );
602
839
  return buildAipPage(data, "runs", parseRun, (token) => this.listRunsPage(pageSize, token));
603
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
+ */
604
847
  async getRun(runId) {
605
848
  validateId(this.scopeId, "scope_id");
606
849
  validateId(runId, "run_id");
@@ -611,13 +854,19 @@ var ScopeEvaluationsResource = class {
611
854
  }
612
855
  };
613
856
 
614
- // src/management/skills/supervision.ts
857
+ // src/management/scopes/supervision.ts
615
858
  var ScopeSupervisionResource = class {
616
859
  constructor(http, config, scopeId) {
617
860
  this.http = http;
618
861
  this.config = config;
619
862
  this.scopeId = scopeId;
620
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
+ */
621
870
  async get(options = {}) {
622
871
  validateId(this.scopeId, "scope_id");
623
872
  return await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_get", {
@@ -625,9 +874,21 @@ var ScopeSupervisionResource = class {
625
874
  query: options.view === void 0 ? void 0 : { view: options.view }
626
875
  });
627
876
  }
877
+ /**
878
+ * Replace this scope's subordinate scopes.
879
+ *
880
+ * @param request - Replacement supervision configuration.
881
+ * @returns The updated supervision configuration.
882
+ */
628
883
  async set(request) {
629
884
  return this.write("ScopeSupervisionController_set", request);
630
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
+ */
631
892
  async setActive(request) {
632
893
  return this.write("ScopeSupervisionController_setActive", request);
633
894
  }
@@ -640,7 +901,7 @@ var ScopeSupervisionResource = class {
640
901
  }
641
902
  };
642
903
 
643
- // src/management/skills/skills.ts
904
+ // src/management/scopes/skills.ts
644
905
  var MANAGEMENT_SCOPE_OPERATIONS = {
645
906
  list: "ScopesController_list",
646
907
  get: "ScopesController_get",
@@ -666,23 +927,58 @@ function parseScope(raw) {
666
927
  return raw;
667
928
  }
668
929
  var ManagementScopesResource = class {
930
+ /** @internal */
669
931
  constructor(http, config) {
670
932
  this.http = http;
671
933
  this.config = config;
672
934
  this.ops = MANAGEMENT_SCOPE_OPERATIONS;
673
935
  }
936
+ /**
937
+ * Conversations for a scope.
938
+ *
939
+ * @param scopeId - Scope id.
940
+ * @returns A conversations resource scoped to the scope.
941
+ */
674
942
  conversations(scopeId) {
675
943
  return new ScopeConversationsResource(this.http, this.config, scopeId);
676
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
+ */
677
951
  memories(scopeId) {
678
952
  return new ScopeMemoriesResource(this.http, this.config, scopeId);
679
953
  }
954
+ /**
955
+ * Evaluations for a scope.
956
+ *
957
+ * @param scopeId - Scope id.
958
+ * @returns An evaluations resource scoped to the scope.
959
+ */
680
960
  evaluations(scopeId) {
681
961
  return new ScopeEvaluationsResource(this.http, this.config, scopeId);
682
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
+ */
683
969
  supervision(scopeId) {
684
970
  return new ScopeSupervisionResource(this.http, this.config, scopeId);
685
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
+ */
686
982
  list(options = {}) {
687
983
  const pageSize = options.pageSize ?? 25;
688
984
  validatePageSize(pageSize);
@@ -702,11 +998,18 @@ var ManagementScopesResource = class {
702
998
  );
703
999
  return buildAipPage(
704
1000
  data,
705
- "skills",
1001
+ "scopes",
706
1002
  parseScope,
707
1003
  (token) => this.listPage(pageSize, token, search, view, managerId)
708
1004
  );
709
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
+ */
710
1013
  async get(scopeId, options = {}) {
711
1014
  validateId(scopeId, "scope_id");
712
1015
  const query = options.view !== void 0 ? { view: options.view } : void 0;
@@ -716,6 +1019,21 @@ var ManagementScopesResource = class {
716
1019
  });
717
1020
  return parseScope(data);
718
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
+ */
719
1037
  async create(options) {
720
1038
  const body = omitUndefined({
721
1039
  name: options.name,
@@ -734,6 +1052,17 @@ var ManagementScopesResource = class {
734
1052
  });
735
1053
  return parseScope(data);
736
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
+ */
737
1066
  async update(scopeId, options = {}) {
738
1067
  validateId(scopeId, "scope_id");
739
1068
  const accessConfig = await accessConfigBodyForUpdate(
@@ -767,6 +1096,17 @@ var ManagementScopesResource = class {
767
1096
  });
768
1097
  return parseScope(data);
769
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
+ */
770
1110
  async deploy(scopeId) {
771
1111
  validateId(scopeId, "scope_id");
772
1112
  const data = asRecord(
@@ -775,14 +1115,26 @@ var ManagementScopesResource = class {
775
1115
  jsonBody: {}
776
1116
  })
777
1117
  );
778
- return parseScope(data.skill);
779
- }
1118
+ return parseScope(data.scope);
1119
+ }
1120
+ /**
1121
+ * Delete a scope.
1122
+ *
1123
+ * @param scopeId - Scope id.
1124
+ * @returns Resolves when the scope is deleted.
1125
+ */
780
1126
  async delete(scopeId) {
781
1127
  validateId(scopeId, "scope_id");
782
1128
  await invokeWithRetry(this.config, this.http, this.ops.delete, {
783
1129
  pathParams: { id: scopeId }
784
1130
  });
785
1131
  }
1132
+ /**
1133
+ * Restore a previously deleted scope.
1134
+ *
1135
+ * @param scopeId - Scope id.
1136
+ * @returns The restored scope.
1137
+ */
786
1138
  async restore(scopeId) {
787
1139
  validateId(scopeId, "scope_id");
788
1140
  const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
@@ -791,6 +1143,13 @@ var ManagementScopesResource = class {
791
1143
  });
792
1144
  return parseScope(data);
793
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
+ */
794
1153
  async requestOwnershipTransfer(scopeId, options) {
795
1154
  validateId(scopeId, "scope_id");
796
1155
  const data = await invokeWithRetry(
@@ -804,6 +1163,7 @@ var ManagementScopesResource = class {
804
1163
  );
805
1164
  return parseScope(data);
806
1165
  }
1166
+ /** Cancel a pending scope ownership transfer. */
807
1167
  async cancelOwnershipTransfer(scopeId) {
808
1168
  validateId(scopeId, "scope_id");
809
1169
  const data = await invokeWithRetry(
@@ -814,6 +1174,7 @@ var ManagementScopesResource = class {
814
1174
  );
815
1175
  return parseScope(data);
816
1176
  }
1177
+ /** Accept a pending scope ownership transfer. */
817
1178
  async acceptOwnershipTransfer(scopeId) {
818
1179
  validateId(scopeId, "scope_id");
819
1180
  const data = await invokeWithRetry(
@@ -824,6 +1185,12 @@ var ManagementScopesResource = class {
824
1185
  );
825
1186
  return parseScope(data);
826
1187
  }
1188
+ /**
1189
+ * Update MCP server configuration for a scope.
1190
+ *
1191
+ * @param scopeId - Scope id.
1192
+ * @param options.mcpConfig - MCP configuration object.
1193
+ */
827
1194
  async patchMcpConfig(scopeId, options) {
828
1195
  validateId(scopeId, "scope_id");
829
1196
  await invokeWithRetry(this.config, this.http, this.ops.patchMcpConfig, {
@@ -831,6 +1198,13 @@ var ManagementScopesResource = class {
831
1198
  jsonBody: omitUndefined({ config: options.mcpConfig })
832
1199
  });
833
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
+ */
834
1208
  async getVariation(scopeId, options) {
835
1209
  validateId(scopeId, "scope_id");
836
1210
  validateId(options.variationUid, "variation_uid");
@@ -847,6 +1221,18 @@ var ManagementUsageResource = class {
847
1221
  this.http = http;
848
1222
  this.config = config;
849
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
+ */
850
1236
  async list(options) {
851
1237
  const query = {
852
1238
  since: options.since,
@@ -854,9 +1240,60 @@ var ManagementUsageResource = class {
854
1240
  rollup: options.rollup
855
1241
  };
856
1242
  if (options.model !== void 0) query.model = options.model;
1243
+ if (options.userEmail !== void 0) query.user_email = [...options.userEmail];
857
1244
  const data = await invokeWithRetry(this.config, this.http, "UsageController_list", { query });
858
1245
  return data;
859
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
+ */
1256
+ async listUsers(options) {
1257
+ const query = {
1258
+ since: options.since,
1259
+ until: options.until
1260
+ };
1261
+ const data = await invokeWithRetry(this.config, this.http, "UsageController_listUsers", {
1262
+ query
1263
+ });
1264
+ return data;
1265
+ }
1266
+ };
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
+ }
860
1297
  };
861
1298
 
862
1299
  // src/management/users.ts
@@ -865,6 +1302,7 @@ var ManagementUsersResource = class {
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,7 +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);
894
- this.organization = new ManagementOrganizationResource(this.http, this.config);
1333
+ this.tools = new ManagementToolsResource(this.http, this.config);
895
1334
  this.users = new ManagementUsersResource(this.http, this.config);
896
1335
  }
897
1336
  };