@getmodus/sdk 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -55,6 +55,16 @@ var OPERATIONS = {
55
55
  requestSchema: null,
56
56
  responseSchema: "ListConnectionsResponseDto"
57
57
  },
58
+ "ConnectionsController_listSelections": {
59
+ method: "GET",
60
+ path: "/api/v1/connections/{connectionId}/selections",
61
+ service: "modus-api",
62
+ serverUrl: "https://api.getmodus.com",
63
+ pathParams: ["connectionId"],
64
+ queryParams: ["pageToken", "pageSize"],
65
+ requestSchema: null,
66
+ responseSchema: "ListConnectionSelectionsResponseDto"
67
+ },
58
68
  "ContextCreatorsController_createLink": {
59
69
  method: "POST",
60
70
  path: "/api/v1/context/links",
@@ -191,7 +201,7 @@ var OPERATIONS = {
191
201
  service: "modus-api",
192
202
  serverUrl: "https://api.getmodus.com",
193
203
  pathParams: [],
194
- queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics"],
204
+ queryParams: ["pageToken", "pageSize", "contextTypes", "verificationStatuses", "searchQuery", "topics", "connectionIds", "parentUids", "ancestorUids"],
195
205
  requestSchema: null,
196
206
  responseSchema: "ListContextItemsResponseDto"
197
207
  },
@@ -215,6 +225,16 @@ var OPERATIONS = {
215
225
  requestSchema: "LookupContextItemDto",
216
226
  responseSchema: "LookupContextItemResponseDto"
217
227
  },
228
+ "ContextItemsController_move": {
229
+ method: "POST",
230
+ path: "/api/v1/context/items/{uid}/move",
231
+ service: "modus-api",
232
+ serverUrl: "https://api.getmodus.com",
233
+ pathParams: ["uid"],
234
+ queryParams: [],
235
+ requestSchema: "MoveContextItemDto",
236
+ responseSchema: "MoveContextItemResponseDto"
237
+ },
218
238
  "ContextItemsController_update": {
219
239
  method: "PATCH",
220
240
  path: "/api/v1/context/items/{uid}",
@@ -755,6 +775,46 @@ var OPERATIONS = {
755
775
  requestSchema: null,
756
776
  responseSchema: "ListConversationsResponseDto"
757
777
  },
778
+ "ScopeInterfacesController_add": {
779
+ method: "POST",
780
+ path: "/api/v1/scopes/{id}/interfaces",
781
+ service: "modus-api",
782
+ serverUrl: "https://api.getmodus.com",
783
+ pathParams: ["id"],
784
+ queryParams: [],
785
+ requestSchema: "AddScopeInterfaceDto",
786
+ responseSchema: "ScopeInterfaceDto"
787
+ },
788
+ "ScopeInterfacesController_delete": {
789
+ method: "DELETE",
790
+ path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
791
+ service: "modus-api",
792
+ serverUrl: "https://api.getmodus.com",
793
+ pathParams: ["id", "interfaceId"],
794
+ queryParams: [],
795
+ requestSchema: null,
796
+ responseSchema: null
797
+ },
798
+ "ScopeInterfacesController_list": {
799
+ method: "GET",
800
+ path: "/api/v1/scopes/{id}/interfaces",
801
+ service: "modus-api",
802
+ serverUrl: "https://api.getmodus.com",
803
+ pathParams: ["id"],
804
+ queryParams: [],
805
+ requestSchema: null,
806
+ responseSchema: "ListScopeInterfacesResponseDto"
807
+ },
808
+ "ScopeInterfacesController_update": {
809
+ method: "PATCH",
810
+ path: "/api/v1/scopes/{id}/interfaces/{interfaceId}",
811
+ service: "modus-api",
812
+ serverUrl: "https://api.getmodus.com",
813
+ pathParams: ["id", "interfaceId"],
814
+ queryParams: ["updateMask"],
815
+ requestSchema: "UpdateScopeInterfaceDto",
816
+ responseSchema: "ScopeInterfaceDto"
817
+ },
758
818
  "ScopeMemoriesController_delete": {
759
819
  method: "DELETE",
760
820
  path: "/api/v1/scopes/{id}/memories/{memoryId}",
@@ -1402,6 +1462,7 @@ var WRITE_BODY_ALLOWED_KEYS = {
1402
1462
  ContextFilesController_uploadUrl: ["fileName", "contentType", "fileSize"],
1403
1463
  ContextFilesController_uploadUrls: ["files"],
1404
1464
  ContextItemsController_lookup: ["contextType", "dataPath", "contentProjection"],
1465
+ ContextItemsController_move: ["destinationFolderUid"],
1405
1466
  ContextItemsController_update: ["contextType", "content", "description", "userFeedback", "topics"],
1406
1467
  CustomContextItemsController_batchCreate: ["items"],
1407
1468
  CustomContextItemsController_create: ["kind", "sourceId", "sourceName", "collectionId", "collectionName", "externalId", "fieldName", "name", "entityType", "description", "content", "url", "attributes", "dataType", "value", "samples", "raw", "topics", "idempotencyKey", "access"],
@@ -1427,11 +1488,13 @@ var WRITE_BODY_ALLOWED_KEYS = {
1427
1488
  RunLifecycleController_interrupt: [],
1428
1489
  ScopeChatController_chat: ["message", "model"],
1429
1490
  ScopeContextController_compose: ["message", "limit"],
1491
+ ScopeInterfacesController_add: ["type", "name", "config"],
1492
+ ScopeInterfacesController_update: ["name", "config"],
1430
1493
  ScopeMemoriesController_search: ["query", "userId", "limit"],
1431
1494
  ScopeMemoriesController_update: ["memory", "metadata"],
1432
1495
  ScopeRunsController_create: ["message", "sessionId", "organizationId", "version", "fileThreadId", "config", "attachments", "userContext", "source", "runId", "subordinateSkillIds"],
1433
1496
  ScopesController_acceptOwnershipTransfer: [],
1434
- ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig"],
1497
+ ScopesController_create: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "includeOwnLearnings", "interfaces", "accessConfig"],
1435
1498
  ScopesController_deploy: [],
1436
1499
  ScopesController_patchMcpConfig: ["config"],
1437
1500
  ScopesController_requestOwnershipTransfer: ["newOwnerUserId"],
@@ -1471,11 +1534,15 @@ function validateId(resourceId, name = "id") {
1471
1534
  }
1472
1535
  var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
1473
1536
  "claude-sonnet-5",
1537
+ "claude-sonnet-5.5",
1474
1538
  "claude-sonnet-4.6",
1475
1539
  "claude-opus-4.8",
1540
+ "claude-opus-5.5",
1476
1541
  "gpt-5.2",
1477
1542
  "gpt-5.5",
1478
1543
  "gpt-5-mini",
1544
+ "gpt-5.6-luna",
1545
+ "gpt-6-luna",
1479
1546
  "gpt-oss-120b",
1480
1547
  "gpt-oss-20b",
1481
1548
  "qwen3-235b-a22b-2507",
@@ -1491,7 +1558,9 @@ var ALLOWED_CHAT_MODELS = /* @__PURE__ */ new Set([
1491
1558
  "gemini-3.1-pro-preview",
1492
1559
  "gemini-3-flash-preview",
1493
1560
  "grok-4.3-fast",
1494
- "grok-4.3"
1561
+ "grok-4.3",
1562
+ "grok-4.7",
1563
+ "kimi-k3"
1495
1564
  ]);
1496
1565
  function validateChatModel(model) {
1497
1566
  if (!ALLOWED_CHAT_MODELS.has(model)) {
@@ -1892,6 +1961,7 @@ function createModusConfig(options = {}) {
1892
1961
  }),
1893
1962
  timeoutMs: resolveTimeoutMs(options.timeoutMs) ?? DEFAULT_TIMEOUT_MS,
1894
1963
  maxRetries,
1964
+ defaultHeaders: Object.freeze({ ...options.defaultHeaders }),
1895
1965
  fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
1896
1966
  });
1897
1967
  }
@@ -1907,7 +1977,7 @@ function formatConfigForLog(config) {
1907
1977
  }
1908
1978
 
1909
1979
  // src/_http.ts
1910
- var USER_AGENT = `modus-typescript/${"0.7.0"} (node/${process.version}; ${process.platform})`;
1980
+ var USER_AGENT = `modus-typescript/${"0.9.0"} (node/${process.version}; ${process.platform})`;
1911
1981
  function buildUrl(baseUrl, path, params) {
1912
1982
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
1913
1983
  if (params) {
@@ -1922,6 +1992,15 @@ function buildUrl(baseUrl, path, params) {
1922
1992
  }
1923
1993
  return url.toString();
1924
1994
  }
1995
+ function mergeHeaders(...layers) {
1996
+ const merged = /* @__PURE__ */ new Map();
1997
+ for (const layer of layers) {
1998
+ for (const [name, value] of Object.entries(layer ?? {})) {
1999
+ merged.set(name.toLowerCase(), [name, value]);
2000
+ }
2001
+ }
2002
+ return Object.fromEntries(merged.values());
2003
+ }
1925
2004
  function headersToRecord(headers) {
1926
2005
  const out = {};
1927
2006
  headers.forEach((value, key) => {
@@ -2027,12 +2106,15 @@ var HttpClient = class {
2027
2106
  this.config = config;
2028
2107
  }
2029
2108
  defaultHeaders() {
2030
- return {
2031
- ...authHeaders(this.config.apiKey),
2032
- Accept: "application/json",
2033
- "Content-Type": "application/json",
2034
- "User-Agent": USER_AGENT
2035
- };
2109
+ return mergeHeaders(
2110
+ {
2111
+ Accept: "application/json",
2112
+ "Content-Type": "application/json",
2113
+ "User-Agent": USER_AGENT,
2114
+ "X-Modus-Client": "sdk"
2115
+ },
2116
+ this.config.defaultHeaders
2117
+ );
2036
2118
  }
2037
2119
  async request(method, path, options = {}) {
2038
2120
  const baseUrl = options.baseUrl ?? this.config.baseUrl;
@@ -2040,7 +2122,7 @@ var HttpClient = class {
2040
2122
  try {
2041
2123
  const response = await this.config.fetch(url, {
2042
2124
  method,
2043
- headers: { ...this.defaultHeaders(), ...options.headers },
2125
+ headers: mergeHeaders(this.defaultHeaders(), options.headers, authHeaders(this.config.apiKey)),
2044
2126
  body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
2045
2127
  signal: AbortSignal.timeout(this.config.timeoutMs)
2046
2128
  });
@@ -2079,11 +2161,12 @@ var HttpClient = class {
2079
2161
  method,
2080
2162
  // Agent-service negotiates SSE vs JSON polling on Accept; JSON-only
2081
2163
  // Accept returns {"runId","status":"pending"} instead of token SSE.
2082
- headers: {
2083
- ...this.defaultHeaders(),
2084
- ...options.headers,
2085
- Accept: "text/event-stream"
2086
- },
2164
+ headers: mergeHeaders(
2165
+ this.defaultHeaders(),
2166
+ options.headers,
2167
+ { Accept: "text/event-stream" },
2168
+ authHeaders(this.config.apiKey)
2169
+ ),
2087
2170
  body: options.json !== void 0 ? JSON.stringify(options.json) : void 0,
2088
2171
  signal: AbortSignal.timeout(this.config.timeoutMs)
2089
2172
  });
@@ -2255,6 +2338,64 @@ function asRecord(data) {
2255
2338
  throw new Error(`Expected object response, got ${typeof data}`);
2256
2339
  }
2257
2340
 
2341
+ // src/_generated/resources/consumption/workflows.ts
2342
+ var WorkflowsResourceBase = class {
2343
+ /** @internal */
2344
+ constructor(http, config) {
2345
+ this.http = http;
2346
+ this.config = config;
2347
+ }
2348
+ /**
2349
+ * List workflows.
2350
+ *
2351
+ * Returns a paginated page of workflows the caller can at least `use`. Workflows the caller
2352
+ * cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
2353
+ *
2354
+ * **Requires:** `workflows:read`
2355
+ *
2356
+ * @param options.pageSize - Items per page. Defaults to 25.
2357
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
2358
+ * for the first page.
2359
+ * @param options.search - Case-insensitive substring filter on workflow name.
2360
+ * @param options.type - Filter by workflow type.
2361
+ * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
2362
+ * snapshot.
2363
+ * @param options.includeVariation - Include the requested variation payload (`trigger`,
2364
+ * `workflowStructure`, `agentSelection`) on list rows.
2365
+ * @returns A page of workflows.
2366
+ *
2367
+ * @example
2368
+ * ```ts
2369
+ * for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
2370
+ * console.log(wf.id, wf.name, wf.status)
2371
+ * }
2372
+ * ```
2373
+ */
2374
+ list(options = {}) {
2375
+ const pageSize = options.pageSize ?? 25;
2376
+ validatePageSize(pageSize);
2377
+ return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation);
2378
+ }
2379
+ async listPage(pageSize, pageToken, search, type, view, includeVariation) {
2380
+ const extra = {};
2381
+ if (search !== void 0) extra.search = search;
2382
+ if (type !== void 0) extra.type = type;
2383
+ if (view !== void 0) extra.view = view;
2384
+ if (includeVariation !== void 0) extra.includeVariation = includeVariation;
2385
+ const data = asRecord(
2386
+ await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
2387
+ query: aipListParams(pageSize, pageToken, extra)
2388
+ })
2389
+ );
2390
+ return buildAipPage(
2391
+ data,
2392
+ "workflows",
2393
+ (raw) => raw,
2394
+ (token) => this.listPage(pageSize, token, search, type, view, includeVariation)
2395
+ );
2396
+ }
2397
+ };
2398
+
2258
2399
  // src/resources/workflows/runs.ts
2259
2400
  var import_node_crypto2 = require("crypto");
2260
2401
  var RUNS_MAX_PAGE_SIZE = 100;
@@ -2680,75 +2821,16 @@ var AgentWorkflowActionsResource = class {
2680
2821
  };
2681
2822
 
2682
2823
  // src/resources/workflows.ts
2683
- function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
2684
- const extra = {};
2685
- if (search !== void 0) extra.search = search;
2686
- if (type !== void 0) extra.type = type;
2687
- if (view !== void 0) extra.view = view;
2688
- if (includeVariation !== void 0) extra.includeVariation = includeVariation;
2689
- return aipListParams(pageSize, pageToken, extra);
2690
- }
2691
2824
  function parseWorkflow(raw) {
2692
2825
  return raw;
2693
2826
  }
2694
- var WorkflowsResource = class {
2827
+ var WorkflowsResource = class extends WorkflowsResourceBase {
2695
2828
  /** @internal */
2696
2829
  constructor(http, config) {
2697
- this.http = http;
2698
- this.config = config;
2830
+ super(http, config);
2699
2831
  this.runs = new WorkflowRunsResource(http, config);
2700
2832
  this.workflowActions = new AgentWorkflowActionsResource(http, config);
2701
2833
  }
2702
- /**
2703
- * List workflows in the organisation.
2704
- *
2705
- * @param options.pageSize - Maximum items per page (default 25).
2706
- * @param options.pageToken - Opaque token from a previous page.
2707
- * @param options.search - Case-insensitive substring filter on the workflow name.
2708
- * @param options.type - Workflow kind: `"task"` or `"workflow"`.
2709
- * @param options.view - Which saved version to return (`active` or `draft`).
2710
- * @param options.includeVariation - Include variation metadata when supported.
2711
- * @returns A page of workflows — use `.autoPagingIter()` for all pages.
2712
- *
2713
- * @example
2714
- * ```ts
2715
- * for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
2716
- * console.log(wf.id, wf.name, wf.status)
2717
- * }
2718
- * ```
2719
- */
2720
- list(options = {}) {
2721
- const pageSize = options.pageSize ?? 25;
2722
- validatePageSize(pageSize);
2723
- return this.listPage(
2724
- pageSize,
2725
- options.pageToken,
2726
- options.search,
2727
- options.type,
2728
- options.view,
2729
- options.includeVariation
2730
- );
2731
- }
2732
- async listPage(pageSize, pageToken, search, type, view, includeVariation) {
2733
- const data = asRecord(
2734
- await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
2735
- query: workflowsListParams(
2736
- pageSize,
2737
- pageToken,
2738
- search,
2739
- type,
2740
- view,
2741
- includeVariation
2742
- )
2743
- })
2744
- );
2745
- return buildAipPage(
2746
- data,
2747
- "workflows",
2748
- parseWorkflow,
2749
- (token) => this.listPage(pageSize, token, search, type, view, includeVariation)
2750
- );
2751
- }
2752
2834
  /**
2753
2835
  * Retrieve a workflow by ID or slug.
2754
2836
  *
@@ -2779,27 +2861,26 @@ var WorkflowsResource = class {
2779
2861
  }
2780
2862
  };
2781
2863
 
2782
- // src/resources/connections.ts
2783
- function connectionsListParams(pageSize, pageToken, type) {
2784
- const extra = {};
2785
- if (type !== void 0) extra.type = type;
2786
- return aipListParams(pageSize, pageToken, extra);
2787
- }
2788
- function parseConnection(raw) {
2789
- return raw;
2790
- }
2791
- var ConnectionsResource = class {
2864
+ // src/_generated/resources/consumption/connections.ts
2865
+ var ConnectionsResourceBase = class {
2792
2866
  /** @internal */
2793
2867
  constructor(http, config) {
2794
2868
  this.http = http;
2795
2869
  this.config = config;
2796
2870
  }
2797
2871
  /**
2798
- * List integration connections.
2872
+ * List connections.
2799
2873
  *
2800
- * @param options.pageSize - Maximum items per page (default 25).
2801
- * @param options.pageToken - Opaque token from a previous page.
2802
- * @param options.type - Integration category; exact match filter.
2874
+ * Returns a paginated page of warehouse and SaaS integration connections the caller can `use`.
2875
+ * Connections the caller cannot access are filtered out. Use the returned `id` when creating
2876
+ * saved-query context items. Pagination uses an opaque token returned in `nextPageToken`.
2877
+ *
2878
+ * **Requires:** `context:read`
2879
+ *
2880
+ * @param options.pageSize - Items per page. Defaults to 25.
2881
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
2882
+ * for the first page.
2883
+ * @param options.type - Filter by effective integration category (case-sensitive exact match).
2803
2884
  * @returns A page of connections.
2804
2885
  */
2805
2886
  list(options = {}) {
@@ -2808,18 +2889,24 @@ var ConnectionsResource = class {
2808
2889
  return this.listPage(pageSize, options.pageToken, options.type);
2809
2890
  }
2810
2891
  async listPage(pageSize, pageToken, type) {
2892
+ const extra = {};
2893
+ if (type !== void 0) extra.type = type;
2811
2894
  const data = asRecord(
2812
2895
  await invokeWithRetry(this.config, this.http, "ConnectionsController_list", {
2813
- query: connectionsListParams(pageSize, pageToken, type)
2896
+ query: aipListParams(pageSize, pageToken, extra)
2814
2897
  })
2815
2898
  );
2816
2899
  return buildAipPage(
2817
2900
  data,
2818
2901
  "connections",
2819
- parseConnection,
2902
+ (raw) => raw,
2820
2903
  (token) => this.listPage(pageSize, token, type)
2821
2904
  );
2822
2905
  }
2906
+ };
2907
+
2908
+ // src/resources/connections.ts
2909
+ var ConnectionsResource = class extends ConnectionsResourceBase {
2823
2910
  /**
2824
2911
  * Find the first connection whose name matches (case-insensitive).
2825
2912
  *
@@ -2844,6 +2931,52 @@ var ConnectionsResource = class {
2844
2931
  } while (token !== void 0);
2845
2932
  return void 0;
2846
2933
  }
2934
+ /**
2935
+ * List the selectable units on a connection (a repository, a schema, a project).
2936
+ *
2937
+ * @param connectionId - Connection id.
2938
+ * @param options.pageSize - Maximum items per page (default 25).
2939
+ * @param options.pageToken - Opaque token from a previous page.
2940
+ * @returns A page of selectable units — use {@link iterSelections} or `.autoPagingIter()` for every page.
2941
+ * @example
2942
+ * for await (const unit of client.connections.iterSelections('7a3f9d2c-1111-4000-a000-000000000abc')) {
2943
+ * console.log(unit.objectType, unit.path)
2944
+ * }
2945
+ */
2946
+ listSelections(connectionId, options = {}) {
2947
+ validateId(connectionId, "connection_id");
2948
+ const pageSize = options.pageSize ?? 25;
2949
+ validatePageSize(pageSize);
2950
+ return this.listSelectionsPage(connectionId, pageSize, options.pageToken);
2951
+ }
2952
+ async listSelectionsPage(connectionId, pageSize, pageToken) {
2953
+ const data = asRecord(
2954
+ await invokeWithRetry(this.config, this.http, "ConnectionsController_listSelections", {
2955
+ pathParams: { connectionId },
2956
+ query: aipListParams(pageSize, pageToken)
2957
+ })
2958
+ );
2959
+ return buildAipPage(
2960
+ data,
2961
+ "selections",
2962
+ (raw) => raw,
2963
+ (token) => this.listSelectionsPage(connectionId, pageSize, token)
2964
+ );
2965
+ }
2966
+ /**
2967
+ * Yield every selectable unit on a connection, following pages.
2968
+ *
2969
+ * @param connectionId - Connection id.
2970
+ * @param options.pageSize - Maximum items per page (default 25).
2971
+ * @example
2972
+ * for await (const unit of client.connections.iterSelections('7a3f9d2c-1111-4000-a000-000000000abc')) {
2973
+ * console.log(unit.objectType, unit.displayName)
2974
+ * }
2975
+ */
2976
+ async *iterSelections(connectionId, options = {}) {
2977
+ const page = await this.listSelections(connectionId, options);
2978
+ yield* page.autoPagingIter();
2979
+ }
2847
2980
  };
2848
2981
 
2849
2982
  // src/resources/context/custom-items.ts
@@ -2878,7 +3011,7 @@ var CustomContextItemsResource = class {
2878
3011
  *
2879
3012
  * @param options.pageSize - Maximum items per page (default 25).
2880
3013
  * @param options.pageToken - Opaque token from a previous page.
2881
- * @param options.searchQuery - Free-text search filter.
3014
+ * @param options.searchQuery - Word search: returns rows that contain every word of the query, case-insensitive.
2882
3015
  * @param options.topics - Filter to items tagged with any of these topics.
2883
3016
  * @returns A page of custom context items.
2884
3017
  * @example
@@ -2941,12 +3074,16 @@ var CustomContextItemsResource = class {
2941
3074
  * @example
2942
3075
  * ```ts
2943
3076
  * const client = new Modus()
3077
+ * // Create the source and collection first, or use batchCreate as shown below.
2944
3078
  * const created = await client.context.customItems.create({
2945
3079
  * kind: 'entity',
2946
- * sourceId: 'my-source',
3080
+ * sourceId: 'billing-db',
3081
+ * collectionId: 'contracts',
3082
+ * externalId: 'contract-123',
2947
3083
  * name: 'Q3 churn notes',
2948
3084
  * content: { summary: 'Key findings…' },
2949
3085
  * })
3086
+ * console.log(created.uid, created.dataPath)
2950
3087
  * ```
2951
3088
  */
2952
3089
  async create(input) {
@@ -2966,9 +3103,22 @@ var CustomContextItemsResource = class {
2966
3103
  * ```ts
2967
3104
  * const client = new Modus()
2968
3105
  * const created = await client.context.customItems.batchCreate([
2969
- * { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
2970
- * { kind: 'field', sourceId: 'src', fieldName: 'amount', dataType: 'number' },
3106
+ * { kind: 'source', sourceId: 'billing-db', name: 'Billing database' },
3107
+ * {
3108
+ * kind: 'collection',
3109
+ * sourceId: 'billing-db',
3110
+ * collectionId: 'contracts',
3111
+ * name: 'Contracts',
3112
+ * },
3113
+ * {
3114
+ * kind: 'entity',
3115
+ * sourceId: 'billing-db',
3116
+ * collectionId: 'contracts',
3117
+ * externalId: 'contract-123',
3118
+ * name: 'Acme renewal',
3119
+ * },
2971
3120
  * ])
3121
+ * console.log(created.map((item) => item.dataPath))
2972
3122
  * ```
2973
3123
  */
2974
3124
  async batchCreate(inputs) {
@@ -3051,9 +3201,18 @@ var CustomContextItemsResource = class {
3051
3201
  };
3052
3202
 
3053
3203
  // src/resources/context/items.ts
3054
- function contextListParams(pageSize, pageToken, contextType) {
3204
+ function contextListParams(pageSize, pageToken, filters = {}) {
3055
3205
  const extra = {};
3056
- if (contextType !== void 0) extra.contextTypes = [contextType];
3206
+ if (filters.contextType !== void 0) extra.contextTypes = [filters.contextType];
3207
+ if (filters.parentUids !== void 0) {
3208
+ extra.parentUids = filters.parentUids.length === 0 ? "" : [...filters.parentUids];
3209
+ }
3210
+ if (filters.ancestorUids !== void 0) {
3211
+ extra.ancestorUids = filters.ancestorUids.length === 0 ? "" : [...filters.ancestorUids];
3212
+ }
3213
+ if (filters.connectionIds !== void 0) {
3214
+ extra.connectionIds = filters.connectionIds.length === 0 ? "" : [...filters.connectionIds];
3215
+ }
3057
3216
  return aipListParams(pageSize, pageToken, extra);
3058
3217
  }
3059
3218
  function parseContextItem2(raw) {
@@ -3079,6 +3238,17 @@ var ContextItemsResource = class {
3079
3238
  * @param options.pageSize - Maximum items per page (default 25).
3080
3239
  * @param options.pageToken - Opaque token from a previous page.
3081
3240
  * @param options.contextType - Filter to a single context type (e.g. `"note"`).
3241
+ * @param options.parentUids - Exact ordered native ancestry chain for direct
3242
+ * children. Omit to leave parent unrestricted; pass `[]` for the known-empty
3243
+ * root. Native UIDs are exact tokens (including whitespace); do not use the
3244
+ * hashed context-item `uid`. For a folder's children, send that item's
3245
+ * `ancestry` UIDs plus its last `dataPath` token.
3246
+ * @param options.ancestorUids - Ordered UID ancestry prefix for strict
3247
+ * descendants. Omit to leave unrestricted; pass `[]` for every item with
3248
+ * non-null ancestry.
3249
+ * @param options.connectionIds - Restrict to these connection ids. Omit to
3250
+ * leave unfiltered; pass `[]` to match none. The Files root is
3251
+ * `connectionIds: ['files']` with `parentUids: []`.
3082
3252
  * @returns A page of context items — use `.autoPagingIter()` for all pages.
3083
3253
  *
3084
3254
  * @example
@@ -3088,23 +3258,47 @@ var ContextItemsResource = class {
3088
3258
  * console.log(item.description ?? item.uid, item.uid)
3089
3259
  * }
3090
3260
  * ```
3261
+ *
3262
+ * @example
3263
+ * ```ts
3264
+ * const rootFolders = await client.context.items.list({
3265
+ * connectionIds: ['files'],
3266
+ * contextType: 'file_folder_metadata',
3267
+ * parentUids: [],
3268
+ * })
3269
+ * const folder = rootFolders.items[0]
3270
+ * const nativeUid = folder?.dataPath?.at(-1)
3271
+ * // Known ancestry only — never treat null/omitted ancestry as a root chain.
3272
+ * if (folder?.ancestry != null && nativeUid !== undefined) {
3273
+ * const filesInFolder = await client.context.items.list({
3274
+ * connectionIds: ['files'],
3275
+ * contextType: 'file_upload',
3276
+ * parentUids: [...folder.ancestry.map((a) => a.uid), nativeUid],
3277
+ * })
3278
+ * }
3279
+ * ```
3091
3280
  */
3092
3281
  list(options = {}) {
3093
3282
  const pageSize = options.pageSize ?? 25;
3094
3283
  validatePageSize(pageSize);
3095
- return this.listPage(pageSize, options.pageToken, options.contextType);
3284
+ return this.listPage(pageSize, options.pageToken, {
3285
+ contextType: options.contextType,
3286
+ parentUids: options.parentUids,
3287
+ ancestorUids: options.ancestorUids,
3288
+ connectionIds: options.connectionIds
3289
+ });
3096
3290
  }
3097
- async listPage(pageSize, pageToken, contextType) {
3291
+ async listPage(pageSize, pageToken, filters) {
3098
3292
  const data = asRecord(
3099
3293
  await invokeWithRetry(this.config, this.http, "ContextItemsController_list", {
3100
- query: contextListParams(pageSize, pageToken, contextType)
3294
+ query: contextListParams(pageSize, pageToken, filters)
3101
3295
  })
3102
3296
  );
3103
3297
  return buildAipPage(
3104
3298
  data,
3105
3299
  "contextItems",
3106
3300
  parseContextItem2,
3107
- (token) => this.listPage(pageSize, token, contextType)
3301
+ (token) => this.listPage(pageSize, token, filters)
3108
3302
  );
3109
3303
  }
3110
3304
  /**
@@ -3278,6 +3472,31 @@ var IngestedDataResource = class {
3278
3472
  }
3279
3473
  };
3280
3474
 
3475
+ // src/_generated/resources/consumption/modus/conversations.ts
3476
+ var ModusConversationsResourceBase = class {
3477
+ /** @internal */
3478
+ constructor(http, config) {
3479
+ this.http = http;
3480
+ this.config = config;
3481
+ }
3482
+ /**
3483
+ * Get a Modus conversation.
3484
+ *
3485
+ * Returns the full message history for a conversation thread.
3486
+ *
3487
+ * **Requires:** `scopes:read`
3488
+ *
3489
+ * @param threadId - Thread id from a conversation list or chat response.
3490
+ */
3491
+ async get(threadId) {
3492
+ validateId(threadId, "thread_id");
3493
+ const data = await invokeWithRetry(this.config, this.http, "ModusConversationsController_get", {
3494
+ pathParams: { threadId }
3495
+ });
3496
+ return data;
3497
+ }
3498
+ };
3499
+
3281
3500
  // src/resources/modus/conversations.ts
3282
3501
  var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
3283
3502
  function listParams(pageSize, pageToken, kind, source, sourceRef) {
@@ -3295,13 +3514,9 @@ function listParams(pageSize, pageToken, kind, source, sourceRef) {
3295
3514
  function parseListItem(raw) {
3296
3515
  return raw;
3297
3516
  }
3298
- function parseConversation(raw) {
3299
- return raw;
3300
- }
3301
- var ModusConversationsResource = class {
3517
+ var ModusConversationsResource = class extends ModusConversationsResourceBase {
3302
3518
  constructor(http, config) {
3303
- this.http = http;
3304
- this.config = config;
3519
+ super(http, config);
3305
3520
  }
3306
3521
  /**
3307
3522
  * List conversations.
@@ -3337,19 +3552,6 @@ var ModusConversationsResource = class {
3337
3552
  (token) => this.listPage(pageSize, token, kind, source, sourceRef)
3338
3553
  );
3339
3554
  }
3340
- /**
3341
- * Retrieve a conversation thread with full message history.
3342
- *
3343
- * @param threadId - Conversation thread id.
3344
- * @returns Conversation with messages.
3345
- */
3346
- async get(threadId) {
3347
- validateId(threadId, "thread_id");
3348
- const data = await invokeWithRetry(this.config, this.http, "ModusConversationsController_get", {
3349
- pathParams: { threadId }
3350
- });
3351
- return parseConversation(data);
3352
- }
3353
3555
  };
3354
3556
 
3355
3557
  // src/resources/modus/modus.ts
@@ -3427,31 +3629,111 @@ var ModusResource = class {
3427
3629
  }
3428
3630
  };
3429
3631
 
3430
- // src/resources/scopes/conversations.ts
3431
- function parseListItem2(raw) {
3432
- return raw;
3433
- }
3434
- function parseConversation2(raw) {
3435
- return raw;
3436
- }
3437
- var ScopeConversationsResource = class {
3632
+ // src/_generated/resources/consumption/scopes.ts
3633
+ var ScopesResourceBase = class {
3634
+ /** @internal */
3635
+ constructor(http, config) {
3636
+ this.http = http;
3637
+ this.config = config;
3638
+ }
3639
+ /**
3640
+ * List scopes.
3641
+ *
3642
+ * Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see
3643
+ * are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
3644
+ *
3645
+ * **Requires:** `scopes:read`
3646
+ *
3647
+ * @param options.pageSize - Items per page. Defaults to 25.
3648
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
3649
+ * for the first page.
3650
+ * @param options.search - Case-insensitive substring filter on scope name.
3651
+ * @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
3652
+ * snapshot.
3653
+ * @param options.managerId - Return only scopes supervised by this manager scope id.
3654
+ * @returns A page of scopes.
3655
+ *
3656
+ * @example
3657
+ * ```ts
3658
+ * for await (const scope of (await client.scopes.list()).autoPagingIter()) {
3659
+ * console.log(scope.id, scope.name, scope.status)
3660
+ * }
3661
+ * ```
3662
+ */
3663
+ list(options = {}) {
3664
+ const pageSize = options.pageSize ?? 25;
3665
+ validatePageSize(pageSize);
3666
+ return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId);
3667
+ }
3668
+ async listPage(pageSize, pageToken, search, view, managerId) {
3669
+ const extra = {};
3670
+ if (search !== void 0) extra.search = search;
3671
+ if (view !== void 0) extra.view = view;
3672
+ if (managerId !== void 0) extra.managerId = managerId;
3673
+ const data = asRecord(
3674
+ await invokeWithRetry(this.config, this.http, "ScopesController_list", {
3675
+ query: aipListParams(pageSize, pageToken, extra)
3676
+ })
3677
+ );
3678
+ return buildAipPage(
3679
+ data,
3680
+ "scopes",
3681
+ (raw) => raw,
3682
+ (token) => this.listPage(pageSize, token, search, view, managerId)
3683
+ );
3684
+ }
3685
+ /**
3686
+ * Get a scope.
3687
+ *
3688
+ * Returns a scope. `view=active` (default) returns the deployed version; `view=draft` returns the
3689
+ * latest unpublished edits. Returns 404 if you cannot access the scope.
3690
+ *
3691
+ * **Requires:** `scopes:read`
3692
+ *
3693
+ * @param scopeId - Numeric scope id.
3694
+ * @param options.view - Which variation snapshot to read. Defaults to `active`.
3695
+ *
3696
+ * @example
3697
+ * ```ts
3698
+ * const scope = await client.scopes.get('revenue-analysis')
3699
+ * console.log(scope.name, scope.status)
3700
+ * ```
3701
+ */
3702
+ async get(scopeId, options = {}) {
3703
+ validateId(scopeId, "scope_id");
3704
+ const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
3705
+ pathParams: { id: scopeId },
3706
+ query: { view: options.view }
3707
+ });
3708
+ return data;
3709
+ }
3710
+ };
3711
+
3712
+ // src/_generated/resources/consumption/scopes/conversations.ts
3713
+ var ScopesConversationsResourceBase = class {
3714
+ /** @internal */
3438
3715
  constructor(http, config, scopeId) {
3439
3716
  this.http = http;
3440
3717
  this.config = config;
3441
3718
  this.scopeId = scopeId;
3442
3719
  }
3443
3720
  /**
3444
- * List conversation threads for this scope, newest first.
3721
+ * List scope conversations.
3445
3722
  *
3446
- * @param options.pageSize - Items per page (default 25).
3447
- * @param options.pageToken - Opaque token from a previous page.
3448
- * @param options.source - Restrict to conversations started from this UI surface
3449
- * (e.g. `"context_chat"`, `"dashboard_copilot"`, `"slack"`).
3723
+ * Returns a page of conversation summaries (most recently updated first) for a scope. Use `id=0`
3724
+ * for your cross-scope recent history. Pass `nextPageToken` as `pageToken` to fetch the next
3725
+ * page.
3726
+ *
3727
+ * **Requires:** `scopes:read`
3728
+ *
3729
+ * @param options.pageSize - Items per page. Defaults to 25.
3730
+ * @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
3731
+ * for the first page.
3732
+ * @param options.source - Return only conversations started from this UI surface.
3450
3733
  * @param options.sourceRef - Narrow `source` to one instance of that surface — for
3451
- * `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
3452
- * `UnprocessableError` (422) if sent on its own. Conversations recorded before
3453
- * this filter shipped carry no instance key and never match it.
3454
- * @returns Page of conversation list items (`threadId`, `firstMessage`, `messageCount`).
3734
+ * `dashboard_copilot` or `dashboard_assistant`, a dashboard id (both scope conversation history
3735
+ * per dashboard). Requires `source`; sent alone it is a 422.
3736
+ * @returns A page of conversations.
3455
3737
  *
3456
3738
  * @example
3457
3739
  * ```ts
@@ -3481,10 +3763,17 @@ var ScopeConversationsResource = class {
3481
3763
  return buildAipPage(
3482
3764
  data,
3483
3765
  "conversations",
3484
- parseListItem2,
3766
+ (raw) => raw,
3485
3767
  (token) => this.listPage(pageSize, token, source, sourceRef)
3486
3768
  );
3487
3769
  }
3770
+ };
3771
+
3772
+ // src/resources/scopes/conversations.ts
3773
+ function parseConversation(raw) {
3774
+ return raw;
3775
+ }
3776
+ var ScopeConversationsResource = class extends ScopesConversationsResourceBase {
3488
3777
  /**
3489
3778
  * Retrieve a thread with full message history.
3490
3779
  *
@@ -3514,27 +3803,12 @@ var ScopeConversationsResource = class {
3514
3803
  beforeMessageIndex: options.beforeMessageIndex
3515
3804
  }
3516
3805
  });
3517
- return parseConversation2(data);
3806
+ return parseConversation(data);
3518
3807
  }
3519
3808
  };
3520
3809
 
3521
3810
  // src/resources/scopes.ts
3522
- function scopesListParams(pageSize, pageToken, search, view, managerId) {
3523
- const extra = {};
3524
- if (search !== void 0) extra.search = search;
3525
- if (view !== void 0) extra.view = view;
3526
- if (managerId !== void 0) extra.managerId = managerId;
3527
- return aipListParams(pageSize, pageToken, extra);
3528
- }
3529
- function parseScope(raw) {
3530
- return raw;
3531
- }
3532
- var ScopesResource = class {
3533
- /** @internal */
3534
- constructor(http, config) {
3535
- this.http = http;
3536
- this.config = config;
3537
- }
3811
+ var ScopesResource = class extends ScopesResourceBase {
3538
3812
  /**
3539
3813
  * Return the conversations sub-resource scoped to `scopeId`.
3540
3814
  *
@@ -3553,77 +3827,16 @@ var ScopesResource = class {
3553
3827
  conversations(scopeId) {
3554
3828
  return new ScopeConversationsResource(this.http, this.config, scopeId);
3555
3829
  }
3556
- /**
3557
- * List scopes in the organisation.
3558
- *
3559
- * @param options.pageSize - Items per page (default 25).
3560
- * @param options.pageToken - Opaque token from a previous page.
3561
- * @param options.search - Case-insensitive substring filter on the scope name.
3562
- * @param options.view - `"active"` (deployed) or `"draft"`.
3563
- * @param options.managerId - Only scopes supervised by this manager scope id.
3564
- * @returns Page of scopes — use `.autoPagingIter()` for all pages.
3565
- *
3566
- * @example
3567
- * ```ts
3568
- * for await (const scope of (await client.scopes.list()).autoPagingIter()) {
3569
- * console.log(scope.id, scope.name, scope.status)
3570
- * }
3571
- * ```
3572
- */
3573
- list(options = {}) {
3574
- const pageSize = options.pageSize ?? 25;
3575
- validatePageSize(pageSize);
3576
- return this.listPage(
3577
- pageSize,
3578
- options.pageToken,
3579
- options.search,
3580
- options.view,
3581
- options.managerId
3582
- );
3583
- }
3584
- async listPage(pageSize, pageToken, search, view, managerId) {
3585
- const data = asRecord(
3586
- await invokeWithRetry(this.config, this.http, "ScopesController_list", {
3587
- query: scopesListParams(pageSize, pageToken, search, view, managerId)
3588
- })
3589
- );
3590
- return buildAipPage(
3591
- data,
3592
- "scopes",
3593
- parseScope,
3594
- (token) => this.listPage(pageSize, token, search, view, managerId)
3595
- );
3596
- }
3597
- /**
3598
- * Retrieve a scope by ID or slug.
3599
- *
3600
- * @param scopeId - Scope numeric id or slug.
3601
- * @param options.view - `"active"` (deployed) or `"draft"`.
3602
- * @throws {NotFoundError} When no scope matches the id or slug.
3603
- * @returns Scope (`id`, `name`, `status`, …).
3604
- *
3605
- * @example
3606
- * ```ts
3607
- * const scope = await client.scopes.get('revenue-analysis')
3608
- * console.log(scope.name, scope.status)
3609
- * ```
3610
- */
3611
- async get(scopeId, options = {}) {
3612
- validateId(scopeId, "scope_id");
3613
- const query = options.view !== void 0 ? { view: options.view } : void 0;
3614
- const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
3615
- pathParams: { id: scopeId },
3616
- query
3617
- });
3618
- return parseScope(data);
3619
- }
3620
3830
  /**
3621
3831
  * Compose context this scope would use for an intent, without running chat.
3622
3832
  *
3833
+ * Large bodies are bounded inline previews. This REST method does not expose file references
3834
+ * or a full-content fetch operation.
3835
+ *
3623
3836
  * @param scopeId - Scope numeric id or slug.
3624
3837
  * @param message - Natural-language intent used to select context.
3625
3838
  * @param options.limit - Maximum context items to return. Omit to return all selected items.
3626
- * @returns Composition metadata. Use `chat` when you need an assistant reply.
3839
+ * @returns Composed context text plus selection counts, item UIDs, and correlation session id.
3627
3840
  *
3628
3841
  * @example
3629
3842
  * ```ts