@gravity-rail/cli 0.32.0 → 0.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gr.js +236 -26
- package/dist/gr.js.map +1 -1
- package/dist/lib.js +94 -5
- package/dist/lib.js.map +1 -1
- package/package.json +2 -2
package/dist/lib.js
CHANGED
|
@@ -8624,6 +8624,12 @@ var qualificationsDomain = {
|
|
|
8624
8624
|
required: false
|
|
8625
8625
|
},
|
|
8626
8626
|
{ name: "goal", description: "Goal for the user simulator", required: false },
|
|
8627
|
+
{ name: "channel", description: "Run channel: web-chat | web-voice", required: false },
|
|
8628
|
+
{
|
|
8629
|
+
name: "anonymous",
|
|
8630
|
+
description: "Use an anonymous caller: true | false; otherwise inherit scenario",
|
|
8631
|
+
required: false
|
|
8632
|
+
},
|
|
8627
8633
|
{ name: "driver", description: "Driver mode: auto | human", required: false },
|
|
8628
8634
|
{
|
|
8629
8635
|
name: "workflow-revision-id",
|
|
@@ -8656,7 +8662,17 @@ var qualificationsDomain = {
|
|
|
8656
8662
|
required: false
|
|
8657
8663
|
}
|
|
8658
8664
|
],
|
|
8659
|
-
handler: async ({ ctx, workspace, args }) => {
|
|
8665
|
+
handler: async ({ ctx, workspace, args, data }) => {
|
|
8666
|
+
if (data !== void 0 || args["data"] !== void 0) {
|
|
8667
|
+
throw new CLIError(
|
|
8668
|
+
"runs start does not accept --data; use --channel, --anonymous and the named run flags"
|
|
8669
|
+
);
|
|
8670
|
+
}
|
|
8671
|
+
const channel = args["channel"];
|
|
8672
|
+
if (channel !== void 0 && channel !== "web-chat" && channel !== "web-voice") {
|
|
8673
|
+
throw new CLIError("--channel must be web-chat or web-voice");
|
|
8674
|
+
}
|
|
8675
|
+
const anonymous = optionalBool(args, "anonymous");
|
|
8660
8676
|
const driver = args["driver"] === "human" ? DriverMode2.HUMAN : DriverMode2.AUTO;
|
|
8661
8677
|
const scenarioId = args["scenario-id"] ? requireNumber(args, "scenario-id") : void 0;
|
|
8662
8678
|
const personaId = args["persona-id"] ? requireNumber(args, "persona-id") : void 0;
|
|
@@ -8680,6 +8696,8 @@ var qualificationsDomain = {
|
|
|
8680
8696
|
...args["workflow-revision-id"] ? { workflowRevisionId: requireNumber(args, "workflow-revision-id") } : {},
|
|
8681
8697
|
...args["workflow-revision-uuid"] ? { workflowRevisionUuid: String(args["workflow-revision-uuid"]) } : {},
|
|
8682
8698
|
...args["goal"] ? { goal: String(args["goal"]) } : {},
|
|
8699
|
+
...channel !== void 0 ? { channel } : {},
|
|
8700
|
+
...anonymous !== void 0 ? { anonymous } : {},
|
|
8683
8701
|
...args["assistant-chat-model-id"] ? { assistantChatModelId: String(args["assistant-chat-model-id"]) } : {},
|
|
8684
8702
|
...args["assistant-realtime-model-id"] ? {
|
|
8685
8703
|
assistantRealtimeModelId: String(args["assistant-realtime-model-id"])
|
|
@@ -10355,12 +10373,81 @@ var ActivityRefResolver = class {
|
|
|
10355
10373
|
forWorkspace.set(`${ref.kind}|${ref.uuid}`, ref);
|
|
10356
10374
|
byWorkspace.set(ref.workspaceUuid, forWorkspace);
|
|
10357
10375
|
}
|
|
10376
|
+
const groups = [...byWorkspace].map(
|
|
10377
|
+
([workspaceUuid, wanted]) => [workspaceUuid, [...wanted.values()]]
|
|
10378
|
+
);
|
|
10379
|
+
if (this.options.orgUuid) {
|
|
10380
|
+
await this.primeOrg(this.options.orgUuid, groups);
|
|
10381
|
+
return;
|
|
10382
|
+
}
|
|
10358
10383
|
await Promise.all(
|
|
10359
|
-
[
|
|
10360
|
-
([workspaceUuid, wanted]) => this.primeWorkspace(workspaceUuid, [...wanted.values()])
|
|
10361
|
-
)
|
|
10384
|
+
groups.map(([workspaceUuid, wanted]) => this.primeWorkspace(workspaceUuid, wanted))
|
|
10362
10385
|
);
|
|
10363
10386
|
}
|
|
10387
|
+
/**
|
|
10388
|
+
* One org call per chunk, each carrying whole workspace groups.
|
|
10389
|
+
*
|
|
10390
|
+
* The server's cap is over the whole request rather than per workspace, and
|
|
10391
|
+
* it accepts each workspace at most once per request — so a group larger
|
|
10392
|
+
* than the cap is split across requests, and smaller groups ride together
|
|
10393
|
+
* until the next one would not fit.
|
|
10394
|
+
*/
|
|
10395
|
+
async primeOrg(orgUuid, groups) {
|
|
10396
|
+
const chunks = [];
|
|
10397
|
+
let current = [];
|
|
10398
|
+
let size = 0;
|
|
10399
|
+
for (const [workspaceUuid, refs] of groups) {
|
|
10400
|
+
for (let start = 0; start < refs.length; start += MAX_REFS_PER_BATCH) {
|
|
10401
|
+
const slice = refs.slice(start, start + MAX_REFS_PER_BATCH);
|
|
10402
|
+
if (size + slice.length > MAX_REFS_PER_BATCH && current.length > 0) {
|
|
10403
|
+
chunks.push(current);
|
|
10404
|
+
current = [];
|
|
10405
|
+
size = 0;
|
|
10406
|
+
}
|
|
10407
|
+
current.push([workspaceUuid, slice]);
|
|
10408
|
+
size += slice.length;
|
|
10409
|
+
}
|
|
10410
|
+
}
|
|
10411
|
+
if (current.length > 0) chunks.push(current);
|
|
10412
|
+
for (const chunk of chunks) {
|
|
10413
|
+
const key = `org:${orgUuid}|${chunk.map(
|
|
10414
|
+
([workspaceUuid, refs]) => `${workspaceUuid}:${refs.map((ref) => `${ref.kind}|${ref.uuid}`).sort().join(",")}`
|
|
10415
|
+
).sort().join(";")}`;
|
|
10416
|
+
const pending = this.inFlight.get(key) ?? this.fetchOrgChunk(orgUuid, chunk, key);
|
|
10417
|
+
this.inFlight.set(key, pending);
|
|
10418
|
+
await pending;
|
|
10419
|
+
}
|
|
10420
|
+
}
|
|
10421
|
+
/** One org batch call, seeded into the same per-ref cache. */
|
|
10422
|
+
async fetchOrgChunk(orgUuid, chunk, key) {
|
|
10423
|
+
try {
|
|
10424
|
+
this.fetches += 1;
|
|
10425
|
+
const response = await this.client.resolveOrgEntityRefs(orgUuid, {
|
|
10426
|
+
workspaces: chunk.map(([workspaceUuid, refs]) => ({
|
|
10427
|
+
workspaceUuid,
|
|
10428
|
+
refs: refs.map((ref) => ({ kind: ref.kind, uuid: ref.uuid }))
|
|
10429
|
+
}))
|
|
10430
|
+
});
|
|
10431
|
+
const answered = new Map(
|
|
10432
|
+
response.workspaces.map((group) => [
|
|
10433
|
+
group.workspaceUuid,
|
|
10434
|
+
new Map(group.refs.map((entry) => [`${entry.kind}|${entry.uuid}`, entry]))
|
|
10435
|
+
])
|
|
10436
|
+
);
|
|
10437
|
+
for (const [workspaceUuid, refs] of chunk) {
|
|
10438
|
+
const byKey = answered.get(workspaceUuid);
|
|
10439
|
+
if (!byKey) continue;
|
|
10440
|
+
for (const ref of refs) {
|
|
10441
|
+
const entry = byKey.get(`${ref.kind}|${ref.uuid}`);
|
|
10442
|
+
if (!entry) continue;
|
|
10443
|
+
const resolution = batchResolution(ref, entry);
|
|
10444
|
+
if (resolution) this.cache.set(this.cacheKey(ref), Promise.resolve(resolution));
|
|
10445
|
+
}
|
|
10446
|
+
}
|
|
10447
|
+
} catch {
|
|
10448
|
+
this.inFlight.delete(key);
|
|
10449
|
+
}
|
|
10450
|
+
}
|
|
10364
10451
|
async primeWorkspace(workspaceUuid, refs) {
|
|
10365
10452
|
for (let start = 0; start < refs.length; start += MAX_REFS_PER_BATCH) {
|
|
10366
10453
|
const chunk = refs.slice(start, start + MAX_REFS_PER_BATCH);
|
|
@@ -10612,8 +10699,10 @@ function globalFlags(ctx) {
|
|
|
10612
10699
|
return flags;
|
|
10613
10700
|
}
|
|
10614
10701
|
function resolverFor(hctx) {
|
|
10702
|
+
const mount = resolveActivityMount(hctx.args);
|
|
10615
10703
|
return new ActivityRefResolver(requireAuth(hctx.ctx).apiClient, {
|
|
10616
|
-
bare: hctx.args.ids === true
|
|
10704
|
+
bare: hctx.args.ids === true,
|
|
10705
|
+
orgUuid: mount.kind === "org" ? mount.uuid : void 0
|
|
10617
10706
|
});
|
|
10618
10707
|
}
|
|
10619
10708
|
function isAggregate(response) {
|