@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/dispatch.js
CHANGED
|
@@ -6624,7 +6624,8 @@ Subcommands:
|
|
|
6624
6624
|
run: `Usage: alva run (--code <js> | --entry-path <alfs-path>) [options]
|
|
6625
6625
|
|
|
6626
6626
|
Execute JavaScript in the Jagent runtime. Local-file flags are unavailable in
|
|
6627
|
-
the embedded Agent; use ALFS paths or inline code
|
|
6627
|
+
the embedded Agent; use ALFS paths or inline code. Return values directly, not
|
|
6628
|
+
JSON.stringify(...).`,
|
|
6628
6629
|
"data-skills": `Usage: alva data-skills <subcommand>
|
|
6629
6630
|
|
|
6630
6631
|
Subcommands:
|
|
@@ -11565,7 +11566,7 @@ function formatTradingPairResolved(result) {
|
|
|
11565
11566
|
}
|
|
11566
11567
|
|
|
11567
11568
|
// src/cli/dispatch.ts
|
|
11568
|
-
var CLI_VERSION = true ? "0.
|
|
11569
|
+
var CLI_VERSION = true ? "0.32.0-beta.0" : "dev";
|
|
11569
11570
|
var DEFAULT_RUN_TIMEOUT_MS = 6e5;
|
|
11570
11571
|
var RUN_TIMEOUT_ENV = "ALVA_RUN_TIMEOUT_MS";
|
|
11571
11572
|
var GLOBAL_VALUE_FLAGS = Object.entries(GLOBAL_FLAG_DEFINITIONS).filter(([, kind]) => kind === "value").map(([name]) => `--${name}`);
|
|
@@ -11875,7 +11876,8 @@ At least one of --code, --local-file, or --entry-path is required.
|
|
|
11875
11876
|
These three options are mutually exclusive.
|
|
11876
11877
|
|
|
11877
11878
|
Response fields:
|
|
11878
|
-
result
|
|
11879
|
+
result The script's return value. Return objects directly; a script
|
|
11880
|
+
returning JSON.stringify(x) is shown as x.
|
|
11879
11881
|
logs Captured stderr output
|
|
11880
11882
|
status "completed" or "failed"
|
|
11881
11883
|
error Error message (when status is "failed")
|
|
@@ -11897,13 +11899,14 @@ Constraints:
|
|
|
11897
11899
|
|
|
11898
11900
|
Examples:
|
|
11899
11901
|
alva run --code "1 + 2 + 3;"
|
|
11900
|
-
alva run --code "
|
|
11902
|
+
alva run --code "require('env').args;" --args '{"symbol":"BTC"}'
|
|
11901
11903
|
alva run --entry-path "~/feeds/my-feed/v1/src/index.js"
|
|
11902
11904
|
alva run --entry-path "~/tasks/analyze/src/index.js" --args '{"symbol":"NVDA","limit":50}'
|
|
11903
11905
|
alva run --local-file ./my-script.js --args '{"symbol":"BTC"}'
|
|
11904
11906
|
printf '%s' '{"symbol":"BTC"}' | alva run --local-file ./my-script.js --args-stdin
|
|
11905
11907
|
alva run --entry-path "~/tasks/heavy/src/index.js" --max-heap-size-mb 1024
|
|
11906
|
-
alva run --entry-path "~/feeds/slow/v1/src/index.js" --timeout-ms 900000
|
|
11908
|
+
alva run --entry-path "~/feeds/slow/v1/src/index.js" --timeout-ms 900000
|
|
11909
|
+
alva run --local-file ./research.js > research.json && jq -c '.result.income[:4]' research.json`,
|
|
11907
11910
|
deploy: `Usage: alva deploy <subcommand> [options]
|
|
11908
11911
|
|
|
11909
11912
|
Manage scheduled cronjobs that run your scripts on a cron schedule.
|
|
@@ -13560,6 +13563,24 @@ function assertLocalFileAvailable(command2, flag, deps) {
|
|
|
13560
13563
|
throw localFileUnsupported(command2, flag);
|
|
13561
13564
|
}
|
|
13562
13565
|
}
|
|
13566
|
+
function decodeRunResult(result) {
|
|
13567
|
+
let value;
|
|
13568
|
+
try {
|
|
13569
|
+
value = JSON.parse(result);
|
|
13570
|
+
} catch {
|
|
13571
|
+
return result;
|
|
13572
|
+
}
|
|
13573
|
+
let inner = value;
|
|
13574
|
+
while (typeof inner === "string") {
|
|
13575
|
+
try {
|
|
13576
|
+
inner = JSON.parse(inner);
|
|
13577
|
+
} catch {
|
|
13578
|
+
break;
|
|
13579
|
+
}
|
|
13580
|
+
if (inner !== null && typeof inner === "object") return inner;
|
|
13581
|
+
}
|
|
13582
|
+
return value;
|
|
13583
|
+
}
|
|
13563
13584
|
function readLocalTextFile(path, command2, flag, deps) {
|
|
13564
13585
|
assertLocalFileAvailable(command2, flag, deps);
|
|
13565
13586
|
if (!deps?.localFiles) {
|
|
@@ -13957,7 +13978,8 @@ async function executeParsedCommand(client, parsedCommand, meta, deps) {
|
|
|
13957
13978
|
);
|
|
13958
13979
|
}
|
|
13959
13980
|
}
|
|
13960
|
-
|
|
13981
|
+
const response = serializedArgs === void 0 ? await client.run.execute(params) : await client.run._executeSerializedArgs(params, serializedArgs);
|
|
13982
|
+
return { ...response, result: decodeRunResult(response.result) };
|
|
13961
13983
|
}
|
|
13962
13984
|
case "deploy": {
|
|
13963
13985
|
if (!subcommand)
|