@getmodus/sdk 0.6.0 → 0.7.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,4 +1,4 @@
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-BRg8gEKX.js';
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';
2
2
 
3
3
  type AgentInterface = components['schemas']['AgentInterfaceDto'];
4
4
  type AddAgentInterface = components['schemas']['AddAgentInterfaceDto'];
@@ -91,6 +91,13 @@ declare class ManagementWorkflowsResource {
91
91
  * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
92
92
  * @param options.includeVariation - Include variation payload on each list row.
93
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
+ * ```
94
101
  */
95
102
  list(options?: {
96
103
  pageSize?: number;
@@ -107,6 +114,12 @@ declare class ManagementWorkflowsResource {
107
114
  * @param workflowId - Workflow id.
108
115
  * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
109
116
  * @returns The workflow.
117
+ * @example
118
+ * ```ts
119
+ * const mgmt = new ModusManagement()
120
+ * const wf = await mgmt.workflows.get('weekly-digest')
121
+ * console.log(wf.name, wf.status)
122
+ * ```
110
123
  */
111
124
  get(workflowId: number | string, options?: {
112
125
  view?: VariationView;
@@ -128,7 +141,8 @@ declare class ManagementWorkflowsResource {
128
141
  * @returns The created workflow (draft).
129
142
  * @example
130
143
  * ```ts
131
- * const wf = await mgmt.workflows.create({ name: 'Daily report', type: WorkflowType.Task })
144
+ * const mgmt = new ModusManagement()
145
+ * const wf = await mgmt.workflows.create({ name: 'Daily report', type: 'task' })
132
146
  * ```
133
147
  */
134
148
  create(options: CreateWorkflowOptions): Promise<Workflow>;
@@ -142,6 +156,11 @@ declare class ManagementWorkflowsResource {
142
156
  * @param options.guardrails - Guardrail labels to set. Fetches the current workflow first to merge. Pass `[]` to clear all.
143
157
  * @param options.updateMask - Comma-separated field names to update or clear.
144
158
  * @returns The updated workflow.
159
+ * @example
160
+ * ```ts
161
+ * const mgmt = new ModusManagement()
162
+ * const wf = await mgmt.workflows.update('PLACEHOLDER_WORKFLOW_ID', { description: 'Runs every morning' })
163
+ * ```
145
164
  */
146
165
  update(workflowId: number | string, options?: UpdateWorkflowOptions): Promise<Workflow>;
147
166
  /**
@@ -151,8 +170,9 @@ declare class ManagementWorkflowsResource {
151
170
  * @returns The published workflow.
152
171
  * @example
153
172
  * ```ts
154
- * await mgmt.workflows.update(workflowId, { description: 'Runs every morning' })
155
- * const published = await mgmt.workflows.deploy(workflowId)
173
+ * const mgmt = new ModusManagement()
174
+ * await mgmt.workflows.update('PLACEHOLDER_WORKFLOW_ID', { description: 'Runs every morning' })
175
+ * const published = await mgmt.workflows.deploy('PLACEHOLDER_WORKFLOW_ID')
156
176
  * ```
157
177
  */
158
178
  deploy(workflowId: number | string): Promise<Workflow>;
@@ -171,6 +191,11 @@ declare class ManagementWorkflowsResource {
171
191
  *
172
192
  * @param workflowId - Workflow id.
173
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
+ * ```
174
199
  */
175
200
  delete(workflowId: number | string): Promise<void>;
176
201
  /**
@@ -255,6 +280,422 @@ declare class ManagementContextItemsResource {
255
280
 
256
281
  type UserFeedback = 'positive' | 'neutral' | 'negative';
257
282
 
283
+ /** A whole dashboard, including its draft definition and `draftRevision`. */
284
+ type Dashboard = components['schemas']['DashboardDto'];
285
+ /** Every tile and filter on a dashboard draft, plus the current `draftRevision`. */
286
+ type DashboardElementsList = components['schemas']['DashboardElementsListResponseDto'];
287
+ /** One tile or filter in a list result. */
288
+ type DashboardElementSummary = components['schemas']['DashboardElementSummaryDto'];
289
+ /** One element's full draft settings, plus the current `draftRevision`. */
290
+ type DashboardElementResult = components['schemas']['DashboardElementResponseDto'];
291
+ /** `"chart"`, `"kpi"`, `"table"`, `"markdown"` or `"filter"`. */
292
+ type DashboardElementKind = components['schemas']['DashboardElementKind'];
293
+ /** Grid position of an element: `x` (0-11), `y`, `w` (1-12) and `h`. */
294
+ type DashboardElementLayout = components['schemas']['DashboardElementLayoutDto'];
295
+ /** Settings to change on one element; `null` clears a setting that supports clearing. */
296
+ type DashboardElementPatch = components['schemas']['DashboardElementPatchDto'];
297
+ /** One element and its final grid position for `updateLayout()`. */
298
+ type DashboardLayoutElement = components['schemas']['DashboardLayoutElementDto'];
299
+ /** Input for `elements(id).create()`. */
300
+ type CreateDashboardElementInput = components['schemas']['CreateDashboardElementDto'];
301
+ /** Input for `elements(id).update()`. */
302
+ type UpdateDashboardElementInput = components['schemas']['UpdateDashboardElementDto'];
303
+ /** Input for `updateLayout()`. */
304
+ type UpdateDashboardLayoutInput = components['schemas']['UpdateDashboardLayoutDto'];
305
+ /** One published version or draft snapshot of a dashboard, with its full definition. */
306
+ type DashboardVersion = components['schemas']['DashboardVersionDto'];
307
+ /** One saved snapshot of a dashboard draft: its id, author and time. */
308
+ type DashboardDraftSnapshot = components['schemas']['DashboardDraftSnapshotDto'];
309
+ /** Result of `publish()`: the published dashboard and the new version. */
310
+ type DashboardPublishResult = components['schemas']['PublishDashboardResponseDto'];
311
+ /** `"active"` (the published version) or `"draft"` (the working draft). */
312
+ type DashboardView = components['schemas']['DashboardView'];
313
+ /** Input for `create()`. */
314
+ type CreateDashboardInput = components['schemas']['CreateDashboardDto'];
315
+ /** Input for `updateDraft()`. */
316
+ type UpdateDashboardDraftInput = components['schemas']['UpdateDashboardDraftDto'];
317
+ /** Input for `publish()`. */
318
+ type PublishDashboardInput = components['schemas']['PublishDashboardDto'];
319
+ /** Input for `updateAccess()`; all three settings replace the current ones. */
320
+ type UpdateDashboardAccessInput = components['schemas']['UpdateDashboardAccessDto'];
321
+ /** Input for `requestOwnershipTransfer()`. */
322
+ type TransferDashboardOwnershipInput = components['schemas']['TransferDashboardOwnershipDto'];
323
+
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;
336
+ /** @internal */
337
+ constructor(http: HttpClient, config: ModusConfig, dashboardId: string);
338
+ /**
339
+ * List every tile and filter on the dashboard draft.
340
+ *
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
+ * @example
345
+ * ```ts
346
+ * const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
347
+ * listed.elements.map((element) => element.id)
348
+ * ```
349
+ */
350
+ list(): Promise<DashboardElementsList>;
351
+ /**
352
+ * Get the full draft settings of one tile or filter.
353
+ *
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
+ * @example
359
+ * ```ts
360
+ * const result = await mgmt.context.dashboards.elements('DASHBOARD_ID').get('ELEMENT_ID')
361
+ * result.element.title
362
+ * ```
363
+ */
364
+ get(elementId: string): Promise<DashboardElementResult>;
365
+ /**
366
+ * Add a blank tile or filter to the dashboard draft.
367
+ *
368
+ * Modus assigns the new element's id; configure it afterwards with `update()`.
369
+ *
370
+ * @param input.expectedRevision - The `draftRevision` your change is based on.
371
+ * @param input.kind - `chart`, `kpi`, `table`, `markdown` or `filter`.
372
+ * @param input.title - Title shown on the element.
373
+ * @param input.layout - Grid position with `x` (0-11), `y`, `w` (1-12) and `h`.
374
+ * @returns The created element and the new `draftRevision`.
375
+ * @throws ConflictError - The draft changed since `expectedRevision`; list the
376
+ * elements again and retry with the new revision.
377
+ * @example
378
+ * ```ts
379
+ * const created = await mgmt.context.dashboards.elements('DASHBOARD_ID').create({
380
+ * expectedRevision: 3,
381
+ * kind: 'chart',
382
+ * title: 'Sales by region',
383
+ * layout: { x: 0, y: 4, w: 6, h: 4 },
384
+ * })
385
+ * ```
386
+ */
387
+ create(input: CreateDashboardElementInput): Promise<DashboardElementResult>;
388
+ /**
389
+ * Change settings of one tile or filter on the dashboard draft.
390
+ *
391
+ * @param elementId - Id of the tile or filter to change.
392
+ * @param input.expectedRevision - The `draftRevision` your change is based on.
393
+ * @param input.patch - The settings to change, for example `{ title: 'Sales' }`
394
+ * or `{ defaultValue: null }`. `null` clears a setting that supports clearing.
395
+ * @returns The whole dashboard after the change, including the new `draftRevision`.
396
+ * @throws ConflictError - The draft changed since `expectedRevision`.
397
+ * @throws NotFoundError - The dashboard or the element does not exist, or you cannot
398
+ * edit the dashboard.
399
+ * @example
400
+ * ```ts
401
+ * const dashboard = await mgmt.context.dashboards
402
+ * .elements('DASHBOARD_ID')
403
+ * .update('ELEMENT_ID', { expectedRevision: 3, patch: { title: 'Revenue' } })
404
+ * ```
405
+ */
406
+ update(elementId: string, input: UpdateDashboardElementInput): Promise<Dashboard>;
407
+ }
408
+ /**
409
+ * Dashboards in the Modus knowledge base.
410
+ *
411
+ * Call path: `mgmt.context.dashboards` after `new ModusManagement(...)`.
412
+ *
413
+ * - `list()`, `get()`, `create()`, `updateDraft()`, `publish()`, `delete()` — dashboards.
414
+ * - `listVersions()`, `getVersion()`, `restoreVersion()`, `listDraftSnapshots()` — history.
415
+ * - `updateAccess()` — who can open and edit a dashboard.
416
+ * - `requestOwnershipTransfer()`, `acceptOwnershipTransfer()`, `cancelOwnershipTransfer()`.
417
+ * - `elements(dashboardId)` — list, get, create and update tiles and filters.
418
+ * - `updateLayout(dashboardId, input)` — move or resize several elements at once.
419
+ */
420
+ declare class ManagementDashboardsResource {
421
+ private readonly http;
422
+ private readonly config;
423
+ /** @internal */
424
+ constructor(http: HttpClient, config: ModusConfig);
425
+ /**
426
+ * List dashboards with their full definitions.
427
+ *
428
+ * @param options.view - `active` (default) lists published dashboards you can open;
429
+ * `draft` lists the drafts of dashboards you can edit.
430
+ * @returns Every matching dashboard. The list is not paginated.
431
+ * @example
432
+ * ```ts
433
+ * const drafts = await mgmt.context.dashboards.list({ view: 'draft' })
434
+ * drafts.map((dashboard) => [dashboard.id, dashboard.draftRevision])
435
+ * ```
436
+ */
437
+ list(options?: {
438
+ view?: DashboardView;
439
+ }): Promise<Dashboard[]>;
440
+ /**
441
+ * Get one dashboard with its full definition.
442
+ *
443
+ * @param dashboardId - Id of the dashboard.
444
+ * @param options.view - `active` (default) returns the published version; `draft`
445
+ * returns the working draft and requires edit access.
446
+ * @returns The dashboard, including `draftRevision` for the next change.
447
+ * @throws NotFoundError - The dashboard does not exist or you cannot open it.
448
+ * @example
449
+ * ```ts
450
+ * const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })
451
+ * draft.draftRevision
452
+ * ```
453
+ */
454
+ get(dashboardId: string, options?: {
455
+ view?: DashboardView;
456
+ }): Promise<Dashboard>;
457
+ /**
458
+ * Create a dashboard draft.
459
+ *
460
+ * The new dashboard is not visible to others until you `publish()` it.
461
+ *
462
+ * @param input.title - Dashboard title.
463
+ * @param input.definition - Tiles, filters and layout, for example
464
+ * `{ tiles: [], filters: [] }`. Element ids must be unique.
465
+ * @param input.description - Optional dashboard description.
466
+ * @param input.access - Optional `visibility`, `groupPermissions` and `sharedWith`.
467
+ * Defaults to private.
468
+ * @returns The created dashboard in its draft view.
469
+ * @throws ModusError - The definition or access settings are invalid.
470
+ * @example
471
+ * ```ts
472
+ * const dashboard = await mgmt.context.dashboards.create({
473
+ * title: 'Revenue',
474
+ * definition: { tiles: [], filters: [] },
475
+ * })
476
+ * dashboard.id
477
+ * ```
478
+ */
479
+ create(input: CreateDashboardInput): Promise<Dashboard>;
480
+ /**
481
+ * Replace the whole draft definition, and optionally the title and description.
482
+ *
483
+ * @param dashboardId - Id of the dashboard.
484
+ * @param input.expectedRevision - The `draftRevision` your change is based on.
485
+ * @param input.definition - The complete new definition. Tiles and filters left
486
+ * out are removed.
487
+ * @param input.title - New title; unchanged when omitted.
488
+ * @param input.description - New description; unchanged when omitted.
489
+ * @returns The dashboard draft after the change, including the new `draftRevision`.
490
+ * @throws ConflictError - The draft changed since `expectedRevision`; get the draft
491
+ * again and retry with the new revision.
492
+ * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
493
+ * @example
494
+ * ```ts
495
+ * const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })
496
+ * await mgmt.context.dashboards.updateDraft('DASHBOARD_ID', {
497
+ * expectedRevision: draft.draftRevision,
498
+ * definition: draft.definition,
499
+ * title: 'Revenue',
500
+ * })
501
+ * ```
502
+ */
503
+ updateDraft(dashboardId: string, input: UpdateDashboardDraftInput): Promise<Dashboard>;
504
+ /**
505
+ * Publish the draft as a new version that everyone with access sees.
506
+ *
507
+ * Alert workflows defined on the dashboard are updated to match.
508
+ *
509
+ * @param dashboardId - Id of the dashboard.
510
+ * @param input.expectedRevision - The `draftRevision` you reviewed and want to publish.
511
+ * @returns The published `dashboard` and the new `version`.
512
+ * @throws ConflictError - The draft changed since `expectedRevision`.
513
+ * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
514
+ * @example
515
+ * ```ts
516
+ * const result = await mgmt.context.dashboards.publish('DASHBOARD_ID', { expectedRevision: 4 })
517
+ * result.version.versionNumber
518
+ * ```
519
+ */
520
+ 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
+ /**
596
+ * Replace who can open and edit a dashboard.
597
+ *
598
+ * All three settings are required and replace the current ones.
599
+ *
600
+ * @param dashboardId - Id of the dashboard.
601
+ * @param input.visibility - `shared` (the owner plus the groups in
602
+ * `groupPermissions`) or `private` (the owner plus the users in `sharedWith`).
603
+ * @param input.groupPermissions - Group id to `{ use, manage }`. Used only when shared.
604
+ * @param input.sharedWith - Users such as `{ email: 'ana@example.com', permission: 'use' }`.
605
+ * Used only when private.
606
+ * @returns The dashboard with its new access settings.
607
+ * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
608
+ * @throws ModusError - A group, user or permission is invalid.
609
+ * @example
610
+ * ```ts
611
+ * await mgmt.context.dashboards.updateAccess('DASHBOARD_ID', {
612
+ * visibility: 'private',
613
+ * groupPermissions: {},
614
+ * sharedWith: [{ email: 'ana@example.com', permission: 'use' }],
615
+ * })
616
+ * ```
617
+ */
618
+ updateAccess(dashboardId: string, input: UpdateDashboardAccessInput): Promise<Dashboard>;
619
+ /**
620
+ * Ask another member of your organization to take ownership of a dashboard.
621
+ *
622
+ * Only the owner can request a transfer. Ownership moves when the recipient
623
+ * calls `acceptOwnershipTransfer()`.
624
+ *
625
+ * @param dashboardId - Id of the dashboard.
626
+ * @param input.newOwnerUserId - User id of the member who should become the owner.
627
+ * @returns The dashboard with `pendingOwnershipTransfer` set.
628
+ * @throws PermissionDeniedError - You are not the owner.
629
+ * @throws NotFoundError - The dashboard does not exist or you cannot open it.
630
+ * @example
631
+ * ```ts
632
+ * await mgmt.context.dashboards.requestOwnershipTransfer('DASHBOARD_ID', {
633
+ * newOwnerUserId: 'USER_ID',
634
+ * })
635
+ * ```
636
+ */
637
+ 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
+ /**
669
+ * Work with the tiles and filters of one dashboard draft.
670
+ *
671
+ * @param dashboardId - Id of the dashboard.
672
+ * @returns A resource bound to that dashboard.
673
+ * @example
674
+ * ```ts
675
+ * await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
676
+ * ```
677
+ */
678
+ elements(dashboardId: string): ManagementDashboardElementsResource;
679
+ /**
680
+ * Move or resize several tiles and filters in one change.
681
+ *
682
+ * @param dashboardId - Id of the dashboard.
683
+ * @param input.expectedRevision - The `draftRevision` your change is based on.
684
+ * @param input.elements - Every element to place, each with `elementId` and its
685
+ * final `layout`.
686
+ * @returns The whole dashboard after the change, including the new `draftRevision`.
687
+ * @throws ConflictError - The draft changed since `expectedRevision`.
688
+ * @example
689
+ * ```ts
690
+ * await mgmt.context.dashboards.updateLayout('DASHBOARD_ID', {
691
+ * expectedRevision: 3,
692
+ * elements: [{ elementId: 'ELEMENT_ID', layout: { x: 0, y: 0, w: 12, h: 2 } }],
693
+ * })
694
+ * ```
695
+ */
696
+ updateLayout(dashboardId: string, input: UpdateDashboardLayoutInput): Promise<Dashboard>;
697
+ }
698
+
258
699
  type FileUpload = components['schemas']['FileUploadResourceDto'];
259
700
  type FileUploadStatus = components['schemas']['FileUploadResourceStatus'];
260
701
  type UploadUrlSlot = components['schemas']['UploadUrlResponseDto'];
@@ -274,6 +715,12 @@ interface UploadUrlInput {
274
715
  interface UploadFromUrlInput {
275
716
  url: string;
276
717
  fileName?: string;
718
+ folderPath?: string;
719
+ }
720
+ /** A local file and its optional durable folder label for `uploadFiles()`. */
721
+ interface UploadFileInput {
722
+ path: string;
723
+ folderPath?: string;
277
724
  }
278
725
  /** A single file that failed during `uploadDir()` (slot creation or PUT/poll). */
279
726
  interface UploadDirFailure {
@@ -285,6 +732,31 @@ interface UploadDirResult {
285
732
  uploaded: FileUpload[];
286
733
  failed: UploadDirFailure[];
287
734
  }
735
+ /** Progress event after each file succeeds or fails in a batch upload. */
736
+ interface UploadProgress {
737
+ completed: number;
738
+ total: number;
739
+ succeeded: number;
740
+ failed: number;
741
+ }
742
+ type UploadProgressCallback = (progress: UploadProgress) => void;
743
+ /** One entry of a bulk finalize request. */
744
+ interface FinalizeInput {
745
+ uploadId: string;
746
+ fileName: string;
747
+ folderPath?: string;
748
+ }
749
+ /** One entry that could not be finalized. */
750
+ interface FinalizeFailure {
751
+ index: number;
752
+ uploadId: string;
753
+ error: string;
754
+ }
755
+ /** Result of `finalizeMany` — partial success, never a partial 4xx. */
756
+ interface BulkFinalizeResult {
757
+ finalized: FileUpload[];
758
+ failed: FinalizeFailure[];
759
+ }
288
760
 
289
761
  /**
290
762
  * Durable file uploads for `ModusManagement`.
@@ -307,7 +779,10 @@ declare class ManagementContextFilesResource {
307
779
  * Office/OpenDocument documents, audio, and video.
308
780
  * @param input.fileSize - File size in bytes. Rejected above 50MB.
309
781
  * @returns Presigned upload slot. PUT the raw bytes to `uploadUrl` within 15
310
- * minutes, then poll `get(uploadId)` — there is no separate finalize call.
782
+ * minutes, then call `finalize(slot.uploadId, slot.fileName)`. Pass the
783
+ * slot's own `fileName` rather than your local basename — the server may
784
+ * sanitize the requested name when it mints the key, and finalization
785
+ * re-derives the key from `uploadId` and `fileName`.
311
786
  */
312
787
  createUploadUrl(input: UploadUrlInput): Promise<UploadUrlSlot>;
313
788
  /**
@@ -328,6 +803,7 @@ declare class ManagementContextFilesResource {
328
803
  */
329
804
  uploadFromUrl(url: string, options?: {
330
805
  fileName?: string;
806
+ folderPath?: string;
331
807
  }): Promise<FileUpload>;
332
808
  /**
333
809
  * Fetch up to 100 files from URLs in one call.
@@ -357,6 +833,47 @@ declare class ManagementContextFilesResource {
357
833
  pageToken?: string;
358
834
  }): Promise<Page<FileUpload>>;
359
835
  private listPage;
836
+ /**
837
+ * Turn a file already PUT to a presigned URL into durable context.
838
+ *
839
+ * Call this once the PUT completes. The server locates the object from
840
+ * `uploadId` + `fileName` and validates the bytes that actually arrived.
841
+ * Safe to retry — a second call returns the same resource.
842
+ *
843
+ * @param uploadId - Upload id returned by `createUploadUrl`.
844
+ * @param fileName - File name returned alongside it.
845
+ * @returns The file upload resource, status `"processing"`.
846
+ */
847
+ finalize(uploadId: string, fileName: string, options?: {
848
+ folderPath?: string;
849
+ }): Promise<FileUpload>;
850
+ /**
851
+ * Finalize up to 100 uploads in one call.
852
+ *
853
+ * What makes directory upload cheap: 2000 files cost 20 requests here rather
854
+ * than 2000.
855
+ *
856
+ * @param uploads - Uploads to finalize (max 100).
857
+ * @returns Resources for every upload that finalized, plus per-index
858
+ * failures for the rest — never a partial 4xx.
859
+ */
860
+ finalizeMany(uploads: readonly FinalizeInput[]): Promise<BulkFinalizeResult>;
861
+ /**
862
+ * Upload an explicit list of local files.
863
+ *
864
+ * Same machinery as `uploadDir`, without the directory walk — use it when
865
+ * the caller already knows which files to send.
866
+ *
867
+ * @param paths - Paths to local files.
868
+ * @param options.concurrency - Max concurrent PUTs (default 10).
869
+ * @param options.waitUntil - `"processing"` (default) or `"ready"`.
870
+ * @param options.onProgress - Optional progress callback after each file.
871
+ */
872
+ uploadFiles(paths: readonly (string | UploadFileInput)[], options?: {
873
+ concurrency?: number;
874
+ waitUntil?: WaitUntil;
875
+ onProgress?: UploadProgressCallback;
876
+ }): Promise<UploadDirResult>;
360
877
  /**
361
878
  * Upload a local file and wait for it to reach `"processing"` or `"ready"`.
362
879
  *
@@ -389,6 +906,7 @@ declare class ManagementContextFilesResource {
389
906
  * @param options.recursive - Recurse into subdirectories (default `true`).
390
907
  * @param options.concurrency - Max concurrent PUT+poll operations (default 10).
391
908
  * @param options.waitUntil - `"processing"` (default) or `"ready"` — same as `upload()`.
909
+ * @param options.onProgress - Optional progress callback after each file.
392
910
  * @returns `UploadDirResult` with every successful `FileUpload` and every
393
911
  * per-file failure (slot creation or PUT/poll), each tagged with its local path.
394
912
  */
@@ -396,7 +914,11 @@ declare class ManagementContextFilesResource {
396
914
  recursive?: boolean;
397
915
  concurrency?: number;
398
916
  waitUntil?: WaitUntil;
917
+ onProgress?: UploadProgressCallback;
399
918
  }): Promise<UploadDirResult>;
919
+ /** Shared body of `uploadFiles` and `uploadDir`: presign in batches of 100,
920
+ * PUT with bounded concurrency, then bulk-finalize the batch. */
921
+ private uploadPaths;
400
922
  private createSlots;
401
923
  private uploadBatch;
402
924
  }
@@ -412,6 +934,7 @@ declare class ManagementContextResource {
412
934
  readonly items: ManagementContextItemsResource;
413
935
  readonly customItems: CustomContextItemsResource;
414
936
  readonly files: ManagementContextFilesResource;
937
+ readonly dashboards: ManagementDashboardsResource;
415
938
  /** @internal */
416
939
  constructor(http: HttpClient, config: ModusConfig);
417
940
  /**
@@ -422,6 +945,7 @@ declare class ManagementContextResource {
422
945
  * @returns The created context item.
423
946
  * @example
424
947
  * ```ts
948
+ * const mgmt = new ModusManagement()
425
949
  * const note = await mgmt.context.createNote('Runbook', '# Steps\n1. Check logs')
426
950
  * ```
427
951
  */
@@ -437,6 +961,14 @@ declare class ManagementContextResource {
437
961
  * @param options.body - New markdown body.
438
962
  * @param options.existing - Optional cached item to avoid a GET.
439
963
  * @returns The updated context item.
964
+ * @example
965
+ * ```ts
966
+ * const mgmt = new ModusManagement()
967
+ * const item = await mgmt.context.updateNote('PLACEHOLDER_UID', {
968
+ * title: 'Runbook',
969
+ * body: '# Steps\n1. Check logs\n2. Escalate',
970
+ * })
971
+ * ```
440
972
  */
441
973
  updateNote(uid: string, options: {
442
974
  title: string;
@@ -454,6 +986,14 @@ declare class ManagementContextResource {
454
986
  * @param options.query - SQL text.
455
987
  * @param options.path - Optional hierarchy path segments.
456
988
  * @returns The created context item.
989
+ * @example
990
+ * ```ts
991
+ * const mgmt = new ModusManagement()
992
+ * const query = await mgmt.context.createSavedQuery('Monthly ARR', {
993
+ * connectionId: 'conn_warehouse',
994
+ * query: 'select * from arr_monthly',
995
+ * })
996
+ * ```
457
997
  */
458
998
  createSavedQuery(name: string, options: {
459
999
  query?: string;
@@ -469,6 +1009,14 @@ declare class ManagementContextResource {
469
1009
  * @param options.query - New SQL text.
470
1010
  * @param options.existing - Optional cached item to avoid a GET.
471
1011
  * @returns The updated context item.
1012
+ * @example
1013
+ * ```ts
1014
+ * const mgmt = new ModusManagement()
1015
+ * const item = await mgmt.context.updateSavedQuery('PLACEHOLDER_UID', {
1016
+ * name: 'Monthly ARR',
1017
+ * query: 'select sum(amount) from arr_monthly',
1018
+ * })
1019
+ * ```
472
1020
  */
473
1021
  updateSavedQuery(uid: string, options: {
474
1022
  name: string;
@@ -488,6 +1036,13 @@ declare class ManagementContextResource {
488
1036
  * @param options.isCrawl - When true, crawl linked pages into context.
489
1037
  * @param options.pageLimit - Maximum pages to crawl when `isCrawl` is true.
490
1038
  * @returns The created context item.
1039
+ * @example
1040
+ * ```ts
1041
+ * const mgmt = new ModusManagement()
1042
+ * const link = await mgmt.context.createLink('https://docs.example.com/runbook', {
1043
+ * title: 'Ops runbook',
1044
+ * })
1045
+ * ```
491
1046
  */
492
1047
  createLink(url: string, options?: {
493
1048
  title?: string;
@@ -504,6 +1059,13 @@ declare class ManagementContextResource {
504
1059
  * @param options.url - New URL.
505
1060
  * @param options.existing - Optional cached item to avoid a GET.
506
1061
  * @returns The updated context item.
1062
+ * @example
1063
+ * ```ts
1064
+ * const mgmt = new ModusManagement()
1065
+ * const item = await mgmt.context.updateLink('PLACEHOLDER_UID', {
1066
+ * title: 'Ops runbook (2025)',
1067
+ * })
1068
+ * ```
507
1069
  */
508
1070
  updateLink(uid: string, options: {
509
1071
  title?: string;
@@ -753,7 +1315,14 @@ declare class ManagementScopesResource {
753
1315
  * @param options.search - Case-insensitive substring filter on the scope name.
754
1316
  * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
755
1317
  * @param options.managerId - Return only scopes supervised by this manager scope id.
756
- * @returns A page of scopes.
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
+ * ```
757
1326
  */
758
1327
  list(options?: {
759
1328
  pageSize?: number;
@@ -769,6 +1338,12 @@ declare class ManagementScopesResource {
769
1338
  * @param scopeId - Scope id.
770
1339
  * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
771
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
+ * ```
772
1347
  */
773
1348
  get(scopeId: number | string, options?: {
774
1349
  view?: VariationView;
@@ -785,7 +1360,9 @@ declare class ManagementScopesResource {
785
1360
  * @returns The created scope (draft).
786
1361
  * @example
787
1362
  * ```ts
1363
+ * const mgmt = new ModusManagement()
788
1364
  * const scope = await mgmt.scopes.create({ name: 'Support assistant', model: 'claude-sonnet-5' })
1365
+ * console.log(scope.id, scope.name)
789
1366
  * ```
790
1367
  */
791
1368
  create(options: CreateScopeOptions): Promise<Scope>;
@@ -799,6 +1376,13 @@ declare class ManagementScopesResource {
799
1376
  * @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.
800
1377
  * @param options.updateMask - Comma-separated field names to update or clear.
801
1378
  * @returns The updated scope.
1379
+ * @example
1380
+ * ```ts
1381
+ * const mgmt = new ModusManagement()
1382
+ * const scope = await mgmt.scopes.update('PLACEHOLDER_SCOPE_ID', {
1383
+ * description: 'Answers billing questions for enterprise customers.',
1384
+ * })
1385
+ * ```
802
1386
  */
803
1387
  update(scopeId: number | string, options?: UpdateScopeOptions): Promise<Scope>;
804
1388
  /**
@@ -808,8 +1392,10 @@ declare class ManagementScopesResource {
808
1392
  * @returns The published scope.
809
1393
  * @example
810
1394
  * ```ts
811
- * await mgmt.scopes.update(scopeId, { instructions: ['Be concise.'] })
812
- * const published = await mgmt.scopes.deploy(scopeId)
1395
+ * const mgmt = new ModusManagement()
1396
+ * const scope = await mgmt.scopes.create({ name: 'Support assistant' })
1397
+ * const published = await mgmt.scopes.deploy(scope.id)
1398
+ * console.log(published.status)
813
1399
  * ```
814
1400
  */
815
1401
  deploy(scopeId: number | string): Promise<Scope>;
@@ -818,6 +1404,11 @@ declare class ManagementScopesResource {
818
1404
  *
819
1405
  * @param scopeId - Scope id.
820
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
+ * ```
821
1412
  */
822
1413
  delete(scopeId: number | string): Promise<void>;
823
1414
  /**
@@ -953,4 +1544,4 @@ declare class ModusManagement extends ModusClientBase {
953
1544
  constructor(options?: ModusOptions);
954
1545
  }
955
1546
 
956
- export { type AgentSelectionInput, type BulkUploadFromUrlsResult, type BulkUploadUrlsResult, type CreateAgentOptions, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type FailedUploadFromUrl, type FailedUploadUrl, type FileUpload, type FileUploadStatus, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type ToolsetInput, type TriggerInput, type UpdateAgentOptions, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UploadDirFailure, type UploadDirResult, type UploadFromUrlInput, type UploadUrlInput, type UploadUrlSlot, type UserFeedback, type WaitUntil, type WorkflowGraphInput };
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 };