@genspark/cli 1.11.0 → 1.11.2

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
@@ -203,23 +203,42 @@ gsk me
203
203
 
204
204
  ### init-opencode
205
205
 
206
- Generate an `.opencode.json` config file for [OpenCode](https://opencode.ai), pre-configured to use Genspark's LLM proxy with your API key.
206
+ Generate an `opencode.json` config file for [OpenCode](https://opencode.ai), pre-configured to use Genspark's LLM proxy with your API key.
207
207
 
208
208
  ```bash
209
- # Generate with default model (claude-opus-4-6-1m)
209
+ # Generate with the server-selected default model
210
210
  gsk init-opencode
211
211
 
212
212
  # Specify a different default model
213
213
  gsk init-opencode --model claude-sonnet-4-6
214
214
 
215
215
  # Write to a custom path
216
- gsk init-opencode -o ./my-project/.opencode.json
216
+ gsk init-opencode -o ./my-project/opencode.json
217
217
  ```
218
218
 
219
219
  | Option | Default | Description |
220
220
  |--------|---------|-------------|
221
- | `--model <name>` | `claude-opus-4-6-1m` | Default model for OpenCode |
222
- | `-o, --out <path>` | `.opencode.json` (cwd) | Output file path |
221
+ | `--model <name>` | Server-selected | Default model for OpenCode |
222
+ | `-o, --out <path>` | `opencode.json` (cwd) | Output file path |
223
+
224
+ The generated models include per-model reasoning variants, selectable with OpenCode's variant selector:
225
+
226
+ | Models | Selectable levels |
227
+ |--------|-------------------|
228
+ | DeepSeek V4 Pro / Flash / Pro 0813 (text), including listed Baseten Pro | `none`, `low`, `high`, `max` |
229
+ | GLM-5.3 / GLM-5.3 Flash | `low`, `high`, `max` |
230
+ | GPT-5.2 / 5.4 (including mini/nano) / 5.5 | `none`, `low`, `medium`, `high`, `xhigh` |
231
+ | GPT-5.6 | `none`, `low`, `medium`, `high`, `xhigh`, `max` |
232
+ | GPT-6 Astra | `low`, `medium`, `high`, `xhigh`, `max` |
233
+ | Adaptive Claude | `low`, `medium`, `high`, `xhigh` |
234
+ | Legacy Claude / Grok 4.5 | `low`, `medium`, `high` |
235
+ | Gemini 3.1 Pro / 3.7 Flash / 3.8 Flash | `low`, `medium`, `high` |
236
+ | Gemini 3 Flash / 3.1 Flash Lite / 3.5 Flash / 3.6 Flash | `minimal`, `low`, `medium`, `high` |
237
+ | MiniMax M3 | `none` (off), `thinking` (always think); no selection keeps adaptive mode |
238
+
239
+ Model access gates still apply. Models without a verified end-to-end effort contract (including Kimi K3, GLM-5.2, Grok 4.6 and DeepSeek vision-exp) do not gain speculative levels. MiniMax modes are not reasoning-depth levels. Gemini uses native `thinkingConfig.thinkingLevel`, not `reasoning_effort`.
240
+
241
+ The server owns this catalog; regenerating overwrites the output file, so preserve custom settings first. No CLI package update is needed for catalog changes. For rollout, deploy the LiteLLM effort-forwarding hook before the backend catalog/validation change, then regenerate configs; this avoids advertising levels while an older proxy still pins or drops them. This command does not deploy either service.
223
242
 
224
243
  ### init-skills
225
244
 
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Schema-driven repair of JSON-array literals handed to array flags (#60410).
3
+ *
4
+ * Every schema `array` parameter is registered as a Commander variadic
5
+ * (`--name <values...>`, see addSchemaOption in index.ts) and nothing in the
6
+ * CLI JSON-parses flag values. So `--sheet_names '["A","B"]'` reaches the
7
+ * server as the ONE-element array `['["A","B"]']` — Google Sheets then created
8
+ * a sheet literally named `["A","B"]` and every later `B!A1:..` write 400'd.
9
+ * Agents write that shape because two sibling flags on the same command
10
+ * (`--values`, `--initial_data`) document exactly it, and the server-side
11
+ * repair from #47625 only covers those two.
12
+ *
13
+ * Contract:
14
+ * - Only a value that is a single string, or a one-element array holding a
15
+ * single string, whose trimmed text is a JSON array literal is touched.
16
+ * `--names a b`, real arrays from --args-file and per-element JSON
17
+ * objects (`--params '{"a":1}' '{"b":2}'`) are left alone.
18
+ * - Text that merely starts with `[` but is not valid JSON (`[Draft]`) is a
19
+ * legitimate value and passes through unchanged.
20
+ * - A literal that parses but whose elements do not match the schema's
21
+ * `items.type` is refused with an actionable error, and nothing is sent:
22
+ * the caller clearly meant a JSON array, so forwarding the text (or
23
+ * guessing a shape) would only move the failure server-side.
24
+ * - Escape hatch for a value that genuinely IS JSON-array-shaped text (a
25
+ * free-text answer such as `["yes","no"]`): put it in --args-file as a
26
+ * real JSON array, `{"answer": ["[\"yes\",\"no\"]"]}`. JSON has no
27
+ * shell ambiguity — an array there is an array and a string a string —
28
+ * so arrays that arrive from the file are forwarded verbatim; only a
29
+ * file STRING where the schema wants an array is repaired.
30
+ */
31
+ export interface ArrayParameterLike {
32
+ type: string | string[];
33
+ items?: {
34
+ type?: string | string[];
35
+ };
36
+ }
37
+ export type JsonArrayRepair = {
38
+ kind: 'unchanged';
39
+ } | {
40
+ kind: 'replaced';
41
+ value: unknown[];
42
+ } | {
43
+ kind: 'error';
44
+ message: string;
45
+ };
46
+ /**
47
+ * Decide what to do with one array parameter's value. Pure; never throws.
48
+ */
49
+ export declare function repairJsonArrayLiteral(name: string, value: unknown, param: ArrayParameterLike): JsonArrayRepair;
50
+ export interface RepairJsonArrayArgsOptions {
51
+ /**
52
+ * Parameters whose current value is a real JSON array from --args-file.
53
+ * Those arrays are forwarded verbatim (see the escape hatch above); a
54
+ * string value under one of these keys is still repaired.
55
+ */
56
+ literalArrayKeys?: ReadonlySet<string>;
57
+ }
58
+ /**
59
+ * Apply repairJsonArrayLiteral to every schema `array` parameter present in
60
+ * `args`, in place. A parameter counts as an array parameter when `array`
61
+ * appears anywhere in its `type` (a nullable `["null", "array"]` included).
62
+ * Returns the first refusal message, or null when every value was accepted
63
+ * (repaired or untouched).
64
+ */
65
+ export declare function repairJsonArrayArgs(args: Record<string, unknown>, props: Record<string, ArrayParameterLike>, options?: RepairJsonArrayArgsOptions): string | null;
66
+ //# sourceMappingURL=arrayArgs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayArgs.d.ts","sourceRoot":"","sources":["../src/arrayArgs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACvB,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAA;CACrC;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,OAAO,EAAE,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAqDtC;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,kBAAkB,GACxB,eAAe,CA0CjB;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CACvC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACzC,OAAO,GAAE,0BAA+B,GACvC,MAAM,GAAG,IAAI,CAYf"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Schema-driven repair of JSON-array literals handed to array flags (#60410).
3
+ *
4
+ * Every schema `array` parameter is registered as a Commander variadic
5
+ * (`--name <values...>`, see addSchemaOption in index.ts) and nothing in the
6
+ * CLI JSON-parses flag values. So `--sheet_names '["A","B"]'` reaches the
7
+ * server as the ONE-element array `['["A","B"]']` — Google Sheets then created
8
+ * a sheet literally named `["A","B"]` and every later `B!A1:..` write 400'd.
9
+ * Agents write that shape because two sibling flags on the same command
10
+ * (`--values`, `--initial_data`) document exactly it, and the server-side
11
+ * repair from #47625 only covers those two.
12
+ *
13
+ * Contract:
14
+ * - Only a value that is a single string, or a one-element array holding a
15
+ * single string, whose trimmed text is a JSON array literal is touched.
16
+ * `--names a b`, real arrays from --args-file and per-element JSON
17
+ * objects (`--params '{"a":1}' '{"b":2}'`) are left alone.
18
+ * - Text that merely starts with `[` but is not valid JSON (`[Draft]`) is a
19
+ * legitimate value and passes through unchanged.
20
+ * - A literal that parses but whose elements do not match the schema's
21
+ * `items.type` is refused with an actionable error, and nothing is sent:
22
+ * the caller clearly meant a JSON array, so forwarding the text (or
23
+ * guessing a shape) would only move the failure server-side.
24
+ * - Escape hatch for a value that genuinely IS JSON-array-shaped text (a
25
+ * free-text answer such as `["yes","no"]`): put it in --args-file as a
26
+ * real JSON array, `{"answer": ["[\"yes\",\"no\"]"]}`. JSON has no
27
+ * shell ambiguity — an array there is an array and a string a string —
28
+ * so arrays that arrive from the file are forwarded verbatim; only a
29
+ * file STRING where the schema wants an array is repaired.
30
+ */
31
+ const PREVIEW_MAX = 80;
32
+ function literalText(value) {
33
+ if (typeof value === 'string')
34
+ return value;
35
+ if (Array.isArray(value) &&
36
+ value.length === 1 &&
37
+ typeof value[0] === 'string') {
38
+ return value[0];
39
+ }
40
+ return undefined;
41
+ }
42
+ function matchesItemType(element, expected) {
43
+ switch (expected) {
44
+ case 'string':
45
+ return typeof element === 'string';
46
+ case 'integer':
47
+ return typeof element === 'number' && Number.isInteger(element);
48
+ case 'number':
49
+ return typeof element === 'number';
50
+ case 'boolean':
51
+ return typeof element === 'boolean';
52
+ case 'array':
53
+ return Array.isArray(element);
54
+ case 'object':
55
+ return (typeof element === 'object' &&
56
+ element !== null &&
57
+ !Array.isArray(element));
58
+ case 'null':
59
+ return element === null;
60
+ default:
61
+ // Unknown item type: not ours to judge, the server validates.
62
+ return true;
63
+ }
64
+ }
65
+ function describeElement(element) {
66
+ if (element === null)
67
+ return 'null';
68
+ if (Array.isArray(element))
69
+ return 'an array';
70
+ if (typeof element === 'object')
71
+ return 'an object';
72
+ return `a ${typeof element}`;
73
+ }
74
+ function preview(text) {
75
+ return text.length > PREVIEW_MAX ? `${text.slice(0, PREVIEW_MAX)}…` : text;
76
+ }
77
+ /**
78
+ * Decide what to do with one array parameter's value. Pure; never throws.
79
+ */
80
+ export function repairJsonArrayLiteral(name, value, param) {
81
+ const text = literalText(value);
82
+ if (text === undefined)
83
+ return { kind: 'unchanged' };
84
+ const trimmed = text.trim();
85
+ if (!trimmed.startsWith('[') || !trimmed.endsWith(']')) {
86
+ return { kind: 'unchanged' };
87
+ }
88
+ let parsed;
89
+ try {
90
+ parsed = JSON.parse(trimmed);
91
+ }
92
+ catch {
93
+ // Not JSON: `[Draft]`-style text is a legitimate single value, so the
94
+ // caller's string goes through untouched (the server validates it).
95
+ return { kind: 'unchanged' };
96
+ }
97
+ if (!Array.isArray(parsed))
98
+ return { kind: 'unchanged' };
99
+ const rawItemType = param.items?.type;
100
+ const expected = rawItemType === undefined
101
+ ? []
102
+ : Array.isArray(rawItemType)
103
+ ? rawItemType
104
+ : [rawItemType];
105
+ if (expected.length > 0) {
106
+ const bad = parsed.findIndex(element => !expected.some(t => matchesItemType(element, t)));
107
+ if (bad !== -1) {
108
+ const want = expected.join(' or ');
109
+ return {
110
+ kind: 'error',
111
+ message: `--${name}: ${preview(trimmed)} parses as a JSON array, but element ` +
112
+ `${bad} is ${describeElement(parsed[bad])} where the schema wants ` +
113
+ `${want}. Pass one value per token (--${name} <v1> <v2>) or a JSON ` +
114
+ `array whose elements are all ${want}. The request was NOT sent ` +
115
+ '(nothing was billed).'
116
+ };
117
+ }
118
+ }
119
+ return { kind: 'replaced', value: parsed };
120
+ }
121
+ /**
122
+ * Apply repairJsonArrayLiteral to every schema `array` parameter present in
123
+ * `args`, in place. A parameter counts as an array parameter when `array`
124
+ * appears anywhere in its `type` (a nullable `["null", "array"]` included).
125
+ * Returns the first refusal message, or null when every value was accepted
126
+ * (repaired or untouched).
127
+ */
128
+ export function repairJsonArrayArgs(args, props, options = {}) {
129
+ for (const [name, param] of Object.entries(props)) {
130
+ const types = Array.isArray(param.type) ? param.type : [param.type];
131
+ if (!types.includes('array') || args[name] === undefined)
132
+ continue;
133
+ const fromFileAsArray = options.literalArrayKeys?.has(name) && Array.isArray(args[name]);
134
+ if (fromFileAsArray)
135
+ continue;
136
+ const repair = repairJsonArrayLiteral(name, args[name], param);
137
+ if (repair.kind === 'error')
138
+ return repair.message;
139
+ if (repair.kind === 'replaced')
140
+ args[name] = repair.value;
141
+ }
142
+ return null;
143
+ }
144
+ //# sourceMappingURL=arrayArgs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayArgs.js","sourceRoot":"","sources":["../src/arrayArgs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAYH,MAAM,WAAW,GAAG,EAAE,CAAA;AAEtB,SAAS,WAAW,CAAC,KAAc;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,EAC5B,CAAC;QACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,OAAgB,EAAE,QAAgB;IACzD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAA;QACpC,KAAK,SAAS;YACZ,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QACjE,KAAK,QAAQ;YACX,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAA;QACpC,KAAK,SAAS;YACZ,OAAO,OAAO,OAAO,KAAK,SAAS,CAAA;QACrC,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAA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EAAE,oBAAoB,CAAA;CAC3B;AAED,kFAAkF;AAClF,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EAAE,GACb,mBAAmB,EAAE,CAqBvB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AA8SH,KAAK,oBAAoB,GAAG,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAA;AAEtE,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AAED,kFAAkF;AAClF,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EAAE,GACb,mBAAmB,EAAE,CAqBvB"}
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ import { classifyFileArg, awaitLocalFileReady, decideAfterWait, localFileNotRead
33
33
  import { setDebugEnabled, setOutputFormat, debug, info, warn, error as logError, output, progress, } from './logger.js';
34
34
  import { runInteractiveApprovalFlow, shouldPromptForApproval, } from './pendingApproval.js';
35
35
  import { isPendingConfirmationEnvelope, runPreCallConfirmation, STALE_SCHEMA_CACHE_MESSAGE, } from './confirm.js';
36
+ import { repairJsonArrayArgs } from './arrayArgs.js';
36
37
  import { clearToolsCache, getCachedFeatures, loadConfigFile, getConfigPath, loadToolsCache, normalizeBaseUrl, saveToolsCache, setConfigPathOverride, updateConfigFile, } from './config.js';
37
38
  import { checkForUpdates } from './updater.js';
38
39
  import { addRegisteredCommands, collectToolCommandTokens, staleCacheMissingToken, } from './staleCache.js';
@@ -1056,6 +1057,10 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
1056
1057
  // deliberate rich payload, flags are the convenience layer (#46011).
1057
1058
  // It sits before the numeric coercion below so file-provided
1058
1059
  // numeric strings get the same schema-driven coercion flags do.
1060
+ // Array values that arrive from --args-file as real JSON arrays are
1061
+ // forwarded verbatim by the array-literal repair below (JSON has no
1062
+ // shell ambiguity); collected here because the merge erases origin.
1063
+ const fileProvidedArrays = new Set();
1059
1064
  if (argsFilePath) {
1060
1065
  let fileArgs;
1061
1066
  try {
@@ -1094,6 +1099,10 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
1094
1099
  process.exit(1);
1095
1100
  }
1096
1101
  Object.assign(args, fileArgs);
1102
+ for (const [key, value] of Object.entries(fileArgs)) {
1103
+ if (Array.isArray(value))
1104
+ fileProvidedArrays.add(key);
1105
+ }
1097
1106
  // Required params were registered optional because the file may
1098
1107
  // carry them (Commander validates before the file is readable) —
1099
1108
  // re-validate the merged set now. CLI-populated params are
@@ -1128,6 +1137,23 @@ function registerToolCommand(parentProgram, tool, clientFactory, vdProjectIdDefa
1128
1137
  }
1129
1138
  }
1130
1139
  }
1140
+ // Array flags are variadics that never JSON-parse, so a whole-array
1141
+ // literal (`--sheet_names '["A","B"]'`) arrives as ONE element and
1142
+ // the server acts on the text verbatim — Google Sheets created a
1143
+ // sheet literally named `["A","B"]` (#60410). Repair it here, after
1144
+ // the --args-file merge, so both input paths see one contract; an
1145
+ // element type that contradicts items.type is refused before any
1146
+ // server call, and a real array from the file is the literal escape
1147
+ // hatch (contract in arrayArgs.ts).
1148
+ {
1149
+ const arrayError = repairJsonArrayArgs(args, props, {
1150
+ literalArrayKeys: fileProvidedArrays,
1151
+ });
1152
+ if (arrayError) {
1153
+ logError(arrayError);
1154
+ process.exit(1);
1155
+ }
1156
+ }
1131
1157
  // Pre-call confirmation (confirm.ts): when the cached /tools
1132
1158
  // payload advertised interactive_confirm AND the schema marks this
1133
1159
  // tool/action confirmation-required, resolve [y/N] / --yes /