@luckypiggy/zhihu-ai-cli 0.2.1-test.4 → 0.2.1-test.5
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 +14 -7
- package/assets/codex-skills/zhihu-aiops/SKILL.md +44 -22
- package/assets/codex-skills/zhihu-aiops/references/commands.md +30 -18
- package/assets/codex-skills/zhihu-aiops/references/errors.md +2 -1
- package/assets/codex-skills/zhihu-aiops/references/safety.md +7 -2
- package/dist/cli.js +70 -5
- package/dist/codex-skill.js +50 -8
- package/dist/credentials.js +30 -10
- package/dist/install.js +11 -4
- package/dist/local-runner.js +1717 -0
- package/dist/profile-lock.js +7 -0
- package/dist/release.js +7 -4
- package/package.json +1 -1
package/dist/install.js
CHANGED
|
@@ -11,6 +11,7 @@ import { SecureCredentialStore } from "./credentials.js";
|
|
|
11
11
|
import { installCodexSkill, resolveCodexSkillTarget, CodexSkillError, CODEX_SKILL_NAME, } from "./codex-skill.js";
|
|
12
12
|
import { CliAuthError, mapFailure } from "./token-manager.js";
|
|
13
13
|
import { CLI_RUNNER } from "./release.js";
|
|
14
|
+
import { existingLocalRunnerCommand, localizedRunnerLockMessage } from "./local-runner.js";
|
|
14
15
|
import { promptTerminalCredentials, TerminalPromptCancelledError, TerminalPromptInteractiveRequiredError } from "./terminal-prompt.js";
|
|
15
16
|
const MAX_CA_BUNDLE_BYTES = 4 * 1024 * 1024;
|
|
16
17
|
const CONTROL_PATTERN = /[\u0000-\u001f\u007f]/;
|
|
@@ -68,6 +69,9 @@ function languageAnswer(value) {
|
|
|
68
69
|
function yesAnswer(value) {
|
|
69
70
|
return /^(?:y|yes|是|好|1)$/i.test(value.trim());
|
|
70
71
|
}
|
|
72
|
+
function activeRunner() {
|
|
73
|
+
return existingLocalRunnerCommand(process.env) ?? CLI_RUNNER;
|
|
74
|
+
}
|
|
71
75
|
export function localizedInstallMessage(code, language, message) {
|
|
72
76
|
const zh = language === "zh";
|
|
73
77
|
switch (code) {
|
|
@@ -107,6 +111,8 @@ export function localizedInstallMessage(code, language, message) {
|
|
|
107
111
|
return zh
|
|
108
112
|
? "连接智护服务超时,请检查地址和网络后再次运行相同的安装命令。"
|
|
109
113
|
: "The Pilot service timed out. Check the address and network, then rerun the same install command.";
|
|
114
|
+
case "LOCAL_RUNNER_LOCK_TIMEOUT":
|
|
115
|
+
return localizedRunnerLockMessage(language);
|
|
110
116
|
case "USER_CANCELLED":
|
|
111
117
|
return wizardMessages(language).cancelled;
|
|
112
118
|
case "CONFIG_EXISTS":
|
|
@@ -116,8 +122,8 @@ export function localizedInstallMessage(code, language, message) {
|
|
|
116
122
|
case "AUTH_ALREADY_LOGGED_IN":
|
|
117
123
|
case "CREDENTIAL_STORE_UNAVAILABLE":
|
|
118
124
|
return zh
|
|
119
|
-
? `${message}。请先执行 ${
|
|
120
|
-
: `${message}. Run ${
|
|
125
|
+
? `${message}。请先执行 ${activeRunner()} auth logout,或使用新的 Profile,再重试。`
|
|
126
|
+
: `${message}. Run ${activeRunner()} auth logout first, or use a new Profile, then retry.`;
|
|
121
127
|
default:
|
|
122
128
|
return message;
|
|
123
129
|
}
|
|
@@ -353,7 +359,8 @@ export async function installWizard(inputValue) {
|
|
|
353
359
|
// Stage 6B1 deliberately installs/ confirms the bundled Skill before it
|
|
354
360
|
// reads customer configuration. This makes `npx ... install` useful as a
|
|
355
361
|
// one-line Codex bootstrap and ensures Skill failures cannot trigger
|
|
356
|
-
// network access, prompts, or Profile writes.
|
|
362
|
+
// network access, prompts, or Profile writes. The local runner lock is
|
|
363
|
+
// acquired only inside this step and is released before any Profile lock.
|
|
357
364
|
let codex;
|
|
358
365
|
if (!inputValue.skipCodex) {
|
|
359
366
|
try {
|
|
@@ -640,7 +647,7 @@ export async function installWizard(inputValue) {
|
|
|
640
647
|
if (rollbackFailure)
|
|
641
648
|
throw rollbackFailure;
|
|
642
649
|
if (cleanupFailure) {
|
|
643
|
-
throw new InstallError("AUTH_RELOGIN_REQUIRED", `Installation failed; ${cleanupFailure}. Run ${
|
|
650
|
+
throw new InstallError("AUTH_RELOGIN_REQUIRED", `Installation failed; ${cleanupFailure}. Run ${activeRunner()} auth logout or login again before retrying.`, { exitCode: 3 });
|
|
644
651
|
}
|
|
645
652
|
if (error instanceof InstallError)
|
|
646
653
|
throw error;
|