@nggaigc/cli 0.1.1 → 0.1.4

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 CHANGED
@@ -6,6 +6,6 @@ NGGAIGC Codex Skill 的 Windows 一命令安装器。
6
6
  npx --yes @nggaigc/cli@latest install
7
7
  ```
8
8
 
9
- 安装器会先验证内置 Plugin 的 Ed25519 签名、归档哈希和逐文件哈希,再原子安装 Skill。首次运行会打开 NGGAIGC 浏览器授权页;短期授权值只通过浏览器片段和本机回环请求返回,设备凭据只通过标准输入进入 Windows Credential Manager。安装器不接受 API Key、授权码或设备凭据参数,也不从环境变量读取这些值。
9
+ 安装器会先验证内置 Plugin 的 Ed25519 签名、归档哈希和逐文件哈希,再原子安装 Skill。首次运行会打开 NGGAIGC 浏览器授权页;浏览器仅接收短期连接挑战,安装器通过内存中的独立轮询凭据获取连接结果,设备凭据只通过标准输入进入 Windows Credential Manager。安装器不接受 API Key、授权码或设备凭据参数,也不从环境变量读取这些值。
10
10
 
11
- 当前候选支持 Windows x64/arm64,并要求 Node.js 22.13 或更高的 22.x 版本。
11
+ 当前候选支持 Windows x64/arm64,自动使用当前 Node.js 22.x(22.13 起)或 24.x。两个版本使用同一个安装包和同一套代码,不下载或内嵌 Node.js;其他主版本暂不支持。
package/dist/bin.js CHANGED
@@ -2,19 +2,21 @@
2
2
  import { CliError } from "./errors.js";
3
3
  import { runInstall } from "./install.js";
4
4
  const messages = {
5
- authorizing: "正在打开浏览器,请在 NGGAIGC 页面确认连接…",
5
+ authorizing: "浏览器已成功启动,请在 NGGAIGC 页面确认连接…",
6
6
  connected: "NGGAIGC Skill 已安装,设备连接验证成功。",
7
7
  installing: "正在安全安装已签名的 NGGAIGC Skill…",
8
+ launching: "正在请求 Windows 打开默认浏览器…",
8
9
  verifying: "正在验证 NGGAIGC 签名安装包…",
9
10
  };
10
11
  const errorMessages = {
11
12
  ARCHIVE_EXTRACTION_FAILED: "安装包无法安全解压,请稍后重试。",
12
13
  BROWSER_AUTHORIZATION_FAILED: "浏览器授权未完成,请重新运行安装命令。",
14
+ BROWSER_OPEN_FAILED: "Windows 未能打开默认浏览器。请确认已设置可用的默认浏览器,然后重新运行安装命令;本次连接未完成。",
13
15
  CONNECTION_VERIFICATION_FAILED: "设备连接验证失败,请重新运行安装命令。",
14
16
  INSTALLATION_FAILED: "本地安装未完成,请重试;现有文件未被修改。",
15
17
  INVALID_INPUT: "命令格式无效。请仅运行:npx --yes @nggaigc/cli@latest install",
16
18
  PACKAGE_VERIFICATION_FAILED: "安装包签名或完整性验证失败,已停止安装。",
17
- RUNTIME_UNSUPPORTED: "请使用 Node.js 22.13 或更高的 22.x 版本。",
19
+ RUNTIME_UNSUPPORTED: "请使用 Node.js 22.x(22.13 起)或 24.x 版本。",
18
20
  UNSUPPORTED_PLATFORM: "当前候选仅支持 Windows x64 或 Windows arm64。",
19
21
  };
20
22
  export async function main(args) {
package/dist/bundle.js CHANGED
@@ -18,7 +18,7 @@ const manifestKeys = [
18
18
  "version",
19
19
  ];
20
20
  const signatureKeys = ["algorithm", "keyId", "scope", "value"];
21
- const archiveName = "nggaigc-plugin-1.1.2.zip";
21
+ const archiveName = "nggaigc-plugin-1.1.5.zip";
22
22
  const trustedKeyId = "ngg-signing-skill-release-1";
23
23
  const trustedKeySpkiSha256 = "3d7450a1a26785d900be03e52b4b7d0b2e84fe4e4fcb6f2e903c1371b0b96cee";
24
24
  function record(value) {
@@ -57,7 +57,7 @@ export async function verifyBundle(input) {
57
57
  !exactKeys(manifestValue, manifestKeys) ||
58
58
  manifestValue.schemaVersion !== "nggaigc-plugin-package/v1" ||
59
59
  manifestValue.artifactId !== "plugin.nggaigc" ||
60
- manifestValue.version !== "1.1.2" ||
60
+ manifestValue.version !== "1.1.5" ||
61
61
  manifestValue.artifactPath !== `packages/plugins/${archiveName}` ||
62
62
  typeof manifestValue.sourceCommit !== "string" ||
63
63
  !/^[a-f0-9]{40}$/.test(manifestValue.sourceCommit) ||
package/dist/install.js CHANGED
@@ -8,14 +8,14 @@ import { CliError, fixedErrorCode } from "./errors.js";
8
8
  function defaultBundle() {
9
9
  const vendor = fileURLToPath(new URL("../vendor/", import.meta.url));
10
10
  return {
11
- archive: path.join(vendor, "nggaigc-plugin-1.1.2.zip"),
11
+ archive: path.join(vendor, "nggaigc-plugin-1.1.5.zip"),
12
12
  manifest: path.join(vendor, "manifest.json"),
13
13
  trust: path.join(vendor, "trusted-keys.json"),
14
14
  };
15
15
  }
16
16
  function validateRuntime(platform, architecture) {
17
17
  const [major, minor] = process.versions.node.split(".").map(Number);
18
- if (major !== 22 || (minor ?? 0) < 13)
18
+ if (!((major === 22 && (minor ?? 0) >= 13) || major === 24))
19
19
  throw new CliError("RUNTIME_UNSUPPORTED");
20
20
  if (platform !== "win32")
21
21
  throw new CliError("UNSUPPORTED_PLATFORM");
@@ -110,18 +110,39 @@ async function connect(launcher, options, report, probe) {
110
110
  throw new CliError("CONNECTION_VERIFICATION_FAILED");
111
111
  }
112
112
  if (!configured) {
113
- report("authorizing");
113
+ report("launching");
114
+ const interruptController = new AbortController();
115
+ const interrupt = () => interruptController.abort();
116
+ process.once("SIGINT", interrupt);
114
117
  try {
115
- const result = await launcher.main(["login"], options);
118
+ const upstreamBrowserOpened = typeof options?.browserOpened === "function"
119
+ ? options.browserOpened
120
+ : undefined;
121
+ const upstreamSignal = options?.signal;
122
+ const result = await launcher.main(["login"], {
123
+ ...options,
124
+ signal: upstreamSignal
125
+ ? AbortSignal.any([upstreamSignal, interruptController.signal])
126
+ : interruptController.signal,
127
+ browserOpened: () => {
128
+ upstreamBrowserOpened?.();
129
+ report("authorizing");
130
+ },
131
+ });
116
132
  if (result === null ||
117
133
  typeof result !== "object" ||
118
134
  !("status" in result) ||
119
135
  result.status !== "connected")
120
136
  throw new Error();
121
137
  }
122
- catch {
138
+ catch (error) {
139
+ if (fixedErrorCode(error) === "BROWSER_OPEN_FAILED")
140
+ throw new CliError("BROWSER_OPEN_FAILED");
123
141
  throw new CliError("BROWSER_AUTHORIZATION_FAILED");
124
142
  }
143
+ finally {
144
+ process.off("SIGINT", interrupt);
145
+ }
125
146
  }
126
147
  report("connected");
127
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nggaigc/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "description": "Secure one-command NGGAIGC Skill installer for Codex on Windows.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,7 @@
12
12
  "vendor/"
13
13
  ],
14
14
  "engines": {
15
- "node": ">=22.13.0 <23"
15
+ "node": ">=22.13.0 <23 || >=24.0.0 <25"
16
16
  },
17
17
  "os": [
18
18
  "win32"
@@ -24,7 +24,7 @@
24
24
  "scripts": {
25
25
  "build": "tsc -p tsconfig.build.json",
26
26
  "prepack": "tsc -p tsconfig.build.json && node scripts/stage-assets.mjs",
27
- "test": "vitest run --exclude 'dist/**' --exclude 'src/windows-secure-store.integration.test.ts'",
27
+ "test": "vitest run src --exclude 'src/windows-secure-store.integration.test.ts'",
28
28
  "test:credential:os": "tsc -p tsconfig.build.json && vitest run src/windows-secure-store.integration.test.ts",
29
29
  "typecheck": "tsc -p tsconfig.json --noEmit"
30
30
  },
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "schemaVersion": "nggaigc-plugin-package/v1",
3
3
  "artifactId": "plugin.nggaigc",
4
- "version": "1.1.2",
5
- "sourceCommit": "c5d94b4d264ffc5b4465ebe697fe4d21de711bc9",
6
- "artifactPath": "packages/plugins/nggaigc-plugin-1.1.2.zip",
7
- "sha256": "1d706fb3638f075520d250b156e78c3a81a21057e6dc19f5626acfa39b3178af",
8
- "sizeBytes": 33024,
4
+ "version": "1.1.5",
5
+ "sourceCommit": "0bdd7f286d33147cdc0c85c7774f782f1373a8e9",
6
+ "artifactPath": "packages/plugins/nggaigc-plugin-1.1.5.zip",
7
+ "sha256": "f516ff626222987c4e9a76afd865822f1ebcce2d3aa2d2bf125fe2c662540950",
8
+ "sizeBytes": 112167,
9
9
  "fileCount": 11,
10
10
  "platforms": ["win32-x64", "win32-arm64"],
11
11
  "files": {
12
- ".codex-plugin/plugin.json": "cf293fefbf769030f5fcb96d0768b11778c8050c4730e7ca729a8a1d47559053",
13
- "installer/install.cjs": "54e379c7e9fe1af7b9907887300f6d530095b77d44fccea124c8203380100842",
12
+ ".codex-plugin/plugin.json": "3efb8c28bd95b0041febdc886487c6e543d156e4607de0ae678a580c21dacd8a",
13
+ "installer/install.cjs": "34f4196d59a911f983311b0a79192b23112cdeeb5455cb57609f121bb3e55ea8",
14
14
  "skills/nggaigc/agents/openai.yaml": "4a71357d3904a2dc69b8b495f7c2f83f01d0a3c231558d7d0f10c46cd98aa301",
15
15
  "skills/nggaigc/references/catalog-and-updates.md": "c0ee74bfe9b75dc8ee818f2db55d4fd7d581927ec037452b5971c9b3a9412e93",
16
- "skills/nggaigc/references/source.json": "6e928eb1868aa24585bd5976e47dbaebda072b55ec4e70df7cd3935b886f3a43",
17
- "skills/nggaigc/scripts/bootstrap-public.json": "c22d41c4bc87c8118e0479354529663a5b404d75ed37aaf4473a4e388d948bb9",
18
- "skills/nggaigc/scripts/launch-ngg-client.cjs": "9a8d51b04ef11174f618e7683c5e11ebe0d8bdb16010203f2cf68a53c8c6b088",
19
- "skills/nggaigc/scripts/ngg_client.mjs": "fd084fbd2223d9aef8f87107b46bde137fea974a011f7e1bf88262869f633669",
20
- "skills/nggaigc/scripts/ngg-session.mjs": "966202d5599291b8031d87082da368e5dda86ce6cfe1c5003488a42614335ded",
16
+ "skills/nggaigc/references/source.json": "6dea5c5cac921526b11593be481496d521cec81d8278a10f49edab2b6efadc94",
17
+ "skills/nggaigc/scripts/bootstrap-public.json": "9e43dcf830c9984e79609faf65ca19cfe5824964b576c4a9540263d0339c3cbb",
18
+ "skills/nggaigc/scripts/launch-ngg-client.cjs": "18c5e016baa4242ccba84fee419a4b017d138b4e71fbab04ab608197afecf630",
19
+ "skills/nggaigc/scripts/ngg_client.mjs": "04e875a78b139f8ee9105bd6230e9c7188e5ca549de5972cfc356f2cea0739ee",
20
+ "skills/nggaigc/scripts/ngg-session.mjs": "166628ccb1ba8cd844de03f76296179eb0ae1480da7ec66e280d1bf88d5363cb",
21
21
  "skills/nggaigc/scripts/windows-credential.ps1": "8b6e323bebd3f86f19e0c2ae5366f4dc68005d57c07d6f699aece366661be6a0",
22
- "skills/nggaigc/SKILL.md": "3287487b20ffbbd2806ef514f9958390fa2feebce519c190788a500c79a340f2"
22
+ "skills/nggaigc/SKILL.md": "b07da5a3f78e4370301a87ceace7c26034a100631b651cdada65bf566f277ead"
23
23
  },
24
24
  "signature": {
25
25
  "algorithm": "ed25519",
26
26
  "keyId": "ngg-signing-skill-release-1",
27
27
  "scope": "artifact-bytes",
28
- "value": "AymFZmaUtNXG11z+XmLla9MI92pqSjjLpVWsJJjp1nfLJD6DLtQcgMCts4lhS4i9EFy3k6RfAXeWfjvI0UmjAw=="
28
+ "value": "kNgGmwu+UD8JwsJ4GzGTp21pF5SsGg/7nQXDPlBQTWwbg3tpxnJef5/o4GNUDzWus6DtOHKRdFce4gUsSRVpBg=="
29
29
  }
30
30
  }
Binary file
Binary file