@getmodus/sdk 0.7.0 → 0.9.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.
@@ -1,15 +1,140 @@
1
- import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType, n as OperationId, V as VariationView, P as Page, a as Workflow, C as ContextItem, y as ContextItemDeletion, d as CustomContextItemsResource, z as CreatedContextItem, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from '../conversations-B0_jmEuT.js';
1
+ import { H as HttpClient, M as ModusConfig, W as WorkflowType, V as VariationView, P as Page, a as Workflow, c as components, q as OperationId, C as ContextItem, m as ContextItemDeletion, n as ContextItemMove, d as CustomContextItemsResource, D as CreatedContextItem, S as Scope, h as ScopeConversationsResource, i as ModusClientBase, j as ModusOptions } from '../conversations-D7ffhHIh.js';
2
+
3
+ /** Generated base for the management `workflows` resource. */
4
+ declare class WorkflowsResourceBase {
5
+ protected readonly http: HttpClient;
6
+ protected readonly config: ModusConfig;
7
+ /** @internal */
8
+ constructor(http: HttpClient, config: ModusConfig);
9
+ /**
10
+ * List workflows.
11
+ *
12
+ * Returns a paginated page of workflows the caller can at least `use`. Workflows the caller
13
+ * cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
14
+ *
15
+ * **Requires:** `workflows:read`
16
+ *
17
+ * @param options.pageSize - Items per page. Defaults to 25.
18
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
19
+ * for the first page.
20
+ * @param options.search - Case-insensitive substring filter on workflow name.
21
+ * @param options.type - Filter by workflow type.
22
+ * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
23
+ * snapshot.
24
+ * @param options.includeVariation - Include the requested variation payload (`trigger`,
25
+ * `workflowStructure`, `agentSelection`) on list rows.
26
+ * @returns A page of workflows.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const mgmt = new ModusManagement()
31
+ * for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {
32
+ * console.log(wf.id, wf.name, wf.status)
33
+ * }
34
+ * ```
35
+ */
36
+ list(options?: {
37
+ pageSize?: number;
38
+ pageToken?: string;
39
+ search?: string;
40
+ type?: WorkflowType;
41
+ view?: VariationView;
42
+ includeVariation?: boolean;
43
+ }): Promise<Page<Workflow>>;
44
+ protected listPage(pageSize: number, pageToken: string | undefined, search?: string, type?: WorkflowType, view?: VariationView, includeVariation?: boolean): Promise<Page<Workflow>>;
45
+ /**
46
+ * Delete a workflow.
47
+ *
48
+ * Deletes a workflow and stops its schedule. The workflow can be restored later with POST
49
+ * /workflows/{id}/restore. Deleting an already-deleted workflow is a no-op.
50
+ *
51
+ * **Requires:** `workflows:write`
52
+ *
53
+ * @param workflowId - Numeric workflow id.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const mgmt = new ModusManagement()
58
+ * await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')
59
+ * ```
60
+ */
61
+ delete(workflowId: number | string): Promise<void>;
62
+ /**
63
+ * Restore a deleted workflow.
64
+ *
65
+ * Restores a previously deleted workflow and returns it. The workflow’s schedule is not resumed
66
+ * automatically — re-enable it if it should run again. Restoring an active workflow returns it
67
+ * unchanged.
68
+ *
69
+ * **Requires:** `workflows:write`
70
+ *
71
+ * @param workflowId - Numeric workflow id.
72
+ */
73
+ restore(workflowId: number | string): Promise<Workflow>;
74
+ /**
75
+ * Cancel ownership transfer.
76
+ *
77
+ * Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may
78
+ * decline.
79
+ *
80
+ * **Requires:** `workflows:write`
81
+ *
82
+ * @param workflowId - Numeric workflow id.
83
+ */
84
+ cancelOwnershipTransfer(workflowId: number | string): Promise<Workflow>;
85
+ /**
86
+ * Accept ownership transfer.
87
+ *
88
+ * Accepts a pending ownership transfer. Only the pending recipient may invoke this action.
89
+ *
90
+ * **Requires:** `workflows:write`
91
+ *
92
+ * @param workflowId - Numeric workflow id.
93
+ */
94
+ acceptOwnershipTransfer(workflowId: number | string): Promise<Workflow>;
95
+ }
96
+
97
+ /** Generated base for the management `workflows.interfaces` resource. */
98
+ declare class WorkflowsInterfacesResourceBase {
99
+ protected readonly http: HttpClient;
100
+ protected readonly config: ModusConfig;
101
+ protected readonly workflowId: number | string;
102
+ /** @internal */
103
+ constructor(http: HttpClient, config: ModusConfig, workflowId: number | string);
104
+ /**
105
+ * List interfaces attached to a workflow.
106
+ *
107
+ * Returns every Slack, MCP, or Teams interface bound to the workflow. Requires manage permission
108
+ * on the workflow.
109
+ *
110
+ * **Requires:** `workflows:read`
111
+ */
112
+ list(): Promise<AgentInterface[]>;
113
+ /**
114
+ * Remove every interface from a workflow.
115
+ *
116
+ * Deletes all interface rows attached to the workflow. Useful when recreating the interface set
117
+ * from scratch.
118
+ *
119
+ * **Requires:** `workflows:write`
120
+ */
121
+ deleteAll(): Promise<void>;
122
+ /**
123
+ * Remove a workflow interface.
124
+ *
125
+ * Deletes one interface row. For MCP interfaces, bound MCP tokens are revoked best-effort.
126
+ *
127
+ * **Requires:** `workflows:write`
128
+ *
129
+ * @param interfaceId - Interface row id (UUID).
130
+ */
131
+ delete(interfaceId: string): Promise<void>;
132
+ }
2
133
 
3
134
  type AgentInterface = components['schemas']['AgentInterfaceDto'];
4
135
  type AddAgentInterface = components['schemas']['AddAgentInterfaceDto'];
5
136
  type UpdateAgentInterface = components['schemas']['UpdateAgentInterfaceDto'];
6
- declare class WorkflowInterfacesResource {
7
- private readonly http;
8
- private readonly config;
9
- private readonly workflowId;
10
- constructor(http: HttpClient, config: ModusConfig, workflowId: number | string);
11
- /** List interfaces attached to this workflow. */
12
- list(): Promise<AgentInterface[]>;
137
+ declare class WorkflowInterfacesResource extends WorkflowsInterfacesResourceBase {
13
138
  /**
14
139
  * Add an interface to this workflow.
15
140
  *
@@ -26,14 +151,6 @@ declare class WorkflowInterfacesResource {
26
151
  * @returns The updated interface.
27
152
  */
28
153
  update(interfaceId: string, options: UpdateAgentInterface, updateMask?: string): Promise<AgentInterface>;
29
- /**
30
- * Delete an interface from this workflow.
31
- *
32
- * @param interfaceId - Interface id.
33
- */
34
- delete(interfaceId: string): Promise<void>;
35
- /** Delete every interface from this workflow. */
36
- deleteAll(): Promise<void>;
37
154
  }
38
155
 
39
156
  type TriggerInput = Record<string, unknown>;
@@ -76,38 +193,8 @@ interface UpdateWorkflowOptions {
76
193
  }
77
194
  /** @deprecated Use `UpdateWorkflowOptions` instead. */
78
195
  type UpdateAgentOptions = UpdateWorkflowOptions;
79
- declare class ManagementWorkflowsResource {
80
- private readonly http;
81
- private readonly config;
196
+ declare class ManagementWorkflowsResource extends WorkflowsResourceBase {
82
197
  protected readonly ops: ManagementWorkflowsOperations;
83
- constructor(http: HttpClient, config: ModusConfig);
84
- /**
85
- * List workflows in the organization.
86
- *
87
- * @param options.pageSize - Maximum items per page (default 25).
88
- * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
89
- * @param options.search - Case-insensitive substring filter on the workflow name.
90
- * @param options.type - Filter by workflow type: `"task"` or `"workflow"`.
91
- * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
92
- * @param options.includeVariation - Include variation payload on each list row.
93
- * @returns A page of workflows.
94
- * @example
95
- * ```ts
96
- * const mgmt = new ModusManagement()
97
- * for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {
98
- * console.log(wf.id, wf.name, wf.status)
99
- * }
100
- * ```
101
- */
102
- list(options?: {
103
- pageSize?: number;
104
- pageToken?: string;
105
- search?: string;
106
- type?: WorkflowType;
107
- view?: VariationView;
108
- includeVariation?: boolean;
109
- }): Promise<Page<Workflow>>;
110
- private listPage;
111
198
  /**
112
199
  * Retrieve a workflow with full configuration.
113
200
  *
@@ -186,25 +273,6 @@ declare class ManagementWorkflowsResource {
186
273
  toggle(workflowId: number | string, options: {
187
274
  active: boolean;
188
275
  }): Promise<Workflow>;
189
- /**
190
- * Delete a workflow.
191
- *
192
- * @param workflowId - Workflow id.
193
- * @returns Resolves when the workflow is deleted.
194
- * @example
195
- * ```ts
196
- * const mgmt = new ModusManagement()
197
- * await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')
198
- * ```
199
- */
200
- delete(workflowId: number | string): Promise<void>;
201
- /**
202
- * Restore a previously deleted workflow.
203
- *
204
- * @param workflowId - Workflow id.
205
- * @returns The restored workflow.
206
- */
207
- restore(workflowId: number | string): Promise<Workflow>;
208
276
  /**
209
277
  * Start transferring ownership of a workflow to another organization member.
210
278
  *
@@ -215,10 +283,6 @@ declare class ManagementWorkflowsResource {
215
283
  requestOwnershipTransfer(workflowId: number | string, options: {
216
284
  newOwnerUserId: string;
217
285
  }): Promise<Workflow>;
218
- /** Cancel a pending workflow ownership transfer. */
219
- cancelOwnershipTransfer(workflowId: number | string): Promise<Workflow>;
220
- /** Accept a pending workflow ownership transfer. */
221
- acceptOwnershipTransfer(workflowId: number | string): Promise<Workflow>;
222
286
  }
223
287
 
224
288
  declare class ManagementContextItemsResource {
@@ -231,12 +295,34 @@ declare class ManagementContextItemsResource {
231
295
  * @param options.pageSize - Items per page (default 25).
232
296
  * @param options.pageToken - Token from a previous page's `nextPageToken`.
233
297
  * @param options.contextType - Filter to one context type (for example `"note"`).
298
+ * @param options.parentUids - Exact ordered native ancestry chain for direct
299
+ * children. Omit to leave parent unrestricted; pass `[]` for the known-empty
300
+ * root. Native UIDs are exact tokens; for a folder's children send ancestry
301
+ * UIDs plus the last `dataPath` token, not the hashed context-item `uid`.
302
+ * @param options.ancestorUids - Ordered UID ancestry prefix for strict
303
+ * descendants. Omit to leave unrestricted; pass `[]` for every item with
304
+ * non-null ancestry.
305
+ * @param options.connectionIds - Restrict to these connection ids. Omit to
306
+ * leave unfiltered; pass `[]` to match none. The Files root is
307
+ * `connectionIds: ['files']` with `parentUids: []`.
234
308
  * @returns A page of context items.
309
+ *
310
+ * @example
311
+ * ```ts
312
+ * const rootFiles = await mgmt.context.items.list({
313
+ * connectionIds: ['files'],
314
+ * contextType: 'file_upload',
315
+ * parentUids: [],
316
+ * })
317
+ * ```
235
318
  */
236
319
  list(options?: {
237
320
  pageSize?: number;
238
321
  pageToken?: string;
239
322
  contextType?: string;
323
+ parentUids?: readonly string[];
324
+ ancestorUids?: readonly string[];
325
+ connectionIds?: readonly string[];
240
326
  }): Promise<Page<ContextItem>>;
241
327
  private listPage;
242
328
  /**
@@ -270,12 +356,41 @@ declare class ManagementContextItemsResource {
270
356
  updateMask?: string;
271
357
  }): Promise<ContextItem>;
272
358
  /**
273
- * Delete a context item.
359
+ * Delete a context item. Deleting a Files folder also deletes all its contents.
274
360
  *
275
361
  * @param uid - Context item uid.
276
362
  * @returns Deletion confirmation details.
277
363
  */
278
364
  delete(uid: string): Promise<ContextItemDeletion>;
365
+ /**
366
+ * Move a live file or Files folder.
367
+ *
368
+ * Pass `destinationFolderUid: null` to move to the Files root. The
369
+ * destination folder must already exist. Same-parent moves succeed as a
370
+ * no-op. Does not rename or merge folders.
371
+ *
372
+ * @param uid - Stored context-item uid of the file or folder to move.
373
+ * @param options.destinationFolderUid - Stored context-item uid of the
374
+ * destination folder, or `null` for the Files root.
375
+ * @returns How many items changed parent (`0` is a successful no-op).
376
+ * @throws {NotFoundError} The source is missing or not visible.
377
+ * @throws {ModusError} The destination is missing, not a Files folder, or
378
+ * the move would create a cycle (HTTP 400).
379
+ * @throws {PermissionDeniedError} The destination exists but is not writable
380
+ * for this caller.
381
+ * @throws {ConflictError} A sibling with the same name already exists.
382
+ *
383
+ * @example
384
+ * ```ts
385
+ * const moved = await mgmt.context.items.move('PLACEHOLDER_UID', {
386
+ * destinationFolderUid: 'PLACEHOLDER_FOLDER_UID',
387
+ * })
388
+ * console.log(moved.movedItems)
389
+ * ```
390
+ */
391
+ move(uid: string, options: {
392
+ destinationFolderUid: string | null;
393
+ }): Promise<ContextItemMove>;
279
394
  }
280
395
 
281
396
  type UserFeedback = 'positive' | 'neutral' | 'negative';
@@ -321,26 +436,144 @@ type UpdateDashboardAccessInput = components['schemas']['UpdateDashboardAccessDt
321
436
  /** Input for `requestOwnershipTransfer()`. */
322
437
  type TransferDashboardOwnershipInput = components['schemas']['TransferDashboardOwnershipDto'];
323
438
 
324
- /**
325
- * Tiles and filters on one dashboard draft.
326
- *
327
- * Call path: `mgmt.context.dashboards.elements(dashboardId)`.
328
- *
329
- * Every change takes the `draftRevision` it is based on as `expectedRevision`;
330
- * a stale value is rejected with a `ConflictError`.
331
- */
332
- declare class ManagementDashboardElementsResource {
333
- private readonly http;
334
- private readonly config;
335
- private readonly dashboardId;
439
+ /** Generated base for the management `context.dashboards` resource. */
440
+ declare class ContextDashboardsResourceBase {
441
+ protected readonly http: HttpClient;
442
+ protected readonly config: ModusConfig;
336
443
  /** @internal */
337
- constructor(http: HttpClient, config: ModusConfig, dashboardId: string);
444
+ constructor(http: HttpClient, config: ModusConfig);
338
445
  /**
339
- * List every tile and filter on the dashboard draft.
446
+ * Delete a dashboard.
447
+ *
448
+ * Removes the dashboard from every listing and deletes its alert workflows. It cannot be restored
449
+ * through the API.
450
+ *
451
+ * **Requires:** `context:write`
452
+ *
453
+ * @param dashboardId - Dashboard id, as shown in the app URL.
454
+ *
455
+ * @example
456
+ * ```ts
457
+ * await mgmt.context.dashboards.delete('DASHBOARD_ID')
458
+ * ```
459
+ */
460
+ delete(dashboardId: string): Promise<void>;
461
+ /**
462
+ * List dashboard draft snapshots.
463
+ *
464
+ * Returns ids and timestamps of the most recent draft snapshots. Editors only.
465
+ *
466
+ * **Requires:** `context:read`
467
+ *
468
+ * @param dashboardId - Dashboard id, as shown in the app URL.
469
+ *
470
+ * @example
471
+ * ```ts
472
+ * const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')
473
+ * snapshots.map((snapshot) => snapshot.uid)
474
+ * ```
475
+ */
476
+ listDraftSnapshots(dashboardId: string): Promise<DashboardDraftSnapshot[]>;
477
+ /**
478
+ * Cancel an ownership transfer.
479
+ *
480
+ * Owner only. Clears the pending transfer and returns the dashboard.
481
+ *
482
+ * **Requires:** `context:write`
483
+ *
484
+ * @param dashboardId - Dashboard id, as shown in the app URL.
485
+ *
486
+ * @example
487
+ * ```ts
488
+ * await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')
489
+ * ```
490
+ */
491
+ cancelOwnershipTransfer(dashboardId: string): Promise<Dashboard>;
492
+ /**
493
+ * Accept an ownership transfer.
494
+ *
495
+ * Recipient only. Makes you the owner and clears the pending transfer.
496
+ *
497
+ * **Requires:** `context:write`
498
+ *
499
+ * @param dashboardId - Dashboard id, as shown in the app URL.
500
+ *
501
+ * @example
502
+ * ```ts
503
+ * await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')
504
+ * ```
505
+ */
506
+ acceptOwnershipTransfer(dashboardId: string): Promise<Dashboard>;
507
+ /**
508
+ * List dashboard versions.
509
+ *
510
+ * Returns the published versions, newest first, each with its full definition. Draft snapshots
511
+ * are not included. The response is not paginated and can be large.
512
+ *
513
+ * **Requires:** `context:read`
514
+ *
515
+ * @param dashboardId - Dashboard id, as shown in the app URL.
516
+ *
517
+ * @example
518
+ * ```ts
519
+ * const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')
520
+ * versions.map((version) => [version.uid, version.versionNumber])
521
+ * ```
522
+ */
523
+ listVersions(dashboardId: string): Promise<DashboardVersion[]>;
524
+ /**
525
+ * Get a dashboard version.
526
+ *
527
+ * Returns the dashboard as it was in the given version. For a draft snapshot (editors only) the
528
+ * view is reported as active and selectedVersion.versionNumber is null.
529
+ *
530
+ * **Requires:** `context:read`
531
+ *
532
+ * @param dashboardId - Dashboard id, as shown in the app URL.
533
+ * @param versionId - Version id, or a draft snapshot id for editors.
534
+ *
535
+ * @example
536
+ * ```ts
537
+ * const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')
538
+ * old.selectedVersion.versionNumber
539
+ * ```
540
+ */
541
+ getVersion(dashboardId: string, versionId: string): Promise<Dashboard>;
542
+ /**
543
+ * Restore a dashboard version.
544
+ *
545
+ * Replaces the current draft with the content of the given version. The outgoing draft is kept as
546
+ * a draft snapshot. Returns the draft view.
547
+ *
548
+ * **Requires:** `context:write`
549
+ *
550
+ * @param dashboardId - Dashboard id, as shown in the app URL.
551
+ * @param versionId - Version id, or a draft snapshot id for editors.
552
+ *
553
+ * @example
554
+ * ```ts
555
+ * await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')
556
+ * ```
557
+ */
558
+ restoreVersion(dashboardId: string, versionId: string): Promise<Dashboard>;
559
+ }
560
+
561
+ /** Generated base for the management `context.dashboards.elements` resource. */
562
+ declare class ContextDashboardsElementsResourceBase {
563
+ protected readonly http: HttpClient;
564
+ protected readonly config: ModusConfig;
565
+ protected readonly dashboardId: number | string;
566
+ /** @internal */
567
+ constructor(http: HttpClient, config: ModusConfig, dashboardId: number | string);
568
+ /**
569
+ * List dashboard elements.
570
+ *
571
+ * Lists every tile and filter on the dashboard draft with id, kind, title and layout. Filters
572
+ * also carry sqlReferences, the exact templates tile SQL must use to reference them. Returns the
573
+ * current draftRevision.
574
+ *
575
+ * **Requires:** `context:read`
340
576
  *
341
- * @returns Each element's id, kind, title and grid position, plus the current
342
- * `draftRevision` to pass as `expectedRevision` on the next change.
343
- * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
344
577
  * @example
345
578
  * ```ts
346
579
  * const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
@@ -349,12 +582,15 @@ declare class ManagementDashboardElementsResource {
349
582
  */
350
583
  list(): Promise<DashboardElementsList>;
351
584
  /**
352
- * Get the full draft settings of one tile or filter.
585
+ * Get a dashboard element.
586
+ *
587
+ * Returns the full draft configuration of one dashboard element, including SQL, chart settings
588
+ * and filter options, with the current draftRevision.
589
+ *
590
+ * **Requires:** `context:read`
591
+ *
592
+ * @param elementId - The dashboard element id to read.
353
593
  *
354
- * @param elementId - Id of the tile or filter, as returned by `list()`.
355
- * @returns The element's settings and the current `draftRevision`.
356
- * @throws NotFoundError - The dashboard or the element does not exist, or you cannot
357
- * edit the dashboard.
358
594
  * @example
359
595
  * ```ts
360
596
  * const result = await mgmt.context.dashboards.elements('DASHBOARD_ID').get('ELEMENT_ID')
@@ -362,6 +598,19 @@ declare class ManagementDashboardElementsResource {
362
598
  * ```
363
599
  */
364
600
  get(elementId: string): Promise<DashboardElementResult>;
601
+ }
602
+
603
+ /**
604
+ * Tiles and filters on one dashboard draft.
605
+ *
606
+ * Call path: `mgmt.context.dashboards.elements(dashboardId)`.
607
+ *
608
+ * Every change takes the `draftRevision` it is based on as `expectedRevision`;
609
+ * a stale value is rejected with a `ConflictError`.
610
+ */
611
+ declare class ManagementDashboardElementsResource extends ContextDashboardsElementsResourceBase {
612
+ /** @internal */
613
+ constructor(http: HttpClient, config: ModusConfig, dashboardId: string);
365
614
  /**
366
615
  * Add a blank tile or filter to the dashboard draft.
367
616
  *
@@ -417,9 +666,7 @@ declare class ManagementDashboardElementsResource {
417
666
  * - `elements(dashboardId)` — list, get, create and update tiles and filters.
418
667
  * - `updateLayout(dashboardId, input)` — move or resize several elements at once.
419
668
  */
420
- declare class ManagementDashboardsResource {
421
- private readonly http;
422
- private readonly config;
669
+ declare class ManagementDashboardsResource extends ContextDashboardsResourceBase {
423
670
  /** @internal */
424
671
  constructor(http: HttpClient, config: ModusConfig);
425
672
  /**
@@ -518,80 +765,6 @@ declare class ManagementDashboardsResource {
518
765
  * ```
519
766
  */
520
767
  publish(dashboardId: string, input: PublishDashboardInput): Promise<DashboardPublishResult>;
521
- /**
522
- * Delete a dashboard and the alert workflows defined on it.
523
- *
524
- * A deleted dashboard cannot be restored.
525
- *
526
- * @param dashboardId - Id of the dashboard.
527
- * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
528
- * @example
529
- * ```ts
530
- * await mgmt.context.dashboards.delete('DASHBOARD_ID')
531
- * ```
532
- */
533
- delete(dashboardId: string): Promise<void>;
534
- /**
535
- * List the published versions of a dashboard, newest first.
536
- *
537
- * @param dashboardId - Id of the dashboard.
538
- * @returns Every published version with its full definition. Definitions are
539
- * returned as stored, so older versions may lack newer fields. The list is
540
- * not paginated.
541
- * @throws NotFoundError - The dashboard does not exist or you cannot open it.
542
- * @example
543
- * ```ts
544
- * const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')
545
- * versions.map((version) => [version.uid, version.versionNumber])
546
- * ```
547
- */
548
- listVersions(dashboardId: string): Promise<DashboardVersion[]>;
549
- /**
550
- * Get a dashboard as it was in one version.
551
- *
552
- * @param dashboardId - Id of the dashboard.
553
- * @param versionId - Id of the version, as returned by `listVersions()`.
554
- * @returns The dashboard with that version's definition.
555
- * @throws NotFoundError - The dashboard or the version does not exist, or you cannot
556
- * open the dashboard.
557
- * @example
558
- * ```ts
559
- * const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')
560
- * old.selectedVersion.versionNumber
561
- * ```
562
- */
563
- getVersion(dashboardId: string, versionId: string): Promise<Dashboard>;
564
- /**
565
- * Replace the draft with the content of an earlier version.
566
- *
567
- * The draft being replaced is kept as a draft snapshot. Call `publish()`
568
- * afterwards to make the restored content visible.
569
- *
570
- * @param dashboardId - Id of the dashboard.
571
- * @param versionId - Id of the version or draft snapshot to restore.
572
- * @returns The dashboard draft after the restore.
573
- * @throws NotFoundError - The dashboard or the version does not exist, or you cannot
574
- * edit the dashboard.
575
- * @example
576
- * ```ts
577
- * await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')
578
- * ```
579
- */
580
- restoreVersion(dashboardId: string, versionId: string): Promise<Dashboard>;
581
- /**
582
- * List recent snapshots of the dashboard draft, newest first.
583
- *
584
- * @param dashboardId - Id of the dashboard.
585
- * @returns Up to 100 snapshots with their id, author and time. Pass an id to
586
- * `restoreVersion()` to bring that draft back.
587
- * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
588
- * @example
589
- * ```ts
590
- * const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')
591
- * snapshots.map((snapshot) => snapshot.uid)
592
- * ```
593
- */
594
- listDraftSnapshots(dashboardId: string): Promise<DashboardDraftSnapshot[]>;
595
768
  /**
596
769
  * Replace who can open and edit a dashboard.
597
770
  *
@@ -635,36 +808,6 @@ declare class ManagementDashboardsResource {
635
808
  * ```
636
809
  */
637
810
  requestOwnershipTransfer(dashboardId: string, input: TransferDashboardOwnershipInput): Promise<Dashboard>;
638
- /**
639
- * Accept a pending ownership transfer and become the dashboard owner.
640
- *
641
- * Only the requested recipient can accept.
642
- *
643
- * @param dashboardId - Id of the dashboard.
644
- * @returns The dashboard with you as its owner.
645
- * @throws NotFoundError - The dashboard does not exist, or it has no pending transfer
646
- * addressed to you.
647
- * @example
648
- * ```ts
649
- * await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')
650
- * ```
651
- */
652
- acceptOwnershipTransfer(dashboardId: string): Promise<Dashboard>;
653
- /**
654
- * Cancel a pending ownership transfer.
655
- *
656
- * Only the owner can cancel.
657
- *
658
- * @param dashboardId - Id of the dashboard.
659
- * @returns The dashboard with no pending transfer.
660
- * @throws NotFoundError - The dashboard does not exist, you cannot open it, or you are
661
- * not the owner.
662
- * @example
663
- * ```ts
664
- * await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')
665
- * ```
666
- */
667
- cancelOwnershipTransfer(dashboardId: string): Promise<Dashboard>;
668
811
  /**
669
812
  * Work with the tiles and filters of one dashboard draft.
670
813
  *
@@ -758,6 +901,49 @@ interface BulkFinalizeResult {
758
901
  failed: FinalizeFailure[];
759
902
  }
760
903
 
904
+ /** Generated base for the management `context.files` resource. */
905
+ declare class ContextFilesResourceBase {
906
+ protected readonly http: HttpClient;
907
+ protected readonly config: ModusConfig;
908
+ /** @internal */
909
+ constructor(http: HttpClient, config: ModusConfig);
910
+ /**
911
+ * List file uploads.
912
+ *
913
+ * Returns a page of durable landed file uploads. Uploads that have not landed yet are visible via
914
+ * `GET /context/files/{uploadId}`, not this list.
915
+ *
916
+ * **Requires:** `context:read`
917
+ *
918
+ * @param options.pageSize - Items per page. Defaults to 50.
919
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
920
+ * for the first page.
921
+ * @returns A page of files.
922
+ */
923
+ list(options?: {
924
+ pageSize?: number;
925
+ pageToken?: string;
926
+ }): Promise<Page<FileUpload>>;
927
+ protected listPage(pageSize: number, pageToken: string | undefined): Promise<Page<FileUpload>>;
928
+ /**
929
+ * Get a file upload.
930
+ *
931
+ * Returns status + metadata for one upload. Prefers the durable landed context item; falls back
932
+ * to in-flight upload status while the object has not landed yet. 404 if neither exists.
933
+ *
934
+ * **Requires:** `context:read`
935
+ *
936
+ * @param uploadId - Upload id returned by `createUploadUrl` / `createUploadUrls`.
937
+ */
938
+ get(uploadId: string): Promise<FileUpload>;
939
+ }
940
+
941
+ type BatchUploadOptions = {
942
+ concurrency?: number;
943
+ waitUntil?: WaitUntil;
944
+ onProgress?: UploadProgressCallback;
945
+ folderPath?: string;
946
+ };
761
947
  /**
762
948
  * Durable file uploads for `ModusManagement`.
763
949
  *
@@ -765,10 +951,9 @@ interface BulkFinalizeResult {
765
951
  *
766
952
  * - `upload(path)` / `uploadDir(dirPath)` — presign + PUT + poll convenience helpers.
767
953
  * - `createUploadUrl(s)`, `uploadFromUrl(s)`, `get`, `list` — raw operations.
954
+ * Hierarchy browsing is available through `mgmt.context.items.list`.
768
955
  */
769
- declare class ManagementContextFilesResource {
770
- private readonly http;
771
- private readonly config;
956
+ declare class ManagementContextFilesResource extends ContextFilesResourceBase {
772
957
  /** @internal */
773
958
  constructor(http: HttpClient, config: ModusConfig);
774
959
  /**
@@ -779,7 +964,7 @@ declare class ManagementContextFilesResource {
779
964
  * Office/OpenDocument documents, audio, and video.
780
965
  * @param input.fileSize - File size in bytes. Rejected above 50MB.
781
966
  * @returns Presigned upload slot. PUT the raw bytes to `uploadUrl` within 15
782
- * minutes, then call `finalize(slot.uploadId, slot.fileName)`. Pass the
967
+ * minutes, sending `headers` unchanged, then call `finalize(slot.uploadId, slot.fileName)`. Pass the
783
968
  * slot's own `fileName` rather than your local basename — the server may
784
969
  * sanitize the requested name when it mints the key, and finalization
785
970
  * re-derives the key from `uploadId` and `fileName`.
@@ -799,6 +984,7 @@ declare class ManagementContextFilesResource {
799
984
  * @param url - Source URL to fetch (SSRF-guarded, 50MB cap, same MIME
800
985
  * allow-list as `createUploadUrl`).
801
986
  * @param options.fileName - Override file name. Inferred from the URL path when omitted.
987
+ * @param options.folderPath - Root-relative folder to upload under.
802
988
  * @returns File upload resource with status `processing` — parsing continues async.
803
989
  */
804
990
  uploadFromUrl(url: string, options?: {
@@ -813,26 +999,6 @@ declare class ManagementContextFilesResource {
813
999
  * failures for the rest — never a partial 4xx.
814
1000
  */
815
1001
  uploadFromUrls(urls: readonly UploadFromUrlInput[]): Promise<BulkUploadFromUrlsResult>;
816
- /**
817
- * Fetch one file upload by its id.
818
- *
819
- * @param uploadId - Upload id returned by `createUploadUrl` / `uploadFromUrl`.
820
- * @returns The file upload resource, including its processing `status`.
821
- */
822
- get(uploadId: string): Promise<FileUpload>;
823
- /**
824
- * List durable file uploads.
825
- *
826
- * @param options.pageSize - Items per page (default 50).
827
- * @param options.pageToken - Opaque token from a previous page's `nextPageToken`.
828
- * @returns Page of file uploads. Uploads that only have a pending row (not yet
829
- * landed) aren't included here — use `get(uploadId)` for those.
830
- */
831
- list(options?: {
832
- pageSize?: number;
833
- pageToken?: string;
834
- }): Promise<Page<FileUpload>>;
835
- private listPage;
836
1002
  /**
837
1003
  * Turn a file already PUT to a presigned URL into durable context.
838
1004
  *
@@ -868,30 +1034,44 @@ declare class ManagementContextFilesResource {
868
1034
  * @param options.concurrency - Max concurrent PUTs (default 10).
869
1035
  * @param options.waitUntil - `"processing"` (default) or `"ready"`.
870
1036
  * @param options.onProgress - Optional progress callback after each file.
1037
+ * @param options.folderPath - Root-relative folder to upload under. Nested
1038
+ * files keep their existing relative folder labels under this prefix.
1039
+ * @example
1040
+ * ```ts
1041
+ * const mgmt = new ModusManagement()
1042
+ * const result = await mgmt.context.files.uploadFiles(
1043
+ * ['./q3.pdf', './notes.md'],
1044
+ * { folderPath: 'reports/2026' },
1045
+ * )
1046
+ * ```
871
1047
  */
872
- uploadFiles(paths: readonly (string | UploadFileInput)[], options?: {
873
- concurrency?: number;
874
- waitUntil?: WaitUntil;
875
- onProgress?: UploadProgressCallback;
876
- }): Promise<UploadDirResult>;
1048
+ uploadFiles(paths: readonly (string | UploadFileInput)[], options?: BatchUploadOptions): Promise<UploadDirResult>;
877
1049
  /**
878
1050
  * Upload a local file and wait for it to reach `"processing"` or `"ready"`.
879
1051
  *
880
- * Gets a presigned URL, PUTs the file bytes, then polls `get()` until the
881
- * upload leaves `"pending"` (or reaches `"ready"`/`"failed"`).
1052
+ * Gets a presigned URL, PUTs the file bytes, then polls `get()`
1053
+ * until the upload leaves `"pending"` (or reaches `"ready"`/`"failed"`).
882
1054
  *
883
1055
  * @param path - Path to a local file.
884
1056
  * @param options.waitUntil - `"processing"` (parsing started, default) or
885
1057
  * `"ready"` (parsing finished).
886
1058
  * @param options.pollIntervalMs - Milliseconds between status polls.
887
1059
  * @param options.timeoutMs - Max milliseconds to wait before raising.
1060
+ * @param options.folderPath - Root-relative folder to upload under. Example:
1061
+ * `{ folderPath: 'reports/2026' }` places `./report.pdf` at `reports/2026`.
888
1062
  * @returns The file upload resource once it reaches `waitUntil` (or `"failed"`).
889
1063
  * @throws {ModusError} If the PUT fails, or polling times out.
1064
+ * @example
1065
+ * ```ts
1066
+ * const mgmt = new ModusManagement()
1067
+ * const file = await mgmt.context.files.upload('./report.pdf', { folderPath: 'reports/2026' })
1068
+ * ```
890
1069
  */
891
1070
  upload(path: string, options?: {
892
1071
  waitUntil?: WaitUntil;
893
1072
  pollIntervalMs?: number;
894
1073
  timeoutMs?: number;
1074
+ folderPath?: string;
895
1075
  }): Promise<FileUpload>;
896
1076
  private pollUntil;
897
1077
  /**
@@ -907,14 +1087,24 @@ declare class ManagementContextFilesResource {
907
1087
  * @param options.concurrency - Max concurrent PUT+poll operations (default 10).
908
1088
  * @param options.waitUntil - `"processing"` (default) or `"ready"` — same as `upload()`.
909
1089
  * @param options.onProgress - Optional progress callback after each file.
1090
+ * @param options.folderPath - Root-relative folder to upload under. Nested
1091
+ * files keep their path relative to `path` under this prefix. Example:
1092
+ * `uploadDir('./docs', { folderPath: 'reports' })` places `./docs/a.txt` at
1093
+ * `reports` and `./docs/nested/b.txt` at `reports/nested`.
910
1094
  * @returns `UploadDirResult` with every successful `FileUpload` and every
911
1095
  * per-file failure (slot creation or PUT/poll), each tagged with its local path.
1096
+ * @example
1097
+ * ```ts
1098
+ * const mgmt = new ModusManagement()
1099
+ * const result = await mgmt.context.files.uploadDir('./docs', { folderPath: 'reports' })
1100
+ * ```
912
1101
  */
913
1102
  uploadDir(path: string, options?: {
914
1103
  recursive?: boolean;
915
1104
  concurrency?: number;
916
1105
  waitUntil?: WaitUntil;
917
1106
  onProgress?: UploadProgressCallback;
1107
+ folderPath?: string;
918
1108
  }): Promise<UploadDirResult>;
919
1109
  /** Shared body of `uploadFiles` and `uploadDir`: presign in batches of 100,
920
1110
  * PUT with bounded concurrency, then bulk-finalize the batch. */
@@ -1079,6 +1269,117 @@ declare class ManagementContextResource {
1079
1269
  private create;
1080
1270
  }
1081
1271
 
1272
+ /** Generated base for the management `scopes` resource. */
1273
+ declare class ScopesResourceBase {
1274
+ protected readonly http: HttpClient;
1275
+ protected readonly config: ModusConfig;
1276
+ /** @internal */
1277
+ constructor(http: HttpClient, config: ModusConfig);
1278
+ /**
1279
+ * List scopes.
1280
+ *
1281
+ * Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see
1282
+ * are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
1283
+ *
1284
+ * **Requires:** `scopes:read`
1285
+ *
1286
+ * @param options.pageSize - Items per page. Defaults to 25.
1287
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
1288
+ * for the first page.
1289
+ * @param options.search - Case-insensitive substring filter on scope name.
1290
+ * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
1291
+ * snapshot.
1292
+ * @param options.managerId - Return only scopes supervised by this manager scope id.
1293
+ * @returns A page of scopes.
1294
+ *
1295
+ * @example
1296
+ * ```ts
1297
+ * const mgmt = new ModusManagement()
1298
+ * for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {
1299
+ * console.log(scope.id, scope.name, scope.status)
1300
+ * }
1301
+ * ```
1302
+ */
1303
+ list(options?: {
1304
+ pageSize?: number;
1305
+ pageToken?: string;
1306
+ search?: string;
1307
+ view?: VariationView;
1308
+ managerId?: number;
1309
+ }): Promise<Page<Scope>>;
1310
+ protected listPage(pageSize: number, pageToken: string | undefined, search?: string, view?: VariationView, managerId?: number): Promise<Page<Scope>>;
1311
+ /**
1312
+ * Get a scope.
1313
+ *
1314
+ * Returns a scope. `view=active` (default) returns the deployed version; `view=draft` returns the
1315
+ * latest unpublished edits. Returns 404 if you cannot access the scope.
1316
+ *
1317
+ * **Requires:** `scopes:read`
1318
+ *
1319
+ * @param scopeId - Numeric scope id.
1320
+ * @param options.view - Which variation snapshot to read. Defaults to `active`.
1321
+ *
1322
+ * @example
1323
+ * ```ts
1324
+ * const mgmt = new ModusManagement()
1325
+ * const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')
1326
+ * console.log(scope.name, scope.status)
1327
+ * ```
1328
+ */
1329
+ get(scopeId: number | string, options?: {
1330
+ view?: VariationView;
1331
+ }): Promise<Scope>;
1332
+ /**
1333
+ * Delete a scope.
1334
+ *
1335
+ * Deletes a scope. The scope can be restored later with POST /scopes/{id}/restore. Deleting an
1336
+ * already-deleted scope is a no-op.
1337
+ *
1338
+ * **Requires:** `scopes:write`
1339
+ *
1340
+ * @param scopeId - Numeric scope id.
1341
+ *
1342
+ * @example
1343
+ * ```ts
1344
+ * const mgmt = new ModusManagement()
1345
+ * await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')
1346
+ * ```
1347
+ */
1348
+ delete(scopeId: number | string): Promise<void>;
1349
+ /**
1350
+ * Restore a deleted scope.
1351
+ *
1352
+ * Restores a previously deleted scope and returns it. Restoring a scope that is already active
1353
+ * returns it unchanged.
1354
+ *
1355
+ * **Requires:** `scopes:write`
1356
+ *
1357
+ * @param scopeId - Numeric scope id.
1358
+ */
1359
+ restore(scopeId: number | string): Promise<Scope>;
1360
+ /**
1361
+ * Cancel ownership transfer.
1362
+ *
1363
+ * Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may
1364
+ * decline.
1365
+ *
1366
+ * **Requires:** `scopes:write`
1367
+ *
1368
+ * @param scopeId - Numeric scope id.
1369
+ */
1370
+ cancelOwnershipTransfer(scopeId: number | string): Promise<Scope>;
1371
+ /**
1372
+ * Accept ownership transfer.
1373
+ *
1374
+ * Accepts a pending ownership transfer. Only the pending recipient may invoke this action.
1375
+ *
1376
+ * **Requires:** `scopes:write`
1377
+ *
1378
+ * @param scopeId - Numeric scope id.
1379
+ */
1380
+ acceptOwnershipTransfer(scopeId: number | string): Promise<Scope>;
1381
+ }
1382
+
1082
1383
  type JsonObjectInput = Record<string, unknown>;
1083
1384
  type JsonObjectListInput = JsonObjectInput[];
1084
1385
 
@@ -1098,18 +1399,25 @@ type MemorySearchRequest = components['schemas']['SearchMemoriesRequestDto'];
1098
1399
  type MemoryUpdate = components['schemas']['UpdateMemoryRequestDto'];
1099
1400
  type MemorySearchResult = components['schemas']['ListMemoriesResponseDto'];
1100
1401
 
1101
- /** Long-term memory stored per scope. */
1102
- declare class ScopeMemoriesResource {
1103
- private readonly http;
1104
- private readonly config;
1105
- private readonly scopeId;
1402
+ /** Generated base for the management `scopes.memories` resource. */
1403
+ declare class ScopesMemoriesResourceBase {
1404
+ protected readonly http: HttpClient;
1405
+ protected readonly config: ModusConfig;
1406
+ protected readonly scopeId: number | string;
1407
+ /** @internal */
1106
1408
  constructor(http: HttpClient, config: ModusConfig, scopeId: number | string);
1107
1409
  /**
1108
- * List memories stored for this scope.
1410
+ * List scope memories.
1109
1411
  *
1110
- * @param options.pageSize - Items per page (default 25).
1111
- * @param options.pageToken - Token from a previous page's `nextPageToken`.
1112
- * @param options.userId - Optional end-user id when memories are scoped per user.
1412
+ * Returns a page of the scope’s memories (up to 1000 total). Pass `nextPageToken` as `pageToken`
1413
+ * to fetch the next page. Optional `userId` filters to one end user.
1414
+ *
1415
+ * **Requires:** `scopes:read`
1416
+ *
1417
+ * @param options.pageSize - Items per page. Defaults to 25.
1418
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
1419
+ * for the first page.
1420
+ * @param options.userId - Narrow results to memories tagged with this end-user id.
1113
1421
  * @returns A page of memories.
1114
1422
  */
1115
1423
  list(options?: {
@@ -1117,108 +1425,227 @@ declare class ScopeMemoriesResource {
1117
1425
  pageToken?: string;
1118
1426
  userId?: string;
1119
1427
  }): Promise<Page<Memory>>;
1120
- private listPage;
1428
+ protected listPage(pageSize: number, pageToken: string | undefined, userId?: string): Promise<Page<Memory>>;
1121
1429
  /**
1122
- * Search this scope's memories by natural-language query.
1430
+ * Search scope memories.
1431
+ *
1432
+ * Returns memories ranked by semantic similarity to the supplied `query`. Caller must at least
1433
+ * `use` the scope. Optional `userId` and `limit` body fields narrow the result set (legacy parity
1434
+ * with `search-memories`).
1123
1435
  *
1124
- * @param request - Query text and optional `userId` / `limit`.
1125
- * @returns Matching memories and relevance scores.
1436
+ * **Requires:** `scopes:read`
1437
+ *
1438
+ * @param request - Request body; see `MemorySearchRequest`.
1126
1439
  */
1127
1440
  search(request: MemorySearchRequest): Promise<MemorySearchResult>;
1128
1441
  /**
1129
- * Update one memory. Requires manage permission on the scope.
1442
+ * Update a memory.
1443
+ *
1444
+ * Updates one memory. Supply at least one of `memory` or `metadata`. Use `updateMask` to limit
1445
+ * which fields change.
1130
1446
  *
1131
- * @param memoryId - Id from list or search.
1132
- * @param update - Fields to change (`memory` and/or `metadata`).
1133
- * @param options.updateMask - Optional comma-separated field names to update.
1134
- * @returns The updated memory.
1447
+ * **Requires:** `scopes:write`
1448
+ *
1449
+ * @param memoryId - Opaque memory id as returned by the list / search endpoints.
1450
+ * @param update - Request body; see `MemoryUpdate`.
1451
+ * @param options.updateMask - Comma-separated list of fields to update. Omit to update all
1452
+ * provided fields.
1135
1453
  */
1136
1454
  update(memoryId: string, update: MemoryUpdate, options?: {
1137
1455
  updateMask?: string;
1138
1456
  }): Promise<Memory>;
1139
- /** Delete one memory (idempotent). */
1457
+ /**
1458
+ * Delete a memory.
1459
+ *
1460
+ * Deletes one memory. Deleting an already-deleted memory is a no-op.
1461
+ *
1462
+ * **Requires:** `scopes:write`
1463
+ *
1464
+ * @param memoryId - Opaque memory id as returned by the list / search endpoints.
1465
+ */
1140
1466
  delete(memoryId: string): Promise<void>;
1141
1467
  }
1142
1468
 
1469
+ /** Long-term memory stored per scope. */
1470
+ declare class ScopeMemoriesResource extends ScopesMemoriesResourceBase {
1471
+ }
1472
+
1143
1473
  type EvaluationConfig = components['schemas']['EvaluationConfigDto'];
1144
1474
  type UpdateEvaluationConfig = components['schemas']['UpdateEvaluationConfigDto'];
1145
1475
  type EvaluationRun = components['schemas']['EvaluationRunDto'];
1146
1476
  type EvaluationRunWithResults = components['schemas']['EvaluationRunWithResultsDto'];
1147
1477
  type TriggerEvaluationRunResponse = components['schemas']['TriggerEvaluationRunResponseDto'];
1148
1478
 
1149
- /** Scheduled and manual scope evaluations. */
1150
- declare class ScopeEvaluationsResource {
1151
- private readonly http;
1152
- private readonly config;
1153
- private readonly scopeId;
1479
+ /** Generated base for the management `scopes.evaluations` resource. */
1480
+ declare class ScopesEvaluationsResourceBase {
1481
+ protected readonly http: HttpClient;
1482
+ protected readonly config: ModusConfig;
1483
+ protected readonly scopeId: number | string;
1484
+ /** @internal */
1154
1485
  constructor(http: HttpClient, config: ModusConfig, scopeId: number | string);
1155
- /** Get the evaluation configuration for this scope. */
1486
+ /**
1487
+ * Get evaluation configuration.
1488
+ *
1489
+ * Returns the evaluation configuration for a scope, including judge settings, schedule cadence,
1490
+ * and notification preferences.
1491
+ *
1492
+ * **Requires:** `scopes:read`
1493
+ */
1156
1494
  getConfig(): Promise<EvaluationConfig>;
1157
1495
  /**
1158
- * Update the evaluation configuration for this scope.
1496
+ * Update evaluation configuration.
1497
+ *
1498
+ * Updates the evaluation configuration for a scope. Changes to the schedule cadence are synced
1499
+ * automatically.
1159
1500
  *
1160
- * @param update - Configuration fields to change.
1161
- * @returns The updated evaluation configuration.
1501
+ * **Requires:** `scopes:write`
1502
+ *
1503
+ * @param update - Request body; see `UpdateEvaluationConfig`.
1162
1504
  */
1163
1505
  updateConfig(update: UpdateEvaluationConfig): Promise<EvaluationConfig>;
1164
1506
  /**
1165
- * Trigger a manual evaluation run for this scope.
1507
+ * Trigger evaluation run.
1508
+ *
1509
+ * Triggers a manual evaluation run for the scope. The run executes asynchronously.
1166
1510
  *
1167
- * @returns The triggered run id and status.
1511
+ * **Requires:** `scopes:write`
1512
+ *
1513
+ * @returns Evaluation run accepted and queued. The run executes asynchronously; poll `GET
1514
+ * /scopes/{id}/evaluations/runs/{runId}` for status.
1168
1515
  */
1169
1516
  triggerRun(): Promise<TriggerEvaluationRunResponse>;
1170
1517
  /**
1171
- * List evaluation runs for this scope.
1518
+ * List evaluation runs.
1172
1519
  *
1173
- * @param options.pageSize - Items per page (default 25).
1174
- * @param options.pageToken - Token from a previous page's `nextPageToken`.
1175
- * @returns A page of evaluation runs.
1520
+ * Returns a paginated list of evaluation runs for the scope, ordered by most recent first.
1521
+ *
1522
+ * **Requires:** `scopes:read`
1523
+ *
1524
+ * @param options.pageSize - Items per page. Defaults to 25.
1525
+ * @returns A page of runs.
1176
1526
  */
1177
1527
  listRuns(options?: {
1178
1528
  pageSize?: number;
1179
1529
  pageToken?: string;
1180
1530
  }): Promise<Page<EvaluationRun>>;
1181
- private listRunsPage;
1531
+ protected listRunsPage(pageSize: number, pageToken: string | undefined): Promise<Page<EvaluationRun>>;
1182
1532
  /**
1183
- * Retrieve one evaluation run with full results.
1533
+ * Get evaluation run.
1534
+ *
1535
+ * Returns details of an evaluation run including all per-case results.
1184
1536
  *
1185
- * @param runId - Evaluation run id.
1186
- * @returns The run and its result details.
1537
+ * **Requires:** `scopes:read`
1538
+ *
1539
+ * @param runId - Run ID.
1187
1540
  */
1188
1541
  getRun(runId: string): Promise<EvaluationRunWithResults>;
1189
1542
  }
1190
1543
 
1191
- type Supervision = components['schemas']['SupervisionDto'];
1192
- type SetSupervisionRequest = components['schemas']['SetSupervisionRequestDto'];
1193
- declare class ScopeSupervisionResource {
1194
- private readonly http;
1195
- private readonly config;
1196
- private readonly scopeId;
1544
+ /** Scheduled and manual scope evaluations. */
1545
+ declare class ScopeEvaluationsResource extends ScopesEvaluationsResourceBase {
1546
+ }
1547
+
1548
+ /** Generated base for the management `scopes.interfaces` resource. */
1549
+ declare class ScopesInterfacesResourceBase {
1550
+ protected readonly http: HttpClient;
1551
+ protected readonly config: ModusConfig;
1552
+ protected readonly scopeId: number | string;
1553
+ /** @internal */
1554
+ constructor(http: HttpClient, config: ModusConfig, scopeId: number | string);
1555
+ /**
1556
+ * List the chat interfaces of a scope.
1557
+ *
1558
+ * Returns the chat interfaces (at most one per chat platform) that let people use this scope from
1559
+ * chat. Requires manage permission on the scope, because the config lists allowed emails.
1560
+ *
1561
+ * **Requires:** `scopes:read`
1562
+ */
1563
+ list(): Promise<ScopeInterface[]>;
1564
+ /**
1565
+ * Remove a scope interface.
1566
+ *
1567
+ * Removes one chat interface from the scope. Mentions on that chat platform stop reaching this
1568
+ * scope immediately.
1569
+ *
1570
+ * **Requires:** `scopes:write`
1571
+ *
1572
+ * @param interfaceId - Interface id (UUID).
1573
+ */
1574
+ delete(interfaceId: string): Promise<void>;
1575
+ }
1576
+
1577
+ type ScopeInterface = components['schemas']['ScopeInterfaceDto'];
1578
+ type AddScopeInterface = components['schemas']['AddScopeInterfaceDto'];
1579
+ type UpdateScopeInterface = components['schemas']['UpdateScopeInterfaceDto'];
1580
+ declare class ScopeInterfacesResource extends ScopesInterfacesResourceBase {
1581
+ /**
1582
+ * Add a Slack or Microsoft Teams interface to this scope.
1583
+ *
1584
+ * @param options - Interface type, optional name and config.
1585
+ * @returns The created interface.
1586
+ */
1587
+ create(options: AddScopeInterface): Promise<ScopeInterface>;
1588
+ /**
1589
+ * Update an interface on this scope.
1590
+ *
1591
+ * @param interfaceId - Interface id.
1592
+ * @param options - Updated name and/or config.
1593
+ * @param updateMask - Optional comma-separated field names to update.
1594
+ * @returns The updated interface.
1595
+ */
1596
+ update(interfaceId: string, options: UpdateScopeInterface, updateMask?: string): Promise<ScopeInterface>;
1597
+ }
1598
+
1599
+ /** Generated base for the management `scopes.supervision` resource. */
1600
+ declare class ScopesSupervisionResourceBase {
1601
+ protected readonly http: HttpClient;
1602
+ protected readonly config: ModusConfig;
1603
+ protected readonly scopeId: number | string;
1604
+ /** @internal */
1197
1605
  constructor(http: HttpClient, config: ModusConfig, scopeId: number | string);
1198
1606
  /**
1199
- * Get this scope's supervision configuration.
1607
+ * Read the scope subordinate supervision list.
1608
+ *
1609
+ * Returns the list of subordinate scope ids managed by this scope. `?view=active` (default) reads
1610
+ * the deployed supervision set; `?view=draft` reads the most recent builder snapshot. Returns 404
1611
+ * when the caller cannot at least `use` the scope.
1200
1612
  *
1201
- * @param options.view - Optional scope variation to inspect.
1202
- * @returns The supervision configuration.
1613
+ * **Requires:** `scopes:read`
1614
+ *
1615
+ * @param options.view - Which variation snapshot to read. Defaults to `active`.
1203
1616
  */
1204
1617
  get(options?: {
1205
1618
  view?: VariationView;
1206
1619
  }): Promise<Supervision>;
1207
1620
  /**
1208
- * Replace this scope's subordinate scopes.
1621
+ * Replace draft subordinate supervision list.
1622
+ *
1623
+ * Writes the supplied subordinate id list into the draft variation. Replaces the previous list
1624
+ * fully — supply an empty array to clear all subordinates. Requires manage permission on the
1625
+ * supervisor; the change is not visible to runners until the scope is deployed.
1209
1626
  *
1210
- * @param request - Replacement supervision configuration.
1211
- * @returns The updated supervision configuration.
1627
+ * **Requires:** `scopes:write`
1628
+ *
1629
+ * @param request - Request body; see `SetSupervisionRequest`.
1212
1630
  */
1213
1631
  set(request: SetSupervisionRequest): Promise<Supervision>;
1214
1632
  /**
1215
- * Replace subordinate scopes on the active (deployed) scope version.
1633
+ * Replace active subordinate supervision list.
1634
+ *
1635
+ * Writes directly into the active variation supervision set, bypassing the draft deploy cycle.
1636
+ * Requires `scopes:write` plus manage permission on the supervisor. Use to correct a live
1637
+ * supervision graph without going through the builder.
1216
1638
  *
1217
- * @param request - Replacement supervision configuration.
1218
- * @returns The updated supervision configuration.
1639
+ * **Requires:** `scopes:write`
1640
+ *
1641
+ * @param request - Request body; see `SetSupervisionRequest`.
1219
1642
  */
1220
1643
  setActive(request: SetSupervisionRequest): Promise<Supervision>;
1221
- private write;
1644
+ }
1645
+
1646
+ type Supervision = components['schemas']['SupervisionDto'];
1647
+ type SetSupervisionRequest = components['schemas']['SetSupervisionRequestDto'];
1648
+ declare class ScopeSupervisionResource extends ScopesSupervisionResourceBase {
1222
1649
  }
1223
1650
 
1224
1651
  /** The canonical `/api/v1/scopes` management operationIds. */
@@ -1245,6 +1672,7 @@ interface CreateScopeOptions {
1245
1672
  model?: string;
1246
1673
  connectionSet?: JsonObjectListInput;
1247
1674
  contextSelections?: JsonObjectListInput;
1675
+ includeOwnLearnings?: boolean;
1248
1676
  interfaces?: JsonObjectListInput;
1249
1677
  guardrails?: string[];
1250
1678
  }
@@ -1273,12 +1701,8 @@ type UpdateSkillOptions = UpdateScopeOptions;
1273
1701
  *
1274
1702
  * Call path: `mgmt.scopes` after `new ModusManagement(...)`.
1275
1703
  */
1276
- declare class ManagementScopesResource {
1277
- private readonly http;
1278
- private readonly config;
1704
+ declare class ManagementScopesResource extends ScopesResourceBase {
1279
1705
  protected readonly ops: ManagementScopesOperations;
1280
- /** @internal */
1281
- constructor(http: HttpClient, config: ModusConfig);
1282
1706
  /**
1283
1707
  * Conversations for a scope.
1284
1708
  *
@@ -1308,46 +1732,12 @@ declare class ManagementScopesResource {
1308
1732
  */
1309
1733
  supervision(scopeId: number | string): ScopeSupervisionResource;
1310
1734
  /**
1311
- * List scopes in the organization.
1312
- *
1313
- * @param options.pageSize - Maximum items per page (default 25).
1314
- * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
1315
- * @param options.search - Case-insensitive substring filter on the scope name.
1316
- * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
1317
- * @param options.managerId - Return only scopes supervised by this manager scope id.
1318
- * @returns A page of scopes — use `.autoPagingIter()` for all pages.
1319
- * @example
1320
- * ```ts
1321
- * const mgmt = new ModusManagement()
1322
- * for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {
1323
- * console.log(scope.id, scope.name, scope.status)
1324
- * }
1325
- * ```
1326
- */
1327
- list(options?: {
1328
- pageSize?: number;
1329
- pageToken?: string;
1330
- search?: string;
1331
- view?: VariationView;
1332
- managerId?: number;
1333
- }): Promise<Page<Scope>>;
1334
- private listPage;
1335
- /**
1336
- * Retrieve a scope with full configuration.
1735
+ * Slack and Microsoft Teams interfaces for a scope.
1337
1736
  *
1338
1737
  * @param scopeId - Scope id.
1339
- * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
1340
- * @returns The scope.
1341
- * @example
1342
- * ```ts
1343
- * const mgmt = new ModusManagement()
1344
- * const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')
1345
- * console.log(scope.name, scope.status)
1346
- * ```
1738
+ * @returns An interfaces resource scoped to the scope.
1347
1739
  */
1348
- get(scopeId: number | string, options?: {
1349
- view?: VariationView;
1350
- }): Promise<Scope>;
1740
+ interfaces(scopeId: number | string): ScopeInterfacesResource;
1351
1741
  /**
1352
1742
  * Create a new scope in the organization.
1353
1743
  *
@@ -1356,6 +1746,7 @@ declare class ManagementScopesResource {
1356
1746
  * @param options.instructions - Optional system instructions.
1357
1747
  * @param options.model - Optional model id.
1358
1748
  * @param options.toolset - Optional tool selection for the scope.
1749
+ * @param options.includeOwnLearnings - Whether the scope reads what is taught while using it. Defaults to true.
1359
1750
  * @param options.guardrails - Runtime guardrail labels (for example `"no-pii"`). Omit to create with no guardrails.
1360
1751
  * @returns The created scope (draft).
1361
1752
  * @example
@@ -1399,25 +1790,6 @@ declare class ManagementScopesResource {
1399
1790
  * ```
1400
1791
  */
1401
1792
  deploy(scopeId: number | string): Promise<Scope>;
1402
- /**
1403
- * Delete a scope.
1404
- *
1405
- * @param scopeId - Scope id.
1406
- * @returns Resolves when the scope is deleted.
1407
- * @example
1408
- * ```ts
1409
- * const mgmt = new ModusManagement()
1410
- * await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')
1411
- * ```
1412
- */
1413
- delete(scopeId: number | string): Promise<void>;
1414
- /**
1415
- * Restore a previously deleted scope.
1416
- *
1417
- * @param scopeId - Scope id.
1418
- * @returns The restored scope.
1419
- */
1420
- restore(scopeId: number | string): Promise<Scope>;
1421
1793
  /**
1422
1794
  * Start transferring ownership of a scope to another organization member.
1423
1795
  *
@@ -1428,10 +1800,6 @@ declare class ManagementScopesResource {
1428
1800
  requestOwnershipTransfer(scopeId: number | string, options: {
1429
1801
  newOwnerUserId: string;
1430
1802
  }): Promise<Scope>;
1431
- /** Cancel a pending scope ownership transfer. */
1432
- cancelOwnershipTransfer(scopeId: number | string): Promise<Scope>;
1433
- /** Accept a pending scope ownership transfer. */
1434
- acceptOwnershipTransfer(scopeId: number | string): Promise<Scope>;
1435
1803
  /**
1436
1804
  * Update MCP server configuration for a scope.
1437
1805
  *
@@ -1457,10 +1825,31 @@ type UsageReport = components['schemas']['ListUsageResponseDto'];
1457
1825
  type UsageRollup = 'hour' | 'day';
1458
1826
  type UsageUsersReport = components['schemas']['ListUsageUsersResponseDto'];
1459
1827
 
1460
- declare class ManagementUsageResource {
1461
- private readonly http;
1462
- private readonly config;
1828
+ /** Generated base for the management `usage` resource. */
1829
+ declare class UsageResourceBase {
1830
+ protected readonly http: HttpClient;
1831
+ protected readonly config: ModusConfig;
1832
+ /** @internal */
1463
1833
  constructor(http: HttpClient, config: ModusConfig);
1834
+ /**
1835
+ * List usage users.
1836
+ *
1837
+ * Returns the distinct acting-user emails that appear in your organization's LLM usage over the
1838
+ * `[since, until)` window. Feeds the usage page's user filter (includes non-Modus Slack/Teams
1839
+ * users). Scoped to your organization.
1840
+ *
1841
+ * **Requires:** `usage:read`
1842
+ *
1843
+ * @param options.since - ISO8601 start of the query window (inclusive).
1844
+ * @param options.until - ISO8601 end of the query window (exclusive).
1845
+ */
1846
+ listUsers(options: {
1847
+ since: string;
1848
+ until: string;
1849
+ }): Promise<UsageUsersReport>;
1850
+ }
1851
+
1852
+ declare class ManagementUsageResource extends UsageResourceBase {
1464
1853
  /**
1465
1854
  * List usage metrics for your organization over a time window.
1466
1855
  *
@@ -1480,39 +1869,38 @@ declare class ManagementUsageResource {
1480
1869
  model?: string;
1481
1870
  userEmail?: readonly string[];
1482
1871
  }): Promise<UsageReport>;
1483
- /**
1484
- * List distinct acting-user emails observed in a time window.
1485
- *
1486
- * @param options.since - Start of the window (ISO 8601, inclusive).
1487
- * @param options.until - End of the window (ISO 8601, exclusive).
1488
- * @returns User emails seen in usage during the window.
1489
- * @throws {UnprocessableError} When the request is rejected by the API.
1490
- * @throws {AuthenticationError} When the API key is invalid or missing.
1491
- */
1492
- listUsers(options: {
1493
- since: string;
1494
- until: string;
1495
- }): Promise<UsageUsersReport>;
1496
1872
  }
1497
1873
 
1498
1874
  type ToolCatalogEntry = components['schemas']['ToolCatalogEntryDto'];
1499
1875
 
1500
- declare class ManagementToolsResource {
1501
- private readonly http;
1502
- private readonly config;
1876
+ /** Generated base for the management `tools` resource. */
1877
+ declare class ToolsResourceBase {
1878
+ protected readonly http: HttpClient;
1879
+ protected readonly config: ModusConfig;
1880
+ /** @internal */
1503
1881
  constructor(http: HttpClient, config: ModusConfig);
1504
1882
  /**
1505
- * List tool and integration surfaces a scope can select in its toolset.
1883
+ * List available tools.
1884
+ *
1885
+ * Returns a page of known tool/integration surfaces a scope can select in its toolset, with the
1886
+ * fixed actions for built-in tools.
1506
1887
  *
1507
- * @param options.pageSize - Maximum items per page (default 25).
1508
- * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
1509
- * @returns A page of tool catalog entries.
1888
+ * **Requires:** `scopes:read`
1889
+ *
1890
+ * @param options.pageSize - Items per page. Defaults to 25.
1891
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
1892
+ * for the first page.
1893
+ * @returns A page of tools.
1510
1894
  */
1511
1895
  list(options?: {
1512
1896
  pageSize?: number;
1513
1897
  pageToken?: string;
1514
1898
  }): Promise<Page<ToolCatalogEntry>>;
1515
- private listPage;
1899
+ protected listPage(pageSize: number, pageToken: string | undefined): Promise<Page<ToolCatalogEntry>>;
1900
+ }
1901
+
1902
+ /** Browse the catalog of tool and integration surfaces a scope can select in its toolset. */
1903
+ declare class ManagementToolsResource extends ToolsResourceBase {
1516
1904
  }
1517
1905
 
1518
1906
  type MemberGroup = components['schemas']['MemberGroupDto'];
@@ -1544,4 +1932,4 @@ declare class ModusManagement extends ModusClientBase {
1544
1932
  constructor(options?: ModusOptions);
1545
1933
  }
1546
1934
 
1547
- export { type AgentSelectionInput, type BulkUploadFromUrlsResult, type BulkUploadUrlsResult, type CreateAgentOptions, type CreateDashboardElementInput, type CreateDashboardInput, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type Dashboard, type DashboardDraftSnapshot, type DashboardElementKind, type DashboardElementLayout, type DashboardElementPatch, type DashboardElementResult, type DashboardElementSummary, type DashboardElementsList, type DashboardLayoutElement, type DashboardPublishResult, type DashboardVersion, type DashboardView, type FailedUploadFromUrl, type FailedUploadUrl, type FileUpload, type FileUploadStatus, type FinalizeInput, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type PublishDashboardInput, type ToolsetInput, type TransferDashboardOwnershipInput, type TriggerInput, type UpdateAgentOptions, type UpdateDashboardAccessInput, type UpdateDashboardDraftInput, type UpdateDashboardElementInput, type UpdateDashboardLayoutInput, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UploadDirFailure, type UploadDirResult, type UploadFileInput, type UploadFromUrlInput, type UploadProgress, type UploadProgressCallback, type UploadUrlInput, type UploadUrlSlot, type UserFeedback, type WaitUntil, type WorkflowGraphInput };
1935
+ export { type AgentSelectionInput, type BulkUploadFromUrlsResult, type BulkUploadUrlsResult, ContextItemDeletion, ContextItemMove, type CreateAgentOptions, type CreateDashboardElementInput, type CreateDashboardInput, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type Dashboard, type DashboardDraftSnapshot, type DashboardElementKind, type DashboardElementLayout, type DashboardElementPatch, type DashboardElementResult, type DashboardElementSummary, type DashboardElementsList, type DashboardLayoutElement, type DashboardPublishResult, type DashboardVersion, type DashboardView, type FailedUploadFromUrl, type FailedUploadUrl, type FileUpload, type FileUploadStatus, type FinalizeInput, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type PublishDashboardInput, type ToolsetInput, type TransferDashboardOwnershipInput, type TriggerInput, type UpdateAgentOptions, type UpdateDashboardAccessInput, type UpdateDashboardDraftInput, type UpdateDashboardElementInput, type UpdateDashboardLayoutInput, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UploadDirFailure, type UploadDirResult, type UploadFileInput, type UploadFromUrlInput, type UploadProgress, type UploadProgressCallback, type UploadUrlInput, type UploadUrlSlot, type UserFeedback, type WaitUntil, type WorkflowGraphInput };