cognitive-modules-cli 2.2.9 → 2.2.11
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/CHANGELOG.md +8 -0
- package/README.md +4 -4
- package/dist/providers/gemini.js +32 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this package are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 2.2.11 - 2026-02-07
|
|
6
|
+
|
|
7
|
+
- Fix: Gemini `responseSchema` compatibility by dropping non-string `enum`/`const` constraints (Gemini rejects boolean enums).
|
|
8
|
+
|
|
9
|
+
## 2.2.10 - 2026-02-07
|
|
10
|
+
|
|
11
|
+
- Fix: Gemini `responseSchema` compatibility by converting JSON-Schema `const` to `enum`.
|
|
12
|
+
|
|
5
13
|
## 2.2.9 - 2026-02-07
|
|
6
14
|
|
|
7
15
|
- Fix: `cog core run` now prints the error envelope (instead of `Error: undefined`) when execution fails.
|
package/README.md
CHANGED
|
@@ -10,12 +10,12 @@ Node.js/TypeScript 版本的 Cognitive Modules CLI,提供 `cog` 命令。
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
# 全局安装(推荐)
|
|
13
|
-
npm install -g cogn@2.2.
|
|
13
|
+
npm install -g cogn@2.2.11
|
|
14
14
|
# 或使用完整包名(同样提供 `cog` 命令)
|
|
15
|
-
# npm install -g cognitive-modules-cli@2.2.
|
|
15
|
+
# npm install -g cognitive-modules-cli@2.2.11
|
|
16
16
|
|
|
17
17
|
# 或使用 npx 零安装
|
|
18
|
-
npx cogn@2.2.
|
|
18
|
+
npx cogn@2.2.11 --help
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
## 快速开始
|
|
@@ -95,7 +95,7 @@ cog doctor
|
|
|
95
95
|
# 可通过环境变量或全局参数覆盖:
|
|
96
96
|
COGNITIVE_REGISTRY_URL=... cog search
|
|
97
97
|
COGNITIVE_REGISTRY_TIMEOUT_MS=15000 COGNITIVE_REGISTRY_MAX_BYTES=2097152 cog search
|
|
98
|
-
cog search --registry https://github.com/Cognary/cognitive/releases/download/v2.2.
|
|
98
|
+
cog search --registry https://github.com/Cognary/cognitive/releases/download/v2.2.11/cognitive-registry.v2.json
|
|
99
99
|
cog registry verify --remote --index https://github.com/Cognary/cognitive/releases/latest/download/cognitive-registry.v2.json
|
|
100
100
|
cog registry verify --remote --concurrency 2
|
|
101
101
|
```
|
package/dist/providers/gemini.js
CHANGED
|
@@ -36,6 +36,38 @@ export class GeminiProvider extends BaseProvider {
|
|
|
36
36
|
if (obj && typeof obj === 'object') {
|
|
37
37
|
const result = {};
|
|
38
38
|
for (const [key, value] of Object.entries(obj)) {
|
|
39
|
+
// Gemini's responseSchema has a restricted schema subset.
|
|
40
|
+
// In particular:
|
|
41
|
+
// - `const` is not supported
|
|
42
|
+
// - `enum` values appear to be string-only in the API surface
|
|
43
|
+
if (key === 'const') {
|
|
44
|
+
// Preserve type info as best-effort but drop the exact-value constraint.
|
|
45
|
+
// (Core runtime will still validate/repair the envelope.)
|
|
46
|
+
if (value === null) {
|
|
47
|
+
// Leave unconstrained; null typing is not consistently supported.
|
|
48
|
+
}
|
|
49
|
+
else if (typeof value === 'boolean') {
|
|
50
|
+
result.type = 'boolean';
|
|
51
|
+
}
|
|
52
|
+
else if (typeof value === 'number') {
|
|
53
|
+
result.type = 'number';
|
|
54
|
+
}
|
|
55
|
+
else if (typeof value === 'string') {
|
|
56
|
+
result.type = 'string';
|
|
57
|
+
// String enums are supported, so we can keep a single-value constraint.
|
|
58
|
+
result.enum = [value];
|
|
59
|
+
}
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (key === 'enum') {
|
|
63
|
+
if (Array.isArray(value) && value.every((v) => typeof v === 'string')) {
|
|
64
|
+
result.enum = value.map((v) => v);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// Drop non-string enums for Gemini compatibility.
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
39
71
|
if (!unsupportedFields.includes(key)) {
|
|
40
72
|
result[key] = clean(value);
|
|
41
73
|
}
|