@alva-ai/toolkit 0.23.1 → 0.25.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/README.md +19 -16
- package/dist/browser.global.js +31 -6
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +68 -12
- package/dist/cli.js +464 -63
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +71 -35
- package/dist/dispatch.js +1456 -390
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +325 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -10
- package/dist/index.d.ts +66 -10
- package/dist/index.js +324 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6143,6 +6143,134 @@ var FsResource = class {
|
|
|
6143
6143
|
}
|
|
6144
6144
|
};
|
|
6145
6145
|
|
|
6146
|
+
// src/jsonPayload.ts
|
|
6147
|
+
var MAX_SAFE_INTEGER_DIGITS = "9007199254740991";
|
|
6148
|
+
function scaledIntegerGreater(left, leftTrailingZeros, right, rightTrailingZeros) {
|
|
6149
|
+
const leftLength = left.length + leftTrailingZeros;
|
|
6150
|
+
const rightLength = right.length + rightTrailingZeros;
|
|
6151
|
+
if (leftLength !== rightLength) return leftLength > rightLength;
|
|
6152
|
+
for (let index = 0; index < leftLength; index++) {
|
|
6153
|
+
const leftDigit = index < left.length ? left[index] : "0";
|
|
6154
|
+
const rightDigit = index < right.length ? right[index] : "0";
|
|
6155
|
+
if (leftDigit !== rightDigit) return leftDigit > rightDigit;
|
|
6156
|
+
}
|
|
6157
|
+
return false;
|
|
6158
|
+
}
|
|
6159
|
+
function numberOutsideSafeRange(token) {
|
|
6160
|
+
const match = token.match(
|
|
6161
|
+
/^-?(?<whole>\d+)(?:\.(?<fraction>\d+))?(?:[eE](?<exponent>[+-]?\d+))?$/
|
|
6162
|
+
);
|
|
6163
|
+
if (!match?.groups) return true;
|
|
6164
|
+
const whole = match.groups.whole;
|
|
6165
|
+
const fraction = match.groups.fraction ?? "";
|
|
6166
|
+
const exponent = Number(match.groups.exponent ?? "0");
|
|
6167
|
+
if (!Number.isSafeInteger(exponent)) return true;
|
|
6168
|
+
const digits = (whole + fraction).replace(/^0+/, "") || "0";
|
|
6169
|
+
if (digits === "0") return false;
|
|
6170
|
+
const scale = exponent - fraction.length;
|
|
6171
|
+
return scale >= 0 ? scaledIntegerGreater(digits, scale, MAX_SAFE_INTEGER_DIGITS, 0) : scaledIntegerGreater(digits, 0, MAX_SAFE_INTEGER_DIGITS, -scale);
|
|
6172
|
+
}
|
|
6173
|
+
function validateJSONNumberTokens(raw) {
|
|
6174
|
+
let index = 0;
|
|
6175
|
+
while (index < raw.length) {
|
|
6176
|
+
if (raw[index] === '"') {
|
|
6177
|
+
index++;
|
|
6178
|
+
while (index < raw.length) {
|
|
6179
|
+
if (raw[index] === "\\") {
|
|
6180
|
+
index += 2;
|
|
6181
|
+
} else if (raw[index++] === '"') {
|
|
6182
|
+
break;
|
|
6183
|
+
}
|
|
6184
|
+
}
|
|
6185
|
+
continue;
|
|
6186
|
+
}
|
|
6187
|
+
if (raw[index] === "-" || /\d/.test(raw[index] ?? "")) {
|
|
6188
|
+
const match = raw.slice(index).match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);
|
|
6189
|
+
if (match) {
|
|
6190
|
+
if (numberOutsideSafeRange(match[0])) {
|
|
6191
|
+
throw new TypeError(
|
|
6192
|
+
"args contains a number outside JavaScript's safe range; use a string for int64 and identifier values"
|
|
6193
|
+
);
|
|
6194
|
+
}
|
|
6195
|
+
index += match[0].length;
|
|
6196
|
+
continue;
|
|
6197
|
+
}
|
|
6198
|
+
}
|
|
6199
|
+
index++;
|
|
6200
|
+
}
|
|
6201
|
+
}
|
|
6202
|
+
function assertPlainJSONData(value, path, seen) {
|
|
6203
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
6204
|
+
return;
|
|
6205
|
+
if (typeof value === "number") {
|
|
6206
|
+
if (!Number.isFinite(value)) {
|
|
6207
|
+
throw new TypeError(`${path} must contain only finite numbers`);
|
|
6208
|
+
}
|
|
6209
|
+
if (Number.isInteger(value) && !Number.isSafeInteger(value)) {
|
|
6210
|
+
throw new TypeError(
|
|
6211
|
+
`${path} contains a number outside JavaScript's safe range; use a string for int64 and identifier values`
|
|
6212
|
+
);
|
|
6213
|
+
}
|
|
6214
|
+
return;
|
|
6215
|
+
}
|
|
6216
|
+
if (typeof value !== "object") {
|
|
6217
|
+
throw new TypeError(`${path} must contain only JSON data`);
|
|
6218
|
+
}
|
|
6219
|
+
if (seen.has(value)) {
|
|
6220
|
+
throw new TypeError(`${path} must not contain circular references`);
|
|
6221
|
+
}
|
|
6222
|
+
seen.add(value);
|
|
6223
|
+
if (Array.isArray(value)) {
|
|
6224
|
+
value.forEach(
|
|
6225
|
+
(item, index) => assertPlainJSONData(item, `${path}[${index}]`, seen)
|
|
6226
|
+
);
|
|
6227
|
+
} else {
|
|
6228
|
+
const prototype = Object.getPrototypeOf(value);
|
|
6229
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
6230
|
+
throw new TypeError(`${path} must contain only plain JSON objects`);
|
|
6231
|
+
}
|
|
6232
|
+
for (const [key, descriptor] of Object.entries(
|
|
6233
|
+
Object.getOwnPropertyDescriptors(value)
|
|
6234
|
+
)) {
|
|
6235
|
+
if (!descriptor.enumerable) continue;
|
|
6236
|
+
if (!("value" in descriptor)) {
|
|
6237
|
+
throw new TypeError(`${path} must not contain accessors`);
|
|
6238
|
+
}
|
|
6239
|
+
assertPlainJSONData(descriptor.value, `${path}.${key}`, seen);
|
|
6240
|
+
}
|
|
6241
|
+
}
|
|
6242
|
+
seen.delete(value);
|
|
6243
|
+
}
|
|
6244
|
+
function serializeStructuredArgs(value) {
|
|
6245
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
6246
|
+
throw new TypeError("args must be a JSON object");
|
|
6247
|
+
}
|
|
6248
|
+
assertPlainJSONData(value, "args", /* @__PURE__ */ new Set());
|
|
6249
|
+
const serialized = JSON.stringify(value);
|
|
6250
|
+
validateSerializedArgs(serialized);
|
|
6251
|
+
return serialized;
|
|
6252
|
+
}
|
|
6253
|
+
function validateSerializedArgs(raw) {
|
|
6254
|
+
const value = JSON.parse(raw);
|
|
6255
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
6256
|
+
throw new TypeError("args must be a JSON object");
|
|
6257
|
+
}
|
|
6258
|
+
validateJSONNumberTokens(raw);
|
|
6259
|
+
}
|
|
6260
|
+
function objectWithRawJSONField(fields, fieldName, rawValue) {
|
|
6261
|
+
const entries = Object.entries(fields).filter(
|
|
6262
|
+
([key, value]) => value !== void 0 && (rawValue === void 0 || key !== fieldName)
|
|
6263
|
+
);
|
|
6264
|
+
if (rawValue !== void 0) {
|
|
6265
|
+
validateSerializedArgs(rawValue);
|
|
6266
|
+
entries.push([fieldName, rawValue]);
|
|
6267
|
+
}
|
|
6268
|
+
return `{${entries.map(([key, value]) => {
|
|
6269
|
+
const encodedValue = key === fieldName && rawValue !== void 0 ? rawValue : JSON.stringify(value);
|
|
6270
|
+
return `${JSON.stringify(key)}:${encodedValue}`;
|
|
6271
|
+
}).join(",")}}`;
|
|
6272
|
+
}
|
|
6273
|
+
|
|
6146
6274
|
// src/resources/run.ts
|
|
6147
6275
|
var RunResource = class {
|
|
6148
6276
|
constructor(client) {
|
|
@@ -6151,13 +6279,24 @@ var RunResource = class {
|
|
|
6151
6279
|
client;
|
|
6152
6280
|
async execute(params) {
|
|
6153
6281
|
this.client._requireAuth();
|
|
6282
|
+
return params.args === void 0 ? this.request(params) : this.request(params, serializeStructuredArgs(params.args));
|
|
6283
|
+
}
|
|
6284
|
+
/** @internal Used by the CLI to preserve the exact --args JSON text. */
|
|
6285
|
+
async _executeSerializedArgs(params, serializedArgs) {
|
|
6286
|
+
this.client._requireAuth();
|
|
6287
|
+
return this.request(params, serializedArgs);
|
|
6288
|
+
}
|
|
6289
|
+
request(params, serializedArgs) {
|
|
6290
|
+
const body = {
|
|
6291
|
+
code: params.code,
|
|
6292
|
+
entry_path: params.entry_path,
|
|
6293
|
+
working_dir: params.working_dir,
|
|
6294
|
+
args: params.args,
|
|
6295
|
+
max_heap_size_mb: params.max_heap_size_mb
|
|
6296
|
+
};
|
|
6154
6297
|
return this.client._request("POST", "/api/v1/run", {
|
|
6155
|
-
body: {
|
|
6156
|
-
|
|
6157
|
-
entry_path: params.entry_path,
|
|
6158
|
-
working_dir: params.working_dir,
|
|
6159
|
-
args: params.args,
|
|
6160
|
-
max_heap_size_mb: params.max_heap_size_mb
|
|
6298
|
+
...serializedArgs === void 0 ? { body } : {
|
|
6299
|
+
jsonBody: objectWithRawJSONField(body, "args", serializedArgs)
|
|
6161
6300
|
},
|
|
6162
6301
|
timeoutMs: params.timeout_ms
|
|
6163
6302
|
});
|
|
@@ -6172,19 +6311,30 @@ var DeployResource = class {
|
|
|
6172
6311
|
client;
|
|
6173
6312
|
async create(params) {
|
|
6174
6313
|
this.client._requireAuth();
|
|
6314
|
+
return params.args === void 0 ? this.createRequest(params) : this.createRequest(params, serializeStructuredArgs(params.args));
|
|
6315
|
+
}
|
|
6316
|
+
/** @internal Used by the CLI to preserve the exact --args JSON text. */
|
|
6317
|
+
async _createSerializedArgs(params, serializedArgs) {
|
|
6318
|
+
this.client._requireAuth();
|
|
6319
|
+
return this.createRequest(params, serializedArgs);
|
|
6320
|
+
}
|
|
6321
|
+
createRequest(params, serializedArgs) {
|
|
6322
|
+
const body = {
|
|
6323
|
+
name: params.name,
|
|
6324
|
+
path: params.path,
|
|
6325
|
+
cron_expression: params.cron_expression,
|
|
6326
|
+
args: params.args,
|
|
6327
|
+
push_notify: params.push_notify,
|
|
6328
|
+
max_heap_size_mb: params.max_heap_size_mb,
|
|
6329
|
+
execution_timeout_seconds: params.execution_timeout_seconds,
|
|
6330
|
+
run_as_user_id: params.run_as_user_id,
|
|
6331
|
+
start_at: params.start_at,
|
|
6332
|
+
end_at: params.end_at,
|
|
6333
|
+
max_runs: params.max_runs
|
|
6334
|
+
};
|
|
6175
6335
|
return this.client._request("POST", "/api/v1/deploy/cronjob", {
|
|
6176
|
-
body: {
|
|
6177
|
-
|
|
6178
|
-
path: params.path,
|
|
6179
|
-
cron_expression: params.cron_expression,
|
|
6180
|
-
args: params.args,
|
|
6181
|
-
push_notify: params.push_notify,
|
|
6182
|
-
max_heap_size_mb: params.max_heap_size_mb,
|
|
6183
|
-
execution_timeout_seconds: params.execution_timeout_seconds,
|
|
6184
|
-
run_as_user_id: params.run_as_user_id,
|
|
6185
|
-
start_at: params.start_at,
|
|
6186
|
-
end_at: params.end_at,
|
|
6187
|
-
max_runs: params.max_runs
|
|
6336
|
+
...serializedArgs === void 0 ? { body } : {
|
|
6337
|
+
jsonBody: objectWithRawJSONField(body, "args", serializedArgs)
|
|
6188
6338
|
}
|
|
6189
6339
|
});
|
|
6190
6340
|
}
|
|
@@ -6203,9 +6353,19 @@ var DeployResource = class {
|
|
|
6203
6353
|
}
|
|
6204
6354
|
async update(params) {
|
|
6205
6355
|
this.client._requireAuth();
|
|
6356
|
+
return params.args === void 0 ? this.updateRequest(params) : this.updateRequest(params, serializeStructuredArgs(params.args));
|
|
6357
|
+
}
|
|
6358
|
+
/** @internal Used by the CLI to preserve the exact --args JSON text. */
|
|
6359
|
+
async _updateSerializedArgs(params, serializedArgs) {
|
|
6360
|
+
this.client._requireAuth();
|
|
6361
|
+
return this.updateRequest(params, serializedArgs);
|
|
6362
|
+
}
|
|
6363
|
+
updateRequest(params, serializedArgs) {
|
|
6206
6364
|
const { id, ...body } = params;
|
|
6207
6365
|
return this.client._request("PATCH", `/api/v1/deploy/cronjob/${id}`, {
|
|
6208
|
-
body
|
|
6366
|
+
...serializedArgs === void 0 ? { body } : {
|
|
6367
|
+
jsonBody: objectWithRawJSONField(body, "args", serializedArgs)
|
|
6368
|
+
}
|
|
6209
6369
|
});
|
|
6210
6370
|
}
|
|
6211
6371
|
async delete(params) {
|
|
@@ -6454,18 +6614,53 @@ var FeedResource = class {
|
|
|
6454
6614
|
}
|
|
6455
6615
|
};
|
|
6456
6616
|
function requireFeedID(id) {
|
|
6457
|
-
if (
|
|
6617
|
+
if (typeof id === "string") {
|
|
6618
|
+
if (!/^[1-9]\d*$/.test(id)) {
|
|
6619
|
+
throw new Error("feed id must be a positive integer");
|
|
6620
|
+
}
|
|
6621
|
+
return id;
|
|
6622
|
+
}
|
|
6623
|
+
if (!Number.isSafeInteger(id) || id <= 0) {
|
|
6458
6624
|
throw new Error("feed id must be a positive integer");
|
|
6459
6625
|
}
|
|
6460
6626
|
return id;
|
|
6461
6627
|
}
|
|
6462
6628
|
|
|
6463
6629
|
// src/resources/automation.ts
|
|
6630
|
+
var AUTOMATION_ALERT_DELIVERY_QUERY = `
|
|
6631
|
+
query ToolkitAutomationAlertDelivery($automationId: ID!) {
|
|
6632
|
+
automation(id: $automationId) {
|
|
6633
|
+
alertDelivery {
|
|
6634
|
+
isEnabled
|
|
6635
|
+
alvaChannels { id }
|
|
6636
|
+
email { isEnabled isAvailable address }
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
`.trim();
|
|
6641
|
+
var UPDATE_AUTOMATION_ALERT_DELIVERY = `
|
|
6642
|
+
mutation ToolkitUpdateAutomationAlertDelivery(
|
|
6643
|
+
$input: UpdateAutomationAlertDeliveryInput!
|
|
6644
|
+
$includeAlvaChannels: Boolean!
|
|
6645
|
+
$includeEmail: Boolean!
|
|
6646
|
+
) {
|
|
6647
|
+
updateAutomationAlertDelivery(input: $input) {
|
|
6648
|
+
automation { id }
|
|
6649
|
+
alertDelivery {
|
|
6650
|
+
isEnabled
|
|
6651
|
+
alvaChannels @include(if: $includeAlvaChannels) { id }
|
|
6652
|
+
email @include(if: $includeEmail) { isEnabled isAvailable address }
|
|
6653
|
+
}
|
|
6654
|
+
}
|
|
6655
|
+
}
|
|
6656
|
+
`.trim();
|
|
6464
6657
|
var AutomationResource = class {
|
|
6465
6658
|
constructor(client) {
|
|
6466
6659
|
this.client = client;
|
|
6660
|
+
this.delivery = new AutomationAlertDeliveryResource(client);
|
|
6467
6661
|
}
|
|
6468
6662
|
client;
|
|
6663
|
+
delivery;
|
|
6469
6664
|
list(params = {}) {
|
|
6470
6665
|
return this.client.feed.list(params);
|
|
6471
6666
|
}
|
|
@@ -6517,8 +6712,93 @@ var AutomationResource = class {
|
|
|
6517
6712
|
return this.client.release.feed(params);
|
|
6518
6713
|
}
|
|
6519
6714
|
};
|
|
6715
|
+
var AutomationAlertDeliveryResource = class {
|
|
6716
|
+
constructor(client) {
|
|
6717
|
+
this.client = client;
|
|
6718
|
+
}
|
|
6719
|
+
client;
|
|
6720
|
+
async get(params) {
|
|
6721
|
+
this.client._requireAuth();
|
|
6722
|
+
const id = requireAutomationIDString(params.id);
|
|
6723
|
+
const data = await this.graphql(
|
|
6724
|
+
AUTOMATION_ALERT_DELIVERY_QUERY,
|
|
6725
|
+
{ automationId: id }
|
|
6726
|
+
);
|
|
6727
|
+
const delivery = data.automation?.alertDelivery;
|
|
6728
|
+
if (!delivery) {
|
|
6729
|
+
throw new AlvaError(
|
|
6730
|
+
"GRAPHQL_EMPTY_RESPONSE",
|
|
6731
|
+
"GraphQL response did not include automation.alertDelivery",
|
|
6732
|
+
502
|
|
6733
|
+
);
|
|
6734
|
+
}
|
|
6735
|
+
return delivery;
|
|
6736
|
+
}
|
|
6737
|
+
async update(params) {
|
|
6738
|
+
this.client._requireAuth();
|
|
6739
|
+
const id = requireAutomationIDString(params.id);
|
|
6740
|
+
const includeAlvaChannels = params.alvaChannelIds !== void 0;
|
|
6741
|
+
const includeEmail = params.emailEnabled !== void 0;
|
|
6742
|
+
if (!includeAlvaChannels && !includeEmail) {
|
|
6743
|
+
throw new Error(
|
|
6744
|
+
"automation delivery update requires alvaChannelIds or emailEnabled"
|
|
6745
|
+
);
|
|
6746
|
+
}
|
|
6747
|
+
const alvaChannelIds = includeAlvaChannels ? uniqueAlvaChannelIDs(params.alvaChannelIds ?? []) : void 0;
|
|
6748
|
+
const data = await this.graphql(
|
|
6749
|
+
UPDATE_AUTOMATION_ALERT_DELIVERY,
|
|
6750
|
+
{
|
|
6751
|
+
input: {
|
|
6752
|
+
automationId: id,
|
|
6753
|
+
...includeAlvaChannels ? { alvaChannelIds } : {},
|
|
6754
|
+
...includeEmail ? { emailEnabled: params.emailEnabled } : {}
|
|
6755
|
+
},
|
|
6756
|
+
includeAlvaChannels,
|
|
6757
|
+
includeEmail
|
|
6758
|
+
}
|
|
6759
|
+
);
|
|
6760
|
+
const result = data.updateAutomationAlertDelivery;
|
|
6761
|
+
if (!result) {
|
|
6762
|
+
throw new AlvaError(
|
|
6763
|
+
"GRAPHQL_EMPTY_RESPONSE",
|
|
6764
|
+
"GraphQL response did not include updateAutomationAlertDelivery",
|
|
6765
|
+
502
|
|
6766
|
+
);
|
|
6767
|
+
}
|
|
6768
|
+
return result;
|
|
6769
|
+
}
|
|
6770
|
+
async graphql(query, variables) {
|
|
6771
|
+
const response = await this.client._request("POST", "/query", {
|
|
6772
|
+
body: { query, variables }
|
|
6773
|
+
});
|
|
6774
|
+
if (!response) {
|
|
6775
|
+
throw new AlvaError(
|
|
6776
|
+
"GRAPHQL_EMPTY_RESPONSE",
|
|
6777
|
+
"GraphQL response was empty",
|
|
6778
|
+
502
|
|
6779
|
+
);
|
|
6780
|
+
}
|
|
6781
|
+
if (response.errors && response.errors.length > 0) {
|
|
6782
|
+
throw new AlvaError(
|
|
6783
|
+
"GRAPHQL_ERROR",
|
|
6784
|
+
graphQLErrorMessage(response.errors),
|
|
6785
|
+
400,
|
|
6786
|
+
{ errors: response.errors }
|
|
6787
|
+
);
|
|
6788
|
+
}
|
|
6789
|
+
if (!response.data) {
|
|
6790
|
+
throw new AlvaError(
|
|
6791
|
+
"GRAPHQL_EMPTY_RESPONSE",
|
|
6792
|
+
"GraphQL response did not include data",
|
|
6793
|
+
502
|
|
6794
|
+
);
|
|
6795
|
+
}
|
|
6796
|
+
return response.data;
|
|
6797
|
+
}
|
|
6798
|
+
};
|
|
6520
6799
|
function requireAutomationID(id) {
|
|
6521
|
-
if (
|
|
6800
|
+
if (typeof id === "string") return requireAutomationIDString(id);
|
|
6801
|
+
if (!Number.isSafeInteger(id) || id <= 0) {
|
|
6522
6802
|
throw new Error("automation id must be a positive integer");
|
|
6523
6803
|
}
|
|
6524
6804
|
return id;
|
|
@@ -6532,6 +6812,23 @@ function requireAutomationIDString(id) {
|
|
|
6532
6812
|
function hasAutomationUpdate(params) {
|
|
6533
6813
|
return params.version !== void 0 || params.cronjob_id !== void 0 || params.description !== void 0 || params.changelog !== void 0 || params.agent_type !== void 0 || params.trigger === true;
|
|
6534
6814
|
}
|
|
6815
|
+
function uniqueAlvaChannelIDs(values) {
|
|
6816
|
+
const ids = [...new Set(values)];
|
|
6817
|
+
for (const id of ids) {
|
|
6818
|
+
if (!/^(0|[1-9]\d*)$/.test(id)) {
|
|
6819
|
+
throw new Error(
|
|
6820
|
+
"Alva channel ids must be positive integer strings or the agent sentinel 0"
|
|
6821
|
+
);
|
|
6822
|
+
}
|
|
6823
|
+
}
|
|
6824
|
+
return ids;
|
|
6825
|
+
}
|
|
6826
|
+
function graphQLErrorMessage(errors) {
|
|
6827
|
+
const messages = errors.map(
|
|
6828
|
+
(error) => error && typeof error.message === "string" && error.message ? error.message : void 0
|
|
6829
|
+
).filter((message) => Boolean(message));
|
|
6830
|
+
return messages.length > 0 ? messages.join("; ") : "GraphQL request failed";
|
|
6831
|
+
}
|
|
6535
6832
|
|
|
6536
6833
|
// src/resources/playbooks.ts
|
|
6537
6834
|
var PLAYBOOK_VISIBILITIES = [
|
|
@@ -8388,7 +8685,7 @@ query ToolkitCreditWalletItems($input: CreditWalletItemConnectionInput!) {
|
|
|
8388
8685
|
}
|
|
8389
8686
|
}
|
|
8390
8687
|
`.trim();
|
|
8391
|
-
function
|
|
8688
|
+
function graphQLErrorMessage2(errors) {
|
|
8392
8689
|
const messages = errors.map(
|
|
8393
8690
|
(error) => typeof error.message === "string" && error.message ? error.message : void 0
|
|
8394
8691
|
).filter((message) => Boolean(message));
|
|
@@ -8443,7 +8740,7 @@ var CreditsResource = class {
|
|
|
8443
8740
|
if (response.errors && response.errors.length > 0) {
|
|
8444
8741
|
throw new AlvaError(
|
|
8445
8742
|
"GRAPHQL_ERROR",
|
|
8446
|
-
|
|
8743
|
+
graphQLErrorMessage2(response.errors),
|
|
8447
8744
|
400,
|
|
8448
8745
|
{ errors: response.errors }
|
|
8449
8746
|
);
|
|
@@ -8600,7 +8897,7 @@ query ToolkitCompanyEarnings($ticker: String!, $input: CompanyEarningsInput) {
|
|
|
8600
8897
|
}
|
|
8601
8898
|
}
|
|
8602
8899
|
`.trim();
|
|
8603
|
-
function
|
|
8900
|
+
function graphQLErrorMessage3(errors) {
|
|
8604
8901
|
const messages = errors.map(
|
|
8605
8902
|
(error) => typeof error.message === "string" && error.message ? error.message : void 0
|
|
8606
8903
|
).filter((message) => Boolean(message));
|
|
@@ -8756,7 +9053,7 @@ var MarketsResource = class {
|
|
|
8756
9053
|
if (response.errors && response.errors.length > 0) {
|
|
8757
9054
|
throw new AlvaError(
|
|
8758
9055
|
"GRAPHQL_ERROR",
|
|
8759
|
-
|
|
9056
|
+
graphQLErrorMessage3(response.errors),
|
|
8760
9057
|
400,
|
|
8761
9058
|
{ errors: response.errors }
|
|
8762
9059
|
);
|
|
@@ -9451,6 +9748,12 @@ var COMMAND_DEFINITIONS = [
|
|
|
9451
9748
|
],
|
|
9452
9749
|
booleans: ["trigger"]
|
|
9453
9750
|
}),
|
|
9751
|
+
command("automation delivery"),
|
|
9752
|
+
command("automation delivery get", { values: ["id"] }),
|
|
9753
|
+
command("automation delivery update", {
|
|
9754
|
+
values: ["id", "alva-channel-ids"],
|
|
9755
|
+
booleans: ["email-enabled"]
|
|
9756
|
+
}),
|
|
9454
9757
|
command("automation stop", { values: ["id"] }),
|
|
9455
9758
|
command("automation resume", { values: ["id"] }),
|
|
9456
9759
|
command("automation delete", { values: ["id"] }),
|
|
@@ -9728,7 +10031,7 @@ var COMMAND_DEFINITIONS = [
|
|
|
9728
10031
|
command("broker", { passthrough: true })
|
|
9729
10032
|
];
|
|
9730
10033
|
|
|
9731
|
-
// src/cli/
|
|
10034
|
+
// src/cli/commandParser.ts
|
|
9732
10035
|
function buildCommandTree(definitions) {
|
|
9733
10036
|
const root = { children: /* @__PURE__ */ new Map() };
|
|
9734
10037
|
for (const definition of definitions) {
|
|
@@ -9758,7 +10061,6 @@ function buildCommandTree(definitions) {
|
|
|
9758
10061
|
}
|
|
9759
10062
|
return root;
|
|
9760
10063
|
}
|
|
9761
|
-
var COMMAND_TREE = buildCommandTree(COMMAND_DEFINITIONS);
|
|
9762
10064
|
function editDistance(a, b) {
|
|
9763
10065
|
let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
9764
10066
|
for (let row = 1; row <= a.length; row++) {
|
|
@@ -9787,11 +10089,11 @@ function closestFlag(input, available) {
|
|
|
9787
10089
|
const threshold = input.length <= 4 ? 1 : 2;
|
|
9788
10090
|
return distance <= threshold ? closest : void 0;
|
|
9789
10091
|
}
|
|
9790
|
-
function mergeFlags(definition) {
|
|
9791
|
-
return { ...
|
|
10092
|
+
function mergeFlags(definition, globalFlags) {
|
|
10093
|
+
return { ...globalFlags, ...definition.flags };
|
|
9792
10094
|
}
|
|
9793
|
-
function resolveCommand(args) {
|
|
9794
|
-
let node =
|
|
10095
|
+
function resolveCommand(args, tree) {
|
|
10096
|
+
let node = tree;
|
|
9795
10097
|
let consumed = 0;
|
|
9796
10098
|
while (consumed < args.length) {
|
|
9797
10099
|
const input = args[consumed];
|
|
@@ -9831,8 +10133,8 @@ function unsupportedFlag(name, definition, available) {
|
|
|
9831
10133
|
definition.path[0]
|
|
9832
10134
|
);
|
|
9833
10135
|
}
|
|
9834
|
-
function
|
|
9835
|
-
const { definition, consumed } = resolveCommand(args);
|
|
10136
|
+
function parseWithTree(args, tree, globalFlags) {
|
|
10137
|
+
const { definition, consumed } = resolveCommand(args, tree);
|
|
9836
10138
|
if (definition.passthrough === true) {
|
|
9837
10139
|
return {
|
|
9838
10140
|
path: definition.path,
|
|
@@ -9841,7 +10143,7 @@ function parseCommand(args) {
|
|
|
9841
10143
|
passthrough: args.slice(consumed)
|
|
9842
10144
|
};
|
|
9843
10145
|
}
|
|
9844
|
-
const available = mergeFlags(definition);
|
|
10146
|
+
const available = mergeFlags(definition, globalFlags);
|
|
9845
10147
|
const flags = {};
|
|
9846
10148
|
const positionals = [];
|
|
9847
10149
|
for (let index = consumed; index < args.length; index++) {
|
|
@@ -9923,6 +10225,16 @@ function parseCommand(args) {
|
|
|
9923
10225
|
positionals
|
|
9924
10226
|
};
|
|
9925
10227
|
}
|
|
10228
|
+
function createCommandParser(definitions, globalFlags) {
|
|
10229
|
+
const tree = buildCommandTree(definitions);
|
|
10230
|
+
return (args) => parseWithTree(args, tree, globalFlags);
|
|
10231
|
+
}
|
|
10232
|
+
|
|
10233
|
+
// src/cli/commandSchema.ts
|
|
10234
|
+
var parseCommand = createCommandParser(
|
|
10235
|
+
COMMAND_DEFINITIONS,
|
|
10236
|
+
GLOBAL_FLAG_DEFINITIONS
|
|
10237
|
+
);
|
|
9926
10238
|
|
|
9927
10239
|
// src/cli/pkce.ts
|
|
9928
10240
|
import * as crypto from "crypto";
|
|
@@ -13976,7 +14288,7 @@ ${formatReport(report, "human")}
|
|
|
13976
14288
|
}
|
|
13977
14289
|
|
|
13978
14290
|
// src/cli/dispatch.ts
|
|
13979
|
-
var CLI_VERSION = true ? "0.
|
|
14291
|
+
var CLI_VERSION = true ? "0.25.0" : "dev";
|
|
13980
14292
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
13981
14293
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
13982
14294
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -14022,7 +14334,7 @@ Commands:
|
|
|
14022
14334
|
service-account Restricted run-as identities (create, list, delete, grant, revoke)
|
|
14023
14335
|
release Feed and playbook releases (feed, playbook-draft, playbook)
|
|
14024
14336
|
lint Design-system lint (playbook)
|
|
14025
|
-
automation Automation management (list, inspect, publish, update, stop, resume, delete)
|
|
14337
|
+
automation Automation management (list, inspect, publish, update, delivery, stop, resume, delete)
|
|
14026
14338
|
alert Alert management (list, follows, enable, disable, history, preferences, enable-session-completed, disable-session-completed)
|
|
14027
14339
|
feed Legacy automation alias (list, stop, resume, delete, set-visibility)
|
|
14028
14340
|
playbooks Playbook discovery (trending, get, list) and visibility
|
|
@@ -14450,6 +14762,7 @@ Subcommands:
|
|
|
14450
14762
|
inspect Inspect one automation and show its flow config path when available
|
|
14451
14763
|
publish First-publish/register a new automation after deploying its cronjob
|
|
14452
14764
|
update Partially update an existing automation by numeric id
|
|
14765
|
+
delivery Get or partially update per-automation alert destinations
|
|
14453
14766
|
stop Stop an automation's producer cronjob
|
|
14454
14767
|
resume Resume a stopped automation's producer cronjob
|
|
14455
14768
|
delete Soft-delete an automation
|
|
@@ -14485,6 +14798,16 @@ Update flags:
|
|
|
14485
14798
|
--agent-type <type> Replace agent kind; explicit empty clears it
|
|
14486
14799
|
--trigger Trigger one run after the update commits
|
|
14487
14800
|
|
|
14801
|
+
Delivery subcommands:
|
|
14802
|
+
delivery get Read Alva channel and verified-email destinations
|
|
14803
|
+
delivery update Update only the destination fields explicitly provided
|
|
14804
|
+
|
|
14805
|
+
Delivery flags:
|
|
14806
|
+
--id <automation_id> Existing automation id (required)
|
|
14807
|
+
--alva-channel-ids <a,b> Replace Alva destinations; empty clears them
|
|
14808
|
+
--email-enabled Enable verified-account email delivery
|
|
14809
|
+
--no-email-enabled Disable email delivery
|
|
14810
|
+
|
|
14488
14811
|
Lifecycle flags:
|
|
14489
14812
|
--id <automation_id> Numeric automation id (required for inspect/update/stop/resume/delete)
|
|
14490
14813
|
|
|
@@ -14495,6 +14818,10 @@ Examples:
|
|
|
14495
14818
|
alva automation publish --name btc-ema --version 1.0.0 --cronjob-id 42
|
|
14496
14819
|
alva automation update --id 42 --description "Updated BTC EMA"
|
|
14497
14820
|
alva automation update --id 42 --version 2.0.0 --trigger
|
|
14821
|
+
alva automation delivery get --id 42
|
|
14822
|
+
alva automation delivery update --id 42 --email-enabled
|
|
14823
|
+
alva automation delivery update --id 42 --no-email-enabled
|
|
14824
|
+
alva automation delivery update --id 42 --alva-channel-ids 0,123
|
|
14498
14825
|
alva automation stop --id 42
|
|
14499
14826
|
alva automation resume --id 42
|
|
14500
14827
|
alva automation delete --id 42`,
|
|
@@ -15278,6 +15605,18 @@ function boolFlag(val) {
|
|
|
15278
15605
|
if (val === "false") return false;
|
|
15279
15606
|
return void 0;
|
|
15280
15607
|
}
|
|
15608
|
+
function serializedJSONFlag(value, command2) {
|
|
15609
|
+
if (value === void 0) return void 0;
|
|
15610
|
+
try {
|
|
15611
|
+
validateSerializedArgs(value);
|
|
15612
|
+
} catch (error) {
|
|
15613
|
+
throw new CliUsageError(
|
|
15614
|
+
`--args must contain valid JSON for '${command2}': ${error instanceof Error ? error.message : String(error)}`,
|
|
15615
|
+
command2.split(" ")[0]
|
|
15616
|
+
);
|
|
15617
|
+
}
|
|
15618
|
+
return value;
|
|
15619
|
+
}
|
|
15281
15620
|
function requireFlag(flags, name, command2) {
|
|
15282
15621
|
const val = flags[name];
|
|
15283
15622
|
if (val === void 0) {
|
|
@@ -15401,7 +15740,7 @@ function runTimeoutMs(flags, deps) {
|
|
|
15401
15740
|
return DEFAULT_RUN_TIMEOUT_MS;
|
|
15402
15741
|
}
|
|
15403
15742
|
function configureRunFetchTimeout(timeoutMs, deps) {
|
|
15404
|
-
if (deps?.
|
|
15743
|
+
if (deps?.runtime === "jagent") return;
|
|
15405
15744
|
deps?.configureFetchTimeout?.(timeoutMs);
|
|
15406
15745
|
}
|
|
15407
15746
|
function requireCurrentGroupAlertSessionID(client, command2) {
|
|
@@ -15553,6 +15892,23 @@ function automationUpdateParams(flags) {
|
|
|
15553
15892
|
}
|
|
15554
15893
|
return params;
|
|
15555
15894
|
}
|
|
15895
|
+
function automationDeliveryUpdateParams(flags) {
|
|
15896
|
+
const command2 = "automation delivery update";
|
|
15897
|
+
const id = requirePositiveIntegerStringFlag(flags, "id", command2);
|
|
15898
|
+
const alvaChannelIds = flags["alva-channel-ids"] === void 0 ? void 0 : csvList(flags["alva-channel-ids"]) ?? [];
|
|
15899
|
+
const emailEnabled = boolFlag(flags["email-enabled"]);
|
|
15900
|
+
if (alvaChannelIds === void 0 && emailEnabled === void 0) {
|
|
15901
|
+
throw new CliUsageError(
|
|
15902
|
+
"automation delivery update requires --alva-channel-ids or --email-enabled/--no-email-enabled",
|
|
15903
|
+
"automation"
|
|
15904
|
+
);
|
|
15905
|
+
}
|
|
15906
|
+
return {
|
|
15907
|
+
id,
|
|
15908
|
+
alvaChannelIds,
|
|
15909
|
+
emailEnabled
|
|
15910
|
+
};
|
|
15911
|
+
}
|
|
15556
15912
|
function trendingPlaybooksSort(val) {
|
|
15557
15913
|
if (val === void 0) return void 0;
|
|
15558
15914
|
const normalized = val.trim().toUpperCase();
|
|
@@ -15827,7 +16183,7 @@ function localFileUnsupported(command2, flag) {
|
|
|
15827
16183
|
);
|
|
15828
16184
|
}
|
|
15829
16185
|
function assertLocalFileAvailable(command2, flag, deps) {
|
|
15830
|
-
if (deps?.
|
|
16186
|
+
if (deps?.runtime === "jagent") {
|
|
15831
16187
|
throw localFileUnsupported(command2, flag);
|
|
15832
16188
|
}
|
|
15833
16189
|
}
|
|
@@ -15896,7 +16252,7 @@ function brokerStdinNeedsIntentId(stdin) {
|
|
|
15896
16252
|
return input.dryRun === false;
|
|
15897
16253
|
}
|
|
15898
16254
|
async function handleBroker(client, brokerArgv, deps) {
|
|
15899
|
-
let argv = brokerArgv;
|
|
16255
|
+
let argv = [...brokerArgv];
|
|
15900
16256
|
const isOrderPlace = brokerArgv[0] === "order" && brokerArgv[1] === "place";
|
|
15901
16257
|
const hasFlag = (name) => brokerArgv.some((a) => a === name || a.startsWith(`${name}=`));
|
|
15902
16258
|
const hasHandle = hasFlag("--intent-id") || hasFlag("--client-order-id");
|
|
@@ -15914,7 +16270,8 @@ async function handleBroker(client, brokerArgv, deps) {
|
|
|
15914
16270
|
throw new Error("Broker live orders require a runtime UUID provider.");
|
|
15915
16271
|
}
|
|
15916
16272
|
const intentId = randomUUID2();
|
|
15917
|
-
deps?.
|
|
16273
|
+
const brokerLabel = deps?.runtime === "jagent" ? "alva trading broker" : "alva broker";
|
|
16274
|
+
deps?.stderr?.write(`${brokerLabel}: intent-id ${intentId}
|
|
15918
16275
|
`);
|
|
15919
16276
|
argv = [...brokerArgv, "--intent-id", intentId];
|
|
15920
16277
|
}
|
|
@@ -15935,7 +16292,7 @@ async function handleBroker(client, brokerArgv, deps) {
|
|
|
15935
16292
|
};
|
|
15936
16293
|
exit = 2;
|
|
15937
16294
|
}
|
|
15938
|
-
if (deps?.
|
|
16295
|
+
if (deps?.runtime === "jagent") {
|
|
15939
16296
|
return envelope;
|
|
15940
16297
|
}
|
|
15941
16298
|
if (!deps?.writeBrokerResult) {
|
|
@@ -15944,7 +16301,10 @@ async function handleBroker(client, brokerArgv, deps) {
|
|
|
15944
16301
|
await deps.writeBrokerResult(envelope, exit);
|
|
15945
16302
|
return void 0;
|
|
15946
16303
|
}
|
|
15947
|
-
async function
|
|
16304
|
+
async function dispatchCli(client, args, meta, deps) {
|
|
16305
|
+
return dispatchTerminal(client, args, meta, deps);
|
|
16306
|
+
}
|
|
16307
|
+
async function dispatchTerminal(client, args, meta, deps) {
|
|
15948
16308
|
const group = args[0];
|
|
15949
16309
|
if (group === "-v" || group === "--version") {
|
|
15950
16310
|
return `alva version ${CLI_VERSION}`;
|
|
@@ -15959,13 +16319,18 @@ async function dispatch(client, args, meta, deps) {
|
|
|
15959
16319
|
return handleBroker(client, args.slice(1), deps);
|
|
15960
16320
|
}
|
|
15961
16321
|
const parsedCommand = parseCommand(args);
|
|
15962
|
-
const subcommand = parsedCommand.path[1];
|
|
15963
16322
|
const flags = parsedCommand.flags;
|
|
15964
|
-
const positionals = parsedCommand.positionals;
|
|
15965
16323
|
if (flags["help"] !== void 0) {
|
|
15966
16324
|
const helpText = COMMAND_HELP[group];
|
|
15967
16325
|
if (helpText) return { _help: true, text: helpText };
|
|
15968
16326
|
}
|
|
16327
|
+
return executeParsedCommand(client, parsedCommand, meta, deps);
|
|
16328
|
+
}
|
|
16329
|
+
async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
16330
|
+
const group = parsedCommand.path[0];
|
|
16331
|
+
const subcommand = parsedCommand.path[1];
|
|
16332
|
+
const flags = parsedCommand.flags;
|
|
16333
|
+
const positionals = parsedCommand.positionals;
|
|
15969
16334
|
if (group === "whoami") {
|
|
15970
16335
|
const user = await client.user.me();
|
|
15971
16336
|
const record = projectUserProfileForCLI(
|
|
@@ -16115,11 +16480,10 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16115
16480
|
}
|
|
16116
16481
|
const timeout_ms = runTimeoutMs(flags, deps);
|
|
16117
16482
|
configureRunFetchTimeout(timeout_ms, deps);
|
|
16118
|
-
|
|
16483
|
+
const params = {
|
|
16119
16484
|
code,
|
|
16120
16485
|
entry_path: flags["entry-path"],
|
|
16121
16486
|
working_dir: flags["working-dir"],
|
|
16122
|
-
args: jsonParse(flags["args"]),
|
|
16123
16487
|
max_heap_size_mb: optionalBoundedIntegerFlag(
|
|
16124
16488
|
flags,
|
|
16125
16489
|
"max-heap-size-mb",
|
|
@@ -16128,18 +16492,19 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16128
16492
|
2048
|
|
16129
16493
|
),
|
|
16130
16494
|
timeout_ms
|
|
16131
|
-
}
|
|
16495
|
+
};
|
|
16496
|
+
const serializedArgs = serializedJSONFlag(flags["args"], "run");
|
|
16497
|
+
return serializedArgs === void 0 ? client.run.execute(params) : client.run._executeSerializedArgs(params, serializedArgs);
|
|
16132
16498
|
}
|
|
16133
16499
|
case "deploy": {
|
|
16134
16500
|
if (!subcommand)
|
|
16135
16501
|
throw new CliUsageError("Missing subcommand for deploy", "deploy");
|
|
16136
16502
|
switch (subcommand) {
|
|
16137
|
-
case "create":
|
|
16138
|
-
|
|
16503
|
+
case "create": {
|
|
16504
|
+
const params = {
|
|
16139
16505
|
name: requireFlag(flags, "name", "deploy create"),
|
|
16140
16506
|
path: requireFlag(flags, "path", "deploy create"),
|
|
16141
16507
|
cron_expression: requireFlag(flags, "cron", "deploy create"),
|
|
16142
|
-
args: jsonParse(flags["args"]),
|
|
16143
16508
|
push_notify: boolFlag(flags["push-notify"]),
|
|
16144
16509
|
max_heap_size_mb: optionalBoundedIntegerFlag(
|
|
16145
16510
|
flags,
|
|
@@ -16159,7 +16524,13 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16159
16524
|
flags,
|
|
16160
16525
|
"deploy create"
|
|
16161
16526
|
)
|
|
16162
|
-
}
|
|
16527
|
+
};
|
|
16528
|
+
const serializedArgs = serializedJSONFlag(
|
|
16529
|
+
flags["args"],
|
|
16530
|
+
"deploy create"
|
|
16531
|
+
);
|
|
16532
|
+
return serializedArgs === void 0 ? client.deploy.create(params) : client.deploy._createSerializedArgs(params, serializedArgs);
|
|
16533
|
+
}
|
|
16163
16534
|
case "list":
|
|
16164
16535
|
return client.deploy.list({
|
|
16165
16536
|
limit: num(flags["limit"]),
|
|
@@ -16169,12 +16540,11 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16169
16540
|
return client.deploy.get({
|
|
16170
16541
|
id: requireNumericFlag(flags, "id", "deploy get")
|
|
16171
16542
|
});
|
|
16172
|
-
case "update":
|
|
16173
|
-
|
|
16543
|
+
case "update": {
|
|
16544
|
+
const params = {
|
|
16174
16545
|
id: requireNumericFlag(flags, "id", "deploy update"),
|
|
16175
16546
|
name: flags["name"],
|
|
16176
16547
|
cron_expression: flags["cron"],
|
|
16177
|
-
args: jsonParse(flags["args"]),
|
|
16178
16548
|
push_notify: boolFlag(flags["push-notify"]),
|
|
16179
16549
|
max_heap_size_mb: optionalBoundedIntegerFlag(
|
|
16180
16550
|
flags,
|
|
@@ -16191,7 +16561,13 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16191
16561
|
3600
|
|
16192
16562
|
),
|
|
16193
16563
|
run_as_user_id: resolveRunAsFlag(flags, "deploy update")
|
|
16194
|
-
}
|
|
16564
|
+
};
|
|
16565
|
+
const serializedArgs = serializedJSONFlag(
|
|
16566
|
+
flags["args"],
|
|
16567
|
+
"deploy update"
|
|
16568
|
+
);
|
|
16569
|
+
return serializedArgs === void 0 ? client.deploy.update(params) : client.deploy._updateSerializedArgs(params, serializedArgs);
|
|
16570
|
+
}
|
|
16195
16571
|
case "delete":
|
|
16196
16572
|
return client.deploy.delete({
|
|
16197
16573
|
id: requireNumericFlag(flags, "id", "deploy delete")
|
|
@@ -16422,6 +16798,31 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16422
16798
|
);
|
|
16423
16799
|
case "update":
|
|
16424
16800
|
return client.automation.update(automationUpdateParams(flags));
|
|
16801
|
+
case "delivery": {
|
|
16802
|
+
const leaf = parsedCommand.path[2];
|
|
16803
|
+
if (!leaf || leaf === "--help" || leaf === "-h") {
|
|
16804
|
+
return { _help: true, text: COMMAND_HELP.automation };
|
|
16805
|
+
}
|
|
16806
|
+
switch (leaf) {
|
|
16807
|
+
case "get":
|
|
16808
|
+
return client.automation.delivery.get({
|
|
16809
|
+
id: requirePositiveIntegerStringFlag(
|
|
16810
|
+
flags,
|
|
16811
|
+
"id",
|
|
16812
|
+
"automation delivery get"
|
|
16813
|
+
)
|
|
16814
|
+
});
|
|
16815
|
+
case "update":
|
|
16816
|
+
return client.automation.delivery.update(
|
|
16817
|
+
automationDeliveryUpdateParams(flags)
|
|
16818
|
+
);
|
|
16819
|
+
default:
|
|
16820
|
+
throw new CliUsageError(
|
|
16821
|
+
`Unknown subcommand: automation delivery ${leaf}`,
|
|
16822
|
+
"automation"
|
|
16823
|
+
);
|
|
16824
|
+
}
|
|
16825
|
+
}
|
|
16425
16826
|
case "stop":
|
|
16426
16827
|
return client.automation.stop({
|
|
16427
16828
|
id: requireNumericFlag(flags, "id", "automation stop")
|
|
@@ -16770,10 +17171,10 @@ async function dispatch(client, args, meta, deps) {
|
|
|
16770
17171
|
const { exitCode, output } = await handleLintPlaybook({
|
|
16771
17172
|
file,
|
|
16772
17173
|
format,
|
|
16773
|
-
client: deps?.
|
|
17174
|
+
client: deps?.runtime === "jagent" ? client : void 0,
|
|
16774
17175
|
readFile: deps?.localFiles?.readText
|
|
16775
17176
|
});
|
|
16776
|
-
if (deps?.
|
|
17177
|
+
if (deps?.runtime === "jagent") {
|
|
16777
17178
|
if (exitCode !== 0) throw new Error(output);
|
|
16778
17179
|
return output;
|
|
16779
17180
|
}
|
|
@@ -17561,7 +17962,7 @@ function stripGlobalFlags(argv) {
|
|
|
17561
17962
|
const result = [];
|
|
17562
17963
|
for (let i = 0; i < argv.length; i++) {
|
|
17563
17964
|
const a = argv[i];
|
|
17564
|
-
if (a === "broker") {
|
|
17965
|
+
if (a === "broker" || a === "trading" && argv[i + 1] === "broker") {
|
|
17565
17966
|
result.push(...argv.slice(i));
|
|
17566
17967
|
break;
|
|
17567
17968
|
}
|
|
@@ -17649,7 +18050,7 @@ async function readAllStdin() {
|
|
|
17649
18050
|
return Buffer.concat(chunks).toString("utf8");
|
|
17650
18051
|
}
|
|
17651
18052
|
var nodeRuntimeDeps = {
|
|
17652
|
-
|
|
18053
|
+
runtime: "nodejs",
|
|
17653
18054
|
env: process.env,
|
|
17654
18055
|
stderr: process.stderr,
|
|
17655
18056
|
localFiles: {
|
|
@@ -17667,8 +18068,8 @@ var nodeRuntimeDeps = {
|
|
|
17667
18068
|
process.exitCode = exitCode;
|
|
17668
18069
|
}
|
|
17669
18070
|
};
|
|
17670
|
-
async function
|
|
17671
|
-
return
|
|
18071
|
+
async function dispatch(client, args, meta, deps) {
|
|
18072
|
+
return dispatchCli(client, args, meta, {
|
|
17672
18073
|
...nodeRuntimeDeps,
|
|
17673
18074
|
...deps,
|
|
17674
18075
|
localFiles: deps?.localFiles ?? nodeRuntimeDeps.localFiles
|
|
@@ -17780,7 +18181,7 @@ async function main() {
|
|
|
17780
18181
|
originSessionId: config.originSessionId,
|
|
17781
18182
|
originSessionKind: config.originSessionKind
|
|
17782
18183
|
});
|
|
17783
|
-
const result = await
|
|
18184
|
+
const result = await dispatch(client, stripGlobalFlags(rawArgs), {
|
|
17784
18185
|
profile: config.profile,
|
|
17785
18186
|
baseUrl: config.baseUrl,
|
|
17786
18187
|
cliVersion: CLI_VERSION
|
|
@@ -17851,7 +18252,7 @@ export {
|
|
|
17851
18252
|
CLI_VERSION,
|
|
17852
18253
|
CliUsageError,
|
|
17853
18254
|
DEFAULT_RUN_TIMEOUT_MS,
|
|
17854
|
-
|
|
18255
|
+
dispatch,
|
|
17855
18256
|
handleConfigure,
|
|
17856
18257
|
isVersionOlderThan,
|
|
17857
18258
|
parseFlags,
|