-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(sdk): add extra_args option to both SDKs #6469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -64,6 +64,19 @@ def validate_query_options(options: QueryOptions) -> None: | |||||||||
| ): | ||||||||||
| raise ValidationError("path_to_qwen_executable cannot be empty") | ||||||||||
|
|
||||||||||
| if options.extra_args: | ||||||||||
| _CONFLICTING_FLAGS = { | ||||||||||
| "--input-format", | ||||||||||
| "--output-format", | ||||||||||
| "--channel", | ||||||||||
| } | ||||||||||
| for arg in options.extra_args: | ||||||||||
| if arg in _CONFLICTING_FLAGS: | ||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Critical] The check
Suggested change
— qwen3.7-max via Qwen Code /review |
||||||||||
| raise ValidationError( | ||||||||||
| f"extra_args cannot include '{arg}' — " | ||||||||||
| "it is managed by the SDK" | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| if options.mcp_servers: | ||||||||||
| raise ValidationError( | ||||||||||
| "mcp_servers is not supported in Python SDK v1. " | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -335,6 +335,10 @@ export class ProcessTransport implements Transport { | |
| args.push('--session-id', this.options.sessionId); | ||
| } | ||
|
|
||
| if (this.options.extraArgs && this.options.extraArgs.length > 0) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Critical] The TypeScript SDK has no conflicting-flag validation for Add runtime validation matching the Python SDK: const CONFLICTING_FLAGS = new Set(['--input-format', '--output-format', '--channel']);
for (const arg of this.options.extraArgs ?? []) {
const name = arg.split('=', 1)[0];
if (CONFLICTING_FLAGS.has(name)) {
throw new Error(`extraArgs cannot include '${name}' — it is managed by the SDK`);
}
}— qwen3.7-max via Qwen Code /review |
||
| args.push(...this.options.extraArgs); | ||
| } | ||
|
|
||
| return args; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion]
_CONFLICTING_FLAGSis defined inside theif options.extra_args:block, but the file's convention is module-level constants (see_VALID_PERMISSION_MODES,_VALID_AUTH_TYPESat lines 13-14). Move it to module scope for consistency and discoverability:Also, the blocklist only covers 3 of ~15 SDK-managed flags. Since
extra_argsis appended last, a user can silently override--model,--approval-mode,--resume,--session-id, etc. via last-wins CLI semantics. Consider either expanding the blocklist to cover all SDK-managed flags, or updating the docstring/JSDoc to warn that only the three protocol-breaking flags are hard-blocked.— qwen3.7-max via Qwen Code /review