@getmodus/sdk 0.10.0 → 0.11.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 +5 -2
- package/README.md +8 -1
- package/dist/{_client-base-H5rt5EGy.d.cts → _client-base-DdnxB9JA.d.cts} +289 -25
- package/dist/{_client-base-H5rt5EGy.d.ts → _client-base-DdnxB9JA.d.ts} +289 -25
- package/dist/{chunk-NA3ZD35T.cjs → chunk-3MHHVC6C.cjs} +14 -2
- package/dist/chunk-3MHHVC6C.cjs.map +1 -0
- package/dist/{chunk-BMYCORZF.js → chunk-JVTQBBMZ.js} +14 -2
- package/dist/chunk-JVTQBBMZ.js.map +1 -0
- package/dist/index.cjs +157 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -8
- package/dist/index.d.ts +32 -8
- package/dist/index.js +36 -7
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +259 -259
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +3 -3
- package/dist/management/index.d.ts +3 -3
- package/dist/management/index.js +3 -3
- package/dist/management/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BMYCORZF.js.map +0 -1
- package/dist/chunk-NA3ZD35T.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunk3MHHVC6Ccjs = require('./chunk-3MHHVC6C.cjs');
|
|
35
35
|
|
|
36
36
|
// src/_agent_run_request.ts
|
|
37
37
|
var _crypto = require('crypto');
|
|
@@ -161,9 +161,9 @@ function runsPath(target) {
|
|
|
161
161
|
return `/agent/v1/${target.kind}/${encodeURIComponent(String(target.id))}/runs`;
|
|
162
162
|
}
|
|
163
163
|
function raiseForEvent(event) {
|
|
164
|
-
if (event.type === "error") throw new (0,
|
|
165
|
-
if (event.type === "cancelled") throw new (0,
|
|
166
|
-
if (event.type === "stream_timeout") throw new (0,
|
|
164
|
+
if (event.type === "error") throw new (0, _chunk3MHHVC6Ccjs.ModusError)(event.message, { requestId: event.requestId });
|
|
165
|
+
if (event.type === "cancelled") throw new (0, _chunk3MHHVC6Ccjs.RunCancelledError)();
|
|
166
|
+
if (event.type === "stream_timeout") throw new (0, _chunk3MHHVC6Ccjs.StreamTimeoutError)();
|
|
167
167
|
return event;
|
|
168
168
|
}
|
|
169
169
|
var ChatSession = class _ChatSession {
|
|
@@ -223,7 +223,7 @@ var ChatSession = class _ChatSession {
|
|
|
223
223
|
async result() {
|
|
224
224
|
for await (const _event of this.replay(true)) {
|
|
225
225
|
}
|
|
226
|
-
if (this.final === void 0) throw new (0,
|
|
226
|
+
if (this.final === void 0) throw new (0, _chunk3MHHVC6Ccjs.ModusError)("Chat stream ended without a done event");
|
|
227
227
|
return this.final;
|
|
228
228
|
}
|
|
229
229
|
/** Resolve with the final {@link ChatResult}, so the session can be awaited. */
|
|
@@ -257,10 +257,10 @@ var ChatSession = class _ChatSession {
|
|
|
257
257
|
*/
|
|
258
258
|
resume(input) {
|
|
259
259
|
if (this.final === void 0) {
|
|
260
|
-
throw new (0,
|
|
260
|
+
throw new (0, _chunk3MHHVC6Ccjs.ModusError)("resume() needs a finished run: await the chat first");
|
|
261
261
|
}
|
|
262
262
|
const { runId, threadId } = this.final;
|
|
263
|
-
|
|
263
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
|
|
264
264
|
return new _ChatSession(this.http, {
|
|
265
265
|
path: `/agent/v1/runs/${encodeURIComponent(runId)}/resume`,
|
|
266
266
|
body: { sessionId: threadId, decision: input.decision },
|
|
@@ -331,9 +331,9 @@ function startChat(http, config, target, message, options) {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
function chatRequest(config, target, message, options) {
|
|
334
|
-
if (target.kind !== "modus")
|
|
335
|
-
|
|
336
|
-
const baseUrl =
|
|
334
|
+
if (target.kind !== "modus") _chunk3MHHVC6Ccjs.validateId.call(void 0, target.id, `${target.kind.slice(0, -1)}_id`);
|
|
335
|
+
_chunk3MHHVC6Ccjs.validateChatModel.call(void 0, options.model);
|
|
336
|
+
const baseUrl = _chunk3MHHVC6Ccjs.requireAgentHost.call(void 0, config);
|
|
337
337
|
const sessionId = resolveAgentRunSessionId(effectiveThreadId(options.threadId));
|
|
338
338
|
return {
|
|
339
339
|
path: runsPath(target),
|
|
@@ -399,7 +399,7 @@ var WorkflowsResourceBase = class {
|
|
|
399
399
|
*/
|
|
400
400
|
list(options = {}) {
|
|
401
401
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
402
|
-
|
|
402
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
|
|
403
403
|
return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation);
|
|
404
404
|
}
|
|
405
405
|
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
@@ -408,12 +408,12 @@ var WorkflowsResourceBase = class {
|
|
|
408
408
|
if (type !== void 0) extra.type = type;
|
|
409
409
|
if (view !== void 0) extra.view = view;
|
|
410
410
|
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
411
|
-
const data =
|
|
412
|
-
await
|
|
413
|
-
query:
|
|
411
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
412
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_list", {
|
|
413
|
+
query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
414
414
|
})
|
|
415
415
|
);
|
|
416
|
-
return
|
|
416
|
+
return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
|
|
417
417
|
data,
|
|
418
418
|
"workflows",
|
|
419
419
|
(raw) => raw,
|
|
@@ -427,7 +427,7 @@ var WorkflowsResourceBase = class {
|
|
|
427
427
|
var RUNS_MAX_PAGE_SIZE = 100;
|
|
428
428
|
function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
|
|
429
429
|
const params = { pageSize };
|
|
430
|
-
const token =
|
|
430
|
+
const token = _chunk3MHHVC6Ccjs.normalizePageToken.call(void 0, pageToken);
|
|
431
431
|
if (token !== void 0) params.pageToken = token;
|
|
432
432
|
if (status !== void 0) params.status = status;
|
|
433
433
|
if (timeframe !== void 0) params.timeframe = timeframe;
|
|
@@ -437,7 +437,7 @@ function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, s
|
|
|
437
437
|
}
|
|
438
438
|
function activeRunsParams(pageSize, pageToken) {
|
|
439
439
|
const params = { pageSize };
|
|
440
|
-
const token =
|
|
440
|
+
const token = _chunk3MHHVC6Ccjs.normalizePageToken.call(void 0, pageToken);
|
|
441
441
|
if (token !== void 0) params.pageToken = token;
|
|
442
442
|
return params;
|
|
443
443
|
}
|
|
@@ -445,26 +445,26 @@ function parseRun(raw) {
|
|
|
445
445
|
return raw;
|
|
446
446
|
}
|
|
447
447
|
function parseActiveRunsArray(raw) {
|
|
448
|
-
const data =
|
|
448
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0, raw);
|
|
449
449
|
const runs = data.runs;
|
|
450
450
|
if (!Array.isArray(runs)) {
|
|
451
|
-
throw new (0,
|
|
451
|
+
throw new (0, _chunk3MHHVC6Ccjs.ModusError)(
|
|
452
452
|
`Unexpected active runs response shape: runs must be a list, got ${typeof runs}.`
|
|
453
453
|
);
|
|
454
454
|
}
|
|
455
455
|
return runs;
|
|
456
456
|
}
|
|
457
457
|
function parseActiveRunsPage(raw, fetchPage) {
|
|
458
|
-
const data =
|
|
458
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0, raw);
|
|
459
459
|
const runs = data.runs;
|
|
460
460
|
if (!Array.isArray(runs)) {
|
|
461
|
-
throw new (0,
|
|
461
|
+
throw new (0, _chunk3MHHVC6Ccjs.ModusError)(
|
|
462
462
|
`Unexpected active runs response shape: runs must be a list, got ${typeof runs}.`
|
|
463
463
|
);
|
|
464
464
|
}
|
|
465
|
-
return new (0,
|
|
465
|
+
return new (0, _chunk3MHHVC6Ccjs.Page)(
|
|
466
466
|
runs,
|
|
467
|
-
|
|
467
|
+
_chunk3MHHVC6Ccjs.normalizePageToken.call(void 0,
|
|
468
468
|
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
469
469
|
),
|
|
470
470
|
fetchPage
|
|
@@ -478,7 +478,7 @@ function sessionIdFromBody(body) {
|
|
|
478
478
|
}
|
|
479
479
|
function requireSessionId(sessionId) {
|
|
480
480
|
if (!_optionalChain([sessionId, 'optionalAccess', _4 => _4.trim, 'call', _5 => _5()])) {
|
|
481
|
-
throw new (0,
|
|
481
|
+
throw new (0, _chunk3MHHVC6Ccjs.ValidationError)("sessionId must be the run's conversation id (a non-empty string)");
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
function makeAgentRunStream(runId, events) {
|
|
@@ -518,14 +518,14 @@ var WorkflowRunsResource = class {
|
|
|
518
518
|
* ```
|
|
519
519
|
*/
|
|
520
520
|
list(workflowId, options = {}) {
|
|
521
|
-
|
|
521
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
522
522
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
523
|
-
|
|
523
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize, RUNS_MAX_PAGE_SIZE);
|
|
524
524
|
return this.listPage(workflowId, pageSize, options.pageToken, options);
|
|
525
525
|
}
|
|
526
526
|
async listPage(workflowId, pageSize, pageToken, filters) {
|
|
527
|
-
const data =
|
|
528
|
-
await
|
|
527
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
528
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowRunsController_list", {
|
|
529
529
|
pathParams: { id: workflowId },
|
|
530
530
|
query: runsListParams(
|
|
531
531
|
pageSize,
|
|
@@ -539,13 +539,13 @@ var WorkflowRunsResource = class {
|
|
|
539
539
|
);
|
|
540
540
|
const runs = data.runs;
|
|
541
541
|
if (!Array.isArray(runs)) {
|
|
542
|
-
throw new (0,
|
|
542
|
+
throw new (0, _chunk3MHHVC6Ccjs.ModusError)(
|
|
543
543
|
`Unexpected list response shape: runs must be a list, got ${typeof runs}.`
|
|
544
544
|
);
|
|
545
545
|
}
|
|
546
|
-
return new (0,
|
|
546
|
+
return new (0, _chunk3MHHVC6Ccjs.Page)(
|
|
547
547
|
runs,
|
|
548
|
-
|
|
548
|
+
_chunk3MHHVC6Ccjs.normalizePageToken.call(void 0,
|
|
549
549
|
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
550
550
|
),
|
|
551
551
|
(token) => this.listPage(workflowId, pageSize, token, filters)
|
|
@@ -567,10 +567,10 @@ var WorkflowRunsResource = class {
|
|
|
567
567
|
* ```
|
|
568
568
|
*/
|
|
569
569
|
async get(workflowId, runId, options = {}) {
|
|
570
|
-
|
|
571
|
-
if (!runId.trim()) throw new (0,
|
|
570
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
571
|
+
if (!runId.trim()) throw new (0, _chunk3MHHVC6Ccjs.ValidationError)("run_id must be a non-empty string");
|
|
572
572
|
const query = options.temporalRunId !== void 0 ? { temporalRunId: options.temporalRunId } : void 0;
|
|
573
|
-
const data = await
|
|
573
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowRunsController_get", {
|
|
574
574
|
pathParams: { id: workflowId, runId },
|
|
575
575
|
query
|
|
576
576
|
});
|
|
@@ -597,7 +597,7 @@ var WorkflowRunsResource = class {
|
|
|
597
597
|
* ```
|
|
598
598
|
*/
|
|
599
599
|
create(workflowId, body, options = {}) {
|
|
600
|
-
|
|
600
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
601
601
|
return this.createRun("WorkflowRunsController_create", body, { id: workflowId }, options);
|
|
602
602
|
}
|
|
603
603
|
/**
|
|
@@ -622,7 +622,7 @@ var WorkflowRunsResource = class {
|
|
|
622
622
|
* ```
|
|
623
623
|
*/
|
|
624
624
|
createScope(scopeId, body, options = {}) {
|
|
625
|
-
|
|
625
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
|
|
626
626
|
return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
|
|
627
627
|
}
|
|
628
628
|
/**
|
|
@@ -670,7 +670,7 @@ var WorkflowRunsResource = class {
|
|
|
670
670
|
* ```
|
|
671
671
|
*/
|
|
672
672
|
resume(runId, body, options = {}) {
|
|
673
|
-
|
|
673
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
|
|
674
674
|
requireSessionId(body.sessionId);
|
|
675
675
|
return this.createRun("ResumeRunsController_create", body, { runId }, options);
|
|
676
676
|
}
|
|
@@ -685,8 +685,8 @@ var WorkflowRunsResource = class {
|
|
|
685
685
|
* ```
|
|
686
686
|
*/
|
|
687
687
|
async cancel(runId) {
|
|
688
|
-
|
|
689
|
-
await
|
|
688
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
|
|
689
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_cancel", {
|
|
690
690
|
pathParams: { runId },
|
|
691
691
|
jsonBody: {}
|
|
692
692
|
});
|
|
@@ -699,8 +699,8 @@ var WorkflowRunsResource = class {
|
|
|
699
699
|
* `status` and `done`.
|
|
700
700
|
*/
|
|
701
701
|
async events(runId) {
|
|
702
|
-
|
|
703
|
-
return await
|
|
702
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
|
|
703
|
+
return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_events", {
|
|
704
704
|
pathParams: { runId }
|
|
705
705
|
});
|
|
706
706
|
}
|
|
@@ -731,13 +731,13 @@ var WorkflowRunsResource = class {
|
|
|
731
731
|
* ```
|
|
732
732
|
*/
|
|
733
733
|
async interrupt(runId, nextRun, options = {}) {
|
|
734
|
-
|
|
734
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
|
|
735
735
|
requireSessionId(nextRun.sessionId);
|
|
736
736
|
const jsonBody = {
|
|
737
737
|
nextRun: { ...nextRun, runId: _optionalChain([nextRun, 'access', _6 => _6.runId, 'optionalAccess', _7 => _7.trim, 'call', _8 => _8()]) || randomRunId() },
|
|
738
738
|
...options.lastSeenEventId ? { lastSeenEventId: options.lastSeenEventId } : {}
|
|
739
739
|
};
|
|
740
|
-
return await
|
|
740
|
+
return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_interrupt", {
|
|
741
741
|
pathParams: { runId },
|
|
742
742
|
jsonBody
|
|
743
743
|
});
|
|
@@ -760,9 +760,9 @@ var WorkflowRunsResource = class {
|
|
|
760
760
|
* ```
|
|
761
761
|
*/
|
|
762
762
|
async editQueued(runId, nextRun) {
|
|
763
|
-
|
|
763
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
|
|
764
764
|
requireSessionId(nextRun.sessionId);
|
|
765
|
-
return await
|
|
765
|
+
return await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_editQueued", {
|
|
766
766
|
pathParams: { runId },
|
|
767
767
|
jsonBody: { nextRun }
|
|
768
768
|
});
|
|
@@ -776,12 +776,12 @@ var WorkflowRunsResource = class {
|
|
|
776
776
|
*/
|
|
777
777
|
active(options = {}) {
|
|
778
778
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 50));
|
|
779
|
-
|
|
779
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize, RUNS_MAX_PAGE_SIZE);
|
|
780
780
|
return this.activePage(pageSize, options.pageToken);
|
|
781
781
|
}
|
|
782
782
|
async activePage(pageSize, pageToken) {
|
|
783
783
|
return parseActiveRunsPage(
|
|
784
|
-
await
|
|
784
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_active", {
|
|
785
785
|
query: activeRunsParams(pageSize, pageToken)
|
|
786
786
|
}),
|
|
787
787
|
(token) => this.activePage(pageSize, token)
|
|
@@ -797,10 +797,10 @@ var WorkflowRunsResource = class {
|
|
|
797
797
|
async activeBySession(sessionIds) {
|
|
798
798
|
const uniqueSessionIds = [...new Set(sessionIds.map((id) => id.trim()).filter(Boolean))];
|
|
799
799
|
if (uniqueSessionIds.length > 100) {
|
|
800
|
-
throw new (0,
|
|
800
|
+
throw new (0, _chunk3MHHVC6Ccjs.ValidationError)("sessionIds must contain at most 100 ids");
|
|
801
801
|
}
|
|
802
802
|
return parseActiveRunsArray(
|
|
803
|
-
await
|
|
803
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_activeBySession", {
|
|
804
804
|
jsonBody: { sessionIds: uniqueSessionIds }
|
|
805
805
|
})
|
|
806
806
|
);
|
|
@@ -823,11 +823,11 @@ var WorkflowRunsResource = class {
|
|
|
823
823
|
* ```
|
|
824
824
|
*/
|
|
825
825
|
stream(runId, options = {}) {
|
|
826
|
-
|
|
827
|
-
const op =
|
|
828
|
-
const path =
|
|
826
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
|
|
827
|
+
const op = _chunk3MHHVC6Ccjs.getOperation.call(void 0, "RunLifecycleController_stream");
|
|
828
|
+
const path = _chunk3MHHVC6Ccjs.formatOperationPath.call(void 0, "RunLifecycleController_stream", { runId });
|
|
829
829
|
const lines = this.http.streamGet(path, void 0, {
|
|
830
|
-
baseUrl:
|
|
830
|
+
baseUrl: _chunk3MHHVC6Ccjs.operationBaseUrl.call(void 0, this.http, op),
|
|
831
831
|
headers: options.lastEventId ? { "Last-Event-ID": options.lastEventId } : void 0
|
|
832
832
|
});
|
|
833
833
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
@@ -835,14 +835,14 @@ var WorkflowRunsResource = class {
|
|
|
835
835
|
createRun(operationId, body, pathParams, options) {
|
|
836
836
|
const runId = _optionalChain([options, 'access', _9 => _9.idempotencyKey, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11()]) || _optionalChain([body, 'access', _12 => _12.runId, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]) || randomRunId();
|
|
837
837
|
const sessionId = sessionIdFromBody(body);
|
|
838
|
-
const op =
|
|
839
|
-
const path =
|
|
838
|
+
const op = _chunk3MHHVC6Ccjs.getOperation.call(void 0, operationId);
|
|
839
|
+
const path = _chunk3MHHVC6Ccjs.formatOperationPath.call(void 0, operationId, pathParams);
|
|
840
840
|
const lines = this.http.streamPost(path, {
|
|
841
841
|
...body,
|
|
842
842
|
sessionId,
|
|
843
843
|
streamProtocolVersion: 2
|
|
844
844
|
}, {
|
|
845
|
-
baseUrl:
|
|
845
|
+
baseUrl: _chunk3MHHVC6Ccjs.operationBaseUrl.call(void 0, this.http, op),
|
|
846
846
|
headers: { "Idempotency-Key": runId }
|
|
847
847
|
});
|
|
848
848
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
@@ -872,10 +872,10 @@ var AgentWorkflowActionsResource = class {
|
|
|
872
872
|
*/
|
|
873
873
|
execute(body, options = {}) {
|
|
874
874
|
const runId = _optionalChain([options, 'access', _15 => _15.idempotencyKey, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]) || _optionalChain([body, 'access', _18 => _18.runId, 'optionalAccess', _19 => _19.trim, 'call', _20 => _20()]) || randomRunId2();
|
|
875
|
-
const op =
|
|
876
|
-
const path =
|
|
875
|
+
const op = _chunk3MHHVC6Ccjs.getOperation.call(void 0, "WorkflowActionsController_execute");
|
|
876
|
+
const path = _chunk3MHHVC6Ccjs.formatOperationPath.call(void 0, "WorkflowActionsController_execute");
|
|
877
877
|
const lines = this.http.streamPost(path, body, {
|
|
878
|
-
baseUrl:
|
|
878
|
+
baseUrl: _chunk3MHHVC6Ccjs.operationBaseUrl.call(void 0, this.http, op),
|
|
879
879
|
headers: { "Idempotency-Key": runId }
|
|
880
880
|
});
|
|
881
881
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
@@ -886,8 +886,8 @@ var AgentWorkflowActionsResource = class {
|
|
|
886
886
|
* @param runId - Action run id to cancel.
|
|
887
887
|
*/
|
|
888
888
|
async cancel(runId) {
|
|
889
|
-
|
|
890
|
-
await
|
|
889
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, runId, "run_id");
|
|
890
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowActionsController_cancel", {
|
|
891
891
|
pathParams: { runId },
|
|
892
892
|
jsonBody: {}
|
|
893
893
|
});
|
|
@@ -925,13 +925,13 @@ var WorkflowsResource = class extends WorkflowsResourceBase {
|
|
|
925
925
|
* ```
|
|
926
926
|
*/
|
|
927
927
|
async get(workflowId, options = {}) {
|
|
928
|
-
|
|
928
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
929
929
|
const query = {};
|
|
930
930
|
if (options.view !== void 0) query.view = options.view;
|
|
931
931
|
if (options.includeVariation !== void 0) {
|
|
932
932
|
query.includeVariation = options.includeVariation;
|
|
933
933
|
}
|
|
934
|
-
const data = await
|
|
934
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_get", {
|
|
935
935
|
pathParams: { id: workflowId },
|
|
936
936
|
query: Object.keys(query).length > 0 ? query : void 0
|
|
937
937
|
});
|
|
@@ -986,18 +986,18 @@ var ConnectionsResourceBase = class {
|
|
|
986
986
|
*/
|
|
987
987
|
list(options = {}) {
|
|
988
988
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
989
|
-
|
|
989
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
|
|
990
990
|
return this.listPage(pageSize, options.pageToken, options.type);
|
|
991
991
|
}
|
|
992
992
|
async listPage(pageSize, pageToken, type) {
|
|
993
993
|
const extra = {};
|
|
994
994
|
if (type !== void 0) extra.type = type;
|
|
995
|
-
const data =
|
|
996
|
-
await
|
|
997
|
-
query:
|
|
995
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
996
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ConnectionsController_list", {
|
|
997
|
+
query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
998
998
|
})
|
|
999
999
|
);
|
|
1000
|
-
return
|
|
1000
|
+
return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
|
|
1001
1001
|
data,
|
|
1002
1002
|
"connections",
|
|
1003
1003
|
(raw) => raw,
|
|
@@ -1020,7 +1020,7 @@ var ConnectionsResource = class extends ConnectionsResourceBase {
|
|
|
1020
1020
|
*/
|
|
1021
1021
|
async find(options) {
|
|
1022
1022
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1023
|
-
|
|
1023
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
|
|
1024
1024
|
const target = options.name.trim().toLowerCase();
|
|
1025
1025
|
let token;
|
|
1026
1026
|
do {
|
|
@@ -1045,19 +1045,19 @@ var ConnectionsResource = class extends ConnectionsResourceBase {
|
|
|
1045
1045
|
* }
|
|
1046
1046
|
*/
|
|
1047
1047
|
listSelections(connectionId, options = {}) {
|
|
1048
|
-
|
|
1048
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, connectionId, "connection_id");
|
|
1049
1049
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1050
|
-
|
|
1050
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
|
|
1051
1051
|
return this.listSelectionsPage(connectionId, pageSize, options.pageToken);
|
|
1052
1052
|
}
|
|
1053
1053
|
async listSelectionsPage(connectionId, pageSize, pageToken) {
|
|
1054
|
-
const data =
|
|
1055
|
-
await
|
|
1054
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
1055
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ConnectionsController_listSelections", {
|
|
1056
1056
|
pathParams: { connectionId },
|
|
1057
|
-
query:
|
|
1057
|
+
query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken)
|
|
1058
1058
|
})
|
|
1059
1059
|
);
|
|
1060
|
-
return
|
|
1060
|
+
return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
|
|
1061
1061
|
data,
|
|
1062
1062
|
"selections",
|
|
1063
1063
|
(raw) => raw,
|
|
@@ -1080,6 +1080,40 @@ var ConnectionsResource = class extends ConnectionsResourceBase {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
};
|
|
1082
1082
|
|
|
1083
|
+
// src/_generated/resources/consumption/context/items.ts
|
|
1084
|
+
var ContextItemsResourceBase = class {
|
|
1085
|
+
/** @internal */
|
|
1086
|
+
constructor(http, config) {
|
|
1087
|
+
this.http = http;
|
|
1088
|
+
this.config = config;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Query context items with SQL.
|
|
1092
|
+
*
|
|
1093
|
+
* Runs one read-only SQL statement over the `context_items` table and returns its rows. The query
|
|
1094
|
+
* sees only the items you can read. A query that is not read-only or not valid returns 400; one
|
|
1095
|
+
* that runs past 20 s returns 422.
|
|
1096
|
+
*
|
|
1097
|
+
* **Requires:** `context:read`
|
|
1098
|
+
*
|
|
1099
|
+
* @param query - Request body; see `ContextItemsQuery`.
|
|
1100
|
+
*
|
|
1101
|
+
* @example
|
|
1102
|
+
* ```ts
|
|
1103
|
+
* const result = await modus.context.items.query({
|
|
1104
|
+
* sql: 'SELECT context_type, count(*) AS items FROM context_items GROUP BY context_type',
|
|
1105
|
+
* })
|
|
1106
|
+
* result.rows
|
|
1107
|
+
* ```
|
|
1108
|
+
*/
|
|
1109
|
+
async query(query) {
|
|
1110
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsQueryController_query", {
|
|
1111
|
+
jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, query)
|
|
1112
|
+
});
|
|
1113
|
+
return data;
|
|
1114
|
+
}
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1083
1117
|
// src/resources/context/items.ts
|
|
1084
1118
|
function contextListParams(pageSize, pageToken, filters = {}) {
|
|
1085
1119
|
const extra = {};
|
|
@@ -1093,7 +1127,7 @@ function contextListParams(pageSize, pageToken, filters = {}) {
|
|
|
1093
1127
|
if (filters.connectionIds !== void 0) {
|
|
1094
1128
|
extra.connectionIds = filters.connectionIds.length === 0 ? "" : [...filters.connectionIds];
|
|
1095
1129
|
}
|
|
1096
|
-
return
|
|
1130
|
+
return _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra);
|
|
1097
1131
|
}
|
|
1098
1132
|
function parseContextItem(raw) {
|
|
1099
1133
|
return raw;
|
|
@@ -1106,12 +1140,7 @@ function parseLookupResponse(raw) {
|
|
|
1106
1140
|
if (item === null || item === void 0) return void 0;
|
|
1107
1141
|
return item;
|
|
1108
1142
|
}
|
|
1109
|
-
var ContextItemsResource = class {
|
|
1110
|
-
/** @internal */
|
|
1111
|
-
constructor(http, config) {
|
|
1112
|
-
this.http = http;
|
|
1113
|
-
this.config = config;
|
|
1114
|
-
}
|
|
1143
|
+
var ContextItemsResource = class extends ContextItemsResourceBase {
|
|
1115
1144
|
/**
|
|
1116
1145
|
* List knowledge-base items.
|
|
1117
1146
|
*
|
|
@@ -1160,7 +1189,7 @@ var ContextItemsResource = class {
|
|
|
1160
1189
|
*/
|
|
1161
1190
|
list(options = {}) {
|
|
1162
1191
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1163
|
-
|
|
1192
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
|
|
1164
1193
|
return this.listPage(pageSize, options.pageToken, {
|
|
1165
1194
|
contextType: options.contextType,
|
|
1166
1195
|
parentUids: options.parentUids,
|
|
@@ -1169,12 +1198,12 @@ var ContextItemsResource = class {
|
|
|
1169
1198
|
});
|
|
1170
1199
|
}
|
|
1171
1200
|
async listPage(pageSize, pageToken, filters) {
|
|
1172
|
-
const data =
|
|
1173
|
-
await
|
|
1201
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
1202
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_list", {
|
|
1174
1203
|
query: contextListParams(pageSize, pageToken, filters)
|
|
1175
1204
|
})
|
|
1176
1205
|
);
|
|
1177
|
-
return
|
|
1206
|
+
return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
|
|
1178
1207
|
data,
|
|
1179
1208
|
"contextItems",
|
|
1180
1209
|
parseContextItem,
|
|
@@ -1195,7 +1224,7 @@ var ContextItemsResource = class {
|
|
|
1195
1224
|
* ```
|
|
1196
1225
|
*/
|
|
1197
1226
|
async get(uid) {
|
|
1198
|
-
const data = await
|
|
1227
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_get", {
|
|
1199
1228
|
pathParams: { uid }
|
|
1200
1229
|
});
|
|
1201
1230
|
return parseContextItem(data);
|
|
@@ -1218,20 +1247,20 @@ var ContextItemsResource = class {
|
|
|
1218
1247
|
* ```
|
|
1219
1248
|
*/
|
|
1220
1249
|
async lookup(options) {
|
|
1221
|
-
const body =
|
|
1250
|
+
const body = _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, {
|
|
1222
1251
|
contextType: options.contextType,
|
|
1223
1252
|
dataPath: options.dataPath,
|
|
1224
1253
|
contentProjection: options.contentProjection
|
|
1225
1254
|
});
|
|
1226
1255
|
try {
|
|
1227
|
-
const raw =
|
|
1228
|
-
await
|
|
1256
|
+
const raw = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
1257
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_lookup", {
|
|
1229
1258
|
jsonBody: body
|
|
1230
1259
|
})
|
|
1231
1260
|
);
|
|
1232
1261
|
return parseLookupResponse(raw);
|
|
1233
1262
|
} catch (error) {
|
|
1234
|
-
if (error instanceof
|
|
1263
|
+
if (error instanceof _chunk3MHHVC6Ccjs.NotFoundError) return void 0;
|
|
1235
1264
|
throw error;
|
|
1236
1265
|
}
|
|
1237
1266
|
}
|
|
@@ -1264,7 +1293,7 @@ var ContextItemsResource = class {
|
|
|
1264
1293
|
*/
|
|
1265
1294
|
listValues(uid, contextType, contentKeyPath, options = {}) {
|
|
1266
1295
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1267
|
-
|
|
1296
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize, _chunk3MHHVC6Ccjs.DEFAULT_MAX_PAGE_SIZE);
|
|
1268
1297
|
return this.listValuesPage(uid, contextType, contentKeyPath, pageSize, options.pageToken);
|
|
1269
1298
|
}
|
|
1270
1299
|
/**
|
|
@@ -1288,16 +1317,16 @@ var ContextItemsResource = class {
|
|
|
1288
1317
|
return this.listValues(item.uid, item.contextType, contentKeyPath, options);
|
|
1289
1318
|
}
|
|
1290
1319
|
async listValuesPage(uid, contextType, contentKeyPath, pageSize, pageToken) {
|
|
1291
|
-
const data =
|
|
1292
|
-
await
|
|
1320
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
1321
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_listValues", {
|
|
1293
1322
|
pathParams: { uid },
|
|
1294
|
-
query:
|
|
1323
|
+
query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, {
|
|
1295
1324
|
contextType,
|
|
1296
1325
|
contentKeyPath
|
|
1297
1326
|
})
|
|
1298
1327
|
})
|
|
1299
1328
|
);
|
|
1300
|
-
return
|
|
1329
|
+
return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
|
|
1301
1330
|
data,
|
|
1302
1331
|
"values",
|
|
1303
1332
|
parseContextValueRow,
|
|
@@ -1311,7 +1340,7 @@ var ContextResource = class {
|
|
|
1311
1340
|
/** @internal */
|
|
1312
1341
|
constructor(http, config) {
|
|
1313
1342
|
this.items = new ContextItemsResource(http, config);
|
|
1314
|
-
this.customItems = new (0,
|
|
1343
|
+
this.customItems = new (0, _chunk3MHHVC6Ccjs.CustomContextItemsResource)(http, config);
|
|
1315
1344
|
}
|
|
1316
1345
|
};
|
|
1317
1346
|
|
|
@@ -1346,7 +1375,7 @@ var IngestedDataResource = class {
|
|
|
1346
1375
|
* ```
|
|
1347
1376
|
*/
|
|
1348
1377
|
async upload(options) {
|
|
1349
|
-
const data = await
|
|
1378
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "IngestedDataController_upload", {
|
|
1350
1379
|
jsonBody: {
|
|
1351
1380
|
integration_type: options.integrationType,
|
|
1352
1381
|
request: options.request,
|
|
@@ -1374,8 +1403,8 @@ var ModusConversationsResourceBase = class {
|
|
|
1374
1403
|
* @param threadId - Thread id from a conversation list or chat response.
|
|
1375
1404
|
*/
|
|
1376
1405
|
async get(threadId) {
|
|
1377
|
-
|
|
1378
|
-
const data = await
|
|
1406
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, threadId, "thread_id");
|
|
1407
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ModusConversationsController_get", {
|
|
1379
1408
|
pathParams: { threadId }
|
|
1380
1409
|
});
|
|
1381
1410
|
return data;
|
|
@@ -1386,7 +1415,7 @@ var ModusConversationsResourceBase = class {
|
|
|
1386
1415
|
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["all", "modus", "scopes"]);
|
|
1387
1416
|
function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
1388
1417
|
if (kind !== void 0 && !ALLOWED_KINDS.has(kind)) {
|
|
1389
|
-
throw new (0,
|
|
1418
|
+
throw new (0, _chunk3MHHVC6Ccjs.ValidationError)(
|
|
1390
1419
|
`kind must be one of ${[...ALLOWED_KINDS].sort().join(", ")}, got ${JSON.stringify(kind)}`
|
|
1391
1420
|
);
|
|
1392
1421
|
}
|
|
@@ -1394,7 +1423,7 @@ function listParams(pageSize, pageToken, kind, source, sourceRef) {
|
|
|
1394
1423
|
if (kind !== void 0) extra.kind = kind;
|
|
1395
1424
|
if (source !== void 0) extra.source = source;
|
|
1396
1425
|
if (sourceRef !== void 0) extra.sourceRef = sourceRef;
|
|
1397
|
-
return
|
|
1426
|
+
return _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra);
|
|
1398
1427
|
}
|
|
1399
1428
|
function parseListItem(raw) {
|
|
1400
1429
|
return raw;
|
|
@@ -1421,16 +1450,16 @@ var ModusConversationsResource = class extends ModusConversationsResourceBase {
|
|
|
1421
1450
|
*/
|
|
1422
1451
|
list(options = {}) {
|
|
1423
1452
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1424
|
-
|
|
1453
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
|
|
1425
1454
|
return this.listPage(pageSize, options.pageToken, options.kind, options.source, options.sourceRef);
|
|
1426
1455
|
}
|
|
1427
1456
|
async listPage(pageSize, pageToken, kind, source, sourceRef) {
|
|
1428
|
-
const data =
|
|
1429
|
-
await
|
|
1457
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
1458
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ModusConversationsController_list", {
|
|
1430
1459
|
query: listParams(pageSize, pageToken, kind, source, sourceRef)
|
|
1431
1460
|
})
|
|
1432
1461
|
);
|
|
1433
|
-
return
|
|
1462
|
+
return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
|
|
1434
1463
|
data,
|
|
1435
1464
|
"conversations",
|
|
1436
1465
|
parseListItem,
|
|
@@ -1463,8 +1492,8 @@ var ModusResource = class {
|
|
|
1463
1492
|
* ```
|
|
1464
1493
|
*/
|
|
1465
1494
|
async getContext(message, options = {}) {
|
|
1466
|
-
const data = await
|
|
1467
|
-
jsonBody:
|
|
1495
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ModusContextComposeController_compose", {
|
|
1496
|
+
jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, { message, limit: options.limit })
|
|
1468
1497
|
});
|
|
1469
1498
|
return data;
|
|
1470
1499
|
}
|
|
@@ -1531,7 +1560,7 @@ var ScopesResourceBase = class {
|
|
|
1531
1560
|
*/
|
|
1532
1561
|
list(options = {}) {
|
|
1533
1562
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1534
|
-
|
|
1563
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize);
|
|
1535
1564
|
return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId);
|
|
1536
1565
|
}
|
|
1537
1566
|
async listPage(pageSize, pageToken, search, view, managerId) {
|
|
@@ -1539,12 +1568,12 @@ var ScopesResourceBase = class {
|
|
|
1539
1568
|
if (search !== void 0) extra.search = search;
|
|
1540
1569
|
if (view !== void 0) extra.view = view;
|
|
1541
1570
|
if (managerId !== void 0) extra.managerId = managerId;
|
|
1542
|
-
const data =
|
|
1543
|
-
await
|
|
1544
|
-
query:
|
|
1571
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
1572
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_list", {
|
|
1573
|
+
query: _chunk3MHHVC6Ccjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
1545
1574
|
})
|
|
1546
1575
|
);
|
|
1547
|
-
return
|
|
1576
|
+
return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
|
|
1548
1577
|
data,
|
|
1549
1578
|
"scopes",
|
|
1550
1579
|
(raw) => raw,
|
|
@@ -1572,8 +1601,8 @@ var ScopesResourceBase = class {
|
|
|
1572
1601
|
* ```
|
|
1573
1602
|
*/
|
|
1574
1603
|
async get(scopeId, options = {}) {
|
|
1575
|
-
|
|
1576
|
-
const data = await
|
|
1604
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
|
|
1605
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_get", {
|
|
1577
1606
|
pathParams: { id: scopeId },
|
|
1578
1607
|
query: { view: options.view }
|
|
1579
1608
|
});
|
|
@@ -1599,7 +1628,7 @@ var ScopesResource = class extends ScopesResourceBase {
|
|
|
1599
1628
|
* ```
|
|
1600
1629
|
*/
|
|
1601
1630
|
conversations(scopeId) {
|
|
1602
|
-
return new (0,
|
|
1631
|
+
return new (0, _chunk3MHHVC6Ccjs.ScopeConversationsResource)(this.http, this.config, scopeId);
|
|
1603
1632
|
}
|
|
1604
1633
|
/**
|
|
1605
1634
|
* Compose context this scope would use for an intent, without running chat.
|
|
@@ -1623,10 +1652,10 @@ var ScopesResource = class extends ScopesResourceBase {
|
|
|
1623
1652
|
* ```
|
|
1624
1653
|
*/
|
|
1625
1654
|
async getContext(scopeId, message, options = {}) {
|
|
1626
|
-
|
|
1627
|
-
const data = await
|
|
1655
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, scopeId, "scope_id");
|
|
1656
|
+
const data = await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeContextComposeController_compose", {
|
|
1628
1657
|
pathParams: { id: scopeId },
|
|
1629
|
-
jsonBody:
|
|
1658
|
+
jsonBody: _chunk3MHHVC6Ccjs.omitUndefined.call(void 0, { message, limit: options.limit })
|
|
1630
1659
|
});
|
|
1631
1660
|
return data;
|
|
1632
1661
|
}
|
|
@@ -1692,19 +1721,19 @@ var SuggestionsResource = class {
|
|
|
1692
1721
|
*/
|
|
1693
1722
|
list(options = {}) {
|
|
1694
1723
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( DEFAULT_SUGGESTIONS_PAGE_SIZE));
|
|
1695
|
-
|
|
1724
|
+
_chunk3MHHVC6Ccjs.validatePageSize.call(void 0, pageSize, MAX_SUGGESTIONS_PAGE_SIZE);
|
|
1696
1725
|
if (_optionalChain([options, 'access', _27 => _27.scopeIds, 'optionalAccess', _28 => _28.length]) === 0) {
|
|
1697
|
-
throw new (0,
|
|
1726
|
+
throw new (0, _chunk3MHHVC6Ccjs.ValidationError)("scopeIds requires at least one id; omit it to list suggestions for every scope");
|
|
1698
1727
|
}
|
|
1699
1728
|
return this.listPage(pageSize, options.pageToken, options.scopeId, options.scopeIds);
|
|
1700
1729
|
}
|
|
1701
1730
|
async listPage(pageSize, pageToken, scopeId, scopeIds) {
|
|
1702
|
-
const data =
|
|
1703
|
-
await
|
|
1731
|
+
const data = _chunk3MHHVC6Ccjs.asRecord.call(void 0,
|
|
1732
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "SuggestionsController_listApproved", {
|
|
1704
1733
|
query: suggestionListParams({ pageSize, pageToken, scopeId, scopeIds })
|
|
1705
1734
|
})
|
|
1706
1735
|
);
|
|
1707
|
-
return
|
|
1736
|
+
return _chunk3MHHVC6Ccjs.buildAipPage.call(void 0,
|
|
1708
1737
|
data,
|
|
1709
1738
|
"suggestions",
|
|
1710
1739
|
parseSuggestion,
|
|
@@ -1718,8 +1747,8 @@ var SuggestionsResource = class {
|
|
|
1718
1747
|
* @param event - Event details, including `eventType` (`shown`, `clicked`, `dismissed`, or `submitted`).
|
|
1719
1748
|
*/
|
|
1720
1749
|
async recordEvent(id, event) {
|
|
1721
|
-
|
|
1722
|
-
await
|
|
1750
|
+
_chunk3MHHVC6Ccjs.validateId.call(void 0, id, "id");
|
|
1751
|
+
await _chunk3MHHVC6Ccjs.invokeWithRetry.call(void 0, this.config, this.http, "SuggestionsController_recordEvent", {
|
|
1723
1752
|
pathParams: { id },
|
|
1724
1753
|
jsonBody: event
|
|
1725
1754
|
});
|
|
@@ -1727,7 +1756,7 @@ var SuggestionsResource = class {
|
|
|
1727
1756
|
};
|
|
1728
1757
|
|
|
1729
1758
|
// src/index.ts
|
|
1730
|
-
var Modus = class extends
|
|
1759
|
+
var Modus = class extends _chunk3MHHVC6Ccjs.ModusClientBase {
|
|
1731
1760
|
constructor(options = {}) {
|
|
1732
1761
|
super(options);
|
|
1733
1762
|
this.scopes = new ScopesResource(this.http, this.config);
|
|
@@ -1761,5 +1790,5 @@ var Modus = class extends _chunkNA3ZD35Tcjs.ModusClientBase {
|
|
|
1761
1790
|
|
|
1762
1791
|
|
|
1763
1792
|
|
|
1764
|
-
exports.APIConnectionError =
|
|
1793
|
+
exports.APIConnectionError = _chunk3MHHVC6Ccjs.APIConnectionError; exports.AgentType = AgentType; exports.AuthenticationError = _chunk3MHHVC6Ccjs.AuthenticationError; exports.BadRequestError = _chunk3MHHVC6Ccjs.BadRequestError; exports.ChatSession = ChatSession; exports.ConflictError = _chunk3MHHVC6Ccjs.ConflictError; exports.InternalServerError = _chunk3MHHVC6Ccjs.InternalServerError; exports.Modus = Modus; exports.ModusError = _chunk3MHHVC6Ccjs.ModusError; exports.NotFoundError = _chunk3MHHVC6Ccjs.NotFoundError; exports.OPERATIONS = _chunk3MHHVC6Ccjs.OPERATIONS; exports.Page = _chunk3MHHVC6Ccjs.Page; exports.PermissionDeniedError = _chunk3MHHVC6Ccjs.PermissionDeniedError; exports.RateLimitError = _chunk3MHHVC6Ccjs.RateLimitError; exports.RunCancelledError = _chunk3MHHVC6Ccjs.RunCancelledError; exports.StreamTimeoutError = _chunk3MHHVC6Ccjs.StreamTimeoutError; exports.UnprocessableError = _chunk3MHHVC6Ccjs.UnprocessableError; exports.ValidationError = _chunk3MHHVC6Ccjs.ValidationError; exports.WorkflowType = WorkflowType; exports.conversationScopeId = conversationScopeId; exports.conversationSkillId = conversationSkillId;
|
|
1765
1794
|
//# sourceMappingURL=index.cjs.map
|