@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/CHANGELOG.md +26 -0
- package/dist/{chunk-GFS7CNON.js → chunk-SP4UYRYG.js} +58 -24
- package/dist/chunk-SP4UYRYG.js.map +1 -0
- package/dist/{conversations-COA6NW8I.d.cts → conversations-D7ffhHIh.d.cts} +380 -50
- package/dist/{conversations-COA6NW8I.d.ts → conversations-D7ffhHIh.d.ts} +380 -50
- package/dist/index.cjs +297 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +182 -100
- package/dist/index.d.ts +182 -100
- package/dist/index.js +212 -150
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +895 -624
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +644 -382
- package/dist/management/index.d.ts +644 -382
- package/dist/management/index.js +879 -642
- package/dist/management/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-GFS7CNON.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
validateChatModel,
|
|
30
30
|
validateId,
|
|
31
31
|
validatePageSize
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-SP4UYRYG.js";
|
|
33
33
|
|
|
34
34
|
// src/_agent_run_request.ts
|
|
35
35
|
import { randomUUID } from "crypto";
|
|
@@ -309,6 +309,64 @@ function conversationSkillId(item) {
|
|
|
309
309
|
return item.scopeId;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
// src/_generated/resources/consumption/workflows.ts
|
|
313
|
+
var WorkflowsResourceBase = class {
|
|
314
|
+
/** @internal */
|
|
315
|
+
constructor(http, config) {
|
|
316
|
+
this.http = http;
|
|
317
|
+
this.config = config;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* List workflows.
|
|
321
|
+
*
|
|
322
|
+
* Returns a paginated page of workflows the caller can at least `use`. Workflows the caller
|
|
323
|
+
* cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
|
|
324
|
+
*
|
|
325
|
+
* **Requires:** `workflows:read`
|
|
326
|
+
*
|
|
327
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
328
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
329
|
+
* for the first page.
|
|
330
|
+
* @param options.search - Case-insensitive substring filter on workflow name.
|
|
331
|
+
* @param options.type - Filter by workflow type.
|
|
332
|
+
* @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
|
|
333
|
+
* snapshot.
|
|
334
|
+
* @param options.includeVariation - Include the requested variation payload (`trigger`,
|
|
335
|
+
* `workflowStructure`, `agentSelection`) on list rows.
|
|
336
|
+
* @returns A page of workflows.
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```ts
|
|
340
|
+
* for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
341
|
+
* console.log(wf.id, wf.name, wf.status)
|
|
342
|
+
* }
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
list(options = {}) {
|
|
346
|
+
const pageSize = options.pageSize ?? 25;
|
|
347
|
+
validatePageSize(pageSize);
|
|
348
|
+
return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation);
|
|
349
|
+
}
|
|
350
|
+
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
351
|
+
const extra = {};
|
|
352
|
+
if (search !== void 0) extra.search = search;
|
|
353
|
+
if (type !== void 0) extra.type = type;
|
|
354
|
+
if (view !== void 0) extra.view = view;
|
|
355
|
+
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
356
|
+
const data = asRecord(
|
|
357
|
+
await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
|
|
358
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
359
|
+
})
|
|
360
|
+
);
|
|
361
|
+
return buildAipPage(
|
|
362
|
+
data,
|
|
363
|
+
"workflows",
|
|
364
|
+
(raw) => raw,
|
|
365
|
+
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
|
|
312
370
|
// src/resources/workflows/runs.ts
|
|
313
371
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
314
372
|
var RUNS_MAX_PAGE_SIZE = 100;
|
|
@@ -734,75 +792,16 @@ var AgentWorkflowActionsResource = class {
|
|
|
734
792
|
};
|
|
735
793
|
|
|
736
794
|
// src/resources/workflows.ts
|
|
737
|
-
function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
|
|
738
|
-
const extra = {};
|
|
739
|
-
if (search !== void 0) extra.search = search;
|
|
740
|
-
if (type !== void 0) extra.type = type;
|
|
741
|
-
if (view !== void 0) extra.view = view;
|
|
742
|
-
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
743
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
744
|
-
}
|
|
745
795
|
function parseWorkflow(raw) {
|
|
746
796
|
return raw;
|
|
747
797
|
}
|
|
748
|
-
var WorkflowsResource = class {
|
|
798
|
+
var WorkflowsResource = class extends WorkflowsResourceBase {
|
|
749
799
|
/** @internal */
|
|
750
800
|
constructor(http, config) {
|
|
751
|
-
|
|
752
|
-
this.config = config;
|
|
801
|
+
super(http, config);
|
|
753
802
|
this.runs = new WorkflowRunsResource(http, config);
|
|
754
803
|
this.workflowActions = new AgentWorkflowActionsResource(http, config);
|
|
755
804
|
}
|
|
756
|
-
/**
|
|
757
|
-
* List workflows in the organisation.
|
|
758
|
-
*
|
|
759
|
-
* @param options.pageSize - Maximum items per page (default 25).
|
|
760
|
-
* @param options.pageToken - Opaque token from a previous page.
|
|
761
|
-
* @param options.search - Case-insensitive substring filter on the workflow name.
|
|
762
|
-
* @param options.type - Workflow kind: `"task"` or `"workflow"`.
|
|
763
|
-
* @param options.view - Which saved version to return (`active` or `draft`).
|
|
764
|
-
* @param options.includeVariation - Include variation metadata when supported.
|
|
765
|
-
* @returns A page of workflows — use `.autoPagingIter()` for all pages.
|
|
766
|
-
*
|
|
767
|
-
* @example
|
|
768
|
-
* ```ts
|
|
769
|
-
* for await (const wf of (await client.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
770
|
-
* console.log(wf.id, wf.name, wf.status)
|
|
771
|
-
* }
|
|
772
|
-
* ```
|
|
773
|
-
*/
|
|
774
|
-
list(options = {}) {
|
|
775
|
-
const pageSize = options.pageSize ?? 25;
|
|
776
|
-
validatePageSize(pageSize);
|
|
777
|
-
return this.listPage(
|
|
778
|
-
pageSize,
|
|
779
|
-
options.pageToken,
|
|
780
|
-
options.search,
|
|
781
|
-
options.type,
|
|
782
|
-
options.view,
|
|
783
|
-
options.includeVariation
|
|
784
|
-
);
|
|
785
|
-
}
|
|
786
|
-
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
787
|
-
const data = asRecord(
|
|
788
|
-
await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
|
|
789
|
-
query: workflowsListParams(
|
|
790
|
-
pageSize,
|
|
791
|
-
pageToken,
|
|
792
|
-
search,
|
|
793
|
-
type,
|
|
794
|
-
view,
|
|
795
|
-
includeVariation
|
|
796
|
-
)
|
|
797
|
-
})
|
|
798
|
-
);
|
|
799
|
-
return buildAipPage(
|
|
800
|
-
data,
|
|
801
|
-
"workflows",
|
|
802
|
-
parseWorkflow,
|
|
803
|
-
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
804
|
-
);
|
|
805
|
-
}
|
|
806
805
|
/**
|
|
807
806
|
* Retrieve a workflow by ID or slug.
|
|
808
807
|
*
|
|
@@ -833,27 +832,26 @@ var WorkflowsResource = class {
|
|
|
833
832
|
}
|
|
834
833
|
};
|
|
835
834
|
|
|
836
|
-
// src/resources/connections.ts
|
|
837
|
-
|
|
838
|
-
const extra = {};
|
|
839
|
-
if (type !== void 0) extra.type = type;
|
|
840
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
841
|
-
}
|
|
842
|
-
function parseConnection(raw) {
|
|
843
|
-
return raw;
|
|
844
|
-
}
|
|
845
|
-
var ConnectionsResource = class {
|
|
835
|
+
// src/_generated/resources/consumption/connections.ts
|
|
836
|
+
var ConnectionsResourceBase = class {
|
|
846
837
|
/** @internal */
|
|
847
838
|
constructor(http, config) {
|
|
848
839
|
this.http = http;
|
|
849
840
|
this.config = config;
|
|
850
841
|
}
|
|
851
842
|
/**
|
|
852
|
-
* List
|
|
843
|
+
* List connections.
|
|
853
844
|
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
845
|
+
* Returns a paginated page of warehouse and SaaS integration connections the caller can `use`.
|
|
846
|
+
* Connections the caller cannot access are filtered out. Use the returned `id` when creating
|
|
847
|
+
* saved-query context items. Pagination uses an opaque token returned in `nextPageToken`.
|
|
848
|
+
*
|
|
849
|
+
* **Requires:** `context:read`
|
|
850
|
+
*
|
|
851
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
852
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
853
|
+
* for the first page.
|
|
854
|
+
* @param options.type - Filter by effective integration category (case-sensitive exact match).
|
|
857
855
|
* @returns A page of connections.
|
|
858
856
|
*/
|
|
859
857
|
list(options = {}) {
|
|
@@ -862,18 +860,24 @@ var ConnectionsResource = class {
|
|
|
862
860
|
return this.listPage(pageSize, options.pageToken, options.type);
|
|
863
861
|
}
|
|
864
862
|
async listPage(pageSize, pageToken, type) {
|
|
863
|
+
const extra = {};
|
|
864
|
+
if (type !== void 0) extra.type = type;
|
|
865
865
|
const data = asRecord(
|
|
866
866
|
await invokeWithRetry(this.config, this.http, "ConnectionsController_list", {
|
|
867
|
-
query:
|
|
867
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
868
868
|
})
|
|
869
869
|
);
|
|
870
870
|
return buildAipPage(
|
|
871
871
|
data,
|
|
872
872
|
"connections",
|
|
873
|
-
|
|
873
|
+
(raw) => raw,
|
|
874
874
|
(token) => this.listPage(pageSize, token, type)
|
|
875
875
|
);
|
|
876
876
|
}
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
// src/resources/connections.ts
|
|
880
|
+
var ConnectionsResource = class extends ConnectionsResourceBase {
|
|
877
881
|
/**
|
|
878
882
|
* Find the first connection whose name matches (case-insensitive).
|
|
879
883
|
*
|
|
@@ -898,6 +902,52 @@ var ConnectionsResource = class {
|
|
|
898
902
|
} while (token !== void 0);
|
|
899
903
|
return void 0;
|
|
900
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* List the selectable units on a connection (a repository, a schema, a project).
|
|
907
|
+
*
|
|
908
|
+
* @param connectionId - Connection id.
|
|
909
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
910
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
911
|
+
* @returns A page of selectable units — use {@link iterSelections} or `.autoPagingIter()` for every page.
|
|
912
|
+
* @example
|
|
913
|
+
* for await (const unit of client.connections.iterSelections('7a3f9d2c-1111-4000-a000-000000000abc')) {
|
|
914
|
+
* console.log(unit.objectType, unit.path)
|
|
915
|
+
* }
|
|
916
|
+
*/
|
|
917
|
+
listSelections(connectionId, options = {}) {
|
|
918
|
+
validateId(connectionId, "connection_id");
|
|
919
|
+
const pageSize = options.pageSize ?? 25;
|
|
920
|
+
validatePageSize(pageSize);
|
|
921
|
+
return this.listSelectionsPage(connectionId, pageSize, options.pageToken);
|
|
922
|
+
}
|
|
923
|
+
async listSelectionsPage(connectionId, pageSize, pageToken) {
|
|
924
|
+
const data = asRecord(
|
|
925
|
+
await invokeWithRetry(this.config, this.http, "ConnectionsController_listSelections", {
|
|
926
|
+
pathParams: { connectionId },
|
|
927
|
+
query: aipListParams(pageSize, pageToken)
|
|
928
|
+
})
|
|
929
|
+
);
|
|
930
|
+
return buildAipPage(
|
|
931
|
+
data,
|
|
932
|
+
"selections",
|
|
933
|
+
(raw) => raw,
|
|
934
|
+
(token) => this.listSelectionsPage(connectionId, pageSize, token)
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Yield every selectable unit on a connection, following pages.
|
|
939
|
+
*
|
|
940
|
+
* @param connectionId - Connection id.
|
|
941
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
942
|
+
* @example
|
|
943
|
+
* for await (const unit of client.connections.iterSelections('7a3f9d2c-1111-4000-a000-000000000abc')) {
|
|
944
|
+
* console.log(unit.objectType, unit.displayName)
|
|
945
|
+
* }
|
|
946
|
+
*/
|
|
947
|
+
async *iterSelections(connectionId, options = {}) {
|
|
948
|
+
const page = await this.listSelections(connectionId, options);
|
|
949
|
+
yield* page.autoPagingIter();
|
|
950
|
+
}
|
|
901
951
|
};
|
|
902
952
|
|
|
903
953
|
// src/resources/context/items.ts
|
|
@@ -1172,6 +1222,31 @@ var IngestedDataResource = class {
|
|
|
1172
1222
|
}
|
|
1173
1223
|
};
|
|
1174
1224
|
|
|
1225
|
+
// src/_generated/resources/consumption/modus/conversations.ts
|
|
1226
|
+
var ModusConversationsResourceBase = class {
|
|
1227
|
+
/** @internal */
|
|
1228
|
+
constructor(http, config) {
|
|
1229
|
+
this.http = http;
|
|
1230
|
+
this.config = config;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Get a Modus conversation.
|
|
1234
|
+
*
|
|
1235
|
+
* Returns the full message history for a conversation thread.
|
|
1236
|
+
*
|
|
1237
|
+
* **Requires:** `scopes:read`
|
|
1238
|
+
*
|
|
1239
|
+
* @param threadId - Thread id from a conversation list or chat response.
|
|
1240
|
+
*/
|
|
1241
|
+
async get(threadId) {
|
|
1242
|
+
validateId(threadId, "thread_id");
|
|
1243
|
+
const data = await invokeWithRetry(this.config, this.http, "ModusConversationsController_get", {
|
|
1244
|
+
pathParams: { threadId }
|
|
1245
|
+
});
|
|
1246
|
+
return data;
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1175
1250
|
// src/resources/modus/conversations.ts
|
|
1176
1251
|
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
|
|
1177
1252
|
function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
@@ -1189,13 +1264,9 @@ function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
|
1189
1264
|
function parseListItem(raw) {
|
|
1190
1265
|
return raw;
|
|
1191
1266
|
}
|
|
1192
|
-
|
|
1193
|
-
return raw;
|
|
1194
|
-
}
|
|
1195
|
-
var ModusConversationsResource = class {
|
|
1267
|
+
var ModusConversationsResource = class extends ModusConversationsResourceBase {
|
|
1196
1268
|
constructor(http, config) {
|
|
1197
|
-
|
|
1198
|
-
this.config = config;
|
|
1269
|
+
super(http, config);
|
|
1199
1270
|
}
|
|
1200
1271
|
/**
|
|
1201
1272
|
* List conversations.
|
|
@@ -1231,19 +1302,6 @@ var ModusConversationsResource = class {
|
|
|
1231
1302
|
(token) => this.listPage(pageSize, token, kind, source, sourceRef)
|
|
1232
1303
|
);
|
|
1233
1304
|
}
|
|
1234
|
-
/**
|
|
1235
|
-
* Retrieve a conversation thread with full message history.
|
|
1236
|
-
*
|
|
1237
|
-
* @param threadId - Conversation thread id.
|
|
1238
|
-
* @returns Conversation with messages.
|
|
1239
|
-
*/
|
|
1240
|
-
async get(threadId) {
|
|
1241
|
-
validateId(threadId, "thread_id");
|
|
1242
|
-
const data = await invokeWithRetry(this.config, this.http, "ModusConversationsController_get", {
|
|
1243
|
-
pathParams: { threadId }
|
|
1244
|
-
});
|
|
1245
|
-
return parseConversation(data);
|
|
1246
|
-
}
|
|
1247
1305
|
};
|
|
1248
1306
|
|
|
1249
1307
|
// src/resources/modus/modus.ts
|
|
@@ -1321,50 +1379,29 @@ var ModusResource = class {
|
|
|
1321
1379
|
}
|
|
1322
1380
|
};
|
|
1323
1381
|
|
|
1324
|
-
// src/resources/scopes.ts
|
|
1325
|
-
|
|
1326
|
-
const extra = {};
|
|
1327
|
-
if (search !== void 0) extra.search = search;
|
|
1328
|
-
if (view !== void 0) extra.view = view;
|
|
1329
|
-
if (managerId !== void 0) extra.managerId = managerId;
|
|
1330
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
1331
|
-
}
|
|
1332
|
-
function parseScope(raw) {
|
|
1333
|
-
return raw;
|
|
1334
|
-
}
|
|
1335
|
-
var ScopesResource = class {
|
|
1382
|
+
// src/_generated/resources/consumption/scopes.ts
|
|
1383
|
+
var ScopesResourceBase = class {
|
|
1336
1384
|
/** @internal */
|
|
1337
1385
|
constructor(http, config) {
|
|
1338
1386
|
this.http = http;
|
|
1339
1387
|
this.config = config;
|
|
1340
1388
|
}
|
|
1341
1389
|
/**
|
|
1342
|
-
*
|
|
1390
|
+
* List scopes.
|
|
1343
1391
|
*
|
|
1344
|
-
*
|
|
1345
|
-
*
|
|
1392
|
+
* Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see
|
|
1393
|
+
* are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
|
|
1346
1394
|
*
|
|
1347
|
-
*
|
|
1348
|
-
* ```ts
|
|
1349
|
-
* for await (const row of (
|
|
1350
|
-
* await client.scopes.conversations(scopeId).list({ pageSize: 10 })
|
|
1351
|
-
* ).autoPagingIter()) {
|
|
1352
|
-
* console.log(row.threadId, row.firstMessage)
|
|
1353
|
-
* }
|
|
1354
|
-
* ```
|
|
1355
|
-
*/
|
|
1356
|
-
conversations(scopeId) {
|
|
1357
|
-
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
1358
|
-
}
|
|
1359
|
-
/**
|
|
1360
|
-
* List scopes in the organisation.
|
|
1395
|
+
* **Requires:** `scopes:read`
|
|
1361
1396
|
*
|
|
1362
|
-
* @param options.pageSize - Items per page
|
|
1363
|
-
* @param options.pageToken - Opaque token from a previous
|
|
1364
|
-
*
|
|
1365
|
-
* @param options.
|
|
1366
|
-
* @param options.
|
|
1367
|
-
*
|
|
1397
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
1398
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
1399
|
+
* for the first page.
|
|
1400
|
+
* @param options.search - Case-insensitive substring filter on scope name.
|
|
1401
|
+
* @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
|
|
1402
|
+
* snapshot.
|
|
1403
|
+
* @param options.managerId - Return only scopes supervised by this manager scope id.
|
|
1404
|
+
* @returns A page of scopes.
|
|
1368
1405
|
*
|
|
1369
1406
|
* @example
|
|
1370
1407
|
* ```ts
|
|
@@ -1376,34 +1413,35 @@ var ScopesResource = class {
|
|
|
1376
1413
|
list(options = {}) {
|
|
1377
1414
|
const pageSize = options.pageSize ?? 25;
|
|
1378
1415
|
validatePageSize(pageSize);
|
|
1379
|
-
return this.listPage(
|
|
1380
|
-
pageSize,
|
|
1381
|
-
options.pageToken,
|
|
1382
|
-
options.search,
|
|
1383
|
-
options.view,
|
|
1384
|
-
options.managerId
|
|
1385
|
-
);
|
|
1416
|
+
return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId);
|
|
1386
1417
|
}
|
|
1387
1418
|
async listPage(pageSize, pageToken, search, view, managerId) {
|
|
1419
|
+
const extra = {};
|
|
1420
|
+
if (search !== void 0) extra.search = search;
|
|
1421
|
+
if (view !== void 0) extra.view = view;
|
|
1422
|
+
if (managerId !== void 0) extra.managerId = managerId;
|
|
1388
1423
|
const data = asRecord(
|
|
1389
1424
|
await invokeWithRetry(this.config, this.http, "ScopesController_list", {
|
|
1390
|
-
query:
|
|
1425
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
1391
1426
|
})
|
|
1392
1427
|
);
|
|
1393
1428
|
return buildAipPage(
|
|
1394
1429
|
data,
|
|
1395
1430
|
"scopes",
|
|
1396
|
-
|
|
1431
|
+
(raw) => raw,
|
|
1397
1432
|
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
1398
1433
|
);
|
|
1399
1434
|
}
|
|
1400
1435
|
/**
|
|
1401
|
-
*
|
|
1436
|
+
* Get a scope.
|
|
1402
1437
|
*
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1438
|
+
* Returns a scope. `view=active` (default) returns the deployed version; `view=draft` returns the
|
|
1439
|
+
* latest unpublished edits. Returns 404 if you cannot access the scope.
|
|
1440
|
+
*
|
|
1441
|
+
* **Requires:** `scopes:read`
|
|
1442
|
+
*
|
|
1443
|
+
* @param scopeId - Numeric scope id.
|
|
1444
|
+
* @param options.view - Which variation snapshot to read. Defaults to `active`.
|
|
1407
1445
|
*
|
|
1408
1446
|
* @example
|
|
1409
1447
|
* ```ts
|
|
@@ -1413,20 +1451,44 @@ var ScopesResource = class {
|
|
|
1413
1451
|
*/
|
|
1414
1452
|
async get(scopeId, options = {}) {
|
|
1415
1453
|
validateId(scopeId, "scope_id");
|
|
1416
|
-
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
1417
1454
|
const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
|
|
1418
1455
|
pathParams: { id: scopeId },
|
|
1419
|
-
query
|
|
1456
|
+
query: { view: options.view }
|
|
1420
1457
|
});
|
|
1421
|
-
return
|
|
1458
|
+
return data;
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
|
|
1462
|
+
// src/resources/scopes.ts
|
|
1463
|
+
var ScopesResource = class extends ScopesResourceBase {
|
|
1464
|
+
/**
|
|
1465
|
+
* Return the conversations sub-resource scoped to `scopeId`.
|
|
1466
|
+
*
|
|
1467
|
+
* @param scopeId - Scope numeric id or slug.
|
|
1468
|
+
* @returns Conversations resource for the scope.
|
|
1469
|
+
*
|
|
1470
|
+
* @example
|
|
1471
|
+
* ```ts
|
|
1472
|
+
* for await (const row of (
|
|
1473
|
+
* await client.scopes.conversations(scopeId).list({ pageSize: 10 })
|
|
1474
|
+
* ).autoPagingIter()) {
|
|
1475
|
+
* console.log(row.threadId, row.firstMessage)
|
|
1476
|
+
* }
|
|
1477
|
+
* ```
|
|
1478
|
+
*/
|
|
1479
|
+
conversations(scopeId) {
|
|
1480
|
+
return new ScopeConversationsResource(this.http, this.config, scopeId);
|
|
1422
1481
|
}
|
|
1423
1482
|
/**
|
|
1424
1483
|
* Compose context this scope would use for an intent, without running chat.
|
|
1425
1484
|
*
|
|
1485
|
+
* Large bodies are bounded inline previews. This REST method does not expose file references
|
|
1486
|
+
* or a full-content fetch operation.
|
|
1487
|
+
*
|
|
1426
1488
|
* @param scopeId - Scope numeric id or slug.
|
|
1427
1489
|
* @param message - Natural-language intent used to select context.
|
|
1428
1490
|
* @param options.limit - Maximum context items to return. Omit to return all selected items.
|
|
1429
|
-
* @returns
|
|
1491
|
+
* @returns Composed context text plus selection counts, item UIDs, and correlation session id.
|
|
1430
1492
|
*
|
|
1431
1493
|
* @example
|
|
1432
1494
|
* ```ts
|