@voyager-crew/cli 0.5.1 → 0.5.2
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 +3 -0
- package/README_ZH.md +1 -0
- package/dist/cli.mjs +65 -4
- package/package.json +1 -1
- package/skills/voyager/SKILL.md +2 -0
package/README.md
CHANGED
|
@@ -149,6 +149,9 @@ reported it.
|
|
|
149
149
|
end, also after a failure; pass `--keep-tab` to leave it open. If ChatGPT asks you to sign in
|
|
150
150
|
or solve a challenge, Voyager CLI stops, leaves that tab open and says so (exit 3); it never
|
|
151
151
|
works around it.
|
|
152
|
+
- The extension refuses jobs while its page data is missing or over 24 hours old (`policy-stale`).
|
|
153
|
+
Commands then refresh it once from voyager.nagi.fun and go on; if that fails, they stop before
|
|
154
|
+
sending anything and say why. `voyager call catalog.refresh` tries again.
|
|
152
155
|
- `voyager update` updates everything it can: the CLI (when npm installed it globally),
|
|
153
156
|
`voyager serve` (restarted unless a job is running) and the extension's page data, fetched now
|
|
154
157
|
instead of at its next check. Your browser's store updates the extension itself.
|
package/README_ZH.md
CHANGED
|
@@ -125,6 +125,7 @@ agent 可以同时提问,回复一起等;输入和点击仍会轮流进行
|
|
|
125
125
|
- `ask`、`read` 和所有 `project` 命令都会自己打开一个 ChatGPT 标签页,结束时关掉,失败了也关;
|
|
126
126
|
想留着就加 `--keep-tab`。如果 ChatGPT 要求登录或人机验证,Voyager CLI 会停下来、留着那个
|
|
127
127
|
标签页并告诉你(退出码 3),不会绕过。
|
|
128
|
+
- 扩展的页面数据缺失或超过 24 小时未更新时,会拒绝新任务(`policy-stale`)。这时命令会先从 voyager.nagi.fun 刷新一次再继续;刷新失败就在发送前停下并说明原因,之后可以用 `voyager call catalog.refresh` 重试。
|
|
128
129
|
- `voyager update` 把能更新的都更新一遍:命令行本身(用 npm 全局安装时)、`voyager serve`
|
|
129
130
|
(没有任务在跑时重启)和扩展的页面数据(立即重新获取,不等下一次定时检查)。扩展本身由浏览器的
|
|
130
131
|
扩展商店更新。
|
package/dist/cli.mjs
CHANGED
|
@@ -3272,7 +3272,7 @@ class PluginRegistry {
|
|
|
3272
3272
|
// package.json
|
|
3273
3273
|
var package_default = {
|
|
3274
3274
|
name: "@voyager-crew/cli",
|
|
3275
|
-
version: "0.5.
|
|
3275
|
+
version: "0.5.2",
|
|
3276
3276
|
description: "Ask ChatGPT from your terminal or your coding agent, through the Voyager browser extension",
|
|
3277
3277
|
keywords: [
|
|
3278
3278
|
"chatgpt",
|
|
@@ -4055,6 +4055,67 @@ function newId(prefix) {
|
|
|
4055
4055
|
return `${prefix}${Date.now().toString(36)}${randomBytes5(5).toString("hex")}`;
|
|
4056
4056
|
}
|
|
4057
4057
|
|
|
4058
|
+
// src/cli/policyRefresh.ts
|
|
4059
|
+
var REFRESH_ATTEMPTS = 2;
|
|
4060
|
+
var REFRESH_WAIT_MS = 30000;
|
|
4061
|
+
var POLICY_REPORT_WAIT_MS = POLL_HOLD_MS + 5000;
|
|
4062
|
+
var POLICY_POLL_MS = 200;
|
|
4063
|
+
async function refreshOnce(client) {
|
|
4064
|
+
const { jobId } = await client.request("POST", BRIDGE_PATHS.call, {
|
|
4065
|
+
op: "catalog.refresh",
|
|
4066
|
+
params: {}
|
|
4067
|
+
});
|
|
4068
|
+
const { kind, job } = await waitForJob(client, jobId, REFRESH_WAIT_MS);
|
|
4069
|
+
if (kind === "timeout")
|
|
4070
|
+
return "the extension did not answer";
|
|
4071
|
+
if (job.status !== "succeeded")
|
|
4072
|
+
return job.error?.message ?? job.status;
|
|
4073
|
+
const result = job.result?.result;
|
|
4074
|
+
if (!isRecord2(result))
|
|
4075
|
+
return "the extension sent no result";
|
|
4076
|
+
if (result.status === "updated" || result.status === "unchanged")
|
|
4077
|
+
return;
|
|
4078
|
+
return typeof result.reason === "string" ? result.reason : String(result.status);
|
|
4079
|
+
}
|
|
4080
|
+
async function policyReported(client) {
|
|
4081
|
+
const deadline = Date.now() + POLICY_REPORT_WAIT_MS;
|
|
4082
|
+
while (Date.now() < deadline) {
|
|
4083
|
+
const status = await client.request("GET", BRIDGE_PATHS.status);
|
|
4084
|
+
if (status.extension.policy?.state !== "stale")
|
|
4085
|
+
return true;
|
|
4086
|
+
await new Promise((resolve3) => setTimeout(resolve3, POLICY_POLL_MS));
|
|
4087
|
+
}
|
|
4088
|
+
return false;
|
|
4089
|
+
}
|
|
4090
|
+
async function refreshPolicy(client) {
|
|
4091
|
+
let reason;
|
|
4092
|
+
for (let attempt = 0;attempt < REFRESH_ATTEMPTS; attempt += 1) {
|
|
4093
|
+
try {
|
|
4094
|
+
reason = await refreshOnce(client);
|
|
4095
|
+
} catch (thrown) {
|
|
4096
|
+
return toBridgeError(thrown).message;
|
|
4097
|
+
}
|
|
4098
|
+
if (reason === undefined) {
|
|
4099
|
+
return await policyReported(client) ? undefined : "the extension still reports it stale";
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
return reason;
|
|
4103
|
+
}
|
|
4104
|
+
async function submitWithFreshPolicy(client, submit) {
|
|
4105
|
+
try {
|
|
4106
|
+
return await submit();
|
|
4107
|
+
} catch (thrown) {
|
|
4108
|
+
if (!(thrown instanceof BridgeFailure) || thrown.error.code !== "policy-stale")
|
|
4109
|
+
throw thrown;
|
|
4110
|
+
note("the extension policy is out of date; refreshing it from voyager.nagi.fun");
|
|
4111
|
+
const reason = await refreshPolicy(client);
|
|
4112
|
+
if (reason !== undefined) {
|
|
4113
|
+
throw failure("policy-stale", `${thrown.message} (refreshing it failed: ${reason})`);
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
return submit();
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4058
4119
|
// src/cli/commands/plugin.ts
|
|
4059
4120
|
var STAGING_MAX_AGE_MS = 24 * 60 * 60000;
|
|
4060
4121
|
async function sweepStaging(root) {
|
|
@@ -4119,11 +4180,11 @@ async function pluginCommand(paths, registry, found, argv) {
|
|
|
4119
4180
|
json: args.options.json === true,
|
|
4120
4181
|
noWait: args.options["no-wait"] === true,
|
|
4121
4182
|
timeoutMs: waitTimeout(args)
|
|
4122
|
-
}, () => client.request("POST", BRIDGE_PATHS.jobs, {
|
|
4183
|
+
}, () => submitWithFreshPolicy(client, () => client.request("POST", BRIDGE_PATHS.jobs, {
|
|
4123
4184
|
plugin: found.plugin.name,
|
|
4124
4185
|
command: found.command,
|
|
4125
4186
|
input
|
|
4126
|
-
}));
|
|
4187
|
+
})));
|
|
4127
4188
|
}
|
|
4128
4189
|
|
|
4129
4190
|
// src/cli/commands/serve.ts
|
|
@@ -4407,7 +4468,7 @@ function policyFailure(state, op) {
|
|
|
4407
4468
|
return failure("policy-denied", "the extension policy does not allow the bridge");
|
|
4408
4469
|
}
|
|
4409
4470
|
if (state === "stale") {
|
|
4410
|
-
return failure("policy-stale", "the extension policy is out of date;
|
|
4471
|
+
return failure("policy-stale", "the extension policy is out of date; run `voyager call catalog.refresh` while the browser can reach voyager.nagi.fun");
|
|
4411
4472
|
}
|
|
4412
4473
|
return;
|
|
4413
4474
|
}
|
package/package.json
CHANGED
package/skills/voyager/SKILL.md
CHANGED
|
@@ -102,6 +102,8 @@ ChatGPT sees nothing of your conversation, so the prompt carries everything. Pro
|
|
|
102
102
|
|
|
103
103
|
## Exit codes
|
|
104
104
|
|
|
105
|
+
`policy-stale` (exit 3) means voyager already tried to refresh the extension's page data and could not; nothing was sent, and `error.message` says why. It usually means the browser cannot reach voyager.nagi.fun. Once it can, run the same command again.
|
|
106
|
+
|
|
105
107
|
| Code | Meaning | Next step |
|
|
106
108
|
| ---- | -------------------------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
107
109
|
| 0 | succeeded (also when some `failedFiles` could not be downloaded) | read `responsePath` and `files`; report `failedFiles` |
|