perstack 0.0.100 → 0.0.101
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/bin/cli.js +17 -6
- package/dist/bin/cli.js.map +1 -1
- package/package.json +4 -4
package/dist/bin/cli.js
CHANGED
|
@@ -959,12 +959,16 @@ function isRemoteUrl(configPath) {
|
|
|
959
959
|
|
|
960
960
|
//#endregion
|
|
961
961
|
//#region ../../packages/perstack-toml/src/config.ts
|
|
962
|
-
const ALLOWED_CONFIG_HOSTS = ["raw.githubusercontent.com"];
|
|
963
962
|
async function getPerstackConfig(configPath) {
|
|
964
963
|
const configString = await findPerstackConfigString(configPath);
|
|
965
964
|
if (configString === null) throw new PerstackError("perstack.toml not found. Create one or specify --config path.");
|
|
966
965
|
return parsePerstackConfig(configString);
|
|
967
966
|
}
|
|
967
|
+
async function getPerstackConfigOrDefault(configPath) {
|
|
968
|
+
const configString = await findPerstackConfigString(configPath);
|
|
969
|
+
if (configString === null) return {};
|
|
970
|
+
return parsePerstackConfig(configString);
|
|
971
|
+
}
|
|
968
972
|
function parsePerstackConfig(config) {
|
|
969
973
|
return parseWithFriendlyError(perstackConfigSchema, dist_default.parse(config ?? ""), "perstack.toml");
|
|
970
974
|
}
|
|
@@ -976,9 +980,8 @@ async function fetchRemoteConfig(url) {
|
|
|
976
980
|
throw new PerstackError(`Invalid remote config URL: ${url}`);
|
|
977
981
|
}
|
|
978
982
|
if (parsed.protocol !== "https:") throw new PerstackError("Remote config requires HTTPS");
|
|
979
|
-
if (!ALLOWED_CONFIG_HOSTS.includes(parsed.hostname)) throw new PerstackError(`Remote config only allowed from: ${ALLOWED_CONFIG_HOSTS.join(", ")}`);
|
|
980
983
|
try {
|
|
981
|
-
const response = await fetch(url
|
|
984
|
+
const response = await fetch(url);
|
|
982
985
|
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
|
|
983
986
|
return await response.text();
|
|
984
987
|
} catch (error) {
|
|
@@ -119753,7 +119756,7 @@ async function startHandler(expertKey, query, options, handlerOptions) {
|
|
|
119753
119756
|
//#endregion
|
|
119754
119757
|
//#region package.json
|
|
119755
119758
|
var name = "perstack";
|
|
119756
|
-
var version = "0.0.
|
|
119759
|
+
var version = "0.0.101";
|
|
119757
119760
|
var description = "PerStack CLI";
|
|
119758
119761
|
|
|
119759
119762
|
//#endregion
|
|
@@ -119766,16 +119769,24 @@ async function resolveConfigAndLockfile(configOption) {
|
|
|
119766
119769
|
lockfile: lockfilePath ? loadLockfile(lockfilePath) ?? void 0 : void 0
|
|
119767
119770
|
};
|
|
119768
119771
|
}
|
|
119772
|
+
async function resolveConfigAndLockfileOrDefault(configOption) {
|
|
119773
|
+
const perstackConfig = await getPerstackConfigOrDefault(configOption);
|
|
119774
|
+
const lockfilePath = findLockfile(configOption);
|
|
119775
|
+
return {
|
|
119776
|
+
perstackConfig,
|
|
119777
|
+
lockfile: lockfilePath ? loadLockfile(lockfilePath) ?? void 0 : void 0
|
|
119778
|
+
};
|
|
119779
|
+
}
|
|
119769
119780
|
const program = new Command().name(name).description(description).version(version);
|
|
119770
119781
|
program.command("start").description("Start Perstack with interactive TUI").argument("[expertKey]", "Expert key to run (optional, will prompt if not provided)").argument("[query]", "Query to run (optional, will prompt if not provided)").option("--config <configPath>", "Path to perstack.toml config file").option("--provider <provider>", "Provider to use").option("--model <model>", "Model to use").option("--reasoning-budget <budget>", "Reasoning budget for native LLM reasoning (minimal, low, medium, high, or token count)").option("--max-retries <maxRetries>", "Maximum number of generation retries, default is 5").option("--timeout <timeout>", "Timeout for each generation in milliseconds, default is 300000 (5 minutes)").option("--job-id <jobId>", "Job ID for identifying the job").option("--env-path <path>", "Path to the environment file (can be specified multiple times), default is .env and .env.local", (value, previous) => previous.concat(value), []).option("--verbose", "Enable verbose logging").option("--continue", "Continue the most recent job with new query").option("--continue-job <jobId>", "Continue the specified job with new query").option("--resume-from <checkpointId>", "Resume from a specific checkpoint (requires --continue or --continue-job)").option("-i, --interactive-tool-call-result", "Query is interactive tool call result").action(async (expertKey, query, options) => {
|
|
119771
|
-
const { perstackConfig, lockfile } = await resolveConfigAndLockfile(options.config);
|
|
119782
|
+
const { perstackConfig, lockfile } = await (expertKey ? resolveConfigAndLockfileOrDefault : resolveConfigAndLockfile)(options.config);
|
|
119772
119783
|
await startHandler(expertKey, query, options, {
|
|
119773
119784
|
perstackConfig,
|
|
119774
119785
|
lockfile
|
|
119775
119786
|
});
|
|
119776
119787
|
});
|
|
119777
119788
|
program.command("run").description("Run Perstack with JSON output").argument("<expertKey>", "Expert key to run").argument("<query>", "Query to run").option("--config <configPath>", "Path to perstack.toml config file").option("--provider <provider>", "Provider to use").option("--model <model>", "Model to use").option("--reasoning-budget <budget>", "Reasoning budget for native LLM reasoning (minimal, low, medium, high, or token count)").option("--max-retries <maxRetries>", "Maximum number of generation retries, default is 5").option("--timeout <timeout>", "Timeout for each generation in milliseconds, default is 300000 (5 minutes)").option("--job-id <jobId>", "Job ID for identifying the job").option("--env-path <path>", "Path to the environment file (can be specified multiple times), default is .env and .env.local", (value, previous) => previous.concat(value), []).option("--verbose", "Enable verbose logging").option("--continue", "Continue the most recent job with new query").option("--continue-job <jobId>", "Continue the specified job with new query").option("--resume-from <checkpointId>", "Resume from a specific checkpoint (requires --continue or --continue-job)").option("-i, --interactive-tool-call-result", "Query is interactive tool call result").option("--filter <types>", "Filter events by type (comma-separated, e.g., completeRun,stopRunByError)").action(async (expertKey, query, options) => {
|
|
119778
|
-
const { perstackConfig, lockfile } = await
|
|
119789
|
+
const { perstackConfig, lockfile } = await resolveConfigAndLockfileOrDefault(options.config);
|
|
119779
119790
|
await runHandler(expertKey, query, options, {
|
|
119780
119791
|
perstackConfig,
|
|
119781
119792
|
lockfile
|