cognitive-modules-cli 2.2.10 → 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 CHANGED
@@ -2,6 +2,10 @@
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
+
5
9
  ## 2.2.10 - 2026-02-07
6
10
 
7
11
  - Fix: Gemini `responseSchema` compatibility by converting JSON-Schema `const` to `enum`.
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.10
13
+ npm install -g cogn@2.2.11
14
14
  # 或使用完整包名(同样提供 `cog` 命令)
15
- # npm install -g cognitive-modules-cli@2.2.10
15
+ # npm install -g cognitive-modules-cli@2.2.11
16
16
 
17
17
  # 或使用 npx 零安装
18
- npx cogn@2.2.10 --help
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.10/cognitive-registry.v2.json
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
  ```
@@ -36,10 +36,36 @@ 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 does not accept JSON-Schema `const`.
40
- // Convert `{ const: X }` into `{ enum: [X] }` for compatibility.
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
41
43
  if (key === 'const') {
42
- result.enum = [clean(value)];
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
+ }
43
69
  continue;
44
70
  }
45
71
  if (!unsupportedFields.includes(key)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cognitive-modules-cli",
3
- "version": "2.2.10",
3
+ "version": "2.2.11",
4
4
  "description": "Cognitive Modules - Structured AI Task Execution with version management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",