@getmodus/sdk 0.10.0 → 0.12.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 +45 -1
- package/README.md +8 -1
- package/dist/{_client-base-H5rt5EGy.d.cts → _client-base-DvrAQWuU.d.cts} +837 -114
- package/dist/{_client-base-H5rt5EGy.d.ts → _client-base-DvrAQWuU.d.ts} +837 -114
- package/dist/{chunk-BMYCORZF.js → chunk-3CKUUDEJ.js} +75 -12
- package/dist/chunk-3CKUUDEJ.js.map +1 -0
- package/dist/{chunk-NA3ZD35T.cjs → chunk-QHA3LF2Q.cjs} +75 -12
- package/dist/chunk-QHA3LF2Q.cjs.map +1 -0
- package/dist/index.cjs +167 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -17
- package/dist/index.d.ts +47 -17
- package/dist/index.js +47 -18
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +274 -263
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +26 -7
- package/dist/management/index.d.ts +26 -7
- package/dist/management/index.js +18 -7
- 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 _chunkQHA3LF2Qcjs = require('./chunk-QHA3LF2Q.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, _chunkQHA3LF2Qcjs.ModusError)(event.message, { requestId: event.requestId });
|
|
165
|
+
if (event.type === "cancelled") throw new (0, _chunkQHA3LF2Qcjs.RunCancelledError)();
|
|
166
|
+
if (event.type === "stream_timeout") throw new (0, _chunkQHA3LF2Qcjs.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, _chunkQHA3LF2Qcjs.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, _chunkQHA3LF2Qcjs.ModusError)("resume() needs a finished run: await the chat first");
|
|
261
261
|
}
|
|
262
262
|
const { runId, threadId } = this.final;
|
|
263
|
-
|
|
263
|
+
_chunkQHA3LF2Qcjs.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,15 +331,16 @@ 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
|
-
|
|
334
|
+
if (target.kind !== "modus") _chunkQHA3LF2Qcjs.validateId.call(void 0, target.id, `${target.kind.slice(0, -1)}_id`);
|
|
335
|
+
const runsWithOwnModels = target.kind === "workflows";
|
|
336
|
+
if (!runsWithOwnModels) _chunkQHA3LF2Qcjs.validateChatModel.call(void 0, options.model);
|
|
337
|
+
const baseUrl = _chunkQHA3LF2Qcjs.requireAgentHost.call(void 0, config);
|
|
337
338
|
const sessionId = resolveAgentRunSessionId(effectiveThreadId(options.threadId));
|
|
338
339
|
return {
|
|
339
340
|
path: runsPath(target),
|
|
340
341
|
body: {
|
|
341
342
|
message,
|
|
342
|
-
config: { model: options.model },
|
|
343
|
+
...runsWithOwnModels ? {} : { config: { model: options.model } },
|
|
343
344
|
sessionId,
|
|
344
345
|
...config.organizationId !== void 0 ? { organizationId: config.organizationId } : {}
|
|
345
346
|
},
|
|
@@ -399,7 +400,7 @@ var WorkflowsResourceBase = class {
|
|
|
399
400
|
*/
|
|
400
401
|
list(options = {}) {
|
|
401
402
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
402
|
-
|
|
403
|
+
_chunkQHA3LF2Qcjs.validatePageSize.call(void 0, pageSize);
|
|
403
404
|
return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation);
|
|
404
405
|
}
|
|
405
406
|
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
@@ -408,12 +409,12 @@ var WorkflowsResourceBase = class {
|
|
|
408
409
|
if (type !== void 0) extra.type = type;
|
|
409
410
|
if (view !== void 0) extra.view = view;
|
|
410
411
|
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
411
|
-
const data =
|
|
412
|
-
await
|
|
413
|
-
query:
|
|
412
|
+
const data = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
413
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_list", {
|
|
414
|
+
query: _chunkQHA3LF2Qcjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
414
415
|
})
|
|
415
416
|
);
|
|
416
|
-
return
|
|
417
|
+
return _chunkQHA3LF2Qcjs.buildAipPage.call(void 0,
|
|
417
418
|
data,
|
|
418
419
|
"workflows",
|
|
419
420
|
(raw) => raw,
|
|
@@ -427,7 +428,7 @@ var WorkflowsResourceBase = class {
|
|
|
427
428
|
var RUNS_MAX_PAGE_SIZE = 100;
|
|
428
429
|
function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, search) {
|
|
429
430
|
const params = { pageSize };
|
|
430
|
-
const token =
|
|
431
|
+
const token = _chunkQHA3LF2Qcjs.normalizePageToken.call(void 0, pageToken);
|
|
431
432
|
if (token !== void 0) params.pageToken = token;
|
|
432
433
|
if (status !== void 0) params.status = status;
|
|
433
434
|
if (timeframe !== void 0) params.timeframe = timeframe;
|
|
@@ -437,7 +438,7 @@ function runsListParams(pageSize, pageToken, status, timeframe, approvalScope, s
|
|
|
437
438
|
}
|
|
438
439
|
function activeRunsParams(pageSize, pageToken) {
|
|
439
440
|
const params = { pageSize };
|
|
440
|
-
const token =
|
|
441
|
+
const token = _chunkQHA3LF2Qcjs.normalizePageToken.call(void 0, pageToken);
|
|
441
442
|
if (token !== void 0) params.pageToken = token;
|
|
442
443
|
return params;
|
|
443
444
|
}
|
|
@@ -445,26 +446,26 @@ function parseRun(raw) {
|
|
|
445
446
|
return raw;
|
|
446
447
|
}
|
|
447
448
|
function parseActiveRunsArray(raw) {
|
|
448
|
-
const data =
|
|
449
|
+
const data = _chunkQHA3LF2Qcjs.asRecord.call(void 0, raw);
|
|
449
450
|
const runs = data.runs;
|
|
450
451
|
if (!Array.isArray(runs)) {
|
|
451
|
-
throw new (0,
|
|
452
|
+
throw new (0, _chunkQHA3LF2Qcjs.ModusError)(
|
|
452
453
|
`Unexpected active runs response shape: runs must be a list, got ${typeof runs}.`
|
|
453
454
|
);
|
|
454
455
|
}
|
|
455
456
|
return runs;
|
|
456
457
|
}
|
|
457
458
|
function parseActiveRunsPage(raw, fetchPage) {
|
|
458
|
-
const data =
|
|
459
|
+
const data = _chunkQHA3LF2Qcjs.asRecord.call(void 0, raw);
|
|
459
460
|
const runs = data.runs;
|
|
460
461
|
if (!Array.isArray(runs)) {
|
|
461
|
-
throw new (0,
|
|
462
|
+
throw new (0, _chunkQHA3LF2Qcjs.ModusError)(
|
|
462
463
|
`Unexpected active runs response shape: runs must be a list, got ${typeof runs}.`
|
|
463
464
|
);
|
|
464
465
|
}
|
|
465
|
-
return new (0,
|
|
466
|
+
return new (0, _chunkQHA3LF2Qcjs.Page)(
|
|
466
467
|
runs,
|
|
467
|
-
|
|
468
|
+
_chunkQHA3LF2Qcjs.normalizePageToken.call(void 0,
|
|
468
469
|
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
469
470
|
),
|
|
470
471
|
fetchPage
|
|
@@ -478,7 +479,7 @@ function sessionIdFromBody(body) {
|
|
|
478
479
|
}
|
|
479
480
|
function requireSessionId(sessionId) {
|
|
480
481
|
if (!_optionalChain([sessionId, 'optionalAccess', _4 => _4.trim, 'call', _5 => _5()])) {
|
|
481
|
-
throw new (0,
|
|
482
|
+
throw new (0, _chunkQHA3LF2Qcjs.ValidationError)("sessionId must be the run's conversation id (a non-empty string)");
|
|
482
483
|
}
|
|
483
484
|
}
|
|
484
485
|
function makeAgentRunStream(runId, events) {
|
|
@@ -518,14 +519,14 @@ var WorkflowRunsResource = class {
|
|
|
518
519
|
* ```
|
|
519
520
|
*/
|
|
520
521
|
list(workflowId, options = {}) {
|
|
521
|
-
|
|
522
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
522
523
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
523
|
-
|
|
524
|
+
_chunkQHA3LF2Qcjs.validatePageSize.call(void 0, pageSize, RUNS_MAX_PAGE_SIZE);
|
|
524
525
|
return this.listPage(workflowId, pageSize, options.pageToken, options);
|
|
525
526
|
}
|
|
526
527
|
async listPage(workflowId, pageSize, pageToken, filters) {
|
|
527
|
-
const data =
|
|
528
|
-
await
|
|
528
|
+
const data = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
529
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowRunsController_list", {
|
|
529
530
|
pathParams: { id: workflowId },
|
|
530
531
|
query: runsListParams(
|
|
531
532
|
pageSize,
|
|
@@ -539,13 +540,13 @@ var WorkflowRunsResource = class {
|
|
|
539
540
|
);
|
|
540
541
|
const runs = data.runs;
|
|
541
542
|
if (!Array.isArray(runs)) {
|
|
542
|
-
throw new (0,
|
|
543
|
+
throw new (0, _chunkQHA3LF2Qcjs.ModusError)(
|
|
543
544
|
`Unexpected list response shape: runs must be a list, got ${typeof runs}.`
|
|
544
545
|
);
|
|
545
546
|
}
|
|
546
|
-
return new (0,
|
|
547
|
+
return new (0, _chunkQHA3LF2Qcjs.Page)(
|
|
547
548
|
runs,
|
|
548
|
-
|
|
549
|
+
_chunkQHA3LF2Qcjs.normalizePageToken.call(void 0,
|
|
549
550
|
typeof data.nextPageToken === "string" ? data.nextPageToken : void 0
|
|
550
551
|
),
|
|
551
552
|
(token) => this.listPage(workflowId, pageSize, token, filters)
|
|
@@ -567,10 +568,10 @@ var WorkflowRunsResource = class {
|
|
|
567
568
|
* ```
|
|
568
569
|
*/
|
|
569
570
|
async get(workflowId, runId, options = {}) {
|
|
570
|
-
|
|
571
|
-
if (!runId.trim()) throw new (0,
|
|
571
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
572
|
+
if (!runId.trim()) throw new (0, _chunkQHA3LF2Qcjs.ValidationError)("run_id must be a non-empty string");
|
|
572
573
|
const query = options.temporalRunId !== void 0 ? { temporalRunId: options.temporalRunId } : void 0;
|
|
573
|
-
const data = await
|
|
574
|
+
const data = await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowRunsController_get", {
|
|
574
575
|
pathParams: { id: workflowId, runId },
|
|
575
576
|
query
|
|
576
577
|
});
|
|
@@ -597,7 +598,7 @@ var WorkflowRunsResource = class {
|
|
|
597
598
|
* ```
|
|
598
599
|
*/
|
|
599
600
|
create(workflowId, body, options = {}) {
|
|
600
|
-
|
|
601
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
601
602
|
return this.createRun("WorkflowRunsController_create", body, { id: workflowId }, options);
|
|
602
603
|
}
|
|
603
604
|
/**
|
|
@@ -622,7 +623,7 @@ var WorkflowRunsResource = class {
|
|
|
622
623
|
* ```
|
|
623
624
|
*/
|
|
624
625
|
createScope(scopeId, body, options = {}) {
|
|
625
|
-
|
|
626
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, scopeId, "scope_id");
|
|
626
627
|
return this.createRun("ScopeRunsController_create", body, { id: scopeId }, options);
|
|
627
628
|
}
|
|
628
629
|
/**
|
|
@@ -670,7 +671,7 @@ var WorkflowRunsResource = class {
|
|
|
670
671
|
* ```
|
|
671
672
|
*/
|
|
672
673
|
resume(runId, body, options = {}) {
|
|
673
|
-
|
|
674
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, runId, "run_id");
|
|
674
675
|
requireSessionId(body.sessionId);
|
|
675
676
|
return this.createRun("ResumeRunsController_create", body, { runId }, options);
|
|
676
677
|
}
|
|
@@ -685,8 +686,8 @@ var WorkflowRunsResource = class {
|
|
|
685
686
|
* ```
|
|
686
687
|
*/
|
|
687
688
|
async cancel(runId) {
|
|
688
|
-
|
|
689
|
-
await
|
|
689
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, runId, "run_id");
|
|
690
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_cancel", {
|
|
690
691
|
pathParams: { runId },
|
|
691
692
|
jsonBody: {}
|
|
692
693
|
});
|
|
@@ -699,8 +700,8 @@ var WorkflowRunsResource = class {
|
|
|
699
700
|
* `status` and `done`.
|
|
700
701
|
*/
|
|
701
702
|
async events(runId) {
|
|
702
|
-
|
|
703
|
-
return await
|
|
703
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, runId, "run_id");
|
|
704
|
+
return await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_events", {
|
|
704
705
|
pathParams: { runId }
|
|
705
706
|
});
|
|
706
707
|
}
|
|
@@ -731,13 +732,13 @@ var WorkflowRunsResource = class {
|
|
|
731
732
|
* ```
|
|
732
733
|
*/
|
|
733
734
|
async interrupt(runId, nextRun, options = {}) {
|
|
734
|
-
|
|
735
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, runId, "run_id");
|
|
735
736
|
requireSessionId(nextRun.sessionId);
|
|
736
737
|
const jsonBody = {
|
|
737
738
|
nextRun: { ...nextRun, runId: _optionalChain([nextRun, 'access', _6 => _6.runId, 'optionalAccess', _7 => _7.trim, 'call', _8 => _8()]) || randomRunId() },
|
|
738
739
|
...options.lastSeenEventId ? { lastSeenEventId: options.lastSeenEventId } : {}
|
|
739
740
|
};
|
|
740
|
-
return await
|
|
741
|
+
return await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_interrupt", {
|
|
741
742
|
pathParams: { runId },
|
|
742
743
|
jsonBody
|
|
743
744
|
});
|
|
@@ -760,9 +761,9 @@ var WorkflowRunsResource = class {
|
|
|
760
761
|
* ```
|
|
761
762
|
*/
|
|
762
763
|
async editQueued(runId, nextRun) {
|
|
763
|
-
|
|
764
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, runId, "run_id");
|
|
764
765
|
requireSessionId(nextRun.sessionId);
|
|
765
|
-
return await
|
|
766
|
+
return await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_editQueued", {
|
|
766
767
|
pathParams: { runId },
|
|
767
768
|
jsonBody: { nextRun }
|
|
768
769
|
});
|
|
@@ -776,12 +777,12 @@ var WorkflowRunsResource = class {
|
|
|
776
777
|
*/
|
|
777
778
|
active(options = {}) {
|
|
778
779
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 50));
|
|
779
|
-
|
|
780
|
+
_chunkQHA3LF2Qcjs.validatePageSize.call(void 0, pageSize, RUNS_MAX_PAGE_SIZE);
|
|
780
781
|
return this.activePage(pageSize, options.pageToken);
|
|
781
782
|
}
|
|
782
783
|
async activePage(pageSize, pageToken) {
|
|
783
784
|
return parseActiveRunsPage(
|
|
784
|
-
await
|
|
785
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_active", {
|
|
785
786
|
query: activeRunsParams(pageSize, pageToken)
|
|
786
787
|
}),
|
|
787
788
|
(token) => this.activePage(pageSize, token)
|
|
@@ -797,10 +798,10 @@ var WorkflowRunsResource = class {
|
|
|
797
798
|
async activeBySession(sessionIds) {
|
|
798
799
|
const uniqueSessionIds = [...new Set(sessionIds.map((id) => id.trim()).filter(Boolean))];
|
|
799
800
|
if (uniqueSessionIds.length > 100) {
|
|
800
|
-
throw new (0,
|
|
801
|
+
throw new (0, _chunkQHA3LF2Qcjs.ValidationError)("sessionIds must contain at most 100 ids");
|
|
801
802
|
}
|
|
802
803
|
return parseActiveRunsArray(
|
|
803
|
-
await
|
|
804
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "RunLifecycleController_activeBySession", {
|
|
804
805
|
jsonBody: { sessionIds: uniqueSessionIds }
|
|
805
806
|
})
|
|
806
807
|
);
|
|
@@ -823,11 +824,11 @@ var WorkflowRunsResource = class {
|
|
|
823
824
|
* ```
|
|
824
825
|
*/
|
|
825
826
|
stream(runId, options = {}) {
|
|
826
|
-
|
|
827
|
-
const op =
|
|
828
|
-
const path =
|
|
827
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, runId, "run_id");
|
|
828
|
+
const op = _chunkQHA3LF2Qcjs.getOperation.call(void 0, "RunLifecycleController_stream");
|
|
829
|
+
const path = _chunkQHA3LF2Qcjs.formatOperationPath.call(void 0, "RunLifecycleController_stream", { runId });
|
|
829
830
|
const lines = this.http.streamGet(path, void 0, {
|
|
830
|
-
baseUrl:
|
|
831
|
+
baseUrl: _chunkQHA3LF2Qcjs.operationBaseUrl.call(void 0, this.http, op),
|
|
831
832
|
headers: options.lastEventId ? { "Last-Event-ID": options.lastEventId } : void 0
|
|
832
833
|
});
|
|
833
834
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
@@ -835,14 +836,14 @@ var WorkflowRunsResource = class {
|
|
|
835
836
|
createRun(operationId, body, pathParams, options) {
|
|
836
837
|
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
838
|
const sessionId = sessionIdFromBody(body);
|
|
838
|
-
const op =
|
|
839
|
-
const path =
|
|
839
|
+
const op = _chunkQHA3LF2Qcjs.getOperation.call(void 0, operationId);
|
|
840
|
+
const path = _chunkQHA3LF2Qcjs.formatOperationPath.call(void 0, operationId, pathParams);
|
|
840
841
|
const lines = this.http.streamPost(path, {
|
|
841
842
|
...body,
|
|
842
843
|
sessionId,
|
|
843
844
|
streamProtocolVersion: 2
|
|
844
845
|
}, {
|
|
845
|
-
baseUrl:
|
|
846
|
+
baseUrl: _chunkQHA3LF2Qcjs.operationBaseUrl.call(void 0, this.http, op),
|
|
846
847
|
headers: { "Idempotency-Key": runId }
|
|
847
848
|
});
|
|
848
849
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
@@ -872,10 +873,10 @@ var AgentWorkflowActionsResource = class {
|
|
|
872
873
|
*/
|
|
873
874
|
execute(body, options = {}) {
|
|
874
875
|
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 =
|
|
876
|
+
const op = _chunkQHA3LF2Qcjs.getOperation.call(void 0, "WorkflowActionsController_execute");
|
|
877
|
+
const path = _chunkQHA3LF2Qcjs.formatOperationPath.call(void 0, "WorkflowActionsController_execute");
|
|
877
878
|
const lines = this.http.streamPost(path, body, {
|
|
878
|
-
baseUrl:
|
|
879
|
+
baseUrl: _chunkQHA3LF2Qcjs.operationBaseUrl.call(void 0, this.http, op),
|
|
879
880
|
headers: { "Idempotency-Key": runId }
|
|
880
881
|
});
|
|
881
882
|
return makeAgentRunStream(runId, this.parseEvents(lines));
|
|
@@ -886,8 +887,8 @@ var AgentWorkflowActionsResource = class {
|
|
|
886
887
|
* @param runId - Action run id to cancel.
|
|
887
888
|
*/
|
|
888
889
|
async cancel(runId) {
|
|
889
|
-
|
|
890
|
-
await
|
|
890
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, runId, "run_id");
|
|
891
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowActionsController_cancel", {
|
|
891
892
|
pathParams: { runId },
|
|
892
893
|
jsonBody: {}
|
|
893
894
|
});
|
|
@@ -925,39 +926,38 @@ var WorkflowsResource = class extends WorkflowsResourceBase {
|
|
|
925
926
|
* ```
|
|
926
927
|
*/
|
|
927
928
|
async get(workflowId, options = {}) {
|
|
928
|
-
|
|
929
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, workflowId, "workflow_id");
|
|
929
930
|
const query = {};
|
|
930
931
|
if (options.view !== void 0) query.view = options.view;
|
|
931
932
|
if (options.includeVariation !== void 0) {
|
|
932
933
|
query.includeVariation = options.includeVariation;
|
|
933
934
|
}
|
|
934
|
-
const data = await
|
|
935
|
+
const data = await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "WorkflowsController_get", {
|
|
935
936
|
pathParams: { id: workflowId },
|
|
936
937
|
query: Object.keys(query).length > 0 ? query : void 0
|
|
937
938
|
});
|
|
938
939
|
return parseWorkflow(data);
|
|
939
940
|
}
|
|
940
941
|
/**
|
|
941
|
-
*
|
|
942
|
+
* Run a published workflow and stream its node output live from the agent
|
|
942
943
|
* host: iterate `textStream()` for tokens, or `await` the result for the
|
|
943
|
-
* workflow's final output.
|
|
944
|
+
* workflow's final output. Call it with no message to trigger a run with no input.
|
|
944
945
|
*
|
|
945
946
|
* @param workflowId - Numeric workflow id.
|
|
946
|
-
* @param message -
|
|
947
|
-
* @param options.model - Required model id (e.g. `"claude-sonnet-5.5"`).
|
|
947
|
+
* @param message - The run's input; omit it for a run with no input.
|
|
948
948
|
* @param options.threadId - Continue an existing conversation; omit to start new.
|
|
949
|
+
* @param options.model - Deprecated and ignored: each step uses the model set in the workflow.
|
|
949
950
|
* @returns A chat session — iterate it or `await` it for `content`, `threadId`, `runId`.
|
|
950
951
|
* @throws {ModusError} When no agent host is known for a custom `baseUrl`.
|
|
951
952
|
*
|
|
952
953
|
* @example
|
|
953
954
|
* ```ts
|
|
954
|
-
* const { content } = await client.workflows.chat(workflowId
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
* console.log(content)
|
|
955
|
+
* const { content } = await client.workflows.chat(workflowId)
|
|
956
|
+
* const digest = await client.workflows.chat(workflowId, "Run this week's digest")
|
|
957
|
+
* console.log(content, digest.content)
|
|
958
958
|
* ```
|
|
959
959
|
*/
|
|
960
|
-
chat(workflowId, message, options) {
|
|
960
|
+
chat(workflowId, message = "", options = {}) {
|
|
961
961
|
return startChat(this.http, this.config, { kind: "workflows", id: workflowId }, message, options);
|
|
962
962
|
}
|
|
963
963
|
};
|
|
@@ -986,18 +986,18 @@ var ConnectionsResourceBase = class {
|
|
|
986
986
|
*/
|
|
987
987
|
list(options = {}) {
|
|
988
988
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
989
|
-
|
|
989
|
+
_chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
996
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "ConnectionsController_list", {
|
|
997
|
+
query: _chunkQHA3LF2Qcjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
998
998
|
})
|
|
999
999
|
);
|
|
1000
|
-
return
|
|
1000
|
+
return _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, connectionId, "connection_id");
|
|
1049
1049
|
const pageSize = _nullishCoalesce(options.pageSize, () => ( 25));
|
|
1050
|
-
|
|
1050
|
+
_chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
1055
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "ConnectionsController_listSelections", {
|
|
1056
1056
|
pathParams: { connectionId },
|
|
1057
|
-
query:
|
|
1057
|
+
query: _chunkQHA3LF2Qcjs.aipListParams.call(void 0, pageSize, pageToken)
|
|
1058
1058
|
})
|
|
1059
1059
|
);
|
|
1060
|
-
return
|
|
1060
|
+
return _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsQueryController_query", {
|
|
1111
|
+
jsonBody: _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
1202
|
+
await _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
1257
|
+
await _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.validatePageSize.call(void 0, pageSize, _chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
1321
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "ContextItemsController_listValues", {
|
|
1293
1322
|
pathParams: { uid },
|
|
1294
|
-
query:
|
|
1323
|
+
query: _chunkQHA3LF2Qcjs.aipListParams.call(void 0, pageSize, pageToken, {
|
|
1295
1324
|
contextType,
|
|
1296
1325
|
contentKeyPath
|
|
1297
1326
|
})
|
|
1298
1327
|
})
|
|
1299
1328
|
);
|
|
1300
|
-
return
|
|
1329
|
+
return _chunkQHA3LF2Qcjs.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, _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, threadId, "thread_id");
|
|
1407
|
+
const data = await _chunkQHA3LF2Qcjs.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, _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
1458
|
+
await _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "ModusContextComposeController_compose", {
|
|
1496
|
+
jsonBody: _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
1572
|
+
await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopesController_list", {
|
|
1573
|
+
query: _chunkQHA3LF2Qcjs.aipListParams.call(void 0, pageSize, pageToken, extra)
|
|
1545
1574
|
})
|
|
1546
1575
|
);
|
|
1547
|
-
return
|
|
1576
|
+
return _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, scopeId, "scope_id");
|
|
1605
|
+
const data = await _chunkQHA3LF2Qcjs.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, _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, scopeId, "scope_id");
|
|
1656
|
+
const data = await _chunkQHA3LF2Qcjs.invokeWithRetry.call(void 0, this.config, this.http, "ScopeContextComposeController_compose", {
|
|
1628
1657
|
pathParams: { id: scopeId },
|
|
1629
|
-
jsonBody:
|
|
1658
|
+
jsonBody: _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.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, _chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.asRecord.call(void 0,
|
|
1732
|
+
await _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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
|
+
_chunkQHA3LF2Qcjs.validateId.call(void 0, id, "id");
|
|
1751
|
+
await _chunkQHA3LF2Qcjs.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 _chunkQHA3LF2Qcjs.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 = _chunkQHA3LF2Qcjs.APIConnectionError; exports.AgentType = AgentType; exports.AuthenticationError = _chunkQHA3LF2Qcjs.AuthenticationError; exports.BadRequestError = _chunkQHA3LF2Qcjs.BadRequestError; exports.ChatSession = ChatSession; exports.ConflictError = _chunkQHA3LF2Qcjs.ConflictError; exports.InternalServerError = _chunkQHA3LF2Qcjs.InternalServerError; exports.Modus = Modus; exports.ModusError = _chunkQHA3LF2Qcjs.ModusError; exports.NotFoundError = _chunkQHA3LF2Qcjs.NotFoundError; exports.OPERATIONS = _chunkQHA3LF2Qcjs.OPERATIONS; exports.Page = _chunkQHA3LF2Qcjs.Page; exports.PermissionDeniedError = _chunkQHA3LF2Qcjs.PermissionDeniedError; exports.RateLimitError = _chunkQHA3LF2Qcjs.RateLimitError; exports.RunCancelledError = _chunkQHA3LF2Qcjs.RunCancelledError; exports.StreamTimeoutError = _chunkQHA3LF2Qcjs.StreamTimeoutError; exports.UnprocessableError = _chunkQHA3LF2Qcjs.UnprocessableError; exports.ValidationError = _chunkQHA3LF2Qcjs.ValidationError; exports.WorkflowType = WorkflowType; exports.conversationScopeId = conversationScopeId; exports.conversationSkillId = conversationSkillId;
|
|
1765
1794
|
//# sourceMappingURL=index.cjs.map
|