@nggaigc/cli 0.1.40 → 0.1.42

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/bundle.js CHANGED
@@ -47,7 +47,7 @@ export async function verifyBundle(input) {
47
47
  !exactKeys(manifestValue, manifestKeys) ||
48
48
  manifestValue.schemaVersion !== "nggaigc-plugin-package/v1" ||
49
49
  manifestValue.artifactId !== "plugin.nggaigc" ||
50
- manifestValue.version !== "1.1.39" ||
50
+ manifestValue.version !== "1.1.41" ||
51
51
  manifestValue.artifactPath !==
52
52
  `packages/plugins/nggaigc-plugin-${manifestValue.version}.zip` ||
53
53
  typeof manifestValue.sourceCommit !== "string" ||
@@ -76,6 +76,68 @@ function resolve(index, id, version, rootVersion, platformVersion) {
76
76
  fail("CATALOG_INVALID");
77
77
  const state = new Map();
78
78
  const ordered = [];
79
+ const visitDependencies = (dependencies, projected = false) => {
80
+ if (!Array.isArray(dependencies) || dependencies.length > 16)
81
+ fail("DEPENDENCY_INVALID");
82
+ const unique = new Set();
83
+ for (const dependency of dependencies) {
84
+ if (!record(dependency) ||
85
+ typeof dependency.id !== "string" ||
86
+ typeof dependency.version !== "string" ||
87
+ !VERSION.test(dependency.version) ||
88
+ (!projected &&
89
+ (dependency.required !== true ||
90
+ !["skill", "capability"].includes(dependency.kind))))
91
+ fail("DEPENDENCY_INVALID");
92
+ const kind = projected || dependency.kind === "skill" ? "skill" : "capability";
93
+ const key = `${kind}:${dependency.id}@${dependency.version}`;
94
+ if (unique.has(key))
95
+ fail("DEPENDENCY_INVALID");
96
+ unique.add(key);
97
+ if (kind === "skill")
98
+ visit(dependency.id, dependency.version);
99
+ else
100
+ visitCapability(dependency.id, dependency.version);
101
+ }
102
+ };
103
+ const visitCapability = (capabilityId, requiredVersion) => {
104
+ if (!/^capability\.[a-z0-9][a-z0-9.-]{0,79}$/.test(capabilityId))
105
+ fail("DEPENDENCY_INVALID");
106
+ const matches = index.catalogEntries?.filter((entry) => entry.kind === "capability" &&
107
+ entry.id === capabilityId &&
108
+ entry.version === requiredVersion);
109
+ if (matches?.length !== 1)
110
+ fail("DEPENDENCY_UNAVAILABLE");
111
+ const entry = matches[0];
112
+ const key = `capability:${capabilityId}@${requiredVersion}`;
113
+ if (state.get(key) === "visiting")
114
+ fail("DEPENDENCY_CYCLE");
115
+ if (state.get(key) === "done")
116
+ return;
117
+ const manifest = entry.manifest;
118
+ if (!record(manifest) ||
119
+ manifest.kind !== "capability" ||
120
+ manifest.id !== capabilityId ||
121
+ manifest.version !== requiredVersion ||
122
+ !record(manifest.lifecycle) ||
123
+ manifest.lifecycle.status !== "published" ||
124
+ typeof entry.manifestSha256 !== "string" ||
125
+ !DIGEST.test(entry.manifestSha256) ||
126
+ sha256(canonical(manifest)) !== entry.manifestSha256)
127
+ fail("CATALOG_INVALID");
128
+ const compatibility = manifest.compatibility;
129
+ if (!record(compatibility) ||
130
+ !record(compatibility.platform) ||
131
+ typeof compatibility.platform.minimum !== "string" ||
132
+ typeof compatibility.platform.maximumExclusive !== "string" ||
133
+ !compatible(platformVersion, compatibility.platform))
134
+ fail("PACKAGE_INCOMPATIBLE");
135
+ if (state.size >= 32)
136
+ fail("DEPENDENCY_INVALID");
137
+ state.set(key, "visiting");
138
+ visitDependencies(manifest.dependencies);
139
+ state.set(key, "done");
140
+ };
79
141
  const visit = (skillId, requiredVersion) => {
80
142
  if (!ID.test(skillId))
81
143
  fail("CATALOG_INVALID");
@@ -84,7 +146,7 @@ function resolve(index, id, version, rootVersion, platformVersion) {
84
146
  if (matches.length !== 1)
85
147
  fail("DEPENDENCY_UNAVAILABLE");
86
148
  const entry = matches[0];
87
- const key = `${entry.id}@${entry.version}`;
149
+ const key = `skill:${entry.id}@${entry.version}`;
88
150
  if (state.get(key) === "visiting")
89
151
  fail("DEPENDENCY_CYCLE");
90
152
  if (state.get(key) === "done")
@@ -105,18 +167,13 @@ function resolve(index, id, version, rootVersion, platformVersion) {
105
167
  !compatible(rootVersion, metadata.compatibility.rootSkill) ||
106
168
  !compatible(platformVersion, metadata.compatibility.platform))
107
169
  fail("PACKAGE_INCOMPATIBLE");
108
- const dependencies = entry.manifest.requires;
109
- if (!Array.isArray(dependencies) ||
110
- dependencies.length > 16 ||
111
- !dependencies.every((item) => record(item) &&
112
- typeof item.id === "string" &&
113
- typeof item.version === "string" &&
114
- VERSION.test(item.version)) ||
115
- ordered.length + state.size > 32)
170
+ if (state.size >= 32)
116
171
  fail("DEPENDENCY_INVALID");
117
172
  state.set(key, "visiting");
118
- for (const dependency of dependencies)
119
- visit(dependency.id, dependency.version);
173
+ const sourceDependencies = index.catalogEntries
174
+ ? entry.sourceManifest?.dependencies
175
+ : undefined;
176
+ visitDependencies(sourceDependencies ?? entry.manifest.requires, sourceDependencies === undefined);
120
177
  state.set(key, "done");
121
178
  ordered.push(entry);
122
179
  };
@@ -187,14 +244,6 @@ export function projectActiveSkillCatalog(snapshot) {
187
244
  typeof dependency.version !== "string" ||
188
245
  dependency.required !== true)
189
246
  fail("DEPENDENCY_INVALID");
190
- const matches = publicEntries.filter((candidate) => candidate.kind === dependency.kind &&
191
- candidate.id === dependency.id &&
192
- candidate.version === dependency.version &&
193
- record(candidate.manifest) &&
194
- record(candidate.manifest.lifecycle) &&
195
- candidate.manifest.lifecycle.status === "published");
196
- if (matches.length !== 1)
197
- fail("DEPENDENCY_UNAVAILABLE");
198
247
  if (dependency.kind === "skill")
199
248
  requires.push({ id: dependency.id, version: dependency.version });
200
249
  else if (dependency.kind !== "capability")
@@ -224,6 +273,7 @@ export function projectActiveSkillCatalog(snapshot) {
224
273
  schemaVersion: "nggaigc-independent-skill-index/v1",
225
274
  releaseId: snapshot.releaseId,
226
275
  entries,
276
+ catalogEntries: publicEntries,
227
277
  };
228
278
  }
229
279
  function storedZipEntries(input) {
@@ -315,7 +365,9 @@ function packageFileType(value) {
315
365
  function validStaticPng(input) {
316
366
  const bytes = Buffer.from(input);
317
367
  if (bytes.length < 45 ||
318
- !bytes.subarray(0, 8).equals(Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])))
368
+ !bytes
369
+ .subarray(0, 8)
370
+ .equals(Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])))
319
371
  return false;
320
372
  let cursor = 8;
321
373
  let chunks = 0;
@@ -759,6 +811,7 @@ export async function prepareIndependentSkill(options) {
759
811
  fail("INSTALL_PATH_UNSAFE");
760
812
  const fetcher = options.fetcher ?? fetch;
761
813
  let result;
814
+ const preparedSkills = [];
762
815
  for (const entry of ordered) {
763
816
  const slug = entry.id.slice("skill.".length);
764
817
  if (slug === "nggaigc")
@@ -785,6 +838,7 @@ export async function prepareIndependentSkill(options) {
785
838
  skillPath: path.join(target, "SKILL.md"),
786
839
  reused: true,
787
840
  };
841
+ preparedSkills.push(result);
788
842
  continue;
789
843
  }
790
844
  const bytes = await download(entry, options.index.releaseId, options.origin ?? "https://api.nggaigc.com/", fetcher);
@@ -842,6 +896,7 @@ export async function prepareIndependentSkill(options) {
842
896
  skillPath: path.join(target, "SKILL.md"),
843
897
  reused: false,
844
898
  };
899
+ preparedSkills.push(result);
845
900
  }
846
901
  finally {
847
902
  await rm(stage, { recursive: true, force: true });
@@ -852,7 +907,7 @@ export async function prepareIndependentSkill(options) {
852
907
  await rm(lock, { force: true });
853
908
  }
854
909
  }
855
- return result;
910
+ return { ...result, preparedSkills };
856
911
  }
857
912
  /** Official start path: online server admission must precede any local preparation. */
858
913
  export async function startIndependentSkill(options) {
package/dist/install.js CHANGED
@@ -8,7 +8,7 @@ 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.39.zip"),
11
+ archive: path.join(vendor, "nggaigc-plugin-1.1.41.zip"),
12
12
  manifest: path.join(vendor, "manifest.json"),
13
13
  trust: path.join(vendor, "trusted-keys.json"),
14
14
  };
@@ -15,7 +15,7 @@ function record(value) {
15
15
  async function productionDependencies(codexHome) {
16
16
  const vendor = fileURLToPath(new URL("../vendor/", import.meta.url));
17
17
  const bundle = await verifyBundle({
18
- archive: path.join(vendor, "nggaigc-plugin-1.1.39.zip"),
18
+ archive: path.join(vendor, "nggaigc-plugin-1.1.41.zip"),
19
19
  manifest: path.join(vendor, "manifest.json"),
20
20
  trust: path.join(vendor, "trusted-keys.json"),
21
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nggaigc/cli",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "description": "Secure one-command NGGAIGC Skill installer for Codex.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "schemaVersion": "nggaigc-plugin-package/v1",
3
3
  "artifactId": "plugin.nggaigc",
4
- "version": "1.1.39",
5
- "sourceCommit": "770deaebd8c50d389420148ebcdbc28d6516e4eb",
6
- "artifactPath": "packages/plugins/nggaigc-plugin-1.1.39.zip",
7
- "sha256": "5b9f9e8bd863b6587387ab04db847df2c270c64baa9a69b65b71b8ee80d236de",
8
- "sizeBytes": 485465,
4
+ "version": "1.1.41",
5
+ "sourceCommit": "2b1c96010bd572ba2639c9eb68accadee8358c77",
6
+ "artifactPath": "packages/plugins/nggaigc-plugin-1.1.41.zip",
7
+ "sha256": "6f61843f956767517192ef142a9155aca5c07949a30ce9a50072c1c4a4483396",
8
+ "sizeBytes": 486916,
9
9
  "fileCount": 24,
10
10
  "platforms": [
11
11
  "win32-x64",
@@ -13,7 +13,7 @@
13
13
  "darwin-arm64"
14
14
  ],
15
15
  "files": {
16
- ".codex-plugin/plugin.json": "9b5a5a97017565ada98c4a41f5fa79f93f2f972489ed4d216a98a366ebd612eb",
16
+ ".codex-plugin/plugin.json": "76a1379c3bb048cce6eab41a44a27a1a9457682f0ffb2552bae70c7c47b24e73",
17
17
  "installer/install.cjs": "a0c94ed71edf4cd7eb4a66609a4dcf73049abbd14aa273ee65b9b3029be2da2b",
18
18
  "installer/legacy-root-digests.json": "922552646a5aa6cff8616c372912a37b1d5f263351206b85785ed9b2eae31641",
19
19
  "installer/signed-pair-1.1.16.json": "ccb22a90302cc5c9c585067ebc211a27b0c9d8a177c2740a5678a58a3d70bfe9",
@@ -24,24 +24,24 @@
24
24
  "migration/seedream-1.1.3/scripts/seedream.mjs": "dcc6af4d945790d9dfd7fac21c60934759d7ac2576a14507d0299f4833942a96",
25
25
  "migration/seedream-1.1.3/SKILL.md": "5c5cf3c2d99376f246425e873c5566436ed528256372ac3208abb60364c4517c",
26
26
  "skills/nggaigc/agents/openai.yaml": "8936d97b9821e687e224e9349cc42be2ee5fc20988562efffbcb70080aedf87c",
27
- "skills/nggaigc/references/catalog-and-updates.md": "f6eee93f5f009f381c4e729cb129176e976edd4ec5c0990c300ac6096dd4ea83",
28
- "skills/nggaigc/references/source.json": "78628a84a27ed234c96462351cc1663c8ae8d3ef2345fa396ed152545a3aec60",
27
+ "skills/nggaigc/references/catalog-and-updates.md": "d02773256fc4d2324415942bdc64593e768a49a4124f22eb7d3f74797f934c1e",
28
+ "skills/nggaigc/references/source.json": "d5792b6cca1440514ad294a2e7ceff34df52cfaf833eecf8d6e4edc56c16817f",
29
29
  "skills/nggaigc/scripts/api_client.mjs": "bf3c671cec24e8ec80d227fdc7ce79c8051fddd21b80df67837ec724f1d8c0ae",
30
30
  "skills/nggaigc/scripts/api_package.mjs": "880e3df0a2f750933c343f0393626d9a5b6e8ecac0622f171da2295c11d7655c",
31
- "skills/nggaigc/scripts/bootstrap-public.json": "5452d0e77bdca7226664b27242fb856d1564d6ed20d8c86f0e12179373359924",
32
- "skills/nggaigc/scripts/launch-ngg-client.cjs": "c4fe67117d1cb05e605a07c64294aa3b17861dd49b4c3db0fd62376501f7adba",
31
+ "skills/nggaigc/scripts/bootstrap-public.json": "b6bdee2accfbb23ee97c7434460cd822d56328d3e440c4d167b13cbdecc7b819",
32
+ "skills/nggaigc/scripts/launch-ngg-client.cjs": "645577f46057674f52c716de9740d9a851973bcc1dc427e14d144d88b1fd2887",
33
33
  "skills/nggaigc/scripts/macos-keychain": "b0bdf29d14219d38ca18c7e5c599deb0daa8c8ac70b0babbc7d4fb23673079ec",
34
34
  "skills/nggaigc/scripts/macos-keychain.swift": "1b57e74fde66c824fe970547dd8ca0883a3334c34c065e85a8a2a90d4556a7f5",
35
- "skills/nggaigc/scripts/ngg_client.mjs": "1db706db152ec94bd628acf3031dfaec3493e6b60bb12b19a1846fa5dd3e30d7",
36
- "skills/nggaigc/scripts/ngg-session.mjs": "1ccb868b9398432de9e846063bb080498af7a248d51cec34d256a8759c0bfbc7",
35
+ "skills/nggaigc/scripts/ngg_client.mjs": "aff899042271fd191ba30e55669c4463536daa8132095b77464e1714b97bccb5",
36
+ "skills/nggaigc/scripts/ngg-session.mjs": "2e7bf37e74ec14db6ab2d76fb181751d665c6df6696d6a77d1d9a7ace1daad9d",
37
37
  "skills/nggaigc/scripts/supported-platforms.json": "ec8b0754c489e04534a1d9880dd6664ba9c5bcd07789e06d138e0923f23575ff",
38
38
  "skills/nggaigc/scripts/windows-credential.ps1": "80d470fb0c9473d26bd599cafa9f1c2ad69056d4a835888ddcbb5c1548f9d059",
39
- "skills/nggaigc/SKILL.md": "8128d8c38ec8051a664082f36c65e566a96d3a1927f40d5cf638dc928500fe03"
39
+ "skills/nggaigc/SKILL.md": "f6ccf3c685cb118ec6ec495da344a5e57ca69ea84d3e5d1f7cd817e5a594a52e"
40
40
  },
41
41
  "signature": {
42
42
  "algorithm": "ed25519",
43
43
  "keyId": "ngg-signing-skill-release-1",
44
44
  "scope": "artifact-bytes",
45
- "value": "M4KsGUOCa2NBYWB6WZKzzeqlSBqcfsN+xVb+WvnXzAjEUfD1FN2soBlyNE/FBfGPv/LsVDJU26ZSU76PKD9oBA=="
45
+ "value": "v1dT1VZ0sNRCPFOoawgyI/ZlLcF53LbNpVbm2d4BSYM/CPqvvOA2av4mr+zTmzRGOi8VN2ZMLhxoEkreVbFgDg=="
46
46
  }
47
47
  }
index 192c613..28300ec 100644
Binary file