Commit graph

76 commits

Author SHA1 Message Date
顾盼
aeeb2976d6
feat(web-search): remove built-in web_search tool, replace with MCP-based approach (#3502)
* feat(web-search): add GLM (ZhipuAI) web search provider

- Add GlmProvider class implementing BaseWebSearchProvider using the
  ZhipuAI Web Search API (https://open.bigmodel.cn/api/paas/v4/web_search)
- Support multiple search engines: search_std, search_pro, search_pro_sogou,
  search_pro_quark
- Support optional config: maxResults, searchIntent, searchRecencyFilter,
  contentSize, searchDomainFilter
- Truncate query to 70 characters per API limit
- Register 'glm' in the provider discriminated union (types.ts) and
  createProvider() switch (index.ts)
- Add GlmProviderConfig to settingsSchema, ConfigParams, and Config class
- Add --glm-api-key CLI flag and GLM_API_KEY env var support in webSearch.ts
- Forward GLM_API_KEY in sandbox environment
- Update provider priority list: Tavily > Google > GLM > DashScope
- Add 17 unit tests for GlmProvider and 4 integration tests in index.test.ts
- Update docs/developers/tools/web-search.md with GLM configuration,
  env vars, CLI args, pricing, and corrected DashScope billing info
- Fix stale OAuth/free-tier references in web-search.md

Closes #3496

* docs(web-search): fix DashScope note and add GLM server-side limitations

* fix(web-search): make DashScope provider work with standard API key, remove qwen-oauth dependency

- DashScopeProvider.isAvailable() now checks config.apiKey instead of authType
- Remove OAuth credential file reading and resource_url requirement
- Use standard DashScope endpoint: dashscope.aliyuncs.com/api/v1/indices/plugin/web_search
- Read DASHSCOPE_API_KEY env var and --dashscope-api-key CLI flag
- Forward DASHSCOPE_API_KEY into sandbox environment
- Update integration test to detect DASHSCOPE_API_KEY
- Update docs to reflect new API key based configuration

* feat(web-search): remove built-in web search tool

The web_search tool and all related provider implementations are removed.
Web search functionality will be provided via MCP integrations instead,
which is the direction the broader agent ecosystem is moving.

Removed:
- packages/core/src/tools/web-search/ (entire directory)
- packages/cli/src/config/webSearch.ts
- integration-tests/cli/web_search.test.ts
- ToolNames.WEB_SEARCH, ToolErrorCode.WEB_SEARCH_FAILED
- webSearch config in ConfigParams, Config class, settingsSchema
- CLI options: --tavily-api-key, --google-api-key, --google-search-engine-id,
  --glm-api-key, --dashscope-api-key, --web-search-default
- Sandbox env forwarding for TAVILY/GLM/DASHSCOPE/GOOGLE search keys
- web_search from rule-parser, permission-manager, speculation gate,
  microcompact tool set, and builtin-agents tool list

* fix: remove websearch reference

* docs: remove websearch tool

* docs: add break change guide

* fix review
2026-04-24 11:29:02 +08:00
chinesepowered
ed6f9e056e
fix(sdk): settle pending next() promise in Stream.return() to prevent hangs (#2981)
* fix(sdk): settle pending next() promise in Stream.return() to prevent hangs

* test(sdk): add regression tests for Stream.return() pending-promise cleanup
2026-04-18 09:46:56 +08:00
Reid
d439e7d738
fix(sdk): avoid leaking process exit listeners in ProcessTransport (#3295)
* fix(sdk): avoid leaking process exit listeners in ProcessTransport

* Strengthen ProcessTransport cleanup during process exit.

  This updates the shared process-exit cleanup path to use a best-effort
  SIGTERM/SIGKILL sequence and adds coverage to verify the global exit
  handler terminates all active child processes.

  It keeps the listener leak fix in place while closing the remaining gaps
  found in review.
2026-04-16 10:52:19 +08:00
Shaojin Wen
1486e85385
feat(cli/sdk): expose /context usage data in non-interactive mode and SDK API (#2916)
Some checks are pending
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
* feat(cli): implement non-interactive /context output and diagnostic

- Extract collectContextData() from contextCommand.ts for shared usage.
- Register /context in ALLOWED_BUILTIN_COMMANDS_NON_INTERACTIVE.
- Extend SDK control protocol with GET_CONTEXT_USAGE request.
- Implement handleGetContextUsage in SystemController for programmatic token queries.
- Expose getContextUsage() method in the TypeScript SDK Query interface.

* fix: address review feedback and fix critical bugs in context usage feature

- Add missing `get_context_usage` route in ControlDispatcher (SDK calls would throw)
- Fix `executionMode` defaulting: use `?? 'interactive'` to match other commands
- Validate dynamic import of `collectContextData` before invoking
- Preserve original error message in handleGetContextUsage catch block
- Add ControlDispatcher test for get_context_usage routing
- Add JSDoc comment for context command in non-interactive allowlist

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: re-check abort signal after async operations in handleGetContextUsage

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: add getContextUsage() to SDK TypeScript documentation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: clarify getContextUsage showDetails is a display hint, not a data filter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: make showDetails affect response shape, add getContextUsage test

- When showDetails is false, return empty detail arrays instead of full
  data so /context and /context detail produce different payloads
- Add unit test for Query.getContextUsage() covering request payload
  and response handling

* fix: strip UI type from SDK response, sync Java SDK protocol

- Remove leaked `type: 'context_usage'` from control response payload
- Add GET_CONTEXT_USAGE to Java SDK protocol mirror (enum, interface,
  union type)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 03:28:32 +08:00
tanzhenxin
63f1963377
Merge pull request #2698 from QwenLM/refactor/subagent-model-selection
feat: add cross-provider model selection for subagents
2026-04-01 16:17:54 +08:00
github-actions[bot]
c7faae7b6e chore(release): sdk-typescript v0.1.6 2026-03-30 04:01:57 +00:00
tanzhenxin
ad20049a4e Merge remote-tracking branch 'origin/main' into refactor/subagent-model-selection 2026-03-27 11:56:29 +08:00
tanzhenxin
5d58b2f112 feat: simplify subagent model configuration with model selector
Refactor subagent model configuration from nested modelConfig object to a simple model string field for better UX and clarity.

Changes:
- Replace modelConfig object with model string in SubagentConfig interface
- Add model-selection.ts utility for parsing and validating model selectors
- Support 'inherit' keyword and bare model IDs (e.g., 'glm-5', 'claude-sonnet-4-6')
- Maintain backward compatibility by parsing legacy modelConfig frontmatter
- Update validation to reject cross-provider authType-prefixed selectors
- Update SDK types (TypeScript and Java) to reflect new schema
- Add comprehensive tests for model selection and validation
- Update documentation with model selection examples

Breaking changes:
- modelConfig.frontmatter field deprecated in favor of model field
- Cross-provider model selectors (e.g., 'openai:gpt-4') not supported for subagents

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-27 11:49:45 +08:00
mingholy.lmh
43bb14ddc9 docs(sdk): enhance coreTools/excludeTools/allowedTools documentation with permissions reference
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-24 22:26:54 +08:00
DragonnZhang
ee33a3c35e feat: add system prompt customization options in SDK and CLI 2026-03-16 02:57:31 +08:00
mingholy.lmh
82dc79629c feat: enhance session ID handling and error propagation 2026-02-13 21:41:38 +08:00
mingholy.lmh
5d939fdb83 feat: add --session-id support for CLI and SDK
- Add --session-id flag to CLI for specifying custom session ID
- Add sessionId option to SDK QueryOptions
- Implement UUID validation for session IDs
- Pass session ID from SDK to CLI via --session-id argument
- Add integration tests for session-id functionality
- Update unit tests for ProcessTransport

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-13 21:40:57 +08:00
LaZzyMan
3f04217458 fix: prevent AbortSignal listener memory leak
- Add abort listener cleanup in Query.close() to prevent memory leak
- Add abort listener cleanup in ControlDispatcher.shutdown()
- Remove AbortController recreation in Session.handleInterrupt()

This fixes the MaxListenersExceededWarning that occurred when:
- Creating 11+ Query instances in SDK/non-interactive mode
- Multiple user interrupts (Ctrl+C) in interactive mode
- Intensive control request scenarios
2026-02-12 10:39:19 +08:00
tanzhenxin
4d29d1fbb5
Merge pull request #1738 from QwenLM/feat/promote-skills-to-stable
feat: promote Agent Skills from experimental to stable
2026-02-06 17:52:39 +08:00
tanzhenxin
a4ffc6eb24 feat: promote Agent Skills from experimental to stable
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-06 13:04:08 +08:00
Mingholy
5c582e98c6
Merge pull request #1732 from QwenLM/mingholy/fix/sdk-release-workflow
Some checks are pending
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
Add CLI source selection for SDK releases and fix subagent output handler
2026-02-06 13:01:05 +08:00
mingholy.lmh
77a8698bc5 ci(sdk-release): fix nightly and preview version calculation based on npm latest+1 patch
- Add getNextPatchVersion() to calculate next patch version from npm latest
- Fix getNightlyVersion() to use npm latest + 1 patch instead of package.json
- Fix getPreviewVersion() to use npm latest + 1 patch instead of nightly version
- Add version info logging in workflow for dry-run verification

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-06 12:34:31 +08:00
mingholy.lmh
39884cc6a1 ci(sdk-release): fix CLI package path handling
- Remove dist/ directory requirement from workflow (CLI files are in package root)
- Update bundle-cli-from-npm.js to use package root directly instead of package/dist

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-05 22:06:08 +08:00
mingholy.lmh
1e05359881 ci(sdk-release): add CLI source selection for SDK releases
- Replace cli_ref input with cli_source choice (build_from_source or npm_latest)
- Add support for bundling latest stable CLI from npm
- Add bundle-cli-from-npm.js script for npm-based CLI bundling
- Fix property naming in nonInteractiveCli.ts (outputUpdateHandler)
- Improve integration tests for subagents
- Skip creating issue on failure during dry-run mode

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-05 20:57:01 +08:00
tanzhenxin
7d50f5363f
Merge pull request #1726 from QwenLM/mingholy/fix/sdk-resume-usage
feat(sdk): add resume, continue options and extend authType support
2026-02-05 19:03:25 +08:00
tanzhenxin
03b2cfbbde
Merge pull request #1719 from QwenLM/mingholy/fix/patch-process-transport-for-electron
Add FORK_MODE support to ProcessTransport for Electron IPC integration
2026-02-05 19:02:30 +08:00
mingholy.lmh
675a8fd058 feat(sdk): add resume, continue options and extend authType support
- Add 'resume' and 'continue' options to TransportOptions for session restoration
- Extend authType to support all CLI authentication types:
  - use_openai, use_anthropic, qwen_oauth, use_gemini, use_vertex_ai
- Update type definitions and validation schemas accordingly

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-05 17:53:03 +08:00
mingholy.lmh
ed3ffe2aa2 fix(sdk): improve FORK_MODE to support bun and fallback to spawn for native type
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-05 17:39:12 +08:00
Mingholy
2d75d82ec8 feat(sdk): add FORK_MODE support for Electron integration
- Rename USE_FORK_FOR_ELECTRON to FORK_MODE
- Add fork mode in ProcessTransport for Electron IPC support
- Add comprehensive unit tests for fork mode

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-02-04 23:14:26 +08:00
DragonnZhang
417007d243 feat(query): add support for resuming sessions with session ID 2026-02-04 14:53:22 +08:00
github-actions[bot]
60cfd70ab1 chore(release): sdk-typescript v0.1.4 2026-01-27 13:53:28 +00:00
mingholy.lmh
810b03c23d fix: failed unit test 2026-01-27 20:07:35 +08:00
mingholy.lmh
b05de7a187 test: improve sdk integration tests 2026-01-27 17:10:36 +08:00
Mingholy
7177b41120
Merge pull request #1588 from QwenLM/mingholy/fix/sdk-request
Some checks are pending
Qwen Code CI / CodeQL (push) Waiting to run
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
fix: cli input stream handling and error management
2026-01-27 09:56:45 +08:00
tanzhenxin
3d6fe23c3b refactor(sdk,vscode): extract CLI bundling to dedicated script
- Move CLI bundling logic from build.js to bundle-cli.js in SDK package
- Add bundle:cli script to SDK package.json lifecycle hooks
- Remove redundant Build and Bundle step from workflow (prepackage handles it)
- Add repo build step to prepackage.js to ensure workspace artifacts exist
- Fix Windows workspace symlink issue by running npm install from tmpdir
- Remove lint/typecheck from prepackage (handled elsewhere in CI)
2026-01-24 11:35:33 +08:00
mingholy.lmh
f578ff07a2 fix: cli input stream handling and error management, improve e2e and unit tests 2026-01-23 13:56:38 +08:00
tanzhenxin
35c865968f chore: remove tiktoken dependency and replace with character-based token estimation 2026-01-17 22:39:18 +08:00
github-actions[bot]
e3eccb5987 chore(release): sdk-typescript v0.1.3 2026-01-13 12:59:45 +00:00
mingholy.lmh
64291db926 fix: misc issues in qwen-oauth models, sdk cli path resolving.
1. remove `generationConfig`` of qwen-oauth models
2. fix esm issues when sdk trying to spawn cli
2026-01-13 17:19:15 +08:00
github-actions[bot]
4bd01d592b chore(release): sdk-typescript v0.1.2 2026-01-12 08:25:25 +00:00
mingholy.lmh
9670456a56 fix: simplify JavaScript runtime detection to fix powershell spawning process issue 2026-01-12 13:42:24 +08:00
mingholy.lmh
7d40e1470c chore: add CODEOWNERS for SDK TypeScript package and remove legacy CLI path alias 2026-01-11 21:24:45 +08:00
mingholy.lmh
587fc82fbc chore: update version to 0.1.1 in package.json 2026-01-09 17:54:59 +08:00
mingholy.lmh
8705f734d0 fix: improve bundled CLI path finding and support --experimental-skills 2026-01-09 16:32:55 +08:00
mingholy.lmh
8c109be48c refactor: unified allow list of supported commands in ACP or non-interactive mode 2025-12-26 17:55:03 +08:00
mingholy.lmh
4efdea0981 chore: revert sdk-typescript version to 0.1.0 and update release workflow 2025-12-24 11:04:33 +08:00
Mingholy
add35d2904
Merge pull request #1321 from QwenLM/mingholy/fix/sdk-cli-path
fix: cli path parsing issue in Windows
2025-12-24 10:35:52 +08:00
mingholy.lmh
4f970c9987 fix: cli path parsing issue in Windows 2025-12-23 19:00:43 +08:00
tanzhenxin
fefc138485 Merge branch 'main' into feat/gemini-3-integration 2025-12-22 10:08:15 +08:00
tanzhenxin
9cc5c3ed8f pump version to 0.6.0 2025-12-22 09:35:30 +08:00
tanzhenxin
17129024f4 Add Gemini provider, remove legacy Google OAuth, and tune generation defaults 2025-12-19 16:26:54 +08:00
mingholy.lmh
fa7d857945 fix: remove unused cli finding code 2025-12-19 16:18:22 +08:00
mingholy.lmh
3354b56a05 docs(sdk): update sdk docs 2025-12-19 15:47:11 +08:00
mingholy.lmh
d40447cee4 fix: failed test cases 2025-12-19 15:44:04 +08:00
mingholy.lmh
156134d3d4 chore(sdk): bundle CLI into SDK package and inherit the dependencies 2025-12-19 15:44:04 +08:00