@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.
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",
@@ -1967,7 +1977,7 @@ function formatConfigForLog(config) {
1967
1977
  }
1968
1978
 
1969
1979
  // src/_http.ts
1970
- var USER_AGENT = `modus-typescript/${"0.8.0"} (node/${process.version}; ${process.platform})`;
1980
+ var USER_AGENT = `modus-typescript/${"0.9.0"} (node/${process.version}; ${process.platform})`;
1971
1981
  function buildUrl(baseUrl, path, params) {
1972
1982
  const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
1973
1983
  if (params) {
@@ -2328,6 +2338,64 @@ function asRecord(data) {
2328
2338
  throw new Error(`Expected object response, got ${typeof data}`);
2329
2339
  }
2330
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
+
2331
2399
  // src/resources/workflows/runs.ts
2332
2400
  var import_node_crypto2 = require("crypto");
2333
2401
  var RUNS_MAX_PAGE_SIZE = 100;
@@ -2753,75 +2821,16 @@ var AgentWorkflowActionsResource = class {
2753
2821
  };
2754
2822
 
2755
2823
  // src/resources/workflows.ts
2756
- function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
2757
- const extra = {};
2758
- if (search !== void 0) extra.search = search;
2759
- if (type !== void 0) extra.type = type;
2760
- if (view !== void 0) extra.view = view;
2761
- if (includeVariation !== void 0) extra.includeVariation = includeVariation;
2762
- return aipListParams(pageSize, pageToken, extra);
2763
- }
2764
2824
  function parseWorkflow(raw) {
2765
2825
  return raw;
2766
2826
  }
2767
- var WorkflowsResource = class {
2827
+ var WorkflowsResource = class extends WorkflowsResourceBase {
2768
2828
  /** @internal */
2769
2829
  constructor(http, config) {
2770
- this.http = http;
2771
- this.config = config;
2830
+ super(http, config);
2772
2831
  this.runs = new WorkflowRunsResource(http, config);
2773
2832
  this.workflowActions = new AgentWorkflowActionsResource(http, config);
2774
2833
  }
2775
- /**
2776
- * List workflows in the organisation.
2777
- *
2778
- * @param options.pageSize - Maximum items per page (default 25).
2779
- * @param options.pageToken - Opaque token from a previous page.
2780
- * @param options.search - Case-insensitive substring filter on the workflow name.
2781
- * @param options.type - Workflow kind: `"task"` or `"workflow"`.
2782
- * @param options.view - Which saved version to return (`active` or `draft`).
2783
- * @param options.includeVariation - Include variation metadata when supported.
2784
- * @returns A page of workflows — use `.autoPagingIter()` for all pages.
2785
- *
2786
- * @example
2787
- * ```ts
2788
- * for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
2789
- * console.log(wf.id, wf.name, wf.status)
2790
- * }
2791
- * ```
2792
- */
2793
- list(options = {}) {
2794
- const pageSize = options.pageSize ?? 25;
2795
- validatePageSize(pageSize);
2796
- return this.listPage(
2797
- pageSize,
2798
- options.pageToken,
2799
- options.search,
2800
- options.type,
2801
- options.view,
2802
- options.includeVariation
2803
- );
2804
- }
2805
- async listPage(pageSize, pageToken, search, type, view, includeVariation) {
2806
- const data = asRecord(
2807
- await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
2808
- query: workflowsListParams(
2809
- pageSize,
2810
- pageToken,
2811
- search,
2812
- type,
2813
- view,
2814
- includeVariation
2815
- )
2816
- })
2817
- );
2818
- return buildAipPage(
2819
- data,
2820
- "workflows",
2821
- parseWorkflow,
2822
- (token) => this.listPage(pageSize, token, search, type, view, includeVariation)
2823
- );
2824
- }
2825
2834
  /**
2826
2835
  * Retrieve a workflow by ID or slug.
2827
2836
  *
@@ -2852,27 +2861,26 @@ var WorkflowsResource = class {
2852
2861
  }
2853
2862
  };
2854
2863
 
2855
- // src/resources/connections.ts
2856
- function connectionsListParams(pageSize, pageToken, type) {
2857
- const extra = {};
2858
- if (type !== void 0) extra.type = type;
2859
- return aipListParams(pageSize, pageToken, extra);
2860
- }
2861
- function parseConnection(raw) {
2862
- return raw;
2863
- }
2864
- var ConnectionsResource = class {
2864
+ // src/_generated/resources/consumption/connections.ts
2865
+ var ConnectionsResourceBase = class {
2865
2866
  /** @internal */
2866
2867
  constructor(http, config) {
2867
2868
  this.http = http;
2868
2869
  this.config = config;
2869
2870
  }
2870
2871
  /**
2871
- * List integration connections.
2872
+ * List connections.
2872
2873
  *
2873
- * @param options.pageSize - Maximum items per page (default 25).
2874
- * @param options.pageToken - Opaque token from a previous page.
2875
- * @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).
2876
2884
  * @returns A page of connections.
2877
2885
  */
2878
2886
  list(options = {}) {
@@ -2881,18 +2889,24 @@ var ConnectionsResource = class {
2881
2889
  return this.listPage(pageSize, options.pageToken, options.type);
2882
2890
  }
2883
2891
  async listPage(pageSize, pageToken, type) {
2892
+ const extra = {};
2893
+ if (type !== void 0) extra.type = type;
2884
2894
  const data = asRecord(
2885
2895
  await invokeWithRetry(this.config, this.http, "ConnectionsController_list", {
2886
- query: connectionsListParams(pageSize, pageToken, type)
2896
+ query: aipListParams(pageSize, pageToken, extra)
2887
2897
  })
2888
2898
  );
2889
2899
  return buildAipPage(
2890
2900
  data,
2891
2901
  "connections",
2892
- parseConnection,
2902
+ (raw) => raw,
2893
2903
  (token) => this.listPage(pageSize, token, type)
2894
2904
  );
2895
2905
  }
2906
+ };
2907
+
2908
+ // src/resources/connections.ts
2909
+ var ConnectionsResource = class extends ConnectionsResourceBase {
2896
2910
  /**
2897
2911
  * Find the first connection whose name matches (case-insensitive).
2898
2912
  *
@@ -2917,6 +2931,52 @@ var ConnectionsResource = class {
2917
2931
  } while (token !== void 0);
2918
2932
  return void 0;
2919
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
+ }
2920
2980
  };
2921
2981
 
2922
2982
  // src/resources/context/custom-items.ts
@@ -2951,7 +3011,7 @@ var CustomContextItemsResource = class {
2951
3011
  *
2952
3012
  * @param options.pageSize - Maximum items per page (default 25).
2953
3013
  * @param options.pageToken - Opaque token from a previous page.
2954
- * @param options.searchQuery - Free-text search filter.
3014
+ * @param options.searchQuery - Word search: returns rows that contain every word of the query, case-insensitive.
2955
3015
  * @param options.topics - Filter to items tagged with any of these topics.
2956
3016
  * @returns A page of custom context items.
2957
3017
  * @example
@@ -3014,12 +3074,16 @@ var CustomContextItemsResource = class {
3014
3074
  * @example
3015
3075
  * ```ts
3016
3076
  * const client = new Modus()
3077
+ * // Create the source and collection first, or use batchCreate as shown below.
3017
3078
  * const created = await client.context.customItems.create({
3018
3079
  * kind: 'entity',
3019
- * sourceId: 'my-source',
3080
+ * sourceId: 'billing-db',
3081
+ * collectionId: 'contracts',
3082
+ * externalId: 'contract-123',
3020
3083
  * name: 'Q3 churn notes',
3021
3084
  * content: { summary: 'Key findings…' },
3022
3085
  * })
3086
+ * console.log(created.uid, created.dataPath)
3023
3087
  * ```
3024
3088
  */
3025
3089
  async create(input) {
@@ -3039,9 +3103,22 @@ var CustomContextItemsResource = class {
3039
3103
  * ```ts
3040
3104
  * const client = new Modus()
3041
3105
  * const created = await client.context.customItems.batchCreate([
3042
- * { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
3043
- * { 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
+ * },
3044
3120
  * ])
3121
+ * console.log(created.map((item) => item.dataPath))
3045
3122
  * ```
3046
3123
  */
3047
3124
  async batchCreate(inputs) {
@@ -3395,6 +3472,31 @@ var IngestedDataResource = class {
3395
3472
  }
3396
3473
  };
3397
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
+
3398
3500
  // src/resources/modus/conversations.ts
3399
3501
  var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
3400
3502
  function listParams(pageSize, pageToken, kind, source, sourceRef) {
@@ -3412,13 +3514,9 @@ function listParams(pageSize, pageToken, kind, source, sourceRef) {
3412
3514
  function parseListItem(raw) {
3413
3515
  return raw;
3414
3516
  }
3415
- function parseConversation(raw) {
3416
- return raw;
3417
- }
3418
- var ModusConversationsResource = class {
3517
+ var ModusConversationsResource = class extends ModusConversationsResourceBase {
3419
3518
  constructor(http, config) {
3420
- this.http = http;
3421
- this.config = config;
3519
+ super(http, config);
3422
3520
  }
3423
3521
  /**
3424
3522
  * List conversations.
@@ -3454,19 +3552,6 @@ var ModusConversationsResource = class {
3454
3552
  (token) => this.listPage(pageSize, token, kind, source, sourceRef)
3455
3553
  );
3456
3554
  }
3457
- /**
3458
- * Retrieve a conversation thread with full message history.
3459
- *
3460
- * @param threadId - Conversation thread id.
3461
- * @returns Conversation with messages.
3462
- */
3463
- async get(threadId) {
3464
- validateId(threadId, "thread_id");
3465
- const data = await invokeWithRetry(this.config, this.http, "ModusConversationsController_get", {
3466
- pathParams: { threadId }
3467
- });
3468
- return parseConversation(data);
3469
- }
3470
3555
  };
3471
3556
 
3472
3557
  // src/resources/modus/modus.ts
@@ -3544,31 +3629,111 @@ var ModusResource = class {
3544
3629
  }
3545
3630
  };
3546
3631
 
3547
- // src/resources/scopes/conversations.ts
3548
- function parseListItem2(raw) {
3549
- return raw;
3550
- }
3551
- function parseConversation2(raw) {
3552
- return raw;
3553
- }
3554
- 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 */
3555
3715
  constructor(http, config, scopeId) {
3556
3716
  this.http = http;
3557
3717
  this.config = config;
3558
3718
  this.scopeId = scopeId;
3559
3719
  }
3560
3720
  /**
3561
- * List conversation threads for this scope, newest first.
3721
+ * List scope conversations.
3562
3722
  *
3563
- * @param options.pageSize - Items per page (default 25).
3564
- * @param options.pageToken - Opaque token from a previous page.
3565
- * @param options.source - Restrict to conversations started from this UI surface
3566
- * (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.
3567
3733
  * @param options.sourceRef - Narrow `source` to one instance of that surface — for
3568
- * `"dashboard_copilot"`, a dashboard id. Requires `source`; the API throws an
3569
- * `UnprocessableError` (422) if sent on its own. Conversations recorded before
3570
- * this filter shipped carry no instance key and never match it.
3571
- * @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.
3572
3737
  *
3573
3738
  * @example
3574
3739
  * ```ts
@@ -3598,10 +3763,17 @@ var ScopeConversationsResource = class {
3598
3763
  return buildAipPage(
3599
3764
  data,
3600
3765
  "conversations",
3601
- parseListItem2,
3766
+ (raw) => raw,
3602
3767
  (token) => this.listPage(pageSize, token, source, sourceRef)
3603
3768
  );
3604
3769
  }
3770
+ };
3771
+
3772
+ // src/resources/scopes/conversations.ts
3773
+ function parseConversation(raw) {
3774
+ return raw;
3775
+ }
3776
+ var ScopeConversationsResource = class extends ScopesConversationsResourceBase {
3605
3777
  /**
3606
3778
  * Retrieve a thread with full message history.
3607
3779
  *
@@ -3631,27 +3803,12 @@ var ScopeConversationsResource = class {
3631
3803
  beforeMessageIndex: options.beforeMessageIndex
3632
3804
  }
3633
3805
  });
3634
- return parseConversation2(data);
3806
+ return parseConversation(data);
3635
3807
  }
3636
3808
  };
3637
3809
 
3638
3810
  // src/resources/scopes.ts
3639
- function scopesListParams(pageSize, pageToken, search, view, managerId) {
3640
- const extra = {};
3641
- if (search !== void 0) extra.search = search;
3642
- if (view !== void 0) extra.view = view;
3643
- if (managerId !== void 0) extra.managerId = managerId;
3644
- return aipListParams(pageSize, pageToken, extra);
3645
- }
3646
- function parseScope(raw) {
3647
- return raw;
3648
- }
3649
- var ScopesResource = class {
3650
- /** @internal */
3651
- constructor(http, config) {
3652
- this.http = http;
3653
- this.config = config;
3654
- }
3811
+ var ScopesResource = class extends ScopesResourceBase {
3655
3812
  /**
3656
3813
  * Return the conversations sub-resource scoped to `scopeId`.
3657
3814
  *
@@ -3670,77 +3827,16 @@ var ScopesResource = class {
3670
3827
  conversations(scopeId) {
3671
3828
  return new ScopeConversationsResource(this.http, this.config, scopeId);
3672
3829
  }
3673
- /**
3674
- * List scopes in the organisation.
3675
- *
3676
- * @param options.pageSize - Items per page (default 25).
3677
- * @param options.pageToken - Opaque token from a previous page.
3678
- * @param options.search - Case-insensitive substring filter on the scope name.
3679
- * @param options.view - `"active"` (deployed) or `"draft"`.
3680
- * @param options.managerId - Only scopes supervised by this manager scope id.
3681
- * @returns Page of scopes — use `.autoPagingIter()` for all pages.
3682
- *
3683
- * @example
3684
- * ```ts
3685
- * for await (const scope of (await client.scopes.list()).autoPagingIter()) {
3686
- * console.log(scope.id, scope.name, scope.status)
3687
- * }
3688
- * ```
3689
- */
3690
- list(options = {}) {
3691
- const pageSize = options.pageSize ?? 25;
3692
- validatePageSize(pageSize);
3693
- return this.listPage(
3694
- pageSize,
3695
- options.pageToken,
3696
- options.search,
3697
- options.view,
3698
- options.managerId
3699
- );
3700
- }
3701
- async listPage(pageSize, pageToken, search, view, managerId) {
3702
- const data = asRecord(
3703
- await invokeWithRetry(this.config, this.http, "ScopesController_list", {
3704
- query: scopesListParams(pageSize, pageToken, search, view, managerId)
3705
- })
3706
- );
3707
- return buildAipPage(
3708
- data,
3709
- "scopes",
3710
- parseScope,
3711
- (token) => this.listPage(pageSize, token, search, view, managerId)
3712
- );
3713
- }
3714
- /**
3715
- * Retrieve a scope by ID or slug.
3716
- *
3717
- * @param scopeId - Scope numeric id or slug.
3718
- * @param options.view - `"active"` (deployed) or `"draft"`.
3719
- * @throws {NotFoundError} When no scope matches the id or slug.
3720
- * @returns Scope (`id`, `name`, `status`, …).
3721
- *
3722
- * @example
3723
- * ```ts
3724
- * const scope = await client.scopes.get('revenue-analysis')
3725
- * console.log(scope.name, scope.status)
3726
- * ```
3727
- */
3728
- async get(scopeId, options = {}) {
3729
- validateId(scopeId, "scope_id");
3730
- const query = options.view !== void 0 ? { view: options.view } : void 0;
3731
- const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
3732
- pathParams: { id: scopeId },
3733
- query
3734
- });
3735
- return parseScope(data);
3736
- }
3737
3830
  /**
3738
3831
  * Compose context this scope would use for an intent, without running chat.
3739
3832
  *
3833
+ * Large bodies are bounded inline previews. This REST method does not expose file references
3834
+ * or a full-content fetch operation.
3835
+ *
3740
3836
  * @param scopeId - Scope numeric id or slug.
3741
3837
  * @param message - Natural-language intent used to select context.
3742
3838
  * @param options.limit - Maximum context items to return. Omit to return all selected items.
3743
- * @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.
3744
3840
  *
3745
3841
  * @example
3746
3842
  * ```ts