-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(sdk): add disabled_slash_commands option to Python and TS SDKs #6480
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,6 +46,7 @@ export type TransportOptions = { | |||||
| * When resume is provided, this should match the resume ID. | ||||||
| */ | ||||||
| sessionId?: string; | ||||||
| disabledSlashCommands?: string[]; | ||||||
| }; | ||||||
|
|
||||||
| export interface QuerySystemPromptPreset { | ||||||
|
|
@@ -465,6 +466,14 @@ export interface QueryOptions { | |||||
| */ | ||||||
| sessionId?: string; | ||||||
|
|
||||||
| /** | ||||||
| * Slash command names to hide/disable. | ||||||
| * Equivalent to CLI's `--disabled-slash-commands` flag. | ||||||
| * Matched case-insensitively against the final command name. | ||||||
| * @example ['/init', '/vim'] | ||||||
| */ | ||||||
|
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 Verified at both matching sites (
Suggested change
Alternatively, strip the leading — qwen3.7-max via Qwen Code /review |
||||||
| disabledSlashCommands?: string[]; | ||||||
|
|
||||||
| /** | ||||||
| * Timeout configuration for various SDK operations. | ||||||
| * All values are in milliseconds. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -352,6 +352,29 @@ describe('ProcessTransport', () => { | |||||
| ); | ||||||
| }); | ||||||
|
|
||||||
| it('should include --disabled-slash-commands when provided', () => { | ||||||
| mockPrepareSpawnInfo.mockReturnValue({ | ||||||
| command: 'qwen', | ||||||
| args: [], | ||||||
| type: 'native', | ||||||
| originalInput: 'qwen', | ||||||
| }); | ||||||
| mockSpawn.mockReturnValue(mockChildProcess); | ||||||
|
|
||||||
| const options: TransportOptions = { | ||||||
| pathToQwenExecutable: 'qwen', | ||||||
| disabledSlashCommands: ['/init', '/vim'], | ||||||
| }; | ||||||
|
|
||||||
|
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. [Suggestion] Test values
Suggested change
Also update the assertion: expect.arrayContaining(['--disabled-slash-commands', 'init,vim']),— qwen3.7-max via Qwen Code /review |
||||||
| new ProcessTransport(options); | ||||||
|
|
||||||
| expect(mockSpawn).toHaveBeenCalledWith( | ||||||
| 'qwen', | ||||||
| expect.arrayContaining(['--disabled-slash-commands', '/init,/vim']), | ||||||
| expect.any(Object), | ||||||
| ); | ||||||
| }); | ||||||
|
|
||||||
| it('should throw if aborted before initialization', () => { | ||||||
| mockPrepareSpawnInfo.mockReturnValue({ | ||||||
| command: 'qwen', | ||||||
|
|
||||||
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] Test values
["/init", "/vim"]use slash-prefixed names, but the CLI expects bare names ('init','vim'). This propagates the incorrect format as test-as-documentation — developers reading this test will copy the slash-prefixed format.Also update the assertion:
— qwen3.7-max via Qwen Code /review