@getmodus/sdk 0.8.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.
@@ -217,7 +217,7 @@ function formatConfigForLog(config) {
217
217
  }
218
218
 
219
219
  // src/_http.ts
220
- var USER_AGENT = `modus-typescript/${"0.8.0"} (node/${process.version}; ${process.platform})`;
220
+ var USER_AGENT = `modus-typescript/${"0.9.0"} (node/${process.version}; ${process.platform})`;
221
221
  function buildUrl(baseUrl, path, params) {
222
222
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
223
223
  if (params) {
@@ -472,15 +472,6 @@ var ModusClientBase = class {
472
472
  }
473
473
  };
474
474
 
475
- // src/_query.ts
476
- function updateMaskQuery(updateMask) {
477
- if (updateMask === void 0) return void 0;
478
- if (!updateMask.trim()) {
479
- throw new Error("update_mask must be a non-empty comma-separated list of field names");
480
- }
481
- return { updateMask };
482
- }
483
-
484
475
  // src/_pagination.ts
485
476
  var Page = class {
486
477
  constructor(items, nextPageToken, fetchPage) {
@@ -576,6 +567,16 @@ var OPERATIONS = {
576
567
  requestSchema: null,
577
568
  responseSchema: "ListConnectionsResponseDto"
578
569
  },
570
+ "ConnectionsController_listSelections": {
571
+ method: "GET",
572
+ path: "/api/v1/connections/{connectionId}/selections",
573
+ service: "modus-api",
574
+ serverUrl: "https://api.getmodus.com",
575
+ pathParams: ["connectionId"],
576
+ queryParams: ["pageToken", "pageSize"],
577
+ requestSchema: null,
578
+ responseSchema: "ListConnectionSelectionsResponseDto"
579
+ },
579
580
  "ContextCreatorsController_createLink": {
580
581
  method: "POST",
581
582
  path: "/api/v1/context/links",
@@ -1988,6 +1989,149 @@ function asRecord(data) {
1988
1989
  throw new Error(`Expected object response, got ${typeof data}`);
1989
1990
  }
1990
1991
 
1992
+ // src/_generated/resources/management/workflows.ts
1993
+ var WorkflowsResourceBase = class {
1994
+ /** @internal */
1995
+ constructor(http, config) {
1996
+ this.http = http;
1997
+ this.config = config;
1998
+ }
1999
+ /**
2000
+ * List workflows.
2001
+ *
2002
+ * Returns a paginated page of workflows the caller can at least `use`. Workflows the caller
2003
+ * cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
2004
+ *
2005
+ * **Requires:** `workflows:read`
2006
+ *
2007
+ * @param options.pageSize - Items per page. Defaults to 25.
2008
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
2009
+ * for the first page.
2010
+ * @param options.search - Case-insensitive substring filter on workflow name.
2011
+ * @param options.type - Filter by workflow type.
2012
+ * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
2013
+ * snapshot.
2014
+ * @param options.includeVariation - Include the requested variation payload (`trigger`,
2015
+ * `workflowStructure`, `agentSelection`) on list rows.
2016
+ * @returns A page of workflows.
2017
+ *
2018
+ * @example
2019
+ * ```ts
2020
+ * const mgmt = new ModusManagement()
2021
+ * for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {
2022
+ * console.log(wf.id, wf.name, wf.status)
2023
+ * }
2024
+ * ```
2025
+ */
2026
+ list(options = {}) {
2027
+ const pageSize = options.pageSize ?? 25;
2028
+ validatePageSize(pageSize);
2029
+ return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation);
2030
+ }
2031
+ async listPage(pageSize, pageToken, search, type, view, includeVariation) {
2032
+ const extra = {};
2033
+ if (search !== void 0) extra.search = search;
2034
+ if (type !== void 0) extra.type = type;
2035
+ if (view !== void 0) extra.view = view;
2036
+ if (includeVariation !== void 0) extra.includeVariation = includeVariation;
2037
+ const data = asRecord(
2038
+ await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
2039
+ query: aipListParams(pageSize, pageToken, extra)
2040
+ })
2041
+ );
2042
+ return buildAipPage(
2043
+ data,
2044
+ "workflows",
2045
+ (raw) => raw,
2046
+ (token) => this.listPage(pageSize, token, search, type, view, includeVariation)
2047
+ );
2048
+ }
2049
+ /**
2050
+ * Delete a workflow.
2051
+ *
2052
+ * Deletes a workflow and stops its schedule. The workflow can be restored later with POST
2053
+ * /workflows/{id}/restore. Deleting an already-deleted workflow is a no-op.
2054
+ *
2055
+ * **Requires:** `workflows:write`
2056
+ *
2057
+ * @param workflowId - Numeric workflow id.
2058
+ *
2059
+ * @example
2060
+ * ```ts
2061
+ * const mgmt = new ModusManagement()
2062
+ * await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')
2063
+ * ```
2064
+ */
2065
+ async delete(workflowId) {
2066
+ validateId(workflowId, "workflow_id");
2067
+ await invokeWithRetry(this.config, this.http, "WorkflowsController_delete", {
2068
+ pathParams: { id: workflowId }
2069
+ });
2070
+ }
2071
+ /**
2072
+ * Restore a deleted workflow.
2073
+ *
2074
+ * Restores a previously deleted workflow and returns it. The workflow’s schedule is not resumed
2075
+ * automatically — re-enable it if it should run again. Restoring an active workflow returns it
2076
+ * unchanged.
2077
+ *
2078
+ * **Requires:** `workflows:write`
2079
+ *
2080
+ * @param workflowId - Numeric workflow id.
2081
+ */
2082
+ async restore(workflowId) {
2083
+ validateId(workflowId, "workflow_id");
2084
+ const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_restore", {
2085
+ pathParams: { id: workflowId },
2086
+ jsonBody: {}
2087
+ });
2088
+ return data;
2089
+ }
2090
+ /**
2091
+ * Cancel ownership transfer.
2092
+ *
2093
+ * Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may
2094
+ * decline.
2095
+ *
2096
+ * **Requires:** `workflows:write`
2097
+ *
2098
+ * @param workflowId - Numeric workflow id.
2099
+ */
2100
+ async cancelOwnershipTransfer(workflowId) {
2101
+ validateId(workflowId, "workflow_id");
2102
+ const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_cancelOwnershipTransfer", {
2103
+ pathParams: { id: workflowId }
2104
+ });
2105
+ return data;
2106
+ }
2107
+ /**
2108
+ * Accept ownership transfer.
2109
+ *
2110
+ * Accepts a pending ownership transfer. Only the pending recipient may invoke this action.
2111
+ *
2112
+ * **Requires:** `workflows:write`
2113
+ *
2114
+ * @param workflowId - Numeric workflow id.
2115
+ */
2116
+ async acceptOwnershipTransfer(workflowId) {
2117
+ validateId(workflowId, "workflow_id");
2118
+ const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_acceptOwnershipTransfer", {
2119
+ pathParams: { id: workflowId },
2120
+ jsonBody: {}
2121
+ });
2122
+ return data;
2123
+ }
2124
+ };
2125
+
2126
+ // src/_query.ts
2127
+ function updateMaskQuery(updateMask) {
2128
+ if (updateMask === void 0) return void 0;
2129
+ if (!updateMask.trim()) {
2130
+ throw new Error("update_mask must be a non-empty comma-separated list of field names");
2131
+ }
2132
+ return { updateMask };
2133
+ }
2134
+
1991
2135
  // src/management/_access-config.ts
1992
2136
  var EVERYONE_GROUP_ID = "__everyone__";
1993
2137
  function accessConfigWireForCreate(guardrails) {
@@ -2021,14 +2165,22 @@ async function accessConfigBodyForUpdate(guardrails, loadResource) {
2021
2165
  return accessConfigWireForUpdate(existing, guardrails);
2022
2166
  }
2023
2167
 
2024
- // src/management/workflows/interfaces.ts
2025
- var WorkflowInterfacesResource = class {
2168
+ // src/_generated/resources/management/workflows/interfaces.ts
2169
+ var WorkflowsInterfacesResourceBase = class {
2170
+ /** @internal */
2026
2171
  constructor(http, config, workflowId) {
2027
2172
  this.http = http;
2028
2173
  this.config = config;
2029
2174
  this.workflowId = workflowId;
2030
2175
  }
2031
- /** List interfaces attached to this workflow. */
2176
+ /**
2177
+ * List interfaces attached to a workflow.
2178
+ *
2179
+ * Returns every Slack, MCP, or Teams interface bound to the workflow. Requires manage permission
2180
+ * on the workflow.
2181
+ *
2182
+ * **Requires:** `workflows:read`
2183
+ */
2032
2184
  async list() {
2033
2185
  validateId(this.workflowId, "workflow_id");
2034
2186
  const data = await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_list", {
@@ -2036,6 +2188,40 @@ var WorkflowInterfacesResource = class {
2036
2188
  });
2037
2189
  return data.interfaces;
2038
2190
  }
2191
+ /**
2192
+ * Remove every interface from a workflow.
2193
+ *
2194
+ * Deletes all interface rows attached to the workflow. Useful when recreating the interface set
2195
+ * from scratch.
2196
+ *
2197
+ * **Requires:** `workflows:write`
2198
+ */
2199
+ async deleteAll() {
2200
+ validateId(this.workflowId, "workflow_id");
2201
+ await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_deleteAll", {
2202
+ pathParams: { id: this.workflowId }
2203
+ });
2204
+ }
2205
+ /**
2206
+ * Remove a workflow interface.
2207
+ *
2208
+ * Deletes one interface row. For MCP interfaces, bound MCP tokens are revoked best-effort.
2209
+ *
2210
+ * **Requires:** `workflows:write`
2211
+ *
2212
+ * @param interfaceId - Interface row id (UUID).
2213
+ */
2214
+ async delete(interfaceId) {
2215
+ validateId(this.workflowId, "workflow_id");
2216
+ validateId(interfaceId, "interface_id");
2217
+ await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_delete", {
2218
+ pathParams: { id: this.workflowId, interfaceId }
2219
+ });
2220
+ }
2221
+ };
2222
+
2223
+ // src/management/workflows/interfaces.ts
2224
+ var WorkflowInterfacesResource = class extends WorkflowsInterfacesResourceBase {
2039
2225
  /**
2040
2226
  * Add an interface to this workflow.
2041
2227
  *
@@ -2066,25 +2252,6 @@ var WorkflowInterfacesResource = class {
2066
2252
  jsonBody: updateMask === void 0 ? omitUndefined(options) : options
2067
2253
  });
2068
2254
  }
2069
- /**
2070
- * Delete an interface from this workflow.
2071
- *
2072
- * @param interfaceId - Interface id.
2073
- */
2074
- async delete(interfaceId) {
2075
- validateId(this.workflowId, "workflow_id");
2076
- validateId(interfaceId, "interface_id");
2077
- await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_delete", {
2078
- pathParams: { id: this.workflowId, interfaceId }
2079
- });
2080
- }
2081
- /** Delete every interface from this workflow. */
2082
- async deleteAll() {
2083
- validateId(this.workflowId, "workflow_id");
2084
- await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_deleteAll", {
2085
- pathParams: { id: this.workflowId }
2086
- });
2087
- }
2088
2255
  };
2089
2256
 
2090
2257
  // src/management/workflows/agents.ts
@@ -2101,66 +2268,14 @@ var MANAGEMENT_WORKFLOW_OPERATIONS = {
2101
2268
  acceptOwnershipTransfer: "WorkflowsController_acceptOwnershipTransfer",
2102
2269
  toggle: "WorkflowsController_toggle"
2103
2270
  };
2104
- function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
2105
- const extra = {};
2106
- if (search !== void 0) extra.search = search;
2107
- if (type !== void 0) extra.type = type;
2108
- if (view !== void 0) extra.view = view;
2109
- if (includeVariation !== void 0) extra.includeVariation = includeVariation;
2110
- return aipListParams(pageSize, pageToken, extra);
2111
- }
2112
2271
  function parseWorkflow(raw) {
2113
2272
  return raw;
2114
2273
  }
2115
- var ManagementWorkflowsResource = class {
2116
- constructor(http, config) {
2117
- this.http = http;
2118
- this.config = config;
2274
+ var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
2275
+ constructor() {
2276
+ super(...arguments);
2119
2277
  this.ops = MANAGEMENT_WORKFLOW_OPERATIONS;
2120
2278
  }
2121
- /**
2122
- * List workflows in the organization.
2123
- *
2124
- * @param options.pageSize - Maximum items per page (default 25).
2125
- * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
2126
- * @param options.search - Case-insensitive substring filter on the workflow name.
2127
- * @param options.type - Filter by workflow type: `"task"` or `"workflow"`.
2128
- * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
2129
- * @param options.includeVariation - Include variation payload on each list row.
2130
- * @returns A page of workflows.
2131
- * @example
2132
- * ```ts
2133
- * const mgmt = new ModusManagement()
2134
- * for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {
2135
- * console.log(wf.id, wf.name, wf.status)
2136
- * }
2137
- * ```
2138
- */
2139
- list(options = {}) {
2140
- const pageSize = options.pageSize ?? 25;
2141
- validatePageSize(pageSize);
2142
- return this.listPage(
2143
- pageSize,
2144
- options.pageToken,
2145
- options.search,
2146
- options.type,
2147
- options.view,
2148
- options.includeVariation
2149
- );
2150
- }
2151
- async listPage(pageSize, pageToken, search, type, view, includeVariation) {
2152
- const data = asRecord(
2153
- await invokeWithRetry(this.config, this.http, this.ops.list, {
2154
- query: workflowsListParams(pageSize, pageToken, search, type, view, includeVariation)
2155
- })
2156
- );
2157
- return buildAipPage(
2158
- data,
2159
- "workflows",
2160
- parseWorkflow,
2161
- (token) => this.listPage(pageSize, token, search, type, view, includeVariation)
2162
- );
2163
- }
2164
2279
  /**
2165
2280
  * Retrieve a workflow with full configuration.
2166
2281
  *
@@ -2301,37 +2416,6 @@ var ManagementWorkflowsResource = class {
2301
2416
  });
2302
2417
  return parseWorkflow(data);
2303
2418
  }
2304
- /**
2305
- * Delete a workflow.
2306
- *
2307
- * @param workflowId - Workflow id.
2308
- * @returns Resolves when the workflow is deleted.
2309
- * @example
2310
- * ```ts
2311
- * const mgmt = new ModusManagement()
2312
- * await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')
2313
- * ```
2314
- */
2315
- async delete(workflowId) {
2316
- validateId(workflowId, "workflow_id");
2317
- await invokeWithRetry(this.config, this.http, this.ops.delete, {
2318
- pathParams: { id: workflowId }
2319
- });
2320
- }
2321
- /**
2322
- * Restore a previously deleted workflow.
2323
- *
2324
- * @param workflowId - Workflow id.
2325
- * @returns The restored workflow.
2326
- */
2327
- async restore(workflowId) {
2328
- validateId(workflowId, "workflow_id");
2329
- const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
2330
- pathParams: { id: workflowId },
2331
- jsonBody: {}
2332
- });
2333
- return parseWorkflow(data);
2334
- }
2335
2419
  /**
2336
2420
  * Start transferring ownership of a workflow to another organization member.
2337
2421
  *
@@ -2352,28 +2436,6 @@ var ManagementWorkflowsResource = class {
2352
2436
  );
2353
2437
  return parseWorkflow(data);
2354
2438
  }
2355
- /** Cancel a pending workflow ownership transfer. */
2356
- async cancelOwnershipTransfer(workflowId) {
2357
- validateId(workflowId, "workflow_id");
2358
- const data = await invokeWithRetry(
2359
- this.config,
2360
- this.http,
2361
- this.ops.cancelOwnershipTransfer,
2362
- { pathParams: { id: workflowId } }
2363
- );
2364
- return parseWorkflow(data);
2365
- }
2366
- /** Accept a pending workflow ownership transfer. */
2367
- async acceptOwnershipTransfer(workflowId) {
2368
- validateId(workflowId, "workflow_id");
2369
- const data = await invokeWithRetry(
2370
- this.config,
2371
- this.http,
2372
- this.ops.acceptOwnershipTransfer,
2373
- { pathParams: { id: workflowId }, jsonBody: {} }
2374
- );
2375
- return parseWorkflow(data);
2376
- }
2377
2439
  };
2378
2440
 
2379
2441
  // src/types/context.ts
@@ -2413,7 +2475,7 @@ var CustomContextItemsResource = class {
2413
2475
  *
2414
2476
  * @param options.pageSize - Maximum items per page (default 25).
2415
2477
  * @param options.pageToken - Opaque token from a previous page.
2416
- * @param options.searchQuery - Free-text search filter.
2478
+ * @param options.searchQuery - Word search: returns rows that contain every word of the query, case-insensitive.
2417
2479
  * @param options.topics - Filter to items tagged with any of these topics.
2418
2480
  * @returns A page of custom context items.
2419
2481
  * @example
@@ -2476,12 +2538,16 @@ var CustomContextItemsResource = class {
2476
2538
  * @example
2477
2539
  * ```ts
2478
2540
  * const client = new Modus()
2541
+ * // Create the source and collection first, or use batchCreate as shown below.
2479
2542
  * const created = await client.context.customItems.create({
2480
2543
  * kind: 'entity',
2481
- * sourceId: 'my-source',
2544
+ * sourceId: 'billing-db',
2545
+ * collectionId: 'contracts',
2546
+ * externalId: 'contract-123',
2482
2547
  * name: 'Q3 churn notes',
2483
2548
  * content: { summary: 'Key findings…' },
2484
2549
  * })
2550
+ * console.log(created.uid, created.dataPath)
2485
2551
  * ```
2486
2552
  */
2487
2553
  async create(input) {
@@ -2501,9 +2567,22 @@ var CustomContextItemsResource = class {
2501
2567
  * ```ts
2502
2568
  * const client = new Modus()
2503
2569
  * const created = await client.context.customItems.batchCreate([
2504
- * { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
2505
- * { kind: 'field', sourceId: 'src', fieldName: 'amount', dataType: 'number' },
2570
+ * { kind: 'source', sourceId: 'billing-db', name: 'Billing database' },
2571
+ * {
2572
+ * kind: 'collection',
2573
+ * sourceId: 'billing-db',
2574
+ * collectionId: 'contracts',
2575
+ * name: 'Contracts',
2576
+ * },
2577
+ * {
2578
+ * kind: 'entity',
2579
+ * sourceId: 'billing-db',
2580
+ * collectionId: 'contracts',
2581
+ * externalId: 'contract-123',
2582
+ * name: 'Acme renewal',
2583
+ * },
2506
2584
  * ])
2585
+ * console.log(created.map((item) => item.dataPath))
2507
2586
  * ```
2508
2587
  */
2509
2588
  async batchCreate(inputs) {
@@ -2668,40 +2747,211 @@ async function resolveAndUpdateLink(items, uid, options) {
2668
2747
  });
2669
2748
  }
2670
2749
 
2671
- // src/management/context/dashboards.ts
2672
- var ManagementDashboardElementsResource = class {
2750
+ // src/_generated/resources/management/context/dashboards.ts
2751
+ var ContextDashboardsResourceBase = class {
2673
2752
  /** @internal */
2674
- constructor(http, config, dashboardId) {
2753
+ constructor(http, config) {
2675
2754
  this.http = http;
2676
2755
  this.config = config;
2677
- this.dashboardId = dashboardId;
2678
2756
  }
2679
2757
  /**
2680
- * List every tile and filter on the dashboard draft.
2758
+ * Delete a dashboard.
2759
+ *
2760
+ * Removes the dashboard from every listing and deletes its alert workflows. It cannot be restored
2761
+ * through the API.
2762
+ *
2763
+ * **Requires:** `context:write`
2764
+ *
2765
+ * @param dashboardId - Dashboard id, as shown in the app URL.
2681
2766
  *
2682
- * @returns Each element's id, kind, title and grid position, plus the current
2683
- * `draftRevision` to pass as `expectedRevision` on the next change.
2684
- * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
2685
2767
  * @example
2686
2768
  * ```ts
2687
- * const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
2688
- * listed.elements.map((element) => element.id)
2769
+ * await mgmt.context.dashboards.delete('DASHBOARD_ID')
2689
2770
  * ```
2690
2771
  */
2691
- async list() {
2692
- return asRecord(
2693
- await invokeWithRetry(this.config, this.http, "DashboardsController_listElements", {
2694
- pathParams: { dashboardId: this.dashboardId }
2695
- })
2696
- );
2697
- }
2698
- /**
2699
- * Get the full draft settings of one tile or filter.
2700
- *
2701
- * @param elementId - Id of the tile or filter, as returned by `list()`.
2702
- * @returns The element's settings and the current `draftRevision`.
2703
- * @throws NotFoundError - The dashboard or the element does not exist, or you cannot
2704
- * edit the dashboard.
2772
+ async delete(dashboardId) {
2773
+ validateId(dashboardId, "dashboardId");
2774
+ await invokeWithRetry(this.config, this.http, "DashboardsController_delete", {
2775
+ pathParams: { dashboardId }
2776
+ });
2777
+ }
2778
+ /**
2779
+ * List dashboard draft snapshots.
2780
+ *
2781
+ * Returns ids and timestamps of the most recent draft snapshots. Editors only.
2782
+ *
2783
+ * **Requires:** `context:read`
2784
+ *
2785
+ * @param dashboardId - Dashboard id, as shown in the app URL.
2786
+ *
2787
+ * @example
2788
+ * ```ts
2789
+ * const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')
2790
+ * snapshots.map((snapshot) => snapshot.uid)
2791
+ * ```
2792
+ */
2793
+ async listDraftSnapshots(dashboardId) {
2794
+ validateId(dashboardId, "dashboardId");
2795
+ const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listDraftSnapshots", {
2796
+ pathParams: { dashboardId }
2797
+ });
2798
+ return asRecord(data).snapshots;
2799
+ }
2800
+ /**
2801
+ * Cancel an ownership transfer.
2802
+ *
2803
+ * Owner only. Clears the pending transfer and returns the dashboard.
2804
+ *
2805
+ * **Requires:** `context:write`
2806
+ *
2807
+ * @param dashboardId - Dashboard id, as shown in the app URL.
2808
+ *
2809
+ * @example
2810
+ * ```ts
2811
+ * await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')
2812
+ * ```
2813
+ */
2814
+ async cancelOwnershipTransfer(dashboardId) {
2815
+ validateId(dashboardId, "dashboardId");
2816
+ const data = await invokeWithRetry(this.config, this.http, "DashboardsController_cancelOwnership", {
2817
+ pathParams: { dashboardId }
2818
+ });
2819
+ return asRecord(data);
2820
+ }
2821
+ /**
2822
+ * Accept an ownership transfer.
2823
+ *
2824
+ * Recipient only. Makes you the owner and clears the pending transfer.
2825
+ *
2826
+ * **Requires:** `context:write`
2827
+ *
2828
+ * @param dashboardId - Dashboard id, as shown in the app URL.
2829
+ *
2830
+ * @example
2831
+ * ```ts
2832
+ * await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')
2833
+ * ```
2834
+ */
2835
+ async acceptOwnershipTransfer(dashboardId) {
2836
+ validateId(dashboardId, "dashboardId");
2837
+ const data = await invokeWithRetry(this.config, this.http, "DashboardsController_acceptOwnership", {
2838
+ pathParams: { dashboardId }
2839
+ });
2840
+ return asRecord(data);
2841
+ }
2842
+ /**
2843
+ * List dashboard versions.
2844
+ *
2845
+ * Returns the published versions, newest first, each with its full definition. Draft snapshots
2846
+ * are not included. The response is not paginated and can be large.
2847
+ *
2848
+ * **Requires:** `context:read`
2849
+ *
2850
+ * @param dashboardId - Dashboard id, as shown in the app URL.
2851
+ *
2852
+ * @example
2853
+ * ```ts
2854
+ * const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')
2855
+ * versions.map((version) => [version.uid, version.versionNumber])
2856
+ * ```
2857
+ */
2858
+ async listVersions(dashboardId) {
2859
+ validateId(dashboardId, "dashboardId");
2860
+ const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listVersions", {
2861
+ pathParams: { dashboardId }
2862
+ });
2863
+ return asRecord(data).versions;
2864
+ }
2865
+ /**
2866
+ * Get a dashboard version.
2867
+ *
2868
+ * Returns the dashboard as it was in the given version. For a draft snapshot (editors only) the
2869
+ * view is reported as active and selectedVersion.versionNumber is null.
2870
+ *
2871
+ * **Requires:** `context:read`
2872
+ *
2873
+ * @param dashboardId - Dashboard id, as shown in the app URL.
2874
+ * @param versionId - Version id, or a draft snapshot id for editors.
2875
+ *
2876
+ * @example
2877
+ * ```ts
2878
+ * const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')
2879
+ * old.selectedVersion.versionNumber
2880
+ * ```
2881
+ */
2882
+ async getVersion(dashboardId, versionId) {
2883
+ validateId(dashboardId, "dashboardId");
2884
+ validateId(versionId, "versionId");
2885
+ const data = await invokeWithRetry(this.config, this.http, "DashboardsController_getVersion", {
2886
+ pathParams: { dashboardId, versionId }
2887
+ });
2888
+ return asRecord(data);
2889
+ }
2890
+ /**
2891
+ * Restore a dashboard version.
2892
+ *
2893
+ * Replaces the current draft with the content of the given version. The outgoing draft is kept as
2894
+ * a draft snapshot. Returns the draft view.
2895
+ *
2896
+ * **Requires:** `context:write`
2897
+ *
2898
+ * @param dashboardId - Dashboard id, as shown in the app URL.
2899
+ * @param versionId - Version id, or a draft snapshot id for editors.
2900
+ *
2901
+ * @example
2902
+ * ```ts
2903
+ * await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')
2904
+ * ```
2905
+ */
2906
+ async restoreVersion(dashboardId, versionId) {
2907
+ validateId(dashboardId, "dashboardId");
2908
+ validateId(versionId, "versionId");
2909
+ const data = await invokeWithRetry(this.config, this.http, "DashboardsController_restore", {
2910
+ pathParams: { dashboardId, versionId }
2911
+ });
2912
+ return asRecord(data);
2913
+ }
2914
+ };
2915
+
2916
+ // src/_generated/resources/management/context/dashboards/elements.ts
2917
+ var ContextDashboardsElementsResourceBase = class {
2918
+ /** @internal */
2919
+ constructor(http, config, dashboardId) {
2920
+ this.http = http;
2921
+ this.config = config;
2922
+ this.dashboardId = dashboardId;
2923
+ }
2924
+ /**
2925
+ * List dashboard elements.
2926
+ *
2927
+ * Lists every tile and filter on the dashboard draft with id, kind, title and layout. Filters
2928
+ * also carry sqlReferences, the exact templates tile SQL must use to reference them. Returns the
2929
+ * current draftRevision.
2930
+ *
2931
+ * **Requires:** `context:read`
2932
+ *
2933
+ * @example
2934
+ * ```ts
2935
+ * const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
2936
+ * listed.elements.map((element) => element.id)
2937
+ * ```
2938
+ */
2939
+ async list() {
2940
+ const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listElements", {
2941
+ pathParams: { dashboardId: this.dashboardId }
2942
+ });
2943
+ return asRecord(data);
2944
+ }
2945
+ /**
2946
+ * Get a dashboard element.
2947
+ *
2948
+ * Returns the full draft configuration of one dashboard element, including SQL, chart settings
2949
+ * and filter options, with the current draftRevision.
2950
+ *
2951
+ * **Requires:** `context:read`
2952
+ *
2953
+ * @param elementId - The dashboard element id to read.
2954
+ *
2705
2955
  * @example
2706
2956
  * ```ts
2707
2957
  * const result = await mgmt.context.dashboards.elements('DASHBOARD_ID').get('ELEMENT_ID')
@@ -2710,11 +2960,18 @@ var ManagementDashboardElementsResource = class {
2710
2960
  */
2711
2961
  async get(elementId) {
2712
2962
  validateId(elementId, "elementId");
2713
- return asRecord(
2714
- await invokeWithRetry(this.config, this.http, "DashboardsController_getElement", {
2715
- pathParams: { dashboardId: this.dashboardId, elementId }
2716
- })
2717
- );
2963
+ const data = await invokeWithRetry(this.config, this.http, "DashboardsController_getElement", {
2964
+ pathParams: { dashboardId: this.dashboardId, elementId }
2965
+ });
2966
+ return asRecord(data);
2967
+ }
2968
+ };
2969
+
2970
+ // src/management/context/dashboards.ts
2971
+ var ManagementDashboardElementsResource = class extends ContextDashboardsElementsResourceBase {
2972
+ /** @internal */
2973
+ constructor(http, config, dashboardId) {
2974
+ super(http, config, dashboardId);
2718
2975
  }
2719
2976
  /**
2720
2977
  * Add a blank tile or filter to the dashboard draft.
@@ -2779,11 +3036,10 @@ var ManagementDashboardElementsResource = class {
2779
3036
  );
2780
3037
  }
2781
3038
  };
2782
- var ManagementDashboardsResource = class {
3039
+ var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
2783
3040
  /** @internal */
2784
3041
  constructor(http, config) {
2785
- this.http = http;
2786
- this.config = config;
3042
+ super(http, config);
2787
3043
  }
2788
3044
  /**
2789
3045
  * List dashboards with their full definitions.
@@ -2924,117 +3180,6 @@ var ManagementDashboardsResource = class {
2924
3180
  })
2925
3181
  );
2926
3182
  }
2927
- /**
2928
- * Delete a dashboard and the alert workflows defined on it.
2929
- *
2930
- * A deleted dashboard cannot be restored.
2931
- *
2932
- * @param dashboardId - Id of the dashboard.
2933
- * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
2934
- * @example
2935
- * ```ts
2936
- * await mgmt.context.dashboards.delete('DASHBOARD_ID')
2937
- * ```
2938
- */
2939
- async delete(dashboardId) {
2940
- validateId(dashboardId, "dashboardId");
2941
- await invokeWithRetry(this.config, this.http, "DashboardsController_delete", {
2942
- pathParams: { dashboardId }
2943
- });
2944
- }
2945
- /**
2946
- * List the published versions of a dashboard, newest first.
2947
- *
2948
- * @param dashboardId - Id of the dashboard.
2949
- * @returns Every published version with its full definition. Definitions are
2950
- * returned as stored, so older versions may lack newer fields. The list is
2951
- * not paginated.
2952
- * @throws NotFoundError - The dashboard does not exist or you cannot open it.
2953
- * @example
2954
- * ```ts
2955
- * const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')
2956
- * versions.map((version) => [version.uid, version.versionNumber])
2957
- * ```
2958
- */
2959
- async listVersions(dashboardId) {
2960
- validateId(dashboardId, "dashboardId");
2961
- const data = asRecord(
2962
- await invokeWithRetry(this.config, this.http, "DashboardsController_listVersions", {
2963
- pathParams: { dashboardId }
2964
- })
2965
- );
2966
- return data.versions;
2967
- }
2968
- /**
2969
- * Get a dashboard as it was in one version.
2970
- *
2971
- * @param dashboardId - Id of the dashboard.
2972
- * @param versionId - Id of the version, as returned by `listVersions()`.
2973
- * @returns The dashboard with that version's definition.
2974
- * @throws NotFoundError - The dashboard or the version does not exist, or you cannot
2975
- * open the dashboard.
2976
- * @example
2977
- * ```ts
2978
- * const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')
2979
- * old.selectedVersion.versionNumber
2980
- * ```
2981
- */
2982
- async getVersion(dashboardId, versionId) {
2983
- validateId(dashboardId, "dashboardId");
2984
- validateId(versionId, "versionId");
2985
- return asRecord(
2986
- await invokeWithRetry(this.config, this.http, "DashboardsController_getVersion", {
2987
- pathParams: { dashboardId, versionId }
2988
- })
2989
- );
2990
- }
2991
- /**
2992
- * Replace the draft with the content of an earlier version.
2993
- *
2994
- * The draft being replaced is kept as a draft snapshot. Call `publish()`
2995
- * afterwards to make the restored content visible.
2996
- *
2997
- * @param dashboardId - Id of the dashboard.
2998
- * @param versionId - Id of the version or draft snapshot to restore.
2999
- * @returns The dashboard draft after the restore.
3000
- * @throws NotFoundError - The dashboard or the version does not exist, or you cannot
3001
- * edit the dashboard.
3002
- * @example
3003
- * ```ts
3004
- * await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')
3005
- * ```
3006
- */
3007
- async restoreVersion(dashboardId, versionId) {
3008
- validateId(dashboardId, "dashboardId");
3009
- validateId(versionId, "versionId");
3010
- return asRecord(
3011
- await invokeWithRetry(this.config, this.http, "DashboardsController_restore", {
3012
- pathParams: { dashboardId, versionId }
3013
- })
3014
- );
3015
- }
3016
- /**
3017
- * List recent snapshots of the dashboard draft, newest first.
3018
- *
3019
- * @param dashboardId - Id of the dashboard.
3020
- * @returns Up to 100 snapshots with their id, author and time. Pass an id to
3021
- * `restoreVersion()` to bring that draft back.
3022
- * @throws NotFoundError - The dashboard does not exist or you cannot edit it.
3023
- * @example
3024
- * ```ts
3025
- * const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')
3026
- * snapshots.map((snapshot) => snapshot.uid)
3027
- * ```
3028
- */
3029
- async listDraftSnapshots(dashboardId) {
3030
- validateId(dashboardId, "dashboardId");
3031
- const data = asRecord(
3032
- await invokeWithRetry(this.config, this.http, "DashboardsController_listDraftSnapshots", {
3033
- pathParams: { dashboardId }
3034
- })
3035
- );
3036
- return data.snapshots;
3037
- }
3038
3183
  /**
3039
3184
  * Replace who can open and edit a dashboard.
3040
3185
  *
@@ -3099,50 +3244,6 @@ var ManagementDashboardsResource = class {
3099
3244
  })
3100
3245
  );
3101
3246
  }
3102
- /**
3103
- * Accept a pending ownership transfer and become the dashboard owner.
3104
- *
3105
- * Only the requested recipient can accept.
3106
- *
3107
- * @param dashboardId - Id of the dashboard.
3108
- * @returns The dashboard with you as its owner.
3109
- * @throws NotFoundError - The dashboard does not exist, or it has no pending transfer
3110
- * addressed to you.
3111
- * @example
3112
- * ```ts
3113
- * await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')
3114
- * ```
3115
- */
3116
- async acceptOwnershipTransfer(dashboardId) {
3117
- validateId(dashboardId, "dashboardId");
3118
- return asRecord(
3119
- await invokeWithRetry(this.config, this.http, "DashboardsController_acceptOwnership", {
3120
- pathParams: { dashboardId }
3121
- })
3122
- );
3123
- }
3124
- /**
3125
- * Cancel a pending ownership transfer.
3126
- *
3127
- * Only the owner can cancel.
3128
- *
3129
- * @param dashboardId - Id of the dashboard.
3130
- * @returns The dashboard with no pending transfer.
3131
- * @throws NotFoundError - The dashboard does not exist, you cannot open it, or you are
3132
- * not the owner.
3133
- * @example
3134
- * ```ts
3135
- * await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')
3136
- * ```
3137
- */
3138
- async cancelOwnershipTransfer(dashboardId) {
3139
- validateId(dashboardId, "dashboardId");
3140
- return asRecord(
3141
- await invokeWithRetry(this.config, this.http, "DashboardsController_cancelOwnership", {
3142
- pathParams: { dashboardId }
3143
- })
3144
- );
3145
- }
3146
3247
  /**
3147
3248
  * Work with the tiles and filters of one dashboard draft.
3148
3249
  *
@@ -3188,8 +3289,66 @@ var ManagementDashboardsResource = class {
3188
3289
  // src/management/context/files.ts
3189
3290
  var import_promises = require("fs/promises");
3190
3291
  var import_node_path = require("path");
3292
+
3293
+ // src/_generated/resources/management/context/files.ts
3294
+ var ContextFilesResourceBase = class {
3295
+ /** @internal */
3296
+ constructor(http, config) {
3297
+ this.http = http;
3298
+ this.config = config;
3299
+ }
3300
+ /**
3301
+ * List file uploads.
3302
+ *
3303
+ * Returns a page of durable landed file uploads. Uploads that have not landed yet are visible via
3304
+ * `GET /context/files/{uploadId}`, not this list.
3305
+ *
3306
+ * **Requires:** `context:read`
3307
+ *
3308
+ * @param options.pageSize - Items per page. Defaults to 50.
3309
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
3310
+ * for the first page.
3311
+ * @returns A page of files.
3312
+ */
3313
+ list(options = {}) {
3314
+ const pageSize = options.pageSize ?? 50;
3315
+ validatePageSize(pageSize, 200);
3316
+ return this.listPage(pageSize, options.pageToken);
3317
+ }
3318
+ async listPage(pageSize, pageToken) {
3319
+ const data = asRecord(
3320
+ await invokeWithRetry(this.config, this.http, "ContextFilesController_list", {
3321
+ query: aipListParams(pageSize, pageToken)
3322
+ })
3323
+ );
3324
+ return buildAipPage(
3325
+ data,
3326
+ "files",
3327
+ (raw) => raw,
3328
+ (token) => this.listPage(pageSize, token)
3329
+ );
3330
+ }
3331
+ /**
3332
+ * Get a file upload.
3333
+ *
3334
+ * Returns status + metadata for one upload. Prefers the durable landed context item; falls back
3335
+ * to in-flight upload status while the object has not landed yet. 404 if neither exists.
3336
+ *
3337
+ * **Requires:** `context:read`
3338
+ *
3339
+ * @param uploadId - Upload id returned by `createUploadUrl` / `createUploadUrls`.
3340
+ */
3341
+ async get(uploadId) {
3342
+ validateId(uploadId, "uploadId");
3343
+ const data = await invokeWithRetry(this.config, this.http, "ContextFilesController_get", {
3344
+ pathParams: { uploadId }
3345
+ });
3346
+ return asRecord(data);
3347
+ }
3348
+ };
3349
+
3350
+ // src/management/context/files.ts
3191
3351
  var MAX_BULK_UPLOAD_FILES = 100;
3192
- var DEFAULT_LIST_PAGE_SIZE = 50;
3193
3352
  var DEFAULT_PUT_TIMEOUT_MS = 6e4;
3194
3353
  var DEFAULT_POLL_INTERVAL_MS = 500;
3195
3354
  var DEFAULT_UPLOAD_TIMEOUT_MS = 12e4;
@@ -3307,11 +3466,10 @@ function assignSlots(batch, result, failed) {
3307
3466
  }
3308
3467
  return assignments;
3309
3468
  }
3310
- var ManagementContextFilesResource = class {
3469
+ var ManagementContextFilesResource = class extends ContextFilesResourceBase {
3311
3470
  /** @internal */
3312
3471
  constructor(http, config) {
3313
- this.http = http;
3314
- this.config = config;
3472
+ super(http, config);
3315
3473
  }
3316
3474
  /**
3317
3475
  * Get a presigned S3 PUT URL for one file.
@@ -3383,41 +3541,6 @@ var ManagementContextFilesResource = class {
3383
3541
  })
3384
3542
  );
3385
3543
  }
3386
- /**
3387
- * Fetch one file upload by its id.
3388
- *
3389
- * @param uploadId - Upload id returned by `createUploadUrl` / `uploadFromUrl`.
3390
- * @returns The file upload resource, including its processing `status`.
3391
- */
3392
- async get(uploadId) {
3393
- validateId(uploadId, "uploadId");
3394
- return asRecord(
3395
- await invokeWithRetry(this.config, this.http, "ContextFilesController_get", {
3396
- pathParams: { uploadId }
3397
- })
3398
- );
3399
- }
3400
- /**
3401
- * List durable file uploads.
3402
- *
3403
- * @param options.pageSize - Items per page (default 50).
3404
- * @param options.pageToken - Opaque token from a previous page's `nextPageToken`.
3405
- * @returns Page of file uploads. Uploads that only have a pending row (not yet
3406
- * landed) aren't included here — use `get(uploadId)` for those.
3407
- */
3408
- list(options = {}) {
3409
- const pageSize = options.pageSize ?? DEFAULT_LIST_PAGE_SIZE;
3410
- validatePageSize(pageSize, 200);
3411
- return this.listPage(pageSize, options.pageToken);
3412
- }
3413
- async listPage(pageSize, pageToken) {
3414
- const data = asRecord(
3415
- await invokeWithRetry(this.config, this.http, "ContextFilesController_list", {
3416
- query: aipListParams(pageSize, pageToken)
3417
- })
3418
- );
3419
- return buildAipPage(data, "files", (raw) => raw, (token) => this.listPage(pageSize, token));
3420
- }
3421
3544
  /**
3422
3545
  * Turn a file already PUT to a presigned URL into durable context.
3423
3546
  *
@@ -4040,31 +4163,187 @@ var ManagementContextResource = class {
4040
4163
  }
4041
4164
  };
4042
4165
 
4043
- // src/resources/scopes/conversations.ts
4044
- function parseListItem(raw) {
4045
- return raw;
4046
- }
4047
- function parseConversation(raw) {
4048
- return raw;
4049
- }
4050
- var ScopeConversationsResource = class {
4166
+ // src/_generated/resources/management/scopes.ts
4167
+ var ScopesResourceBase = class {
4168
+ /** @internal */
4169
+ constructor(http, config) {
4170
+ this.http = http;
4171
+ this.config = config;
4172
+ }
4173
+ /**
4174
+ * List scopes.
4175
+ *
4176
+ * Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see
4177
+ * are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
4178
+ *
4179
+ * **Requires:** `scopes:read`
4180
+ *
4181
+ * @param options.pageSize - Items per page. Defaults to 25.
4182
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
4183
+ * for the first page.
4184
+ * @param options.search - Case-insensitive substring filter on scope name.
4185
+ * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
4186
+ * snapshot.
4187
+ * @param options.managerId - Return only scopes supervised by this manager scope id.
4188
+ * @returns A page of scopes.
4189
+ *
4190
+ * @example
4191
+ * ```ts
4192
+ * const mgmt = new ModusManagement()
4193
+ * for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {
4194
+ * console.log(scope.id, scope.name, scope.status)
4195
+ * }
4196
+ * ```
4197
+ */
4198
+ list(options = {}) {
4199
+ const pageSize = options.pageSize ?? 25;
4200
+ validatePageSize(pageSize);
4201
+ return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId);
4202
+ }
4203
+ async listPage(pageSize, pageToken, search, view, managerId) {
4204
+ const extra = {};
4205
+ if (search !== void 0) extra.search = search;
4206
+ if (view !== void 0) extra.view = view;
4207
+ if (managerId !== void 0) extra.managerId = managerId;
4208
+ const data = asRecord(
4209
+ await invokeWithRetry(this.config, this.http, "ScopesController_list", {
4210
+ query: aipListParams(pageSize, pageToken, extra)
4211
+ })
4212
+ );
4213
+ return buildAipPage(
4214
+ data,
4215
+ "scopes",
4216
+ (raw) => raw,
4217
+ (token) => this.listPage(pageSize, token, search, view, managerId)
4218
+ );
4219
+ }
4220
+ /**
4221
+ * Get a scope.
4222
+ *
4223
+ * Returns a scope. `view=active` (default) returns the deployed version; `view=draft` returns the
4224
+ * latest unpublished edits. Returns 404 if you cannot access the scope.
4225
+ *
4226
+ * **Requires:** `scopes:read`
4227
+ *
4228
+ * @param scopeId - Numeric scope id.
4229
+ * @param options.view - Which variation snapshot to read. Defaults to `active`.
4230
+ *
4231
+ * @example
4232
+ * ```ts
4233
+ * const mgmt = new ModusManagement()
4234
+ * const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')
4235
+ * console.log(scope.name, scope.status)
4236
+ * ```
4237
+ */
4238
+ async get(scopeId, options = {}) {
4239
+ validateId(scopeId, "scope_id");
4240
+ const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
4241
+ pathParams: { id: scopeId },
4242
+ query: { view: options.view }
4243
+ });
4244
+ return data;
4245
+ }
4246
+ /**
4247
+ * Delete a scope.
4248
+ *
4249
+ * Deletes a scope. The scope can be restored later with POST /scopes/{id}/restore. Deleting an
4250
+ * already-deleted scope is a no-op.
4251
+ *
4252
+ * **Requires:** `scopes:write`
4253
+ *
4254
+ * @param scopeId - Numeric scope id.
4255
+ *
4256
+ * @example
4257
+ * ```ts
4258
+ * const mgmt = new ModusManagement()
4259
+ * await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')
4260
+ * ```
4261
+ */
4262
+ async delete(scopeId) {
4263
+ validateId(scopeId, "scope_id");
4264
+ await invokeWithRetry(this.config, this.http, "ScopesController_delete", {
4265
+ pathParams: { id: scopeId }
4266
+ });
4267
+ }
4268
+ /**
4269
+ * Restore a deleted scope.
4270
+ *
4271
+ * Restores a previously deleted scope and returns it. Restoring a scope that is already active
4272
+ * returns it unchanged.
4273
+ *
4274
+ * **Requires:** `scopes:write`
4275
+ *
4276
+ * @param scopeId - Numeric scope id.
4277
+ */
4278
+ async restore(scopeId) {
4279
+ validateId(scopeId, "scope_id");
4280
+ const data = await invokeWithRetry(this.config, this.http, "ScopesController_restore", {
4281
+ pathParams: { id: scopeId },
4282
+ jsonBody: {}
4283
+ });
4284
+ return data;
4285
+ }
4286
+ /**
4287
+ * Cancel ownership transfer.
4288
+ *
4289
+ * Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may
4290
+ * decline.
4291
+ *
4292
+ * **Requires:** `scopes:write`
4293
+ *
4294
+ * @param scopeId - Numeric scope id.
4295
+ */
4296
+ async cancelOwnershipTransfer(scopeId) {
4297
+ validateId(scopeId, "scope_id");
4298
+ const data = await invokeWithRetry(this.config, this.http, "ScopesController_cancelOwnershipTransfer", {
4299
+ pathParams: { id: scopeId }
4300
+ });
4301
+ return data;
4302
+ }
4303
+ /**
4304
+ * Accept ownership transfer.
4305
+ *
4306
+ * Accepts a pending ownership transfer. Only the pending recipient may invoke this action.
4307
+ *
4308
+ * **Requires:** `scopes:write`
4309
+ *
4310
+ * @param scopeId - Numeric scope id.
4311
+ */
4312
+ async acceptOwnershipTransfer(scopeId) {
4313
+ validateId(scopeId, "scope_id");
4314
+ const data = await invokeWithRetry(this.config, this.http, "ScopesController_acceptOwnershipTransfer", {
4315
+ pathParams: { id: scopeId },
4316
+ jsonBody: {}
4317
+ });
4318
+ return data;
4319
+ }
4320
+ };
4321
+
4322
+ // src/_generated/resources/consumption/scopes/conversations.ts
4323
+ var ScopesConversationsResourceBase = class {
4324
+ /** @internal */
4051
4325
  constructor(http, config, scopeId) {
4052
4326
  this.http = http;
4053
4327
  this.config = config;
4054
4328
  this.scopeId = scopeId;
4055
4329
  }
4056
4330
  /**
4057
- * List conversation threads for this scope, newest first.
4331
+ * List scope conversations.
4058
4332
  *
4059
- * @param options.pageSize - Items per page (default 25).
4060
- * @param options.pageToken - Opaque token from a previous page.
4061
- * @param options.source - Restrict to conversations started from this UI surface
4062
- * (e.g. `"context_chat"`, `"dashboard_copilot"`, `"slack"`).
4333
+ * Returns a page of conversation summaries (most recently updated first) for a scope. Use `id=0`
4334
+ * for your cross-scope recent history. Pass `nextPageToken` as `pageToken` to fetch the next
4335
+ * page.
4336
+ *
4337
+ * **Requires:** `scopes:read`
4338
+ *
4339
+ * @param options.pageSize - Items per page. Defaults to 25.
4340
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
4341
+ * for the first page.
4342
+ * @param options.source - Return only conversations started from this UI surface.
4063
4343
  * @param options.sourceRef - Narrow `source` to one instance of that surface — for
4064
- * `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
4065
- * `UnprocessableError` (422) if sent on its own. Conversations recorded before
4066
- * this filter shipped carry no instance key and never match it.
4067
- * @returns Page of conversation list items (`threadId`, `firstMessage`, `messageCount`).
4344
+ * `dashboard_copilot` or `dashboard_assistant`, a dashboard id (both scope conversation history
4345
+ * per dashboard). Requires `source`; sent alone it is a 422.
4346
+ * @returns A page of conversations.
4068
4347
  *
4069
4348
  * @example
4070
4349
  * ```ts
@@ -4094,10 +4373,17 @@ var ScopeConversationsResource = class {
4094
4373
  return buildAipPage(
4095
4374
  data,
4096
4375
  "conversations",
4097
- parseListItem,
4376
+ (raw) => raw,
4098
4377
  (token) => this.listPage(pageSize, token, source, sourceRef)
4099
4378
  );
4100
4379
  }
4380
+ };
4381
+
4382
+ // src/resources/scopes/conversations.ts
4383
+ function parseConversation(raw) {
4384
+ return raw;
4385
+ }
4386
+ var ScopeConversationsResource = class extends ScopesConversationsResourceBase {
4101
4387
  /**
4102
4388
  * Retrieve a thread with full message history.
4103
4389
  *
@@ -4131,22 +4417,26 @@ var ScopeConversationsResource = class {
4131
4417
  }
4132
4418
  };
4133
4419
 
4134
- // src/management/scopes/memories.ts
4135
- function parseMemory(raw) {
4136
- return raw;
4137
- }
4138
- var ScopeMemoriesResource = class {
4420
+ // src/_generated/resources/management/scopes/memories.ts
4421
+ var ScopesMemoriesResourceBase = class {
4422
+ /** @internal */
4139
4423
  constructor(http, config, scopeId) {
4140
4424
  this.http = http;
4141
4425
  this.config = config;
4142
4426
  this.scopeId = scopeId;
4143
4427
  }
4144
4428
  /**
4145
- * List memories stored for this scope.
4429
+ * List scope memories.
4146
4430
  *
4147
- * @param options.pageSize - Items per page (default 25).
4148
- * @param options.pageToken - Token from a previous page's `nextPageToken`.
4149
- * @param options.userId - Optional end-user id when memories are scoped per user.
4431
+ * Returns a page of the scope’s memories (up to 1000 total). Pass `nextPageToken` as `pageToken`
4432
+ * to fetch the next page. Optional `userId` filters to one end user.
4433
+ *
4434
+ * **Requires:** `scopes:read`
4435
+ *
4436
+ * @param options.pageSize - Items per page. Defaults to 25.
4437
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
4438
+ * for the first page.
4439
+ * @param options.userId - Narrow results to memories tagged with this end-user id.
4150
4440
  * @returns A page of memories.
4151
4441
  */
4152
4442
  list(options = {}) {
@@ -4167,15 +4457,20 @@ var ScopeMemoriesResource = class {
4167
4457
  return buildAipPage(
4168
4458
  data,
4169
4459
  "memories",
4170
- parseMemory,
4460
+ (raw) => raw,
4171
4461
  (token) => this.listPage(pageSize, token, userId)
4172
4462
  );
4173
4463
  }
4174
4464
  /**
4175
- * Search this scope's memories by natural-language query.
4465
+ * Search scope memories.
4466
+ *
4467
+ * Returns memories ranked by semantic similarity to the supplied `query`. Caller must at least
4468
+ * `use` the scope. Optional `userId` and `limit` body fields narrow the result set (legacy parity
4469
+ * with `search-memories`).
4176
4470
  *
4177
- * @param request - Query text and optional `userId` / `limit`.
4178
- * @returns Matching memories and relevance scores.
4471
+ * **Requires:** `scopes:read`
4472
+ *
4473
+ * @param request - Request body; see `MemorySearchRequest`.
4179
4474
  */
4180
4475
  async search(request) {
4181
4476
  validateId(this.scopeId, "scope_id");
@@ -4186,12 +4481,17 @@ var ScopeMemoriesResource = class {
4186
4481
  return data;
4187
4482
  }
4188
4483
  /**
4189
- * Update one memory. Requires manage permission on the scope.
4484
+ * Update a memory.
4485
+ *
4486
+ * Updates one memory. Supply at least one of `memory` or `metadata`. Use `updateMask` to limit
4487
+ * which fields change.
4190
4488
  *
4191
- * @param memoryId - Id from list or search.
4192
- * @param update - Fields to change (`memory` and/or `metadata`).
4193
- * @param options.updateMask - Optional comma-separated field names to update.
4194
- * @returns The updated memory.
4489
+ * **Requires:** `scopes:write`
4490
+ *
4491
+ * @param memoryId - Opaque memory id as returned by the list / search endpoints.
4492
+ * @param update - Request body; see `MemoryUpdate`.
4493
+ * @param options.updateMask - Comma-separated list of fields to update. Omit to update all
4494
+ * provided fields.
4195
4495
  */
4196
4496
  async update(memoryId, update, options = {}) {
4197
4497
  validateId(memoryId, "memory_id");
@@ -4201,9 +4501,17 @@ var ScopeMemoriesResource = class {
4201
4501
  query: updateMaskQuery(options.updateMask),
4202
4502
  jsonBody: omitUndefined(update)
4203
4503
  });
4204
- return parseMemory(data);
4504
+ return data;
4205
4505
  }
4206
- /** Delete one memory (idempotent). */
4506
+ /**
4507
+ * Delete a memory.
4508
+ *
4509
+ * Deletes one memory. Deleting an already-deleted memory is a no-op.
4510
+ *
4511
+ * **Requires:** `scopes:write`
4512
+ *
4513
+ * @param memoryId - Opaque memory id as returned by the list / search endpoints.
4514
+ */
4207
4515
  async delete(memoryId) {
4208
4516
  validateId(memoryId, "memory_id");
4209
4517
  validateId(this.scopeId, "scope_id");
@@ -4213,32 +4521,42 @@ var ScopeMemoriesResource = class {
4213
4521
  }
4214
4522
  };
4215
4523
 
4216
- // src/management/scopes/evaluations.ts
4217
- function parseConfig(raw) {
4218
- return raw;
4219
- }
4220
- function parseRun(raw) {
4221
- return raw;
4222
- }
4223
- var ScopeEvaluationsResource = class {
4524
+ // src/management/scopes/memories.ts
4525
+ var ScopeMemoriesResource = class extends ScopesMemoriesResourceBase {
4526
+ };
4527
+
4528
+ // src/_generated/resources/management/scopes/evaluations.ts
4529
+ var ScopesEvaluationsResourceBase = class {
4530
+ /** @internal */
4224
4531
  constructor(http, config, scopeId) {
4225
4532
  this.http = http;
4226
4533
  this.config = config;
4227
4534
  this.scopeId = scopeId;
4228
4535
  }
4229
- /** Get the evaluation configuration for this scope. */
4536
+ /**
4537
+ * Get evaluation configuration.
4538
+ *
4539
+ * Returns the evaluation configuration for a scope, including judge settings, schedule cadence,
4540
+ * and notification preferences.
4541
+ *
4542
+ * **Requires:** `scopes:read`
4543
+ */
4230
4544
  async getConfig() {
4231
4545
  validateId(this.scopeId, "scope_id");
4232
4546
  const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_getConfig", {
4233
4547
  pathParams: { id: this.scopeId }
4234
4548
  });
4235
- return parseConfig(data);
4549
+ return data;
4236
4550
  }
4237
4551
  /**
4238
- * Update the evaluation configuration for this scope.
4552
+ * Update evaluation configuration.
4553
+ *
4554
+ * Updates the evaluation configuration for a scope. Changes to the schedule cadence are synced
4555
+ * automatically.
4239
4556
  *
4240
- * @param update - Configuration fields to change.
4241
- * @returns The updated evaluation configuration.
4557
+ * **Requires:** `scopes:write`
4558
+ *
4559
+ * @param update - Request body; see `UpdateEvaluationConfig`.
4242
4560
  */
4243
4561
  async updateConfig(update) {
4244
4562
  validateId(this.scopeId, "scope_id");
@@ -4246,12 +4564,17 @@ var ScopeEvaluationsResource = class {
4246
4564
  pathParams: { id: this.scopeId },
4247
4565
  jsonBody: omitUndefined(update)
4248
4566
  });
4249
- return parseConfig(data);
4567
+ return data;
4250
4568
  }
4251
4569
  /**
4252
- * Trigger a manual evaluation run for this scope.
4570
+ * Trigger evaluation run.
4571
+ *
4572
+ * Triggers a manual evaluation run for the scope. The run executes asynchronously.
4573
+ *
4574
+ * **Requires:** `scopes:write`
4253
4575
  *
4254
- * @returns The triggered run id and status.
4576
+ * @returns Evaluation run accepted and queued. The run executes asynchronously; poll `GET
4577
+ * /scopes/{id}/evaluations/runs/{runId}` for status.
4255
4578
  */
4256
4579
  async triggerRun() {
4257
4580
  validateId(this.scopeId, "scope_id");
@@ -4261,11 +4584,14 @@ var ScopeEvaluationsResource = class {
4261
4584
  return data;
4262
4585
  }
4263
4586
  /**
4264
- * List evaluation runs for this scope.
4587
+ * List evaluation runs.
4265
4588
  *
4266
- * @param options.pageSize - Items per page (default 25).
4267
- * @param options.pageToken - Token from a previous page's `nextPageToken`.
4268
- * @returns A page of evaluation runs.
4589
+ * Returns a paginated list of evaluation runs for the scope, ordered by most recent first.
4590
+ *
4591
+ * **Requires:** `scopes:read`
4592
+ *
4593
+ * @param options.pageSize - Items per page. Defaults to 25.
4594
+ * @returns A page of runs.
4269
4595
  */
4270
4596
  listRuns(options = {}) {
4271
4597
  const pageSize = options.pageSize ?? 25;
@@ -4280,13 +4606,21 @@ var ScopeEvaluationsResource = class {
4280
4606
  query: aipListParams(pageSize, pageToken)
4281
4607
  })
4282
4608
  );
4283
- return buildAipPage(data, "runs", parseRun, (token) => this.listRunsPage(pageSize, token));
4609
+ return buildAipPage(
4610
+ data,
4611
+ "runs",
4612
+ (raw) => raw,
4613
+ (token) => this.listRunsPage(pageSize, token)
4614
+ );
4284
4615
  }
4285
4616
  /**
4286
- * Retrieve one evaluation run with full results.
4617
+ * Get evaluation run.
4618
+ *
4619
+ * Returns details of an evaluation run including all per-case results.
4287
4620
  *
4288
- * @param runId - Evaluation run id.
4289
- * @returns The run and its result details.
4621
+ * **Requires:** `scopes:read`
4622
+ *
4623
+ * @param runId - Run ID.
4290
4624
  */
4291
4625
  async getRun(runId) {
4292
4626
  validateId(this.scopeId, "scope_id");
@@ -4298,14 +4632,26 @@ var ScopeEvaluationsResource = class {
4298
4632
  }
4299
4633
  };
4300
4634
 
4301
- // src/management/scopes/interfaces.ts
4302
- var ScopeInterfacesResource = class {
4635
+ // src/management/scopes/evaluations.ts
4636
+ var ScopeEvaluationsResource = class extends ScopesEvaluationsResourceBase {
4637
+ };
4638
+
4639
+ // src/_generated/resources/management/scopes/interfaces.ts
4640
+ var ScopesInterfacesResourceBase = class {
4641
+ /** @internal */
4303
4642
  constructor(http, config, scopeId) {
4304
4643
  this.http = http;
4305
4644
  this.config = config;
4306
4645
  this.scopeId = scopeId;
4307
4646
  }
4308
- /** List the Slack and Microsoft Teams interfaces on this scope. */
4647
+ /**
4648
+ * List the chat interfaces of a scope.
4649
+ *
4650
+ * Returns the chat interfaces (at most one per chat platform) that let people use this scope from
4651
+ * chat. Requires manage permission on the scope, because the config lists allowed emails.
4652
+ *
4653
+ * **Requires:** `scopes:read`
4654
+ */
4309
4655
  async list() {
4310
4656
  validateId(this.scopeId, "scope_id");
4311
4657
  const data = await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_list", {
@@ -4313,6 +4659,27 @@ var ScopeInterfacesResource = class {
4313
4659
  });
4314
4660
  return data.interfaces;
4315
4661
  }
4662
+ /**
4663
+ * Remove a scope interface.
4664
+ *
4665
+ * Removes one chat interface from the scope. Mentions on that chat platform stop reaching this
4666
+ * scope immediately.
4667
+ *
4668
+ * **Requires:** `scopes:write`
4669
+ *
4670
+ * @param interfaceId - Interface id (UUID).
4671
+ */
4672
+ async delete(interfaceId) {
4673
+ validateId(this.scopeId, "scope_id");
4674
+ validateId(interfaceId, "interface_id");
4675
+ await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_delete", {
4676
+ pathParams: { id: this.scopeId, interfaceId }
4677
+ });
4678
+ }
4679
+ };
4680
+
4681
+ // src/management/scopes/interfaces.ts
4682
+ var ScopeInterfacesResource = class extends ScopesInterfacesResourceBase {
4316
4683
  /**
4317
4684
  * Add a Slack or Microsoft Teams interface to this scope.
4318
4685
  *
@@ -4343,67 +4710,79 @@ var ScopeInterfacesResource = class {
4343
4710
  jsonBody: updateMask === void 0 ? omitUndefined(options) : options
4344
4711
  });
4345
4712
  }
4346
- /**
4347
- * Remove an interface from this scope.
4348
- *
4349
- * @param interfaceId - Interface id.
4350
- */
4351
- async delete(interfaceId) {
4352
- validateId(this.scopeId, "scope_id");
4353
- validateId(interfaceId, "interface_id");
4354
- await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_delete", {
4355
- pathParams: { id: this.scopeId, interfaceId }
4356
- });
4357
- }
4358
4713
  };
4359
4714
 
4360
- // src/management/scopes/supervision.ts
4361
- var ScopeSupervisionResource = class {
4715
+ // src/_generated/resources/management/scopes/supervision.ts
4716
+ var ScopesSupervisionResourceBase = class {
4717
+ /** @internal */
4362
4718
  constructor(http, config, scopeId) {
4363
4719
  this.http = http;
4364
4720
  this.config = config;
4365
4721
  this.scopeId = scopeId;
4366
4722
  }
4367
4723
  /**
4368
- * Get this scope's supervision configuration.
4724
+ * Read the scope subordinate supervision list.
4725
+ *
4726
+ * Returns the list of subordinate scope ids managed by this scope. `?view=active` (default) reads
4727
+ * the deployed supervision set; `?view=draft` reads the most recent builder snapshot. Returns 404
4728
+ * when the caller cannot at least `use` the scope.
4729
+ *
4730
+ * **Requires:** `scopes:read`
4369
4731
  *
4370
- * @param options.view - Optional scope variation to inspect.
4371
- * @returns The supervision configuration.
4732
+ * @param options.view - Which variation snapshot to read. Defaults to `active`.
4372
4733
  */
4373
4734
  async get(options = {}) {
4374
4735
  validateId(this.scopeId, "scope_id");
4375
- return await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_get", {
4736
+ const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_get", {
4376
4737
  pathParams: { id: this.scopeId },
4377
- query: options.view === void 0 ? void 0 : { view: options.view }
4738
+ query: { view: options.view }
4378
4739
  });
4740
+ return data;
4379
4741
  }
4380
4742
  /**
4381
- * Replace this scope's subordinate scopes.
4743
+ * Replace draft subordinate supervision list.
4744
+ *
4745
+ * Writes the supplied subordinate id list into the draft variation. Replaces the previous list
4746
+ * fully — supply an empty array to clear all subordinates. Requires manage permission on the
4747
+ * supervisor; the change is not visible to runners until the scope is deployed.
4382
4748
  *
4383
- * @param request - Replacement supervision configuration.
4384
- * @returns The updated supervision configuration.
4749
+ * **Requires:** `scopes:write`
4750
+ *
4751
+ * @param request - Request body; see `SetSupervisionRequest`.
4385
4752
  */
4386
4753
  async set(request) {
4387
- return this.write("ScopeSupervisionController_set", request);
4754
+ validateId(this.scopeId, "scope_id");
4755
+ const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_set", {
4756
+ pathParams: { id: this.scopeId },
4757
+ jsonBody: request
4758
+ });
4759
+ return data;
4388
4760
  }
4389
4761
  /**
4390
- * Replace subordinate scopes on the active (deployed) scope version.
4762
+ * Replace active subordinate supervision list.
4391
4763
  *
4392
- * @param request - Replacement supervision configuration.
4393
- * @returns The updated supervision configuration.
4764
+ * Writes directly into the active variation supervision set, bypassing the draft deploy cycle.
4765
+ * Requires `scopes:write` plus manage permission on the supervisor. Use to correct a live
4766
+ * supervision graph without going through the builder.
4767
+ *
4768
+ * **Requires:** `scopes:write`
4769
+ *
4770
+ * @param request - Request body; see `SetSupervisionRequest`.
4394
4771
  */
4395
4772
  async setActive(request) {
4396
- return this.write("ScopeSupervisionController_setActive", request);
4397
- }
4398
- async write(operation, request) {
4399
4773
  validateId(this.scopeId, "scope_id");
4400
- return await invokeWithRetry(this.config, this.http, operation, {
4774
+ const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_setActive", {
4401
4775
  pathParams: { id: this.scopeId },
4402
4776
  jsonBody: request
4403
4777
  });
4778
+ return data;
4404
4779
  }
4405
4780
  };
4406
4781
 
4782
+ // src/management/scopes/supervision.ts
4783
+ var ScopeSupervisionResource = class extends ScopesSupervisionResourceBase {
4784
+ };
4785
+
4407
4786
  // src/management/scopes/skills.ts
4408
4787
  var MANAGEMENT_SCOPE_OPERATIONS = {
4409
4788
  list: "ScopesController_list",
@@ -4419,21 +4798,12 @@ var MANAGEMENT_SCOPE_OPERATIONS = {
4419
4798
  patchMcpConfig: "ScopesController_patchMcpConfig",
4420
4799
  getVariation: "ScopesController_getVariation"
4421
4800
  };
4422
- function scopesListParams(pageSize, pageToken, search, view, managerId) {
4423
- const extra = {};
4424
- if (search !== void 0) extra.search = search;
4425
- if (view !== void 0) extra.view = view;
4426
- if (managerId !== void 0) extra.managerId = managerId;
4427
- return aipListParams(pageSize, pageToken, extra);
4428
- }
4429
4801
  function parseScope(raw) {
4430
4802
  return raw;
4431
4803
  }
4432
- var ManagementScopesResource = class {
4433
- /** @internal */
4434
- constructor(http, config) {
4435
- this.http = http;
4436
- this.config = config;
4804
+ var ManagementScopesResource = class extends ScopesResourceBase {
4805
+ constructor() {
4806
+ super(...arguments);
4437
4807
  this.ops = MANAGEMENT_SCOPE_OPERATIONS;
4438
4808
  }
4439
4809
  /**
@@ -4481,69 +4851,6 @@ var ManagementScopesResource = class {
4481
4851
  interfaces(scopeId) {
4482
4852
  return new ScopeInterfacesResource(this.http, this.config, scopeId);
4483
4853
  }
4484
- /**
4485
- * List scopes in the organization.
4486
- *
4487
- * @param options.pageSize - Maximum items per page (default 25).
4488
- * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
4489
- * @param options.search - Case-insensitive substring filter on the scope name.
4490
- * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
4491
- * @param options.managerId - Return only scopes supervised by this manager scope id.
4492
- * @returns A page of scopes — use `.autoPagingIter()` for all pages.
4493
- * @example
4494
- * ```ts
4495
- * const mgmt = new ModusManagement()
4496
- * for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {
4497
- * console.log(scope.id, scope.name, scope.status)
4498
- * }
4499
- * ```
4500
- */
4501
- list(options = {}) {
4502
- const pageSize = options.pageSize ?? 25;
4503
- validatePageSize(pageSize);
4504
- return this.listPage(
4505
- pageSize,
4506
- options.pageToken,
4507
- options.search,
4508
- options.view,
4509
- options.managerId
4510
- );
4511
- }
4512
- async listPage(pageSize, pageToken, search, view, managerId) {
4513
- const data = asRecord(
4514
- await invokeWithRetry(this.config, this.http, this.ops.list, {
4515
- query: scopesListParams(pageSize, pageToken, search, view, managerId)
4516
- })
4517
- );
4518
- return buildAipPage(
4519
- data,
4520
- "scopes",
4521
- parseScope,
4522
- (token) => this.listPage(pageSize, token, search, view, managerId)
4523
- );
4524
- }
4525
- /**
4526
- * Retrieve a scope with full configuration.
4527
- *
4528
- * @param scopeId - Scope id.
4529
- * @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
4530
- * @returns The scope.
4531
- * @example
4532
- * ```ts
4533
- * const mgmt = new ModusManagement()
4534
- * const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')
4535
- * console.log(scope.name, scope.status)
4536
- * ```
4537
- */
4538
- async get(scopeId, options = {}) {
4539
- validateId(scopeId, "scope_id");
4540
- const query = options.view !== void 0 ? { view: options.view } : void 0;
4541
- const data = await invokeWithRetry(this.config, this.http, this.ops.get, {
4542
- pathParams: { id: scopeId },
4543
- query
4544
- });
4545
- return parseScope(data);
4546
- }
4547
4854
  /**
4548
4855
  * Create a new scope in the organization.
4549
4856
  *
@@ -4655,37 +4962,6 @@ var ManagementScopesResource = class {
4655
4962
  );
4656
4963
  return parseScope(data.scope);
4657
4964
  }
4658
- /**
4659
- * Delete a scope.
4660
- *
4661
- * @param scopeId - Scope id.
4662
- * @returns Resolves when the scope is deleted.
4663
- * @example
4664
- * ```ts
4665
- * const mgmt = new ModusManagement()
4666
- * await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')
4667
- * ```
4668
- */
4669
- async delete(scopeId) {
4670
- validateId(scopeId, "scope_id");
4671
- await invokeWithRetry(this.config, this.http, this.ops.delete, {
4672
- pathParams: { id: scopeId }
4673
- });
4674
- }
4675
- /**
4676
- * Restore a previously deleted scope.
4677
- *
4678
- * @param scopeId - Scope id.
4679
- * @returns The restored scope.
4680
- */
4681
- async restore(scopeId) {
4682
- validateId(scopeId, "scope_id");
4683
- const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
4684
- pathParams: { id: scopeId },
4685
- jsonBody: {}
4686
- });
4687
- return parseScope(data);
4688
- }
4689
4965
  /**
4690
4966
  * Start transferring ownership of a scope to another organization member.
4691
4967
  *
@@ -4706,28 +4982,6 @@ var ManagementScopesResource = class {
4706
4982
  );
4707
4983
  return parseScope(data);
4708
4984
  }
4709
- /** Cancel a pending scope ownership transfer. */
4710
- async cancelOwnershipTransfer(scopeId) {
4711
- validateId(scopeId, "scope_id");
4712
- const data = await invokeWithRetry(
4713
- this.config,
4714
- this.http,
4715
- this.ops.cancelOwnershipTransfer,
4716
- { pathParams: { id: scopeId } }
4717
- );
4718
- return parseScope(data);
4719
- }
4720
- /** Accept a pending scope ownership transfer. */
4721
- async acceptOwnershipTransfer(scopeId) {
4722
- validateId(scopeId, "scope_id");
4723
- const data = await invokeWithRetry(
4724
- this.config,
4725
- this.http,
4726
- this.ops.acceptOwnershipTransfer,
4727
- { pathParams: { id: scopeId }, jsonBody: {} }
4728
- );
4729
- return parseScope(data);
4730
- }
4731
4985
  /**
4732
4986
  * Update MCP server configuration for a scope.
4733
4987
  *
@@ -4758,12 +5012,35 @@ var ManagementScopesResource = class {
4758
5012
  }
4759
5013
  };
4760
5014
 
4761
- // src/management/usage.ts
4762
- var ManagementUsageResource = class {
5015
+ // src/_generated/resources/management/usage.ts
5016
+ var UsageResourceBase = class {
5017
+ /** @internal */
4763
5018
  constructor(http, config) {
4764
5019
  this.http = http;
4765
5020
  this.config = config;
4766
5021
  }
5022
+ /**
5023
+ * List usage users.
5024
+ *
5025
+ * Returns the distinct acting-user emails that appear in your organization's LLM usage over the
5026
+ * `[since, until)` window. Feeds the usage page's user filter (includes non-Modus Slack/Teams
5027
+ * users). Scoped to your organization.
5028
+ *
5029
+ * **Requires:** `usage:read`
5030
+ *
5031
+ * @param options.since - ISO8601 start of the query window (inclusive).
5032
+ * @param options.until - ISO8601 end of the query window (exclusive).
5033
+ */
5034
+ async listUsers(options) {
5035
+ const data = await invokeWithRetry(this.config, this.http, "UsageController_listUsers", {
5036
+ query: { since: options.since, until: options.until }
5037
+ });
5038
+ return data;
5039
+ }
5040
+ };
5041
+
5042
+ // src/management/usage.ts
5043
+ var ManagementUsageResource = class extends UsageResourceBase {
4767
5044
  /**
4768
5045
  * List usage metrics for your organization over a time window.
4769
5046
  *
@@ -4787,42 +5064,27 @@ var ManagementUsageResource = class {
4787
5064
  const data = await invokeWithRetry(this.config, this.http, "UsageController_list", { query });
4788
5065
  return data;
4789
5066
  }
4790
- /**
4791
- * List distinct acting-user emails observed in a time window.
4792
- *
4793
- * @param options.since - Start of the window (ISO 8601, inclusive).
4794
- * @param options.until - End of the window (ISO 8601, exclusive).
4795
- * @returns User emails seen in usage during the window.
4796
- * @throws {UnprocessableError} When the request is rejected by the API.
4797
- * @throws {AuthenticationError} When the API key is invalid or missing.
4798
- */
4799
- async listUsers(options) {
4800
- const query = {
4801
- since: options.since,
4802
- until: options.until
4803
- };
4804
- const data = await invokeWithRetry(this.config, this.http, "UsageController_listUsers", {
4805
- query
4806
- });
4807
- return data;
4808
- }
4809
5067
  };
4810
5068
 
4811
- // src/management/tools.ts
4812
- function parseToolCatalogEntry(raw) {
4813
- return raw;
4814
- }
4815
- var ManagementToolsResource = class {
5069
+ // src/_generated/resources/management/tools.ts
5070
+ var ToolsResourceBase = class {
5071
+ /** @internal */
4816
5072
  constructor(http, config) {
4817
5073
  this.http = http;
4818
5074
  this.config = config;
4819
5075
  }
4820
5076
  /**
4821
- * List tool and integration surfaces a scope can select in its toolset.
5077
+ * List available tools.
4822
5078
  *
4823
- * @param options.pageSize - Maximum items per page (default 25).
4824
- * @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
4825
- * @returns A page of tool catalog entries.
5079
+ * Returns a page of known tool/integration surfaces a scope can select in its toolset, with the
5080
+ * fixed actions for built-in tools.
5081
+ *
5082
+ * **Requires:** `scopes:read`
5083
+ *
5084
+ * @param options.pageSize - Items per page. Defaults to 25.
5085
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
5086
+ * for the first page.
5087
+ * @returns A page of tools.
4826
5088
  */
4827
5089
  list(options = {}) {
4828
5090
  const pageSize = options.pageSize ?? 25;
@@ -4835,10 +5097,19 @@ var ManagementToolsResource = class {
4835
5097
  query: aipListParams(pageSize, pageToken)
4836
5098
  })
4837
5099
  );
4838
- return buildAipPage(data, "tools", parseToolCatalogEntry, (token) => this.listPage(pageSize, token));
5100
+ return buildAipPage(
5101
+ data,
5102
+ "tools",
5103
+ (raw) => raw,
5104
+ (token) => this.listPage(pageSize, token)
5105
+ );
4839
5106
  }
4840
5107
  };
4841
5108
 
5109
+ // src/management/tools.ts
5110
+ var ManagementToolsResource = class extends ToolsResourceBase {
5111
+ };
5112
+
4842
5113
  // src/management/users.ts
4843
5114
  var ManagementUsersResource = class {
4844
5115
  constructor(http, config) {