@alva-ai/toolkit 0.31.0 → 0.32.0-beta.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/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.js +28 -6
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.js +28 -6
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -16169,7 +16169,7 @@ function formatTradingPairResolved(result) {
|
|
|
16169
16169
|
}
|
|
16170
16170
|
|
|
16171
16171
|
// src/cli/dispatch.ts
|
|
16172
|
-
var CLI_VERSION = true ? "0.
|
|
16172
|
+
var CLI_VERSION = true ? "0.32.0-beta.0" : "dev";
|
|
16173
16173
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
16174
16174
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
16175
16175
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -16535,7 +16535,8 @@ At least one of --code, --local-file, or --entry-path is required.
|
|
|
16535
16535
|
These three options are mutually exclusive.
|
|
16536
16536
|
|
|
16537
16537
|
Response fields:
|
|
16538
|
-
result
|
|
16538
|
+
result The script's return value. Return objects directly; a script
|
|
16539
|
+
returning JSON.stringify(x) is shown as x.
|
|
16539
16540
|
logs Captured stderr output
|
|
16540
16541
|
status "completed" or "failed"
|
|
16541
16542
|
error Error message (when status is "failed")
|
|
@@ -16557,13 +16558,14 @@ Constraints:
|
|
|
16557
16558
|
|
|
16558
16559
|
Examples:
|
|
16559
16560
|
alva run --code "1 + 2 + 3;"
|
|
16560
|
-
alva run --code "
|
|
16561
|
+
alva run --code "require('env').args;" --args '{"symbol":"BTC"}'
|
|
16561
16562
|
alva run --entry-path "~/feeds/my-feed/v1/src/index.js"
|
|
16562
16563
|
alva run --entry-path "~/tasks/analyze/src/index.js" --args '{"symbol":"NVDA","limit":50}'
|
|
16563
16564
|
alva run --local-file ./my-script.js --args '{"symbol":"BTC"}'
|
|
16564
16565
|
printf '%s' '{"symbol":"BTC"}' | alva run --local-file ./my-script.js --args-stdin
|
|
16565
16566
|
alva run --entry-path "~/tasks/heavy/src/index.js" --max-heap-size-mb 1024
|
|
16566
|
-
alva run --entry-path "~/feeds/slow/v1/src/index.js" --timeout-ms 900000
|
|
16567
|
+
alva run --entry-path "~/feeds/slow/v1/src/index.js" --timeout-ms 900000
|
|
16568
|
+
alva run --local-file ./research.js > research.json && jq -c '.result.income[:4]' research.json`,
|
|
16567
16569
|
deploy: `Usage: alva deploy <subcommand> [options]
|
|
16568
16570
|
|
|
16569
16571
|
Manage scheduled cronjobs that run your scripts on a cron schedule.
|
|
@@ -18248,6 +18250,24 @@ function assertLocalFileAvailable(command2, flag, deps) {
|
|
|
18248
18250
|
throw localFileUnsupported(command2, flag);
|
|
18249
18251
|
}
|
|
18250
18252
|
}
|
|
18253
|
+
function decodeRunResult(result) {
|
|
18254
|
+
let value;
|
|
18255
|
+
try {
|
|
18256
|
+
value = JSON.parse(result);
|
|
18257
|
+
} catch {
|
|
18258
|
+
return result;
|
|
18259
|
+
}
|
|
18260
|
+
let inner = value;
|
|
18261
|
+
while (typeof inner === "string") {
|
|
18262
|
+
try {
|
|
18263
|
+
inner = JSON.parse(inner);
|
|
18264
|
+
} catch {
|
|
18265
|
+
break;
|
|
18266
|
+
}
|
|
18267
|
+
if (inner !== null && typeof inner === "object") return inner;
|
|
18268
|
+
}
|
|
18269
|
+
return value;
|
|
18270
|
+
}
|
|
18251
18271
|
function readLocalTextFile(path, command2, flag, deps) {
|
|
18252
18272
|
assertLocalFileAvailable(command2, flag, deps);
|
|
18253
18273
|
if (!deps?.localFiles) {
|
|
@@ -18670,7 +18690,8 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
18670
18690
|
);
|
|
18671
18691
|
}
|
|
18672
18692
|
}
|
|
18673
|
-
|
|
18693
|
+
const response = serializedArgs === void 0 ? await client.run.execute(params) : await client.run._executeSerializedArgs(params, serializedArgs);
|
|
18694
|
+
return { ...response, result: decodeRunResult(response.result) };
|
|
18674
18695
|
}
|
|
18675
18696
|
case "deploy": {
|
|
18676
18697
|
if (!subcommand)
|
|
@@ -20637,7 +20658,8 @@ async function main() {
|
|
|
20637
20658
|
} else if (typeof result === "string") {
|
|
20638
20659
|
process.stdout.write(result);
|
|
20639
20660
|
} else if (result !== void 0) {
|
|
20640
|
-
process.stdout.
|
|
20661
|
+
const indent = process.stdout.isTTY ? 2 : void 0;
|
|
20662
|
+
process.stdout.write(JSON.stringify(result, null, indent) + "\n");
|
|
20641
20663
|
}
|
|
20642
20664
|
} catch (error) {
|
|
20643
20665
|
if (error instanceof CliUsageError) {
|