@getmodus/sdk 0.2.3 → 0.4.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 +7 -35
- package/README.md +4 -0
- package/dist/{chunk-ZFZQ2UMA.js → chunk-I56O44TR.js} +168 -37
- package/dist/chunk-I56O44TR.js.map +1 -0
- package/dist/{conversations-BP2sI3Q5.d.cts → conversations-Cq6OVlpQ.d.cts} +875 -3154
- package/dist/{conversations-BP2sI3Q5.d.ts → conversations-Cq6OVlpQ.d.ts} +875 -3154
- package/dist/index.cjs +546 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +494 -32
- package/dist/index.d.ts +494 -32
- package/dist/index.js +378 -42
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +635 -65
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +501 -43
- package/dist/management/index.d.ts +501 -43
- package/dist/management/index.js +469 -30
- package/dist/management/index.js.map +1 -1
- package/package.json +3 -1
- package/dist/chunk-ZFZQ2UMA.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,46 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
**Current npm release:** [`0.
|
|
3
|
+
**Current npm release:** [`0.4.0`](https://www.npmjs.com/package/@getmodus/sdk/v/0.4.0).
|
|
4
4
|
|
|
5
|
+
Pre-1.0 (`0.x`) releases are internal. Detailed release notes are not maintained
|
|
6
|
+
until `1.0.0` — keep `[Unreleased]` empty while the package stays on `0.x`.
|
|
5
7
|
|
|
6
|
-
## [
|
|
7
|
-
|
|
8
|
-
## [0.2.3] — 2026-07-20
|
|
9
|
-
|
|
10
|
-
## [0.2.2] — 2026-07-20
|
|
11
|
-
|
|
12
|
-
## [0.2.1] — 2026-07-20
|
|
13
|
-
|
|
14
|
-
### Changed
|
|
8
|
+
## [0.4.0] — 2026-08-01
|
|
15
9
|
|
|
16
|
-
- Public README brought to parity with the Python SDK guide (product framing, auth, Modus vs scopes, chat/stream/context, management, pagination, errors).
|
|
17
|
-
- Added `assets/modus-logo.png` / `.svg` for GitHub mirror and package docs.
|
|
18
|
-
|
|
19
|
-
## [0.2.0] — 2026-07-20
|
|
20
|
-
|
|
21
|
-
### Added
|
|
22
|
-
|
|
23
|
-
- Canonical **`client.scopes` / `client.workflows`** and **`mgmt.scopes` / `mgmt.workflows`** against `/api/v1/scopes` and `/api/v1/workflows`.
|
|
24
|
-
- **`client.suggestions`** — `list()` / `recordEvent()`.
|
|
25
|
-
- **`client.workflows.runs.active()` / `activeBySession(...)`** — active conversation runs.
|
|
26
|
-
- **`mgmt.scopes.evaluations(scopeId)`** — evaluation config, trigger, run history.
|
|
27
|
-
- Bounded conversation windows via optional `{ messageLimit, beforeMessageIndex }` on `conversations(id).get()`.
|
|
28
|
-
- MCP **`get_context_data`** batch + ACL: `{ items[], sessionId? }` → `{ results[] }` (max 20).
|
|
29
|
-
- Shipped examples under `examples/scripts/`.
|
|
30
|
-
- Full public OpenAPI operation coverage (contract-tested). Dual ESM + CJS. Zero runtime dependencies.
|
|
31
10
|
|
|
32
11
|
### Changed
|
|
33
12
|
|
|
34
|
-
-
|
|
35
|
-
- Run creation: `client.workflows.runs.createScope(scopeId, body)` (not `createSkill`).
|
|
36
|
-
- Public docs use **Scope** / **Workflow** vocabulary.
|
|
13
|
+
- Public OpenAPI updates from production release.
|
|
37
14
|
|
|
38
|
-
### Removed
|
|
39
15
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## [0.1.0] — 2026-07-20
|
|
43
|
-
|
|
44
|
-
### Added
|
|
16
|
+
## [Unreleased]
|
|
45
17
|
|
|
46
|
-
|
|
18
|
+
## [0.3.0] — 2026-07-26
|
package/README.md
CHANGED
|
@@ -224,3 +224,7 @@ npx tsx examples/scripts/quickstart.ts
|
|
|
224
224
|
```
|
|
225
225
|
|
|
226
226
|
See [CHANGELOG.md](./CHANGELOG.md) for release history.
|
|
227
|
+
|
|
228
|
+
## Docs
|
|
229
|
+
|
|
230
|
+
Full guides: [docs.getmodus.com/guides/sdk](https://docs.getmodus.com/guides/sdk) (TypeScript page: [sdk-typescript](https://docs.getmodus.com/guides/sdk-typescript)).
|
|
@@ -216,7 +216,7 @@ var OPERATIONS = {
|
|
|
216
216
|
service: "modus-api",
|
|
217
217
|
serverUrl: "https://api.getmodus.com",
|
|
218
218
|
pathParams: [],
|
|
219
|
-
queryParams: [
|
|
219
|
+
queryParams: [],
|
|
220
220
|
requestSchema: null,
|
|
221
221
|
responseSchema: "ListMemberGroupsResponseDto"
|
|
222
222
|
},
|
|
@@ -286,19 +286,9 @@ var OPERATIONS = {
|
|
|
286
286
|
service: "modus-api",
|
|
287
287
|
serverUrl: "https://api.getmodus.com",
|
|
288
288
|
pathParams: [],
|
|
289
|
-
queryParams: ["pageSize", "pageToken"],
|
|
290
|
-
requestSchema: null,
|
|
291
|
-
responseSchema: "ListOrgMembersResponseDto"
|
|
292
|
-
},
|
|
293
|
-
"OrganizationController_deleteOrganization": {
|
|
294
|
-
method: "DELETE",
|
|
295
|
-
path: "/api/v1/users/organization",
|
|
296
|
-
service: "modus-api",
|
|
297
|
-
serverUrl: "https://api.getmodus.com",
|
|
298
|
-
pathParams: [],
|
|
299
289
|
queryParams: [],
|
|
300
290
|
requestSchema: null,
|
|
301
|
-
responseSchema:
|
|
291
|
+
responseSchema: "ListOrgMembersResponseDto"
|
|
302
292
|
},
|
|
303
293
|
"ResumeRunsController_create": {
|
|
304
294
|
method: "POST",
|
|
@@ -518,7 +508,7 @@ var OPERATIONS = {
|
|
|
518
508
|
pathParams: ["id"],
|
|
519
509
|
queryParams: [],
|
|
520
510
|
requestSchema: null,
|
|
521
|
-
responseSchema: "
|
|
511
|
+
responseSchema: "ScopeDto"
|
|
522
512
|
},
|
|
523
513
|
"ScopesController_cancelOwnershipTransfer": {
|
|
524
514
|
method: "DELETE",
|
|
@@ -528,7 +518,7 @@ var OPERATIONS = {
|
|
|
528
518
|
pathParams: ["id"],
|
|
529
519
|
queryParams: [],
|
|
530
520
|
requestSchema: null,
|
|
531
|
-
responseSchema: "
|
|
521
|
+
responseSchema: "ScopeDto"
|
|
532
522
|
},
|
|
533
523
|
"ScopesController_create": {
|
|
534
524
|
method: "POST",
|
|
@@ -538,7 +528,7 @@ var OPERATIONS = {
|
|
|
538
528
|
pathParams: [],
|
|
539
529
|
queryParams: [],
|
|
540
530
|
requestSchema: "CreateSkillDto",
|
|
541
|
-
responseSchema: "
|
|
531
|
+
responseSchema: "ScopeDto"
|
|
542
532
|
},
|
|
543
533
|
"ScopesController_delete": {
|
|
544
534
|
method: "DELETE",
|
|
@@ -568,7 +558,7 @@ var OPERATIONS = {
|
|
|
568
558
|
pathParams: ["id"],
|
|
569
559
|
queryParams: ["view"],
|
|
570
560
|
requestSchema: null,
|
|
571
|
-
responseSchema: "
|
|
561
|
+
responseSchema: "ScopeDto"
|
|
572
562
|
},
|
|
573
563
|
"ScopesController_getVariation": {
|
|
574
564
|
method: "GET",
|
|
@@ -578,7 +568,7 @@ var OPERATIONS = {
|
|
|
578
568
|
pathParams: ["id", "variationUid"],
|
|
579
569
|
queryParams: [],
|
|
580
570
|
requestSchema: null,
|
|
581
|
-
responseSchema: "
|
|
571
|
+
responseSchema: "ScopeDto"
|
|
582
572
|
},
|
|
583
573
|
"ScopesController_list": {
|
|
584
574
|
method: "GET",
|
|
@@ -608,7 +598,7 @@ var OPERATIONS = {
|
|
|
608
598
|
pathParams: ["id"],
|
|
609
599
|
queryParams: [],
|
|
610
600
|
requestSchema: "TransferOwnershipDto",
|
|
611
|
-
responseSchema: "
|
|
601
|
+
responseSchema: "ScopeDto"
|
|
612
602
|
},
|
|
613
603
|
"ScopesController_restore": {
|
|
614
604
|
method: "POST",
|
|
@@ -618,7 +608,7 @@ var OPERATIONS = {
|
|
|
618
608
|
pathParams: ["id"],
|
|
619
609
|
queryParams: [],
|
|
620
610
|
requestSchema: null,
|
|
621
|
-
responseSchema: "
|
|
611
|
+
responseSchema: "ScopeDto"
|
|
622
612
|
},
|
|
623
613
|
"ScopesController_update": {
|
|
624
614
|
method: "PATCH",
|
|
@@ -628,7 +618,7 @@ var OPERATIONS = {
|
|
|
628
618
|
pathParams: ["id"],
|
|
629
619
|
queryParams: ["updateMask"],
|
|
630
620
|
requestSchema: "UpdateSkillDto",
|
|
631
|
-
responseSchema: "
|
|
621
|
+
responseSchema: "ScopeDto"
|
|
632
622
|
},
|
|
633
623
|
"SuggestionsController_listApproved": {
|
|
634
624
|
method: "GET",
|
|
@@ -636,7 +626,7 @@ var OPERATIONS = {
|
|
|
636
626
|
service: "modus-api",
|
|
637
627
|
serverUrl: "https://api.getmodus.com",
|
|
638
628
|
pathParams: [],
|
|
639
|
-
queryParams: ["pageToken", "pageSize", "
|
|
629
|
+
queryParams: ["pageToken", "pageSize", "scopeId", "scopeIds"],
|
|
640
630
|
requestSchema: null,
|
|
641
631
|
responseSchema: "ListSuggestionQuestionsResponseDto"
|
|
642
632
|
},
|
|
@@ -650,16 +640,36 @@ var OPERATIONS = {
|
|
|
650
640
|
requestSchema: "RecordSuggestionEventDto",
|
|
651
641
|
responseSchema: null
|
|
652
642
|
},
|
|
643
|
+
"ToolsController_list": {
|
|
644
|
+
method: "GET",
|
|
645
|
+
path: "/api/v1/tools",
|
|
646
|
+
service: "modus-api",
|
|
647
|
+
serverUrl: "https://api.getmodus.com",
|
|
648
|
+
pathParams: [],
|
|
649
|
+
queryParams: ["pageToken", "pageSize"],
|
|
650
|
+
requestSchema: null,
|
|
651
|
+
responseSchema: "ListToolsResponseDto"
|
|
652
|
+
},
|
|
653
653
|
"UsageController_list": {
|
|
654
654
|
method: "GET",
|
|
655
655
|
path: "/api/v1/usage",
|
|
656
656
|
service: "modus-api",
|
|
657
657
|
serverUrl: "https://api.getmodus.com",
|
|
658
658
|
pathParams: [],
|
|
659
|
-
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface"],
|
|
659
|
+
queryParams: ["since", "until", "rollup", "model", "group_by", "skill_id", "agent_id", "user_id", "interface", "user_email"],
|
|
660
660
|
requestSchema: null,
|
|
661
661
|
responseSchema: "ListUsageResponseDto"
|
|
662
662
|
},
|
|
663
|
+
"UsageController_listUsers": {
|
|
664
|
+
method: "GET",
|
|
665
|
+
path: "/api/v1/usage/users",
|
|
666
|
+
service: "modus-api",
|
|
667
|
+
serverUrl: "https://api.getmodus.com",
|
|
668
|
+
pathParams: [],
|
|
669
|
+
queryParams: ["since", "until"],
|
|
670
|
+
requestSchema: null,
|
|
671
|
+
responseSchema: "ListUsageUsersResponseDto"
|
|
672
|
+
},
|
|
663
673
|
"WorkflowActionsController_cancel": {
|
|
664
674
|
method: "POST",
|
|
665
675
|
path: "/agent/v1/workflow-actions/{runId}/cancel",
|
|
@@ -716,7 +726,7 @@ var OPERATIONS = {
|
|
|
716
726
|
service: "modus-api",
|
|
717
727
|
serverUrl: "https://api.getmodus.com",
|
|
718
728
|
pathParams: ["id"],
|
|
719
|
-
queryParams: [
|
|
729
|
+
queryParams: [],
|
|
720
730
|
requestSchema: null,
|
|
721
731
|
responseSchema: "ListAgentInterfacesResponseDto"
|
|
722
732
|
},
|
|
@@ -768,7 +778,7 @@ var OPERATIONS = {
|
|
|
768
778
|
pathParams: ["id"],
|
|
769
779
|
queryParams: [],
|
|
770
780
|
requestSchema: null,
|
|
771
|
-
responseSchema: "
|
|
781
|
+
responseSchema: "WorkflowDto"
|
|
772
782
|
},
|
|
773
783
|
"WorkflowsController_cancelOwnershipTransfer": {
|
|
774
784
|
method: "DELETE",
|
|
@@ -778,7 +788,7 @@ var OPERATIONS = {
|
|
|
778
788
|
pathParams: ["id"],
|
|
779
789
|
queryParams: [],
|
|
780
790
|
requestSchema: null,
|
|
781
|
-
responseSchema: "
|
|
791
|
+
responseSchema: "WorkflowDto"
|
|
782
792
|
},
|
|
783
793
|
"WorkflowsController_create": {
|
|
784
794
|
method: "POST",
|
|
@@ -788,7 +798,7 @@ var OPERATIONS = {
|
|
|
788
798
|
pathParams: [],
|
|
789
799
|
queryParams: [],
|
|
790
800
|
requestSchema: "CreateAgentDto",
|
|
791
|
-
responseSchema: "
|
|
801
|
+
responseSchema: "WorkflowDto"
|
|
792
802
|
},
|
|
793
803
|
"WorkflowsController_delete": {
|
|
794
804
|
method: "DELETE",
|
|
@@ -818,7 +828,7 @@ var OPERATIONS = {
|
|
|
818
828
|
pathParams: ["id"],
|
|
819
829
|
queryParams: ["view"],
|
|
820
830
|
requestSchema: null,
|
|
821
|
-
responseSchema: "
|
|
831
|
+
responseSchema: "WorkflowDto"
|
|
822
832
|
},
|
|
823
833
|
"WorkflowsController_list": {
|
|
824
834
|
method: "GET",
|
|
@@ -838,7 +848,7 @@ var OPERATIONS = {
|
|
|
838
848
|
pathParams: ["id"],
|
|
839
849
|
queryParams: [],
|
|
840
850
|
requestSchema: "TransferOwnershipDto",
|
|
841
|
-
responseSchema: "
|
|
851
|
+
responseSchema: "WorkflowDto"
|
|
842
852
|
},
|
|
843
853
|
"WorkflowsController_restore": {
|
|
844
854
|
method: "POST",
|
|
@@ -848,7 +858,7 @@ var OPERATIONS = {
|
|
|
848
858
|
pathParams: ["id"],
|
|
849
859
|
queryParams: [],
|
|
850
860
|
requestSchema: null,
|
|
851
|
-
responseSchema: "
|
|
861
|
+
responseSchema: "WorkflowDto"
|
|
852
862
|
},
|
|
853
863
|
"WorkflowsController_toggle": {
|
|
854
864
|
method: "POST",
|
|
@@ -858,7 +868,7 @@ var OPERATIONS = {
|
|
|
858
868
|
pathParams: ["id"],
|
|
859
869
|
queryParams: [],
|
|
860
870
|
requestSchema: "ToggleAgentDto",
|
|
861
|
-
responseSchema: "
|
|
871
|
+
responseSchema: "WorkflowDto"
|
|
862
872
|
},
|
|
863
873
|
"WorkflowsController_update": {
|
|
864
874
|
method: "PATCH",
|
|
@@ -868,7 +878,7 @@ var OPERATIONS = {
|
|
|
868
878
|
pathParams: ["id"],
|
|
869
879
|
queryParams: ["updateMask"],
|
|
870
880
|
requestSchema: "UpdateAgentDto",
|
|
871
|
-
responseSchema: "
|
|
881
|
+
responseSchema: "WorkflowDto"
|
|
872
882
|
}
|
|
873
883
|
};
|
|
874
884
|
|
|
@@ -961,9 +971,20 @@ var Page = class {
|
|
|
961
971
|
this.nextPageToken = normalizePageToken(nextPageToken);
|
|
962
972
|
this.fetchPage = fetchPage;
|
|
963
973
|
}
|
|
974
|
+
/**
|
|
975
|
+
* Whether another page of results is available.
|
|
976
|
+
*
|
|
977
|
+
* @returns `true` when {@link Page.nextPageToken} is set.
|
|
978
|
+
*/
|
|
964
979
|
hasNextPage() {
|
|
965
980
|
return this.nextPageToken !== void 0;
|
|
966
981
|
}
|
|
982
|
+
/**
|
|
983
|
+
* Fetch the next page using {@link Page.nextPageToken}.
|
|
984
|
+
*
|
|
985
|
+
* @returns The following page of results.
|
|
986
|
+
* @throws {Error} When there is no next page. Check {@link Page.hasNextPage} first.
|
|
987
|
+
*/
|
|
967
988
|
async getNextPage() {
|
|
968
989
|
if (this.nextPageToken === void 0) {
|
|
969
990
|
throw new Error(
|
|
@@ -972,6 +993,12 @@ var Page = class {
|
|
|
972
993
|
}
|
|
973
994
|
return this.fetchPage(this.nextPageToken);
|
|
974
995
|
}
|
|
996
|
+
/**
|
|
997
|
+
* Async-iterate over all items across every page, fetching additional pages as needed.
|
|
998
|
+
*
|
|
999
|
+
* @returns An async generator yielding every item in the result set.
|
|
1000
|
+
* @throws {ModusError} When a follow-up page request fails.
|
|
1001
|
+
*/
|
|
975
1002
|
async *autoPagingIter() {
|
|
976
1003
|
for (const item of this.items) yield item;
|
|
977
1004
|
let nextPageToken = this.nextPageToken;
|
|
@@ -981,6 +1008,7 @@ var Page = class {
|
|
|
981
1008
|
nextPageToken = page.nextPageToken;
|
|
982
1009
|
}
|
|
983
1010
|
}
|
|
1011
|
+
/** Iterate over the current page's items only. */
|
|
984
1012
|
[Symbol.iterator]() {
|
|
985
1013
|
return this.items[Symbol.iterator]();
|
|
986
1014
|
}
|
|
@@ -1047,6 +1075,19 @@ function resolveBaseUrl(baseUrl) {
|
|
|
1047
1075
|
function resolveAgentHost(agentHost) {
|
|
1048
1076
|
return agentHost ?? process.env[ENV_AGENT_HOST] ?? void 0;
|
|
1049
1077
|
}
|
|
1078
|
+
function isModusApiHostname(hostname) {
|
|
1079
|
+
return hostname === "api.getmodus.com" || /^api\.[a-z0-9-]+\.getmodus\.com$/i.test(hostname);
|
|
1080
|
+
}
|
|
1081
|
+
function deriveAgentHostFromBaseUrl(baseUrl) {
|
|
1082
|
+
try {
|
|
1083
|
+
const url = new URL(baseUrl);
|
|
1084
|
+
if (!isModusApiHostname(url.hostname)) return void 0;
|
|
1085
|
+
url.hostname = `agent.${url.hostname.slice("api.".length)}`;
|
|
1086
|
+
return url.origin;
|
|
1087
|
+
} catch {
|
|
1088
|
+
return void 0;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1050
1091
|
function resolveOrganizationId(organizationId) {
|
|
1051
1092
|
const raw = organizationId ?? process.env[ENV_ORGANIZATION_ID];
|
|
1052
1093
|
if (raw === void 0) return void 0;
|
|
@@ -1098,7 +1139,7 @@ function createModusConfig(options = {}) {
|
|
|
1098
1139
|
const baseUrl = normalizeBaseUrl(resolveBaseUrl(options.baseUrl) ?? DEFAULT_BASE_URL);
|
|
1099
1140
|
const baseUrlOverrides = normalizeBaseUrls(options.baseUrls);
|
|
1100
1141
|
const agentHost = normalizeBaseUrl(
|
|
1101
|
-
baseUrlOverrides["agent-service"] ?? resolveAgentHost(options.agentHost) ?? DEFAULT_AGENT_HOST
|
|
1142
|
+
baseUrlOverrides["agent-service"] ?? resolveAgentHost(options.agentHost) ?? deriveAgentHostFromBaseUrl(baseUrl) ?? DEFAULT_AGENT_HOST
|
|
1102
1143
|
);
|
|
1103
1144
|
const organizationId = resolveOrganizationId(options.organizationId);
|
|
1104
1145
|
return Object.freeze({
|
|
@@ -1128,7 +1169,7 @@ function formatConfigForLog(config) {
|
|
|
1128
1169
|
}
|
|
1129
1170
|
|
|
1130
1171
|
// src/_http.ts
|
|
1131
|
-
var USER_AGENT = `modus-typescript/${"0.
|
|
1172
|
+
var USER_AGENT = `modus-typescript/${"0.4.0"} (node/${process.version}; ${process.platform})`;
|
|
1132
1173
|
function buildUrl(baseUrl, path, params) {
|
|
1133
1174
|
const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
|
|
1134
1175
|
if (params) {
|
|
@@ -1403,7 +1444,7 @@ var WRITE_BODY_ALLOWED_KEYS = {
|
|
|
1403
1444
|
ScopesController_update: ["name", "description", "expectedOutput", "instructions", "toolset", "model", "connectionSet", "contextSelections", "interfaces", "accessConfig", "managerId", "evaluations", "supervisionSubordinateDescriptions"],
|
|
1404
1445
|
ScopeSupervisionController_set: ["subordinateAgentIds"],
|
|
1405
1446
|
ScopeSupervisionController_setActive: ["subordinateAgentIds"],
|
|
1406
|
-
SuggestionsController_recordEvent: ["
|
|
1447
|
+
SuggestionsController_recordEvent: ["eventType", "source", "skillId", "threadId", "metadata"],
|
|
1407
1448
|
WorkflowActionsController_cancel: [],
|
|
1408
1449
|
WorkflowActionsController_execute: ["organizationId", "sessionId", "fileThreadId", "workflowAction", "previousOutputs", "userTimezone", "runId", "automationId", "source"],
|
|
1409
1450
|
WorkflowInterfacesController_add: ["type", "name", "config"],
|
|
@@ -1588,16 +1629,37 @@ function parseContextItem(raw) {
|
|
|
1588
1629
|
return raw;
|
|
1589
1630
|
}
|
|
1590
1631
|
function parseCreatedCustomContextItem(raw) {
|
|
1591
|
-
|
|
1632
|
+
const data = asRecord(raw);
|
|
1633
|
+
const contextItemId = data.contextItemId;
|
|
1634
|
+
if (typeof contextItemId !== "string" || !contextItemId) {
|
|
1635
|
+
throw new ValidationError(
|
|
1636
|
+
"Custom context create response missing non-empty string contextItemId"
|
|
1637
|
+
);
|
|
1638
|
+
}
|
|
1639
|
+
return {
|
|
1640
|
+
...data,
|
|
1641
|
+
contextItemId,
|
|
1642
|
+
uid: contextItemId
|
|
1643
|
+
};
|
|
1592
1644
|
}
|
|
1593
1645
|
function parseDeletion(raw) {
|
|
1594
1646
|
return raw;
|
|
1595
1647
|
}
|
|
1596
1648
|
var CustomContextItemsResource = class {
|
|
1649
|
+
/** @internal */
|
|
1597
1650
|
constructor(http, config) {
|
|
1598
1651
|
this.http = http;
|
|
1599
1652
|
this.config = config;
|
|
1600
1653
|
}
|
|
1654
|
+
/**
|
|
1655
|
+
* List custom context items.
|
|
1656
|
+
*
|
|
1657
|
+
* @param options.pageSize - Maximum items per page (default 25).
|
|
1658
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
1659
|
+
* @param options.searchQuery - Free-text search filter.
|
|
1660
|
+
* @param options.topics - Filter to items tagged with any of these topics.
|
|
1661
|
+
* @returns A page of custom context items.
|
|
1662
|
+
*/
|
|
1601
1663
|
list(options = {}) {
|
|
1602
1664
|
const pageSize = options.pageSize ?? 25;
|
|
1603
1665
|
validatePageSize(pageSize);
|
|
@@ -1619,6 +1681,13 @@ var CustomContextItemsResource = class {
|
|
|
1619
1681
|
(token) => this.listPage(pageSize, token, options)
|
|
1620
1682
|
);
|
|
1621
1683
|
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Retrieve a custom context item by uid.
|
|
1686
|
+
*
|
|
1687
|
+
* @param uid - Item uid.
|
|
1688
|
+
* @returns The custom context item.
|
|
1689
|
+
* @throws {NotFoundError} When no item matches the uid.
|
|
1690
|
+
*/
|
|
1622
1691
|
async get(uid) {
|
|
1623
1692
|
return parseContextItem(
|
|
1624
1693
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_get", {
|
|
@@ -1626,6 +1695,26 @@ var CustomContextItemsResource = class {
|
|
|
1626
1695
|
})
|
|
1627
1696
|
);
|
|
1628
1697
|
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Create a custom context item.
|
|
1700
|
+
*
|
|
1701
|
+
* @param input.kind - Item kind (`source`, `collection`, `entity`, `field`, or `entity_samples`).
|
|
1702
|
+
* @param input.sourceId - Source identifier for the item hierarchy.
|
|
1703
|
+
* @param input.name - Display name when applicable.
|
|
1704
|
+
* @param input.content - Item payload.
|
|
1705
|
+
* @param input.idempotencyKey - Optional idempotency key for safe retries.
|
|
1706
|
+
* @returns Created item ids and hierarchy metadata.
|
|
1707
|
+
*
|
|
1708
|
+
* @example
|
|
1709
|
+
* ```ts
|
|
1710
|
+
* const created = await client.context.customItems.create({
|
|
1711
|
+
* kind: 'entity',
|
|
1712
|
+
* sourceId: 'my-source',
|
|
1713
|
+
* name: 'Q3 churn notes',
|
|
1714
|
+
* content: { summary: 'Key findings…' },
|
|
1715
|
+
* })
|
|
1716
|
+
* ```
|
|
1717
|
+
*/
|
|
1629
1718
|
async create(input) {
|
|
1630
1719
|
return parseCreatedCustomContextItem(
|
|
1631
1720
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_create", {
|
|
@@ -1633,6 +1722,20 @@ var CustomContextItemsResource = class {
|
|
|
1633
1722
|
})
|
|
1634
1723
|
);
|
|
1635
1724
|
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Create multiple custom context items in one request.
|
|
1727
|
+
*
|
|
1728
|
+
* @param inputs - Items to create (same fields as {@link CustomContextItemsResource.create}).
|
|
1729
|
+
* @returns Created item metadata for each input.
|
|
1730
|
+
*
|
|
1731
|
+
* @example
|
|
1732
|
+
* ```ts
|
|
1733
|
+
* const created = await client.context.customItems.batchCreate([
|
|
1734
|
+
* { kind: 'field', sourceId: 'src', fieldName: 'region', dataType: 'string' },
|
|
1735
|
+
* { kind: 'field', sourceId: 'src', fieldName: 'amount', dataType: 'number' },
|
|
1736
|
+
* ])
|
|
1737
|
+
* ```
|
|
1738
|
+
*/
|
|
1636
1739
|
async batchCreate(inputs) {
|
|
1637
1740
|
const data = asRecord(
|
|
1638
1741
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_batchCreate", {
|
|
@@ -1644,6 +1747,13 @@ var CustomContextItemsResource = class {
|
|
|
1644
1747
|
const items = data.contextItems;
|
|
1645
1748
|
return Array.isArray(items) ? items.map(parseCreatedCustomContextItem) : [];
|
|
1646
1749
|
}
|
|
1750
|
+
/**
|
|
1751
|
+
* Update a custom context item.
|
|
1752
|
+
*
|
|
1753
|
+
* @param uid - Item uid.
|
|
1754
|
+
* @param input - Fields to change (kind and hierarchy ids cannot be changed).
|
|
1755
|
+
* @returns The updated item uid.
|
|
1756
|
+
*/
|
|
1647
1757
|
async update(uid, input) {
|
|
1648
1758
|
return asRecord(
|
|
1649
1759
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_update", {
|
|
@@ -1652,6 +1762,12 @@ var CustomContextItemsResource = class {
|
|
|
1652
1762
|
})
|
|
1653
1763
|
);
|
|
1654
1764
|
}
|
|
1765
|
+
/**
|
|
1766
|
+
* Delete a custom context item.
|
|
1767
|
+
*
|
|
1768
|
+
* @param uid - Item uid.
|
|
1769
|
+
* @returns Deletion confirmation with uid and context type.
|
|
1770
|
+
*/
|
|
1655
1771
|
async delete(uid) {
|
|
1656
1772
|
return parseDeletion(
|
|
1657
1773
|
await invokeWithRetry(this.config, this.http, "CustomContextItemsController_delete", {
|
|
@@ -1661,7 +1777,7 @@ var CustomContextItemsResource = class {
|
|
|
1661
1777
|
}
|
|
1662
1778
|
};
|
|
1663
1779
|
|
|
1664
|
-
// src/resources/
|
|
1780
|
+
// src/resources/scopes/conversations.ts
|
|
1665
1781
|
function parseListItem(raw) {
|
|
1666
1782
|
return raw;
|
|
1667
1783
|
}
|
|
@@ -1674,6 +1790,13 @@ var ScopeConversationsResource = class {
|
|
|
1674
1790
|
this.config = config;
|
|
1675
1791
|
this.scopeId = scopeId;
|
|
1676
1792
|
}
|
|
1793
|
+
/**
|
|
1794
|
+
* List conversation threads for this scope, newest first.
|
|
1795
|
+
*
|
|
1796
|
+
* @param options.pageSize - Items per page (default 25).
|
|
1797
|
+
* @param options.pageToken - Opaque token from a previous page.
|
|
1798
|
+
* @returns Page of conversation list items.
|
|
1799
|
+
*/
|
|
1677
1800
|
list(options = {}) {
|
|
1678
1801
|
const pageSize = options.pageSize ?? 25;
|
|
1679
1802
|
validatePageSize(pageSize);
|
|
@@ -1694,6 +1817,14 @@ var ScopeConversationsResource = class {
|
|
|
1694
1817
|
(token) => this.listPage(pageSize, token)
|
|
1695
1818
|
);
|
|
1696
1819
|
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Retrieve a thread with full message history.
|
|
1822
|
+
*
|
|
1823
|
+
* @param threadId - Conversation thread id.
|
|
1824
|
+
* @param options.messageLimit - Maximum messages to return (1–100).
|
|
1825
|
+
* @param options.beforeMessageIndex - Return messages before this index (requires messageLimit).
|
|
1826
|
+
* @returns Conversation with messages.
|
|
1827
|
+
*/
|
|
1697
1828
|
async get(threadId, options = {}) {
|
|
1698
1829
|
validateId(this.scopeId, "scope_id");
|
|
1699
1830
|
validateId(threadId, "thread_id");
|
|
@@ -1743,4 +1874,4 @@ export {
|
|
|
1743
1874
|
CustomContextItemsResource,
|
|
1744
1875
|
ScopeConversationsResource
|
|
1745
1876
|
};
|
|
1746
|
-
//# sourceMappingURL=chunk-
|
|
1877
|
+
//# sourceMappingURL=chunk-I56O44TR.js.map
|