Commit Graph

5316 Commits

Author SHA1 Message Date
suyao
007848db82
Merge branch 'migrate/v6-2' into migrate/v6-3 2026-01-02 15:39:43 +08:00
suyao
51908fbd01
Merge branch 'migrate/v6' into migrate/v6-2 2026-01-02 15:39:14 +08:00
suyao
59c613efd9
Merge branch 'feat/update-t2i-image' into migrate/v6 2026-01-02 15:38:00 +08:00
suyao
025d4a678f
fix: comment 2026-01-02 15:36:01 +08:00
suyao
f3975b1b08
chore: comment 2 2026-01-02 15:07:31 +08:00
suyao
f2029f82b3
chore: comment 2026-01-02 15:07:07 +08:00
suyao
8cb2fca776
chore: remove legacy code 2026-01-02 15:03:14 +08:00
suyao
953b6d3042
refactor: use ai sdk getFromApi 2026-01-02 09:38:34 +08:00
suyao
538ebd281e
Merge branch 'migrate/v6' into migrate/v6-2 2026-01-02 09:07:50 +08:00
suyao
5bb7a00f93
Merge remote-tracking branch 'origin/main' into migrate/v6 2026-01-02 09:06:31 +08:00
suyao
f7ee2fc934
refactor: add ai-sdk embedFunc and remove legacy 2026-01-02 08:59:27 +08:00
suyao
53a2e06120
refactor: migrate to ai sdk imageFunc 2026-01-02 08:19:50 +08:00
suyao
8d37dc6385
chore: remove unuse var 2026-01-02 07:10:55 +08:00
suyao
ac69b5cf2a
test: add type test 2026-01-02 07:09:42 +08:00
suyao
acaeab90c8
refactor: scripts 2026-01-02 07:02:29 +08:00
suyao
95bebfbe8e
fix: ai core check 2026-01-02 06:54:30 +08:00
suyao
000e867161
fix: ai core typecheck 2026-01-02 06:47:34 +08:00
suyao
ab6e7a13d6
fix: add packages/aiCore to scripts and fix related bug in test 2026-01-02 06:42:37 +08:00
suyao
d92d52cee0
fix: typecheck 2026-01-02 06:14:40 +08:00
suyao
f210fa077d
chore: format 2026-01-02 04:00:37 +08:00
suyao
cd7e27e111
Merge remote-tracking branch 'origin/main' into migrate/v6-2 2026-01-02 03:38:52 +08:00
suyao
0507945a8a
docs: add ai core docs 2026-01-02 03:23:10 +08:00
suyao
f805ddc285
refactor(aiCore): restructure test utilities and fix failing tests
- Move test utilities from src/__tests__/ to test_utils/
- Fix ModelResolver tests for simplified API (2 params instead of 4)
- Fix generateImage/generateText tests with proper vi.fn() mocks
- Fix ExtensionRegistry.parseProviderId to check variants before aliases
- Add createProvider method overload for dynamic provider IDs
- Update ProviderExtension tests for runtime validation behavior
- Delete outdated tests: initialization.test.ts, extensions.integration.test.ts, executor-resolveModel.test.ts
- Remove 3 skipped tests for removed validate hook
- Add HubProvider.integration.test.ts
- All 359 tests passing, 0 skipped

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-02 03:15:50 +08:00
suyao
2e97d07c10
refactor: enforce mutual exclusivity of create and import in ProviderExtensionConfig
Use TypeScript discriminated union types to prevent using both `create` and `import`
options simultaneously in ProviderExtensionConfig at compile time. This replaces runtime
validation with type-level enforcement.

Changes:
- Split ProviderExtensionConfig into a union of ProviderExtensionConfigWithCreate and ProviderExtensionConfigWithImport
- Extract shared properties into ProviderExtensionConfigBase
- Remove runtime validation checks that are now handled by the type system
- Clean up unused import in HubProvider.test.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-02 00:14:59 +08:00
suyao
8f79af2797
refactor: remove branded export from types index
Remove unused `export type * from './branded'` line since branded.ts was already deleted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-01 23:51:12 +08:00
suyao
9024eea727
Merge branch 'migrate/v6' into migrate/v6-2 2026-01-01 23:46:45 +08:00
suyao
0f276a3f1d
refactor: remove ProviderId 2026-01-01 23:30:14 +08:00
suyao
75832a1610
refactor: remove unused branded types
- Remove packages/aiCore/src/core/types/branded.ts (ModelId, ProviderId, RequestId types were not used anywhere)
- Update packages/aiCore/src/index.ts to remove branded type exports

All tests passing (164/165 test files, 2933/2934 tests)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-01 23:29:00 +08:00
suyao
2e7c6438bd
test: fix test failures in migrate/v6 branch
- Add missing jsonSchema export to ai mock in HubProvider and RegistryManagement tests
- Add missing generateImage and jsonSchema exports to ai mock in generateImage test
- Fix totalTokens calculation in convertClaudeCodeUsage (inputTokens + outputTokens)
- Update usage assertions in transform tests to use toMatchObject instead of toEqual

All tests now passing (165 test files, 2934 tests passed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-01 23:13:38 +08:00
suyao
7268d8eef2
fix: provider initialization 2026-01-01 22:54:16 +08:00
suyao
372d4501fc
fix: test 2026-01-01 21:34:26 +08:00
suyao
e3351097a9
refactor:type inference 2026-01-01 19:33:10 +08:00
Northword
77e024027c
fix(miniapps): switch to new google ai studio logo (#12229) 2026-01-01 19:13:24 +08:00
Phantom
d391e55a8a
refactor(ovms): lazy-load OVMS support check with SWR (#12226) 2026-01-01 16:40:12 +08:00
Here_is_Daiyu
f878c8ab3b
Update minimax API documentation link (#12220) 2026-01-01 16:36:52 +08:00
suyao
42ff133732
refactor: type safety 2026-01-01 16:03:27 +08:00
Phantom
33cdcaa558
fix(ovms): add platform check to prevent errors on non-Windows systems (#12125)
* fix(ovms): make ovms manager windows-only and lazy load it

Add platform check in OvmsManager constructor to throw error on non-Windows platforms
Lazy load ovmsManager instance and handle IPC registration only on Windows
Update will-quit handler to conditionally cleanup ovms resources

* feat(preload): add windows-only OVMS API and improve type safety

Extract OVMS API methods into a separate windowsOnlyApi object for better organization
Add explicit return type for getDeviceType method

* feat(system): add system utils and refine ovms support check

- Add new system utility functions for device type, hostname and CPU name
- Refactor OVMS support check to require both Windows and Intel CPU
- Update IPC handlers to use new system utils and provide proper OVMS fallbacks

* Revert "feat(preload): add windows-only OVMS API and improve type safety"

This reverts commit d7c5c2b9a4.

* feat(ovms): add support check for ovms provider

Add new IPC channel and handler to check if OVMS is supported on the current system. This replaces the previous device type and CPU name checks with a more maintainable solution.

* fix(OvmsManager): improve intel cpu check for ovms manager

Move isOvmsSupported check before class definition and update error message to reflect intel cpu requirement

* fix: use isOvmsSupported flag for ovms cleanup check

Replace platform check with feature flag to properly determine if ovms cleanup should run

* fix: improve warning message for undefined ovmsManager

* fix(system): handle edge cases in getCpuName function

Add error handling and null checks to prevent crashes when CPU information is unavailable

* feat(runtime): add ovms support check during app init

Add isOvmsSupported state to runtime store and check support status during app initialization. Move ovms support check from ProviderList component to useAppInit hook for centralized management.
2025-12-31 22:24:53 +08:00
beyondkmp
bc9eeb9f30
feat: add fuzzy search for file list with relevance scoring (#12131)
* feat: add fuzzy search for file list with relevance scoring

- Add fuzzy option to DirectoryListOptions (default: true)
- Implement isFuzzyMatch for subsequence matching
- Add getFuzzyMatchScore for relevance-based sorting
- Remove searchByContent method (content-based search)
- Increase maxDepth to 10 and maxEntries to 20

* perf: optimize fuzzy search with ripgrep glob pre-filtering

- Add queryToGlobPattern to convert query to glob pattern
- Use ripgrep --iglob for initial filtering instead of loading all files
- Reduces memory footprint and improves performance for large directories

* feat: add greedy substring match fallback for fuzzy search

- Add isGreedySubstringMatch for flexible matching
- Fallback to greedy match when glob pre-filter returns empty
- Allows 'updatercontroller' to match 'updateController.ts'

* fix: improve greedy substring match algorithm

- Search from longest to shortest substring for better matching
- Fix issue where 'updatercontroller' couldn't match 'updateController'

* docs: add fuzzy search documentation (en/zh)

* refactor: extract MAX_ENTRIES_PER_SEARCH constant

* refactor: use logarithmic scaling for path length penalty

- Replace linear penalty (0.8 * length) with logarithmic scaling
- Prevents long paths from dominating the score
- Add PATH_LENGTH_PENALTY_FACTOR constant with explanation

* refactor: extract scoring constants with documentation

- Add named constants for scoring factors (SCORE_SEGMENT_MATCH, etc.)
- Update en/zh documentation with scoring strategy explanation

* refactor: move PATH_LENGTH_PENALTY_FACTOR to class level constant

* refactor: extract buildRipgrepBaseArgs helper method

- Reduce code duplication for ripgrep argument building
- Consolidate directory exclusion patterns and depth handling

* refactor: rename MAX_ENTRIES_PER_SEARCH to MAX_SEARCH_RESULTS

* fix: escape ! character in glob pattern for negation support

* fix: avoid duplicate scoring for filename starts and contains

* docs: clarify fuzzy search filtering and scoring strategies

* fix: limit word boundary bonus to single match

* fix: add dedicated scoring for greedy substring match

- Add getGreedyMatchScore function that rewards fewer fragments and tighter matches
- Add isFuzzyMatch validation before scoring in fuzzy glob path
- Use greedy scoring for fallback path to properly rank longest matches first

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>

---------

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-30 19:42:56 +08:00
jardel
068cf1083c
fix: use HTML content for markdown copy button (#12187) 2025-12-30 13:35:15 +08:00
nujabse
ed4353b054
fix: align MCP tool ids for permissions (#12127)
* fix(agents): align MCP tool IDs for permissions

Normalize legacy MCP allowlist entries so auto-approval matches SDK tool names.

Signed-off-by: mathholic <h.p.zhumeng@gmail.com>

* fix: normalize mcp tool ids in sessions

Signed-off-by: macmini <h.p.zhumeng@gmail.com>

* fix: align mcp tool ids with buildFunctionCallToolName

---------

Signed-off-by: mathholic <h.p.zhumeng@gmail.com>
Signed-off-by: macmini <h.p.zhumeng@gmail.com>
2025-12-30 13:33:09 +08:00
suyao
415ca39b35
chore: format 2025-12-30 00:11:30 +08:00
suyao
fd12792d6b
refactor: remove obsolete Claude Code mapping functions and integrate new utility functions for finish reason mapping and usage conversion 2025-12-29 23:38:54 +08:00
suyao
5bb19b3e30
refactor: update package dependencies to use patch versions for @ai-sdk/google and @ai-sdk/openai-compatible 2025-12-29 21:36:01 +08:00
suyao
42b4a8f7d1
refactor: improve type imports and simplify system message handling in plugin functions 2025-12-29 19:39:55 +08:00
suyao
9ee15ceec9
refactor: improve type safety and documentation in PluginManager and PluginEngine 2025-12-29 19:22:12 +08:00
LiuVaayne
528d6d37f2
refactor: simplify buildFunctionCallToolName to use mcp__{server}__{tool} format (#12186) 2025-12-29 18:52:58 +08:00
LiuVaayne
efbe64e5da
feat(tokenflux): add Anthropic host support using OpenRouter package (#12188)
* feat(tokenflux): add Anthropic host support using OpenRouter package

- Add anthropicApiHost to TokenFlux provider config
- Map TokenFlux to OpenRouter in STATIC_PROVIDER_MAPPING for full compatibility

* feat(tokenflux): update API URLs and add migration

- Update apiHost to https://api.tokenflux.ai/openai/v1
- Update anthropicApiHost to https://api.tokenflux.ai/anthropic
- Add migration 191 to update existing TokenFlux users

* fix(tokenflux): add to Anthropic compatible providers list

Enable Anthropic API host configuration in TokenFlux provider settings UI
2025-12-29 18:24:57 +08:00
suyao
3c23c32232
Add comprehensive tests for PluginEngine functionality
- Implement tests for plugin registration, management, and lifecycle
- Validate plugin execution order and context management
- Test model resolution, parameter transformation, and result transformation
- Ensure error handling and recursive call support
- Cover streaming execution and image model handling
- Verify type safety for plugin parameters
2025-12-29 17:11:11 +08:00
suyao
fca41ed966
refactor: remove obsolete middleware and README, add new plugins for reasoning and tool selection
- Deleted README.md for AiSdkMiddlewareBuilder as it was outdated.
- Removed toolChoiceMiddleware.ts as it is no longer needed.
- Introduced new plugins:
  - noThinkPlugin: Appends '/no_think' to user messages to prevent unnecessary thinking.
  - openrouterGenerateImagePlugin: Configures OpenRouter for image and text modalities.
  - openrouterReasoningPlugin: Redacts reasoning blocks in OpenRouter responses.
  - qwenThinkingPlugin: Controls thinking mode for Qwen models based on provider support.
  - reasoningExtractionPlugin: Extracts reasoning tags from OpenAI/Azure responses.
  - simulateStreamingPlugin: Converts non-streaming responses to streaming format.
  - skipGeminiThoughtSignaturePlugin: Skips Gemini3 thought signatures for multi-model requests.
- Updated parameterBuilder.ts to correct type definitions.
- Added middlewareConfig.ts for better middleware configuration management.
- Enhanced reasoning utility functions for better tag name retrieval.
- Updated ApiService.ts and aiCoreTypes.ts for consistency with new changes.
2025-12-29 14:48:24 +08:00
tylinux
cccf9bb7be
feat: add latest zhipu models (#12169) 2025-12-28 19:11:08 +08:00